<?
session_start();
include ("header.php");
$data=date("YmdHi");
$data4=date("Ymd");
$ref=rand(100000,1000000);
if (!$autorize) {
echo $div["header"];
echo "[<a href=\"login.php?".session_name()."=".session_id()."\">Вход</a>][<a href=\"reg.php?".session_name()."=".session_id()."\">Регистрация</a>]<br/>";
echo $div["end"];
echo $div["div"];
if ($_SESSION['wap']!="xml") {echo "-<br/>";}
echo $div["end"];
}
//Проверка
$qp = mysql_query("select * from forum where id='$p';");
if (mysql_affected_rows()==0)
{
echo $div["div"];
echo "Ошибка!<br/>";
echo "-<br/>";
echo $div["end"];
include ("footer.php");
exit();
}
if (($autorize['adminka']==1||$autorize['moderka']==2)&&$edit=="del")
{
@mysql_query("delete from `messages` where `id`='$iddel'");
}
if ($autorize&&$mod=="delmsg")
{
$q_msg = mysql_query("select * from `messages` where ((`id`='$postid')and(`who`='$login'));");
$row_msg=mysql_fetch_array($q_msg);
if (mysql_affected_rows()!=0)
{
@mysql_query("delete from `messages` where `id`='$postid'");
}
}
echo $div["div"];
//берем все это дело :)
$fie=mysql_fetch_array($qp);
$forums=$fie['forums'];
$podforums=$fie['podforums'];
$theme=$fie['themes'];
$adtem=$fie['who'];
$close=$fie['close'];
$in=$fie['mod'];
$qpf = mysql_query("select id from forum where ((forums='$forums')and(f='1'));");
$qpp = mysql_query("select id from forum where ((podforums='$podforums')and(b='1'));");
$qpt = mysql_query("select id,who from forum where ((themes='$theme')and(t='1'));");
$forumsidDB=mysql_fetch_array($qpf);
$podforumsidDB=mysql_fetch_array($qpp);
$themeidDB=mysql_fetch_array($qpt);
$forumsid=$forumsidDB['id'];
$podforumsid=$podforumsidDB['id'];
$themeid=$themeidDB['id'];
$whoistem=$themeidDB['who'];
$qpmf = mysql_query("select * from moders where ((who='$login')and(forum='all'));");
if (mysql_affected_rows()!=0)
{
$moder="1";
}
$qpmf = mysql_query("select * from moders where ((who='$login')and(forum='$forumsid'));");
if (mysql_affected_rows()!=0)
{
$moder="1";
}
if (($autorize['adminka']==1||$autorize['moderka']==2)&&$tema=="close"&&$close!=1)
{
@mysql_query("UPDATE forum SET `close`='1' WHERE id='$p'");
echo "Тема закрыта!<br/>";
}
if (($autorize['adminka']==1||$autorize['moderka']==2)&&$tema=="open"&&$close==1)
{
@mysql_query("UPDATE forum SET `close`='0' WHERE id='$p'");
echo "Тема открыта!<br/>";
}
if (($autorize['adminka']==1)&&$tema=="on"&&$in!=1)
{
@mysql_query("UPDATE forum SET `mod`='1' WHERE id='$p'");
echo "Тема сделана важной!<br/>";
}
if (($autorize['adminka']==1)&&$tema=="off"&&$in==1)
{
@mysql_query("UPDATE forum SET `mod`='0' WHERE id='$p'");
echo "Тема убрана из важных!<br/>";
}
echo $div["end"];
//настройки навигации
$page=@$_GET['page'];
if (!isset($page) || $page=='' || $page<1 ) {
$page=1;}
if ($autorize) {$max_lines_on_page=$autorize['postmsg'];} else {$max_lines_on_page=10;}
$maxpages=5;
$t=2;
if (empty($postp)) {$limit=($page-1)* $max_lines_on_page;} else {$limit=$postp;}
//поехали :)
echo $div["header"];
echo "<a href=\"index.php?b=$forumsid&".session_name()."=".session_id()."\">$forums</a> » ";
echo "<a href=\"topslist.php?p=$podforumsid&".session_name()."=".session_id()."\">$podforums</a><br/> » ";
if (($mod!="add")&&($mod!="red")&&($about=="")) {echo "$theme<br/>";} else { echo "<a href=\"postslist.php?p=$themeid&".session_name()."=".session_id()."\">$theme</a><br/>";}
echo "[<a href=\"postslist.php?p=$p&page=$page&".session_name()."=".session_id()."&ref=$ref\">Обновить</a>]<br/>";
$whoistem=strtolower($whoistem);
$login=strtolower($login);
if ($whoistem==$login) {echo "Оцените ответы участников вашей темы!<br/>";}
echo $div["end"];
echo $div["div"];
if ($_SESSION['wap']!="xml") {echo "-<br/>";}
echo $div["end"];
if ($autorize&&$mod=="red")
{
if (empty($go))
{
$q_msg = mysql_query("select * from `messages` where ((`id`='$postid')and(`who`='$login'));");
$row_msg=mysql_fetch_array($q_msg);
$msg_db=$row_msg['message'];
if ($_SESSION['wap']=="xml")
{
echo "<form action=\"postslist.php?p=$p&page=$page&mod=red&postid=$postid&".session_name()."=".session_id()."&go=post\" method=\"post\">";
echo "<div>";
echo "Сообщение: <br/>";
echo "<input name=\"message".$ref."\" maxlength=\"250\" value=\"$msg_db\" title=\"Text\"/><br/>";
echo "<select multiple=\"multiple\" name=\"translit\">
<option value=\"1\">Транслит</option></select><br/>";
echo "<input type=\"hidden\" name=\"reff\" value=\"$ref\"/>";
echo "<input class=\"ibutton\" type=\"submit\" value=\"Отправить\"/>";
echo "</div>";
echo "</form>";
}
else
{
echo "Сообщение: <br/>";
echo "</small><input name=\"message".$ref."\" value=\"$msg_db\" maxlength=\"250\" title=\"Text\"/><br/><small>";
echo "</small><select multiple=\"true\" name=\"translit\">
<option value=\"1\">Транслит</option></select><small><br/>";
echo "<anchor title=\"send\">Отправить<go href=\"postslist.php?p=$p&page=$page&mod=red&postid=$postid&".session_name()."=".session_id()."&go=post\" method=\"post\">";
echo "<postfield name=\"message\" value=\"$(message".$ref.")\"/>";
echo "<postfield name=\"translit\" value=\"$(translit)\"/>";
echo "</go></anchor><br/>";
}
echo $div["div"];
if ($_SESSION['wap']!="xml") {echo "-<br/>";}
echo $div["end"];
include ("footer.php");
exit();
}
else
{
if ($_SESSION['wap']=='xml')$message=$_POST['message'.$reff];
@mysql_query("UPDATE `messages` SET `message`='$message' WHERE ((`id`='$postid')and(`who`='$login'))");
}
}
if (($autorize['adminka']==1||$autorize['moderka']==2)&&$edit=="red")
{
if (empty($go))
{
$q_msg = mysql_query("select * from `messages` where (`id`='$postid');");
$row_msg=mysql_fetch_array($q_msg);
$msg_db=$row_msg['message'];
if ($_SESSION['wap']=="xml")
{
echo "<form action=\"postslist.php?p=$p&edit=red&postid=$postid&".session_name()."=".session_id()."&go=post\" method=\"post\">";
echo "<div>";
echo "Сообщение: <br/>";
echo "<input name=\"message\" maxlength=\"250\" value=\"$msg_db\" title=\"Text\"/><br/>";
echo "<select multiple=\"multiple\" name=\"translit\">
<option value=\"1\">Транслит</option></select><br/>";
echo "<input class=\"ibutton\" type=\"submit\" value=\"Отправить\"/>";
echo "</div>";
echo "</form>";
}
else
{
echo "Сообщение: <br/>";
echo "</small><input name=\"message".$ref."\" value=\"$msg_db\" maxlength=\"250\" title=\"Text\"/><br/><small>";
echo "</small><select multiple=\"true\" name=\"translit\">
<option value=\"1\">Транслит</option></select><small><br/>";
echo "<anchor title=\"send\">Отправить<go href=\"postslist.php?p=$p&edit=red&postid=$postid&".session_name()."=".session_id()."&go=post\" method=\"post\">";
echo "<postfield name=\"message\" value=\"$(message".$ref.")\"/>";
echo "<postfield name=\"translit\" value=\"$(translit)\"/>";
echo "</go></anchor><br/>";
}
echo $div["div"];
if ($_SESSION['wap']!="xml") {echo "-<br/>";}
echo $div["end"];
include ("footer.php");
exit();
}
else
{
@mysql_query("UPDATE `messages` SET `message`='$message' WHERE (`id`='$postid')");
}
}
if ($autorize&&$mod=="add")
{
if (empty($go))
{
if ($_SESSION['wap']=="xml")
{
echo "<form action=\"postslist.php?p=$p&page=$page&mod=add&".session_name()."=".session_id()."&go=post\" method=\"post\">";
echo "<div>";
echo "Сообщение: <br/>";
echo "<input name=\"message".$ref."\" maxlength=\"250\" value=\"$msg_db\" title=\"Text\"/><br/>";
echo "<select multiple=\"multiple\" name=\"translit\">
<option value=\"1\">Транслит</option></select><br/>";
echo "<input type=\"hidden\" name=\"reff\" value=\"$ref\"/>";
echo "<input class=\"ibutton\" type=\"submit\" value=\"Отправить\"/>";
echo "</div>";
echo "</form>";
}
else
{
echo "Сообщение: <br/>";
echo "</small><input name=\"message".$ref."\" value=\"$user\" maxlength=\"250\" title=\"Text\"/><br/><small>";
echo "</small><select multiple=\"true\" name=\"translit\">
<option value=\"1\">Транслит</option></select><small><br/>";
echo "<anchor title=\"send\">Отправить<go href=\"postslist.php?p=$p&page=$page&mod=add&".session_name()."=".session_id()."&go=post\" method=\"post\">";
echo "<postfield name=\"message\" value=\"$(message".$ref.")\"/>";
echo "<postfield name=\"translit\" value=\"$(translit)\"/>";
echo "</go></anchor><br/>";
}
echo $div["div"];
if ($_SESSION['wap']!="xml") {echo "-<br/>";}
echo $div["end"];
include ("footer.php");
exit();
}
else
{
echo $div["div"];
#создание темы
//проверка символов
if ($_SESSION['wap']=='xml')$message=$_POST['message'.$reff];
$message=htmlspecialchars(stripslashes(trim($message)));
$message=str_replace("$","$$",$message);
if($translit==1) $message=latrus($message);
if(empty($error)) $error='';
if(empty($message)) $error=$error.'Вам необходимо ввести сообщение!';
$row = @mysql_query("select * from messages where ((message='".$message."')and(who='".$login."')and(forums='".$forums."')and(podforums='".$podforums."')and(themes='".$theme."'));");
$w = @mysql_fetch_array($row);
$db_logins = $w['message'];
//Проверка на схожесть и т.д
if(empty($error))
{
if(strtolower($message) == strtolower($db_logins))
{
echo "<b>Не повторяйте ваши сообщения!</b><br/>";
if ($_SESSION['wap']!="xml") {echo "-<br/>";}
}
else
{
$who=$autorize['login'];
@mysql_query("insert into messages values(0,'$forums','$podforums','$theme','$who','$message','','$data');")or die ("FUCK");
$id_msg=mysql_insert_id();
@mysql_query("UPDATE `forum` SET `id_msg`='$id_msg' where ((`forums`='$forums')and(`podforums`='$podforums')and(`themes`='$theme'));");
@mysql_query("UPDATE users SET `posts`=`posts`+'1' WHERE login='$who'");
echo "<b>Ответ добавлен!</b><br/>";
if ($_SESSION['wap']!="xml") {echo "-<br/>";}
}
}
else
{
echo "$error<br/>";
}
echo $div["end"];
}
}
#вывод тем
echo $div["div"];
if (!empty($about))
{
$q_user = mysql_query("select * from users where `login`='$about';");
if (mysql_affected_rows()==0)
{
echo "Нет такого юзера!<br/>";
}
else
{
$row_user=mysql_fetch_array($q_user);
$user= $row_user['login'];
$name= $row_user['name'];
$email= $row_user['email'];
$posts= $row_user['posts'];
$den= $row_user['den'];
$img= $row_user['img'];
$mes= $row_user['mes'];
$god= $row_user['god'];
$db_date= $row_user['date'];
$god_r=substr($db_date,0,4);
$mes_r=substr($db_date,4,2);
$den_r=substr($db_date,6,2);
$group= $row_user['group'];
$rating= $row_user['rating'];
$status= $row_user['status'];
$online= $row_user['online'];
$gorod= $row_user['gorod'];
$zan= $row_user['zan'];
$osebe= $row_user['about'];
$icq= $row_user['icq'];
$sex= $row_user['sex'];
$mobila= $row_user['mobila'];
$site= $row_user['site'];
$opsos= $row_user['opsos'];
$perst= $row_user['persst'];
$ban= $row_user['ban'];
$ad= $row_user['adminka'];
$modr= $row_user['moderka'];
$ip_db= $row_user['ip'];
$brow_db= $row_user['brow'];
echo "Информация о юзере: <b>$user</b><br/>";
if (!empty($img)) echo "<img src=\"photos/$img\" alt=\"foto...\"/><br/>";
//@mysql_query("UPDATE users SET `rating`=`rating`+'500' WHERE login='$user'");
if ($autorize)
{
$qvoid = @mysql_query("select void from messages where ((`who`='$user')and(`void`='1')and(`themes`='$theme'));");
if (mysql_affected_rows()!=0)
{
}
else
{
$fvoid=mysql_fetch_array($qvoid);
$void=$fvoid['void'];
if (($adtem==$login)&&($about!=$login)&&$void==0)
{
if (empty($voidplus)&&empty($voidmin))
{
echo "-<br/>
Оценить ответ: <br/>";
echo $div["end"];
if ($_SESSION['wap']=="xml")
{
echo "<form action=\"postslist.php?p=$p&about=$about&".session_name()."=".session_id()."\" method=\"post\">";
echo "<div>";
echo "<select name=\"voidplus\">";
$post=$autorize['posts'];
echo "<option value=\"0\">0</option>";
echo "<option value=\"1\">1</option>";
if ($post>$how2||$autorize['adminka']==1) echo "<option value=\"2\">2</option>";
if ($post>$how3||$autorize['adminka']==1) echo "<option value=\"3\">3</option>";
if ($post>$how4||$autorize['adminka']==1) echo "<option value=\"4\">4</option>";
if ($post>$how5||$autorize['adminka']==1) echo "<option value=\"5\">5</option>";
if ($post>$how6||$autorize['adminka']==1) echo "<option value=\"6\">6</option>";
if ($post>$how7||$autorize['adminka']==1) echo "<option value=\"7\">7</option>";
echo "</select>";
echo "<input class=\"ibutton\" type=\"submit\" value=\"+\"/>";
echo "</div>";
echo "</form>";
echo "<form action=\"postslist.php?p=$p&about=$about&".session_name()."=".session_id()."\" method=\"post\">";
echo "<div>";
echo "<select name=\"voidmin\">";
$post=$autorize['posts'];
echo "<option value=\"0\">0</option>";
echo "<option value=\"1\">1</option>";
if ($post>$how2||$autorize['adminka']==1) echo "<option value=\"2\">2</option>";
if ($post>$how3||$autorize['adminka']==1) echo "<option value=\"3\">3</option>";
if ($post>$how4||$autorize['adminka']==1) echo "<option value=\"4\">4</option>";
if ($post>$how5||$autorize['adminka']==1) echo "<option value=\"5\">5</option>";
if ($post>$how6||$autorize['adminka']==1) echo "<option value=\"6\">6</option>";
if ($post>$how7||$autorize['adminka']==1) echo "<option value=\"7\">7</option>";
echo "</select>";
echo "<input class=\"ibutton\" type=\"submit\" value=\"-\"/>";
echo "</div>";
echo "</form>";
echo $div["div"];
}
else
{
echo "</small><select name=\"voidk\">";
$post=$autorize['posts'];
echo "<option value=\"0\">0</option>";
echo "<option value=\"1\">1</option>";
if ($post>$how2||$autorize['adminka']==1) echo "<option value=\"2\">2</option>";
if ($post>$how3||$autorize['adminka']==1) echo "<option value=\"3\">3</option>";
if ($post>$how4||$autorize['adminka']==1) echo "<option value=\"4\">4</option>";
if ($post>$how5||$autorize['adminka']==1) echo "<option value=\"5\">5</option>";
if ($post>$how6||$autorize['adminka']==1) echo "<option value=\"6\">6</option>";
if ($post>$how7||$autorize['adminka']==1) echo "<option value=\"7\">7</option>";
echo "</select><small>";
echo "<a href=\"postslist.php?p=$p&about=$about&voidplus=$(voidk)&".session_name()."=".session_id()."\">+</a>/";
echo "<a href=\"postslist.php?p=$p&about=$about&voidmin=$(voidk)&".session_name()."=".session_id()."\">-</a><br/>";
}
}
elseif (!empty($voidplus)&&$voidplus>=0&&$voidplus<8&&$void!=1)
{
if (($post<$how2&&$voidplus>1)&&$autorize['adminka']==0) $error=1; else
if (($post<$how3&&$voidplus>2)&&$autorize['adminka']==0) $error=1; else
if (($post<$how4&&$voidplus>3)&&$autorize['adminka']==0) $error=1; else
if (($post<$how5&&$voidplus>4)&&$autorize['adminka']==0) $error=1; else
if (($post<$how6&&$voidplus>5)&&$autorize['adminka']==0) $error=1; else
if (($post<$how7&&$voidplus>6)&&$autorize['adminka']==0) $error=1;
if ($error==1)
{
echo "<b>Сильно умный!??</b><br/>";
}
else
{
echo "<b>Голос защитан!</b><br/>";
@mysql_query("UPDATE users SET `rating`=`rating`+'$voidplus' WHERE login='$user'");
@mysql_query("UPDATE messages SET `void`='1' WHERE ((`who`='$user')and(`themes`='$theme'))");
}
}
elseif ($voidmin>=0&&$voidmin<8&&$void!=1)
{
if (($post<$how2&&$voidplus>1)&&$autorize['adminka']==0) $error=1; else
if (($post<$how3&&$voidplus>2)&&$autorize['adminka']==0) $error=1; else
if (($post<$how4&&$voidplus>3)&&$autorize['adminka']==0) $error=1; else
if (($post<$how5&&$voidplus>4)&&$autorize['adminka']==0) $error=1; else
if (($post<$how6&&$voidplus>5)&&$autorize['adminka']==0) $error=1; else
if (($post<$how7&&$voidplus>6)&&$autorize['adminka']==0) $error=1;
if ($error==1)
{
echo "<b>Сильно умный!??</b><br/>";
}
else
{
echo "<b>Голос защитан!</b><br/>";
@mysql_query("UPDATE users SET `rating`=`rating`-'$voidmin' WHERE login='$user'");
@mysql_query("UPDATE messages SET `void`='1' WHERE ((`who`='$user')and(`themes`='$theme'))");
}
}
else
{
echo "Голос не принят!<br/>";
}
}
}
}
if (!empty($name)) echo "Имя: <b>$name</b><br/>";
echo "Пол:"; if ($sex=="m")echo " <b>мужской</b><br/>"; else echo " <b>женский</b><br/>";
echo "Рейтинг: <b>$rating</b><br/>";
echo "Группа: <b>$group</b><br/>";
if ($ad==0&&$modr==0) {echo "Статус: <b>$status</b><br/>";}
echo "Постов: <b>$posts</b><br/>";
if (!empty($email)) echo "E-mail: <b>$email</b><br/>";
if (!empty($den)&&!empty($mes)&&!empty($god)) echo "Дата рождения: <b>$den.$mes.$god </b><br/>";
if (!empty($gorod)) echo "Город: <b>$gorod</b><br/>";
if (!empty($icq)) echo "ICQ: <b>$icq</b><br/>";
if (!empty($site)) echo "Страница: <a href=\"$site\">$site</a><br/>";
if (!empty($mobila)) echo "Мобила: <b>$mobila</b><br/>";
if (!empty($opsos)) echo "Оператор: <b>$opsos</b><br/>";
if (!empty($zan)) echo "Занятость: <b>$zan</b><br/>";
if (!empty($osebe)) echo "О себе: <b>$osebe</b><br/>";
if (!empty($perst)) echo "Персональный статус: <b>$perst</b><br/>";
echo "Дата регистрации: <b>$den_r.$mes_r.$god_r</b><br/>";
if ($autorize['adminka']==1&&$user!=$autorize['login'])
{
echo "IP: <b>$ip_db</b><br/>";
echo "Браузер: <b>$brow_db</b><br/>";
echo "[<a href=\"admin.php?mod=deluser&user=$user&".session_name()."=".session_id()."\">Удалить юзера</a>]<br/>";
echo "[<a href=\"admin.php?mod=ban&user=$user&".session_name()."=".session_id()."\">Забанить юзера</a> /";
echo " <a href=\"admin.php?mod=razban&user=$user&".session_name()."=".session_id()."\">Разбанить</a>]<br/>";
echo "[<a href=\"admin.php?mod=banwhy&user=$user&".session_name()."=".session_id()."\">Бан(причина, время)</a>]<br/>";
echo "[<a href=\"admin.php?mod=banip&user=$user&".session_name()."=".session_id()."\">Бан по IP+SOFT</a>]<br/>";
}
if ($autorize['moderka']>0&&$user!=$autorize['login']&&$moder==1)
{
echo "[<a href=\"moder.php?mod=ban&user=$user&".session_name()."=".session_id()."\">Забанить юзера</a> /";
echo " <a href=\"moder.php?mod=razban&user=$user&".session_name()."=".session_id()."\">Разбанить</a>]<br/>";
echo "[<a href=\"moder.php?mod=banwhy&user=$user&".session_name()."=".session_id()."\">Бан(причина, время)</a>]<br/>";
if ($autorize['moderka']==2) echo "[<a href=\"moder.php?mod=banip&user=$user&".session_name()."=".session_id()."\">Бан по IP+SOFT</a>]<br/>";
}
if ($autorize) {echo "[<a href=\"read.php?mod=sent&user=$user&".session_name()."=".session_id()."\">Написать сообщение</a>]<br/>";}
if ($ban==1) echo "<b>Забанен!</b><br/>";
if ($online==1) echo "<b>Сейчас на форуме!</b><br/>";
echo "";
}
echo "-<br/>";
echo $div["end"];
include ("footer.php");
exit();
}
//echo $div["div"];
$q= mysql_query("select * from messages where ((themes='$theme')and(podforums='$podforums'));");
$all=mysql_num_rows($q);
$query = mysql_query("select * from messages where ((themes='$theme')and(podforums='$podforums')) order by id asc LIMIT $limit, $max_lines_on_page;");
if (mysql_affected_rows()==0)
{
echo "Куда то делись сообщения (<br/>";
echo "-<br/>";
if ($autorize) {echo "[<a href=\"postslist.php?p=$p&page=$page&mod=add&".session_name()."=".session_id()."\">Ответить на тему</a>]<br/>";}
echo "-<br/>";
echo $div["end"];
include ("footer.php");
exit();
}
else
{
echo $div["end"];
echo $div["ten"];
while ($field=mysql_fetch_array($query))
{
$id=$field['id'];
$themes=$field['themes'];
$who=$field['who'];
$msg=$field['message'];
$db_data=$field['data'];
$god=substr($db_data,0,4);
$mes=substr($db_data,4,2);
$den=substr($db_data,6,2);
$h=substr($db_data,8,2);
$m=substr($db_data,10,2);
if ($autorize) { if ($autorize['sml']==1) {$msg=smile($msg);} } else {$msg=smile($msg);}
echo "<b><a href=\"postslist.php?p=$p&about=$who&post=$id&".session_name()."=".session_id()."\">$who</a></b>";
if ($close!=1) { if ($autorize) {echo " <a href=\"postslist.php?p=$p&page=$page&mod=add&user=$who, &".session_name()."=".session_id()."\">*</a>";}}
echo "<br/> <b>(</b>$h:$m $den.$mes.$god<b>)</b><br/> $msg";
$who=strtolower($who);
if ($autorize&&$who==$login) {echo " <a href=\"postslist.php?p=$p&page=$page&mod=red&postid=$id&".session_name()."=".session_id()."\">[ред]</a>";}
if ($autorize&&$who==$login) {echo " <a href=\"postslist.php?p=$p&page=$page&mod=delmsg&postid=$id&".session_name()."=".session_id()."\">[удл]</a>";}
if ($autorize['adminka']==1&&$who!=$login) { echo " [<a href=\"postslist.php?p=$p&page=$page&edit=red&postid=$id&".session_name()."=".session_id()."\">ред</a>]"; echo " [<a href=\"postslist.php?p=$p&edit=del&iddel=$id&".session_name()."=".session_id()."\">удл</a>]<br/>";
} else if ($autorize['moderka']==2&&$moder==1&&$who!=$login) { echo " [<a href=\"postslist.php?p=$p&page=$page&edit=red&postid=$id&".session_name()."=".session_id()."\">ред</a>]"; echo " [<a href=\"postslist.php?p=$p&edit=del&iddel=$id&".session_name()."=".session_id()."\">удл</a>]<br/>";
}
else
{ echo "<br/>"; }
}
echo $div["end"];
echo $div["div"];
}
//функция навигации
function PRINT_NUM_PAGE(){
global $page,$all, $max_lines_on_page, $max_pages_on_page, $maxpages, $t, $p,$div;
$maxpage=ceil($all/$max_lines_on_page);
if ($maxpage!=1){
echo "-<br/>";
if ($page>1) echo "<a href=\"postslist.php?p=$p&page=".($page-1)."&".session_name()."=".session_id()."\">«-</a>";
else echo "«-";
if ($_SESSION['wap']=="xml")
{
echo $div["end"];
echo "<form action=\"postslist.php\" method=\"get\">";
echo "<div>";
echo "<input name=\"page\" maxlength=\"3\" value=\"1\" size=\"3\"/>";
echo "<input type=\"hidden\" name=\"p\" value=\"$p\"/>";
echo "<input type=\"hidden\" name=\"".session_name()."\" value=\"".session_id()."\"/>";
echo "<input class=\"ibutton\" type=\"submit\" value=\"»\"/>";
echo "</div>";
echo "</form>";
echo $div["div"];
}
else
{
echo " | </small><input name=\"page\" maxlength=\"3\" value=\"1\" size=\"3\"/><small>";
echo "<a href=\"postslist.php?p=$p&page=$(page)&".session_name()."=".session_id()."\">»</a> | ";
}
if ($page<$maxpage) echo " <a href=\"postslist.php?p=$p&page=".($page+1)."&".session_name()."=".session_id()."\">-»</a> <br/>";
else echo " -» <br/>";
if ($page==4) {echo "<a href=\"postslist.php?p=$p&page=1&".session_name()."=".session_id()."\">1</a>";}
if ($page>4) {echo "<a href=\"postslist.php?p=$p&page=1&".session_name()."=".session_id()."\">1</a> ... "; }
if ($t=='2'){
$l=$page - floor($maxpages/2);
$r=$page + floor($maxpages/2);
if ($l<1){$l='1'; $r=$maxpages;}
if ($r>$maxpage){$r=$r+$r/2;}
if (($page-1)>$maxpages-3/2){ $ll=$l+1; echo "<a href=\"postslist.php?p=$p&page=$ll&".session_name()."=".session_id()."\">«</a> ";
}
}else{
$l = ceil($page/$maxpages)*$maxpages+1- $maxpages;
$r = ceil($page/$maxpages)*$maxpages;
}
$l=$l;
for ($l; $l<=$r; $l++){
if ($l>$maxpage)break;
if ($l == $page){
print " <b>$page</b> ";
}else{
echo " <a href=\"postslist.php?p=$p&page=$l&".session_name()."=".session_id()."\">$l</a> ";}
}
if ($maxpage>$r) { $ll=$r+1;
echo "<a href=\"postslist.php?p=$p&page=$ll&".session_name()."=".session_id()."\">»</a> ";}
if ($page<$maxpage-2&&$maxpage>5) {echo "... <a href=\"postslist.php?p=$p&page=$maxpage&".session_name()."=".session_id()."\">$maxpage</a> ";}
echo "<br/>";
}
}
PRINT_NUM_PAGE();
if ($close!=1) { if ($autorize) {echo "-<br/>";echo "[<a href=\"postslist.php?p=$p&page=$page&mod=add&".session_name()."=".session_id()."\">Ответить на тему</a>]<br/>";}}
else
{
echo "-<br/>";
echo "<b>Тема закрыта для обсуждений!</b><br/>";
}
if (($autorize['adminka']==1||$autorize['moderka']==2)&&$close!=1) {
echo "-<br/>";
echo "[<a href=\"postslist.php?p=$p&tema=close&".session_name()."=".session_id()."\">Закрыть тему</a>]<br/>";}
if (($autorize['adminka']==1||$autorize['moderka']==2)&&$close==1) {
echo "-<br/>";
echo "[<a href=\"postslist.php?p=$p&tema=open&".session_name()."=".session_id()."\">Открыть тему</a>]<br/>";}
if (($autorize['adminka']==1)&&$in!=1) {
echo "-<br/>";
echo "[<a href=\"postslist.php?p=$p&tema=on&".session_name()."=".session_id()."\">Сделать важной</a>]<br/>";}
if (($autorize['adminka']==1)&&$in==1) {
echo "-<br/>";
echo "[<a href=\"postslist.php?p=$p&tema=off&".session_name()."=".session_id()."\">Убрать из важных</a>]<br/>";}
if ($_SESSION['wap']!="xml") {echo "-<br/>";}
echo $div["end"];
include ("footer.php");
?>