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

Documentation generated on Fri, 16 Oct 2009 09:39:05 +0200 by phpDocumentor 1.4.1