Файл: forum.php
Строк: 1473
<?php
//error_reporting(2047|2048);
error_reporting(0);
include 'config.php';
class_exists('config') or die('Error load config class');
$config = new config(1, 1, 1);
$lang = $config->parse_lang() or die('Error parse lang file');
if(isset($_GET['id'])) $id = intval($_GET['id']);
elseif(isset($_POST['id'])) $id = intval($_POST['id']);
else $id = false;
if(isset($_GET['ps'])) $ps = trim($_GET['ps']);
elseif(isset($_POST['ps'])) $ps = trim($_POST['ps']);
else $ps = false;
if(!$id || !$ps){
$config->start('error', $lang['1014'], 'center');
echo '<u>'.$lang['1025'].'</u><br/>'.
'<a href="index.php?l='.$config->lang.'&v='.$config->vers.'">'.$lang['1003'].'</a>';
$config->finish(true);
}
if(!$mysql = mysql_connect($config->mysql['host'], $config->mysql['user'], $config->mysql['pass'])){
$config->start('error', $lang['1014']);
if($config->vers == 'wml'){
print '<b>'.$lang['1014'].'! '.$lang['1010'].'</b><br/>';
}
else
if($config->vers == 'html'){
print '<font color="'.$config->color['error'].'">'.$lang['1014'].'! '.$lang['1010'].'</font><br/>';
}
print $lang['1015'].' MySQL: <u>'.mysql_error().'</u><br/>';
print '<a href="index.php?l='.$config->lang.'&v='.$config->vers.'">'.$lang['1003'].'</a>';
$config->finish(true);
}
if(!mysql_select_db($config->mysql['db'], $mysql)){
$config->start('error', $lang['1014']);
if($config->vers == 'wml'){
print '<b>'.$lang['1014'].'! '.$lang['1011'].'</b><br/>';
}
else
if($config->vers == 'html'){
print '<font color="'.$config->color['error'].'">'.$lang['1014'].'! '.$lang['1011'].'</font><br/>';
}
print $lang['1015'].' MySQL: <u>'.mysql_error().'</u><br/>';
print '<a href="index.php?l='.$config->lang.'&v='.$config->vers.'">'.$lang['1003'].'</a>';
mysql_close($mysql); $config->finish(true);
}
$q = mysql_query("SELECT `pass`, `status` FROM `users` WHERE `id` = '$id';", $mysql);
$q = mysql_fetch_array($q);
if(!$q || $q['pass'] != $ps){
$config->start('error', $lang['1014'], 'center');
echo '<u>'.$lang['1025'].'</u><br/>'.
'<a href="index.php?l='.$config->lang.'&v='.$config->vers.'">'.$lang['1003'].'</a>';
mysql_close($mysql); $config->finish(true);
}
$status = $q['status'];
if(isset($_GET['r'])) $r = $_GET['r'];
elseif(isset($_POST['r'])) $r = $_POST['r'];
else $r = false;
/******************************************************************************/
if($config->conf['online']['forum'] == 'on'){
mysql_query("UPDATE `users` SET `online_f` = '".time()."' WHERE `id` = '$id';", $mysql); }
/******************************************************************************/
if(($r == 'add') && ($status == 7 || strpos($config->conf['admin'], '|'.$id.'|') !== false)){
$config->start('add', $lang['1172']);
if(!isset($_POST['razdel'])){
if($config->vers == 'wml')
echo '<small>'.$lang['1175'].':</small><br/>'.
'<input type="text" name="razdel" value="" maxlength="50"/><br/>'.
'<small>'.$lang['1176'].':</small> '.
'<input type="text" name="position" value="" maxlength="2" format="*N" size="2"/><br/>'.
'<small><anchor>'.$lang['1105'].'<go href="forum.php" method="post">'.
'<postfield name="l" value="'.$config->lang.'"/>'.
'<postfield name="v" value="wml"/>'.
'<postfield name="id" value="'.$id.'"/>'.
'<postfield name="ps" value="'.$ps.'"/>'.
'<postfield name="r" value="add"/>'.
'<postfield name="razdel" value="$(razdel)"/>'.
'<postfield name="position" value="$(position)"/>'.
'</go></anchor><br/>'.
'<a href="forum.php?l='.$config->lang.'&v=wml&id='.$id.'&ps='.$ps.'">'.$lang['1027'].'</a>'.
'</small>';
else
if($config->vers == 'html')
echo '<form action="forum.php" method="post">'.
'<input type="hidden" name="l" value="'.$config->lang.'"/>'.
'<input type="hidden" name="v" value="html"/>'.
'<input type="hidden" name="id" value="'.$id.'"/>'.
'<input type="hidden" name="ps" value="'.$ps.'"/>'.
'<input type="hidden" name="r" value="add"/>'.
$lang['1175'].':<br/>'.
'<input type="text" name="razdel" value="" maxlength="50"/><br/>'.
$lang['1176'].': '.
'<input type="text" name="position" value="" maxlength="2" size="2"/><br/>'.
'<input type="submit" value="'.$lang['1105'].'"/><br/>'.
'<a href="forum.php?l='.$config->lang.'&v=html&id='.$id.'&ps='.$ps.'">'.$lang['1027'].'</a>'.
'</form>';
}
else{
$position = intval($_POST['position']);
$razdel = stripslashes($_POST['razdel']);
$razdel = str_replace("n", " ", $razdel);
$razdel = iconv('utf-8', 'windows-1251', $razdel);
$razdel = addslashes($razdel);
$razdel = trim($razdel);
if($position < 0 || $position > 99) $position = 0;
if(strlen($razdel) < 3 || strlen($razdel) > 50) $error = $lang['1177'];
else
mysql_query("INSERT INTO `forum_razdel` VALUES('0', '$razdel', '$position');", $mysql) or $error = $lang['1178'];
if($config->vers == 'wml') print '<small>';
if($error)
echo '<u>'.$error.'</u><br/><br/>'.
'<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r=add">'.$lang['1029'].'</a><br/><br/>';
else
echo '<u>'.$lang['1179'].'</u><br/><br/>';
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1171'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
}
mysql_close($mysql); $config->finish(true);
}
/******************************************************************************/
if((isset($_GET['edit'])) && ($status == 7 || strpos($config->conf['admin'], '|'.$id.'|') !== false)){
$r = intval($_GET['edit']);
$q = mysql_query("SELECT `name`, `position` FROM `forum_razdel` WHERE `id` = '$r';", $mysql);
$q = mysql_fetch_array($q);
if($q){
$rnd = mt_rand();
$config->start('edit', htmlspecialchars($q['name']));
if($config->vers == 'wml')
echo '<small>'.$lang['1180'].'<br/>'.
'<a href="forum.php?l='.$config->lang.'&v=wml&id='.$id.'&ps='.$ps.'&del='.$r.'">'.$lang['1016'].'</a><br/><br/>'.
$lang['1175'].':</small><br/>'.
'<input type="text" name="razdel'.$rnd.'" value="'.htmlspecialchars($q['name']).'" maxlength="50"/><br/>'.
'<small>'.$lang['1176'].':</small> '.
'<input type="text" name="position'.$rnd.'" value="'.intval($q['position']).'" maxlength="2" format="*N" size="2"/><br/>'.
'<small><anchor>'.$lang['1061'].'<go href="forum.php" method="post">'.
'<postfield name="l" value="'.$config->lang.'"/>'.
'<postfield name="v" value="wml"/>'.
'<postfield name="id" value="'.$id.'"/>'.
'<postfield name="ps" value="'.$ps.'"/>'.
'<postfield name="edit" value="'.$r.'"/>'.
'<postfield name="razdel" value="$(razdel'.$rnd.')"/>'.
'<postfield name="position" value="$(position'.$rnd.')"/>'.
'</go></anchor><br/>'.
'<a href="forum.php?l='.$config->lang.'&v=wml&id='.$id.'&ps='.$ps.'">'.$lang['1027'].'</a>'.
'</small>';
else
if($config->vers == 'html')
echo $lang['1180'].'<br/>'.
'<a href="forum.php?l='.$config->lang.'&v=html&id='.$id.'&ps='.$ps.'&del='.$r.'">'.$lang['1016'].'</a><br/><br/>'.
'<form action="forum.php" method="post">'.
'<input type="hidden" name="l" value="'.$config->lang.'"/>'.
'<input type="hidden" name="v" value="html"/>'.
'<input type="hidden" name="id" value="'.$id.'"/>'.
'<input type="hidden" name="ps" value="'.$ps.'"/>'.
'<input type="hidden" name="edit" value="'.$r.'"/>'.
$lang['1175'].':<br/>'.
'<input type="text" name="razdel" value="'.htmlspecialchars($q['name']).'" maxlength="5"/><br/>'.
$lang['1176'].': '.
'<input type="text" name="position" value="'.intval($q['position']).'" maxlength="2" size="2"/><br/>'.
'<input type="submit" value="'.$lang['1061'].'"/><br/>'.
'<a href="forum.php?l='.$config->lang.'&v=html&id='.$id.'&ps='.$ps.'">'.$lang['1027'].'</a>'.
'</form>';
mysql_close($mysql); $config->finish(true);
}
}
/******************************************************************************/
if((isset($_POST['edit'])) && ($status == 7 || strpos($config->conf['admin'], '|'.$id.'|') !== false)){
$r = intval($_POST['edit']);
$q = mysql_query("SELECT `name`, `position` FROM `forum_razdel` WHERE `id` = '$r';", $mysql);
$q = mysql_fetch_array($q);
if($q){
$position = intval($_POST['position']);
$razdel = stripslashes($_POST['razdel']);
$razdel = str_replace("n", " ", $razdel);
$razdel = iconv('utf-8', 'windows-1251', $razdel);
$razdel = addslashes($razdel);
$razdel = trim($razdel);
if($position < 0 || $position > 99) $position = $q['position'];
if(strlen($razdel) < 3 || strlen($razdel) > 50) $error = $lang['1177'];
else
mysql_query("UPDATE `forum_razdel` SET `name` = '$razdel', `position` = '$position' WHERE `id` = '$r';", $mysql) or $error = $lang['1181'];
$config->start('edit', htmlspecialchars($q['name']));
if($config->vers == 'wml') print '<small>';
if($error)
echo '<u>'.$error.'</u><br/><br/>'.
'<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&edit='.$r.'">'.$lang['1029'].'</a><br/><br/>';
else
echo '<u>'.$lang['1182'].'</u><br/><br/>';
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1171'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
}
/******************************************************************************/
if((isset($_GET['del'])) && ($status == 7 || strpos($config->conf['admin'], '|'.$id.'|') !== false)){
$del = intval($_GET['del']);
mysql_query("DELETE FROM `forum_razdel` WHERE `id` = '$del';", $mysql) or die(mysql_error($mysql));
mysql_query("DELETE FROM `forum_theme` WHERE `razdel` = '$del';", $mysql) or die(mysql_error($mysql));
mysql_query("DELETE FROM `forum_mess` WHERE `razdel` = '$del';", $mysql) or die(mysql_error($mysql));
}
/******************************************************************************/
if(($_GET['ban'] == 'clear') && ($status == 7 || strpos($config->conf['admin'], '|'.$id.'|') !== false)){
mysql_query("DELETE FROM `forum_ban`;");
}
/******************************************************************************/
if(($_GET['ban'] == 'list') && ($status == 7 || strpos($config->conf['admin'], '|'.$id.'|') !== false)){
$config->start('list', $lang['1348']);
if($config->vers == 'wml') print '<small>';
if(isset($_GET['list']))
{
$list = intval($_GET['list']);
$q = mysql_query("SELECT * FROM `forum_ban` WHERE `id` = '$list';", $mysql);
$q = mysql_fetch_array($q);
if(!$q) echo '<u>'.$lang['1025'].'</u><br/><br/>';
else
{
echo $lang['1312'].': <u>'.$q['user'];
if($config->conf['nick'] == 'on')
{
$nick = mysql_query("SELECT `nick` FROM `users` WHERE `id` = '".$q['user']."';", $mysql);
$nick = mysql_fetch_array($nick) or $nick['nick'] = '';
if(strlen($nick['nick']) > 0)
{
$nick['nick'] = htmlspecialchars($nick['nick']);
$nick['nick'] = str_replace('$', '$$', $nick['nick']);
echo '; '.$nick['nick'];
}
}
echo '</u><br/>';
$q['ip'] = htmlspecialchars($q['ip']);
$q['ip'] = str_replace('$', '$$', $q['ip']);
echo 'IP: <u>'.$q['ip'].'</u><br/>';
$q['ua'] = htmlspecialchars($q['ua']);
$q['ua'] = str_replace('$', '$$', $q['ua']);
echo 'UA: <u>'.$q['ua'].'</u><br/><br/>';
if($q['what'] == 1) $q['what'] = $lang['1312'];
elseif($q['what'] == 2) $q['what'] = 'IP';
elseif($q['what'] == 3) $q['what'] = 'UA';
elseif($q['what'] == 4) $q['what'] = 'IP+UA';
else $q['what'] = 'Unknown';
echo $lang['1352'].': <u>'.$q['what'].'</u><br/>';
$q['time'] = date('d.m.Y H:i:s', $q['time']);
echo $lang['1350'].': <u>'.$q['time'].'</u><br/><br/>';
echo $lang['1351'].': <u>ID='.$q['who'];
if($config->conf['nick'] == 'on')
{
$nick = mysql_query("SELECT `nick` FROM `users` WHERE `id` = '".$q['who']."';", $mysql);
$nick = mysql_fetch_array($nick) or $nick['nick'] = '';
if(strlen($nick['nick']) > 0)
{
$nick['nick'] = htmlspecialchars($nick['nick']);
$nick['nick'] = str_replace('$', '$$', $nick['nick']);
echo '; '.$nick['nick'];
}
}
echo '</u><br/>';
if(strlen($q['comment']) > 0)
{
$q['comment'] = htmlspecialchars($q['comment']);
$q['comment'] = str_replace('$', '$$', $q['comment']);
echo $lang['1222'].': <u>'.$q['comment'].'</u><br/>';
}
echo '<br/>- <a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&ban=list&delban='.$q['id'].'&p='.intval($_GET['p']).'">'.$lang['1319'].'</a><br/><br/>';
}
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&ban=list&p='.intval($_GET['p']).'">'.$lang['1197'].'</a><br/>'.
'<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1201'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
if(isset($_GET['delban'])){
$del = intval($_GET['delban']);
mysql_query("DELETE FROM `forum_ban` WHERE `id` = '$del';");
}
$q = mysql_query("SELECT COUNT(`id`) AS `count` FROM `forum_ban`;", $mysql);
$q = mysql_fetch_array($q) or $q['count'] = 0;
$count = $q['count'];
if($count <= 0) echo '<u>'.$lang['1349'].'</u><br/><br/>';
else
{
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&ban=clear">'.$lang['1225'].'</a><br/><br/>';
$page = intval($_GET['p']);
if($page < 1) $page = 1;
$limit = $page*10-10;
if($limit >= $count){ $limit = 0; $page = 1; }
$pages = round($count/10);
if($pages*10 < $count) $pages++;
$c = $limit+1;
$q = mysql_query("SELECT `id`, `user` FROM `forum_ban` ORDER BY `id` DESC LIMIT $limit, 10;", $mysql);
while($d = mysql_fetch_array($q)){
echo '<b>'.$c.'.</b> <u><a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&ban=list&list='.$d['id'].'&p='.$page.'">';
if($config->conf['nick'] == 'on')
{
$nick = mysql_query("SELECT `nick` FROM `users` WHERE `id` = '".$d['user']."';", $mysql);
$nick = mysql_fetch_array($nick) or $nick['nick'] = '';
if(strlen($nick['nick']) > 0)
{
$nick['nick'] = htmlspecialchars($nick['nick']);
$nick['nick'] = str_replace('$', '$$', $nick['nick']);
echo $nick['nick'].'; ';
}
}
echo 'ID='.$d['user'].'</a></u> '.
'[<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&ban=list&delban='.$d['id'].'&p='.$page.'">x</a>]<br/>';
$c++;
}
echo '<br/>';
if($page > 1 || $page < $pages)
{
if($page > 1){
if($page-1 != 1)
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&ban=list&p=1"><<</a> ';
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&ban=list&p='.($page-1).'"><-</a> ';
}
if($page < $pages){
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&ban=list&p='.($page+1).'">-></a> ';
if($page+1 != $pages)
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&ban=list&p='.$pages.'">>></a> ';
}
echo '<br/><br/>';
}
}
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1201'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
/******************************************************************************/
if(isset($_GET['rules'])){
$config->start('rules', $lang['1024']);
if($config->vers == 'wml') print '<small>';
echo $lang['1174'].
'<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1171'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
/******************************************************************************/
if(intval($r) == true){
$r = intval($r);
$q = mysql_query("SELECT `name` FROM `forum_razdel` WHERE `id` = '$r';", $mysql);
$q = mysql_fetch_array($q);
if(!$q){
$config->start('error', $lang['1014']);
if($config->vers == 'wml') print '<small>';
echo '<u>'.$lang['1183'].'</u><br/><br/>'.
'<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1201'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
if(isset($_GET['t'])) $t = $_GET['t'];
elseif(isset($_POST['t'])) $t = $_POST['t'];
else $t = false;
################################################################################
if($t == 'add'){
$config->start('add', $lang['1185']);
if(!isset($_POST['theme'])){
$rnd = mt_rand();
if($config->vers == 'wml')
echo '<small>'.$lang['1186'].':</small><br/>'.
'<input type="text" name="theme'.$rnd.'" value="" maxlength="150"/><br/>'.
'<small>'.$lang['1187'].':</small><br/>'.
'<input type="text" name="mess'.$rnd.'" value="" maxlength="250"/><br/>'.
'<small><anchor>'.$lang['1105'].'<go href="forum.php" method="post">'.
'<postfield name="l" value="'.$config->lang.'"/>'.
'<postfield name="v" value="wml"/>'.
'<postfield name="id" value="'.$id.'"/>'.
'<postfield name="ps" value="'.$ps.'"/>'.
'<postfield name="r" value="'.$r.'"/>'.
'<postfield name="t" value="add"/>'.
'<postfield name="theme" value="$(theme'.$rnd.')"/>'.
'<postfield name="mess" value="$(mess'.$rnd.')"/>'.
'</go></anchor><br/>'.
'<a href="forum.php?l='.$config->lang.'&v=wml&id='.$id.'&ps='.$ps.'&r='.$r.'">'.$lang['1027'].'</a>'.
'</small>';
else
if($config->vers == 'html')
echo '<form action="forum.php" method="post">'.
'<input type="hidden" name="l" value="'.$config->lang.'"/>'.
'<input type="hidden" name="v" value="html"/>'.
'<input type="hidden" name="id" value="'.$id.'"/>'.
'<input type="hidden" name="ps" value="'.$ps.'"/>'.
'<input type="hidden" name="r" value="'.$r.'"/>'.
'<input type="hidden" name="t" value="add"/>'.
$lang['1186'].':<br/>'.
'<input type="text" name="theme" value="" maxlength="150"/><br/>'.
$lang['1187'].':<br/>'.
'<input type="text" name="mess" value="" maxlength="250"/><br/>'.
'<input type="submit" value="'.$lang['1105'].'"/><br/>'.
'<a href="forum.php?l='.$config->lang.'&v=html&id='.$id.'&ps='.$ps.'&r='.$r.'">'.$lang['1027'].'</a>'.
'</form>';
}
else{
$theme = stripslashes($_POST['theme']);
$theme = str_replace("n", " ", $theme);
$theme = iconv('utf-8', 'windows-1251', $theme);
$theme = addslashes($theme);
$theme = trim($theme);
$mess = stripslashes($_POST['mess']);
$mess = str_replace("n", " ", $mess);
$mess = iconv('utf-8', 'windows-1251', $mess);
$mess = addslashes($mess);
$mess = trim($mess);
if(strlen($theme) < 3 || strlen($theme) > 150) $error = $lang['1188'];
elseif(strlen($mess) < 1 || strlen($mess) > 250) $error = $lang['1189'];
else{
if(!isset($_SERVER['REMOTE_ADDR'])) $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
if(!isset($_SERVER['HTTP_USER_AGENT'])) $_SERVER['HTTP_USER_AGENT'] = 'Unknown';
$ip = addslashes($_SERVER['REMOTE_ADDR']);
$ua = addslashes($_SERVER['HTTP_USER_AGENT']);
if(strlen($ip) > 15) $ip = substr($ip, 0, 15);
if(strlen($ua) > 200) $ua = substr($ua, 0, 200);
$q = mysql_query("SELECT `comment` FROM `forum_ban` WHERE `user` = '$id' && `what` = '1' && `time` > '".time()."';", $mysql);
if(mysql_num_rows($q) == 0)
$q = mysql_query("SELECT `comment` FROM `forum_ban` WHERE `ip` = '$ip' && `what` = '2' && `time` > '".time()."';", $mysql);
if(mysql_num_rows($q) == 0)
$q = mysql_query("SELECT `comment` FROM `forum_ban` WHERE `ua` = '$ua' && `what` = '3' && `time` > '".time()."';", $mysql);
if(mysql_num_rows($q) == 0)
$q = mysql_query("SELECT `comment` FROM `forum_ban` WHERE `ip` = '$ip' && `ua` = '$ua' && `what` = '4' && `time` > '".time()."';", $mysql);
if(mysql_num_rows($q) > 0){
$q = mysql_fetch_array($q);
$comment = htmlspecialchars($q['comment']);
$comment = str_replace('$', '$$', $comment);
$error = $lang['1190'];
if($comment) $error .= '<br/><b>'.$lang['1191'].':</b> '.$comment;
}
else{
$q = mysql_query("SELECT `time` FROM `forum_mess` WHERE `user` = '$id' ORDER BY `time` DESC LIMIT 0, 1;", $mysql);
$q = mysql_fetch_array($q) or $q['time'] = 0;
if(time()-$q['time'] <= 10) $error = $lang['1192'];
else{
mysql_query("INSERT INTO `forum_theme` VALUES('0', '$theme', '$r', '$id', '".time()."', '1', '1');", $mysql) or $error = $lang['1193'];
$theme_id = mysql_insert_id($mysql);
mysql_query("INSERT INTO `forum_mess` VALUES('0', '$mess', '$theme_id', '$r', '$id', '$ip', '$ua', '".time()."');", $mysql);
}
}
}
if($config->vers == 'wml') print '<small>';
if($error)
echo '<u>'.$error.'</u><br/><br/>'.
'<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t=add">'.$lang['1029'].'</a><br/><br/>';
else
echo '<u>'.$lang['1194'].'</u><br/><br/>';
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'">'.$lang['1195'].'</a><br/>'.
'<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1201'].'</a>';
if($config->vers == 'wml') print '</small>';
}
mysql_close($mysql); $config->finish(true);
}
################################################################################
if(intval($t) == true){
$t = intval($t);
$q = mysql_query("SELECT `theme`, `user`, `fixed`, `status` FROM `forum_theme` WHERE `razdel` = '$r' && `id` = '$t';", $mysql);
$q = mysql_fetch_array($q);
if(!$q){
$config->start('error', $lang['1014']);
if($config->vers == 'wml') print '<small>';
echo '<u>'.$lang['1184'].'</u><br/><br/>'.
'<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1201'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
$theme = $q['theme'];
$tuser = $q['user'];
$fixed = $q['fixed'];
$tstatus = $q['status'];
if(isset($_GET['m'])) $m = $_GET['m'];
elseif(isset($_POST['m'])) $m = $_POST['m'];
else $m = false;
################################################################################
if($m == 'add' && $tstatus == 1){
$config->start('add', $lang['1203']);
if(!isset($_POST['mess'])){
$rnd = mt_rand();
if($config->vers == 'wml'){
echo '<small>'.$lang['1187'].':</small><br/>'.
'<input type="text" name="mess'.$rnd.'" value="" maxlength="250"/><br/>';
if($status > 3 || $tuser == $id)
echo '<small>'.$lang['1205'].':</small> '.
'<select name="close'.$rnd.'" value="0">'.
'<option value="0">'.$lang['1064'].'</option>'.
'<option value="1">'.$lang['1063'].'</option>'.
'</select><br/>';
echo '<small><anchor>'.$lang['1105'].'<go href="forum.php" method="post">'.
'<postfield name="l" value="'.$config->lang.'"/>'.
'<postfield name="v" value="wml"/>'.
'<postfield name="id" value="'.$id.'"/>'.
'<postfield name="ps" value="'.$ps.'"/>'.
'<postfield name="r" value="'.$r.'"/>'.
'<postfield name="t" value="'.$t.'"/>'.
'<postfield name="m" value="add"/>'.
'<postfield name="mess" value="$(mess'.$rnd.')"/>';
if($status > 3 || $tuser == $id)
echo '<postfield name="close" value="$(close'.$rnd.')"/>';
echo '</go></anchor><br/>'.
'<a href="forum.php?l='.$config->lang.'&v=wml&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t.'">'.$lang['1027'].'</a>'.
'</small>';
}
else
if($config->vers == 'html'){
echo '<form action="forum.php" method="post">'.
'<input type="hidden" name="l" value="'.$config->lang.'"/>'.
'<input type="hidden" name="v" value="html"/>'.
'<input type="hidden" name="id" value="'.$id.'"/>'.
'<input type="hidden" name="ps" value="'.$ps.'"/>'.
'<input type="hidden" name="r" value="'.$r.'"/>'.
'<input type="hidden" name="t" value="'.$t.'"/>'.
'<input type="hidden" name="m" value="add"/>'.
$lang['1187'].':<br/>'.
'<input type="text" name="mess" value="" maxlength="250"/><br/>';
if($status > 3 || $tuser == $id)
echo $lang['1205'].': '.
'<input type="checkbox" name="close" value="1"/><br/>';
echo '<input type="submit" value="'.$lang['1105'].'"/><br/>'.
'<a href="forum.php?l='.$config->lang.'&v=html&id='.$id.'&ps='.$ps.'&r='.$r.'">'.$lang['1027'].'</a>'.
'</form>';
}
}
else{
$mess = stripslashes($_POST['mess']);
$mess = str_replace("n", " ", $mess);
$mess = iconv('utf-8', 'windows-1251', $mess);
$mess = addslashes($mess);
$mess = trim($mess);
if(strlen($mess) < 1 || strlen($mess) > 250) $error = $lang['1189'];
else{
if(!isset($_SERVER['REMOTE_ADDR'])) $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
if(!isset($_SERVER['HTTP_USER_AGENT'])) $_SERVER['HTTP_USER_AGENT'] = 'Unknown';
$ip = addslashes($_SERVER['REMOTE_ADDR']);
$ua = addslashes($_SERVER['HTTP_USER_AGENT']);
if(strlen($ip) > 15) $ip = substr($ip, 0, 15);
if(strlen($ua) > 200) $ua = substr($ua, 0, 200);
$q = mysql_query("SELECT `comment` FROM `forum_ban` WHERE `user` = '$id' && `what` = '1' && `time` > '".time()."';", $mysql);
if(mysql_num_rows($q) == 0)
$q = mysql_query("SELECT `comment` FROM `forum_ban` WHERE `ip` = '$ip' && `what` = '2' && `time` > '".time()."';", $mysql);
if(mysql_num_rows($q) == 0)
$q = mysql_query("SELECT `comment` FROM `forum_ban` WHERE `ua` = '$ua' && `what` = '3' && `time` > '".time()."';", $mysql);
if(mysql_num_rows($q) == 0)
$q = mysql_query("SELECT `comment` FROM `forum_ban` WHERE `ip` = '$ip' && `ua` = '$ua' && `what` = '4' && `time` > '".time()."';", $mysql);
if(mysql_num_rows($q) > 0){
$q = mysql_fetch_array($q);
$comment = htmlspecialchars($q['comment']);
$comment = str_replace('$', '$$', $comment);
$error = $lang['1190'];
if($comment) $error .= '<br/><b>'.$lang['1191'].':</b> '.$comment;
}
else{
$q = mysql_query("SELECT `time` FROM `forum_mess` WHERE `user` = '$id' ORDER BY `time` DESC LIMIT 0, 1;", $mysql);
$q = mysql_fetch_array($q) or $q['time'] = 0;
if(time()-$q['time'] <= 10) $error = $lang['1192'];
else{
mysql_query("INSERT INTO `forum_mess` VALUES('0', '$mess', '$t', '$r', '$id', '$ip', '$ua', '".time()."');", $mysql) or $error = $lang['1206'];
mysql_query("UPDATE `forum_theme` SET `time` = '".time()."' WHERE `id` = '$t';", $mysql);
if(intval($_POST['close']) == 1)
if($tuser == $id || $status == 4 || $status == 6 || $status == 7 || strpos($config->conf['admin'], '|'.$id.'|') !== false)
mysql_query("UPDATE `forum_theme` SET `status` = '2' WHERE `id` = '$t';", $mysql);
}
}
}
if($config->vers == 'wml') print '<small>';
if($error)
echo '<u>'.$error.'</u><br/><br/>'.
'<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t.'&m=add">'.$lang['1029'].'</a><br/><br/>';
else
echo '<u>'.$lang['1207'].'</u><br/><br/>';
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t.'">'.$lang['1208'].'</a><br/>'.
'<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'">'.$lang['1195'].'</a>';
if($config->vers == 'wml') print '</small>';
}
mysql_close($mysql); $config->finish(true);
}
################################################################################
if((intval($m) == true) && ($status == 4 || $status == 6 || $status == 7 || strpos($config->conf['admin'], '|'.$id.'|') !== false)){
$m = intval($m);
$q = mysql_query("SELECT `mess`, `user`, `ip`, `ua`, `time` FROM `forum_mess` WHERE `theme` = '$t' && `razdel` = '$r' && `id` = '$m';", $mysql);
$q = mysql_fetch_array($q);
if(!$q){
$config->start('error', $lang['1014']);
if($config->vers == 'wml') print '<small>';
echo '<u>'.$lang['1213'].'</u><br/><br/>'.
'<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1201'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
################################################################################
if(isset($_GET['d'])){
$config->start('del', $lang['1214'], 'left', 'forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t, '1');
if($config->vers == 'wml') print '<small>';
if(!mysql_query("DELETE FROM `forum_mess` WHERE `id` = '$m';", $mysql)) echo '<u>'.$lang['1215'].'</u><br/><br/>';
else echo '<u>'.$lang['1216'].'</u><br/><br/>';
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t.'">'.$lang['1208'].'</a><br/>'.
'<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'">'.$lang['1195'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
################################################################################
if(isset($_POST['ban'])){
$config->start('ban', $lang['1217'], 'left', 'forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t, '1');
if($config->vers == 'wml') print '<small>';
$ban = intval($_POST['ban']);
if($ban < 1 || $ban > 4) $ban = 1;
$period = intval($_POST['period']);
if($period < 1 || $period > 7) $period = 1;
$comment = stripslashes($_POST['comment']);
$comment = str_replace("n", " ", $comment);
$comment = iconv('utf-8', 'windows-1251', $comment);
$comment = substr($comment, 0, 250);
$comment = addslashes($comment);
$comment = trim($comment);
if($period == 1) $period = time()+3600; //на 1 час
elseif($period == 2) $period = time()+86400; //на 1 день
elseif($period == 3) $period = time()+604800; //на 1 неделю
elseif($period == 4) $period = time()+2592000; //на 1 месяц
elseif($period == 5) $period = time()+7776000; //на 3 месяц
elseif($period == 6) $period = time()+15552000; //на 6 месяц
elseif($period == 7) $period = time()+31104000; //на 1 год
if(mysql_query("INSERT INTO `forum_ban` VALUES('0', '".$q['ip']."', '".$q['ua']."', '".$q['user']."', '".$id."', '".$ban."', '".$period."', '".$comment."');", $mysql))
echo '<u>'.$lang['1224'].'</u><br/><br/>';
else
echo '<u>'.$lang['1223'].'</u><br/><br/>';
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t.'">'.$lang['1208'].'</a><br/>'.
'<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'">'.$lang['1195'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
################################################################################
$config->start('mess', '');
if($config->vers == 'wml') print '<small>';
$q['mess'] = htmlspecialchars($q['mess']);
$q['mess'] = str_replace('$', '$$', $q['mess']);
$q['ip'] = htmlspecialchars($q['ip']);
$q['ip'] = str_replace('$', '$$', $q['ip']);
$q['ua'] = htmlspecialchars($q['ua']);
$q['ua'] = str_replace('$', '$$', $q['ua']);
if($config->conf['nick'] == 'on')
{
$nick = mysql_query("SELECT `nick` FROM `users` WHERE `id` = '".$q['user']."';", $mysql);
$nick = mysql_fetch_array($nick) or $nick['nick'] = '';
if(strlen($nick['nick']) > 0)
{
$nick['nick'] = htmlspecialchars($nick['nick']);
$nick['nick'] = str_replace('$', '$$', $nick['nick']);
echo $nick['nick'].'; ';
}
}
echo 'id='.$q['user'].' ['.date('d.m.y H:i:s', $q['time']).']<br/>'.
'<u>'.$q['mess'].'</u><br/>'.
'<b>IP:</b> '.$q['ip'].'<br/>'.
'<b>UA:</b> '.$q['ua'].'<br/>'.
'- <a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t.'&m='.$m.'&d=yes">'.$lang['1214'].'</a><br/>'.
'- <a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t.'&d=yes">'.$lang['1226'].'</a><br/><br/>';
if($config->vers == 'wml')
echo $lang['1217'].':</small><br/>'.
'<select name="ban" value="1">'.
'<option value="1">ID</option>'.
'<option value="2">IP</option>'.
'<option value="3">UA</option>'.
'<option value="4">IP+UA</option>'.
'</select> '.
'<select name="period" value="1">'.
'<option value="1">'.$lang['1218'].'</option>'.
'<option value="2">'.$lang['1219'].'</option>'.
'<option value="3">'.$lang['1220'].'</option>'.
'<option value="4">'.$lang['1221'].'</option>'.
'<option value="5">'.$lang['1342'].'</option>'.
'<option value="6">'.$lang['1343'].'</option>'.
'<option value="7">'.$lang['1344'].'</option>'.
'</select><br/>'.
'<small>'.$lang['1222'].':</small><br/>'.
'<input type="text" name="comment" value="" maxlength="250"/><br/>'.
'<small><anchor>'.$lang['1217'].'<go href="forum.php" method="post">'.
'<postfield name="l" value="'.$config->lang.'"/>'.
'<postfield name="v" value="wml"/>'.
'<postfield name="id" value="'.$id.'"/>'.
'<postfield name="ps" value="'.$ps.'"/>'.
'<postfield name="r" value="'.$r.'"/>'.
'<postfield name="t" value="'.$t.'"/>'.
'<postfield name="m" value="'.$m.'"/>'.
'<postfield name="ban" value="$(ban)"/>'.
'<postfield name="period" value="$(period)"/>'.
'<postfield name="comment" value="$(comment)"/>'.
'</go></anchor><br/>'.
'<a href="forum.php?l='.$config->lang.'&v=wml&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t.'">'.$lang['1027'].'</a>'.
'</small>';
else
if($config->vers == 'html')
echo '<form action="forum.php" method="post">'.
'<input type="hidden" name="l" value="'.$config->lang.'"/>'.
'<input type="hidden" name="v" value="html"/>'.
'<input type="hidden" name="id" value="'.$id.'"/>'.
'<input type="hidden" name="ps" value="'.$ps.'"/>'.
'<input type="hidden" name="r" value="'.$r.'"/>'.
'<input type="hidden" name="t" value="'.$t.'"/>'.
'<input type="hidden" name="m" value="'.$m.'"/>'.
$lang['1217'].':<br/>'.
'<select name="ban" value="1">'.
'<option value="1">ID</option>'.
'<option value="2">IP</option>'.
'<option value="3">UA</option>'.
'<option value="4">IP+UA</option>'.
'</select> '.
'<select name="period" value="1">'.
'<option value="1">'.$lang['1218'].'</option>'.
'<option value="2">'.$lang['1219'].'</option>'.
'<option value="3">'.$lang['1220'].'</option>'.
'<option value="4">'.$lang['1221'].'</option>'.
'<option value="5">'.$lang['1342'].'</option>'.
'<option value="6">'.$lang['1343'].'</option>'.
'<option value="7">'.$lang['1344'].'</option>'.
'</select><br/>'.
$lang['1222'].':<br/>'.
'<input type="text" name="comment" value="" maxlength="250"/><br/>'.
'<input type="submit" value="'.$lang['1217'].'"/><br/>'.
'<a href="forum.php?l='.$config->lang.'&v=html&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t.'">'.$lang['1027'].'</a>';
'</form>';
mysql_close($mysql); $config->finish(true);
}
################################################################################
if(isset($_GET['close']) && $tstatus == 1){
if($tuser == $id || $status == 4 || $status == 6 || $status == 7 || strpos($config->conf['admin'], '|'.$id.'|') !== false)
if(mysql_query("UPDATE `forum_theme` SET `status` = '2' WHERE `id` = '$t';", $mysql)) $tstatus = 2;
}
elseif(isset($_GET['open']) && $tstatus == 2){
if($tuser == $id || $status == 4 || $status == 6 || $status == 7 || strpos($config->conf['admin'], '|'.$id.'|') !== false)
if(mysql_query("UPDATE `forum_theme` SET `status` = '1' WHERE `id` = '$t';", $mysql)) $tstatus = 1;
}
if((isset($_GET['fixed'])) && ($fixed == 1) && ($status == 7 || strpos($config->conf['admin'], '|'.$id.'|') !== false)){
if(mysql_query("UPDATE `forum_theme` SET `fixed` = '2' WHERE `id` = '$t';", $mysql)) $fixed = 2;
}
elseif((isset($_GET['unfixed'])) && ($fixed == 2) && ($status == 7 || strpos($config->conf['admin'], '|'.$id.'|') !== false)){
if(mysql_query("UPDATE `forum_theme` SET `fixed` = '1' WHERE `id` = '$t';", $mysql)) $fixed = 1;
}
################################################################################
if((isset($_GET['d'])) && ($status == 4 || $status == 6 || $status == 7 || strpos($config->conf['admin'], '|'.$id.'|') !== false)){
$config->start('del', $lang['1226'], 'left', 'forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r, '1');
if($config->vers == 'wml') print '<small>';
if(mysql_query("DELETE FROM `forum_theme` WHERE `id` = '$t';", $mysql)){
mysql_query("DELETE FROM `forum_mess` WHERE `theme` = '$t';", $mysql);
echo '<u>'.$lang['1228'].'</u><br/><br/>';
}
else
echo '<u>'.$lang['1227'].'</u><br/><br/>';
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'">'.$lang['1195'].'</a><br/>'.
'<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1201'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
################################################################################
$config->start('forum', htmlspecialchars($theme));
if($config->vers == 'wml') print '<small>';
if($tstatus == 2){
echo '<u># '.$lang['1202'].'</u><br/>';
if($tuser == $id || $status == 4 || $status == 6 || $status == 7 || strpos($config->conf['admin'], '|'.$id.'|') !== false) echo '- <a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t.'&open=yes">'.$lang['1210'].'</a><br/>';
}
else{
echo '+ <u><a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t.'&m=add">'.$lang['1203'].'</a></u><br/>';
if($tuser == $id || $status == 4 || $status == 6 || $status == 7 || strpos($config->conf['admin'], '|'.$id.'|') !== false) echo '- <a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t.'&close=yes">'.$lang['1209'].'</a><br/>';
}
if($status == 7 || strpos($config->conf['admin'], '|'.$id.'|') !== false){
if($fixed == 2)
echo '- <a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t.'&unfixed=yes">'.$lang['1212'].'</a><br/>';
else
echo '- <a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t.'&fixed=yes">'.$lang['1211'].'</a><br/>';
}
echo '<br/>';
$q = mysql_query("SELECT COUNT(`id`) FROM `forum_mess` WHERE `theme` = '$t' && `razdel` = '$r';", $mysql);
$q = mysql_fetch_array($q) or $q['0'] = 0;
$count = $q['0'];
if($count < 1) print '<u>'.$lang['1204'].'</u><br/><br/>';
else{
$page = intval($_GET['p']);
if($page < 1) $page = 1;
$limit = $page*10-10;
if($limit >= $count){ $limit = 0; $page = 1; }
$pages = round($count/10);
if($pages*10 < $count) $pages++;
if($page > 1){
echo '- <a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t.'&p='.($page-1).'">'.$lang['1197'].'</a><br/>';
if($page-1 != 1)
echo '- <a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t.'&p=1">'.$lang['1198'].'</a><br/>';
echo '<br/>';
}
$q = mysql_query("SELECT `id`, `mess`, `user`, `time` FROM `forum_mess` WHERE `theme` = '$t' && `razdel` = '$r' ORDER BY `time` LIMIT $limit, 10;", $mysql);
while($d = mysql_fetch_array($q)){
$d['mess'] = htmlspecialchars($d['mess']);
$d['mess'] = str_replace('$', '$$', $d['mess']);
if($config->vers == 'html') echo '<font color="'.$config->color['other'].'">»</font>'; else echo '»';
echo '<u>';
if($config->conf['nick'] == 'on')
{
$nick = mysql_query("SELECT `nick` FROM `users` WHERE `id` = '".$d['user']."';", $mysql);
$nick = mysql_fetch_array($nick) or $nick['nick'] = '';
if(strlen($nick['nick']) > 0)
{
$nick['nick'] = htmlspecialchars($nick['nick']);
$nick['nick'] = str_replace('$', '$$', $nick['nick']);
echo $nick['nick'].'; ';
}
}
echo 'id='.$d['user'].'</u> '.date('d.m H:i', $d['time']);
if($status == 4 || $status == 6 || $status == 7 || strpos($config->conf['admin'], '|'.$id.'|') !== false) echo ' <a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t.'&m='.$d['id'].'">*</a>';
echo '<br/>'.$d['mess'].'<br/><br/>';
}
if($page < $pages){
echo '- <a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t.'&p='.($page+1).'">'.$lang['1199'].'</a><br/>';
if($page+1 != $pages)
echo '- <a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t.'&p='.$pages.'">'.$lang['1200'].'</a><br/>';
echo '<br/>';
}
if($tstatus == 1)
echo '+ <u><a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$t.'&m=add">'.$lang['1203'].'</a></u><br/><br/>';
}
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'">'.$lang['1195'].'</a><br/>'.
'<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1201'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
################################################################################
$config->start('forum', htmlspecialchars($q['name']));
if($config->vers == 'wml') print '<small>';
echo '+ <u><a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t=add">'.$lang['1185'].'</a></u><br/><br/>';
$q = mysql_query("SELECT COUNT(`id`) FROM `forum_theme` WHERE `razdel` = '$r';", $mysql);
$q = mysql_fetch_array($q) or $q['0'] = 0;
$count = $q['0'];
if($count < 1) print '<u>'.$lang['1196'].'</u><br/><br/>';
else{
$page = intval($_GET['p']);
if($page < 1) $page = 1;
$limit = $page*10-10;
if($limit >= $count){ $limit = 0; $page = 1; }
$pages = round($count/10);
if($pages*10 < $count) $pages++;
if($page > 1){
echo '- <a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&p='.($page-1).'">'.$lang['1197'].'</a><br/>';
if($page-1 != 1)
echo '- <a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&p=1">'.$lang['1198'].'</a><br/>';
echo '<br/>';
}
$q = mysql_query("SELECT `id`, `theme`, `user`, `time`, `fixed`, `status` FROM `forum_theme` WHERE `razdel` = '$r' ORDER BY `fixed` DESC, `time` DESC LIMIT $limit, 10;", $mysql);
while($d = mysql_fetch_array($q)){
$mess = mysql_query("SELECT COUNT(`id`) FROM `forum_mess` WHERE `razdel` = '".$r."' && `theme` = '".$d['id']."';", $mysql);
$mess = mysql_fetch_array($mess) or $mess['0'] = 0;
$d['theme'] = htmlspecialchars($d['theme']);
$d['theme'] = str_replace('$', '$$', $d['theme']);
echo '-><a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t='.$d['id'].'">';
if($config->conf['nick'] == 'on')
{
$nick = mysql_query("SELECT `nick` FROM `users` WHERE `id` = '".$d['user']."';", $mysql);
$nick = mysql_fetch_array($nick) or $nick['nick'] = '';
if(strlen($nick['nick']) > 0)
{
$nick['nick'] = htmlspecialchars($nick['nick']);
$nick['nick'] = str_replace('$', '$$', $nick['nick']);
echo $nick['nick'].'; ';
}
}
echo 'id='.$d['user'].' '.date('d.m H:i', $d['time']).' ['.$mess['0'].']</a>';
if($d['status'] == 2) echo '#';
if($d['fixed'] == 2) echo '!';
echo '<br/>'.$d['theme'].'<br/><br/>';
}
if($page < $pages){
echo '- <a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&p='.($page+1).'">'.$lang['1199'].'</a><br/>';
if($page+1 != $pages)
echo '- <a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&p='.$pages.'">'.$lang['1200'].'</a><br/>';
echo '<br/>';
}
echo '+ <u><a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$r.'&t=add">'.$lang['1185'].'</a></u><br/><br/>';
}
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1201'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
/******************************************************************************/
if(isset($_GET['online']) && $config->conf['online']['forum'] == 'on'){
$config->start('online', $lang['1346']);
if($config->vers == 'wml') print '<small>';
$q = mysql_query("SELECT COUNT(*) as `count` FROM `users` WHERE `online_f` > '".(time()-600)."';", $mysql);
$q = mysql_fetch_array($q) or $q['count'] = 0;
$count = $q['count'];
if($count <= 0) echo '<u>'.$lang['1347'].'</u><br/><br/>';
else
{
$page = intval($_GET['p']);
if($page < 1) $page = 1;
$limit = $page*10-10;
if($limit >= $count){ $limit = 0; $page = 1; }
$pages = round($count/10);
if($pages*10 < $count) $pages++;
$c = $limit+1;
$q = mysql_query("SELECT `id`, `nick`, `online_f` FROM `users` WHERE `online_f` > '".(time()-600)."' ORDER BY `online_f` DESC LIMIT $limit, 10;", $mysql);
while($d = mysql_fetch_array($q)){
echo '<b>'.$c.'.</b> <u>';
if($config->conf['nick'] == 'on')
{
if(strlen($d['nick']) > 0)
{
$d['nick'] = htmlspecialchars($d['nick']);
$d['nick'] = str_replace('$', '$$', $d['nick']);
echo $d['nick'].'; ';
}
}
echo 'ID='.$d['id'].'</u> ['.date("H:i:s", $d['online_f']).']<br/>';
$c++;
}
echo '<br/>';
if($page > 1 || $page < $pages)
{
if($page > 1){
if($page-1 != 1)
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&online=1&p=1"><<</a> ';
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&online=1&p='.($page-1).'"><-</a> ';
}
if($page < $pages){
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&online=1&p='.($page+1).'">-></a> ';
if($page+1 != $pages)
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&online=1&p='.$pages.'">>></a> ';
}
echo '<br/><br/>';
}
}
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1201'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish(true);
}
/******************************************************************************/
$config->start('forum', $lang['1171']);
if($config->vers == 'wml') print '<small>';
if($status == 7 || strpos($config->conf['admin'], '|'.$id.'|') !== false){
$ban = mysql_query("SELECT COUNT(`id`) FROM `forum_ban`;", $mysql);
$ban = mysql_fetch_array($ban) or $ban['0'] = 0;
echo '+ <u><a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r=add">'.$lang['1172'].'</a></u><br/>';
if($ban['0'] > 0)
echo '- <a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&ban=list">'.$lang['1348'].' ['.$ban['0'].']</a><br/>';
echo '<br/>';
}
$q = mysql_query("SELECT `id`, `name` FROM `forum_razdel` ORDER BY `position`;", $mysql);
$n = mysql_num_rows($q);
if($n < 1) print '<u>'.$lang['1173'].'</u><br/><br/>';
else{
for($i=1; $i<=$n; $i++){
$d = mysql_fetch_array($q);
$d['name'] = htmlspecialchars($d['name']);
$d['name'] = str_replace('$', '$$', $d['name']);
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&r='.$d['id'].'">'.$d['name'].'</a>';
$theme = mysql_query("SELECT COUNT(`id`) FROM `forum_theme` WHERE `razdel` = '".$d['id']."';", $mysql);
$theme = mysql_fetch_array($theme) or $theme['0'] = 0;
$theme = $theme['0'];
$mess = mysql_query("SELECT COUNT(`id`) FROM `forum_mess` WHERE `razdel` = '".$d['id']."';", $mysql);
$mess = mysql_fetch_array($mess) or $mess['0'] = 0;
$mess = $mess['0'];
echo ' ['.$theme.'/'.$mess.']';
if($status == 7 || strpos($config->conf['admin'], '|'.$id.'|') !== false) echo ' [<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&edit='.$d['id'].'">+</a>]';
echo '<br/>';
}
echo '<br/>';
}
if($config->conf['online']['forum'] == 'on')
{
$q = mysql_query("SELECT COUNT(*) as `count` FROM `users` WHERE `online_f` > '".(time()-600)."';", $mysql);
$q = mysql_fetch_array($q) or $q['count'] = 0;
echo $lang['1345'].': ';
if($q['count'] <= 0) echo '0';
else echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&online=yes">'.$q['count'].'</a>';
echo '<br/><br/>';
}
echo '<a href="forum.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'&rules=yes">'.$lang['1024'].'</a><br/>'.
'<a href="panel.php?l='.$config->lang.'&v='.$config->vers.'&id='.$id.'&ps='.$ps.'">'.$lang['1009'].'</a>';
if($config->vers == 'wml') print '</small>';
mysql_close($mysql); $config->finish();
?>