<?
#############################################
# Создание скрипта: Manlix SW               #
# Имя скрипта: Manlix SW News               #
# Версия скрипта: 0.2                       #
# Статус: Бесплатный скрипт                 #
# Требования: PHP3 и выше                   #
# Дата создания скрипта: 21 марта 2002 год  #
# Страница:  http://manliks.ru/manlix       #
#############################################
#         Читай файл HowToUse.htm           #
#############################################
if ($fp == "")
{
$fp = $PHP_SELF;
$fp = eregi_replace("/vhosts/cool-wm.ru/htdocs/mnlxswnews02/mnlxswnews.php","","$fp");
$fp = "$DOCUMENT_ROOT$fp";
}
include ("/vhosts/cool-wm.ru/htdocs/mnlxswnews02/config.inc.php");
include ("$fp$dtemplates/top.htm");
$newsfile = file($fp.$newsdat);
if ($news != "archive")
{
include ("$fp$dtemplates/new_top.htm");
if (count(file($fp.$newsdat)) < 1)
{
include ("$fp$dtemplates/empty.htm");
}
if (count(file($fp.$newsdat)) > 0)
{
for ( $i = count(file($fp.$newsdat)) - 1; $i > count(file($fp.$newsdat)) - $ap - 1; $i--)
{
if ($i >= 0)
{
list($date,$news)=explode("::", $newsfile[$i]);
$id = $i;
$id++;
$t_news = file("$fp$d/vhosts/cool-wm.ru/htdocs/mnlxswnews02/templates/news.htm");
for($n = 0 ; $n < count($t_news); $n++)
{
$t_news[$n] = str_replace("%date%",$date,$t_news[$n]);
$t_news[$n] = str_replace("%news%",$news,$t_news[$n]);
$t_news[$n] = str_replace("%id%",$id,$t_news[$n]);
echo $t_news[$n];
}
echo "$separator";
}
}
}
$t_end = file("$fp$dtemplates/end.htm");
for($en = 0 ; $en < count($t_end); $en++)
{
$t_end[$en] = str_replace("%archive%","<a href=\"http://$HTTP_HOST$PHP_SELF?news=archive\" title=\"$title_archive\">$title_archive</a>",$t_end[$en]);
echo $t_end[$en];
}
}
if ($news == "archive")
{
if ($page == "")
{
$page = "1";
}
include ("$fp$dtemplates/archive_top.htm");
if (!ereg("^[0-9]+$",$page))
{
include ("$fp$dtemplates/error.htm");
$t_archive_end = file("$fp$dtemplates/archive_end.htm");
for($a_en = 0 ; $a_en < count($t_archive_end); $a_en++)
{
$t_archive_end[$a_en] = str_replace("%news_list%","<a href=\"http://$HTTP_HOST$PHP_SELF\" title=\"$non_title_archive\">$non_title_archive</a>",$t_archive_end[$a_en]);
echo $t_archive_end[$a_en];
}
include ("$fp$dtemplates/bottom.htm");
exit();
}
$newsfile = file($fp.$newsdat);
if (count(file($fp.$newsdat)) < $ap)
{
include ("$fp$dtemplates/archive_empty.htm");
$t_archive_end = file("$fp$dtemplates/archive_end.htm");
for($a_en = 0 ; $a_en < count($t_archive_end); $a_en++)
{
$t_archive_end[$a_en] = str_replace("%news_list%","<a href=\"http://$HTTP_HOST$PHP_SELF\" title=\"$non_title_archive\">$non_title_archive</a>",$t_archive_end[$a_en]);
echo $t_archive_end[$a_en];
}
include ("$fp$dtemplates/bottom.htm");
exit();
}
if (count(file($fp.$newsdat)) > 0)
{
if ($page == "" or $page < 0)
{
$page = "1";
}
$first = count($newsfile) - ($show_archive * ($page - 1));
$second = count($newsfile) - ($show_archive * $page) + 1;
if ($second < 1)
{
$second = 1;
}
$pages = (int) ((count($newsfile) - 1 + $show_archive) / $show_archive);
if ($page > $pages)
{
include ("$fp$dtemplates/error.htm");
$t_archive_end = file("$fp$dtemplates/archive_end.htm");
for($a_en = 0 ; $a_en < count($t_archive_end); $a_en++)
{
$t_archive_end[$a_en] = str_replace("%news_list%","<a href=\"http://$HTTP_HOST$PHP_SELF\" title=\"$non_title_archive\">$non_title_archive</a>",$t_archive_end[$a_en]);
echo $t_archive_end[$a_en];
}
include ("$fp$dtemplates/bottom.htm");
exit();
}
$line = "|";
for ($show_archive = 1; $show_archive <= $pages; $show_archive++)
{
if ($show_archive != $page)
{
if ($page != "" and $page > "1" and $page < $pages)
{
$li = "<a href=\"http://$HTTP_HOST$PHP_SELF?news=archive&page=".($page-1)."\" title=\"$back\"> $back </a> $snb ";
}
$page2 = $page+1;
$line = "<a href=\"http://$HTTP_HOST$PHP_SELF?news=archive&page=$page2\" title=\"$next\"> $next </a>";
}
if ($show_archive == $page)
{
$line = "<a href=\"http://$HTTP_HOST$PHP_SELF?news=archive&page=".($page-1)."\" title=\"$back\"> $back </a>";
}
}
$t_navigation = file("$fp$dtemplates/navigation.htm");
for($nav = 0 ; $nav < count($t_navigation); $nav++)
{
$t_navigation[$nav] = str_replace("%navigation%","$li$line",$t_navigation[$nav]);
echo $t_navigation[$nav];
}
for ( $i = $first-1; $i >= $second-1; $i--)
{
if ($i >= 0)
{
list($date,$news)=explode("::", $newsfile[$i]);
$id = $i;
$id++;
$t_news = file("$fp$dtemplates/news.htm");
for($n = 0 ; $n < count($t_news); $n++)
{
$t_news[$n] = str_replace("%date%",".:: $date ::.",$t_news[$n]);
$t_news[$n] = str_replace("%news%",$news,$t_news[$n]);
$t_news[$n] = str_replace("%id%",$id,$t_news[$n]);
echo $t_news[$n];
}
echo "$separator";
}
}
$t_navigation = file("$fp$dtemplates/navigation.htm");
for($nav = 0 ; $nav < count($t_navigation); $nav++)
{
$t_navigation[$nav] = str_replace("%navigation%","$li$line",$t_navigation[$nav]);
echo $t_navigation[$nav];
}
$t_archive_end = file("$fp$dtemplates/archive_end.htm");
for($a_en = 0 ; $a_en < count($t_archive_end); $a_en++)
{
$t_archive_end[$a_en] = str_replace("%news_list%","<a href=\"http://$HTTP_HOST$PHP_SELF\" title=\"$non_title_archive\">$non_title_archive</a>",$t_archive_end[$a_en]);
echo $t_archive_end[$a_en];
}
}
}
include ("$fp$dtemplates/bottom.htm");
?>
