Размер файла: 12.37Kb
<?
$p = intval($_GET['t']);
$s = intval($_GET['s']);
$queryTheme = mysql_query("SELECT * FROM themes 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 />
-');
if($authorize)
{
echo('<a href="./?p=0&v=wml&sid='.$sid.'">Форумы</a>');
}
else
{
echo('<a href="./?p=0&v=wml">Форумы</a>');
}
echo(''.$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.'');
if($authorize)
{
echo('<div class="bottom"><a href="./?p=0&v=xhtml&sid='.$sid.'">Форумы</a>');
}
else
{
echo('<div class="bottom"><a href="./?p=0&v=xhtml">Форумы</a>');
}
echo(''.$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 />
-');
if($authorize)
{
echo('<a href="./?p=2&v=wml&sid='.$sid.'&f='.$info['id_forum'].'">Назад</a><br />
<a href="./?v=wml&sid='.$sid.'">Форумы</a>');
}
else
{
echo('<a href="./?p=2&v=wml&f='.$info['id_forum'].'">Назад</a><br />
<a href="./?p=0&v=wml">Форумы</a>');
}
echo(''.$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.'');
if($authorize)
{
echo('<a href="./?p=2&v=xhtml&sid='.$sid.'&f='.$info['id_forum'].'">Назад</a><br />
<a href="./?p=0&v=xhtml&sid='.$sid.'">Форумы</a>');
}
else
{
echo('<a href="./?p=2&v=xhtml&f='.$info['id_forum'].'">Назад</a><br />
<a href="./?p=0&v=xhtml">Форумы</a>');
}
echo(''.$tagC.'
</td></tr></table>
</body></html>');
}
} else
{
if(($status == "moderator" || $status == "admin" || is_author($p, $username)) and !empty($_GET['o']))
{
mysql_query("UPDATE `themes` SET `close`='off' WHERE `id`=".$p);
}
if($s == 0)
{
$s = "1";
}
$title=''.$s.'-'.$info['tname'].'';
$back = mysql_fetch_assoc(mysql_query("SELECT *
FROM `forums`
WHERE `id`=".$info['id_forum']));
$count = mysql_result(
mysql_query("SELECT COUNT(*)
FROM posts
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 posts
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)
{
if($authorize)
{
echo("<a accesskey=\"1\" href=\"./?p=4&v=wml&sid=".$sid."&t=".$p."&s=".($count - 5)."\">Вниз (1)</a><br />\r\n");
}
else
{
echo("<a accesskey=\"1\" href=\"./?p=4&v=wml&t=".$p."&s=".($count - 5)."\">Вниз (1)</a><br />\r\n");
}
}
if($count > ceil($count / ($pageSize / 1000)))
{
echo("<a href=\"./?p=17&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>'.$title.'</b></font>
</td></tr>
<tr><td bgcolor="'.$style['bottom'].'">'.$tag);
if($count > 5)
{
if($authorize)
{
echo("<a href=\"./?p=4&v=xhtml&sid=".$sid."&t=".$p."&s=".($count - 5)."\">Вниз</a><br />\r\n");
}
else
{
echo("<a href=\"./?p=4&v=xhtml&t=".$p."&s=".($count - 5)."\">Вниз</a><br />\r\n");
}
}
if($count > ceil(($count / ($pageSize / 1000))))
{
echo("<a href=\"./?p=17&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 == "moderator" || $status == "admin")
{
echo("<form action=\"./?p=25&v=xhtml&sid=".$sid."&tid=".$p."&mode=checkbox\" method=\"post\">\r\n");
}
}
$aposts = mysql_query("SELECT *
FROM `posts`
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" or !$authorize)
{
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 == "moderator" or $status == "admin")
{
echo(' <a href="./?p=25&id='.$posts['id'].'&v='.$version.'&sid='.$sid.'&mode=mpost&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 == "moderator" || $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'].$title);
if($s + $thisPageSize + (250 * abs($int - $start)) > $pageSize)
{
if($int != $count)
{
$next = $int;
}
break;
}
}
if($version == "wml")
{
if(!empty($next))
{
if($authorize)
{
echo("<a accesskey=\"3\" href=\"./?p=4&v=wml&sid=".$sid."&s=".$next."&t=".$p."\">Дальше...(3)</a><br />\r\n");
}
else
{
echo("<a accesskey=\"3\" href=\"./?p=4&v=wml&s=".$next."&t=".$p."\">Дальше...(3)</a><br />\r\n");
}
}
if($info['close'] == "on")
{
echo('<b>Тема закрыта</b><br />');
if(is_author($p, $username) or $status == "moderator" or $status == "admin")
{
echo('<a href="./?p=4&v=wml&sid='.$sid.'&o=1&t='.$p.'">[Открыть]</a><br />');
}
}
if($authorize && $info['close'] != "on" )
{
echo('<a href="./?p=7&v=wml&sid='.$sid.'&f='.$p.'">Ответить</a><br />');
}
if($info['del'] == 1)
{
echo('Тема была удалена модератором '.$info['mdel']."<br />\r\n");
}
if($authorize)
{
echo('<a href="./?p=2&f='.$back['id'].'&sid='.$sid.'&v=wml">Назад в «'.$back['name'].'»</a>');
}
else
{
echo('<a href="./?p=2&f='.$back['id'].'&v=wml">Назад в «'.$back['name'].'»</a>');
}
echo(''.$tagC.'
</p></card></wml>');
} elseif($version == "xhtml")
{
echo($tagC."</td></tr>
<tr><td bgcolor=\"".$style['bottom']."\">\r\n".$tag);
if(!empty($next))
{
if($authorize)
{
echo("<a href=\"./?p=4&v=xhtml&sid=".$sid."&s=".$next."&t=".$p."\">Дальше...</a><br />\r\n");
}
else
{
echo("<a href=\"./?p=4&v=xhtml&s=".$next."&t=".$p."\">Дальше...</a><br />\r\n");
}
}
if($info['close'] == "on")
{
echo('<b>Тема закрыта</b><br />');
if(is_author($p, $username) or $status == "moderator" or $status == "admin")
{
echo('<a href="./?p=4&v=xhtml&sid='.$sid.'&o=1&t='.$p.'">[Открыть]</a><br />');
}
}
if($authorize && $info['close'] != "on" )
{
echo('<a href="./?p=7&v=xhtml&sid='.$sid.'&f='.$p."\">Ответить</a><br />\r\n");
}
if($info['del'] == 1)
{
echo('Тема была удалена модератором '.$info['mdel']."<br />\r\n");
}
if($authorize)
{
echo('<a href="./?p=2&v=xhtml&sid='.$sid.'&f='.$back['id'].'">Назад в «'.$back['name']."»</a><br />\r\n");
}
else
{
echo('<a href="./?p=2&v=xhtml&f='.$back['id'].'">Назад в «'.$back['name']."»</a><br />\r\n");
}
if($status == "moderator" || $status == "admin")
{
echo("<input type=\"submit\" value=\"Удалить отмеченные\" />\r\n");
}
echo($tagC."</td></tr></table>\r\n</body></html>");
}
}
?>