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

84 lines
3.3KB

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