');
}
db::c()->query('INSERT INTO `forum` (`type`, `topic`, `text`, `parent`, `author`, `date`, `min_align`, `max_align`) VALUES (2,"?s","?s",?i,"?s","?s","?s","?s")', $text2, $text1, $_GET['topic'], $userPost, date('d.m.y H:i:s'), $min_align, $max_align);
db::c()->query('UPDATE `forum` SET `updated` = now() WHERE `id` = ?i', $_GET['topic']);
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) {
db::c()->query('DELETE FROM `forum` WHERE `id` = ?i OR `parent` = ?i', $_GET['dp'], $_GET['dp']);
echo "";
exit();
}
}
if (isset($_GET['dt']) && $dostupPal == true) {
if ($_GET['dt'] > 100) {
db::c()->query('DELETE FROM `forum` WHERE `id` = ?i OR `parent` = ?i', $_GET['dt'], $_GET['dt']);
echo "";
exit();
}
}
if (isset($_GET['com']) && isset($_GET['cpr']) && $dostupPal == true) {
if ($user['invis'] == 1) {
$addText = "
Невидимка: " . $_GET['cpr'];
} else {
$addText = nick::id($user['id'])->full(1). ": " . $_GET['cpr'];
}
db::c()->query('UPDATE `forum` SET `text` = CONCAT(`text`,"?s") WHERE `id` = ?i',$addText,$_GET['com']);
echo "";
exit();
}
if (isset($_GET['do']) && $dostupPal == true) {
if ($_GET['do'] == "open") {
db::c()->query('UPDATE `forum` SET `close` = 0 WHERE `id` = "?s"', $_GET['topic']);
echo "";
exit();
}
if ($_GET['do'] == "close") {
$closeComment = "Обсуждение закрыл " . ($user['admin'] == 1) ? "
Администратор" : nick::id($user['id'])->full(1);
db::c()->query('UPDATE `forum` SET `close` = 1, `closepal` = "?s" WHERE `id` = "?s"', $closeComment, $_GET['topic']);
echo "";
exit();
}
if ($_GET['do'] == "fix") {
db::c()->query('UPDATE `forum` SET `fix` = 1 WHERE `id` = "?s"', $_GET['topic']);
echo "";
exit();
}
if ($_GET['do'] == "unfix") {
db::c()->query('UPDATE `forum` SET `fix` = 0 WHERE `id` = "?s"', $_GET['topic']);
echo "";
exit();
}
}
if (!isset($_GET['conf'])) {
$row = db::c()->query('SELECT * FROM `forum` WHERE `id` = "?s"', $_GET['topic'])->fetch_assoc();
if (($row['min_align'] == 0 && $row['max_align'] == 0) || ($user['align'] >= $row['min_align'] && $user['align'] <= $row['max_align']) || $user['admin'] == "1") {
$top = $row['parent'];
$parentCat = db::c()->query('SELECT * FROM `forum` WHERE `id` = ?i', $top)->fetch_assoc();
$icons = $row['icon'];
?>
if (isset($error)) err($error); ?>
$par_top = db::c()->query('SELECT `closepal`, `id` FROM `forum` WHERE `id` = "?s"', $_GET['topic'])->fetch_row();
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 = db::c()->query('SELECT count(`id`) FROM `forum` WHERE `parent` = "?s"', $_GET['topic'])->fetch_assoc();
$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 = "
";
?>
= $row['topic'] ?>
"= $row['author'] ?>"
("= $row['date'] ?>")
= $edit ?>
";
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");
$data = db::c()->query('SELECT * FROM `forum` WHERE `parent` = "?s" ORDER BY "?s" LIMIT ?i,20', $_GET['topic'], $sort_type, ($_GET['page'] * 20));
while ($row = $data->fetch_assoc()) {
echo "" . $closepal . "