[Openfirst-cvscommit] SF.net SVN: openfirst: [189] trunk/src/news/rss
Brought to you by:
xtimg
From: <ast...@us...> - 2006-06-23 01:28:48
|
Revision: 189 Author: astronouth7303 Date: 2006-06-22 18:28:43 -0700 (Thu, 22 Jun 2006) ViewCVS: http://svn.sourceforge.net/openfirst/?rev=189&view=rev Log Message: ----------- - Removing VIM modeline - ported to 2.0 Modified Paths: -------------- trunk/src/news/rss/class.RSSBuilder.inc.php trunk/src/news/rss/rss.php Modified: trunk/src/news/rss/class.RSSBuilder.inc.php =================================================================== --- trunk/src/news/rss/class.RSSBuilder.inc.php 2006-06-23 00:23:10 UTC (rev 188) +++ trunk/src/news/rss/class.RSSBuilder.inc.php 2006-06-23 01:28:43 UTC (rev 189) @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4: */ //+----------------------------------------------------------------------+ //| WAMP (XP-SP1/1.3.27/4.0.12/4.3.2) | //+----------------------------------------------------------------------+ @@ -1339,9 +1338,9 @@ if (!isset($this->output)) { $this->createOutput($version); } // end if - header ('content-type: text/xml'); + header('content-type: text/xml'); header('Content-Disposition: inline; filename=rss_' . str_replace(' ','',$this->title) . '.xml'); - $this->output = '<?xml version="1.0" encoding="' . $this->encoding . '"?>' . "\n" . + $this->output = '<'.'?xml version="1.0" encoding="' . $this->encoding . '"?'.'>' . "\n" . '<!-- RSS generated by Flaimo.com RSS Builder [' . date('Y-m-d H:i:s') .'] --> ' . $this->output; echo $this->output; } // end function @@ -1357,7 +1356,7 @@ if (!isset($this->output)) { $this->createOutput($version); } // end if - return (string) '<?xml version="1.0" encoding="' . $this->encoding . '"?>' . "\n" . + return (string) '<'.'?xml version="1.0" encoding="' . $this->encoding . '"?'.'>' . "\n" . '<!-- RSS generated by Flaimo.com RSS Builder [' . date('Y-m-d H:i:s') .'] --> ' . $this->output; } // end function /**#@-*/ @@ -1736,4 +1735,4 @@ } // end function /**#@-*/ } // end class RSSItem -?> \ No newline at end of file +?> Modified: trunk/src/news/rss/rss.php =================================================================== --- trunk/src/news/rss/rss.php 2006-06-23 00:23:10 UTC (rev 188) +++ trunk/src/news/rss/rss.php 2006-06-23 01:28:43 UTC (rev 189) @@ -26,74 +26,68 @@ * */ - if(isset($_GET['headlines'])&&$_GET['headlines']!=""){ - if($_GET['headlines'] == "all"){ - $limit = 9999999; - }else{ - $limit = $_GET['headlines']; - } - } else { - $limit = 5; - } +if(isset($_GET['headlines']) && $_GET['headlines'] != ""){ + if($_GET['headlines'] == "all") { + $limit = 9999999; + } else { + $limit = (int)$_GET['headlines']; + } +} else { + $limit = 5; +} - include_once("../../config/globals.php"); +require_once("../../includes/globals.php"); - ob_start(); - session_start(); - - // Include system RSSBuilder Class - include_once("class.RSSBuilder.inc.php"); +ob_start(); +// Include system RSSBuilder Class +include_once("class.RSSBuilder.inc.php"); - // Create the object - remember, not all attibutes are supported - // by every rss version. just hand over an empty string if you - // don't need a specific attribute +// Create the object - remember, not all attibutes are supported +// by every rss version. just hand over an empty string if you +// don't need a specific attribute - $encoding =(string) 'ISO-8859-1'; - $about = (string) $home; - $title = (string) $title." News"; - $description = (string) 'This is the '.$title.' News RSS Feed'; - $image_link = (string) ''; - $category = (string) ''; // (only rss 2.0) - $cache = (string) 60; // in minutes (only rss 2.0) - $rssfile = new RSSBuilder($encoding, $about, $title, $description, $image_link, $category, $cache); +$encoding = (string) 'utf-8'; +$about = (string) $ogHome; +$title = (string) $ogSiteTitle." News"; +$description = (string) 'This is the '.$ogSiteTitle.' News RSS Feed'; +$image_link = (string) ''; +$category = (string) ''; // (only rss 2.0) +$cache = (string) 60; // in minutes (only rss 2.0) +$rssfile = new RSSBuilder($encoding, $about, $title, $description, $image_link, $category, $cache); - // If you want you can add additional Public Core data to the basic rss file - // (if rss version supports it) - - $publisher = (string) $title; // person, an organization, or a service - $creator = (string) ''; // person, an organization, or a service - $date = (string) date('Y-m-d\TH:i:sO'); - $language = (string) 'en'; - $rights = (string) 'Copyright \xA9 2003 '.$title.' ('.$server.$basepath.')'; - $coverage = (string) ''; // spatial location , temporal period or jurisdiction - $contributor = (string) ''; // person, an organization, or a service - $rssfile->addDCdata($publisher, $creator, $date, $language, $rights, $coverage, $contributor); +// If you want you can add additional Public Core data to the basic rss file +// (if rss version supports it) - // If you want you can add additional Syndication data to the basic - // rss file (if rss version supports it) +$publisher = (string) $ogSiteTitle; // person, an organization, or a service +$creator = (string) ''; // person, an organization, or a service +$date = (string) date('Y-m-d\TH:i:sO'); +$language = (string) 'en'; +$rights = (string) 'Copyright '.ofSymbol('copy').' 2003 '.$ogSiteTitle.' ('.$ogServer.$ogBasePath.')'; +$coverage = (string) ''; // spatial location , temporal period or jurisdiction +$contributor = (string) ''; // person, an organization, or a service +$rssfile->addDCdata($publisher, $creator, $date, $language, $rights, $coverage, $contributor); - $period = (string) 'daily'; // hourly / daily / weekly / ... - $frequency = (int) 5; // every X hours/days/... - $base = (string) date('Y-m-d\TH:i:sO'); - $rssfile->addSYdata($period, $frequency, $base); +// If you want you can add additional Syndication data to the basic +// rss file (if rss version supports it) - // Data for a single RSS item +$period = (string) 'daily'; // hourly / daily / weekly / ... +$frequency = (int) 5; // every X hours/days/... +$base = (string) date('r'); +$rssfile->addSYdata($period, $frequency, $base); - $query = ofirst_dbquery("SELECT * FROM ofirst_news ORDER BY `date` LIMIT $limit"); - while($news = ofirst_dbfetch_object($query)){ +// Data for a single RSS item + +$query = $ogDB->select('news', '*', false, array('order' => 'post_date', 'dir' => 'DESC', 'LIMIT' => $limit)); +while($news = $ogDB->fetchObject($query)){ - $about = $link = $server.$basepath.'/news/readnews.php?ID='.$news->ID; + $about = $link = $ogServer.$ogBasePath.'/news/viewnews.php?ID='.$news->ID; $title = strip_tags($news->title); - if (function_exists('html_entity_decode')){ - $description = html_entity_decode(strip_tags($news->news)); - } else { - $description = str_replace(' ',' ',strip_tags($news->news)); - } + $description = html_entity_decode(strip_tags($news->news)); $subject = (string) ''; // optional DC value - $timestamp=strtotime($news->date); - if ($timestamp!=-1){ - $date = (string) date('Y-m-d\TH:i:sO',$timestamp); - } +/* $timestamp=strtotime($news->post_date); + if ($timestamp!=-1){*/ + $date = (string)date('r', $news->post_date); +/* }*/ $author = (string) $news->poster; // author of item $comments = (string) ''; // url to comment page rss 2.0 value $image = (string) $news->image; // optional mod_im value for dispaying a different pic for every item @@ -105,13 +99,8 @@ // If you don't want to directly output the content, but instead work with the string (for example write it to a cache file) use // $rssfile->getRSSOutput($version); - if(isset($_GET['rss'])){ - $version = $_GET['rss']; - } else { - $version = "2.0"; - } - $rssfile->outputRSS($version); - - ob_end_flush(); +$version = "2.0"; +$rssfile->outputRSS($version); +ob_end_flush(); ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |