|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
-
- require_once(dirname(__FILE__)."/config.php");
-
- if (empty($do)) {
- include DEDEADMIN.'/templets/baidunews.htm';
- } else {
- $baidunews = "<?xml version=\"1.0\" encoding=\"".$cfg_soft_lang."\" ?>\n";
- $baidunews .= "<document>\n";
- $baidunews .= "<webSite>$cfg_webname </webSite>\n";
- $baidunews .= "<webMaster>$cfg_adminemail </webMaster>\n";
- $baidunews .= "<updatePeri>$cfg_updateperi </updatePeri>\n";
-
- $limit = $cfg_baidunews_limit;
- if ($limit > 100 || $limit < 1) {
- $limit = 100;
- }
-
- $query = "SELECT maintable.*, addtable.body, arctype.typename
- FROM #@__archives maintable
- LEFT JOIN #@__addonarticle addtable ON addtable.aid=maintable.id
- LEFT JOIN #@__arctype arctype ON arctype.ID=maintable.typeid
- WHERE maintable.channel=1 and maintable.arcrank!=-1 ORDER BY maintable.pubdate DESC LIMIT $limit
- ";
- $dsql->SetQuery($query);
- $dsql->Execute();
- while ($row = $dsql->GetArray()) {
- $title = dede_htmlspecialchars($row['title']);
- $row1 = GetOneArchive($row['id']);
- if (strpos($row1['arcurl'], 'http://') === false) {
- $link = ($cfg_basehost == '' ? 'http://'.$_SERVER["HTTP_HOST"].$cfg_cmspath : $cfg_basehost).$row1['arcurl'];
- } else {
- $link = $row1['arcurl'];
- }
- $link = dede_htmlspecialchars($link);
- $description = dede_htmlspecialchars(strip_tags($row['description']));
- $text = dede_htmlspecialchars(strip_tags($row['body']));
- $image = $row['litpic'] == '' ? '' : $row['litpic'];
- if ($image != '' && strpos($image, 'http://') === false) {
- $image = ($cfg_basehost == '' ? 'http://'.$_SERVER["HTTP_HOST"].$cfg_cmspath : $cfg_basehost).$image;
- }
-
- $keywords = dede_htmlspecialchars($row['keywords']);
- $category = dede_htmlspecialchars($row['typename']);
- $author = dede_htmlspecialchars($row['writer']);
- $source = dede_htmlspecialchars($row['source']);
- $pubdate = dede_htmlspecialchars(gmdate('Y-m-d H:i', $row['pubdate'] + $cfg_cli_time * 3600));
-
- $baidunews .= "<item>\n";
- $baidunews .= "<title>$title </title>\n";
- $baidunews .= "<link>$link </link>\n";
- $baidunews .= "<description>$description </description>\n";
- $baidunews .= "<text>$text </text>\n";
- $baidunews .= "<image>$image </image>\n";
-
- $baidunews .= "<keywords>$keywords </keywords>\n";
- $baidunews .= "<category>$category </category>\n";
- $baidunews .= "<author>$author </author>\n";
- $baidunews .= "<source>$source </source>\n";
- $baidunews .= "<pubDate>$pubdate </pubDate>\n";
- $baidunews .= "</item>\n";
- }
- $baidunews .= "</document>\n";
-
- $fp = fopen(dirname(__FILE__).'/'.$filename, 'w');
- fwrite($fp, $baidunews);
- fclose($fp);
- showmsg("<a href='{$filename}' target=\"_blank\">{$filename} make success</a>", 'javascript:;');
- }
|