linea21-core
[ class tree: linea21-core ] [ index: linea21-core ] [ all elements ]

Source for file rss2.php

Documentation is available at rss2.php

  1. <?php
  2. /**
  3.  * @package linea21.core
  4.  * @subpackage public
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  */
  10.  
  11. include_once('../config/define.php');
  12. include_once('../lib/no_cache.php');
  13. distInclude('../public/'.SQL.'.inc.php'THEME_PUBLIC_DIST);
  14. include_once('../languages/' U_L'/lang_common.' CHARSET '.php');
  15.  
  16.  
  17. ////////////////////////////////////////
  18. /// Connexion SQL
  19. ///////////////////
  20. include_once('../class/system/class.'.SQL.'.php');
  21. $sql_entity=SQL;
  22. $sql_object new $sql_entity;
  23. $sql_object -> DBInitialise();
  24. $sql_object -> DBConnexion();
  25. ///////////////////
  26. $data=$sql_object -> DBSelect(SQL_getRSS2formatedNews());
  27.  
  28. $li_items='';
  29. $content='';
  30. if($data!=0{
  31.  
  32.   for($i=0$i<count($data)$i++{
  33.     $news_id=$data[$i]['news_id'];
  34.     $news_title=$data[$i]['news_title'];
  35.     $news_posted_by=$data[$i]['user_login'];
  36.     $news_header=$data[$i]['news_header'];
  37.     $news_body=$data[$i]['news_body'];
  38.     $news_theme=$data[$i]['theme_name'];
  39.     $news_date=$data[$i]['news_published_date_display'];
  40.     $link_news=array ('rub'=>$GLOBALS['links'][U_L]['news']['linkvalue']'id'=>$news_id'name' => $news_title);
  41.  
  42.     $li_items.='<rdf:li resource="'.CURRENT_APP_URL HrefMaker($link_news).'" />'.END_LINE;
  43.  
  44.  
  45.     $content.='<item rdf:about="'.CURRENT_APP_URL HrefMaker($link_news).'">'.END_LINE;
  46.     $content.='<title>'.$news_title.'</title>'.END_LINE;
  47.     $content.='<link>'.CURRENT_APP_URL HrefMaker($link_news).'</link>'.END_LINE;
  48.     $content.='<dc:date>'.$news_date.'</dc:date>'.END_LINE;
  49.     $content.='<dc:creator>'.$news_posted_by.'</dc:creator>'.END_LINE;
  50.     $content.='<dc:subject>'.$news_theme.'</dc:subject>'.END_LINE;
  51.     $content.='<guid isPermaLink="false">'.$news_id.'@'CURRENT_APP_URL .'</guid>'.END_LINE;
  52.     $content.='<description>'.END_LINE;
  53.     $content.='<![CDATA['.$news_header.' '.$news_body.']]';
  54.     $content.='</description>'.END_LINE;
  55.     $content.='</item>'.END_LINE;
  56.   }
  57. }
  58.  
  59.  
  60.  
  61.  
  62.  
  63. /**
  64.  * HEADER RSS
  65.  ****************************************************************/
  66.  
  67. header('Content-Type: text/xml');
  68. echo '<?xml version="1.0" encoding="UTF-8"?>';
  69. echo '<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"
  70.     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
  71.     xmlns:admin="http://webns.net/mvcb/"
  72.     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  73.     xmlns:content="http://purl.org/rss/1.0/modules/content/">'.END_LINE;
  74.  
  75. echo '<channel>'.END_LINE;
  76. echo '<title>'.SITE_NAME.'</title>'.END_LINE;
  77. echo '<link>'.CURRENT_APP_URL.'</link>'.END_LINE;
  78. echo '<description>'.CURRENT_APP_URL.'</description>'.END_LINE;
  79. echo '<dc:language>'.strtolower(U_L).'</dc:language>'.END_LINE;
  80. echo '<dc:creator>'.CURRENT_APP_URL.'</dc:creator>'.END_LINE;
  81. echo '<dc:rights>Copyrights '.date("Y").'</dc:rights>'.END_LINE;
  82. echo '<dc:date>'.date("Y-m-j").'</dc:date>'.END_LINE;
  83. //echo '<dc:date>'.date("Y-m-j\TH:i:s").'</dc:date>'.END_LINE;
  84. echo '<admin:generatorAgent rdf:resource="http://cafelog.com/?v=0.6.1"/>'.END_LINE;
  85. echo '<admin:errorReportsTo rdf:resource="'.SITE_MAIL.'"/>'.END_LINE;
  86. echo '<sy:updatePeriod>hourly</sy:updatePeriod>'.END_LINE;
  87. echo '<sy:updateFrequency>1</sy:updateFrequency>'.END_LINE;
  88. echo '<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>'.END_LINE;
  89.  
  90. echo '<image rdf:resource="http://www.linea21.com/logo_linea.gif" />'.END_LINE;
  91.  
  92. # LISTES ITEMS
  93. echo '<items>'.END_LINE;
  94. echo '<rdf:Seq>'.END_LINE;
  95. echo $li_items.END_LINE;
  96. echo '</rdf:Seq>'.END_LINE;
  97. echo '</items>'.END_LINE;
  98.  
  99.  
  100. echo $content;
  101.  
  102.  
  103. /**
  104.  * FOOTER RSS
  105.  **********************************************************/
  106.  
  107. echo '</channel>'.END_LINE;
  108. echo '</rss>'.END_LINE;
  109. ?>

Documentation generated on Fri, 01 Apr 2011 09:34:27 +0200 by phpDocumentor 1.4.1