Файл: soc-set/moduls/loads/top.php
Строк: 30
<?php
require_once('../../core/start.php');
require_once('func.php');
check_auth();
switch ($select) {
case 'pictures':
head('ТОП картинок');
echo DIV_TITLE . 'ТОП картинок' . CLOSE_DIV;
if (!empty($_GET['sort'])) {
if ($_GET['sort'] == 'loads') {
$_SESSION['sort'] = 'loads';
} else {
$_SESSION['sort'] = 'rating';
}
}
echo DIV_BLOCK;
echo '<b>По:</b> ' . ( empty($_SESSION['sort']) || $_SESSION['sort'] == 'loads' ? '<b>[количеству скачиваний]</b>' : '<a href="?sort=loads">[количеству скачиваний]</a>') . ' ' . ($_SESSION['sort'] == 'rating' ? '<b>[рейтингу]</b>' : '<a href="?sort=rating">[рейтингу]</a>');
echo CLOSE_DIV;
/* Превью изображения */
$array = array(30, 60, 100);
if (!empty($_GET['prev'])) {
$prev1 = $_GET['prev'];
if ($prev1 == $array[0]) {
unset($_SESSION['prev']);
} elseif ($prev1 == $array[1]) {
$_SESSION['prev'] = 1;
} elseif ($prev1 == $array[2]) {
$_SESSION['prev'] = 2;
} else {
$_SESSION['prev'] = 'no';
}
}
if (empty($_SESSION['prev'])) {
$prev = 'wight="'.$array[0].'" height="'.$array[0].'"';
} elseif ($_SESSION['prev'] == 1) {
$prev = 'wight="'.$array[1].'" height="'.$array[1].'"';
} elseif ($_SESSION['prev'] == 2) {
$prev = 'wight="'.$array[2].'" height="'.$array[2].'"';
} else {
$prev = NULL;
}
echo DIV_BLOCK;
echo '<b>Превью:</b> ' . (empty($_SESSION['prev']) ? '<b>['.$array[0].'x'.$array[0].']</b>' : '<a href="?prev='.$array[0].'">['.$array[0].'x'.$array[0].']</a>') . '
' . ($_SESSION['prev'] == 1 ? '<b>['.$array[1].'x'.$array[1].']</b>' : '<a href="?prev='.$array[1].'">['.$array[1].'x'.$array[1].']</a>') . ' ' .
($_SESSION['prev'] == 2 ? '<b>['.$array[2].'x'.$array[2].']</b>' : '<a href="?prev='.$array[2].'">['.$array[2].'x'.$array[2].']</a>') . ' ' .
($_SESSION['prev'] == 'no' ? '<b>[Выкл.]</b>' : '<a href="?prev=no">[Не показывать]</a>');
echo CLOSE_DIV;
/* *** */
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LOADS_FILE." WHERE `type` = '.jpg' || `type` = '.jpeg' || `type` = '.gif' || `type` = '.png' || `type` = '.bmp'");
if (empty($all)) {
echo DIV_BLOCK . 'Картинки не загружены' . CLOSE_DIV;
} else {
if (empty($_SESSION['sort']) || $_SESSION['sort'] == 'loads') {
$sql = DB::$dbs->query("SELECT * FROM ".LOADS_FILE." WHERE `type` = '.jpg' || `type` = '.jpeg' || `type` = '.gif' || `type` = '.png' || `type` = '.bmp' ORDER BY `loads` DESC LIMIT 10 ");
} else {
$sql = DB::$dbs->query("SELECT * FROM ".LOADS_FILE." WHERE `type` = '.jpg' || `type` = '.jpeg' || `type` = '.gif' || `type` = '.png' || `type` = '.bmp' ORDER BY `rating` DESC LIMIT 10 ");
}
while($file = $sql -> fetch()) {
echo DIV_LI . '<a href="'.HOME.'/loads/'.$file['folder_id'].'/'.$file['folderc_id'].'/'.$file['id'].'/">'.$file['name'].'</a> ['.(empty($_SESSION['sort']) || $_SESSION['sort'] == 'loads' ? $file['loads'] . ' скачиваний' : 'Рейтинг: ' . $file['rating']).']' . CLOSE_DIV;
echo DIV_AUT;
if (empty($_SESSION['prev']) || $_SESSION['prev'] == 1 || $_SESSION['prev'] == 2 ) {
echo '<a href="'.HOME.'/loads/'.$file['folder_id'].'/'.$file['folderc_id'].'/'.$file['id'].'/"><img src="'.HOME.'/files/loads/files/mini_'.$file['url'].'" '.$prev.'/></a>';
}
echo ( (empty($_SESSION['prev']) || $_SESSION['prev'] == 1 || $_SESSION['prev'] == 2) ? '<span style="float: right; ">' : NULL );
echo '<a href="'.HOME.'/loads/'.$file['folder_id'].'/'.$file['folderc_id'].'/'.$file['id'].'/">'.$file['name'].'</a></span><br />';
echo CLOSE_DIV;
}
}
echo DIV_GO . '<a href="'.HOME.'/">Главная</a> / <a href="'.HOME.'/loads/">Загрузки</a> / <b>ТОП картинок</b>' . CLOSE_DIV;
break;
case 'appl':
head('ТОП приложений');
echo DIV_TITLE . 'ТОП приложений' . CLOSE_DIV;
if (!empty($_GET['sort'])) {
if ($_GET['sort'] == 'loads') {
$_SESSION['sort'] = 'loads';
} else {
$_SESSION['sort'] = 'rating';
}
}
echo DIV_BLOCK;
echo '<b>По:</b> ' . ( empty($_SESSION['sort']) || $_SESSION['sort'] == 'loads' ? '<b>[количеству скачиваний]</b>' : '<a href="?sort=loads">[количеству скачиваний]</a>') . ' ' . ($_SESSION['sort'] == 'rating' ? '<b>[рейтингу]</b>' : '<a href="?sort=rating">[рейтингу]</a>');
echo CLOSE_DIV;
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LOADS_FILE." WHERE `type` = '.sisx' || `type` = '.sis' || `type` = '.jar' || `type` = '.apk' || `type` = '.zip' || `type` = '.rar' || `type` = '.ipa'");
if (empty($all)) {
echo DIV_BLOCK . 'Картинки не загружены' . CLOSE_DIV;
} else {
if (empty($_SESSION['sort']) || $_SESSION['sort'] == 'loads') {
$sql = DB::$dbs->query("SELECT * FROM ".LOADS_FILE." WHERE `type` = '.sisx' || `type` = '.sis' || `type` = '.jar' || `type` = '.apk' || `type` = '.zip' || `type` = '.rar' || `type` = '.ipa' ORDER BY `loads` DESC LIMIT 10 ");
} else {
$sql = DB::$dbs->query("SELECT * FROM ".LOADS_FILE." WHERE `type` = '.sisx' || `type` = '.sis' || `type` = '.jar' || `type` = '.apk' || `type` = '.zip' || `type` = '.rar' || `type` = '.ipa' ORDER BY `rating` DESC LIMIT 10 ");
}
while($file = $sql -> fetch()) {
echo DIV_LI . '<a href="'.HOME.'/loads/'.$file['folder_id'].'/'.$file['folderc_id'].'/'.$file['id'].'/">'.$file['name'].'</a> ['.(empty($_SESSION['sort']) || $_SESSION['sort'] == 'loads' ? $file['loads'] . ' скачиваний' : 'Рейтинг: ' . $file['rating']).']' . CLOSE_DIV;
}
}
echo DIV_GO . '<a href="'.HOME.'/">Главная</a> / <a href="'.HOME.'/loads/">Загрузки</a> / <b>ТОП картинок</b>' . CLOSE_DIV;
break;
}
require_once('../../core/stop.php');
?>