Внедрение шаблонизатора.
This commit is contained in:
parent
885300ab05
commit
7e91ef21db
695
forum.php
695
forum.php
@ -33,7 +33,7 @@ $replasepost = '';
|
||||
|
||||
function parse_bb_code($text)
|
||||
{
|
||||
$bbCodes = array(
|
||||
$bbCodes = [
|
||||
// Стандартные BB коды
|
||||
'/\[(\/?)(b|i|u|s)\s*\]/' => "<$1$2>",
|
||||
'/\[(left|center|right)\]/' => '<p style="text-align:$1;">',
|
||||
@ -175,7 +175,7 @@ function parse_bb_code($text)
|
||||
'/\:pal\:/' => '<img src="i/smile/pal.gif" />',
|
||||
'/\:nun\:/' => '<img src="i/smile/nun.gif" />',
|
||||
'/\:ura\:/' => '<img src="i/smile/ura.gif" />',
|
||||
);
|
||||
];
|
||||
|
||||
$text = preg_replace(array_keys($bbCodes), array_values($bbCodes), $text);
|
||||
$text = close_dangling_tags($text);
|
||||
@ -335,343 +335,336 @@ if (isset($_GET['do']) && $isModerator == true) {
|
||||
exit();
|
||||
}
|
||||
}
|
||||
Template::header('Форум');
|
||||
?>
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Форум</title>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<link rel="stylesheet" href="css/wysibb/theme/default/wbbtheme.css"/>
|
||||
<script type="text/javascript" language="JavaScript" src='js/forum.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%" border="0">
|
||||
<tr valign="top">
|
||||
<td width="200">
|
||||
<br/>
|
||||
<?php if (isset($user['id'])) echo "Игрок : " . Nick::id($user['id'])->full(1) . "<br />"; ?>
|
||||
<h4>Конференции</h4>
|
||||
<?php
|
||||
if ((isset($_GET['conf']) && is_numeric($_GET['conf'])) || (isset($_GET['konftop']) && is_numeric($_GET['konftop'])) || $Movemess == 1) {
|
||||
$data = db::c()->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;
|
||||
|
||||
<table width="100%" border="0">
|
||||
<tr valign="top">
|
||||
<td width="200">
|
||||
<br/>
|
||||
<?php if (isset($user['id'])) echo "Игрок : " . Nick::id($user['id'])->full(1) . "<br />"; ?>
|
||||
<h4>Конференции</h4>
|
||||
<?php
|
||||
if ((isset($_GET['conf']) && is_numeric($_GET['conf'])) || (isset($_GET['konftop']) && is_numeric($_GET['konftop'])) || $Movemess == 1) {
|
||||
$data = db::c()->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 '<nobr><b> 📕';
|
||||
} else {
|
||||
echo '<nobr><b> 📖 ';
|
||||
if (!isset($user['id']) || (($user['align'] < $row['min_align']) || ($user['align'] > $row['max_align']) && !$min && !$max)) {
|
||||
echo '<nobr><b> 📕';
|
||||
} else {
|
||||
echo '<nobr><b> 📖 ';
|
||||
}
|
||||
echo '<a href="?conf=' . $row['id'] . '">' . $row['topic'] . '</a><br /></b></nobr>';
|
||||
}
|
||||
echo '<a href="?conf=' . $row['id'] . '">' . $row['topic'] . '</a><br /></b></nobr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td rowspan="2" style="padding-left: 10px;">
|
||||
<?php
|
||||
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']) || $isAdmin) {
|
||||
$top = $row['parent'];
|
||||
$parentCat = db::c()->query('SELECT * FROM `forum` WHERE `id` = ?i', $top)->fetch_assoc();
|
||||
$icons = $row['icon'];
|
||||
?>
|
||||
<h3><a href="forum.php?conf=<?= $top ?>">Конференция «<?= $parentCat['topic'] ?>»</a></h3>
|
||||
|
||||
<?php
|
||||
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 = "<a href='?topic={$_GET['topic']}&do=open'>🔓Открыть</a>";
|
||||
$closed = 1;
|
||||
$closepal = $row['closepal'];
|
||||
} else {
|
||||
$close = "<a href='?topic={$_GET['topic']}&do=close'>🔒Закрыть</a>";
|
||||
}
|
||||
if ($row['fix'] == 1) {
|
||||
$fix = "<a href='?topic={$_GET['topic']}&do=unfix'>📄Открепить</a>";
|
||||
} else {
|
||||
$fix = "<a href='?topic={$_GET['topic']}&do=fix'>📌Прикрепить</a>";
|
||||
}
|
||||
|
||||
if ($isModerator): ?>
|
||||
<br>
|
||||
<div align="right">
|
||||
<small>
|
||||
<?= $close ?> | <?= $fix ?>
|
||||
<br><i>Перемещение тем не работает.</i>
|
||||
</small>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
$pgs = db::c()->query('SELECT count(`id`) FROM `forum` WHERE `parent` = "?s"', $_GET['topic'])->fetch_row();
|
||||
$pgs = $pgs[0] / 20;
|
||||
if ($pgs > 1) echo "<img src=i/ico/news.gif width=\"16\" height=\"16\" /> Страницы: ";
|
||||
$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 ? " <b>" . ($i + 1) . "</b>" : " <a href='?topic=" . (int)$row['id'] . "&konftop=" . htmlspecialchars($_GET['konftop']) . "&page=" . ($i) . "'>" . ($i + 1) . "</a>");
|
||||
}
|
||||
}
|
||||
$pages_str .= ($page < $pgs - 5 ? " ..." : "");
|
||||
$pages_str = ($page > 4 ? "<a href='?topic=" . (int)$row['id'] . "&konftop=" . htmlspecialchars($_GET['konftop']) . "&page=" . ($page - 1) . "'> « </a> ... " : "") . $pages_str . (($page < ($pgs - 1) ? "<a href='?topic=" . (int)$row['id'] . "&page=" . ($page + 1) . "' > » </a>" : ""));
|
||||
}
|
||||
$FirstPage = (ceil($pgs) > 4 ? $_GET['page'] > 0 ? "<a href='?topic=" . (int)$row['id'] . "&konftop=" . htmlspecialchars($_GET['konftop']) . "&page=0'> Первая </a>" : "" : "");
|
||||
$LastPage = (ceil($pgs) > 4 ? (ceil($pgs) - 1) != $_GET['page'] ? "<a href='?topic=" . (int)$row['id'] . "&konftop=" . htmlspecialchars($_GET['konftop']) . "&page=" . (ceil($pgs) - 1) . "'> Последняя </a>" : "" : "");
|
||||
$pages_str = $FirstPage . $pages_str . $LastPage;
|
||||
echo $pages_str;
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td rowspan="2" style="padding-left: 10px;">
|
||||
<?php
|
||||
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']) || $isAdmin) {
|
||||
$top = $row['parent'];
|
||||
$parentCat = db::c()->query('SELECT * FROM `forum` WHERE `id` = ?i', $top)->fetch_assoc();
|
||||
$icons = $row['icon'];
|
||||
?>
|
||||
<div id="leaf<?= $row['id'] ?>"
|
||||
style="background-color: #ddd;margin: 2px;padding:5px;overflow-x: auto;word-wrap: break-word;box-shadow: 1px 2px 3px #ccc;">
|
||||
<h3><a href="forum.php?conf=<?= $top ?>">Конференция «<?= $parentCat['topic'] ?>»</a></h3>
|
||||
|
||||
<?php
|
||||
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 = "<a href='?topic={$_GET['topic']}&do=open'>🔓Открыть</a>";
|
||||
$closed = 1;
|
||||
$closepal = $row['closepal'];
|
||||
} else {
|
||||
$close = "<a href='?topic={$_GET['topic']}&do=close'>🔒Закрыть</a>";
|
||||
}
|
||||
if ($row['fix'] == 1) {
|
||||
$fix = "<a href='?topic={$_GET['topic']}&do=unfix'>📄Открепить</a>";
|
||||
} else {
|
||||
$fix = "<a href='?topic={$_GET['topic']}&do=fix'>📌Прикрепить</a>";
|
||||
}
|
||||
|
||||
if ($isModerator): ?>
|
||||
<br>
|
||||
<div align="right">
|
||||
<small>
|
||||
<?= $close ?> | <?= $fix ?>
|
||||
<br><i>Перемещение тем не работает.</i>
|
||||
</small>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
$pgs = db::c()->query('SELECT count(`id`) FROM `forum` WHERE `parent` = "?s"', $_GET['topic'])->fetch_row();
|
||||
$pgs = $pgs[0] / 20;
|
||||
if ($pgs > 1) echo "<img src=i/ico/news.gif width=\"16\" height=\"16\" /> Страницы: ";
|
||||
$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 ? " <b>" . ($i + 1) . "</b>" : " <a href='?topic=" . (int)$row['id'] . "&konftop=" . htmlspecialchars($_GET['konftop']) . "&page=" . ($i) . "'>" . ($i + 1) . "</a>");
|
||||
}
|
||||
}
|
||||
$pages_str .= ($page < $pgs - 5 ? " ..." : "");
|
||||
$pages_str = ($page > 4 ? "<a href='?topic=" . (int)$row['id'] . "&konftop=" . htmlspecialchars($_GET['konftop']) . "&page=" . ($page - 1) . "'> « </a> ... " : "") . $pages_str . (($page < ($pgs - 1) ? "<a href='?topic=" . (int)$row['id'] . "&page=" . ($page + 1) . "' > » </a>" : ""));
|
||||
}
|
||||
$FirstPage = (ceil($pgs) > 4 ? $_GET['page'] > 0 ? "<a href='?topic=" . (int)$row['id'] . "&konftop=" . htmlspecialchars($_GET['konftop']) . "&page=0'> Первая </a>" : "" : "");
|
||||
$LastPage = (ceil($pgs) > 4 ? (ceil($pgs) - 1) != $_GET['page'] ? "<a href='?topic=" . (int)$row['id'] . "&konftop=" . htmlspecialchars($_GET['konftop']) . "&page=" . (ceil($pgs) - 1) . "'> Последняя </a>" : "" : "");
|
||||
$pages_str = $FirstPage . $pages_str . $LastPage;
|
||||
echo $pages_str;
|
||||
|
||||
?>
|
||||
<div id="leaf<?= $row['id'] ?>"
|
||||
style="background-color: #ddd;margin: 2px;padding:5px;overflow-x: auto;word-wrap: break-word;box-shadow: 1px 2px 3px #ccc;">
|
||||
<span class="topicTitle">
|
||||
<img src="i/forum/icon<?= $icons ?>.gif"> <?= $row['topic'] ?>
|
||||
</span>
|
||||
<div class="auth_str">
|
||||
<?= $row['author'] ?><span class="date">(<?= $row['date'] ?>)</span>
|
||||
<a href='#' class='cite' onclick="add_cites(<?= $row['id'] ?>);" title="Цитата">
|
||||
<small>Цитировать</small>
|
||||
</a>
|
||||
<?php if ($isAdmin): ?>
|
||||
| <a href="javascript:void(0);" class="contact" id="<?= $row['id'] ?>">
|
||||
<small>Редактировать</small>
|
||||
<div class="auth_str">
|
||||
<?= $row['author'] ?><span class="date">(<?= $row['date'] ?>)</span>
|
||||
<a href='#' class='cite' onclick="add_cites(<?= $row['id'] ?>);" title="Цитата">
|
||||
<small>Цитировать</small>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($isAdmin): ?>
|
||||
| <a href="javascript:void(0);" class="contact" id="<?= $row['id'] ?>">
|
||||
<small>Редактировать</small>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($isModerator AND (isset($_GET['conf']) OR isset($_GET['page']))): ?>
|
||||
<a href="?topic=<?= $_GET['topic'] ?>&konftop=<?= htmlspecialchars($_GET['conf']) ?>&page=<?= $_GET['page'] ?>&dp=<?= $row['id'] ?>">
|
||||
<small>Удалить</small>
|
||||
</a> |
|
||||
<a onclick="let obj; if (obj = prompt('Введите комментарий','')) { window.location='forum.php?topic=<?= $_GET['topic'] ?>&konftop=<?= htmlspecialchars($_GET['conf']) ?>&page=<?= $_GET['page'] ?>&cpr='+obj+'&com=<?= $row['id'] ?>'; }"
|
||||
href='#'>
|
||||
<small>Комментарий</small>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<br>
|
||||
<br>
|
||||
</div>
|
||||
<span><?= $row['text'] ?></span>
|
||||
</div>
|
||||
<?php
|
||||
if (empty($_GET['page'])) $_GET['page'] = "";
|
||||
$data = db::c()->query('SELECT * FROM `forum` WHERE `parent` = "?s" ORDER BY `id` ASC LIMIT ?i,20', $_GET['topic'], ($_GET['page'] * 20));
|
||||
while ($row = $data->fetch_assoc()): ?>
|
||||
<div id="leaf<?= $row['id'] ?>"
|
||||
style="background-color: #ddd;margin: 2px;padding:5px;overflow-x: auto;word-wrap: break-word;box-shadow: 1px 2px 3px #ccc;">
|
||||
<div class="mesTopBar">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<?= $row['author'] ?> <span class="date">(<?= $row['date'] ?>)</span>
|
||||
<?php if ($isModerator AND isset($_GET['conf']) AND isset($_GET['page'])): ?>
|
||||
<a href="?topic=<?= $_GET['topic'] ?>&konftop=<?= htmlspecialchars($_GET['conf']) ?>&page=<?= $_GET['page'] ?>&dp=<?= $row['id'] ?>">
|
||||
<small>Удалить</small>
|
||||
</a>
|
||||
<a onclick="let obj; if (obj = prompt('Введите комментарий','')) { window.location='forum.php?topic=<?= $_GET['topic'] ?>&konftop=<?= htmlspecialchars($_GET['conf']) ?>&page=<?= $_GET['page'] ?>&cpr='+obj+'&com=<?= $row['id'] ?>'; }"
|
||||
href='#'>
|
||||
|
|
||||
<small>Комментарий</small>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="javascript:void(0);" class="quote_btn"
|
||||
onclick="return add_cites(<?= $row['id'] ?>);" title="Цитата">
|
||||
<small>Цитировать</small>
|
||||
</a>
|
||||
<?php if ($isAdmin): ?>
|
||||
<a href="javascript:void(0);" class="contact"
|
||||
id="<?= $row['id'] ?>">
|
||||
<small>Редактировать</small>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php if ($isModerator and (isset($_GET['conf']) or isset($_GET['page']))): ?>
|
||||
<a href="?topic=<?= $_GET['topic'] ?>&konftop=<?= htmlspecialchars($_GET['conf']) ?>&page=<?= $_GET['page'] ?>&dp=<?= $row['id'] ?>">
|
||||
<small>Удалить</small>
|
||||
</a> |
|
||||
<a onclick="let obj; if (obj = prompt('Введите комментарий','')) { window.location='forum.php?topic=<?= $_GET['topic'] ?>&konftop=<?= htmlspecialchars($_GET['conf']) ?>&page=<?= $_GET['page'] ?>&cpr='+obj+'&com=<?= $row['id'] ?>'; }"
|
||||
href='#'>
|
||||
<small>Комментарий</small>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<br>
|
||||
<br>
|
||||
</div>
|
||||
<span><?= $row['text'] ?></span>
|
||||
</div>
|
||||
<?php
|
||||
endwhile;
|
||||
if ($pgs > 1) {
|
||||
echo "<img src=i/ico/news.gif> Страницы: ";
|
||||
}
|
||||
echo $pages_str;
|
||||
<?php
|
||||
if (empty($_GET['page'])) $_GET['page'] = "";
|
||||
$data = db::c()->query('SELECT * FROM `forum` WHERE `parent` = "?s" ORDER BY `id` ASC LIMIT ?i,20', $_GET['topic'], ($_GET['page'] * 20));
|
||||
while ($row = $data->fetch_assoc()): ?>
|
||||
<div id="leaf<?= $row['id'] ?>"
|
||||
style="background-color: #ddd;margin: 2px;padding:5px;overflow-x: auto;word-wrap: break-word;box-shadow: 1px 2px 3px #ccc;">
|
||||
<div class="mesTopBar">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<?= $row['author'] ?> <span
|
||||
class="date">(<?= $row['date'] ?>)</span>
|
||||
<?php if ($isModerator and isset($_GET['conf']) and isset($_GET['page'])): ?>
|
||||
<a href="?topic=<?= $_GET['topic'] ?>&konftop=<?= htmlspecialchars($_GET['conf']) ?>&page=<?= $_GET['page'] ?>&dp=<?= $row['id'] ?>">
|
||||
<small>Удалить</small>
|
||||
</a>
|
||||
<a onclick="let obj; if (obj = prompt('Введите комментарий','')) { window.location='forum.php?topic=<?= $_GET['topic'] ?>&konftop=<?= htmlspecialchars($_GET['conf']) ?>&page=<?= $_GET['page'] ?>&cpr='+obj+'&com=<?= $row['id'] ?>'; }"
|
||||
href='#'>
|
||||
|
|
||||
<small>Комментарий</small>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="javascript:void(0);" class="quote_btn"
|
||||
onclick="return add_cites(<?= $row['id'] ?>);" title="Цитата">
|
||||
<small>Цитировать</small>
|
||||
</a>
|
||||
<?php if ($isAdmin): ?>
|
||||
<a href="javascript:void(0);" class="contact"
|
||||
id="<?= $row['id'] ?>">
|
||||
<small>Редактировать</small>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<span><?= $row['text'] ?></span>
|
||||
</div>
|
||||
<?php
|
||||
endwhile;
|
||||
if ($pgs > 1) {
|
||||
echo "<img src=i/ico/news.gif> Страницы: ";
|
||||
}
|
||||
echo $pages_str;
|
||||
|
||||
if ($closed == 1) {
|
||||
echo "<br /><div align=center>" . $closepal . "</div><br /><br />";
|
||||
} else {
|
||||
if (!empty($user['block'])) {
|
||||
$error = "Вы заблокированы!";
|
||||
} elseif ($user['level'] < 2) {
|
||||
$error = "Персонажам до 2-го уровня запрещено писать на форуме!";
|
||||
} elseif (isset($sleep['id'])) {
|
||||
$error = "Вы молчите!";
|
||||
if ($closed == 1) {
|
||||
echo "<br /><div align=center>" . $closepal . "</div><br /><br />";
|
||||
} else {
|
||||
?>
|
||||
<a name="add_comment_place"></a>
|
||||
<form method=POST
|
||||
action="forum.php?topic=<?= $_GET['topic'] ?>&konftop=<?= $_GET['conf'] ?>&page=<?= $_GET['page'] ?>"
|
||||
name="F1">
|
||||
if (!empty($user['block'])) {
|
||||
$error = "Вы заблокированы!";
|
||||
} elseif ($user['level'] < 2) {
|
||||
$error = "Персонажам до 2-го уровня запрещено писать на форуме!";
|
||||
} elseif (isset($sleep['id'])) {
|
||||
$error = "Вы молчите!";
|
||||
} else {
|
||||
?>
|
||||
<a name="add_comment_place"></a>
|
||||
<form method=POST
|
||||
action="forum.php?topic=<?= $_GET['topic'] ?>&konftop=<?= $_GET['conf'] ?>&page=<?= $_GET['page'] ?>"
|
||||
name="F1">
|
||||
|
||||
<table bgcolor="F6E5B1" cellpadding="5" style="border: 1px outset;">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h4 id="response">Оставить комментарий</h4>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table bgcolor="F6E5B1" cellpadding="5" style="border: 1px outset;">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h4 id="response">Оставить комментарий</h4>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<textarea class="inup" id="answer" rows="12" name="text"
|
||||
cols="84" wrap="virtual"
|
||||
onselect="storeCaret(this);"
|
||||
onclick="storeCaret(this);"
|
||||
onkeyup="storeCaret(this);"
|
||||
onchange="storeCaret(this);"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<input type="submit" class="btn" value="Добавить" name="add2">
|
||||
<div class="page" id="<?= $ps; ?>" style="display: none;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<input type="hidden" value="index" name="n"/>
|
||||
<input type="hidden" value="73991290635595" name="id"/>
|
||||
<input type="hidden" value="add_com" name="act"/>
|
||||
<input type="hidden" id="key_person_line" name="key_person_line"
|
||||
value="1290639545#1227576496"/>
|
||||
<input type="hidden" id="set_person_line" name="set_person_line"
|
||||
value="9c84c2b3d7e44a2b82928fd840ec97d7"/>
|
||||
</form>
|
||||
<?
|
||||
}
|
||||
}
|
||||
} else echo "Тема удалена с форума, либо её не существует.<br>";
|
||||
}
|
||||
} 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);
|
||||
?>
|
||||
<td rowspan="2" style="padding-left: 10px">
|
||||
<h3><?= $confname ?></h3>
|
||||
|
||||
<?php
|
||||
if (isset($error)) err($error);
|
||||
if (empty($row['parent'])) echo $row['text'];
|
||||
|
||||
if ($pgs > 1) {
|
||||
for ($i = 0; $i < ceil($pgs); $i++) {
|
||||
if (($i > ($page - 5)) && ($i <= ($page + 4))) {
|
||||
$pages_str .= ($i == $page ? " <b>" . ($i + 1) . "</b>" : " <a href='?conf=" . $_GET['conf'] . "&konftop=" . htmlspecialchars($_GET['conf']) . "&page=" . ($i) . "'>" . ($i + 1) . "</a>");
|
||||
}
|
||||
}
|
||||
$pages_str .= ($page < $pgs - 5 ? " ..." : "");
|
||||
$pages_str = ($page > 4 ? "<a href='?conf=" . $_GET['conf'] . "&konftop=" . htmlspecialchars($_GET['conf']) . "&page=" . ($page - 1) . "'> « </a> ... " : "") . $pages_str . (($page < ($pgs - 1) ? "<a href='?conf=" . $_GET['conf'] . "&page=" . ($page + 1) . "' > »</a>" : ""));
|
||||
?>
|
||||
<div style="width: 100%; margin: 5px;">
|
||||
<img src="i/ico/news.gif" width="16" height="16"/> Страницы:<?= $pages_str ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
$FirstPage = (ceil($pgs) > 4 ? $_GET['page'] > 0 ? "<a href='?conf=" . $_GET['conf'] . "&konftop=" . htmlspecialchars($_GET['conf']) . "&page=0'> Первая </a>" : "" : "");
|
||||
$LastPage = (ceil($pgs) > 4 ? (ceil($pgs) - 1) != $_GET['page'] ? "<a href='?conf=" . $_GET['conf'] . "&konftop=" . htmlspecialchars($_GET['conf']) . "&page=" . (ceil($pgs) - 1) . "'> Последняя </a>" : "" : "");
|
||||
$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 "<div class=\"mBodyBlock rounded rc6\" style='background-color: #ddd;margin: 2px;overflow-x: auto;word-wrap: break-word; box-shadow: 1px 2px 3px #ccc'>
|
||||
<p class=pleft>" . ($row['fix'] ? "📌 " : "") . "<a href='?topic=" . $row['id'];
|
||||
if (isset($_GET['conf'])) echo "&konftop=" . $_GET['conf'];
|
||||
|
||||
$pgs1 = db::c()->query('SELECT count(`id`) FROM `forum` WHERE `parent` = ?i', $row['id'])->fetch_assoc();
|
||||
$pgs1 = $pgs1[0] / 20;
|
||||
$pages_str1 = '';
|
||||
$page1 = (int)$_GET['page'] > 0 ? (((int)$_GET['page'] + 1) > $pgs ? ($pgs - 1) : (int)$_GET['page']) : 0;
|
||||
$page1 = ceil($page1);
|
||||
if ($pgs1 > 1) {
|
||||
for ($i = 0; $i < ceil($pgs1); $i++)
|
||||
if (($i > ($page1 - 5)) && ($i <= ($page1 + 4)))
|
||||
$pages_str1 .= ($i == $page1 ? "<b>" . ($i + 1) . "</b>" : "<a href='?topic=" . $row['id'] . "&konftop=" . htmlspecialchars($_GET['conf']) . "&page=" . ($i) . "'>" . ($i + 1) . "</a>");
|
||||
$pages_str1 .= ($page1 < $pgs1 - 5 ? " ..." : "");
|
||||
}
|
||||
if ($pgs1 > 1) {
|
||||
$pages_str1 = "<nobr><img src=\"i/forum/p.gif\" width=\"10\" height=\"12\" /><small class=pages><span class=pagenum>" . $pages_str1 . "</span></small></nobr>";
|
||||
}
|
||||
|
||||
echo "'><IMG height=15 src=\"i/forum/icon{$icons}.gif\" width=15 border=0> {$row['topic']}</a> " . $pages_str1 . "<nobr> {$row['author']}</nobr>";
|
||||
|
||||
if ($isModerator) echo " <a href='?conf={$_GET['conf']}&dt={$row['id']}'><small>Удалить</small></a>";
|
||||
|
||||
echo "<br /><span class=date>" . $row['date'] . "</span><span class=dsc> " . strip_tags(substr($row['text'], 0, 250), "") . "</span>
|
||||
<br /><small>Ответов: <b>" . $count . "</b> <span title=\"Последний ответ: " . $logi . "\" style=\"border-bottom:1px dashed grey;cursor:help;font-size:10px;\">(" . $lasttime . ")</span></small>
|
||||
</p></div>";
|
||||
}
|
||||
}
|
||||
if ($pgs > 1) echo "<p><img src=i/ico/news.gif width=\"16\" height=\"16\" /> Страницы:";
|
||||
|
||||
echo $pages_str . "</p>";
|
||||
|
||||
if (!empty($user['block'])) {
|
||||
$error = "Вы заблокированы!";
|
||||
} elseif ($user['level'] < 2) {
|
||||
$error = "Персонажам до 2-го уровня запрещено писать на форуме!";
|
||||
} elseif (isset($sleep['id'])) {
|
||||
$error = "Вы молчите!";
|
||||
} else {
|
||||
?>
|
||||
<a name="answer"></a>
|
||||
<br/>
|
||||
<form method=POST action="forum.php?conf=<?= $_GET['conf'] ?>" name="F1">
|
||||
<table bgcolor="F6E5B1" width="100%" cellspacing="0" cellpadding="2"
|
||||
style="border: 1px outset;">
|
||||
<tr>
|
||||
<td align=center>
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h4>Добавить свой вопрос в форум</h4>
|
||||
<input type="text" class="inup" name="title" size="57" maxlength="65"
|
||||
placeholder="Тема сообщения">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<input type="submit" class="btn" value="Добавить" name="add2">
|
||||
<div class="page" id="<?= $ps; ?>" style="display: none;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<input type="hidden" value="index" name="n"/>
|
||||
<input type="hidden" value="73991290635595" name="id"/>
|
||||
<input type="hidden" value="add_com" name="act"/>
|
||||
<input type="hidden" id="key_person_line" name="key_person_line"
|
||||
value="1290639545#1227576496"/>
|
||||
<input type="hidden" id="set_person_line" name="set_person_line"
|
||||
value="9c84c2b3d7e44a2b82928fd840ec97d7"/>
|
||||
</form>
|
||||
<?
|
||||
}
|
||||
}
|
||||
} else echo "Тема удалена с форума, либо её не существует.<br>";
|
||||
}
|
||||
} 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);
|
||||
?>
|
||||
<td rowspan="2" style="padding-left: 10px">
|
||||
<h3><?= $confname ?></h3>
|
||||
|
||||
<?php
|
||||
if (isset($error)) err($error);
|
||||
if (empty($row['parent'])) echo $row['text'];
|
||||
|
||||
if ($pgs > 1) {
|
||||
for ($i = 0; $i < ceil($pgs); $i++) {
|
||||
if (($i > ($page - 5)) && ($i <= ($page + 4))) {
|
||||
$pages_str .= ($i == $page ? " <b>" . ($i + 1) . "</b>" : " <a href='?conf=" . $_GET['conf'] . "&konftop=" . htmlspecialchars($_GET['conf']) . "&page=" . ($i) . "'>" . ($i + 1) . "</a>");
|
||||
}
|
||||
}
|
||||
$pages_str .= ($page < $pgs - 5 ? " ..." : "");
|
||||
$pages_str = ($page > 4 ? "<a href='?conf=" . $_GET['conf'] . "&konftop=" . htmlspecialchars($_GET['conf']) . "&page=" . ($page - 1) . "'> « </a> ... " : "") . $pages_str . (($page < ($pgs - 1) ? "<a href='?conf=" . $_GET['conf'] . "&page=" . ($page + 1) . "' > »</a>" : ""));
|
||||
?>
|
||||
<div style="width: 100%; margin: 5px;">
|
||||
<img src="i/ico/news.gif" width="16" height="16"/> Страницы:<?= $pages_str ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
$FirstPage = (ceil($pgs) > 4 ? $_GET['page'] > 0 ? "<a href='?conf=" . $_GET['conf'] . "&konftop=" . htmlspecialchars($_GET['conf']) . "&page=0'> Первая </a>" : "" : "");
|
||||
$LastPage = (ceil($pgs) > 4 ? (ceil($pgs) - 1) != $_GET['page'] ? "<a href='?conf=" . $_GET['conf'] . "&konftop=" . htmlspecialchars($_GET['conf']) . "&page=" . (ceil($pgs) - 1) . "'> Последняя </a>" : "" : "");
|
||||
$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 "<div class=\"mBodyBlock rounded rc6\" style='background-color: #ddd;margin: 2px;overflow-x: auto;word-wrap: break-word; box-shadow: 1px 2px 3px #ccc'>
|
||||
<p class=pleft>" . ($row['fix'] ? "📌 " : "") . "<a href='?topic=" . $row['id'];
|
||||
if (isset($_GET['conf'])) echo "&konftop=" . $_GET['conf'];
|
||||
|
||||
$pgs1 = db::c()->query('SELECT count(`id`) FROM `forum` WHERE `parent` = ?i', $row['id'])->fetch_assoc();
|
||||
$pgs1 = $pgs1[0] / 20;
|
||||
$pages_str1 = '';
|
||||
$page1 = (int)$_GET['page'] > 0 ? (((int)$_GET['page'] + 1) > $pgs ? ($pgs - 1) : (int)$_GET['page']) : 0;
|
||||
$page1 = ceil($page1);
|
||||
if ($pgs1 > 1) {
|
||||
for ($i = 0; $i < ceil($pgs1); $i++)
|
||||
if (($i > ($page1 - 5)) && ($i <= ($page1 + 4)))
|
||||
$pages_str1 .= ($i == $page1 ? "<b>" . ($i + 1) . "</b>" : "<a href='?topic=" . $row['id'] . "&konftop=" . htmlspecialchars($_GET['conf']) . "&page=" . ($i) . "'>" . ($i + 1) . "</a>");
|
||||
$pages_str1 .= ($page1 < $pgs1 - 5 ? " ..." : "");
|
||||
}
|
||||
if ($pgs1 > 1) {
|
||||
$pages_str1 = "<nobr><img src=\"i/forum/p.gif\" width=\"10\" height=\"12\" /><small class=pages><span class=pagenum>" . $pages_str1 . "</span></small></nobr>";
|
||||
}
|
||||
|
||||
echo "'><IMG height=15 src=\"i/forum/icon{$icons}.gif\" width=15 border=0> {$row['topic']}</a> " . $pages_str1 . "<nobr> {$row['author']}</nobr>";
|
||||
|
||||
if ($isModerator) echo " <a href='?conf={$_GET['conf']}&dt={$row['id']}'><small>Удалить</small></a>";
|
||||
|
||||
echo "<br /><span class=date>" . $row['date'] . "</span><span class=dsc> " . strip_tags(substr($row['text'], 0, 250), "") . "</span>
|
||||
<br /><small>Ответов: <b>" . $count . "</b> <span title=\"Последний ответ: " . $logi . "\" style=\"border-bottom:1px dashed grey;cursor:help;font-size:10px;\">(" . $lasttime . ")</span></small>
|
||||
</p></div>";
|
||||
}
|
||||
}
|
||||
if ($pgs > 1) echo "<p><img src=i/ico/news.gif width=\"16\" height=\"16\" /> Страницы:";
|
||||
|
||||
echo $pages_str . "</p>";
|
||||
|
||||
if (!empty($user['block'])) {
|
||||
$error = "Вы заблокированы!";
|
||||
} elseif ($user['level'] < 2) {
|
||||
$error = "Персонажам до 2-го уровня запрещено писать на форуме!";
|
||||
} elseif (isset($sleep['id'])) {
|
||||
$error = "Вы молчите!";
|
||||
} else {
|
||||
?>
|
||||
<a name="answer"></a>
|
||||
<br/>
|
||||
<form method=POST action="forum.php?conf=<?= $_GET['conf'] ?>" name="F1">
|
||||
<table bgcolor="F6E5B1" width="100%" cellspacing="0" cellpadding="2"
|
||||
style="border: 1px outset;">
|
||||
<tr>
|
||||
<td align=center>
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h4>Добавить свой вопрос в форум</h4>
|
||||
<input type="text" class="inup" name="title" size="57" maxlength="65"
|
||||
placeholder="Тема сообщения">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<td>
|
||||
<textarea rows="8" class="inup" id="message" name="text" cols="85"
|
||||
wrap="virtual"
|
||||
onselect="storeCaret(this);"
|
||||
@ -679,48 +672,50 @@ if (isset($_GET['do']) && $isModerator == true) {
|
||||
onkeyup="storeCaret(this);"
|
||||
onchange="storeCaret(this);"
|
||||
placeholder="Введите сообщение..."></textarea>
|
||||
<input type=hidden value=0 name=n>
|
||||
<input type=hidden value=1025804759 name=id>
|
||||
<input type=hidden name=redirect>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<input type="hidden" name="icon" value="13">
|
||||
</td>
|
||||
<td align="right">
|
||||
<input type="submit" class="btn" value="Добавить" name="add"/>
|
||||
<input type="hidden" name="n" value="klans">
|
||||
<input type="hidden" id="act" name="act" value="add_branch"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?
|
||||
}
|
||||
}
|
||||
} else echo ' <div style="width: 300px; margin: auto; font-weight: bold;">Ничего не найдено!</div> ';
|
||||
}
|
||||
?>
|
||||
<!-- End of text -->
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type=hidden value=0 name=n>
|
||||
<input type=hidden value=1025804759 name=id>
|
||||
<input type=hidden name=redirect>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<input type="hidden" name="icon" value="13">
|
||||
</td>
|
||||
<td align="right">
|
||||
<input type="submit" class="btn" value="Добавить"
|
||||
name="add"/>
|
||||
<input type="hidden" name="n" value="klans">
|
||||
<input type="hidden" id="act" name="act"
|
||||
value="add_branch"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo ' <div style="width: 300px; margin: auto; font-weight: bold;">Ничего не найдено!</div> ';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!-- End of text -->
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php if ($isModerator == true): ?>
|
||||
<form name='repltopic' method='post'>
|
||||
<input type='hidden' id='selectt' name='selectt'/>
|
||||
<input type='hidden' id='numt' name='numt'/>
|
||||
</form>
|
||||
<? endif; ?>
|
||||
</body>
|
||||
</html>
|
||||
<? endif; ?>
|
Loading…
Reference in New Issue
Block a user