Файл: apwa/news.php
Строк: 63
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
/*if ($_GET['news'] == '')
{
$_GET['cat'] = 'all';
}*/
if (!empty($_GET['cat']))
{
$cat = $_GET['cat'];
if ( $cat == 'all')
{
$title = 'Все новости';
}
elseif ( $cat == '1')
{
$title = 'В России';
}
elseif ( $cat == '2')
{
$title = 'В мире';
}
elseif ( $cat == '3')
{
$title = 'Экономика';
}
elseif ($cat == '4')
{
$title = 'Криминал';
}
elseif ($cat == '8')
{
$title = 'Спорт';
}
elseif ($cat == '9')
{
$title = 'Культура';
}
elseif ($cat == '10')
{
$title = 'Религия и общество';
}
}
else
{
$title = 'Новости';
}
page_header($title);
$template->set_filenames(array(
'body' => 'news_body.html',
));
$file_rows = FALSE;
$s_cat = FALSE;
if (empty($_GET['cat']) and empty($_GET['news']) and empty($_GET['lu']))
{
$s_cat = TRUE;
}
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("rn","n"),'',$file);
$file = str_replace('<br/><br/>','<br/>',$file);
$file = str_replace('<br/><br/>','<br/>',$file);
$file = str_replace('<br/>',"<br />rn",$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>rn<a href="?cat=$1&news=$2">Далее >></a><br />rn</p>",$file);
$file = preg_replace("|([0-9]+).([0-9]+).([0-9]+) ([0-9]+):([0-9]+)<br />rn<a href="/news/([0-9]+)/?lu=([0-9]+)">([0-9 a-zа-яё&;#`~!@$%^*()_-+=|\}{[]'":?/.,]+)</a><br />|ius","<div class="row1">rn$1.$2.$3 $4:$5<br />rn<a href="?news=$6&lu=$7">$8</a><br />rn</div>",$file);
$file_rows = $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("rn","n"),'',$file);
$file = str_replace('<br/>',"rn",$file);
if (preg_match("|<a href="/sect/([0-9]+)/">([0-9 a-zа-яё&;#`~!@$%^*()_-+=|\}{[]'":?/.,]+)</a>rn|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>rn|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&lu=$3&simv=$2">$4</a>",$file);
$file_rows = '<div class="row_hard">' . $file . '</div>' . @$nav . '';
}
}
$template->assign_vars(array(
'S_FILE' => $file_rows,
'S_TITLE' => $title,
'S_CAT' => $s_cat,
));
page_footer();
?>