Просмотр файла forum/new.php

Размер файла: 5.35Kb
<?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 = 'themes';
} 

switch ($act):
# ###########################################################################################
# #                                     Последние темы                                     ##
# ###########################################################################################
case "themes":
  show_title('site.png', 'Список последних тем');
  $config['newtitle'] = 'Список последних тем';

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

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

    $querytopic = DB :: $dbh -> query("SELECT `topics`.*, `forums_title` FROM `topics` LEFT JOIN `forums` ON `topics`.`topics_forums_id`=`forums`.`forums_id` ORDER BY `topics_last_time` 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 'Форум: <a href="forum.php?fid=' . $data['topics_forums_id'] . '&amp;' . SID . '">' . $data['forums_title'] . '</a><br />';
      echo 'Автор: ' . nickname($data['topics_author']) . ' / Посл.: ' . nickname($data['topics_last_user']) . ' (' . date_fixed($data['topics_last_time']) . ')</div>';
    } 

    page_strnavigation('new.php?act=themes&amp;', $config['forumtem'], $start, $total);
  } else {
    show_error('Созданных тем еще нет!');
  } 
  break;
# ###########################################################################################
# #                                  Последние сообщения                                   ##
# ###########################################################################################
case "posts":
  show_title('site.png', 'Список последних сообщений');
  $config['newtitle'] = 'Список последних сообщений';

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

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

    $querypost = DB :: $dbh -> query("SELECT `posts`.*, `topics_title`, `topics_posts` FROM `posts` LEFT JOIN `topics` ON `posts`.`posts_topics_id`=`topics`.`topics_id` ORDER BY `posts_time` DESC LIMIT " . $start . ", " . $config['forumpost'] . ";");

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

      echo '<img src="../images/img/forums.gif" alt="image" /> <b><a href="topic.php?act=viewpost&amp;tid=' . $data['posts_topics_id'] . '&amp;id=' . $data['posts_id'] . '&amp;' . SID . '">' . $data['topics_title'] . '</a></b>  (' . $data['topics_posts'] . ')</div>';

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

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

      if (is_admin() || empty($config['anonymity'])) {
        echo '<span class="data">(' . $data['posts_brow'] . ', ' . $data['posts_ip'] . ')</span>';
      } 

      echo '</div>';
    } 

    page_strnavigation('new.php?act=posts&amp;', $config['forumpost'], $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');

  ?>