query('SELECT `id` FROM `effects` WHERE `owner` = ?i AND `time` > ?i AND `type` = 3', $user['id'], time())->fetch_assoc(); $ps = $_GET['page'] ?? 0; $isModerator = false; $isAdmin = false; $edit = ''; $search = ''; if (isset($_GET['do']) && $_GET['do'] != "search" && $_GET['do'] != "my_topics" && $_GET['do'] != "my_comments" && $_GET['do'] != "open" && $_GET['do'] != "close" && $_GET['do'] != "fix" && $_GET['do'] != "unfix") { echo ''; } elseif (isset($_GET['do']) && $_GET['do'] == "search") { $search .= '


'; } if (isset($_POST['selectt'], $_POST['numt']) && $_POST['selectt'] != '' && $_POST['numt'] != '') { $AlignTop = db::c()->query('SELECT `min_align`, `max_align` FROM `forum` WHERE `id` = ?i', $_POST['selectt'])->fetch_assoc(); db::c()->query('UPDATE `forum` SET `parent` = ?i, `min_align` = "?s", `max_align` = "?s" WHERE `id` = ?i', $_POST['selectt'], $AlignTop['min_align'], $AlignTop['max_align'], $_POST['numt']); } if (!isset($_GET['conf']) && !isset($_GET['topic'])) { $_GET['conf'] = 1; } $Movemess = ($isModerator == true) ? 1 : 0; $replasepost = ''; function parse_bb_code($text) { $bbCodes = [ // Стандартные BB коды '/\[(\/?)(b|i|u|s)\s*\]/' => "<$1$2>", '/\[(left|center|right)\]/' => '

', '/\[\/(left|center|right)\]/' => '

', '/\[url\s?(src=)?\s?(.+?)\s?(target=(_blank|_self))?\](.+?)\[\/url\]/' => '$5', '/\[img width=([0-9]{1,4}) height=([0-9]{1,4})\](.+?)\[\/img\]/' => '', '/\[img\](.+?)\[\/img\]/' => '', '/\[quote\](.+?)\[\/quote\]/' => "
$1
", '/\[code\](.+?)\[\/code\]/' => "
$1
", // Смайлы '/\:susel\:/' => '', '/\:ponder\:/' => '', ]; $text = preg_replace(array_keys($bbCodes), array_values($bbCodes), $text); $text = close_dangling_tags($text); return $text; } function close_dangling_tags($html) { preg_match_all("#<([a-z]+)( .*)?(?!/)>#iU", $html, $result); $openedtags = $result[1]; preg_match_all("##iU", $html, $result); $closedtags = $result[1]; $len_opened = count($openedtags); if (count($closedtags) == $len_opened) { return $html; } $openedtags = array_reverse($openedtags); for ($i = 0; $i < $len_opened; $i++) { if (!in_array($openedtags[$i], $closedtags)) { if ($openedtags[$i] != 'br') { $html .= ''; } } else { unset($closedtags[array_search($openedtags[$i], $closedtags)]); } } return $html; } if (isset($_POST['add']) && isset($user['id'])) { $icon = htmlentities($_POST['icon'], ENT_NOQUOTES, 'utf8'); $text2 = htmlspecialchars($_POST['title'], ENT_NOQUOTES, 'utf8'); $text1 = parse_bb_code(preg_replace("/\n/", "
", $_POST['text'])); $minmax = db::c()->query('SELECT `min_align`, `max_align` FROM `forum` WHERE `id` = ?i', $_GET['conf'])->fetch_assoc(); $min_align = $minmax['min_align']; $max_align = $minmax['max_align']; rtrim($_POST['title']); rtrim($_POST['text']); if (empty($_POST['text']) || empty($_POST['title'])) { $error = "Заголовок или текст не могут быть пустыми!"; } elseif (($minmax['min_align'] == 0 && $minmax['max_align'] == 0) || ($user['align'] >= $minmax['min_align'] && $user['align'] <= $minmax['max_align']) || $isAdmin) { if ($user['invis'] == 1) { $userPost = 'Невидимка'; } else { $userPost = Nick::id($user['id'])->full(1); } if ($isModerator == false) $text1 = strip_tags($text1, '
'); db::c()->query('INSERT INTO `forum` (`type`, `topic`, `text`, `parent`, `author`, `date`, `min_align`, `max_align`, `icon`) VALUES (2,"?s","?s",?i,"?s","?s","?s","?s","?s")', $text2, $text1, $_GET['conf'], $userPost, date('d.m.y H:i:s'), $min_align, $max_align, $icon); $topic_id = db::c()->getLastInsertId(); unset($_POST['text']); print ""; exit(); } else { $error = "Вы не можете писать в этой конференции!"; } unset($_POST['add']); } if (isset($_POST['add2']) && isset($user['id'])) { $text2 = htmlspecialchars($_POST['title'], ENT_NOQUOTES, 'utf8'); $text1 = parse_bb_code(preg_replace("/\n/", "
", $_POST['text'])); $minmax = db::c()->query('SELECT `min_align`,`max_align`, `close`, `parent` FROM `forum` WHERE `id` = ?i', $_GET['topic'])->fetch_assoc(); $min_align = $minmax['min_align']; $max_align = $minmax['max_align']; rtrim($_POST['text']); if (empty($_POST['text'])) { $error = "Текст не может быть пустыми"; } elseif (!is_numeric($_GET['topic'])) { $error = "Не надо так делать"; } if (($minmax['min_align'] == 0 && $minmax['max_align'] == 0) || ($user['align'] >= $minmax['min_align'] && $user['align'] <= $minmax['max_align']) && $minmax['close'] == "0" || $isAdmin) { if ($user['invis'] == 1) { $userPost = 'Невидимка'; } else { $userPost = Nick::id($user['id'])->full(1); } if ($isModerator == false) { $text1 = strip_tags($text1, '

'); } 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']) && $isModerator == 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']) && $isModerator == 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']) && $isModerator == 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']) && $isModerator == 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 = "Обсуждение закрыл " . ($isAdmin) ? "Администратор" : 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(); } } Template::header('Форум'); ?>

full(1) . "
"; ?>

Конференции

query('SELECT * FROM `forum` WHERE `parent` = 0 AND `type` = 1 ORDER BY `id` ASC'); while ($row = $data->fetch_assoc()) { if (($row['min_align'] == 0 && $row['max_align'] == 0) || ($user['align'] >= $row['min_align'] && $user['align'] <= $row['max_align']) || $isAdmin) { $min = $row['min_align'] == 0; $max = $row['max_align'] == 0; if (!isset($user['id']) || (($user['align'] < $row['min_align']) || ($user['align'] > $row['max_align']) && !$min && !$max)) { echo '  📕'; } else { echo '  📖 '; } echo '' . $row['topic'] . '
'; } } } ?>
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']) || $isAdmin) { $top = $row['parent']; $parentCat = db::c()->query('SELECT * FROM `forum` WHERE `id` = ?i', $top)->fetch_assoc(); $icons = $row['icon']; ?>

Конференция «»

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 ($isModerator): ?>
|
Перемещение тем не работает.
query('SELECT count(`id`) FROM `forum` WHERE `parent` = "?s"', $_GET['topic'])->fetch_row(); $pgs = $pgs[0] / 20; if ($pgs > 1) echo " Страницы: "; $pages_str = ''; $page = isset($_GET['page']) ? (((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; ?> query('SELECT * FROM `forum` WHERE `parent` = "?s" ORDER BY `id` ASC LIMIT ?i,20', $_GET['topic'], ($_GET['page'] * 20)); while ($row = $data->fetch_assoc()): ?> 1) { echo " Страницы: "; } echo $pages_str; if ($closed == 1) { echo "
" . $closepal . "


"; } else { if (!empty($user['block'])) { $error = "Вы заблокированы!"; } elseif ($user['level'] < 2) { $error = "Персонажам до 2-го уровня запрещено писать на форуме!"; } elseif (isset($sleep['id'])) { $error = "Вы молчите!"; } else { ?>

Оставить комментарий

"; } } else { if (is_numeric($_GET['conf']) && $row = db::c()->query('SELECT * FROM `forum` WHERE `id` = ?i', $_GET['conf'])->fetch_assoc()) { if (($row['min_align'] == 0 && $row['max_align'] == 0) || ($user['align'] >= $row['min_align'] && $user['align'] <= $row['max_align']) || $isAdmin) { $confname = 'Конференция «' . $row['topic'] . '»'; $pgs = db::c()->query('SELECT count(`id`) FROM `forum` WHERE `parent` = ?i ORDER BY `fix` DESC, `updated` DESC', $_GET['conf'])->fetch_row(); $pgs = $pgs[0] / 20; $pages_str = ''; if (empty($_GET['page'])) $_GET['page'] = 0; $page = (int)$_GET['page'] ? (((int)$_GET['page'] + 1) > $pgs ? ($pgs - 1) : (int)$_GET['page']) : 0; $page = ceil($page); ?>

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) ? " »" : "")); ?>
Страницы:
4 ? $_GET['page'] > 0 ? " Первая " : "" : ""); $LastPage = (ceil($pgs) > 4 ? (ceil($pgs) - 1) != $_GET['page'] ? " Последняя " : "" : ""); $pages_str = $FirstPage . $pages_str . $LastPage; if (!empty($_GET['conf'])) { if (empty($_GET['page'])) $_GET['page'] = 0; $data = db::c()->query('SELECT * FROM `forum` WHERE `parent` = "?s" ORDER BY `fix` DESC, `updated` DESC LIMIT ?i,20', $_GET['conf'], ($_GET['page'] * 20)); while ($row = $data->fetch_assoc()) { $logi = ''; $userlist = ''; $icons = $row['icon']; $data2 = db::c()->query('SELECT `author` FROM (SELECT `author`,`id` FROM `forum` WHERE `parent` = ?i ORDER BY `id` DESC LIMIT 10) AS sTable ORDER BY id DESC', $row['id']); while ($row2 = $data2->fetch_row()) { $userlist = strip_tags($row2[0], ""); [$username, $level] = split(" \[", $userlist); $logi .= $username; } $datacount = db::c()->query('SELECT count(*) AS CountNumber FROM `forum` WHERE `parent` = ?i', $row['id'])->fetch_assoc(); $count = $datacount["CountNumber"]; $lasttimedb = db::c()->query('SELECT `date` FROM `forum` WHERE `parent` = ?i ORDER BY `id` DESC', $row['id'])->fetch_assoc(); $lasttime = $lasttimedb['date']; echo "

" . ($row['fix'] ? "📌 " : "") . "" . ($i + 1) . "" : "" . ($i + 1) . ""); $pages_str1 .= ($page1 < $pgs1 - 5 ? " ..." : ""); } if ($pgs1 > 1) { $pages_str1 = "" . $pages_str1 . ""; } echo "'> {$row['topic']} " . $pages_str1 . " {$row['author']}"; if ($isModerator) echo " Удалить"; echo "
" . $row['date'] . " " . strip_tags(substr($row['text'], 0, 250), "") . "
Ответов: " . $count . " (" . $lasttime . ")

"; } } if ($pgs > 1) echo "

Страницы:"; echo $pages_str . "

"; if (!empty($user['block'])) { $error = "Вы заблокированы!"; } elseif ($user['level'] < 2) { $error = "Персонажам до 2-го уровня запрещено писать на форуме!"; } elseif (isset($sleep['id'])) { $error = "Вы молчите!"; } else { ?>

Добавить свой вопрос в форум

Ничего не найдено! '; } } ?>