📄 feeds.php
字号:
<?php/*Types of feeds.. rss atom .. then modified/posted/created option Technorati http://www.technorati.com/developers/help/tags/ http://www.atompub.org/2005/08/17/draft-ietf-atompub-format-11.html */defined('WikyBlog') or die("Not an entry point...");global $pageOwner,$dbObject,$lang;$page->displayTitle = 'Google Gadget'; //!!$lang$dbObject->links['?'] = 'Google Gadget';includeFile('search/all.php');class searchFeed extends query{ var $numTables = 0; var $numFields = 0; function searchFeed(){ global $page,$dbInfo,$pageOwner,$lang,$wbTables; $this->rowLimit = 7; // --display-- --database-- $this->fields[$lang['modified']] = 'modified'; $this->fields[$lang['posted']] = 'posted'; $this->allSelect = array('modified','posted','created','username','file_id','keywords'); $this->queryAllFiles(); $this->query .= ' AND '.$wbTables['all_files'].'.owner_id = "'.$pageOwner['user_id'].'" '; $this->query .= ' AND !FIND_IN_SET("hidden", '.$wbTables['all_files'].'.`flags`) '; $this->query .= ' AND !FIND_IN_SET("deleted", '.$wbTables['all_files'].'.`flags`) '; $this->query .= ' AND !FIND_IN_SET("redirect", '.$wbTables['all_files'].'.`flags`) '; //modifications for blog if( isset($_GET['field']) && $_GET['field'] =='blog'){ $_GET['field'] = $lang['posted']; if( isset($pageOwner['sBlog']) && ($pageOwner['sBlog'] == 'On') ){ $this->query .= ' AND FIND_IN_SET("unchecked", '.$wbTables['all_files'].'.`flags`) '; //!!only unused flag.. will need to rename this in a later update } } $this->orderBy(); $this->searchUrl = '/Special/'.$pageOwner['username'].'/searchFeed'; browseSearch3($this,'searchFeed'); //!!$lang } function displayEmpty(){ return true; } function mysqlFetch(&$result){ return mysql_fetch_row($result); } function displayNumbers(&$from,&$to,&$rowsFound,&$prev,&$next){}}// <updated>2003-12-13T18:30:02Z</updated>// <author>// <name>John Doe</name>// </author>// <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>// <entry>// <title>Atom-Powered Robots Run Amok</title>// <link href="http://example.org/2003/12/13/atom03"/>// <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>// <updated>2003-12-13T18:30:02Z</updated>// <summary>Some text.</summary>// </entry>// </feed>class searchFeedAtom extends searchFeed{ function searchFeedAtom(){ $this->searchFeed(); } function displayPre(){ global $lang,$serverName2,$pageOwner,$serverName4; global $page,$serverName1; header('Content-type: text/xml; charset=UTF-8'); //header('Content-type: text/plain; charset=UTF-8'); echo '<?xml version="1.0" encoding="utf-8"?>'; //echo "\n".'<feed xmlns="http://www.w3.org/2005/Atom">'; echo "\n".'<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">'; echo "\n".'<title>'.$pageOwner['username'].' - '.$serverName1.'</title>'; echo "\n".'<link rel="alternate" type="text/html" href="'.$serverName4.'/'.$pageOwner['username'].'/" />'; echo "\n".'<link rel="self" type="application/atom+xml" href="'.$serverName4.'/Special/'.$pageOwner['username'].'/atom" />'; //echo '<id>tag:'.strtolower($serverName2).',2006:'.strtolower($pageOwner['username']).'</id>'; echo '<id>tag:'.strtolower($serverName2).',2006:'.$pageOwner['user_id'].'</id>'; $modified = date('Y-m-d 0:0:0'); //mimic a database timestamp echo '<updated>'.dbFromDate($modified,6).'</updated>'; echo "\n".'<author>'; echo '<name>'.$pageOwner['username'].'</name>'; echo '<uri>'.$serverName4.'/'.$pageOwner['username'].'</uri>'; echo '</author>'; } function displayPost(&$prev,&$pages,&$next){ echo "\n</feed>"; exit();//must end it here } function abbrevOutput(&$row,$i){ global $lang,$serverName2,$serverName4,$pageOwner; $this->queryAllResult($row); echo "\n".'<entry>'; echo '<title>'.toDisplay($row['title']).'</title>'; echo '<link rel="alternate" type="text/html" href="'.$serverName4.$row['uniqLink'].'" />'; echo '<published>'.dbFromDate($row['posted'],6).'</published>'; echo '<updated>'.dbFromDate($row['modified'],6).'</updated>'; //must be unique! use the file_id! //echo '<id>tag:'.strtolower($serverName2).','.dbFromDate($row['created'],4).':'.$row['file_id'].'</id>'; //echo '<id>tag:'.strtolower($serverName2).','.$row['file_id'].'</id>'; echo '<id>tag:'.strtolower($serverName2).',2006:'.$pageOwner['user_id'].'.'.$row['file_id'].'</id>'; //content isn't available because of the database structure $keyArray = explode(',',$row['keywords']); foreach($keyArray as $key){ $key = str_replace(array(': ',':'),'/',$key); $key = str_replace(' ','+',$key); echo '<dc:subject>'.$key.'</dc:subject>'; } echo '</entry>'; }}//RSS 2.0 Feeds//class searchFeedRSS extends searchFeed{ function searchFeedRSS(){ $this->searchFeed(); } function displayPre(){ global $lang,$serverName1,$serverName4,$pageOwner; header('Content-type: text/xml; charset=UTF-8'); //header('Content-type: text/plain; charset=UTF-8'); $this->serverPrefix =& $serverName4; //new echo '<?xml version="1.0" encoding="utf-8" ?>'; echo "\n". '<rss version="2.0">'; echo '<channel>'; echo '<title>'.$pageOwner['username'].' - '.$serverName1.'</title>'; echo '<link>'.$this->serverPrefix.'/'.$pageOwner['username'].'</link>'; echo '<description>'.$pageOwner['username'].' - '.$serverName1.'</description>'; } function displayPost(&$prev,&$pages,&$next){ echo "\n".'</channel></rss>'; exit();//must end it here } function abbrevOutput(&$row,$i){ global $lang,$serverName1; $this->queryAllResult($row); echo "\n".'<item>'; echo '<guid isPermaLink="true">'.$this->serverPrefix.$row['uniqLink'].'</guid>'; echo '<pubDate>'.dbFromDate($row['posted'],5).'</pubDate>'; echo '<title>'.toDisplay($row['dTitle']).'</title>'; echo '<link>'.$this->serverPrefix.$row['uniqLink'].'</link>'; $keyArray = explode(',',$row['keywords']); foreach($keyArray as $key){ $key = str_replace(array(': ',':'),'/',$key); $key = str_replace(' ','+',$key); echo '<category>'.$key.'</category>'; } //content isn't available because of the database structure echo '</item>'; }}/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////* class displayAtom{// function displayPre(){// global $lang,$serverName1,$serverName4,$pageOwner;// // header('Content-type: text/xml; charset=UTF-8');// //header('Content-type: text/plain; charset=UTF-8');// // $this->serverPrefix =& $serverName4;// // // //new// echo '<?xml version="1.0" encoding="utf-8" ?>';// echo "\n". '<rss version="2.0">';// echo '<channel>';// echo '<title>'.$pageOwner['username'].' - '.$serverName1.'</title>';// echo '<link>'.$this->serverPrefix.'/'.$pageOwner['username'].'</link>';// echo '<description>'.$pageOwner['username'].' - '.$serverName1.'</description>';// }// function displayPost($prev,$pages,$next){// echo "\n".'</channel></rss>';// exit();//must end it here// }// // function abbrevOutput(&$row,$i){// global $lang,$serverName1;// // //echo showArray($row);// //echo '<hr>';// // echo "\n".'<item>';// echo '<guid isPermaLink="true">'.$this->serverPrefix.$row->uniqLink.'</guid>';// echo '<pubDate>'.dbFromDate($row->posted,5).'</pubDate>';// echo '<title>'.toDisplay($row->dTitle).'</title>';// echo '<link>'.$this->serverPrefix.$row->uniqLink.'</link>';// // $keyArray = explode(',',$row->keywords);// foreach($keyArray as $key){// $key = str_replace(array(': ',':'),'/',$key);// $key = str_replace(' ','+',$key);// echo '<category>'.$key.'</category>';// }// // // //content isn't available because of the database structure// // echo '</item>';// } // }*/ class displayAtom{ function displayPre(){ global $lang,$serverName2,$pageOwner,$serverName4; global $page,$serverName1; header('Content-type: text/xml; charset=UTF-8'); echo '<?xml version="1.0" encoding="utf-8"?>'; //echo "\n".'<feed xmlns="http://www.w3.org/2005/Atom">'; echo "\n".'<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">'; echo "\n".'<title>'.$pageOwner['username'].' - '.$serverName1.'</title>'; echo "\n".'<link rel="alternate" type="text/html" href="'.$serverName4.'/'.$pageOwner['username'].'/" />'; echo "\n".'<link rel="self" type="application/atom+xml" href="'.$serverName4.'/Special/'.$pageOwner['username'].'/atom" />'; //echo '<id>tag:'.strtolower($serverName2).',2006:'.strtolower($pageOwner['username']).'</id>'; echo '<id>tag:'.strtolower($serverName2).',2006:'.$pageOwner['user_id'].'</id>'; $modified = date('Y-m-d 0:0:0'); //mimic a database timestamp echo '<updated>'.dbFromDate($modified,6).'</updated>'; echo "\n".'<author>'; echo '<name>'.$pageOwner['username'].'</name>'; echo '<uri>'.$serverName4.'/'.$pageOwner['username'].'</uri>'; echo '</author>'; } function displayPost($prev,$pages,$next){ echo "\n</feed>"; exit();//must end it here } function abbrevOutput(&$row,$i){ global $lang,$serverName2,$serverName4,$pageOwner; echo "\n".'<entry>'; echo '<title>'.toDisplay($row->title).'</title>'; echo '<link rel="alternate" type="text/html" href="'.$serverName4.$row->uniqLink.'" />'; echo '<published>'.dbFromDate($row->posted,6).'</published>'; echo '<updated>'.dbFromDate($row->modified,6).'</updated>'; //must be unique! use the file_id! //echo '<id>tag:'.strtolower($serverName2).','.dbFromDate($row['created'],4).':'.$row['file_id'].'</id>'; //echo '<id>tag:'.strtolower($serverName2).','.$row['file_id'].'</id>'; echo '<id>tag:'.strtolower($serverName2).',2006:'.$pageOwner['user_id'].'.'.$row->file_id.'</id>'; //content isn't available because of the database structure $keyArray = explode(',',$row->keywords); foreach($keyArray as $key){ $key = str_replace(array(': ',':'),'/',$key); $key = str_replace(' ','+',$key); echo '<dc:subject>'.$key.'</dc:subject>'; } if( isset($row->content) && !empty($row->content)){ echo '<content type="application/xhtml+xml" xml:lang="en">'; echo '<div xmlns="http://www.w3.org/1999/xhtml">'; $bool = wikiToHtml($row->content,400,$row->flags); echo $row->content; if($bool == true){ echo '... '; echo '<a href="'.$serverName4.$row->uniqLink.'">'.$lang['read_more'].'</a> ('.$bool.$lang['words'].')'; } echo '</div>'; echo '</content>'; } echo '</entry>'; } } function blogFeed(){ global $dbInfo; $displayObj = new displayAtom(); $displayObj->objectType = $GLOBALS['pageOwner']['blogT']; $displayObj->dbInfo = $dbInfo[$GLOBALS['pageOwner']['blogT']]; $displayObj->displayPre(); getBlogPage($displayObj); $displayObj->displayPost(false,false,false); }//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// global $dbObject; $_GET += array('field'=>''); switch($_GET['field']){ case 'blog': blogFeed(); break; } switch($dbObject->title){ case 'atom': new searchFeedAtom(); break; case 'rss': new searchFeedRSS(); break; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -