Code cleanup
This commit is contained in:
parent
81c20f34d3
commit
4252246d1d
104
forum.php
104
forum.php
@ -354,7 +354,7 @@ if (isset($_GET['do']) && $isModerator == true) {
|
||||
<head>
|
||||
<title>Форум</title>
|
||||
<meta charset="utf-8">
|
||||
<!-- <link rel="stylesheet" href="css/forum.css"/>-->
|
||||
<!-- <link rel="stylesheet" href="css/forum.css"/>-->
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<link rel="stylesheet" href="css/wysibb/theme/default/wbbtheme.css"/>
|
||||
<link rel='stylesheet' href="css/contact.css" media='screen'/>
|
||||
@ -378,8 +378,6 @@ if (isset($_GET['do']) && $isModerator == true) {
|
||||
$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) {
|
||||
$replasepost .= "<option value='" . $row['id'] . "'>" . $row['topic'] . "</option>";
|
||||
|
||||
$min = $row['min_align'] == 0;
|
||||
$max = $row['max_align'] == 0;
|
||||
|
||||
@ -403,11 +401,11 @@ if (isset($_GET['do']) && $isModerator == true) {
|
||||
$parentCat = db::c()->query('SELECT * FROM `forum` WHERE `id` = ?i', $top)->fetch_assoc();
|
||||
$icons = $row['icon'];
|
||||
?>
|
||||
<div align="center"><br/>
|
||||
<h3><a href="forum.php?conf=<?= $top ?>">Конференция "<?= $parentCat['topic'] ?>"</a></h3>
|
||||
<? if (isset($error)) err($error); ?>
|
||||
</div>
|
||||
<?
|
||||
<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) {
|
||||
@ -423,26 +421,20 @@ if (isset($_GET['do']) && $isModerator == true) {
|
||||
$fix = "<a href='?topic={$_GET['topic']}&do=fix'>Прикрепить</a>";
|
||||
}
|
||||
|
||||
if ($isModerator == true) {
|
||||
?>
|
||||
if ($isModerator): ?>
|
||||
<br>
|
||||
<div align="right">
|
||||
<small>
|
||||
<img src="i/close2.gif"><?= $close ?> | <img src="i/ico/fixed.gif"><?= $fix ?>
|
||||
<br><i>Перемещение тем не работает.</i>
|
||||
</small>
|
||||
<br><br>
|
||||
<select id="seltopic<?= $_GET['topic'] ?>"><?= $replasepost ?></select>
|
||||
<input type="button" value="Переместить"
|
||||
onClick="replasetopic(<?= $_GET['konftop'] ?>, <?= $_GET['topic'] ?>)">
|
||||
</div>
|
||||
<?php
|
||||
if (!empty($_POST['selectt']) AND !empty($_POST['numt'])) {
|
||||
$error = "<h3>Тема перемещена.</h3><a href='forum.php?topic=" . $_POST['numt'] . "&konftop=" . $_POST['selectt'] . "'>forum.php?topic=" . $_POST['numt'] . "&konftop=" . $_POST['selectt'] . "</a>";
|
||||
}
|
||||
}
|
||||
<?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\" /> Страницы : ";
|
||||
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);
|
||||
@ -482,9 +474,7 @@ if (isset($_GET['do']) && $isModerator == true) {
|
||||
<img src="i/clear.gif">
|
||||
</a>
|
||||
<a onclick="var obj; if (obj = prompt('Введите комментарий','')) { window.location='forum.php?topic=<?= $_GET['topic'] ?>&konftop=<?= htmlspecialchars($_GET['conf']) ?>&page=<?= $_GET['page'] ?>&cpr='+obj+'&com=<?= $row['id'] ?>'; }"
|
||||
href='#'>
|
||||
<img src="i/forum/icon4.gif" title="Комментарий">
|
||||
</a>
|
||||
href='#'><small>Комментарий</small></a>
|
||||
<?php endif; ?>
|
||||
<br>
|
||||
<br>
|
||||
@ -501,7 +491,7 @@ if (isset($_GET['do']) && $isModerator == true) {
|
||||
<tr>
|
||||
<td>
|
||||
<?= $row['author'] ?> <span class="date">(<?= $row['date'] ?>)</span>
|
||||
<?php if ($isModerator): ?>
|
||||
<?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'] ?>">
|
||||
<img src="i/clear.gif">
|
||||
</a>
|
||||
@ -513,8 +503,7 @@ if (isset($_GET['do']) && $isModerator == true) {
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="javascript:void(0);" class="quote_btn"
|
||||
onclick="return add_cites(<?= $row['id'] ?>);" alt="Цитата"
|
||||
title="Цитата">
|
||||
onclick="return add_cites(<?= $row['id'] ?>);" title="Цитата">
|
||||
<img src="i/forum/icon13.gif">
|
||||
</a>
|
||||
<?php if ($isAdmin): ?>
|
||||
@ -541,12 +530,12 @@ if (isset($_GET['do']) && $isModerator == true) {
|
||||
echo "<br /><div align=center>" . $closepal . "</div><br /><br />";
|
||||
} else {
|
||||
if (!empty($user['block'])) {
|
||||
$error = "<br /><br /><b>Заблокированным персонажам запрещено писать на форуме!</b><br /><br />";
|
||||
$error = "Вы заблокированы!";
|
||||
} elseif ($user['level'] < 2) {
|
||||
$error = "<br /><br /><b>Персонажам до 2-го уровня запрещено писать на форуме!</b><br /><br />";
|
||||
$error = "Персонажам до 2-го уровня запрещено писать на форуме!";
|
||||
} elseif (isset($sleep['id'])) {
|
||||
$error = "<br /><br /><b>Персонажам с заклинанием форумного молчания запрещено писать на форуме!</b><br /><br />";
|
||||
} elseif ($user['level'] > 1 && !isset($sleep['id'])) {
|
||||
$error = "Вы молчите!";
|
||||
} else {
|
||||
?>
|
||||
<a name="add_comment_place"></a>
|
||||
<form method=POST
|
||||
@ -593,26 +582,20 @@ if (isset($_GET['do']) && $isModerator == true) {
|
||||
} 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) {
|
||||
?>
|
||||
<td rowspan="2" style="padding-left: 10px">
|
||||
|
||||
<br/>
|
||||
|
||||
<? $confname = 'Конференция "' . $row['topic'] . '"'; ?>
|
||||
<h3 style="display:inline;text-align:center;padding-left:50px;"><?= $confname ?></h3><br/>
|
||||
<? if (isset($error)) err($error);
|
||||
|
||||
if ($row['parent'] == 0) {
|
||||
echo $row['text'];
|
||||
}
|
||||
|
||||
echo '<br />';
|
||||
|
||||
$confname = 'Конференция «' . $row['topic'] . '»';
|
||||
$pgs = db::c()->query('SELECT count(`id`) FROM `forum` WHERE `parent` = ?i ORDER BY `fix` DESC, `updated` DESC', $_GET['conf'])->fetch_assoc();
|
||||
$pgs = $pgs[0] / 20;
|
||||
$pages_str = '';
|
||||
$page = (int)$_GET['page'] > 0 ? (((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))) {
|
||||
@ -626,26 +609,15 @@ if (isset($_GET['do']) && $isModerator == true) {
|
||||
$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;
|
||||
?>
|
||||
<table width=100% cellspacing=5 cellpadding=5>
|
||||
<tr>
|
||||
<td><img src="i/ico/news.gif" width="16" height="16"/> Страницы:<?= $pages_str ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="i/register/ram12_34.gif">
|
||||
<tr>
|
||||
<td align="left" scope="col"><img src="i/register/ram12_33.gif" width="12" height="11"/></td>
|
||||
<td scope="col"></td>
|
||||
<td width="18" align="right" scope="col"><img src="i/register/ram12_35.gif" width="13" height="11"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div style="width: 100%; margin: 5px;">
|
||||
<img src="i/ico/news.gif" width="16" height="16"/> Страницы:<?= $pages_str ?>
|
||||
</div>
|
||||
<?php
|
||||
$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 = mysql_query("SELECT `author` FROM (SELECT `author`,`id` FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($row['id']) . "' ORDER BY `id` DESC LIMIT 10) AS sTable ORDER BY id DESC LIMIT 1;");
|
||||
$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_assoc()) {
|
||||
$userlist = strip_tags($row2[0], "");
|
||||
@ -658,9 +630,7 @@ if (isset($_GET['do']) && $isModerator == true) {
|
||||
$lasttime = $lasttimedb['date'];
|
||||
echo "<div class=\"mBodyBlock rounded rc6\">
|
||||
<p class=pleft>" . ($row['fix'] ? "<IMG src=\"i/ico/fixed.gif\" alt=\"Закреплено\" title=\"Закреплено\" border=0> " : "") . "<a href='?topic=" . $row['id'];
|
||||
if (isset($_GET['conf'])) {
|
||||
echo "&konftop=" . $_GET['conf'];
|
||||
}
|
||||
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;
|
||||
@ -677,20 +647,16 @@ if (isset($_GET['do']) && $isModerator == true) {
|
||||
$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 == true && $row['id'] != 228043095) {
|
||||
echo " <a href='?conf={$_GET['conf']}&dt={$row['id']}'><img src='i/clear.gif'></a>";
|
||||
}
|
||||
if ($isModerator) echo " <a href='?conf={$_GET['conf']}&dt={$row['id']}'><img src='i/clear.gif'></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\" /> Страницы :";
|
||||
}
|
||||
if ($pgs > 1) echo "<p><img src=i/ico/news.gif width=\"16\" height=\"16\" /> Страницы:";
|
||||
|
||||
echo $pages_str . "</p>";
|
||||
|
||||
if (!empty($user['block'])) {
|
||||
|
Loading…
Reference in New Issue
Block a user