国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
3.3KB

  1. <?php
  2. /**
  3. * 百度新闻
  4. *
  5. * @version $Id: baidunews.php 1 14:31 2010年7月12日Z tianya $
  6. * @package DedeBIZ.Administrator
  7. * @copyright Copyright (c) 2020, DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(dirname(__FILE__) . "/config.php");
  12. if (empty($do)) {
  13. include DEDEADMIN . '/templets/baidunews.htm';
  14. } else {
  15. $baidunews = "<?xml version=\"1.0\" encoding=\"" . $cfg_soft_lang . "\" ?>\n";
  16. $baidunews .= "<document>\n";
  17. $baidunews .= "<webSite>$cfg_webname </webSite>\n";
  18. $baidunews .= "<webMaster>$cfg_adminemail </webMaster>\n";
  19. $baidunews .= "<updatePeri>$cfg_updateperi </updatePeri>\n";
  20. $limit = $cfg_baidunews_limit;
  21. if ($limit > 100 || $limit < 1) {
  22. $limit = 100;
  23. }
  24. $query = "SELECT maintable.*, addtable.body, arctype.typename
  25. FROM #@__archives maintable
  26. LEFT JOIN #@__addonarticle addtable ON addtable.aid=maintable.id
  27. LEFT JOIN #@__arctype arctype ON arctype.ID=maintable.typeid
  28. WHERE maintable.channel=1 and maintable.arcrank!=-1 ORDER BY maintable.pubdate DESC LIMIT $limit
  29. ";
  30. $dsql->SetQuery($query);
  31. $dsql->Execute();
  32. while ($row = $dsql->GetArray()) {
  33. $title = dede_htmlspecialchars($row['title']);
  34. $row1 = GetOneArchive($row['id']);
  35. if (strpos($row1['arcurl'], 'http://') === false) {
  36. $link = ($cfg_basehost == '' ? 'http://' . $_SERVER["HTTP_HOST"] . $cfg_cmspath : $cfg_basehost) . $row1['arcurl'];
  37. } else {
  38. $link = $row1['arcurl'];
  39. }
  40. $link = dede_htmlspecialchars($link);
  41. $description = dede_htmlspecialchars(strip_tags($row['description']));
  42. $text = dede_htmlspecialchars(strip_tags($row['body']));
  43. $image = $row['litpic'] == '' ? '' : $row['litpic'];
  44. if ($image != '' && strpos($image, 'http://') === false) {
  45. $image = ($cfg_basehost == '' ? 'http://' . $_SERVER["HTTP_HOST"] . $cfg_cmspath : $cfg_basehost) . $image;
  46. }
  47. //$headlineimg = '';
  48. $keywords = dede_htmlspecialchars($row['keywords']);
  49. $category = dede_htmlspecialchars($row['typename']);
  50. $author = dede_htmlspecialchars($row['writer']);
  51. $source = dede_htmlspecialchars($row['source']);
  52. $pubdate = dede_htmlspecialchars(gmdate('Y-m-d H:i', $row['pubdate'] + $cfg_cli_time * 3600));
  53. $baidunews .= "<item>\n";
  54. $baidunews .= "<title>$title </title>\n";
  55. $baidunews .= "<link>$link </link>\n";
  56. $baidunews .= "<description>$description </description>\n";
  57. $baidunews .= "<text>$text </text>\n";
  58. $baidunews .= "<image>$image </image>\n";
  59. //$baidunews .= "<headlineimages/>\n";
  60. $baidunews .= "<keywords>$keywords </keywords>\n";
  61. $baidunews .= "<category>$category </category>\n";
  62. $baidunews .= "<author>$author </author>\n";
  63. $baidunews .= "<source>$source </source>\n";
  64. $baidunews .= "<pubDate>$pubdate </pubDate>\n";
  65. $baidunews .= "</item>\n";
  66. }
  67. $baidunews .= "</document>\n";
  68. $fp = fopen(dirname(__FILE__) . '/' . $filename, 'w');
  69. fwrite($fp, $baidunews);
  70. fclose($fp);
  71. showmsg("<a href='{$filename}' target=\"_blank\">{$filename} make success</a>", 'javascript:;');
  72. }