battles/forum.php

893 lines
54 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
session_start();
include('config.php');
$user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $_SESSION['uid'] . '" LIMIT 1'));
$sleep = mysql_fetch_array(mysql_query('SELECT `id` FROM `effects` WHERE `owner` = "' . $user['id'] . '" AND `time` > "' . time() . '" AND `type` = "3" LIMIT 1'));
if (!isset($_GET['page'])) {
$ps = 0;
} else {
$ps = $_GET['page'];
}
$dostupPal = false;
$dostupSovet = false;
if (($user['align'] >= 1.7 && $user['align'] < 2) || $user['align'] == 2.4) {
$dostupPal = true;
}
if (($user['align'] >= 1.98 && $user['align'] <= 1.99) || $user['admin'] == 1 || $user['align'] == 10) {
$dostupSovet = true;
$dostupPal = true;
}
$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 '<script type="text/javascript">location.href="forum.php"</script>';
} elseif (isset($_GET['do']) && $_GET['do'] == "search") {
$search .= '<br /><br /><br />';
}
$news_topic = false;
if (isset($_GET['topic']) && is_numeric($_GET['topic']) && $_GET['topic'] == 228043095) {
$news_topic = true;
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Форум Бойцовского клуба</title>
<meta charset="utf-8">
<link rel="stylesheet" href="css/forum.css"/>
<link rel="stylesheet" href="css/wysibb/theme/default/wbbtheme.css"/>
<link rel='stylesheet' href="css/contact.css" media='screen'/>
<script type="text/javascript" language="JavaScript" src="js/jquery.min.js"></script>
<script type="text/javascript" language="JavaScript" src="js/jquery.wysibb-1.3.0.js"></script>
<script type="text/javascript" language="JavaScript" src='js/forum.js'></script>
<script type='text/javascript' src='js/jquery.simplemodal.js'></script>
<script type='text/javascript' src='js/contact.js'></script>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr valign=top>
<td align="center">
<a href="/">← на главную</a>
</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#3D3D3B">
<tr valign=top>
<td align=center>
<script type="text/javascript">
var $wsize = document.body.clientWidth;
if ($wsize >= 800) $wsize = Math.floor($wsize * 0.8);
document.write('<table cellspacing="0" cellpadding="0" bgcolor="#f2e5b1" border="0" width="' + ($wsize - 20 ) + '">');
$(function () {
$("a.cite").show();
return false;
});
</script>
</td>
</tr>
<tr valign="top">
<td width="29" rowspan="2">
<p><img src="i/register/fr_08.jpg" width="29" height="256" alt=""/></p>
</td>
<td style="background: url('i/register/fr_04.jpg') left top no-repeat;" width="200">
<br/>
<?php
if (!$user['id']) {
echo "<b>Не авторизованы</b><br />";
} else {
echo "Игрок : " . nick::id($user['id'])->full(1) . "<br />";
}
?>
<br/>
<b><span style="color: #8f0000;font-family: arial;font-size: 10pt;">Конференции</span></b>
<br/>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left" scope="col">
<img src="i/register/ram12_33.gif" width="12" height="11" alt=""/>
</td>
<td scope="col"></td>
<td width="18" align="right" scope="col">
<img src="i/register/ram12_35.gif" width="13" height="11" alt=""/>
</td>
</tr>
</table>
<?php
if (isset($_POST['selectt'], $_POST['numt']) && $_POST['selectt'] != '' && $_POST['numt'] != '') {
$AlignTop = mysql_fetch_array(mysql_query('SELECT `min_align`, `max_align` FROM `forum` WHERE `id` = "' . mysql_real_escape_string($_POST['selectt']) . '" LIMIT 1'));
mysql_query('UPDATE `forum` SET `parent` = "' . (int)$_POST['selectt'] . '", `min_align` = "' . mysql_real_escape_string($AlignTop['min_align']) . '" , `max_align` = "' . mysql_real_escape_string($AlignTop['max_align']) . '" WHERE `id` = "' . (int)$_POST['numt'] . '" LIMIT 1');
}
if (!isset($_GET['conf']) && !isset($_GET['topic'])) {
$_GET['conf'] = 1;
}
$Movemess = ($dostupPal == true) ? 1 : 0;
$replasepost = '';
if ((isset($_GET['conf']) && is_numeric($_GET['conf'])) || (isset($_GET['konftop']) && is_numeric($_GET['konftop'])) || $Movemess == 1) {
$data = mysql_query("SELECT * FROM `forum` WHERE `parent` = 0 AND `type` = 1 ORDER BY `id` ASC");
while ($row = mysql_fetch_array($data)) {
if ($row['id'] == 228043095) {
$news_topic = true;
}
if (($row['min_align'] == 0 && $row['max_align'] == 0) || ($user['align'] >= $row['min_align'] && $user['align'] <= $row['max_align']) || $user['align'] == '1.99' || $user['admin'] == '1' || $user['align'] == '10') {
$replasepost .= "<option value='" . $row['id'] . "'>" . $row['topic'] . "</option>";
$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) && $user['align'] != '2.99') {
echo '<nobr><b>&nbsp;&nbsp; <img src="i/static/img/ic_acc1.gif" width="10" height="10" title="Только для чтения" />';
} else {
echo '<nobr><b>&nbsp;&nbsp; <img src="i/static/img/ic_acc4.gif" width="10" height="10" title="Разрешено добавлять ответы и создавать топики" />&nbsp;';
}
echo '<a href="?conf=' . $row['id'] . '">' . $row['topic'] . '</a><br /></b></nobr>';
}
}
}
?>
<br/>
<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>
<br/>
</td>
<td rowspan="2" style="padding-left: 10;">
<?php
function parse_bb_code($text)
{
$bbCodes = array(
// Стандартные BB коды
'/\[(\/?)(b|i|u|s)\s*\]/' => "<$1$2>",
'/\[(left|center|right)\]/' => '<p style="text-align:$1;">',
'/\[\/(left|center|right)\]/' => '</p>',
'/\[url\s?(src=)?\s?(.+?)\s?(target=(_blank|_self))?\](.+?)\[\/url\]/' => '<a href="$2" target="$4">$5</a>',
'/\[img width=([0-9]{1,4}) height=([0-9]{1,4})\](.+?)\[\/img\]/' => '<img src="$3" width="$1" height="$2" />',
'/\[img\](.+?)\[\/img\]/' => '<img src="$1" />',
'/\[quote\](.+?)\[\/quote\]/' => "<blockquote>$1</blockquote>",
'/\[code\](.+?)\[\/code\]/' => "<pre><code>$1</code></pre>",
// Смайлы
'/\:smile0\:/' => '<img src="i/forum/icon7.gif" />',
'/\:baby\:/' => '<img src="i/smile/baby.gif" />',
'/\:sniper\:/' => '<img src="i/smile/sniper.gif" />',
'/\:trup\:/' => '<img src="i/smile/trup.gif" />',
'/\:beggar\:/' => '<img src="i/smile/beggar.gif" />',
'/\:rotate\:/' => '<img src="i/smile/rotate.gif" />',
'/\:hello\:/' => '<img src="i/smile/hello.gif" />',
'/\:sten\:/' => '<img src="i/smile/sten.gif" />',
'/\:shuffle\:/' => '<img src="i/smile/shuffle.gif" />',
'/\:elix\:/' => '<img src="i/smile/elix.gif" />',
'/\:smil\:/' => '<img src="i/smile/smil.gif" />',
'/\:mdr\:/' => '<img src="i/smile/mdr.gif" />',
'/\:podz\:/' => '<img src="i/smile/podz.gif" />',
'/\:dont\:/' => '<img src="i/smile/dont.gif" />',
'/\:grust\:/' => '<img src="i/smile/grust.gif" />',
'/\:boks\:/' => '<img src="i/smile/boks.gif" />',
'/\:susel\:/' => '<img src="i/smile/susel.gif" />',
'/\:dedmoroz\:/' => '<img src="i/smile/dedmoroz.gif" />',
'/\:creator\:/' => '<img src="i/smile/creator.gif" />',
'/\:no\:/' => '<img src="i/smile/no.gif" />',
'/\:horse\:/' => '<img src="i/smile/horse.gif" />',
'/\:vamp\:/' => '<img src="i/smile/vamp.gif" />',
'/\:eek\:/' => '<img src="i/smile/eek.gif" />',
'/\:sorry\:/' => '<img src="i/smile/sorry.gif" />',
'/\:friday\:/' => '<img src="i/smile/friday.gif" />',
'/\:obm\:/' => '<img src="i/smile/obm.gif" />',
'/\:smile\:/' => '<img src="i/smile/smile.gif" />',
'/\:nail\:/' => '<img src="i/smile/nail.gif" />',
'/\:gent\:/' => '<img src="i/smile/gent.gif" />',
'/\:beer\:/' => '<img src="i/smile/beer.gif" />',
'/\:inv\:/' => '<img src="i/smile/inv.gif" />',
'/\:fire\:/' => '<img src="i/smile/fire.gif" />',
'/\:dance1\:/' => '<img src="i/smile/dance1.gif" />',
'/\:maniac\:/' => '<img src="i/smile/maniac.gif" />',
'/\:kiss4\:/' => '<img src="i/smile/kiss4.gif" />',
'/\:confused\:/' => '<img src="i/smile/confused.gif" />',
'/\:kiss2\:/' => '<img src="i/smile/kiss2.gif" />',
'/\:snowfight\:/' => '<img src="i/smile/snowfight.gif" />',
'/\:row\:/' => '<img src="i/smile/row.gif" />',
'/\:naem\:/' => '<img src="i/smile/naem.gif" />',
'/\:radio1\:/' => '<img src="i/smile/radio1.gif" />',
'/\:fie\:/' => '<img src="i/smile/fie.gif" />',
'/\:love\:/' => '<img src="i/smile/love.gif" />',
'/\:sneeze\:/' => '<img src="i/smile/sneeze.gif" />',
'/\:mol\:/' => '<img src="i/smile/mol.gif" />',
'/\:showng\:/' => '<img src="i/smile/showng.gif" />',
'/\:rocket\:/' => '<img src="i/smile/rocket.gif" />',
'/\:dustman\:/' => '<img src="i/smile/dustman.gif" />',
'/\:rupor\:/' => '<img src="i/smile/rupor.gif" />',
'/\:nnn\:/' => '<img src="i/smile/nnn.gif" />',
'/\:snegur\:/' => '<img src="i/smile/snegur.gif" />',
'/\:dance2\:/' => '<img src="i/smile/dance2.gif" />',
'/\:jeer\:/' => '<img src="i/smile/jeer.gif" />',
'/\:kiss\:/' => '<img src="i/smile/kiss.gif" />',
'/\:ponder\:/' => '<img src="i/smile/ponder.gif" />',
'/\:drink\:/' => '<img src="i/smile/drink.gif" />',
'/\:angel\:/' => '<img src="i/smile/angel.gif" />',
'/\:idea\:/' => '<img src="i/smile/idea.gif" />',
'/\:lady\:/' => '<img src="i/smile/lady.gif" />',
'/\:gun\:/' => '<img src="i/smile/gun.gif" />',
'/\:pif\:/' => '<img src="i/smile/pif.gif" />',
'/\:help\:/' => '<img src="i/smile/help.gif" />',
'/\:alch\:/' => '<img src="i/smile/alch.gif" />',
'/\:kiss3\:/' => '<img src="i/smile/kiss3.gif" />',
'/\:hug\:/' => '<img src="i/smile/hug.gif" />',
'/\:lordhaos\:/' => '<img src="i/smile/lordhaos.gif" />',
'/\:rose\:/' => '<img src="i/smile/rose.gif" />',
'/\:radio2\:/' => '<img src="i/smile/radio2.gif" />',
'/\:boks2\:/' => '<img src="i/smile/boks2.gif" />',
'/\:str\:/' => '<img src="i/smile/str.gif" />',
'/\:invis\:/' => '<img src="i/smile/invis.gif" />',
'/\:rev\:/' => '<img src="i/smile/rev.gif" />',
'/\:ok\:/' => '<img src="i/smile/ok.gif" />',
'/\:alien\:/' => '<img src="i/smile/alien.gif" />',
'/\:smash\:/' => '<img src="i/smile/smash.gif" />',
'/\:super\:/' => '<img src="i/smile/super.gif" />',
'/\:love2\:/' => '<img src="i/smile/love2.gif" />',
'/\:victory\:/' => '<img src="i/smile/victory.gif" />',
'/\:kruger\:/' => '<img src="i/smile/kruger.gif" />',
'/\:agree\:/' => '<img src="i/smile/agree.gif" />',
'/\:hi\:/' => '<img src="i/smile/hi.gif" />',
'/\:privet\:/' => '<img src="i/smile/privet.gif" />',
'/\:devil\:/' => '<img src="i/smile/devil.gif" />',
'/\:naem2\:/' => '<img src="i/smile/naem2.gif" />',
'/\:tongue\:/' => '<img src="i/smile/tongue.gif" />',
'/\:red\:/' => '<img src="i/smile/red.gif" />',
'/\:doc\:/' => '<img src="i/smile/doc.gif" />',
'/\:icon7\:/' => '<img src="i/forum/icon7.gif" />',
'/\:lightfly\:/' => '<img src="i/smile/lightfly.gif" />',
'/\:owl\:/' => '<img src="i/smile/owl.gif" />',
'/\:pirate\:/' => '<img src="i/smile/pirate.gif" />',
'/\:sword\:/' => '<img src="i/smile/sword.gif" />',
'/\:bye\:/' => '<img src="i/smile/bye.gif" />',
'/\:mad\:/' => '<img src="i/smile/mad.gif" />',
'/\:fingal\:/' => '<img src="i/smile/fingal.gif" />',
'/\:nono\:/' => '<img src="i/smile/nono.gif" />',
'/\:loveya\:/' => '<img src="i/smile/loveya.gif" />',
'/\:cry\:/' => '<img src="i/smile/cry.gif" />',
'/\:superng\:/' => '<img src="i/smile/superng.gif" />',
'/\:yes\:/' => '<img src="i/smile/yes.gif" />',
'/\:crying\:/' => '<img src="i/smile/crying.gif" />',
'/\:\'\(\:/' => '<img src="i/smile/crying.gif" />',
'/\:flowers\:/' => '<img src="i/smile/flowers.gif" />',
'/\:tease\:/' => '<img src="i/smile/tease.gif" />',
'/\:wink\:/' => '<img src="i/smile/wink.gif" />',
'/\:sharp\:/' => '<img src="i/smile/sharp.gif" />',
'/\:nunu\:/' => '<img src="i/smile/nunu.gif" />',
'/\:angel2\:/' => '<img src="i/smile/angel2.gif" />',
'/\:naem3\:/' => '<img src="i/smile/naem3.gif" />',
'/\:lick\:/' => '<img src="i/smile/lick.gif" />',
'/\:ninja\:/' => '<img src="i/smile/ninja.gif" />',
'/\:cat\:/' => '<img src="i/smile/cat.gif" />',
'/\:smoke\:/' => '<img src="i/smile/smoke.gif" />',
'/\:chtoza\:/' => '<img src="i/smile/chtoza.gif" />',
'/\:grace\:/' => '<img src="i/smile/grace.gif" />',
'/\:tongue2\:/' => '<img src="i/smile/tongue2.gif" />',
'/\:sorry2\:/' => '<img src="i/smile/sorry2.gif" />',
'/\:yar\:/' => '<img src="i/smile/yar.gif" />',
'/\:king2\:/' => '<img src="i/smile/king2.gif" />',
'/\:carreat\:/' => '<img src="i/smile/carreat.gif" />',
'/\:hlw\:/' => '<img src="i/smile/hlw.gif" />',
'/\:grenade\:/' => '<img src="i/smile/grenade.gif" />',
'/\:bow\:/' => '<img src="i/smile/bow.gif" />',
'/\:doc2\:/' => '<img src="i/smile/doc2.gif" />',
'/\:duel\:/' => '<img src="i/smile/duel.gif" />',
'/\:mag\:/' => '<img src="i/smile/mag.gif" />',
'/\:king\:/' => '<img src="i/smile/king.gif" />',
'/\:laugh\:/' => '<img src="i/smile/laugh.gif" />',
'/\: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);
return $text;
}
function close_dangling_tags($html)
{
preg_match_all("#<([a-z]+)( .*)?(?!/)>#iU", $html, $result);
$openedtags = $result[1];
preg_match_all("#</([a-z]+)>#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 .= '</' . $openedtags[$i] . '>';
}
} 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/", "<br />", $_POST['text']));
$minmax = mysql_fetch_array(mysql_query("SELECT `min_align`, `max_align` FROM `forum` WHERE `id` = '" . mysql_real_escape_string($_GET['conf']) . "' LIMIT 1"));
$min_align = $minmax['min_align'];
$max_align = $minmax['max_align'];
if (!isset($_POST['text']) || !isset($_POST['title']) || $_POST['title'] == "" || $_POST['title'] == " " || $_POST['text'] == "" || $_POST['text'] == " ") {
$error = "<span style='redalert'>Заголовок или текст не могут быть пустыми</span>";
} elseif (($minmax['min_align'] == 0 && $minmax['max_align'] == 0) || ($user['align'] >= $minmax['min_align'] && $user['align'] <= $minmax['max_align']) || $dostupSovet) {
if ($user['invis'] == 1) {
$userPost = '<b>Невидимка</b>';
} else {
$userPost = nick::id($user['id'])->full(1);
}
if ($dostupPal == true) {
$text1 = $text1;
} else {
$text1 = strip_tags($text1, '<b><i><u><code><a><br><img><div>');
}
mysql_query("INSERT INTO `forum` (`type`, `topic`, `text`, `parent`, `author`, `date`, `min_align`, `max_align`, `icon`) VALUES ('2', '" . mysql_real_escape_string($text2) . "', '" . $text1 . "', '" . mysql_real_escape_string($_GET['conf']) . "', '" . $userPost . "', '" . date('d.m.y H:i:s') . "', '" . mysql_real_escape_string($min_align) . "', '" . mysql_real_escape_string($max_align) . "', '" . mysql_real_escape_string($icon) . "')");
$topic_id = mysql_insert_id();
unset($_POST['text']);
print "<script>window.location='?conf=" . $_GET['conf'] . "&rnd'</script>";
exit();
} else {
$error = "<font color=red><b>Вы не можете писать в этой конференции</b></font>";
}
unset($_POST['add']);
}
if (isset($_POST['add2']) && isset($user['id'])) {
$text2 = htmlspecialchars($_POST['title'], ENT_NOQUOTES, 'utf8');
$text1 = parse_bb_code(preg_replace("/\n/", "<br />", $_POST['text']));
$minmax = mysql_fetch_array(mysql_query("SELECT `min_align`,`max_align`, `close`, `parent` FROM `forum` WHERE `id` = '" . mysql_real_escape_string($_GET['topic']) . "' LIMIT 1"));
$min_align = $minmax['min_align'];
$max_align = $minmax['max_align'];
if (!isset($_POST['text']) || $_POST['text'] == "" || $_POST['text'] == " ") {
$error = "<font color=red><b>Текст не может быть пустыми</b></font>";
} elseif (!is_numeric($_GET['topic'])) {
$error = "<font color=red><b>Не надо так делать</b></font>";
}
if (($minmax['min_align'] == 0 && $minmax['max_align'] == 0) || ($user['align'] >= $minmax['min_align'] && $user['align'] <= $minmax['max_align']) && $minmax['close'] == "0" || $dostupSovet) {
if ($user['invis'] == 1) {
$userPost = '<b>Невидимка</b>';
} else {
$userPost = nick::id($user['id'])->full(1);
}
if ($dostupPal == false) {
$text1 = strip_tags($text1, '<b><i><u><code><a><br><img><div>');
}
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 '<script>location.href="?topic=' . $_GET['topic'] . '&konftop=' . $minmax['parent'] . $page_num . '&rnd#add_comment_place";</script>';
exit();
} else {
$error = "<font color=red><b>Вы не можете писать в этой конференции</b></font>";
}
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 "<script>window.location='?topic=" . $_GET['topic'] . "&page=" . $_GET['page'] . "'</script>";
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 "<script>window.location='?conf=" . $_GET['conf'] . "&rnd'</script>";
exit();
}
}
if (isset($_GET['com']) && isset($_GET['cpr']) && $dostupPal == true) {
if ($user['invis'] == 1) {
mysql_query("UPDATE `forum` SET `text` = CONCAT(`text`,'<br /><font color=red><b>Невидимка</b>: " . mysql_real_escape_string($_GET['cpr']) . "</font>') WHERE `id` = '" . mysql_real_escape_string($_GET['com']) . "' LIMIT 1");
} else {
mysql_query("UPDATE `forum` SET `text` = CONCAT(`text`,'<br /><font color=red>" . mysql_real_escape_string(nick::id($user['id'])->full(1)) . ": " . mysql_real_escape_string($_GET['cpr']) . "</font>') WHERE `id` = '" . mysql_real_escape_string($_GET['com']) . "' LIMIT 1");
}
echo "<script>window.location='?topic=" . $_GET['topic'] . "&rnd'</script>";
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 = '<b>Администрацией</b>';
}
if ($_GET['do'] == "open") {
mysql_query("UPDATE `forum` SET `close` = '0' WHERE `id` = '" . mysql_real_escape_string($_GET['topic']) . "' LIMIT 1");
echo "<script>window.location='?topic=" . $_GET['topic'] . "&rnd'</script>";
exit();
}
if ($_GET['do'] == "close") {
mysql_query("UPDATE `forum` SET `close` = '1', `closepal` = '<font color=red>Обсуждение закрыто " . $palclose . "</font>' WHERE `id` = '" . mysql_real_escape_string($_GET['topic']) . "' LIMIT 1");
echo "<script>window.location='?topic=" . $_GET['topic'] . "&rnd'</script>";
exit();
}
if ($_GET['do'] == "fix") {
mysql_query("UPDATE `forum` SET `fix` = '1' WHERE `id` = '" . mysql_real_escape_string($_GET['topic']) . "' LIMIT 1");
echo "<script>window.location='?topic=" . $_GET['topic'] . "&rnd'</script>";
exit();
}
if ($_GET['do'] == "unfix") {
mysql_query("UPDATE `forum` SET `fix` = '0' WHERE `id` = '" . mysql_real_escape_string($_GET['topic']) . "' LIMIT 1");
echo "<script>window.location='?topic=" . $_GET['topic'] . "&rnd'</script>";
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'];
?>
<div align="center"><br/>
<h3 style="display:inline;text-align:center;border-bottom:dotted 1px #000;">
<a href="forum.php?conf=<?= $top ?>">Конференция "<?= $parentCat['topic'] ?>"</a>
</h3>
<? if ($error != '') {
echo '<center>' . $error . '</center>';
} ?>
</div>
<?
$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 = "<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 ($dostupPal == true) {
echo '<br />
<div align="right">
<small>
<img src="i/close2.gif" />' . $close . ' | <img src="i/ico/fixed.gif" width="12" />' . $fix . '
</small>
<br /><br />
';
echo "<select id='seltopic" . $_GET['topic'] . "'>" . $replasepost . "</select> <input type='button' value='Переместить' onClick=\"replasetopic(" . $_GET['konftop'] . ", " . $_GET['topic'] . ")\"></div>";
if (isset($_POST['selectt'], $_POST['numt']) && $_POST['selectt'] != '' && $_POST['numt'] != '') {
$error = "<center><h3>Тема перемещена.</h3><a href='forum.php?topic=" . $_POST['numt'] . "&konftop=" . $_POST['selectt'] . "'>forum.php?topic=" . $_POST['numt'] . "&konftop=" . $_POST['selectt'] . "</a></center>";
}
}
$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 "<img src=i/ico/news.gif width=\"16\" height=\"16\" /> Страницы : ";
}
$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 ? " <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) . "'> &laquo; </a> ... " : "") . $pages_str . (($page < ($pgs - 1) ? "<a href='?topic=" . (int)$row['id'] . "&page=" . ($page + 1) . "' > &raquo; </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;
if ($dostupSovet == true) {
$edit = "<a href=\"javascript:void(0);\" class='contact' id=\"{$row[id]}\"><img src=\"i/forum/edit.png\" /></a>";
}
echo "<div class=\"rc6 mBodyBlock\" id=\"leaf{$row['id']}\">
<span class=\"topicTitle\">
<img height=15 src=\"i/forum/icon{$icons}.gif\" width=15 border=0 /><a href='?'>{$row['topic']}</a>
</span>";
echo "<div class=\"auth_str\">" . $row['author'] . "
<div class=\"date_abs\">(" . $row['date'] . ")</div> <a href='#' class='cite' onclick=\"add_cites({$row['id']});\" title=\"Цитата\">
<img src=\"i/forum/icon13.gif\" />
</a>
$edit
";
if ($dostupPal == true && $news_topic == false) {
echo " <a href='?topic=" . $_GET['topic'] . "&konftop=" . htmlspecialchars($_GET['conf']) . "&page=" . $_GET['page'] . "&dp=" . $row['id'] . "'><img src='i/clear.gif'></a>";
echo " <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=\"http://capitalcity.old-dark.rui/forum/icon4.gif\" title=\"Комментарий\" /></a>";
}
echo "<br /><br /></div>";
echo " <span>" . $row['text'] . "</span></div></div>";
$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 "<div class=\"rc6 mBodyBlock\" id=\"leaf{$row['id']}\"><div ><div class=\"mesTopBar\">
<table width=\"100%\" >
<tr>
<td>
" . $row['author'] . " <font class=\"date\">(" . $row['date'] . ")</font>
";
if ($dostupSovet == true) {
$edit = "<a href=\"javascript:void(0);\" class='contact' id=\"{$row[id]}\"><img src=\"i/forum/edit.png\" /></a>";
}
if ($dostupPal == true && $news_topic == false) {
echo " <a href='?topic={$_GET['topic']}&konftop=" . htmlspecialchars($_GET['conf']) . "&page=" . $_GET['page'] . "&dp={$row['id']}'><img src='i/clear.gif'></a>";
echo " <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=\"http://capitalcity.old-dark.rui/forum/icon4.gif\" title=\"Комментарий\" /></a>";
}
echo " </td>
<td align='right'>
<a href='javascript:void(0);' class='quote_btn' onclick='return add_cites(\"{$row[id]}\");' alt=\"Цитата\" title=\"Цитата\">
<img src=\"i/forum/icon13.gif\" />
</a>
$edit
</td>
</tr>
</table></div>
";
echo " <span>" . ($row['text']) . "</span>
</div>
</div>
";
}
if ($pgs > 1) {
echo "<img src=i/ico/news.gif width=\"16\" height=\"16\" /> Страницы : ";
}
echo $pages_str;
$closed = '';
$closepal = '';
if (($closed == 1 && $_GET['topic'] != 228043095)) {
echo "<br /><div align=center>" . $closepal . "</div><br /><br />";
} else {
if ($user['align'] == 4 && $_GET['conf'] != 23) {
$error = "<br /><br /><center><b>Персонажам со склонностью хаос запрещено писать на этом форуме!</b></center><br /><br />";
} elseif ($user['baned'] == 1) {
$error = "<br /><br /><center><b>Заблокированным персонажам запрещено писать на форуме!</b></center><br /><br />";
} elseif ($user['level'] < 2) {
$error = "<br /><br /><center><b>Персонажам до 2-го уровня запрещено писать на форуме!</b></center><br /><br />";
} elseif (isset($sleep['id'])) {
$error = "<br /><br /><center><b>Персонажам с заклинанием форумного молчания запрещено писать на форуме!</b></center><br /><br />";
} elseif ($user['level'] > 1 && !isset($sleep['id'])) {
?>
<a name="add_comment_place"></a>
<form method=POST
action="forum.php?topic=<?= $_GET['topic'] ?>&konftop=<?= $_GET['conf'] ?>&page=<?= $_GET['page'] ?>"
name="F1">
<table width="100%">
<tr>
<td align="center"><br/>
<table bgcolor="F6E5B1" cellspacing="0" cellpadding="5"
style="border: 1px outset;">
<tr>
<td colspan="2">
<h4 id="response">Оставить комментарий</h4>
</td>
</tr>
<tr>
<td colspan="2">
<table width="100%">
<tr>
<td align="center">
<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>
</table>
</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>
</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 /><br />";
}
}
} else {
echo "Тема удалена с форума, либо её не существует<br />";
}
}
} else {
if (is_numeric($_GET['conf']) && $row = mysql_fetch_array(mysql_query("SELECT * FROM `forum` WHERE `id` = '" . mysql_real_escape_string($_GET['conf']) . "'"))) {
if (($row['min_align'] == 0 && $row['max_align'] == 0) || ($user['align'] >= $row['min_align'] && $user['align'] <= $row['max_align']) || $dostupSovet) {
?>
<td rowspan="2" style="padding-left: 10">
<br/>
<? $confname = 'Конференция "' . $row['topic'] . '"'; ?>
<h3 style="display:inline;text-align:center;padding-left:50px;"><?= $confname ?></h3><br/>
<? if ($error != '') {
echo '<center>' . $error . '</center>';
} ?>
<?
if ($row['parent'] == 0) {
echo $row['text'];
}
echo '<br />';
$pgs = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($_GET['conf']) . "' ORDER BY `fix` DESC, `updated` DESC;"));
$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);
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) . "'> &laquo; </a> ... " : "") . $pages_str . (($page < ($pgs - 1) ? "<a href='?conf=" . $_GET['conf'] . "&page=" . ($page + 1) . "' > &raquo;</a>" : ""));
}
$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;
?>
<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>
<?php
$data = mysql_query("SELECT * FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($_GET['conf']) . "' ORDER BY `fix` DESC, `updated` DESC LIMIT " . (INT)($_GET['page'] * 20) . ",20;");
while ($row = mysql_fetch_array($data)) {
$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;");
while ($row2 = mysql_fetch_array($data2)) {
$userlist = strip_tags($row2[0], "");
list ($username, $level) = split(" \[", $userlist);
$logi .= $username;
}
$datacount = mysql_fetch_array(mysql_query("SELECT count(*) AS CountNumber FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($row['id']) . "';"));
$count = $datacount["CountNumber"];
$lasttimedb = mysql_fetch_array(mysql_query("SELECT `date` FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($row['id']) . "' ORDER BY `id` DESC LIMIT 1;"));
$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'];
}
$pgs1 = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `forum` WHERE `parent` = '" . mysql_real_escape_string($row['id']) . "';"));
$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>&nbsp;{$row['author']}</nobr>";
if ($dostupPal == true && $row['id'] != 228043095) {
echo " <a href='?conf={$_GET['conf']}&dt={$row['id']}'><img src='i/clear.gif'></a>";
}
echo "<br /><span class=date>" . $row['date'] . "</span><font class=dsc> " . strip_tags(substr($row['text'], 0, 250), "") . "</font>
<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 ($user['align'] == 4 && $_GET['conf'] != 23) {
$error = "<br /><br /><center><b>Персонажам со склонностью хаос запрещено писать на этом форуме!</b></center><br /><br />";
} elseif ($user['baned'] == 1) {
$error = "<br /><br /><center><b>Заблокированным персонажам запрещено писать на форуме!</b></center><br /><br />";
} elseif ($user['level'] < 2) {
$error = "<br /><br /><center><b>Персонажам до 4-го уровня запрещено писать на форуме!</b></center><br /><br />";
} elseif (isset($sleep['id'])) {
$error = "<br /><br /><center><b>Персонажам с заклинанием форумного молчания запрещено писать на форуме!</b></center><br /><br />";
} elseif ($user['level'] > 1 && !isset($sleep['id'])) {
?>
<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>
<textarea rows="8" class="inup" id="message" name="text" cols="85"
wrap="virtual"
onselect="storeCaret(this);"
onclick="storeCaret(this);"
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 "<br /><br />";
}
}
} else echo ' <div style="width: 300px; margin: auto; font-weight: bold;">Ничего не найдено!</div> ';
}
?>
<!-- End of text -->
<td style='padding-left: 3' align="right"><img src="i/register/forumru_03.jpg" width="139" height="144"
border="0"></td>
<td valign="top" background="i/register/nnn21_03_1.jpg">&nbsp;&nbsp;&nbsp;&nbsp;</td>
</tr>
<tr valign="top">
<td></td>
<td align="right" valign="center" style="padding-bottom:50"><img src="i/register/fr_15.jpg" width="128"
height="236" border="0"></td>
<td width="23" valign="top" background="i/register/nnn21_03_1.jpg">&nbsp;</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan=3 width="100%" height=13 background="i/register/sitebk_07.jpg"></td>
</tr>
<tr valign=top>
<td width="20%">
<div align="center"></div>
</td>
<td align=center valign=middle>
<div align="center">
<span class="style6" style="padding-bottom: 15px; font-size: 12px;">(c) Ещё один клон БК... </span><br/>
</div>
</td>
<td width="20%"></td>
</tr>
</table>
<?php if ($dostupPal == true) { ?>
<form name='repltopic' method='post' action="">
<input type='hidden' id='selectt' name='selectt'/>
<input type='hidden' id='numt' name='numt'/>
</form>
<? } ?>
</body>
</html>