View file blog/new.php

File size: 5.46Kb
<?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');

$config['blogpost'] = 10;

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

switch ($act):
# ###########################################################################################
# #                                        Вывод тем                                       ##
# ###########################################################################################
case 'blogs':
    show_title('site.png', 'Список новых статей');
    $config['newtitle'] = 'Список новых статей';

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

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

        $queryblog = DB :: $dbh -> query("SELECT `blogs`.*, `cats_name` FROM `blogs` LEFT JOIN `catsblog` ON `blogs`.`blogs_cats_id`=`catsblog`.`cats_id` ORDER BY `blogs_time` DESC LIMIT " . $start . ", " . $config['blogpost'] . ";");

        while ($data = $queryblog -> fetch()) {
            if ($data['blogs_rating'] > 0) {
                $data['blogs_rating'] = '<span style="color:#00ff00">+' . $data['blogs_rating'] . '</span>';
            } 
            if ($data['blogs_rating'] < 0) {
                $data['blogs_rating'] = '<span style="color:#ff0000">' . $data['blogs_rating'] . '</span>';
            } 

            echo '<div class="b"><img src="../images/img/edit.gif" alt="image" /> ';

            echo '<b><a href="blog.php?act=view&amp;id=' . $data['blogs_id'] . '&amp;' . SID . '">' . $data['blogs_title'] . '</a></b> (' . $data['blogs_rating'] . ')</div>';

            echo '<div>Категория: <a href="blog.php?cid=' . $data['blogs_cats_id'] . '&amp;' . SID . '">' . $data['cats_name'] . '</a><br />';
            echo 'Просмотров: ' . $data['blogs_read'] . '<br />';
            echo 'Добавил: <a href="../pages/anketa.php?uz=' . $data['blogs_user'] . '&amp;' . SID . '">' . nickname($data['blogs_user']) . '</a>  (' . date_fixed($data['blogs_time']) . ')</div>';
        } 

        page_strnavigation('new.php?act=blogs&amp;', $config['blogpost'], $start, $total);
    } else {
        show_error('Опубликованных статей еще нет!');
    } 
    break;
# ###########################################################################################
# #                                     Вывод сообщений                                    ##
# ###########################################################################################
case 'comments':
    show_title('site.png', 'Список последних комментариев');
    $config['newtitle'] = 'Список последних комментариев';

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

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

        $queryblog = DB :: $dbh -> query("SELECT `commblog`.*, `blogs_title`, `blogs_comments` FROM `commblog` LEFT JOIN `blogs` ON `commblog`.`commblog_blog`=`blogs`.`blogs_id` ORDER BY `commblog_time` DESC LIMIT " . $start . ", " . $config['blogpost'] . ";");

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

            echo '<img src="../images/img/balloon.gif" alt="image" /> <b><a href="blog.php?act=comments&amp;id=' . $data['commblog_blog'] . '&amp;' . SID . '">' . $data['blogs_title'] . '</a></b> (' . $data['blogs_comments'] . ')</div>';

            echo '<div>' . bb_code($data['commblog_text']) . '<br />';

            echo 'Написал: <a href="../pages/anketa.php?uz=' . $data['commblog_author'] . '&amp;' . SID . '">' . nickname($data['commblog_author']) . '</a> <small>(' . date_fixed($data['commblog_time']) . ')</small><br />';

            echo '<span class="data">(' . $data['commblog_brow'] . ', ' . $data['commblog_ip'] . ')</span></div>';
        } 

        page_strnavigation('new.php?act=comments&amp;', $config['blogpost'], $start, $total);
    } else {
        show_error('Комментарии не найдены!');
    } 
    break;

default:
    header("location: new.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');

    ?>