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.  
  27. $data=$sql_object -> DBSelect(SQL_getRSS2formatedNews());
  28.  
  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=date_rfc2822($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.     if(!empty($news_header)) $news_content $news_header;
  43.     else   $news_content $news_body;
  44.  
  45.     $content.='<item>'.END_LINE;
  46.     $content.='    <title>'.$news_title.'</title>'.END_LINE;
  47.     $content.='    <link>'.CURRENT_APP_URL HrefMaker($link_news).'</link>'.END_LINE;
  48.     $content.='    <pubDate>'.$news_date.'</pubDate>'.END_LINE;
  49.     $content.='    <category>'.$news_theme.'</category>'.END_LINE;
  50.     $content.='    <guid isPermaLink="false">'.$news_id.'@'CURRENT_APP_URL .'</guid>'.END_LINE;
  51.     $content.='    <description>'.END_LINE;
  52.     $content.='    <![CDATA[ '.$news_header.' ]]>';
  53.     $content.='    </description>'.END_LINE;
  54.     $content.='    <content:encoded><![CDATA['.$news_body.']]></content:encoded>';
  55.     $content.='</item>'.END_LINE;
  56.   }
  57. }
  58.  
  59.  
  60.  
  61.  
  62.  
  63. /**
  64.  * HEADER RSS
  65.  ****************************************************************/
  66.  
  67. header('Content-Type: application/rss+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:atom="http://www.w3.org/2005/Atom" 
  74.     xmlns:content="http://purl.org/rss/1.0/modules/content/">'.END_LINE;
  75.  
  76. echo '<channel>'.END_LINE;
  77. echo '    <title>'.SITE_NAME.'</title>'.END_LINE;
  78. echo '    <link>'.CURRENT_APP_URL.'</link>'.END_LINE;
  79. echo '    <atom:link href="'.CURRENT_APP_URL.'rss2.php" rel="self" type="application/rss+xml" />'.END_LINE;
  80. echo '    <description>'.CURRENT_APP_URL.'</description>'.END_LINE;
  81. echo '    <language>'.strtolower(U_L).'</language>'.END_LINE;
  82. echo '    <copyright>Copyright '.date('Y').' - '.SITE_NAME.'</copyright>'.END_LINE;
  83. echo '    <managingEditor>'.SITE_MAIL.'</managingEditor>'.END_LINE;
  84. echo '    <webMaster>'.SITE_MAIL.'</webMaster>'.END_LINE;
  85. echo '    <lastBuildDate>'.date('r').'</lastBuildDate>'.END_LINE;
  86. echo '    <generator>'.SITE_LINEA_NAME.'</generator>'.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. echo '    <image>'.END_LINE;
  91. echo '        <url>http://www.linea21.com/logo_linea.gif</url>'.END_LINE;
  92. echo '      <link>http://www.linea21.com</link>'.END_LINE;
  93. echo '        <title>linea21.com</title>'.END_LINE;
  94. echo '    </image>'.END_LINE;
  95.  
  96.  
  97.  
  98. echo $content;
  99.  
  100.  
  101. /**
  102.  * FOOTER RSS
  103.  **********************************************************/
  104.  
  105. echo '</channel>'.END_LINE;
  106. echo '</rss>';
  107. ?>

Documentation generated on Thu, 03 May 2012 15:07:31 +0200 by phpDocumentor 1.4.1