View file news.php

File size: 4.85Kb
<?php

define('IN_PHPBB',true);
$phpbb_root_path = './';
require($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip,-14);
init_userprefs($userdata);

/*if ($_GET['news'] == '')
{
      $_GET['cat'] = 'all';
}*/
$page_title = $set['title'] = 'Мировые новости'; // заголовок страницы
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

if (!empty($_GET['cat'])) 
{
      $cat = $_GET['cat'];
      if ($cat=='all') 
      {
            $title = 'Все новости';
      } 
      else if ($cat=='1') 
      {
            $title = 'В России';
      } 
      else if ($cat=='2') 
      {
            $title = 'В мире';
      } 
      else if ($cat=='3') 
      {
            $title = 'Экономика';
      } 
      else if ($cat=='4') 
      {
            $title = 'Криминал';
      } 
      else if ($cat=='8') 
      {  
            $title = 'Спорт';
      } 
      else if ($n == '9') 
      {
           $title = 'Культура';
      } 
      else if ($n=='10') 
      {
            $title = 'Религия и общество';
      }
} 
else 
{
    $title = 'Разделы';
}
echo '' . $title . '';
if (empty($_GET['cat']) and empty($_GET['news']) and empty($_GET['lu'])) 
{
      echo '<div class="row1"><a href="?cat=all">Все новости</a><br /><a href="?cat=1">В России</a><br /><a href="?cat=2">В мире</a><br /><a href="?cat=3">Экономика</a><br />
      <a href="?cat=4">Криминал</a><br /><a href="?cat=8">Спорт</a><br /><a href="?cat=9">Культура</a><br/><a href="?cat=10">Религия и общество</a><br /></div><div class="tab">- <a href="http://apwa.ru">Главная</a></div>';
} 
else if (!empty($_GET['cat'])) 
{
    if (empty($_GET['news'])) 
    {
       $file = @file_get_contents('http://wap.newsru.com/sect/'.$cat);
    } 
    else 
    {
       $news = $_GET['news'];
       $file = @file_get_contents('http://wap.newsru.com/sect/'.$cat.'/'.$news);
    }
    if (preg_match('|^(.*)<p>(.*)</p>(.*)$|ius',$file,$out)) 
    {
       $file = $out[2];
       $file = str_replace(array("\r\n","\n"),'',$file);
       $file = str_replace('<br/><br/>','<br/>',$file);
       $file = str_replace('<br/><br/>','<br/>',$file);
       $file = str_replace('<br/>',"<br />\r\n",$file);
       $file = str_replace('<b><a href="/">Начало</a></b>','',$file);
       $file = preg_replace('|<a href="/sect/([0-9a-z]+)/([0-9]+)/">Далее</a><br />|ui',"<p>\r\n<a href=\"?cat=$1&amp;news=$2\">Далее &gt;&gt;</a><br />\r\n</p>",$file);
       $file = preg_replace("|([0-9]+).([0-9]+).([0-9]+) ([0-9]+):([0-9]+)<br />\r\n<a href=\"/news/([0-9]+)/\?lu=([0-9]+)\">([0-9 a-zа-яё\&\;\#\`\~\!\@\$\%\^\*\(\)\_\-\+\=\|\\\}\{\[\]\'\"\:\?\/\.\,]+)</a><br />|ius","<div class=\"row1\">\r\n$1.$2.$3 $4:$5<br />\r\n<a href=\"?news=$6&amp;lu=$7\">$8</a><br />\r\n</div>",$file);
       echo '' . $file . '';
    }
} 
else if (!empty($_GET['news']) and !empty($_GET['lu'])) 
{
       $news = $_GET['news'];
       $lu = $_GET['lu'];
       if (empty($_GET['simv'])) 
       {
              $file = @file_get_contents('http://wap.newsru.com/news/'.$news.'/?lu='.$lu);
       } 
       else 
       {
              $simv = $_GET['simv'];
              $file = @file_get_contents('http://wap.newsru.com/news/'.$news.'/'.$simv.'/?lu='.$lu);
       }
       if (preg_match('|^(.*)<p>(.*)</p>(.*)$|ius',$file,$out)) 
       {
              $file = $out[2];
              $file = str_replace(array("\r\n","\n"),'',$file);
              $file = str_replace('<br/>',"\r\n",$file);
              if (preg_match("|<a href=\"/sect/([0-9]+)/\">([0-9 a-zа-яё\&\;\#\`\~\!\@\$\%\^\*\(\)\_\-\+\=\|\\\}\{\[\]\'\"\:\?\/\.\,]+)</a>\r\n|iu",$file,$out)) 
              {
                      $nav = '<p>- <a href="?cat='.$out[1].'">'.$out[2].'</a></p>';
                      $file = preg_replace("|<a href=\"/sect/([0-9]+)/\">([0-9 a-zа-яё\&\;\#\`\~\!\@\$\%\^\*\(\)\_\-\+\=\|\\\}\{\[\]\'\"\:\?\/\.\,]+)</a>\r\n|iu",'',$file);
              }
              $file = str_replace('<b><a href="/">Начало</a></b>','',$file);
              $file = trim($file);
              $file = nl2br($file);
              $file = preg_replace("|<a href=\"/news/([0-9]+)/([0-9]+)/\?lu=([0-9]+)\">([0-9 a-zа-яё\&\;\#\`\~\!\@\$\%\^\*\(\)\_\-\+\=\|\\\}\{\[\]\'\"\:\?\/\.\,]+)</a>|iu","<a href=\"?news=$1&amp;lu=$3&amp;simv=$2\">$4</a>",$file);
              echo '<div class="row_hard">' . $file . '</div>' . @$nav . '';
       }
}

if (!empty($_GET['cat'])) 
{
      echo '<div class="tab">- <a href="?">К разделам</a><br />- <a href="http://apwa.ru">Главная</a></div>';
}

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>