Вход Регистрация
Файл: include/posts.php
Строк: 246
<?
$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&amp;v=wml&amp;sid='.$sid.'">Форумы</a>');
}
else
{
echo(
'<a href="./?p=0&amp;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&amp;v=xhtml&amp;sid='.$sid.'">Форумы</a>');
}
else
{
echo(
'<div class="bottom"><a href="./?p=0&amp;v=xhtml">Форумы</a>');
}
echo(
''.$tagC.'
</td></tr></table>
</body></html>'
);
        }
    } elseif(
$info['del'] == 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&amp;v=wml&amp;sid='.$sid.'&amp;f='.$info['id_forum'].'">Назад</a><br />
<a href="./?v=wml&amp;sid='
.$sid.'">Форумы</a>');
}
else
{
echo(
'<a href="./?p=2&amp;v=wml&amp;f='.$info['id_forum'].'">Назад</a><br />
<a href="./?p=0&amp;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&amp;v=xhtml&amp;sid='.$sid.'&amp;f='.$info['id_forum'].'">Назад</a><br />
<a href="./?p=0&amp;v=xhtml&amp;sid='
.$sid.'">Форумы</a>');
}
else
{
echo(
'<a href="./?p=2&amp;v=xhtml&amp;f='.$info['id_forum'].'">Назад</a><br />
<a href="./?p=0&amp;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&amp;v=wml&amp;sid=".$sid."&amp;t=".$p."&amp;s=".($count - 5)."">Вниз (1)</a><br />rn");
                }
                else
                {
                echo(
"<a accesskey="1" href="./?p=4&amp;v=wml&amp;t=".$p."&amp;s=".($count - 5)."">Вниз (1)</a><br />rn");
                }
                }
                if(
$count ceil($count / ($pageSize 1000)))
                {
                    echo(
"<a href="./?p=17&amp;v=wml&amp;sid=".$sid."&amp;t=".$p."&amp;c=".$count."">Перейти к[1-".$count."]</a><br />rn");
                }
                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&amp;v=wml&amp;sid='.$sid.'">Приват</a> - <a href="./?p=24&amp;v=wml&amp;sid='.$sid.'&amp;new=1">'.$private."</a><br />rn");
            }
            } 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&amp;v=xhtml&amp;sid=".$sid."&amp;t=".$p."&amp;s=".($count - 5)."">Вниз</a><br />rn");
                    }
                    else
                    {
                    echo(
"<a href="./?p=4&amp;v=xhtml&amp;t=".$p."&amp;s=".($count - 5)."">Вниз</a><br />rn");
                    }
                    }
                    if(
$count ceil(($count / ($pageSize 1000))))
                    {
                    echo(
"<a href="./?p=17&amp;v=xhtml&amp;sid=".$sid."&amp;t=".$p."&amp;c=".$count."">Перейти к[1-".$count."]</a><br />rn");
                    }
        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&amp;mode=inbox&amp;v=xhtml&amp;sid='.$sid.'">Приват</a> - <a href="./?p=24&amp;v=xhtml&amp;sid='.$sid.'&amp;mode=inbox&amp;new=1">'.$private."</a><br />rn");
            }
echo(
$tagC."</td></tr>
<tr><td bgcolor="".
$style['text']."">rn".$tag);
            if(
$status == "moderator"  || $status == "admin")
            {
                echo(
"<form action="./?p=25&amp;v=xhtml&amp;sid=".$sid."&amp;tid=".$p."&amp;mode=checkbox" method="post">rn");
            }
            }
            
$aposts mysql_query("SELECT *
            FROM `posts`
            WHERE id_theme="
.$p."
            ORDER BY `id`
            "
.$limit);
            
$on $start+1;
            while(
$posts mysql_fetch_assoc($aposts))
            {
                static 
$s;
                if(
$authorize && $info['close'] != "on" )
                    {
                    echo(
'<a href="./?p=7&amp;v='.$version.'&amp;sid='.$sid.'&amp;f='.$p."&amp;s=".$on.""><b>".$on."</b></a>");
                    echo(" 
[");
                    }
                    else
                    {
                    {
                    echo('<b>'.
$on."</b>");
                    echo(" 
[");
                    }
                    }
                echo(date("
d/m H:i", $posts['time'])."]");
                
$authoriz = mysql_query("SELECT FROM `usersWHERE `username`='".$username."' AND `password`='".$password."'");
                
$params = array();
                list(
$params['ip1'], $params['ip2']) = explode("", $posts['ip']);
                    
$Sauthoriz = mysql_fetch_array($authoriz);
                    if(
$Sauthoriz['private'] == "off" or !$authorize or mysql_result(mysql_query("SELECT COUNT(*) FROM `usersWHERE username='".$posts['name']."'"), 0) == 0)
                    {
                    echo("
<b>".$posts['name']."</b>rn");
                    }
                    elseif(
$Sauthoriz['private'] == "private")
                    {
                    echo("
<b><a href="./?p=24&amp;d=1&amp;uid=".UserName2id($posts['name'])."&amp;t=".$p."&amp;v=".$version."&amp;sid=".$sid."">".$posts['name']."</a></b>rn");
                    }
                    elseif(
$Sauthoriz['private'] == "user")
                    {
                    echo("
<b><a href="./?p=6&amp;v=xhtml&amp;id=".UserName2id($posts['name'])."&amp;th=".$color."">".$posts['name']."</a></b>rn");
                    }
                    if(
$status == "moderator" or $status == "admin")
                    {
                        echo(' <a href="
./?p=25&amp;id='.$posts['id'].'&amp;v='.$version.'&amp;sid='.$sid.'&amp;mode=mpost&amp;tid='.$posts['id_theme']."">X</a><br />rn");
                        echo('
['.strtok($posts['useragent'], '/').' <a href="./?p=25&amp;v='.$version.'&amp;mode=whois&amp;sid='.$sid.'&amp;ip='.$params['ip1'].'">'.$params['ip1'].'</a>, <a href="./?p=25&amp;v='.$version.'&amp;mode=whois&amp;sid='.$sid.'&amp;ip='.$params['ip2'].'">'.$params['ip2']."</a>]rn");
                    }
                    if($status == "moderator" || $status == "admin" && $version == "xhtml")
                    {
                        echo("<input type="checkbox" name="id[]" value="".$posts['
id']."" />rn");
                    }
                    echo('
<br />'.nl2br(str_replace('&#36;', $validChar, $posts['post']))."<br /><br /> rn");
                    
$int++;
                    
$s += strlen($posts['post'].$posts['name'].$posts['time'].$title);
                    if(
$s $thisPageSize + (250 abs($int $start)) > $pageSize)
                    {
                        if(
$int != $count)
                        {
                            
$next $int;
                        }
                        break;
                    }
                    
$on++;
            }
            if(
$version == "wml")
            {
                if(!empty(
$next))
                {
                if(
$authorize)
{
                    echo(
"<a accesskey="3" href="./?p=4&amp;v=wml&amp;sid=".$sid."&amp;s=".$next."&amp;t=".$p."">Дальше...(3)</a><br />rn");
                }
                else
                {
                echo(
"<a accesskey="3" href="./?p=4&amp;v=wml&amp;s=".$next."&amp;t=".$p."">Дальше...(3)</a><br />rn");
                }
                }
if(
$info['close'] == "on")
                {
                    echo(
'<b>Тема закрыта</b><br />');
                    if(
is_author($p$username) or $status == "moderator" or $status == "admin")
                        {
                            echo(
'<a href="./?p=4&amp;v=wml&amp;sid='.$sid.'&amp;o=1&amp;t='.$p.'">[Открыть]</a><br />');
                        }
                }
                if(
$authorize && $info['close'] != "on" )
                {
                    echo(
'<a href="./?p=7&amp;v=wml&amp;sid='.$sid.'&amp;f='.$p.'">Ответить</a><br />');
                }
                elseif(!
$authorize && $info['close'] != "on" && $AuthorAnonim)
                {
                    echo(
'<a href="./?p=30&amp;v=wml&amp;f='.$p.'">Ответить</a><br />');
                }
                if(
$info['del'] == 1)
                    {
                        echo(
'Тема была удалена модератором '.$info['mdel']."<br />rn");
                    }
                    if(
$authorize)
{
            echo(
'<a href="./?p=2&amp;f='.$back['id'].'&amp;sid='.$sid.'&amp;v=wml">Назад в «'.$back['name'].'»</a>');
}
else
{
echo(
'<a href="./?p=2&amp;f='.$back['id'].'&amp;v=wml">Назад в «'.$back['name'].'»</a>');
}
echo(
''.$tagC.'
</p></card></wml>'
);
            } elseif(
$version == "xhtml")
            {
                echo(
$tagC."</td></tr>
<tr><td bgcolor="".
$style['bottom']."">rn".$tag);
                    if(!empty(
$next))
                    {
                    if(
$authorize)
{
                        echo(
"<a href="./?p=4&amp;v=xhtml&amp;sid=".$sid."&amp;s=".$next."&amp;t=".$p."">Дальше...</a><br />rn");
                    }
                    else
                    {
                    echo(
"<a href="./?p=4&amp;v=xhtml&amp;s=".$next."&amp;t=".$p."">Дальше...</a><br />rn");
                    }
                    }
if(
$info['close'] == "on")
                    {
                        echo(
'<b>Тема закрыта</b><br />');
                        if(
is_author($p$username) or $status == "moderator" or $status == "admin")
                        {
                            echo(
'<a href="./?p=4&amp;v=xhtml&amp;sid='.$sid.'&amp;o=1&amp;t='.$p.'">[Открыть]</a><br />');
                        }
                    }
                    if(
$authorize && $info['close'] != "on" )
                    {
                        echo(
'<a href="./?p=7&amp;v=xhtml&amp;sid='.$sid.'&amp;f='.$p."">Ответить</a><br />rn");
                    }
                    elseif(!
$authorize && $info['close'] != "on" && $AuthorAnonim)
                    {
                    echo('<a href="
./?p=30&amp;v=xhtml&amp;f='.$p."">Ответить</a><br />rn");
                    }
                    if($info['
del'] == 1)
                    {
                        echo('
Тема была удалена модератором '.$info['mdel']."<br />rn");
                    }
                    if($authorize)
{
                echo('
<a href="./?p=2&amp;v=xhtml&amp;sid='.$sid.'&amp;f='.$back['id'].'">Назад в «'.$back['name']."»</a><br />rn");
                }
                else
                {
                echo('
<a href="./?p=2&amp;v=xhtml&amp;f='.$back['id'].'">Назад в «'.$back['name']."»</a><br />rn");
                }
                if($status == "moderator" || $status == "admin")
                {
                    echo("<input type="submit" value="Удалить отмеченные" />rn");
                }
echo($tagC."</td></tr></table>rn</body></html>");
            }
    }
?>
Онлайн: 0
Реклама