View file forum/top.php

File size: 3.26Kb
<?php
#-----------------------------------------------------#
#          ********* ROTORCMS *********               #
#              Made by  :  VANTUZ                     #
#               E-mail  :  [email protected]         #
#                 Site  :  http://pizdec.ru           #
#             WAP-Site  :  http://visavi.net          #
#                  ICQ  :  36-44-66                   #
#  Вы не имеете право вносить изменения в код скрипта #
#        для его дальнейшего распространения          #
#-----------------------------------------------------#	
require_once ('../includes/start.php');
require_once ('../includes/functions.php');
require_once ('../includes/header.php');
include_once ('../themes/' . $config['themes'] . '/index.php');

if (isset($_GET['start'])) {
    $start = abs(intval($_GET['start']));
} else {
    $start = 0;
} 
if (isset($_GET['act'])) {
    $act = check($_GET['act']);
} else {
    $act = 'index';
} 

switch ($act):
# ###########################################################################################
# #                                       Топ тем                                          ##
# ###########################################################################################
case "index":
    show_title('site.png', 'Топ популярных тем');
    $config['newtitle'] = 'Топ популярных тем';

    $total = DB :: $dbh -> querySingle("SELECT count(*) FROM topics;");

    if ($total > 0) {
        if ($start >= $total) {
            $start = 0;
        } 

        $querytopic = DB :: $dbh -> query("SELECT * FROM topics ORDER BY topics_posts DESC LIMIT " . $start . ", " . $config['forumtem'] . ";");

        while ($data = $querytopic -> fetch()) {
            echo '<div class="b">';

            if ($data['topics_locked'] == 1) {
                echo '<img src="../images/img/lock.gif" alt="image" /> ';
            } elseif ($data['topics_closed'] == 1) {
                echo '<img src="../images/img/closed.gif" alt="image" /> ';
            } else {
                echo '<img src="../images/img/forums.gif" alt="image" /> ';
            } 

            echo '<b><a href="topic.php?tid=' . $data['topics_id'] . '&amp;' . SID . '">' . $data['topics_title'] . '</a></b> (' . $data['topics_posts'] . ')</div>';
            echo '<div>Страницы: ';
            forum_navigation('topic.php?tid=' . $data['topics_id'] . '&amp;', $config['forumpost'], $data['topics_posts']);
            echo 'Автор: ' . $data['topics_author'] . '<br />';
            echo 'Сообщение: ' . $data['topics_last_user'] . ' (' . date_fixed($data['topics_last_time']) . ')</div>';
        } 

        page_strnavigation('top.php?', $config['forumtem'], $start, $total);
    } else {
        show_error('Созданных тем еще нет!');
    } 

    break;

default:
    header("location: top.php?" . SID);
    exit;
    endswitch;

    echo '<img src="../images/img/reload.gif" alt="image" /> <a href="index.php?' . SID . '">К форумам</a><br />';
    echo '<img src="../images/img/homepage.gif" alt="image" /> <a href="../index.php?' . SID . '">На главную</a>';

    include_once ('../themes/' . $config['themes'] . '/foot.php');

    ?>