Sorry

This feed does not validate.

In addition, interoperability with the widest range of feed readers could be improved by implementing the following recommendation.

Source: http://yartube.ru//rss.xml

  1. <?php
  2. /*
  3. =====================================================
  4. DataLife Engine - by SoftNews Media Group
  5. -----------------------------------------------------
  6. http://dle-news.ru/
  7. -----------------------------------------------------
  8. Copyright (c) 2004-2016 SoftNews Media Group
  9. =====================================================
  10. Данный код защищен авторскими правами
  11. =====================================================
  12. Файл: rss.php
  13. -----------------------------------------------------
  14. Назначение: экспорт новостей
  15. =====================================================
  16. */
  17.  
  18. define( 'DATALIFEENGINE', true );
  19. define( 'ROOT_DIR', '..' );
  20. define( 'ENGINE_DIR', dirname( __FILE__ ) );
  21.  
  22. @error_reporting ( E_ALL ^ E_WARNING ^ E_NOTICE );
  23. @ini_set ( 'display_errors', true );
  24. @ini_set ( 'html_errors', false );
  25. @ini_set ( 'error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE );
  26.  
  27. include ENGINE_DIR . '/data/config.php';
  28.  
  29. date_default_timezone_set ( $config['date_adjust'] );
  30.  
  31. if( $config['http_home_url'] == "" ) {
  32. $config['http_home_url'] = explode( "engine/rss.php", $_SERVER['PHP_SELF'] );
  33. $config['http_home_url'] = reset( $config['http_home_url'] );
  34. $config['http_home_url'] = "http://" . $_SERVER['HTTP_HOST'] . $config['http_home_url'];
  35.  
  36. } elseif (strpos($config['http_home_url'], "//") === 0) $config['http_home_url'] = "http:".$config['http_home_url'];
  37. elseif (strpos($config['http_home_url'], "/") === 0) $config['http_home_url'] = "http://".$_SERVER['HTTP_HOST'].$config['http_home_url'];
  38.  
  39. require_once ENGINE_DIR . '/classes/mysql.php';
  40. include_once ENGINE_DIR . '/data/dbconfig.php';
  41. include_once ENGINE_DIR . '/modules/functions.php';
  42. require_once ENGINE_DIR . '/classes/templates.class.php';
  43. include_once ROOT_DIR . '/language/' . $config['langs'] . '/website.lng';
  44.  
  45. check_xss();
  46. $_TIME = time();
  47.  
  48. if (isset ($_REQUEST['do']) ) $do = totranslit ( $_REQUEST['do'] ); else $do = "";
  49. if (isset ($_REQUEST['subaction']) ) $subaction = totranslit ($_REQUEST['subaction']); else $subaction = "";
  50. if ( isset ($_REQUEST['doaction']) ) $doaction = totranslit ($_REQUEST['doaction']); else $doaction = "";
  51. if ($do == "tags" AND !$_GET['tag']) $do = "alltags";
  52.  
  53. $dle_module = $do;
  54. if ($do == "" and ! $subaction and $year) $dle_module = "date";
  55. elseif ($do == "" and $catalog) $dle_module = "catalog";
  56. elseif ($do == "") $dle_module = $subaction;
  57. if ($subaction == '' AND $newsid) $dle_module = "showfull";
  58. $dle_module = $dle_module ? $dle_module : "main";
  59.  
  60. $tpl = new dle_template( );
  61. $tpl->dir = ROOT_DIR . '/templates';
  62. define( 'TEMPLATE_DIR', $tpl->dir );
  63.  
  64. //####################################################################################################################
  65. //                    Определение категорий и их параметры
  66. //####################################################################################################################
  67. $cat_info = get_vars( "category" );
  68.  
  69. if( ! $cat_info ) {
  70. $cat_info = array ();
  71. $db->query( "SELECT * FROM " . PREFIX . "_category ORDER BY posi ASC" );
  72. while ( $row = $db->get_row() ) {
  73. $cat_info[$row['id']] = array ();
  74. foreach ( $row as $key => $value ) {
  75. $cat_info[$row['id']][$key] = $value;
  76. }
  77. }
  78. set_vars( "category", $cat_info );
  79. $db->free();
  80. }
  81. //################# Определение групп пользователей
  82. $user_group = get_vars( "usergroup" );
  83.  
  84. if( ! $user_group ) {
  85. $user_group = array ();
  86. $db->query( "SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC" );
  87. while ( $row = $db->get_row() ) {
  88. $user_group[$row['id']] = array ();
  89. foreach ( $row as $key => $value ) {
  90. $user_group[$row['id']][$key] = $value;
  91. }
  92. }
  93. set_vars( "usergroup", $user_group );
  94. $db->free();
  95. }
  96.  
  97. $member_id['user_group'] = 5;
  98.  
  99. if( isset( $_GET['year'] ) ) $year = intval( $_GET['year'] ); else $year = '';
  100. if( isset( $_GET['month'] )) $month = @$db->safesql ( sprintf("%02d", intval ( $_GET['month'] ) ) ); else $month = '';
  101. if( isset( $_GET['day'] )) $day = @$db->safesql ( sprintf("%02d", intval ( $_GET['day'] ) ) ); else $day = '';
  102. if( isset( $_GET['news_name'] ) ) $news_name = @$db->safesql( strip_tags( str_replace( '/', '', $_GET['news_name'] ) ) ); else $news_name = '';
  103. if( isset( $_GET['newsid'] ) ) $newsid = intval( $_GET['newsid'] ); else $newsid = 0;
  104. if( isset( $_GET['news_page'] ) ) $news_page = intval( $_GET['news_page'] ); else $news_page = 0;
  105.  
  106. if (isset ( $_GET['catalog'] )) {
  107.  
  108. $catalog = @strip_tags ( str_replace ( '/', '', urldecode ( $_GET['catalog'] ) ) );
  109.  
  110. if ( $config['charset'] == "windows-1251" AND $config['charset'] != detect_encoding($catalog) ) {
  111. if( function_exists( 'mb_convert_encoding' ) ) {
  112. $catalog = mb_convert_encoding( $catalog, "windows-1251", "UTF-8" );
  113. } elseif( function_exists( 'iconv' ) ) {
  114. $catalog = iconv( "UTF-8", "windows-1251//IGNORE", $catalog );
  115. }
  116. }
  117.  
  118. $catalog = $db->safesql ( dle_substr ( $catalog, 0, 3, $config['charset'] ) );
  119.  
  120. } else $catalog = '';
  121.  
  122. if (isset ( $_GET['user'] )) {
  123.  
  124. $user = @strip_tags ( str_replace ( '/', '', urldecode ( $_GET['user'] ) ) );
  125.  
  126. if ( $config['charset'] == "windows-1251" AND $config['charset'] != detect_encoding($user) ) {
  127. if( function_exists( 'mb_convert_encoding' ) ) {
  128. $user = mb_convert_encoding( $user, "windows-1251", "UTF-8" );
  129. } elseif( function_exists( 'iconv' ) ) {
  130. $user = iconv( "UTF-8", "windows-1251//IGNORE", $user );
  131. }
  132. }
  133.  
  134. $user = $db->safesql ( $user );
  135.  
  136. if( preg_match( "/[\||\'|\<|\>|\"|\!|\?|\$|\@|\/|\\\|\&\~\*\+]/", $user ) ) $user="";
  137.  
  138. } else $user = '';
  139.  
  140. if( isset( $_GET['category'] ) ) {
  141. if( substr( $_GET['category'], - 1, 1 ) == '/' ) $_GET['category'] = substr( $_GET['category'], 0, - 1 );
  142. $category = explode( '/', $_GET['category'] );
  143. $category = end( $category );
  144. $category = $db->safesql( strip_tags( $category ) );
  145. } else
  146. $category = '';
  147.  
  148. if( $category != '' ) $category_id = get_ID( $cat_info, $category );
  149. else $category_id = false;
  150.  
  151. $view_template = "rss";
  152.  
  153. $config['allow_cache'] = true;
  154. $config['allow_banner'] = false;
  155. $config['rss_number'] = intval( $config['rss_number'] );
  156. $config['rss_format'] = intval( $config['rss_format'] );
  157. $cstart = 0;
  158.  
  159. if ( $user ) $config['allow_cache'] = false;
  160.  
  161. if( $_GET['subaction'] == 'allnews' ) $config['home_title'] = $lang['show_user_news'] . ' ' . htmlspecialchars( $user, ENT_QUOTES, $config['charset'] ) . " - " . $config['home_title'];
  162. elseif( $_GET['do'] == 'cat' ) $config['home_title'] = stripslashes( $cat_info[$category_id]['name'] ) . " - " . $config['home_title'];
  163.  
  164. $rss_content = <<<XML
  165. <?xml version="1.0" encoding="{$config['charset']}"?>
  166. <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  167. <channel>
  168. <title>{$config['home_title']}</title>
  169. <link>{$config['http_home_url']}</link>
  170. <language>ru</language>
  171. <description>{$config['home_title']}</description>
  172. <generator>DataLife Engine</generator>
  173. XML;
  174.  
  175. if( !file_exists( $tpl->dir . "/rss.tpl" ) ) {
  176.  
  177. $tpl->template = <<<HTML
  178. [shortrss]<item>
  179. <title>{title}</title>
  180. <guid isPermaLink="true">{rsslink}</guid>
  181. <link>{rsslink}</link>
  182. <description>{short-story}</description>
  183. <category>{category}</category>
  184. <dc:creator>{rssauthor}</dc:creator>
  185. <pubDate>{rssdate}</pubDate>
  186. </item>[/shortrss]
  187. [fullrss]<item>
  188. <title>{title}</title>
  189. <guid isPermaLink="true">{rsslink}</guid>
  190. <link>{rsslink}</link>
  191. <description><![CDATA[{short-story}]]></description>
  192. <category><![CDATA[{category}]]></category>
  193. <dc:creator>{rssauthor}</dc:creator>
  194. <pubDate>{rssdate}</pubDate>
  195. </item>[/fullrss]
  196. [yandexrss]<item>
  197. <title>{title}</title>
  198. <link>{rsslink}</link>
  199. <description>{short-story}</description>
  200. <category>{category}</category>{images}
  201. <pubDate>{rssdate}</pubDate>
  202. <yandex:full-text>{full-story}</yandex:full-text>
  203. </item>[/yandexrss]
  204. HTML;
  205.  
  206. $tpl->copy_template = $tpl->template;
  207.  
  208. } else {
  209. $tpl->load_template( 'rss.tpl' );
  210. }
  211.  
  212.  
  213. if( $config['site_offline'] OR ! $config['allow_rss'] ) {
  214. $rss_content .= <<<XML
  215. <item>
  216. <title>RSS in offline mode</title>
  217. <guid isPermaLink="true"></guid>
  218. <link></link>
  219. <description>RSS in offline mode</description>
  220. <category>undefined</category>
  221. <dc:creator>DataLife Engine</dc:creator>
  222. <pubDate>DataLife Engine</pubDate>
  223. </item>
  224. XML;
  225.  
  226. } else {
  227. if( $config['rss_format'] == 1 ) {
  228. $tpl->template = str_replace( '[fullrss]', '', $tpl->template );
  229. $tpl->template = str_replace( '[/fullrss]', '', $tpl->template );
  230. $tpl->template = preg_replace( "'\\[yandexrss\\](.*?)\\[/yandexrss\\]'si", "", $tpl->template );
  231. $tpl->template = preg_replace( "'\\[shortrss\\](.*?)\\[/shortrss\\]'si", "", $tpl->template );
  232. $tpl->template = trim($tpl->template);
  233. } elseif( $config['rss_format'] == 2 ) {
  234. $rss_content = <<<XML
  235. <?xml version="1.0" encoding="{$config['charset']}"?>
  236. <rss xmlns:yandex="http://news.yandex.ru" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
  237. <channel>
  238. <title>{$config['home_title']}</title>
  239. <link>{$config['http_home_url']}</link>
  240. <language>ru</language>
  241. <description>{$config['home_title']}</description>
  242. <yandex:logo>{$config['http_home_url']}yandexlogo.png</yandex:logo>
  243. <yandex:logo type="square">{$config['http_home_url']}yandexsquarelogo.png</yandex:logo>
  244. <generator>DataLife Engine</generator>
  245. XML;
  246. $tpl->template = str_replace( '[yandexrss]', '', $tpl->template );
  247. $tpl->template = str_replace( '[/yandexrss]', '', $tpl->template );
  248. $tpl->template = preg_replace( "'\\[fullrss\\](.*?)\\[/fullrss\\]'si", "", $tpl->template );
  249. $tpl->template = preg_replace( "'\\[shortrss\\](.*?)\\[/shortrss\\]'si", "", $tpl->template );
  250. $tpl->template = trim($tpl->template);
  251. } else {
  252. $tpl->template = str_replace( '[shortrss]', '', $tpl->template );
  253. $tpl->template = str_replace( '[/shortrss]', '', $tpl->template );
  254. $tpl->template = preg_replace( "'\\[fullrss\\](.*?)\\[/fullrss\\]'si", "", $tpl->template );
  255. $tpl->template = preg_replace( "'\\[yandexrss\\](.*?)\\[/yandexrss\\]'si", "", $tpl->template );
  256. $tpl->template = trim($tpl->template);
  257. }
  258. $tpl->copy_template = $tpl->template;
  259. include_once ENGINE_DIR . '/engine.php';
  260. $rss_content .= $tpl->result['content'];
  261. }
  262.  
  263. $rss_content .= '</channel></rss>';
  264.  
  265. header( "Content-type: application/xml; charset=".$config['charset'] );
  266. echo $rss_content;
  267.  
  268. ?>
Copyright © 2002-9 Sam Ruby, Mark Pilgrim, Joseph Walton, and Phil Ringnalda