File size: 4.16Kb
<?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['sort'])) {
$sort = check($_GET['sort']);
} else {
$sort = 'rated';
}
switch ($sort) {
case 'rated': $order = 'photo_rating';
break;
case 'comm': $order = 'photo_comments';
break;
default: $order = 'photo_rating';
}
# ###########################################################################################
# # Топ фото ##
# ###########################################################################################
show_title('site.png', 'Топ популярных фотографий');
$config['newtitle'] = 'Топ популярных фотографий';
echo '<a href="#down"><img src="../images/img/downs.gif" alt="Вниз" /></a> ';
echo 'Сортировать: ';
if ($order == 'photo_rating') {
echo '<b><a href="top.php?sort=rated&' . SID . '">Оценки</a></b>, ';
} else {
echo '<a href="top.php?sort=rated&' . SID . '">Оценки</a>, ';
}
if ($order == 'photo_comments') {
echo '<b><a href="top.php?sort=comm&' . SID . '">Комментарии</a></b>';
} else {
echo '<a href="top.php?sort=comm&' . SID . '">Комментарии</a>';
}
echo '<hr />';
$total = DB :: $dbh -> querySingle("SELECT count(*) FROM `photo`;");
if ($total > 0) {
if ($start >= $total) {
$start = 0;
}
$queryphoto = DB :: $dbh -> query("SELECT * FROM `photo` ORDER BY " . $order . " DESC LIMIT " . $start . ", " . $config['fotolist'] . ";");
while ($data = $queryphoto -> fetch()) {
if ($data['photo_rating'] > 0) {
$data['photo_rating'] = '<span style="color:#00aa00">+' . $data['photo_rating'] . '</span>';
}
if ($data['photo_rating'] < 0) {
$data['photo_rating'] = '<span style="color:#ff0000">' . $data['photo_rating'] . '</span>';
}
echo '<div class="b"><img src="../images/img/gallery.gif" alt="image" /> ';
echo '<b><a href="index.php?act=showimg&gid=' . $data['photo_id'] . '&start=' . $start . '&' . SID . '">' . $data['photo_title'] . '</a></b> (' . read_file(BASEDIR . 'gallery/pictures/' . $data['photo_link']) . ') (' . $data['photo_rating'] . ')</div><div>';
echo '<a href="index.php?act=showimg&gid=' . $data['photo_id'] . '&start=' . $start . '&' . SID . '"><img src="resize.php?dir=gallery/pictures&name=' . $data['photo_link'] . '" alt="image" /></a>';
echo '<br />' . bb_code($data['photo_text']) . '<br />';
echo 'Добавлено: <a href="../pages/anketa.php?uz=' . $data['photo_user'] . '&' . SID . '">' . nickname($data['photo_user']) . '</a> (' . date_fixed($data['photo_time']) . ')<br />';
echo '<a href="index.php?act=comments&gid=' . $data['photo_id'] . '&' . SID . '">Комментарии</a> (' . $data['photo_comments'] . ')';
echo '</div>';
}
page_strnavigation('top.php?sort=' . $sort . '&', $config['fotolist'], $start, $total);
} else {
show_error('Загруженных фотографий еще нет!');
}
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');
?>