国内流行的内容管理系统(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.

85 lines
3.4KB

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