[ Index ] |
|
Code source de e107 0.7.8 |
1 <?php 2 /* 3 + ----------------------------------------------------------------------------+ 4 | e107 website system 5 | 6 | ©Steve Dunstan 2001-2002 7 | http://e107.org 8 | jalist@e107.org 9 | 10 | Released under the terms and conditions of the 11 | GNU General Public License (http://gnu.org). 12 | 13 | $Source: /cvsroot/e107/e107_0.7/e107_plugins/rss_menu/rss.php,v $ 14 | $Revision: 1.57 $ 15 | $Date: 2006/11/08 06:51:13 $ 16 | $Author: e107coders $ 17 +----------------------------------------------------------------------------+ 18 */ 19 20 /* 21 Query string: content_type.rss_type.[topic id] 22 1: news 23 5: comments 24 12: downloads (option: specify category) 25 26 Plugins should use an e_rss.php file in their plugin folder 27 ---------------------------------------------------------------- 28 */ 29 30 require_once ("../../class2.php"); 31 32 global $tp; 33 34 require_once(e_PLUGIN."rss_menu/rss_shortcodes.php"); 35 require_once(e_HANDLER."userclass_class.php"); 36 37 if (!is_object($tp->e_bb)) { 38 require_once(e_HANDLER.'bbcode_handler.php'); 39 $tp->e_bb = new e_bbcode; 40 } 41 42 //get language file 43 if (is_readable(e_PLUGIN."rss_menu/languages/".e_LANGUAGE.".php")) { 44 include_once(e_PLUGIN."rss_menu/languages/".e_LANGUAGE.".php"); 45 } else { 46 include_once(e_PLUGIN."rss_menu/languages/English.php"); 47 } 48 49 //get template 50 if (is_readable(THEME."rss_template.php")) { 51 require_once (THEME."rss_template.php"); 52 } else { 53 require_once(e_PLUGIN."rss_menu/rss_template.php"); 54 } 55 56 //query handler 57 list($content_type, $rss_type, $topic_id) = explode(".", e_QUERY); 58 59 //list available rss feeds 60 if (intval($rss_type) == false) { 61 require_once(HEADERF); 62 require_once(e_PLUGIN."rss_menu/rss_template.php"); 63 64 if(!$sql->db_Select("rss", "*", "rss_class='0' AND rss_limit>0 AND rss_topicid NOT REGEXP ('\\\*') ORDER BY rss_name")) 65 { 66 $ns->tablerender(LAN_ERROR, RSS_LAN_ERROR_4); 67 } 68 else 69 { 70 $text = $RSS_LIST_HEADER; 71 while($row=$sql->db_Fetch()) 72 { 73 $text .= $tp -> parseTemplate($RSS_LIST_TABLE, FALSE, $rss_shortcodes); 74 } 75 $text .= $RSS_LIST_FOOTER; 76 $ns->tablerender(RSS_MENU_L2, $text); 77 } 78 79 require_once(FOOTERF); 80 exit; 81 } 82 83 //conversion table for old urls ------- 84 $conversion[1] = "news"; 85 $conversion[5] = "comments"; 86 $conversion[10] = "bugtracker"; 87 $conversion[12] = "download"; 88 //------------------------------------- 89 90 //convert certain old urls so we can check the db entries --------------------- 91 if($topic_id){ 92 //rss.php?1.2.14 (news, rss-2, cat=14) 93 if(is_numeric($content_type) && isset($conversion[$content_type]) ){ 94 $content_type = $conversion[$content_type]; 95 } 96 }else{ 97 //rss.php?1.2 (news, rss-2) --> check = news (check conversion table) 98 if(is_numeric($content_type) && isset($conversion[$content_type]) ){ 99 $content_type = $conversion[$content_type]; 100 } 101 } 102 103 $check_topic = ($topic_id ? " AND rss_topicid = '".$topic_id."' " : ""); 104 105 if(!$sql -> db_Select("rss", "*", "rss_class!='2' AND rss_url='".$content_type."' ".$check_topic." AND rss_limit>0 ")) 106 { 107 //check if wildcard present for topic_id 108 $check_topic = ($topic_id ? " AND rss_topicid = '".str_replace($topic_id, "*", $topic_id)."' " : ""); 109 if(!$sql -> db_Select("rss", "*", "rss_class!='2' AND rss_url='".$content_type."' ".$check_topic." AND rss_limit>0 ")) 110 { 111 require_once(HEADERF); 112 $ns->tablerender("", RSS_LAN_ERROR_1); 113 require_once(FOOTERF); 114 exit; 115 }else{ 116 $row = $sql->db_Fetch(); 117 } 118 }else{ 119 $row = $sql->db_Fetch(); 120 } 121 122 //debugging 123 //echo $check." - ".$content_type." - ".$rss_type." - ".$topic_id."<br />"; 124 //exit; 125 126 // ---------------------------------------------------------------------------- 127 128 if($rss = new rssCreate($content_type, $rss_type, $topic_id, $row)){ 129 $rss_title = ($rss->contentType ? $rss->contentType : ucfirst($content_type)); 130 $rss->buildRss ($rss_title); 131 }else{ 132 require_once(HEADERF); 133 $ns->tablerender(RSS_LAN_ERROR_0, RSS_LAN_ERROR_1); 134 require_once(FOOTERF); 135 exit; 136 } 137 138 class rssCreate { 139 140 var $contentType; 141 var $rssType; 142 var $path; 143 var $parm; 144 var $rssItems; 145 var $rssQuery; 146 var $topicid; 147 var $offset; 148 var $rssNamespace; 149 var $rssCustomChannel; 150 151 function rssCreate($content_type, $rss_type, $topic_id, $row) { 152 // constructor 153 $sql_rs = new db; 154 global $tp, $sql, $e107, $PLUGINS_DIRECTORY, $pref, $rssgen; 155 $this -> path = e_PLUGIN."rss_menu/"; 156 $this -> rssType = $rss_type; 157 $this -> topicid = $topic_id; 158 $this -> offset = $pref['time_offset'] * 3600; 159 $this -> limit = $row['rss_limit']; 160 $this -> contentType = $row['rss_name']; 161 162 if(!is_numeric($content_type)){ 163 $path = e_PLUGIN.$row['rss_path']."/e_rss.php"; 164 } 165 if(strpos($row['rss_path'],'|')!==FALSE){ 166 $tmp = explode("|", $row['rss_path']); 167 $path = e_PLUGIN.$tmp[0]."/e_rss.php"; 168 $this -> parm = $tmp[1]; //parm is used in e_rss.php to define which feed you need to prepare 169 } 170 171 switch ($content_type) { 172 case news: 173 case 1: 174 if($topic_id && is_numeric($topic_id)){ 175 $topic = " AND news_category = ".intval($topic_id); 176 }else{ 177 $topic = ''; 178 } 179 $path=''; 180 $render = ($pref['rss_othernews'] != 1) ? "AND n.news_render_type < 2" : ""; 181 182 $this -> rssQuery = " 183 SELECT n.*, u.user_id, u.user_name, u.user_email, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n 184 LEFT JOIN #user AS u ON n.news_author = u.user_id 185 LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id 186 WHERE n.news_class IN (".USERCLASS_LIST.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") {$render} {$topic} ORDER BY news_datestamp DESC LIMIT 0,".$this -> limit; 187 $sql->db_Select_gen($this -> rssQuery); 188 $tmp = $sql->db_getList(); 189 $this -> rssItems = array(); 190 $loop=0; 191 foreach($tmp as $value) { 192 $this -> rssItems[$loop]['title'] = $value['news_title']; 193 $this -> rssItems[$loop]['link'] = "http://".$_SERVER['HTTP_HOST'].e_HTTP."news.php?item.".$value['news_id'].".".$value['news_category']; 194 if($value['news_summary']){ 195 $this -> rssItems[$loop]['description'] = $value['news_summary']; 196 }else{ 197 $this -> rssItems[$loop]['description'] = $value['news_body']; 198 } 199 $this -> rssItems[$loop]['author'] = $value['user_name']; 200 $this -> rssItems[$loop]['author_email'] = $value['user_email']; 201 $this -> rssItems[$loop]['category'] = "<category domain='".SITEURL."news.php?cat.".$value['news_category']."'>".$value['category_name']."</category>"; 202 203 if($value['news_allow_comments'] && $pref['comments_disabled'] != 1){ 204 $this -> rssItems[$loop]['comment'] = "http://".$_SERVER['HTTP_HOST'].e_HTTP."comment.php?comment.news.".$value['news_id']; 205 } 206 $this -> rssItems[$loop]['pubdate'] = $value['news_datestamp']; 207 208 $loop++; 209 } 210 break; 211 case 2: 212 $path=''; 213 $this -> contentType = "articles"; 214 break; 215 case 3: 216 $path=''; 217 $this -> contentType = "reviews"; 218 break; 219 case 4: 220 $path=''; 221 $this -> contentType = "content"; 222 break; 223 case comments: 224 case 5: 225 $path=''; 226 $this -> rssQuery = "SELECT * FROM #comments ORDER BY comment_datestamp DESC LIMIT 0,".$this -> limit; 227 $sql->db_Select_gen($this -> rssQuery); 228 $tmp = $sql->db_getList(); 229 $this -> rssItems = array(); 230 $loop=0; 231 foreach($tmp as $value) { 232 $this -> rssItems[$loop]['title'] = $value['comment_subject']; 233 234 switch ($value['comment_type']) { 235 case 0: 236 $this -> rssItems[$loop]['link'] = "http://".$_SERVER['HTTP_HOST'].e_HTTP."comment.php?comment.news.".$value['comment_item_id']; 237 break; 238 case 4: 239 $this -> rssItems[$loop]['link'] = "http://".$_SERVER['HTTP_HOST'].e_HTTP."comment.php?comment.poll.".$value['comment_item_id']; 240 break; 241 } 242 243 $this -> rssItems[$loop]['description'] = $value['comment_comment']; 244 $this -> rssItems[$loop]['author'] = substr($value['comment_author'], (strpos($value['comment_author'], ".")+1)); 245 $loop++; 246 } 247 break; 248 249 case 6: 250 case 7: 251 $path = e_PLUGIN."forum/e_rss.php"; 252 break; 253 254 case 8: 255 if(!$this -> topicid) { 256 return FALSE; 257 } 258 $path = e_PLUGIN."forum/e_rss.php"; 259 break; 260 261 /* 262 case 10: 263 $this -> limit = '9'; 264 $path=''; 265 $this -> contentType = "bugtracker reports"; 266 $sql->db_Select("bugtrack2_bugs", "*", "bugtrack2_bugs_status=0 ORDER BY bugtrack2_bugs_datestamp LIMIT 0,".$this -> limit); 267 $tmp = $sql->db_getList(); 268 $this -> rssItems = array(); 269 $loop=0; 270 foreach($tmp as $value) { 271 $nick = preg_replace("/[0-9]+\./", "", $value['bugtrack2_bugs_poster']); 272 $this -> rssItems[$loop]['author'] = $nick; 273 $this -> rssItems[$loop]['title'] = $value['bugtrack2_bugs_summary']; 274 $this -> rssItems[$loop]['link'] = $e107->base_path.$PLUGINS_DIRECTORY."bugtracker2/bugtracker2.php?0.bug.".$value['bugtrack2_bugs_id']; 275 $this -> rssItems[$loop]['description'] = $value['bugtrack2_bugs_description']; 276 $loop++; 277 } 278 break; 279 */ 280 281 case 11: 282 if(!$this -> topicid) { 283 return FALSE; 284 } 285 $path = e_PLUGIN."forum/e_rss.php"; 286 break; 287 288 case download: 289 case 12: 290 if($topic_id && is_numeric($topic_id)){ 291 $topic = "d.download_category='".intval($topic_id)."' AND "; 292 }else{ 293 $topic = ""; 294 } 295 $path=''; 296 $class_list = "0,251,252,253"; 297 $query = "SELECT d.*, dc.* FROM #download AS d LEFT JOIN #download_category AS dc ON d.download_category = dc.download_category_id WHERE {$topic} d.download_active > 0 AND d.download_class IN (".$class_list.") ORDER BY d.download_datestamp DESC LIMIT 0,".$this -> limit; 298 $sql -> db_Select_gen($query); 299 300 // $sql->db_Select("download", "*", "{$topic} download_active > 0 AND download_class IN (".$class_list.") ORDER BY download_datestamp DESC LIMIT 0,".$this -> limit); 301 $tmp = $sql->db_getList(); 302 $this -> rssItems = array(); 303 $loop=0; 304 foreach($tmp as $value) { 305 if($value['download_author']){ 306 $nick = preg_replace("/[0-9]+\./", "", $value['download_author']); 307 $this -> rssItems[$loop]['author'] = $nick; 308 } 309 $this -> rssItems[$loop]['author_email'] = $value['download_author_email']; 310 $this -> rssItems[$loop]['title'] = $value['download_name']; 311 $this -> rssItems[$loop]['link'] = $e107->base_path."download.php?view.".$value['download_id']; 312 $this -> rssItems[$loop]['description'] = ($rss_type == 3 ? $value['download_description'] : $value['download_description']); 313 $this -> rssItems[$loop]['category_name'] = $value['download_category_name']; 314 $this -> rssItems[$loop]['category_link'] = $e107->base_path."download.php?list.".$value['download_category_id']; 315 $this -> rssItems[$loop]['enc_url'] = $e107->base_path."request.php?".$value['download_id']; 316 $this -> rssItems[$loop]['enc_leng'] = $value['download_filesize']; 317 $this -> rssItems[$loop]['enc_type'] = $this->getmime($value['download_url']); 318 $this -> rssItems[$loop]['pubdate'] = $value['download_datestamp']; 319 $loop++; 320 } 321 break; 322 } 323 324 325 if(isset($path) && $path!=''){ 326 327 //new rss reader from e_rss.php in plugin folder 328 if (is_readable($path)) { 329 require_once($path); 330 foreach($eplug_rss_data as $key=>$rs){ 331 foreach($rs as $k=>$row){ 332 $this -> rssItems[$k]['author'] = $row['author']; 333 $this -> rssItems[$k]['author_email'] = $row['author_email']; 334 $this -> rssItems[$k]['title'] = $row['title']; 335 if($row['link']){ 336 if(eregi("http",$row['link'])){ 337 $this -> rssItems[$k]['link'] = $row['link']; 338 }else{ 339 $this -> rssItems[$k]['link'] = $e107->base_path.$PLUGINS_DIRECTORY.$row['link']; 340 } 341 } 342 $this -> rssItems[$k]['description'] = $row['description']; 343 if($row['enc_url']){ 344 $this -> rssItems[$k]['enc_url'] = $e107->base_path.$PLUGINS_DIRECTORY.$enc_url.$row['item_id']; 345 } 346 if($row['enc_leng']){ 347 $this -> rssItems[$k]['enc_leng'] = $row['enc_leng']; 348 } 349 350 if($eplug_rss['enc_type']){ 351 $this -> rssItems[$k]['enc_type'] = $this->getmime($eplug_rss['enc_type']); 352 }elseif($row['enc_type']){ 353 $this -> rssItems[$k]['enc_type'] = $row['enc_type']; 354 } 355 356 $this -> rssItems[$k]['category_name'] = $row['category_name']; 357 if($row['category_link']){ 358 if(eregi("http",$row['category_link'])){ 359 $this -> rssItems[$k]['category_link'] = $row['category_link']; 360 }else{ 361 $this -> rssItems[$k]['category_link'] = $e107->base_path.$PLUGINS_DIRECTORY.$row['category_link']; 362 } 363 } 364 if($row['datestamp']){ 365 $this -> rssItems[$k]['pubdate'] = $row['datestamp']; 366 } 367 } 368 } 369 } 370 } 371 372 } 373 374 function buildRss($rss_title) { 375 global $sql, $pref, $tp, $e107, $PLUGINS_DIRECTORY; 376 header('Content-type: application/xml', TRUE); 377 378 $rss_title = $tp->toRss($pref['sitename']." : ".$rss_title); 379 $rss_namespace = ($this->rssNamespace) ? "xmlns:".$this->rssNamespace : ""; 380 $rss_custom_channel = ($this->rssCustomChannel) ? $this->rssCustomChannel : ""; 381 $time = time(); 382 switch ($this -> rssType) { 383 case 1: // Rss 1.0 384 echo "<?xml version=\"1.0\" encoding=\"".CHARSET."\" ?> 385 <!-- generator=\"e107\" --> 386 <!-- content type=\"".$this -> contentType."\" --> 387 <rss version=\"0.92\"> 388 <channel> 389 <title>".$tp->toRss($rss_title)."</title> 390 <link>".$pref['siteurl']."</link> 391 <description>".$tp->toRss($pref['sitedescription'])."</description> 392 <lastBuildDate>".$itemdate = date("r", ($time + $this -> offset))."</lastBuildDate> 393 <docs>http://backend.userland.com/rss092</docs>\n"; 394 395 foreach($this -> rssItems as $value) 396 { 397 398 // Multi-language rss links. 399 $link = (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['link']) : $value['link']; 400 401 echo " 402 <item> 403 <title>".$tp->toRss($value['title'])."</title> 404 <description>".$tp->toRss(substr($value['description'],0,150))."</description> 405 <author>".$value['author']."<".$this->nospam($value['author_email'])."></author> 406 <link>".$link."</link> 407 </item>"; 408 } 409 echo " 410 </channel> 411 </rss>"; 412 break; 413 414 case 2: // rss 2.0 415 $sitebutton = (strstr(SITEBUTTON, "http:") ? SITEBUTTON : SITEURL.str_replace("../", "", e_IMAGE).SITEBUTTON); 416 echo "<?xml version=\"1.0\" encoding=\"".CHARSET."\"?> 417 <!-- generator=\"e107\" --> 418 <!-- content type=\"".$this -> contentType."\" --> 419 <!-- test=\"".SITEDISCLAIMER."\" --> 420 <rss {$rss_namespace} version=\"2.0\"> 421 <channel> 422 <title>".$tp->toRss($rss_title)."</title> 423 <link>".$pref['siteurl']."</link> 424 <description>".$tp->toRss($pref['sitedescription'])."</description>\n"; 425 426 echo $tp->toRss($rss_custom_channel,TRUE)."\n"; 427 428 echo "<language>".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."</language> 429 <copyright>".preg_replace("#\<br \/\>|\n|\r#si", "", SITEDISCLAIMER)."</copyright> 430 <managingEditor>".$pref['siteadmin']." - ".$this->nospam($pref['siteadminemail'])."</managingEditor> 431 <webMaster>".$this->nospam($pref['siteadminemail'])."</webMaster> 432 <pubDate>".date("r",($time + $this -> offset))."</pubDate> 433 <lastBuildDate>".date("r",($time + $this -> offset))."</lastBuildDate> 434 <docs>http://backend.userland.com/rss</docs> 435 <generator>e107 (http://e107.org)</generator> 436 <ttl>60</ttl> 437 <image> 438 <title>".$tp->toRss($rss_title)."</title> 439 <url>".(strstr(SITEBUTTON, "http:") ? SITEBUTTON : SITEURL.str_replace("../", "", e_IMAGE).SITEBUTTON)."</url> 440 <link>".$pref['siteurl']."</link> 441 <width>88</width> 442 <height>31</height> 443 <description>".$tp->toRss($pref['sitedescription'])."</description> 444 </image> 445 <textInput> 446 <title>Search</title> 447 <description>Search ".$tp->toRss($pref['sitename'])."</description> 448 <name>query</name> 449 <link>".SITEURL.(substr(SITEURL, -1) == "/" ? "" : "/")."search.php</link> 450 </textInput>"; 451 foreach($this -> rssItems as $value) 452 { 453 // Multi-language rss links. 454 $link = (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['link']) : $value['link']; 455 $catlink = (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['category_link']) : $value['category_link']; 456 457 echo " 458 <item> 459 <title>".$tp->toRss($value['title'])."</title>\n"; 460 461 if($link){ 462 echo "<link>".$link."</link>\n"; 463 } 464 465 echo "<description>".$tp->toRss($value['description'],TRUE)."</description>\n"; 466 467 if($value['category_name'] && $catlink){ 468 echo "<category domain='".$catlink."'>".$tp -> toRss($value['category_name'])."</category>\n"; 469 } 470 471 if($value['comment']){ 472 //echo "<comments>".$tp->toRss($value['comment'])."</comments>\n"; 473 echo "<comments>".$value['comment']."</comments>\n"; 474 } 475 476 if($value['author']){ 477 echo "<author>".$value['author']."<".$this->nospam($value['author_email'])."></author>\n"; 478 } 479 480 // enclosure support for podcasting etc. 481 if($value['enc_url'] && $value['enc_leng'] && $value['enc_type']){ 482 echo "<enclosure url=\"".$value['enc_url']."\" length=\"".$value['enc_leng']."\" type=\"".$value['enc_type']."\" />\n"; 483 } 484 485 echo "<pubDate>".date("r", ($value['pubdate'] + $this -> offset))."</pubDate>\n"; 486 487 if($link){ 488 echo "<guid isPermaLink=\"true\">".$link."</guid>\n"; 489 } 490 491 echo "</item>"; 492 } 493 echo " 494 </channel> 495 </rss>"; 496 break; 497 498 case 3: // rdf 499 echo "<?xml version=\"1.0\" encoding=\"".CHARSET."\" ?> 500 <!-- generator=\"e107\" --> 501 <!-- content type=\"".$this -> contentType."\" --> 502 <rdf:RDF xmlns=\"http://purl.org/rss/1.0/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:sy=\"http://purl.org/rss/1.0/modules/syndication/\" xmlns:admin=\"http://webns.net/mvcb/\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\"> 503 <channel rdf:about=\"".$pref['siteurl']."\"> 504 <title>".$tp->toRss($rss_title)."</title> 505 <link>".$pref['siteurl']."</link> 506 <description>".$tp->toRss($pref['sitedescription'])."</description> 507 <dc:language>".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."</dc:language> 508 <dc:date>".$this->get_iso_8601_date($time + $this -> offset). "</dc:date> 509 <dc:creator>".$this->nospam($pref['siteadminemail'])."</dc:creator> 510 <admin:generatorAgent rdf:resource=\"http://e107.org\" /> 511 <admin:errorReportsTo rdf:resource=\"mailto:".$this->nospam($pref['siteadminemail'])."\" /> 512 <sy:updatePeriod>hourly</sy:updatePeriod> 513 <sy:updateFrequency>1</sy:updateFrequency> 514 <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase> 515 <items> 516 <rdf:Seq>"; 517 518 foreach($this -> rssItems as $value) 519 { 520 521 // Multi-language rss links. 522 $link = (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['link']) : $value['link']; 523 524 echo " 525 <rdf:li rdf:resource=\"".$link."\" />"; 526 } 527 528 echo " 529 </rdf:Seq> 530 </items> 531 </channel>"; 532 533 reset($this -> rssItems); 534 unset($link); 535 foreach($this -> rssItems as $value) 536 { 537 538 // Multi-language rss links. 539 $link = (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['link']) : $value['link']; 540 541 echo " 542 <item rdf:about=\"".$link."\"> 543 <title>".$tp->toRss($value['title'])."</title> 544 <link>".$link."</link> 545 <dc:date>".$this->get_iso_8601_date($time + $this -> offset)."</dc:date> 546 <dc:creator>".$value['author']."</dc:creator> 547 <dc:subject>".$tp->toRss($value['category_name'])."</dc:subject> 548 <description>".$tp->toRss($value['description'])."</description> 549 </item>"; 550 } 551 echo " 552 </rdf:RDF>"; 553 break; 554 555 //new feed for atom - still in development, and not yet tested 556 case 4: 557 echo "<?xml version='1.0' encoding='".CHARSET."'?>\n 558 <feed xmlns='http://www.w3.org/2005/Atom'>\n"; 559 /* 560 <feed version='0.3' 561 xmlns='http://purl.org/atom/ns#' 562 xmlns:dc='http://purl.org/dc/elements/1.1/' 563 xml:lang='".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."'>\n"; 564 */ 565 566 //required 567 echo " 568 <id>".$pref['siteurl']."</id>\n 569 <title type='text'>".$tp->toRss($rss_title)."</title>\n 570 <updated>".$this->get_iso_8601_date($time + $this -> offset)."</updated>\n"; 571 572 //recommended 573 echo " 574 <author>\n 575 <name>e107</name>\n"; 576 //<email></email>\n 577 echo " 578 <uri>http://e107.org/</uri>\n 579 </author>\n 580 <link rel='self' href='".$e107->base_path.$PLUGINS_DIRECTORY."rss_menu/".e_PAGE."?".e_QUERY."' />\n"; 581 582 //optional 583 include(e_ADMIN."ver.php"); 584 echo " 585 <category term='e107'/>\n 586 <contributor>\n 587 <name>e107</name>\n 588 </contributor>\n 589 <generator uri='http://e107.org/' version='".$e107info['e107_version']."'>e107</generator>\n"; 590 //<icon>/icon.jpg</icon>\n 591 echo " 592 <logo>".(strstr(SITEBUTTON, "http:") ? SITEBUTTON : SITEURL.str_replace("../", "", e_IMAGE).SITEBUTTON)."</logo>\n 593 <rights type='html'>".$pref['siteadmin']." - ".$this->nospam($pref['siteadminemail'])."</rights>\n"; 594 if($pref['sitedescription']){ 595 echo " 596 <subtitle type='text'>".$pref['sitedescription']."</subtitle>\n"; 597 } 598 foreach($this -> rssItems as $value) { 599 echo " 600 <entry>\n"; 601 602 //required 603 echo " 604 <id>".$value['link']."</id>\n 605 <title type='text'>".$tp->toRss($value['title'])."</title>\n 606 <updated>".$this->get_iso_8601_date($value['pubdate'] + $this -> offset)."</updated>\n"; 607 608 //recommended 609 $author = ($value['author']) ? $value['author'] : "unknown"; 610 611 echo " 612 <author>\n"; 613 echo " 614 <name>".$author."</name>\n"; 615 echo ($value['author_email']) ? "\t\t\t\t\t\t<email>".$this->nospam($value['author_email'])."</email>\n" : ""; 616 echo "</author>\n"; 617 //<content>complete story here</content>\n 618 echo " 619 <link rel='alternate' type='text/html' href='".$value['link']."' />\n 620 <summary type='text'>".$tp->toRss($value['description'])."</summary>\n"; 621 622 //optional 623 if($value['category_name']){ 624 echo "<category term='".$tp -> toRss($value['category_name'])."'/>\n"; 625 } 626 //<contributor> 627 // <name>Jane Doe</name> 628 //</contributor> 629 echo "<published>".$this->get_iso_8601_date($value['pubdate'] + $this -> offset)."</published>\n"; 630 //<source> 631 // <id>http://example.org/</id> 632 // <title>Fourty-Two</title> 633 // <updated>2003-12-13T18:30:02Z</updated> 634 // <rights>© 2005 Example, Inc.</rights> 635 //</source> 636 //<rights type='html'>&copy; 2005 John Doe</rights> 637 echo " 638 </entry>\n"; 639 } 640 echo " 641 </feed>\n"; 642 643 break; 644 } 645 } 646 647 function getmime($file){ 648 $ext = strtolower(str_replace(".","",strrchr(basename($file), "."))); 649 $mime["mp3"] = "audio/mpeg"; 650 return $mime[$ext]; 651 } 652 653 function get_iso_8601_date($int_date) { 654 //$int_date: current date in UNIX timestamp 655 $date_mod = date('Y-m-d\TH:i:s', $int_date); 656 $pre_timezone = date('O', $int_date); 657 $time_zone = substr($pre_timezone, 0, 3).":".substr($pre_timezone, 3, 2); 658 $date_mod .= $time_zone; 659 return $date_mod; 660 } 661 662 function nospam($text){ 663 $tmp = explode("@",$text); 664 return ($tmp[0] != "") ? $tmp[0].RSS_LAN_2 : RSS_LAN_3; 665 } 666 667 } 668 669 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Apr 1 01:23:32 2007 | par Balluche grâce à PHPXref 0.7 |