<?
#############################################
# Создание скрипта: Manlix SW               #
# Имя скрипта: Manlix SW News               #
# Версия скрипта: 0.2                       #
# Статус: Бесплатный скрипт                 #
# Требования: PHP3 и выше                   #
# Дата создания скрипта: 21 марта 2002 год  #
# Страница:  http://manliks.ru/manlix       #
#############################################
#         Читай файл HowToUse.htm           #
#############################################
include("config.inc.php");
function form()
{
echo "
<html>
<head>
<title>Администратирование, Manlix SW News v0.2 - Разработка: Manlix SW</title>
<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">
<meta http-equiv=\"content-type\" content=\"text/html; charset=windows-1251\">
<style type=\"text/css\">
<!--
A:link    {COLOR: #000000; FONT-FAMILY: Verdana; TEXT-DECORATION: none}
A:active  {COLOR: #000000; FONT-FAMILY: Verdana; TEXT-DECORATION: none}
A:visited {COLOR: #000000; FONT-FAMILY: Verdana; TEXT-DECORATION: none}
A:hover   {COLOR: #000080; FONT-FAMILY: Verdana; TEXT-DECORATION: none}
-->
</style>
</head>
<body background=images/background.gif>
<form action=admin.php method=get>
<table border=0 width=500 align=center cellspacing=1 cellpadding=3 bgcolor=000080>
<tr><td align=center bgcolor=face7d><font face=verdana size=2><a href=http://manliks.ru/manlix target=_blank>Manlix SW News v0.2</a></font></td></tr>
<tr><td align=center bgcolor=face7d><font face=verdana size=2 color=de0000>Введите пароль</font></td></tr>
<tr><td align=center bgcolor=face7d><input typy=text name=p size=25></td></tr>
<tr><td align=center bgcolor=face7d><input type=submit value=Войти></td></tr>
</form>
";
}
if ($p != $password)
{
form();
}
if ($p == $password)
{
if ($log == "Очистить лог файл")
{
$log_f = fopen("logs/admin.log","w+");
fputs ($log_f,"");
fclose ($log_f);
}
$all_news = count(file($newsdat));
if ($addnewnews == "Добавить новую новость")
{
if ($news != "")
{
$newnewsfile = fopen("$newsdat","a");
$news = ereg_replace("::","&#58;&#58;",$news);
$news = ereg_replace("\r\n","<br>",$news);
$time = ereg_replace("::","&#58;&#58;",$time);
fputs($newnewsfile,"$time::$news::\r\n");
fclose($newnewsfile);
}
}
$autfi = file("$newsdat");
if ($oldnews == "изменить" or $oldnews == "удалить")
{
$autfif = fopen("$newsdat","w");
for ($autc = 0; $autc < count($autfi); $autc++)
{
if ($autc != $n)
{
fputs($autfif,$autfi[$autc]);
}
else
{
if ($oldnews == "изменить")
{
$time = ereg_replace("::","&#58;&#58;",$time);
$news = ereg_replace("&lt;","<",$news);
$news = ereg_replace("&gt;",">",$news);
$news = ereg_replace("\r\n","<br>",$news);
fputs($autfif,"$time::$news::\r\n");
}
}
}
fclose($autfif);
}
echo "<html>
<head>
<title>Администратирование, Manlix SW News v0.2 - Разработка: Manlix SW</title>
<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">
<meta http-equiv=\"content-type\" content=\"text/html; charset=windows-1251\">
<style type=\"text/css\">
<!--
A:link    {COLOR: #000000; FONT-FAMILY: Verdana; TEXT-DECORATION: none}
A:active  {COLOR: #000000; FONT-FAMILY: Verdana; TEXT-DECORATION: none}
A:visited {COLOR: #000000; FONT-FAMILY: Verdana; TEXT-DECORATION: none}
A:hover   {COLOR: #DE0000; FONT-FAMILY: Verdana; TEXT-DECORATION: none}
-->
</style>
</head>
<body background=images/background.gif>
";
echo "
<table border=0 width=500 align=center cellspacing=1 cellpadding=1 bgcolor=000080>
<tr><td bgcolor=f5ba53 align=center><font face=verdana size=2><a href=\"http://manliks.ru/manlix\" target=\"_blank\">Manlix SW News v0.2</a></font></td></tr>
<tr><td bgcolor=face7d align=center><font face=verdana size=2 color=000080>Меню админа</font></td></tr>
<tr><td bgcolor=f5ba53 align=center><font face=verdana size=1><a href=admin.php?p=$p&menu=new>Добавить</a> |<a href=admin.php?p=$p&menu=news>Отредактировать, удалить новость</a> | <a href=admin.php?p=$p&menu=design>Дизайн</a> | <a href=admin.php?p=$p&menu=parameters>Параметры</a> | <a href=admin.php?p=$p&menu=log>Лог файл</a></td></tr>
</table>
";
if ($QUERY_STRING == "p=$password")
{
echo "
<table border=0><tr><td></td></tr></table><table border=0 width=500 align=center cellspacing=1 cellpadding=1 bgcolor=000080>
<tr><td bgcolor=face7d align=center><font face=verdana size=2 color=000080>!!! ВЫБЕРИТЕ РАЗДЕЛ !!!</font></td></tr>
</table>
";
}
$newsfile = file($newsdat);
$apa = "10";
$pm = file("$newsdat");
if ($page == "")
{
$page = "1";
}
$first = count($pm) - ($apa * ($page - 1));
$second = count($pm) - ($apa * $page) + 1;
if ($second < 1)
{
$second = 1;
}
$pages = (int) ((count($pm) + $apa) / $apa);
$line = "|";
for ($apa = 1; $apa <= $pages; $apa++)
{
if ($apa != $page)
{
$line .= "<a href=\"admin.php?p=$p&menu=news&page=$apa\"> $apa </a>|";
}
if ($apa == $page)
{
$line .= " $apa |";
}
}
if ($menu == "new")
{
$next_news = count(file($newsdat));
$next_news++;
echo "<table border=0><tr><td></td></tr></table><table border=0 width=500 align=center cellspacing=1 cellpadding=1 bgcolor=000080>
<tr><td bgcolor=face7d align=center><font face=verdana size=2 color=000080>Добавление новой новости</font></td></tr>
<form action=admin.php method=post>
<input type=hidden name=addnews value=okey>
<input type=hidden name=p value=\"$p\">
<tr><td bgcolor=ffba53 align=center><font face=verdana size=2 color=000080>Дата</td></tr>
<tr><td bgcolor=ffba53 align=center> <input type=text name=time value=\"".date("d.m.Y",time())."\" size=8></td></tr>
<tr><td bgcolor=f5ba53 align=center><font face=verdana size=2>ID этой <font color=000080>НОВОСТИ</font> будет <font color=000080>$next_news</font></font></td></tr>
<tr><td bgcolor=ffba53 align=center><textarea name=news rows=5 cols=59></textarea></td></tr>
<tr><td bgcolor=ffba53 align=center><input type=submit name=addnewnews value=\"Добавить новую новость\"></td></tr></form>
<tr><td bgcolor=face7d align=center><font face=verdana size=1 color=000080>...вместо даты можете вписать заголовок новости...</font></td></tr></form>
</table><table border=0><tr><td></td></tr></table>
<table border=0 width=500 align=center cellspacing=1 cellpadding=1 bgcolor=000080>
<tr><td bgcolor=f5ba53 align=center><font face=verdana size=2 color=000080>Всего новостей: <font color=de0000>$all_news</font></font></td></tr>
</table>
";
}
if ($lo == "okey")
{
echo "
<table border=0><tr><td></td></tr></table><table border=0 width=500 align=center cellspacing=1 cellpadding=1 bgcolor=000080>
<tr><td bgcolor=f5ba53 align=center><font face=verdana size=2>!!! <font color=000080>ЛОГ ФАЙЛ ОЧИЩЕН</font> !!!</font></td></tr>
</table>
";
}
if ($addnews == "okey")
{
echo "
<table border=0><tr><td></td></tr></table><table border=0 width=500 align=center cellspacing=1 cellpadding=1 bgcolor=000080>
<tr><td bgcolor=f5ba53 align=center><font face=verdana size=2 color=000080>!!! Новость добавлена !!!</font></td></tr>
</table>
";
}
if ($menu == "news")
{
if (count(file($newsdat)) > 0)
{
echo "
<table border=0><tr><td></td></tr></table><table border=0 width=500 align=center cellspacing=1 cellpadding=1 bgcolor=000080>
<tr><td bgcolor=f5ba53 align=center><font face=verdana size=2 color=000080>Всего новостей: <font color=de0000>$all_news</font></font></td></tr>
</table><table border=0><tr><td></td></tr></table>
<table border=0 width=500 align=center cellspacing=1 cellpadding=1 bgcolor=000080>
<tr><td bgcolor=f5ba53 align=center><font face=verdana size=1>$line</font></td></tr>
</table><table border=0><tr><td></td></tr></table>
";
}
if ($cod == "okey")
{
echo "
<table border=0 width=500 align=center cellspacing=1 cellpadding=1 bgcolor=000080>
<tr><td bgcolor=f5ba53 align=center><font face=verdana size=2>!!! <font color=000080>Новость с номером <font color=de0000>$next_n</font> успешно изменена/удалена</font> !!!</font></td></tr>
</table><table border=0><tr><td></td></tr></table>
";
}
for ( $i = $first-1; $i >= $second-1; $i--)
{
list($date,$news) = explode("::", $newsfile[$i]);
$news = str_replace("<br>","\r\n",$news);
$news = ereg_replace("<","&lt;",$news);
$news = ereg_replace(">","&gt;",$news);
$id = $i;
$id++;
echo "<table border=0 width=500 align=center cellspacing=1 cellpadding=1 bgcolor=000080>
<form action=admin.php method=post>
<input type=hidden name=menu value=news>
<input type=hidden name=p value=\"$p\">
<input type=hidden name=page value=\"$page\">
<input type=hidden name=cod value=okey>
<input type=hidden name=n value=$i>
<input type=hidden name=next_n value=\"$id\">
<tr><td bgcolor=face7d align=center><font face=verdana size=2 color=000080>Дата</td></tr>
<tr><td bgcolor=ffba53 align=center> <input type=text name=time value=\"$date\" size=8></td></tr>
<tr><td bgcolor=face7d align=center><font face=verdana size=2 color=000080>Новость <font color=000000>#</font>$id</font></td></tr>
<tr><td bgcolor=ffba53 align=center><textarea name=news rows=5 cols=59>$news</textarea></td></tr>
<tr><td bgcolor=face7d align=center><input type=submit name=oldnews value=\"удалить\"> <input type=submit name=oldnews value=\"изменить\"></td></tr></form>
</table><table border=0><tr><td></td></tr></table>
";
}
if (count(file($newsdat)) > 0)
{
echo "
<table border=0 width=500 align=center cellspacing=1 cellpadding=1 bgcolor=000080>
<tr><td bgcolor=f5ba53 align=center><font face=verdana size=2 color=000080>Всего новостей: <font color=de0000>$all_news</font></font></td></tr>
</table><table border=0><tr><td></td></tr></table>
<table border=0 width=500 align=center cellspacing=1 cellpadding=1 bgcolor=000080>
<tr><td bgcolor=f5ba53 align=center><font face=verdana size=1>$line</font></td></tr>
</table>
";
}
if (count(file($newsdat)) < 1)
{
echo "
<table border=0><tr><td></td></tr></table><table border=0 width=500 align=center cellspacing=1 cellpadding=1 bgcolor=000080>
<tr><td bgcolor=f5ba53 align=center><font face=verdana size=2 color=000080>!!! НОВОСТЕЙ НЕТ !!!</font></td></tr>
</table>
";
}
}
if ($menu == "design" and $template == "")
{
echo "<table border=0><tr><td></td></tr></table><table width=500 border=0 cellspacing=1 cellpadding=1 bgcolor=000080 align=center>\n";
echo "<tr><td bgcolor=#face7d align=center><font face=verdana size=2 color=de0000>Выберите шаблон!</font></td></tr>\n";
echo "<tr><td bgcolor=#face7d><font face=verdana size=2>1. <a href=\"admin.php?p=$p&menu=design&template=top\" target=\"_self\">Самый верх новостей</a></font></td></tr>\n";
echo "<tr><td bgcolor=#face7d><font face=verdana size=2>2. <a href=\"admin.php?p=$p&menu=design&template=bottom\" target=\"_self\">Самый низ новостей</a></font></td></tr>\n";
echo "<tr><td bgcolor=#face7d><font face=verdana size=2>3. <a href=\"admin.php?p=$p&menu=design&template=error\" target=\"_self\">Ошибка</a></font></td></tr>\n";
echo "<tr><td bgcolor=#face7d align=center><font face=verdana size=2 color=de0000>Шаблоны для новостей не из архива</font></td></tr>\n";
echo "<tr><td bgcolor=#face7d><font face=verdana size=2>4. <a href=\"admin.php?p=$p&menu=design&template=new_top\" target=\"_self\">Верхушка новостей</a></font></td></tr>\n";
echo "<tr><td bgcolor=#face7d><font face=verdana size=2>5. <a href=\"admin.php?p=$p&menu=design&template=news\" target=\"_self\">Внешний вид новости</a></font></td></tr>\n";
echo "<tr><td bgcolor=#face7d><font face=verdana size=2>6. <a href=\"admin.php?p=$p&menu=design&template=empty\" target=\"_self\">Новостей нет</a></font></td></tr>\n";
echo "<tr><td bgcolor=#face7d><font face=verdana size=2>7. <a href=\"admin.php?p=$p&menu=design&template=end\" target=\"_self\">Низ новостей</a></font></td></tr>\n";
echo "<tr><td bgcolor=#face7d align=center><font face=verdana size=2 color=de0000>Шаблоны для новостей из архива</font></td></tr>\n";
echo "<tr><td bgcolor=#face7d><font face=verdana size=2>8. <a href=\"admin.php?p=$p&menu=design&template=archive_top\" target=\"_self\">Верхушка архива новостей</a></font></td></tr>\n";
echo "<tr><td bgcolor=#face7d><font face=verdana size=2>9. <a href=\"admin.php?p=$p&menu=design&template=archive_empty\" target=\"_self\">Архив новостей пуст</a></font></td></tr>\n";
echo "<tr><td bgcolor=#face7d><font face=verdana size=2>10. <a href=\"admin.php?p=$p&menu=design&template=navigation\" target=\"_self\">Навигация по архиву</a></font></td></tr>\n";
echo "<tr><td bgcolor=#face7d><font face=verdana size=2>11. <a href=\"admin.php?p=$p&menu=design&template=archive_end\" target=\"_self\">Низ архива новостей</a></font></td></tr>\n";
echo "</table>\n";
}
if ($template == "top")
{
echo "<table border=0><tr><td></td></tr></table><table width=500 border=0 cellspacing=1 cellpadding=1 bgcolor=000080 align=center>\n";
echo "<tr><td bgcolor=#face7d align=center><font face=verdana size=2 color=maroon>Шаблон \"<font color=de0000>САМЫЙ ВЕРХ НОВОСТЕЙ</font>\"</font></td></tr>\n";
$t_top = file("$dtemplates/top.htm");
echo "<form action=\"admin.php\" method=\"post\"><input type=hidden name=p value=\"$p\"><input type=hidden name=menu value=design>\n<tr><td bgcolor=#face7d align=center>";
echo "<textarea name=\"d_e_t\" cols=59 rows=15>";
for($t = 0 ; $t < count($t_top); $t++)
{
$t_top[$t] = str_replace('"',"&quot;",$t_top[$t]);
$t_top[$t] = str_replace('<',"&lt;",$t_top[$t]);
$t_top[$t] = str_replace('>',"&gt;",$t_top[$t]);
$t_top[$t] = str_replace("\r\n","\r",$t_top[$t]);
echo $t_top[$t];
}
echo "\n</textarea></font></td></tr>";
echo "<tr><td bgcolor=#face7d align=center><input type=\"submit\" name=\"design_top\" value=\"Изменить @ Применить\"></td></tr>\n";
echo "</table>\n</form>";
}
if ($design_top == "Изменить @ Применить")
{
$u_t_top = fopen("$dtemplates/top.htm","w");
$d_e_t = ereg_replace("&quot;",'"',$d_e_t);
$d_e_t = ereg_replace("\\\'","'",$d_e_t);
$d_e_t = ereg_replace('\\\"','"',$d_e_t);
$d_e_t = str_replace('&lt;',"<",$d_e_t);
$d_e_t = str_replace('&gt;',">",$d_e_t);
fputs ($u_t_top,$d_e_t);
}
if ($template == "error")
{
echo "<table border=0><tr><td></td></tr></table><table width=500 border=0 cellspacing=1 cellpadding=1 bgcolor=000080 align=center>\n";
echo "<tr><td bgcolor=#face7d align=center><font face=verdana size=2 color=maroon>Шаблон \"<font color=de0000>ОШИБКА</font>\"</font></td></tr>\n";
$t_top = file("$dtemplates/error.htm");
echo "<form action=\"admin.php\" method=\"post\"><input type=hidden name=p value=\"$p\"><input type=hidden name=menu value=design>\n<tr><td bgcolor=#face7d align=center>";
echo "<textarea name=\"d_e_t\" cols=59 rows=15>";
for($t = 0 ; $t < count($t_top); $t++)
{
$t_top[$t] = str_replace('"',"&quot;",$t_top[$t]);
$t_top[$t] = str_replace('<',"&lt;",$t_top[$t]);
$t_top[$t] = str_replace('>',"&gt;",$t_top[$t]);
$t_top[$t] = str_replace("\r\n","\r",$t_top[$t]);
echo $t_top[$t];
}
echo "\n</textarea></font></td></tr>";
echo "<tr><td bgcolor=#face7d align=center><input type=\"submit\" name=\"design_error\" value=\"Изменить @ Применить\"></td></tr>\n";
echo "</table>\n</form>";
}
if ($design_error == "Изменить @ Применить")
{
$u_t_top = fopen("$dtemplates/error.htm","w");
$d_e_t = ereg_replace("&quot;",'"',$d_e_t);
$d_e_t = ereg_replace("\\\'","'",$d_e_t);
$d_e_t = ereg_replace('\\\"','"',$d_e_t);
$d_e_t = str_replace('&lt;',"<",$d_e_t);
$d_e_t = str_replace('&gt;',">",$d_e_t);
fputs ($u_t_top,$d_e_t);
}
if ($template == "new_top")
{
echo "<table border=0><tr><td></td></tr></table><table width=500 border=0 cellspacing=1 cellpadding=1 bgcolor=000080 align=center>\n";
echo "<tr><td bgcolor=#face7d align=center><font face=verdana size=2 color=maroon>Шаблон \"<font color=de0000>ВЕРХУШКА НОВОСТЕЙ</font>\"</font></td></tr>\n";
$t_top = file("$dtemplates/new_top.htm");
echo "<form action=\"admin.php\" method=\"post\"><input type=hidden name=p value=\"$p\"><input type=hidden name=menu value=design>\n<tr><td bgcolor=#face7d align=center>";
echo "<textarea name=\"d_e_t\" cols=59 rows=15>";
for($t = 0 ; $t < count($t_top); $t++)
{
$t_top[$t] = str_replace('"',"&quot;",$t_top[$t]);
$t_top[$t] = str_replace('<',"&lt;",$t_top[$t]);
$t_top[$t] = str_replace('>',"&gt;",$t_top[$t]);
$t_top[$t] = str_replace("\r\n","\r",$t_top[$t]);
echo $t_top[$t];
}
echo "\n</textarea></font></td></tr>";
echo "<tr><td bgcolor=#face7d align=center><input type=\"submit\" name=\"design_news_top\" value=\"Изменить @ Применить\"></td></tr>\n";
echo "</table>\n</form>";
}
if ($design_news_top == "Изменить @ Применить")
{
$u_t_top = fopen("$dtemplates/new_top.htm","w");
$d_e_t = ereg_replace("&quot;",'"',$d_e_t);
$d_e_t = ereg_replace("\\\'","'",$d_e_t);
$d_e_t = ereg_replace('\\\"','"',$d_e_t);
$d_e_t = str_replace('&lt;',"<",$d_e_t);
$d_e_t = str_replace('&gt;',">",$d_e_t);
fputs ($u_t_top,$d_e_t);
}
if ($template == "end")
{
echo "<table border=0><tr><td></td></tr></table><table width=500 border=0 cellspacing=1 cellpadding=1 bgcolor=000080 align=center>\n";
echo "<tr><td bgcolor=#face7d align=center><font face=verdana size=2 color=maroon>Шаблон \"<font color=de0000>НИЗ НОВОСТЕЙ</font>\"</font></td></tr>\n";
$t_top = file("$dtemplates/end.htm");
echo "<form action=\"admin.php\" method=\"post\"><input type=hidden name=p value=\"$p\"><input type=hidden name=menu value=design>\n<tr><td bgcolor=#face7d align=center>";
echo "<textarea name=\"d_e_t\" cols=59 rows=15>";
for($t = 0 ; $t < count($t_top); $t++)
{
$t_top[$t] = str_replace('"',"&quot;",$t_top[$t]);
$t_top[$t] = str_replace('<',"&lt;",$t_top[$t]);
$t_top[$t] = str_replace('>',"&gt;",$t_top[$t]);
$t_top[$t] = str_replace("\r\n","\r",$t_top[$t]);
echo $t_top[$t];
}
echo "\n</textarea></font></td></tr>";
echo "<tr><td bgcolor=#face7d align=center><input type=\"submit\" name=\"design_end\" value=\"Изменить @ Применить\"></td></tr>\n";
echo "<tr><td bgcolor=#face7d align=center><font face=verdana size=2 color=000080>Автозамена</font></td></tr>\n";
echo "<tr><td bgcolor=#face7d><font face=verdana size=2><font color=000080>%archive%</font> - $title_archive</font></td></tr>\n";
echo "</table>\n</form>";
}
if ($design_end == "Изменить @ Применить")
{
$u_t_top = fopen("$dtemplates/end.htm","w");
$d_e_t = ereg_replace("&quot;",'"',$d_e_t);
$d_e_t = ereg_replace("\\\'","'",$d_e_t);
$d_e_t = ereg_replace('\\\"','"',$d_e_t);
$d_e_t = str_replace('&lt;',"<",$d_e_t);
$d_e_t = str_replace('&gt;',">",$d_e_t);
fputs ($u_t_top,$d_e_t);
}
if ($template == "navigation")
{
echo "<table border=0><tr><td></td></tr></table><table width=500 border=0 cellspacing=1 cellpadding=1 bgcolor=000080 align=center>\n";
echo "<tr><td bgcolor=#face7d align=center><font face=verdana size=2 color=maroon>Шаблон \"<font color=de0000>НАВИГАЦИЯ ПО АРХИВУ</font>\"</font></td></tr>\n";
$t_top = file("$dtemplates/navigation.htm");
echo "<form action=\"admin.php\" method=\"post\"><input type=hidden name=p value=\"$p\"><input type=hidden name=menu value=design>\n<tr><td bgcolor=#face7d align=center>";
echo "<textarea name=\"d_e_t\" cols=59 rows=15>";
for($t = 0 ; $t < count($t_top); $t++)
{
$t_top[$t] = str_replace('"',"&quot;",$t_top[$t]);
$t_top[$t] = str_replace('<',"&lt;",$t_top[$t]);
$t_top[$t] = str_replace('>',"&gt;",$t_top[$t]);
$t_top[$t] = str_replace("\r\n","\r",$t_top[$t]);
echo $t_top[$t];
}
echo "\n</textarea></font></td></tr>";
echo "<tr><td bgcolor=#face7d align=center><input type=\"submit\" name=\"design_navigation\" value=\"Изменить @ Применить\"></td></tr>\n";
echo "<tr><td bgcolor=#face7d align=center><font face=verdana size=2 color=000080>Автозамена</font></td></tr>\n";
echo "<tr><td bgcolor=#face7d><font face=verdana size=2><font color=000080>%navigation%</font> - $back$snb$next</font></td></tr>\n";
echo "</table>\n</form>";
}
if ($design_navigation == "Изменить @ Применить")
{
$u_t_top = fopen("$dtemplates/navigation.htm","w");
$d_e_t = ereg_replace("&quot;",'"',$d_e_t);
$d_e_t = ereg_replace("\\\'","'",$d_e_t);
$d_e_t = ereg_replace('\\\"','"',$d_e_t);
$d_e_t = str_replace('&lt;',"<",$d_e_t);
$d_e_t = str_replace('&gt;',">",$d_e_t);
fputs ($u_t_top,$d_e_t);
}
if ($template == "news")
{
echo "<table border=0><tr><td></td></tr></table><table width=500 border=0 cellspacing=1 cellpadding=1 bgcolor=000080 align=center>\n";
echo "<tr><td bgcolor=#face7d align=center><font face=verdana size=2 color=maroon>Шаблон \"<font color=de0000>ВНЕШНИЙ ВИД НОВОСТИ</font>\"</font></td></tr>\n";
$t_top = file("$dtemplates/news.htm");
echo "<form action=\"admin.php\" method=\"post\"><input type=hidden name=p value=\"$p\"><input type=hidden name=menu value=design>\n<tr><td bgcolor=#face7d align=center>";
echo "<textarea name=\"d_e_t\" cols=59 rows=15>";
for($t = 0 ; $t < count($t_top); $t++)
{
$t_top[$t] = str_replace('"',"&quot;",$t_top[$t]);
$t_top[$t] = str_replace('<',"&lt;",$t_top[$t]);
$t_top[$t] = str_replace('>',"&gt;",$t_top[$t]);
$t_top[$t] = str_replace("\r\n","\r",$t_top[$t]);
echo $t_top[$t];
}
echo "\n</textarea></font></td></tr>";
echo "<tr><td bgcolor=#face7d align=center><input type=\"submit\" name=\"design_news\" value=\"Изменить @ Применить\"></td></tr>\n";
echo "<tr><td bgcolor=#face7d align=center><font face=verdana size=2 color=000080>Автозамена</font></td></tr>\n";
echo "<tr><td bgcolor=#face7d><font face=verdana size=2><font color=000080>%date%</font> - дата новости</font></td></tr>\n";
echo "<tr><td bgcolor=#face7d><font face=verdana size=2><font color=000080>%news%</font> - сама новость</font></td></tr>\n";
echo "<tr><td bgcolor=#face7d><font face=verdana size=2><font color=000080>%id%</font> - id новости</font></td></tr>\n";
echo "</table>\n</form>";
}
if ($design_news == "Изменить @ Применить")
{
$u_t_top = fopen("$dtemplates/news.htm","w");
$d_e_t = ereg_replace("&quot;",'"',$d_e_t);
$d_e_t = ereg_replace("\\\'","'",$d_e_t);
$d_e_t = ereg_replace('\\\"','"',$d_e_t);
$d_e_t = str_replace('&lt;',"<",$d_e_t);
$d_e_t = str_replace('&gt;',">",$d_e_t);
fputs ($u_t_top,$d_e_t);
}
if ($template == "archive_end")
{
echo "<table border=0><tr><td></td></tr></table><table width=500 border=0 cellspacing=1 cellpadding=1 bgcolor=000080 align=center>\n";
echo "<tr><td bgcolor=#face7d align=center><font face=verdana size=2 color=maroon>Шаблон \"<font color=de0000>НИЗ АРХИВА НОВОСТЕЙ</font>\"</font></td></tr>\n";
$t_top = file("$dtemplates/archive_end.htm");
echo "<form action=\"admin.php\" method=\"post\"><input type=hidden name=p value=\"$p\"><input type=hidden name=menu value=design>\n<tr><td bgcolor=#face7d align=center>";
echo "<textarea name=\"d_e_t\" cols=59 rows=15>";
for($t = 0 ; $t < count($t_top); $t++)
{
$t_top[$t] = str_replace('"',"&quot;",$t_top[$t]);
$t_top[$t] = str_replace('<',"&lt;",$t_top[$t]);
$t_top[$t] = str_replace('>',"&gt;",$t_top[$t]);
$t_top[$t] = str_replace("\r\n","\r",$t_top[$t]);
echo $t_top[$t];
}
echo "\n</textarea></font></td></tr>";
echo "<tr><td bgcolor=#face7d align=center><input type=\"submit\" name=\"design_archive_end\" value=\"Изменить @ Применить\"></td></tr>\n";
echo "<tr><td bgcolor=#face7d align=center><font face=verdana size=2 color=000080>Автозамена</font></td></tr>\n";
echo "<tr><td bgcolor=#face7d><font face=verdana size=2><font color=000080>%news_list%</font> - $non_title_archive</font></td></tr>\n";
echo "</table>\n</form>";
}
if ($design_archive_end == "Изменить @ Применить")
{
$u_t_top = fopen("$dtemplates/archive_end.htm","w");
$d_e_t = ereg_replace("&quot;",'"',$d_e_t);
$d_e_t = ereg_replace("\\\'","'",$d_e_t);
$d_e_t = ereg_replace('\\\"','"',$d_e_t);
$d_e_t = str_replace('&lt;',"<",$d_e_t);
$d_e_t = str_replace('&gt;',">",$d_e_t);
fputs ($u_t_top,$d_e_t);
}
if ($template == "archive_empty")
{
echo "<table border=0><tr><td></td></tr></table><table width=500 border=0 cellspacing=1 cellpadding=1 bgcolor=000080 align=center>\n";
echo "<tr><td bgcolor=#face7d align=center><font face=verdana size=2 color=maroon>Шаблон \"<font color=de0000>АРХИВ НОВОСТЕЙ ПУСТ</font>\"</font></td></tr>\n";
$t_top = file("$dtemplates/archive_empty.htm");
echo "<form action=\"admin.php\" method=\"post\"><input type=hidden name=p value=\"$p\"><input type=hidden name=menu value=design>\n<tr><td bgcolor=#face7d align=center>";
echo "<textarea name=\"d_e_t\" cols=59 rows=15>";
for($t = 0 ; $t < count($t_top); $t++)
{
$t_top[$t] = str_replace('"',"&quot;",$t_top[$t]);
$t_top[$t] = str_replace('<',"&lt;",$t_top[$t]);
$t_top[$t] = str_replace('>',"&gt;",$t_top[$t]);
$t_top[$t] = str_replace("\r\n","\r",$t_top[$t]);
echo $t_top[$t];
}
echo "\n</textarea></font></td></tr>";
echo "<tr><td bgcolor=#face7d align=center><input type=\"submit\" name=\"design_archive_empty\" value=\"Изменить @ Применить\"></td></tr>\n";
echo "</table>\n</form>";
}
if ($design_archive_empty == "Изменить @ Применить")
{
$u_t_top = fopen("$dtemplates/archive_empty.htm","w");
$d_e_t = ereg_replace("&quot;",'"',$d_e_t);
$d_e_t = ereg_replace("\\\'","'",$d_e_t);
$d_e_t = ereg_replace('\\\"','"',$d_e_t);
$d_e_t = str_replace('&lt;',"<",$d_e_t);
$d_e_t = str_replace('&gt;',">",$d_e_t);
fputs ($u_t_top,$d_e_t);
}
if ($template == "archive_top")
{
echo "<table border=0><tr><td></td></tr></table><table width=500 border=0 cellspacing=1 cellpadding=1 bgcolor=000080 align=center>\n";
echo "<tr><td bgcolor=#face7d align=center><font face=verdana size=2 color=maroon>Шаблон \"<font color=de0000>ВЕРХУШКА АРХИВА НОВОСТЕЙ</font>\"</font></td></tr>\n";
$t_top = file("$dtemplates/archive_top.htm");
echo "<form action=\"admin.php\" method=\"post\"><input type=hidden name=p value=\"$p\"><input type=hidden name=menu value=design>\n<tr><td bgcolor=#face7d align=center>";
echo "<textarea name=\"d_e_t\" cols=59 rows=15>";
for($t = 0 ; $t < count($t_top); $t++)
{
$t_top[$t] = str_replace('"',"&quot;",$t_top[$t]);
$t_top[$t] = str_replace('<',"&lt;",$t_top[$t]);
$t_top[$t] = str_replace('>',"&gt;",$t_top[$t]);
$t_top[$t] = str_replace("\r\n","\r",$t_top[$t]);
echo $t_top[$t];
}
echo "\n</textarea></font></td></tr>";
echo "<tr><td bgcolor=#face7d align=center><input type=\"submit\" name=\"design_archive_top\" value=\"Изменить @ Применить\"></td></tr>\n";
echo "</table>\n</form>";
}
if ($design_archive_top == "Изменить @ Применить")
{
$u_t_top = fopen("$dtemplates/archive_top.htm","w");
$d_e_t = ereg_replace("&quot;",'"',$d_e_t);
$d_e_t = ereg_replace("\\\'","'",$d_e_t);
$d_e_t = ereg_replace('\\\"','"',$d_e_t);
$d_e_t = str_replace('&lt;',"<",$d_e_t);
$d_e_t = str_replace('&gt;',">",$d_e_t);
fputs ($u_t_top,$d_e_t);
}
if ($template == "bottom")
{
echo "<table border=0><tr><td></td></tr></table><table width=500 border=0 cellspacing=1 cellpadding=1 bgcolor=000080 align=center>\n";
echo "<tr><td bgcolor=#face7d align=center><font face=verdana size=2 color=maroon>Шаблон \"<font color=de0000>САМЫЙ НИЗ НОВОСТЕЙ</font>\"</font></td></tr>\n";
$t_top = file("$dtemplates/bottom.htm");
echo "<form action=\"admin.php\" method=\"post\"><input type=hidden name=p value=\"$p\"><input type=hidden name=menu value=design>\n<tr><td bgcolor=#face7d align=center>";
echo "<textarea name=\"d_e_t\" cols=59 rows=15>";
for($t = 0 ; $t < count($t_top); $t++)
{
$t_top[$t] = str_replace('"',"&quot;",$t_top[$t]);
$t_top[$t] = str_replace('<',"&lt;",$t_top[$t]);
$t_top[$t] = str_replace('>',"&gt;",$t_top[$t]);
$t_top[$t] = str_replace("\r\n","\r",$t_top[$t]);
echo $t_top[$t];
}
echo "\n</textarea></font></td></tr>";
echo "<tr><td bgcolor=#face7d align=center><input type=\"submit\" name=\"design_bottom\" value=\"Изменить @ Применить\"></td></tr>\n";
echo "</table>\n</form>";
}
if ($design_bottom == "Изменить @ Применить")
{
$u_t_top = fopen("$dtemplates/bottom.htm","w");
$d_e_t = ereg_replace("&quot;",'"',$d_e_t);
$d_e_t = ereg_replace("\\\'","'",$d_e_t);
$d_e_t = ereg_replace('\\\"','"',$d_e_t);
$d_e_t = str_replace('&lt;',"<",$d_e_t);
$d_e_t = str_replace('&gt;',">",$d_e_t);
fputs ($u_t_top,$d_e_t);
}
if ($template == "empty")
{
echo "<table border=0><tr><td></td></tr></table><table width=500 border=0 cellspacing=1 cellpadding=1 bgcolor=000080 align=center>\n";
echo "<tr><td bgcolor=#face7d align=center><font face=verdana size=2 color=maroon>Шаблон \"<font color=de0000>НОВОСТЕЙ НЕТ</font>\"</font></td></tr>\n";
$t_top = file("$dtemplates/empty.htm");
echo "<form action=\"admin.php\" method=\"post\"><input type=hidden name=p value=\"$p\"><input type=hidden name=menu value=design>\n<tr><td bgcolor=#face7d align=center>";
echo "<textarea name=\"d_e_t\" cols=59 rows=15>";
for($t = 0 ; $t < count($t_top); $t++)
{
$t_top[$t] = str_replace('"',"&quot;",$t_top[$t]);
$t_top[$t] = str_replace('<',"&lt;",$t_top[$t]);
$t_top[$t] = str_replace('>',"&gt;",$t_top[$t]);
$t_top[$t] = str_replace("\r\n","\r",$t_top[$t]);
echo $t_top[$t];
}
echo "\n</textarea></font></td></tr>";
echo "<tr><td bgcolor=#face7d align=center><input type=\"submit\" name=\"design_empty\" value=\"Изменить @ Применить\"></td></tr>\n";
echo "</table>\n</form>";
}
if ($design_empty == "Изменить @ Применить")
{
$u_t_top = fopen("$dtemplates/empty.htm","w");
$d_e_t = ereg_replace("&quot;",'"',$d_e_t);
$d_e_t = ereg_replace("\\\'","'",$d_e_t);
$d_e_t = ereg_replace('\\\"','"',$d_e_t);
$d_e_t = str_replace('&lt;',"<",$d_e_t);
$d_e_t = str_replace('&gt;',">",$d_e_t);
fputs ($u_t_top,$d_e_t);
}
if ($menu == "parameters")
{
echo "<table border=0><tr><td></td></tr></table><table width=500 border=0 cellspacing=1 cellpadding=1 bgcolor=000080 align=center>\n";
echo "<form action=admin.php method=get><input type=hidden name=p value=\"$p\"><input type=hidden name=update_okey value=yes><tr><td bgcolor=#face7d align=center colspan=2><font face=verdana size=2 color=000080>ПАРАМЕТРЫ</font></td></tr>\n";
echo "<tr><td bgcolor=#face7d align=center width=50%><font face=verdana size=2 color=000080>Пароль админа:</font></td><td bgcolor=#face7d align=center><input type=text name=password_ value=\"$password\" size=33></td></tr>\n";
echo "<tr><td bgcolor=#face7d align=center width=50%><font face=verdana size=2 color=000080>Разделитель новостей</font></td><td bgcolor=#face7d align=center><input type=text name=separator_ value=\"$separator\" size=33></td></tr>\n";
echo "<tr><td bgcolor=#face7d align=center width=50%><font face=verdana size=2 color=000080>Кол-во новостей на стр.</font></td><td bgcolor=#face7d align=center><input type=text name=ap_ value=\"$ap\" size=33></td></tr>\n";
echo "<tr><td bgcolor=#face7d align=center width=50%><font face=verdana size=2 color=000080>Кол-во новостей на стр. архива</font></td><td bgcolor=#face7d align=center><input type=text name=show_archive_ value=\"$show_archive\" size=33></td></tr>\n";
echo "<tr><td bgcolor=#face7d align=center width=50%><font face=verdana size=2 color=000080>Папка с шаблонами</font></td><td bgcolor=#face7d align=center><input type=text name=dtemplates_ value=\"$dtemplates\" size=33></td></tr>\n";
echo "<tr><td bgcolor=#face7d align=center width=50%><font face=verdana size=2 color=000080>Файл с новостями</font></td><td bgcolor=#face7d align=center><input type=text name=newsdat_ value=\"$newsdat\" size=33></td></tr>\n";
echo "<tr><td bgcolor=#face7d align=center width=50%><font face=verdana size=2 color=000080>Надпись &quot;архив новостей&quot;</font></td><td bgcolor=#face7d align=center><input type=text name=non_title_archive_ value=\"$non_title_archive\" size=33></td></tr>\n";
echo "<tr><td bgcolor=#face7d align=center width=50%><font face=verdana size=2 color=000080>Надпись &quot;к списку новостей&quot;</font></td><td bgcolor=#face7d align=center><input type=text name=title_archive_ value=\"$title_archive\" size=33></td></tr>\n";
echo "<tr><td bgcolor=#face7d align=center width=50%><font face=verdana size=2 color=000080>Слово &quot;вперёд&quot; в архиве:</font></td><td bgcolor=#face7d align=center><input type=text name=next_ value=\"$next\" size=33></td></tr>\n";
echo "<tr><td bgcolor=#face7d align=center width=50%><font face=verdana size=2 color=000080>Слово &quot;назад&quot; в архиве:</font></td><td bgcolor=#face7d align=center><input type=text name=back_ value=\"$back\" size=33></td></tr>\n";
echo "<tr><td bgcolor=#face7d align=center width=50%><font face=verdana size=1 color=000080>Разделитель между &quot;вперёд&quot; и &quot;назад&quot;:</font></td><td bgcolor=#face7d align=center><input type=text name=snb_ value=\"$snb\" size=33></td></tr>\n";
if ($fp != "")
{
echo "<tr><td bgcolor=#face7d align=center width=50%><font face=verdana size=2 color=000080>Полный путь к новостям:</font></td><td bgcolor=#face7d align=center><input type=text name=fp_ value=\"$fp\" size=33></td></tr>\n";
}
$sct = $PHP_SELF;
$sct = eregi_replace("admin.php","","$sct");
if ($fp == "")
{
echo "<tr><td bgcolor=#face7d align=center width=50%><font face=verdana size=2 color=000080>Полный путь к новостям:</font></td><td bgcolor=#face7d align=center><input type=text name=fp_ value=\"$DOCUMENT_ROOT$sct\" size=33></td></tr>\n";
}
echo "<tr><td bgcolor=#face7d align=center colspan=2><font face=verdana size=1>например: <font color=maroon>/pub/home/htdocs/mnlxswnews02/</font></font></td></tr>";
echo "<tr><td bgcolor=#face7d align=center colspan=2><input type=\"submit\" name=\"update\" value=\"Изменить @ Применить\"></td></tr>";
echo "</table></form>\n";
}
if ($update == "Изменить @ Применить")
{
$a_update_config = str_replace('"',"'",$a_update_config);
$a_update_config  = "<?\r\n";
$a_update_config .= "#############################################\r\n# Создание скрипта: Manlix SW               #\r\n# Имя скрипта: Manlix SW News               #\r\n# Версия скрипта: 0.2                       #\r\n# Статус: Бесплатный скрипт                 #\r\n# Требования: PHP3 и выше                   #\r\n# Дата создания скрипта: 21 марта 2002 год  #\r\n# Страница:  http://manliks.ru/manlix       #\r\n#############################################\r\n#         Читай файл HowToUse.htm           #\r\n#############################################\r\n\r\n";
$a_update_config .= "#############################################\r\n#   ЭТОТ ФАЙЛ ЖЕЛАТЕЛЬНО ИЗМЕНЯТЬ, ЧЕРЕЗ    #\r\n#         ПАНЕЛЬКУ АДМИНИСТРАТОРА           #\r\n#############################################\r\n\r\n";
$a_update_config .= "\$next = \"$next_\";\r\n";
$a_update_config .= "\$back = \"$back_\";\r\n";
$a_update_config .= "\$snb = \"$snb_\";\r\n";
$a_update_config .= "\$show_archive = \"$show_archive_\";\r\n";
$a_update_config .= "\$fp = \"$fp_\";\r\n";
$a_update_config .= "\$title_archive = \"$title_archive_\";\r\n";
$a_update_config .= "\$non_title_archive = \"$non_title_archive_\";\r\n";
$a_update_config .= "\$password = \"$password_\";\r\n";
$a_update_config .= "\$separator = \"$separator_\";\r\n";
$a_update_config .= "\$ap = \"$ap_\";\r\n";
$a_update_config .= "\$dtemplates = \"$dtemplates_\";\r\n";
$a_update_config .= "\$newsdat = \"$newsdat_\";\r\n";
$a_update_config .= "?>";
$u_update_config = fopen("config.inc.php","w+");
$a_update_config = str_replace('&lt;',"<",$a_update_config);
$a_update_config = str_replace('&gt;',">",$a_update_config);
fputs ($u_update_config,$a_update_config);
}
if ($update_okey == "yes")
{
echo "<table border=0><tr><td></td></tr></table><table width=500 border=0 cellspacing=1 cellpadding=1 bgcolor=000080 align=center>";
echo "<tr><td bgcolor=#face7d align=center><font face=verdana size=2 color=000080>Параметры новостей <font color=green>обновленны</font>!</font></td></td></tr>";
echo "</table>";
form();
}
if ($menu == "log")
{
$log_admin = file("logs/admin.log");
$onlyplog = "20";
$p2messages = file("logs/admin.log");
if ($pagelog == "")
{
$pagelog = "1";
}
$firstlog = count($p2messages) - ($onlyplog * ($pagelog - 1));
$secondlog = count($p2messages) - ($onlyplog * $pagelog) + 1;
if ($secondlog < 1)
{
$secondlog = 1;
}
$pageslog = (int) ((count($p2messages) + $onlyplog) / $onlyplog);
$linelog = "|";
for ($onlyplog = 1; $onlyplog <= $pageslog; $onlyplog++)
{
if ($onlyplog != $pagelog)
{
$linelog .= "<a href=\"admin.php?p=$p&menu=logs&pagelog=$onlyplog\"> $onlyplog </a>|";
}
if ($onlyplog == $pagelog)
{
$linelog .= " $onlyplog |";
}
}
echo "<table border=0><tr><td></td></tr></table><table width=500 border=0 cellspacing=1 cellpadding=1 bgcolor=000080 align=center>";
$log_admin = file("logs/admin.log");
if(count($log_admin) < "1")
{
echo "<tr><td bgcolor=#face7d align=center><font face=verdana size=2 color=de0000>Лог файл пуст!</font></td></td></tr>";
}
if(count($log_admin) == "1" or count($log_admin) > "1")
{
echo "<tr><td bgcolor=#face7d align=center colspan=4><font color=de0000 face=verdana size=2>Лог на панельку входа админа</td></tr>";
echo "<tr><td bgcolor=#face7d align=center colspan=4><font face=verdana size=1>$linelog</td></tr>";
echo "<tr><td bgcolor=#face7d align=center><font color=de0000 face=verdana size=2>IP адрес</td><td bgcolor=#face7d align=center><font color=green face=verdana size=2>Хост</td><td bgcolor=#face7d align=center><font color=red face=verdana size=2>Дата</td><td bgcolor=#face7d align=center><font color=000000 face=verdana size=2>Введённый пароль</td></tr>";
}
for ( $la = $firstlog-1; $la >= $secondlog-1; $la--)
{
list($log_ip,$log_host,$log_date,$log_password)=explode("<>", $log_admin[$la]);
echo "<tr><td bgcolor=#face7d align=center><font color=000080 face=verdana size=2>$log_ip</td><td bgcolor=#face7d align=center><font color=000080 face=verdana size=2>$log_host</td><td bgcolor=#face7d align=center><font color=000080 face=verdana size=2>$log_date</td><td bgcolor=#face7d align=center><font color=000080 face=verdana size=2>$log_password</td></tr>";
}
if(count($log_admin) == "1" or count($log_admin) > "1")
{
$coal2 = file("logs/admin.log");
$coal = count($coal2);
echo "<tr><td bgcolor=#face7d align=center colspan=4><font face=verdana size=1>$linelog</td></tr>";
echo "<form action=admin.php method=get><input type=hidden name=menu value=log><input type=hidden name=lo value=okey><input type=hidden name=p value=\"$p\"><tr><td bgcolor=#face7d align=center colspan=4><input type=submit name=log value=\"Очистить лог файл\"></td></tr>\n<tr><td bgcolor=#face7d align=center colspan=4><font color=000080 face=verdana size=2>Попыток входа не админом: <font color=de0000>$coal</font></font></td></tr></form>";
}
echo "</table>";
}
}
if ($QUERY_STRING != "" and $p != "$password" and $update == "")
{
if(empty($log_ip))
{
if (getenv('HTTP_X_FORWARDED_FOR'))
{
$ip=getenv('HTTP_X_FORWARDED_FOR');
}
else
{
$log_ip=getenv('REMOTE_ADDR');
}
}
$log_host=gethostbyaddr("$log_ip");
$log_date=date('d\.m\.Y, H:i:s');
$log_file = fopen("logs/admin.log","a+");
$p = eregi_replace("<","&lt;","$p");
$p = eregi_replace(">","&gt;","$p");
if($p == "")
{
$p = "не вводил";
}
fputs ($log_file,"$log_ip<>$log_host<>$log_date<>$p\r\n");
fclose ($log_file);
}
?>