File size: 11.06Kb
<?
if( in_array($status, array('admin', 'moderator')) )
{
$p = intval($_GET['t']);
$s = intval($_GET['s']);
$queryTheme = mysql_query("SELECT * FROM mthemes WHERE id=".$p);
$info = mysql_fetch_assoc($queryTheme);
if(mysql_num_rows($queryTheme) < 1)
{
if($version == "wml")
{
header('Content-type: text/vnd.wap.wml; charset=utf-8');
header("Cache-Control: no-cache");
echo(doctype("Ошибка").$tag.'Темы не существует! <br />
-
<a href="./?p=1&v=wml&sid='.$sid.'">Форумы</a>
'.$tagC.'
</p></card></wml>');
} elseif($version == "xhtml")
{
header("Content-type: text/html; charset=utf-8");
header("Last-Modified:".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-relative");
echo('<html>
<head>
<title>Ошибка</title>
</head>
<body bgcolor="'.$style['background'].'" link="'.$style['link'].'" vlink="'.$style['link'].'" text="#000000">
<table align="center" border="0" cellspacing="1" cellpadding="5" width="350">
<tr><td align="center" bgcolor="'.$style['title'].'">'.$tag.'
<font color="#FFFFFF"><b>Ошибка</b></font>
'.$tagC.'
</td></tr>
<tr><td bgcolor="'.$style['text'].'">'.$tag.'
<div class="text">Темы не существует!
'.$tagC.'
</td></tr>
<tr><td bgcolor="'.$style['bottom'].'">'.$tag.'
<div class="bottom"><a href="./?p=1&v=xhtml&sid='.$sid.'">Форумы</a>
'.$tagC.'
</td></tr></table>
</body></html>');
}
} elseif($info['del'] == 1 and $status != 'admin')
{
if($version == "wml")
{
header('Content-type: text/vnd.wap.wml; charset=utf-8');
header("Cache-Control: no-cache");
echo(doctype("Ошибка").$tag.'
Тема '.$info['tname'].' из '.mysql_num_rows($queryTheme).' сообщений была удалена модератором '.$info['mdel'].'!<br />
-
<a href="./?p=3&v=wml&sid='.$sid.'&f='.$info['id_forum'].'">Назад</a><br />
<a href="./?p=1&v=wml">Форумы</a>
'.$tagC.'
</p></card></wml>');
} elseif($version == "xhtml")
{
header("Content-type: text/html; charset=utf-8");
header("Last-Modified:".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-relative");
echo('<html>
<head>
<title>'.$info['tname'].'</title>
</head>
<body bgcolor="'.$style['background'].'" link="'.$style['link'].'" vlink="'.$style['link'].'" text="#000000">
<table align="center" border="0" cellspacing="1" cellpadding="5" width="350">
<tr><td align="center" bgcolor="'.$style['title'].'">
<font color="#FFFFFF"><b>'.$info['tname'].'</b></font>
</td></tr>
<tr><td bgcolor="'.$style['text'].'">'.$tag.'
Тема '.$info['tname'].' из '.mysql_num_rows($queryTheme).' сообщений была удалена модератором '.$info['mdel'].'!
'.$tagC.'
</td></tr>
<tr><td align="center" bgcolor="'.$style['bottom'].'">'.$tag.'
<a href="./?p=3&v=xhtml&sid='.$sid.'&f='.$info['id_forum'].'">Назад</a><br />
<a href="./?p=1&v=xhtml">Форумы</a>
'.$tagC.'
</td></tr></table>
</body></html>');
}
} else
{
if(($status == "admin" || is_author($p, $username)) and !empty($_GET['o']))
{
mysql_query("UPDATE `mthemes` SET `close`='off' WHERE `id`=".$p);
}
if($s == 0)
{
$s = "1";
}
$title=''.$s.'-'.$info['tname'].'';
$back = mysql_fetch_assoc(mysql_query("SELECT *
FROM `mforums`
WHERE `id`=".$info['id_forum']));
$count = mysql_result(
mysql_query("SELECT COUNT(*)
FROM mposts
WHERE id_theme=".$p), 0);
if(empty($_GET['ss']))
{
$start = intval($_GET['s']);
}
else
{
$start = intval($_GET['ss']) - 1;
}
if(!empty($start))
{
$limit = "LIMIT ".$start.", ".abs($count - $start);
$int = $start;
}
else
{
$int = 0;
}
if($version == "xhtml")
{
$validChar = '$';
}
else
{
$validChar = '$$';
}
$thisPageSize = 600;
if($authorize)
{
$lastTimeQ = mysql_query("SELECT * FROM `counter`
WHERE `username`='".$username."'
AND `fid`=".$back['id']);
$lastTimeR = mysql_fetch_assoc($lastTimeQ);
$lastTime = $lastTimeR['time'];
$lastMsgTime = mysql_result(
mysql_query("SELECT MAX(time)
FROM mposts
WHERE id_theme = ". $p), 0);
if($lastTime <= $lastMsgTime)
{
RefreshLastTime($username, $info['id_forum'], $lastMsgTime);
}
}
if($version == "wml")
{
header('Content-type: text/vnd.wap.wml; charset=utf-8');
header("Cache-Control: no-cache");
echo(doctype($title).$tag);
if($count > 5)
{
echo("<a accesskey=\"1\" href=\"./?p=5&v=wml&sid=".$sid."&t=".$p."&s=".($count - 5)."\">Вниз (1)</a><br />\r\n");
}
if($count > ceil($count / ($pageSize / 1000)))
{
echo("<a href=\"./?p=18&v=wml&sid=".$sid."&t=".$p."&c=".$count."\">Перейти к[1-".$count."]</a><br />\r\n");
}
if($private = mysql_result(
mysql_query("SELECT COUNT(*)
FROM `private`
WHERE `name`='".$username."'
AND `new`=1
AND `mod`='i'"), 0))
{
echo('<a href="./?p=24&v=wml&sid='.$sid.'">Приват</a> - <a href="./?p=24&v=wml&sid='.$sid.'&new=1">'.$private."</a><br />\r\n");
}
} elseif($version == "xhtml")
{
header("Content-type: text/html; charset=utf-8");
header("Last-Modified:".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-relative");
echo('<html>
<head>
<title>'.$title.'</title>
</head>
<body bgcolor="'.$style['background'].'" link="'.$style['link'].'" vlink="'.$style['link'].'" text="#000000">
<table align="center" border="0" cellspacing="1" cellpadding="5" width="350">
<tr><td align="center" bgcolor="'.$style['title'].'">
<font color="#FFFFFF"><b>'.cutString($title, 25).'</b></font>
</td></tr>
<tr><td bgcolor="'.$style['bottom'].'">'.$tag);
if($count > 5)
{
echo("<a href=\"./?p=5&v=xhtml&sid=".$sid."&t=".$p."&s=".($count - 5)."\">Вниз</a><br />\r\n");
}
if($count > ceil(($count / ($pageSize / 1000))))
{
echo("<a href=\"./?p=18&v=xhtml&sid=".$sid."&t=".$p."&c=".$count."\">Перейти к[1-".$count."]</a><br />\r\n");
}
if($private = mysql_result(
mysql_query("SELECT COUNT(*)
FROM `private`
WHERE `name`='".$username."'
AND `new`=1
AND `mod`='i'"), 0))
{
echo('<a href="./?p=24&mode=inbox&v=xhtml&sid='.$sid.'">Приват</a> - <a href="./?p=24&v=xhtml&sid='.$sid.'&mode=inbox&new=1">'.$private."</a><br />\r\n");
}
echo($tagC."</td></tr>
<tr><td bgcolor=\"".$style['text']."\">\r\n".$tag);
if($status == "admin")
{
echo("<form action=\"./?p=25&v=xhtml&sid=".$sid."&tid=".$p."&mode=checkboxm\" method=\"post\">\r\n");
}
}
$aposts = mysql_query("SELECT *
FROM `mposts`
WHERE id_theme=".$p."
ORDER BY `id`
".$limit);
while($posts = mysql_fetch_assoc($aposts))
{
static $s;
echo(date("d/m H:i", $posts['time'])."]");
$authoriz = mysql_query("SELECT * FROM `users` WHERE `username`='".$username."' AND `password`='".$password."'");
$Sauthoriz = mysql_fetch_array($authoriz);
if($Sauthoriz['private'] == "off")
{
echo("<b>".$posts['name']."</b>\r\n");
}
elseif($Sauthoriz['private'] == "private")
{
echo("<b><a href=\"./?p=24&d=1&uid=".UserName2id($posts['name'])."&v=".$version."&sid=".$sid."\">".$posts['name']."</a></b>\r\n");
}
elseif($Sauthoriz['private'] == "user")
{
echo("<b><a href=\"./?p=6&v=xhtml&id=".UserName2id($posts['name'])."&th=".$color."\">".$posts['name']."</a></b>\r\n");
}
if($status == "admin")
{
echo(' <a href="./?p=25&id='.$posts['id'].'&v='.$version.'&sid='.$sid.'&mode=mpostm&tid='.$posts['id_theme']."\">X</a><br />\r\n");
echo('['.strtok($posts['useragent'], '/').' <a href="./?p=25&v='.$version.'&mode=whois&sid='.$sid.'&ip='.$posts['ip'].'">'.$posts['ip']."</a>]\r\n");
}
if($status == "admin" && $version == "xhtml")
{
echo("<input type=\"checkbox\" name=\"id[]\" value=\"".$posts['id']."\" />\r\n");
}
echo('<br />'.nl2br(str_replace('$', $validChar, $posts['post']))."<br /><br /> \r\n");
$int++;
$s += strlen($posts['post'].$posts['name'].$posts['time']);
if($s + $thisPageSize + (250 * abs($int - $start)) > $pageSize)
{
if($int != $count)
{
$next = $int;
}
break;
}
}
if($version == "wml")
{
echo('');
if(!empty($next))
{
echo("<a accesskey=\"3\" href=\"./?p=5&v=wml&sid=".$sid."&s=".$next."&t=".$p."\">Дальше...(3)</a><br />\r\n");
}
if($info['close'] == "on")
{
echo('<b>Тема закрыта</b><br />');
if(is_author($p, $username) or $status == "admin")
{
echo('<a href="./?p=5&v=wml&sid='.$sid.'&o=1&t='.$p.'">[Открыть]</a><br />');
}
}
if($authorize && $info['close'] != "on" )
{
echo('<a href="./?p=8&v=wml&sid='.$sid.'&f='.$p.'">Ответить</a><br />');
}
if($info['del'] == 1)
{
echo('Тема была удалена модератором '.$info['mdel']."<br />\r\n");
}
echo('<a href="./?p=3&f='.$back['id'].'&sid='.$sid.'&v=wml">Назад в '.$back['name'].'</a>
'.$tagC.'
</p></card></wml>');
} elseif($version == "xhtml")
{
echo($tagC."</td></tr>
<tr><td bgcolor=\"".$style['bottom']."\">\r\n".$tag);
if(!empty($next))
{
echo("<a href=\"./?p=5&v=xhtml&sid=".$sid."&s=".$next."&t=".$p."\">Дальше...</a><br />\r\n");
}
if($info['close'] == "on")
{
echo('<b>Тема закрыта</b><br />');
if(is_author($p, $username) or $status == "admin")
{
echo('<a href="./?p=5&v=xhtml&sid='.$sid.'&o=1&t='.$p.'">[Открыть]</a><br />');
}
}
if($authorize && $info['close'] != "on" )
{
echo('<a href="./?p=8&v=xhtml&sid='.$sid.'&f='.$p."\">Ответить</a><br />\r\n");
}
if($info['del'] == 1)
{
echo('Тема была удалена модератором '.$info['mdel']."<br />\r\n");
}
echo('<a href="./?p=3&v=xhtml&sid='.$sid.'&f='.$back['id'].'">Назад в '.$back['name']."</a><br />\r\n");
if($status == "admin")
{
echo("<input type=\"submit\" value=\"Удалить отмечанные\" />\r\n");
}
echo($tagC."</td></tr></table>\r\n</body></html>");
}
}
}
?>