');
}
mysql_query("INSERT INTO `forum` (`type`, `topic`, `text`, `parent`, `author`, `date`, `min_align`, `max_align`) VALUES ('2', '" . mysql_real_escape_string($text2) . "', '" . $text1 . "', '" . mysql_real_escape_string($_GET['topic']) . "', '" . $userPost . "', '" . date("d.m.y H:i:s") . "', '" . mysql_real_escape_string($min_align) . "', '" . mysql_real_escape_string($max_align) . "')");
mysql_query('UPDATE `forum` SET `updated` = now() WHERE `id` = "' . mysql_real_escape_string($_GET['topic']) . '" LIMIT 1');
unset($_POST['text']);
if (isset($_GET['page']) && (int)$_GET['page'] > 0) {
$page_num = '&page=' . $_GET['page'];
} else {
$page_num = '&page=0';
}
echo '';
exit();
} else {
$error = "
Вы не можете писать в этой конференции";
}
unset($_POST['add2']);
}
if (isset($_GET['dp']) && $dostupPal == true) {
if ($_GET['dp'] > 100) {
mysql_query("DELETE FROM `forum` WHERE `id` = '" . mysql_real_escape_string($_GET['dp']) . "' LIMIT 1");
mysql_query("DELETE FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($_GET['dp']) . "'");
echo "";
exit();
}
}
if (isset($_GET['dt']) && $dostupPal == true) {
if ($_GET['dt'] > 100) {
mysql_query("DELETE FROM `forum` WHERE `id` = '" . mysql_real_escape_string($_GET['dt']) . "' LIMIT 1");
mysql_query("DELETE FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($_GET['dt']) . "'");
echo "";
exit();
}
}
if (isset($_GET['com']) && isset($_GET['cpr']) && $dostupPal == true) {
if ($user['invis'] == 1) {
mysql_query("UPDATE `forum` SET `text` = CONCAT(`text`,'
Невидимка: " . mysql_real_escape_string($_GET['cpr']) . "') WHERE `id` = '" . mysql_real_escape_string($_GET['com']) . "' LIMIT 1");
} else {
mysql_query("UPDATE `forum` SET `text` = CONCAT(`text`,'
" . mysql_real_escape_string(nick::id($user['id'])->full(1)) . ": " . mysql_real_escape_string($_GET['cpr']) . "') WHERE `id` = '" . mysql_real_escape_string($_GET['com']) . "' LIMIT 1");
}
echo "";
exit();
}
if (isset($_GET['do']) && $dostupPal == true) {
if ($user['align'] >= 1.7 && $user['align'] < 2) {
$palclose = 'паладином ' . nick::id($user['id'])->full(1);
} elseif ((int)$user['admin'] == 1) {
$palclose = '
Администрацией';
}
if ($_GET['do'] == "open") {
mysql_query("UPDATE `forum` SET `close` = '0' WHERE `id` = '" . mysql_real_escape_string($_GET['topic']) . "' LIMIT 1");
echo "";
exit();
}
if ($_GET['do'] == "close") {
mysql_query("UPDATE `forum` SET `close` = '1', `closepal` = '
Обсуждение закрыто " . $palclose . "' WHERE `id` = '" . mysql_real_escape_string($_GET['topic']) . "' LIMIT 1");
echo "";
exit();
}
if ($_GET['do'] == "fix") {
mysql_query("UPDATE `forum` SET `fix` = '1' WHERE `id` = '" . mysql_real_escape_string($_GET['topic']) . "' LIMIT 1");
echo "";
exit();
}
if ($_GET['do'] == "unfix") {
mysql_query("UPDATE `forum` SET `fix` = '0' WHERE `id` = '" . mysql_real_escape_string($_GET['topic']) . "' LIMIT 1");
echo "";
exit();
}
}
if (!isset($_GET['conf'])) {
$row = mysql_fetch_array(mysql_query("SELECT * FROM `forum` WHERE `id` = '" . mysql_real_escape_string($_GET['topic']) . "'"));
if (($row['min_align'] == 0 && $row['max_align'] == 0) || ($user['align'] >= $row['min_align'] && $user['align'] <= $row['max_align']) || $user['align'] == "1.99" || $user['align'] == 2.99) {
$top = $row['parent'];
$parentCat = mysql_fetch_array(mysql_query("SELECT * FROM `forum` WHERE `id` = '" . $top . "' LIMIT 1"));
$icons = $row['icon'];
?>
if ($error != '') {
echo '
' . $error . '';
} ?>
$par_top = mysql_fetch_row(mysql_query("SELECT `closepal`, `id` FROM `forum` WHERE `id` = '" . (int)$_GET['topic'] . "' LIMIT 1"));
if (((int)$par_top[1] != 0) || ((int)$_GET['konftop'] > 0)) {
if ($row['close'] == 1) {
$close = "
Открыть";
$closed = 1;
$closepal = $row['closepal'];
} else {
$close = "
Закрыть";
}
if ($row['fix'] == 1) {
$fix = "
Открепить";
} else {
$fix = "
Прикрепить";
}
if ($dostupPal == true) {
echo '
";
if (isset($_POST['selectt'], $_POST['numt']) && $_POST['selectt'] != '' && $_POST['numt'] != '') {
$error = "
Тема перемещена.
forum.php?topic=" . $_POST['numt'] . "&konftop=" . $_POST['selectt'] . "";
}
}
$pgs = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($_GET['topic']) . "'"));
$pgs = $pgs[0] / 20;
if ($pgs > 1) {
echo "
Страницы : ";
}
$pages_str = '';
$page = (int)$_GET['page'] > 0 ? (((int)$_GET['page'] + 1) > $pgs ? ($pgs - 1) : (int)$_GET['page']) : 0;
$page = ceil($page);
if ($pgs > 1) {
for ($i = 0; $i < ceil($pgs); $i++) {
if (($i > ($page - 5)) && ($i <= ($page + 4))) {
$pages_str .= ($i == $page ? "
" . ($i + 1) . "" : "
" . ($i + 1) . "");
}
}
$pages_str .= ($page < $pgs - 5 ? " ..." : "");
$pages_str = ($page > 4 ? "
« ... " : "") . $pages_str . (($page < ($pgs - 1) ? "
» " : ""));
}
$FirstPage = (ceil($pgs) > 4 ? $_GET['page'] > 0 ? "
Первая " : "" : "");
$LastPage = (ceil($pgs) > 4 ? (ceil($pgs) - 1) != $_GET['page'] ? "
Последняя " : "" : "");
$pages_str = $FirstPage . $pages_str . $LastPage;
echo $pages_str;
if ($dostupSovet == true) {
$edit = "
";
}
echo "
{$row['topic']}
";
echo "
" . $row['author'] . "
(" . $row['date'] . ")
$edit
";
if ($dostupPal == true && $news_topic == false) {
echo "
";
echo "
";
}
echo "
";
echo "
" . $row['text'] . " ";
$sort_type = 'ASC';
if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228043095) {
$sort_type = 'DESC';
}
$data = mysql_query("SELECT * FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($_GET['topic']) . "' ORDER by `id` {$sort_type} LIMIT " . (int)($_GET['page'] * 20) . ",20");
while ($row = mysql_fetch_array($data)) {
echo "" . $closepal . "