View file forum/new.php

File size: 4.94Kb
<?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/header.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::run() -> querySingle("SELECT count(*) FROM topics;");

		if ($total > 0) {
			if ($total > 100) {
				$total = 100;
			} 
			if ($start >= $total) {
				$start = last_page($total, $config['forumtem']);
			} 

			$querytopic = DB::run() -> 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::run() -> querySingle("SELECT count(*) FROM `posts`;");

		if ($total > 0) {
			if ($total > 100) {
				$total = 100;
			} 
			if ($start >= $total) {
				$start = last_page($total, $config['forumpost']);
			} 

			$querypost = DB::run() -> 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 'Написал: '.profile($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:
	redirect("new.php?".SID);
endswitch;

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

include_once ('../themes/footer.php');
?>