Вход Регистрация
Файл: include/topics.php
Строк: 206
<?
$f 
intval($_GET['f']);
    
$forums mysql_query("SELECT * FROM forums
                           WHERE id="
.$f);
    if(
mysql_num_rows($forums) < 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'].'">
<font color="#FFFFFF"><b>Ошибка</b></font>
</td></tr>
<tr><td bgcolor="'
.$style['text'].'">'.$tag.'
Такого подфорума не существует!
'
.$tagC.'
</td></tr>
<tr><td bgcolor="'
.$style['bottom'].'">');
if(
$authorize)
{
echo(
'<a href="./?p=0&amp;v=xhtml&amp;sid='.$sid.'">Форумы</a>');
}
else
{
echo(
'<a href="./?p=0&amp;v=xhtml">Форумы</a>');
}
echo(
'</td></tr></table>
</body></html>'
);
            }
    } else
    {
        
//   Навигация
          
$count mysql_result(
                   
mysql_query("SELECT COUNT(*)
                                FROM themes
                                WHERE id_forum="
.$f), 0);
        
$start intval($_GET['s']);
        if(!empty(
$start))
        {
            
$limit "LIMIT ".$start.", ".abs($count $start);
            
$int $start;
        }
        else
        {
            
$int 0;
        }
         
// Заголовок
        
$forRows mysql_fetch_assoc($forums);
$pcnt mysql_fetch_assoc(
                
mysql_query("SELECT COUNT(*) AS cnt, MAX(posts.time) AS mt
                             FROM posts
                             LEFT JOIN themes
                             ON posts.id_theme=themes.id
                             WHERE id_forum="
.$f));
        if(
$authorize)
        {
            if(!
mysql_result(
                
mysql_query("SELECT COUNT(*)
                             FROM `counter`
                             WHERE `username`='"
.$username."'
                             AND `fid`="
.$f), 0))
        {
            
mysql_query("INSERT INTO `counter`
                         VALUES(0, '"
.$username."', ".$f.", (SELECT MIN(time)FROM posts))");
        }
            
$lastTimeQ mysql_query("SELECT `time`
                                      FROM `counter`
                                      WHERE `username`='"
.$username."'
                                      AND `fid`="
.$f);
            
$lastTimeR mysql_fetch_assoc($lastTimeQ);
            
$lastTime $lastTimeR['time'];
            
$newPosts = @intval(
                        
mysql_result(
                        
mysql_query("SELECT COUNT(*)
                                     FROM posts, themes
                                     WHERE posts.id_theme=themes.id
                                     AND id_forum="
.$f."
                                     AND posts.time > '"
.$lastTime."'
                                     AND posts.name != '"
.$username."'
                                     GROUP BY themes.id_forum"
), 0)).'/';

            if(
$newPosts 1)
            {
                
$newPosts '0/';
            }
            
$title "".$newPosts.intval($pcnt['cnt'])."-".$forRows['name']."";
        }
        else
        {
        
$title "".intval($pcnt['cnt'])."-".$forRows['name']."";
}
        if(
$version == "wml")
        {
            
$validChar '$$';
        }
        else
        {
            
$validChar '$';
        }
        if(
$version=="xhtml"){
        
$thisPageSize $pageSize;
        }
        else
        {
        
$thisPageSize 1750;
        }
            if(
$version == "wml")
            {
                
header('Content-type: text/vnd.wap.wml; charset=utf-8');
                
header("Cache-Control: no-cache");
                echo(
doctype($title));
                echo(
$tag."<a href="./?p=0&amp;v=wml&amp;sid=".$sid."">Форумы</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");
                }
                if(
$authorize)
                {

                    if(
$order == 0)
                    {
                        echo(
"<a href="./?p=15&amp;v=wml&amp;sid=".$sid."&amp;f=".$f."">Популярные темы</a><br />rn");
                    }
                    else
                    {
                        echo(
"<a href="./?p=15&amp;v=wml&amp;sid=".$sid."&amp;f=".$f."">Последние темы</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(
$authorize)
{
echo(
'<a href="./?p=0&amp;v=xhtml&amp;sid='.$sid."">Форумы</a><br />rn");
}
else
{
echo("
<a href="./?p=0&amp;v=xhtml">Форумы</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=xhtml&amp;sid='.$sid.'">Приват</a> - <a href="./?p=24&amp;v=xhtml&amp;sid='.$sid.'&amp;new=1">'.$private.'</a><br />');
            }
                if(
$authorize)
                {

                    if(
$order == 0)
                    {
                        echo("
<a href="./?p=15&amp;v=xhtml&amp;sid=".$sid."&amp;f=".$f."">Популярные темы</a><br />rn");
                    }
                    else
                    {
                        echo("
<a href="./?p=15&amp;v=xhtml&amp;sid=".$sid."&amp;f=".$f."">Последние темы</a><br />rn");
                    }
                }
                    echo(
$tagC."</td></tr>rn");
                    echo("
<tr><td bgcolor="".$style['text']."">rn".$tag);
            if(
$status == "moderator"  OR $status == "admin")
            {
                echo("
<form action="./?p=25&amp;v=xhtml&amp;sid=".$sid."&amp;fid=".$f."&amp;mode=checkbox" method="post">rn");
            }
            }

            if(
$status != "admin")
            {
                
$noDel = "`del`=AND";
            }
            if(
$authorize && $order == 1)
            {
                
$SQL = "SELECT themes.*, MAX(posts.id) AS mpidCOUNT(posts.id) AS cnt
                        FROM themes
posts
                        WHERE posts
.id_theme=themes.id
                        
AND themes.id_forum=".$f."
                        
GROUP BY themes.id
                        ORDER BY pos
mpid DESC
                          
".$limit;
            }
            else
            {
                
$SQL = "SELECT themes . * , COUNTposts.id ) AS cnt
                        FROM themes 
posts
                        WHERE 
".$noDel." id_forum ".$f."
                        
AND posts.id_theme themes.id
                        GROUP BY themes
.id
                        ORDER BY 
`pos` , `idDESC
                        
".$limit;
            }
            
$topicsa = mysql_query($SQL);
            if(
$authorize)
            {
                while(
$topics = mysql_fetch_assoc($topicsa))
                {
                    static 
$s;
                    
$s += strlen($topics['tname'].$topics['name'].$topics['time'].$title);
                    
$topics['cnt'] = $topics['cnt'] - 1;
                    if((
$status == "moderator" || $status == "admin") && $version == "xhtml")
                    {
                        echo("
<input type="checkbox" name="id[]" value="".$topics['id']."" />rn");
                    }
                    if(
$topics['pos'] < 1)
                    {
                        echo('<b>[!]</b>');
                    }
                    echo(date("
d/m H:i", $topics['time'])."");
                    if(
$topics['close'] == "on")
                    {
                        echo('<b>#</b>');
                    }
                    else
                    {
                        echo(']');
                    }
                    
$newPosts = mysql_result(
                                mysql_query("
SELECT COUNT(*)
                                              
FROM `posts`
                                             
WHERE `time` > '".$lastTime."'
                                             
AND `name` != '".$username."'
                                             
AND `id_theme`=".$topics['id']), 0);
                    
$authoriz = mysql_query("SELECT FROM `usersWHERE `username`='".$username."' AND `password`='".$password."'");
                    
$Sauthoriz = mysql_fetch_array($authoriz);
                    if(!
$authorize || $Sauthoriz['private'] == "off" || mysql_result(mysql_query("SELECT COUNT(*) FROM `usersWHERE username='".$topics['name']."'"), 0) == 0)
                    {
                    echo("
<b>".$topics['name']."</b>rn");
                    }
                    elseif(
$Sauthoriz['private'] == "private")
                    {
                    echo("
<b><a href="./?p=24&amp;uid=".UserName2id($topics['name'])."&amp;v=".$version."&amp;sid=".$sid."&amp;d=1">".$topics['name']."</a></b>rn");
                    }
                    elseif(
$Sauthoriz['private'] == "user")
                    {
                    echo("
<b><a href="./?p=6&amp;v=xhtml&amp;id=".UserName2id($topics['name'])."&amp;th=".$color."">".$topics['name']."</a></b>rn");
                    }

                    if(
$status == "moderator" or $status == "admin")
                    {
                        echo(' <a href="
./?p=25&amp;id='.$topics['id'].'&amp;v='.$version.'&amp;sid='.$sid."&amp;mode=mtopic">X</a>rn");
                    }

                    if($topics['
del'] == "1" AND $status == "admin" ) { echo('<i>'); }
                    echo('
<br /><b><a href="./?p=4&amp;t='.$topics['id'].'&amp;v='.$version.'&amp;sid='.$sid.'">'.str_replace('&#36;', $validChar, $topics['tname'])."</a></b>");
                    
if($topics['del'] == "1" AND $status == "admin" ) { echo('</i>');  }
                    
$SnewPosts = ($topics['cnt'] + 1) - $newPosts;
                    echo(
'(');
                    if(
$newPosts $topics['cnt'])
                    {
                        
$newPosts $topics['cnt'];
                    }
                    if(
$newPosts && $topics['cnt'] != 0)
                    {
                        echo(
'<a href="./?p=4&amp;t='.$topics['id'].'&amp;s='.$SnewPosts.'&amp;v='.$version.'&amp;sid='.$sid.'"><b>'.($newPosts).'</b></a>/');
                    } elseif(
$newPosts == && $topics['cnt'] != 0)
                    {
                        echo(
'<a href="./?p=4&amp;t='.$topics['id'].'&amp;s='.$SnewPosts.'&amp;v='.$version.'&amp;sid='.$sid.'"><b>1</b></a>/');
                    }
                    echo(
$topics['cnt'].') ');
                    echo(
"<br /><br />rn");


                    
$int++;
                    if(
$s 1700 $pageSize)
                    {
                        if(
$int != $count)
                        {
                            
$next $int;
                        }
                        break;
                    }
                }
            } else
            {
                while(
$topics mysql_fetch_assoc($topicsa))
                {
                    static 
$s;
                    
$s += strlen($topics['tname'].$topics['name'].$topics['time'].$title);
                    if(
$topics['pos'] < 1)
                    {
                        echo(
'<b>[!]</b>');
                    }
                    echo(
date("d/m H:i"$topics['time'])."");
                    if(
$topics['close'] == "on")
                    {
                        echo(
'<b>#</b>');
                    }
                    else
                    {
                        echo(
']');
                    }
                    echo(
"<b>".$topics['name']."</b>rn");

                    echo(
'<br /><b><a href="./?p=4&amp;t='.$topics['id'].'&amp;v='.$version.'">'.str_replace('&#36;'$validChar$topics['tname'])."</a></b>");
                    echo(
'('.$topics['cnt'].') <br /><br />');
                    
$int++;
                    if(
$s 1700 $pageSize)
                    {
                        if(
$int != $count)
                        {
                            
$next $int;
                        }
                        break;
                    }

                }
            }

        if(
$version == "wml")
        {
            echo(
'<br />');
            if(
$authorize)
            {
            if(!empty(
$next))
            {
            echo(
"<a accesskey="3" href="./?p=2&amp;v=wml&amp;sid=".$sid."&amp;f=".$f."&amp;s=".$next."">Дальше...(3)</a><br />rn");
            }
            echo(
"<a href="./?p=9&amp;v=wml&amp;sid=".$sid."&amp;f=".$f."">Новая тема</a><br />rn");
            }
            else
            {
            if(!empty(
$next))
            {
            echo(
"<a accesskey="3" href="./?p=2&amp;v=wml&amp;f=".$f."&amp;s=".$next."">Дальше...(3)</a><br />rn");
            }
            if(
$AuthorAnonim){
            echo(
"<a href="./?p=31&amp;v=wml&amp;f=".$f."">Новая тема</a><br />rn");}
            }
echo(
'<a href="'.htmlspecialchars($_SERVER['REQUEST_URI']).'&amp;'.time().'">В начало</a><br />
'
.$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=2&amp;v=xhtml&amp;sid=".$sid."&amp;f=".$f."&amp;s=".$next."">Дальше...</a><br />rn");
            }
            else
            {
            echo(
"<a href="./?p=2&amp;v=xhtml&amp;f=".$f."&amp;s=".$next."">Дальше...</a><br />rn");
            }
            }
            if(
$status == "admin" or $status == "moderator")
            {
                echo(
"<input type="submit" value="Удалить отмеченные" /><br />rn</form>");
            }
            if(
$authorize)
{
            echo(
'<a href="./?p=9&amp;v=xhtml&amp;sid='.$sid.'&amp;f='.$f."">Новая тема</a><br />rn");
            }
            elseif(!
$authorize && $AuthorAnonim)
            {
            echo('<a href="
./?p=31&amp;v=xhtml&amp;f='.$f."">Новая тема</a><br />rn");
            }
            echo('
<a href="'.htmlspecialchars($_SERVER['REQUEST_URI']).'&amp;'.time()."">В начало</a><br />
"
.$tagC."</td></tr></table>
</body></html>rn"
);
            }

    }
?>
Онлайн: 1
Реклама