View file publs_v1_0/new.php

File size: 2.55Kb
<?php
if (defined('BASEDIR')) {
	exit (header('Location: /index.php'));
}

$headmod = 'pub';
$textl = 'Публикации';
$start = isset($_GET['start']) ?  abs(intval($_GET['start'])) : 0; 

require_once ('../includes/start.php');
require_once ('../includes/functions.php');
require_once ('../includes/header.php');
include_once ('../themes/header.php');

require_once ("./inc/conf.php");

// Ограничиваем доступ к Библиотеке
if (!$closed && is_admin(array())) {
	$error = 'Публикации закрыты';
}	else if ($closed == 1 && !is_user()) {
    $error = 'Доступ в Публикации открыт только авторизованным посетителям';
}
if ($error) {
	echo '<div class="rmenu"><p>'.$error.'</p></div>';
	include_once ('../themes/footer.php');
	exit;
}

require_once ("panel.dat");

echo '<ol class="breadcrumb">';
echo '<li><a href="/index.php?"> <i class="fa fa-home fa-lg text-muted"></i> </a></li>';
echo '<li class=""><a href="index.php?">Публикации</a></li>';
echo '<li class="active"><strong>Новинки</strong></li>';
echo '</ol> ';


$total = DB::run() -> querySingle("SELECT COUNT(*) FROM `pub_arts` WHERE `type` = 'file' AND `path` LIKE '/%' AND `time` > '".(SITETIME -($new_fil * 24 * 3600) )."' AND `moder` = '1'");
if	($total > 0) {
	$sql = DB::run() -> query("select * from `pub_arts` where `type` = 'file' and `path` LIKE '/%' and `time` > '".(SITETIME -($new_fil * 24 * 3600) )."' and `moder` = '1' order by `time` DESC LIMIT ".$start.",".$kol_file."");
	$i = 0;
	while ($res = $sql -> fetch()) {
		echo ($i % 2) ? '<div class="list2">' : '<div class="list1">';	++$i;
		echo '<div class="b">';
		echo '<small class="imgright">('.date_fixed($res['time']).')</small> ';
		echo '<a href="read.php?id='.$res['id'].'"><span class="red">'.$res['name'].'</span></a></div>';
		echo '<div class="">'.bb_code(utf_substr($res['text'], 0, 250)).'...</div>';
		echo '<ul>';
		echo '<li><strong>Просмотров:</strong> '.$res['count'].'</li>';
		echo '<li>[<a href="index.php?id='.$res['fid'].'">'.profile($res['name']).'</a>]</li>';
		echo '</ul>';
		echo '</div>';
	}
} else {
	show_error('К сожаленюю, ничего нового на данный момент нету!!');
}


if ($total > $kol_file) {
	page_strnavigation('new.php?&amp;', $kol_file, $start, $total);
}
echo '<div class="breadcrumb">Всего '.$total.' </div>';
echo '<a href="index.php?">Публикации</a> <br />';
include_once ('../themes/footer.php');
?>