if (isset($_GET)){foreach ( $_GET as $key => $value ) {$$key=$value;}}
if ( $act == "news")
{
include("config.inc.php");
$link = "news";
$general = @file($base_news);
include("index_top.htm");
$line = "Страницы: ";
$lines = count($general);
$ogran = (int) ($onlygadd / 2);
if ($page != ""){
for ( $i = $lines-1; $i >= 0; $i--)
{
list($nomer,$tema,$data,$message)=explode("::", $general[$i]);
if ($page == $nomer){$page_abs = $i; break;}
if($i == 0 and $page != $nomer){
$data = time();
$data = date("d m Y", $data);
$tema = "Ошибка 404 (not found)";
$message = "
Такой страницы нет в базе!!!
Она была удалена!!!
|
";
}
}
$first = $page_abs + $ogran;
if($first > $lines){ $first = $lines; }
$second = $page_abs - $ogran;
if($second < 1){ $second = 0; }
for ( $i = $lines-1; $i >= 0; $i--)
{
$strok = $lines - $i;
list($nomer_s,$tema_s,$data_s,$message_s)=explode("::", $general[$i]);
if($first + $ogran == $i){$line .= " << ";}
if($first >= $i and $i > $page_abs) {$line .= " $strok |";}
if($page_abs == $i) {$line .= " $strok |";}
if($second <= $i and $i < $page_abs){$line .= " $strok |";}
if($second - $ogran == $i){ $line .= " >> "; }
}
}
echo" ";
if ($show == "yes"){
$t_mha = @file("message_news.htm");
for($mha = 0 ; $mha < count($t_mha); $mha++)
{
$t_mha[$mha] = str_replace("%tema%",$tema,$t_mha[$mha]);
$t_mha[$mha] = str_replace("%data%",$data,$t_mha[$mha]);
$t_mha[$mha] = str_replace("%message%",$message,$t_mha[$mha]);
echo "$t_mha[$mha]";
}
}
else{
if ($page_all == ""){$page_all = 1;}
$pages = ($lines + $onlygadd) / $onlygadd;
$first = $onlygadd * $page_all;
for ( $i = 1; $i < $pages; $i++)
{
if($i > $page_all){$line .= " $i |";}
if($i == $page_all){$line .= " $i |";}
if($i < $page_all){$line .= " $i |";}
}
for ( $i = $lines-1; $i >= 0; $i--)
{
if($i >= $lines - $first and $i < $lines - $first + $onlygadd){
list($nomer,$tema,$data,$message)=explode("::", $general[$i]);
if ( $obrez < strlen ($message))
{
$message = substr ( $message, 0, $obrez);
$message = ereg_replace("
"," ",$message);
$message = $message ."..." ." подробнее >>>";
}
else { $message = $message ."..." ." подробнее >>>"; }
$t_mha = @file("message_news.htm");
for($mha = 0 ; $mha < count($t_mha); $mha++)
{
$t_mha[$mha] = str_replace("%tema%",$tema,$t_mha[$mha]);
$t_mha[$mha] = str_replace("%data%",$data,$t_mha[$mha]);
$t_mha[$mha] = str_replace("%message%",$message,$t_mha[$mha]);
echo "$t_mha[$mha]";
}
}
if($i == 0 and $message == ""){
echo"
Ошибка: Такой страницы нет в базе!!!
|
";
}
}
}
echo("
");
if ($lines > "0") {
$t_mha = @file("line.htm");
for($mha = 0 ; $mha < count($t_mha); $mha++)
{
$t_mha[$mha] = str_replace("%line%",$line,$t_mha[$mha]);
echo "$t_mha[$mha]";
}
}
include("index_end.htm");
}
?>