Файл: new.php
Строк: 142
<?php
// mod Gemorroj
require 'moduls/config.php';
require 'moduls/header.php';
###############Проверка переменных###############
$title .= $_SESSION['language']['new files'];
if(@$_REQUEST['go_cat']){
header('Location: '.DIRECTORY.'new/'.int(@$_REQUEST['go_cat']).'/');
}
$onpage = get2ses('onpage');
if ($onpage < 3) {
$onpage = $setup['onpage'];
}
$prew = get2ses('prew');
if ($prew != 0 && $prew != 1) {
$prew = $setup['preview'];
}
$id = isset($_GET['id']) ? abs($_GET['id']) : 0;
$page = isset($_GET['page']) ? abs($_GET['page']) : 1;
if ($page < 1) {
$page = 1;
}
$out = '';
$banner='';
$Reklames = new Reklames(); // Создаем экземпляр класса Reklames
$banner.= $Reklames->Bottom();
$banner.=$Reklames->Banner();
$cate = isset($_GET['cat']) ? int(@$_GET['cat']).'/' : $cate='';
if(@$_GET['cat']){
$result=mysql_result(mysql_query("SELECT `path` FROM `files` WHERE `id`='".int(@$_GET['cat'])."' LIMIT 1",$mysql),0);
$nomm=' AND `path` LIKE "'.$result.'%"';
}else{
$nomm='';
}
$new = 86400 * $setup['day_new'];
###############Получаем список файлов###############
if ($_SESSION['langpack'] == 'russian') {
$sql = mysql_query('
SELECT SQL_CALC_FOUND_ROWS `id`,
`path`,
`infolder`,
`rus_name` AS `name`,
`size`,
`loads`,
`timeupload`,
`yes`,
`no`
FROM `files` WHERE `timeupload` > "'.($_SERVER['REQUEST_TIME'] - $new).'"' . $nomm . ' AND `dir` = "0"
AND `hidden` = "0" AND `fileid`="0" ORDER BY `id` DESC LIMIT ' . (($page * $onpage) - $onpage) . ', ' . $onpage,$mysql);
} else {
$sql = mysql_query('
SELECT SQL_CALC_FOUND_ROWS `id`,
`path`,
`infolder`,
`name`,
`size`,
`loads`,
`timeupload`,
`yes`,
`no`
FROM `files` WHERE `timeupload` > "'.($_SERVER['REQUEST_TIME'] - $new).'"' . $nomm . ' AND `dir` = "0"
AND `hidden` = "0" AND `fileid`="0" ORDER BY `id` DESC LIMIT ' . (($page * $onpage) - $onpage) . ', ' . $onpage,$mysql);
}
$all = mysql_fetch_row(mysql_query('SELECT FOUND_ROWS();', $mysql));
$all=$all[0];
$onpage = $onpage > $all ? $all : $onpage;
###############Вывод###############
$out .= '<div class="mainzag">' . $_SESSION['language']['new files'] . ':</div>';
$out.= $Reklames->Top();
$nomin='';
$sqle=mysql_query("SELECT `rus_name`,`id`,`name` FROM `files` WHERE `infolder`='".$setup['nomination']."' AND `dir`!='0' ORDER BY `id`",$mysql);
$nomin.='<form action="'.DIRECTORY.'new.php" method="post">'.$_SESSION['language']['nomination'].': <select name="go_cat">';
while($da=mysql_fetch_array($sqle)){
$nomin.='<option value="'.$da['id'].'">'.($_SESSION['langpack'] == 'russian' ? htmlspecialchars($da['rus_name'], ENT_NOQUOTES) : htmlspecialchars($da['name'], ENT_NOQUOTES)).'</option>';
}
$nomin.='</select> <input class="buttom" type="submit" value="' . $_SESSION['language']['go'] . '"/></form>';
$out.='<div class="sort">'.$nomin.'</div>';
###############Cтраницы###############
$pages = ceil($all / $onpage);
if (!$pages) {
$pages = 1;
}
###############Если их нет...###########
if (!$all) {
$out .= '<div class="row2">'.$_SESSION['language']['empty2'].'</div>';
}
###############Вывод списка#############
$bool = true;
while ($v = mysql_fetch_assoc($sql)) {
$bool != $bool;
if ($bool) {
$out .= '<div class="row">';
} else {
$out .= '<div class="row2">';
}
$ext = strtolower(pathinfo($v['path'], PATHINFO_EXTENSION));
//Красивый размер
$v['size'] = '(' . size($v['size']) . ')';
//Предосмотр
$pre = '';
if ($prew) {
$prev_pic = str_replace('/', '--', iconv_substr(strstr($v['path'], '/'), 1));
if ($setup['screen_change'] && ($ext == 'gif' || $ext == 'jpeg' || $ext == 'jpg' || $ext == 'png' || $ext == 'bmp')) {
if (file_exists($setup['picpath'] . '/' . $prev_pic . '.gif')) {
$pre .= '<img style="margin: 1px;" src="' . DIRECTORY . $setup['picpath'] . '/' . htmlspecialchars($prev_pic) . '.gif" alt=""/><br/>';
} else {
$pre .= '<img style="margin: 1px;" src="' . DIRECTORY . 'im/' . $v['id'] . '" alt=""/><br/>';
}
} else if ($setup['screen_change'] && ($ext == 'avi' || $ext == '3gp' || $ext == 'mp4') && extension_loaded('ffmpeg')) {
$wh = explode('*', $setup['prev_size']);
if (file_exists($setup['ffmpegpath'] . '/' . $prev_pic . '_frame_' . $setup['ffmpeg_frame'] . '.gif')) {
$pre .= '<img style="margin: 1px; width:' . $wh[0] . '; height:' . $wh[1] . ';" src="' . DIRECTORY . $setup['ffmpegpath'] . '/' . htmlspecialchars($prev_pic) . '_frame_' . $setup['ffmpeg_frame'] . '.gif" alt=""/><br/>';
} else {
$pre .= '<img style="margin: 1px; width:' . $wh[0] . '; height:' . $wh[1] . ';" src="' . DIRECTORY . 'ffmpeg/' . $v['id'] . '" alt=""/><br/>';
}
} else if ($setup['screen_change'] && ($ext == 'thm' || $ext == 'nth' || $ext == 'utz' || $ext == 'sdt' || $ext == 'scs')) {
if (file_exists($setup['tpath'] . '/' . $prev_pic . '.gif')) {
$pre .= '<img style="margin: 1px;" src="' . DIRECTORY . $setup['tpath'] . '/' . htmlspecialchars($prev_pic) . '.gif" alt=""/><br/>';
} else if ($setup['swf_change'] && file_exists($setup['tpath'] . '/' . $prev_pic . '.gif.swf')) {
$pre .= '<object style="width:128px; height:128px;"><param name="movie" value="' . DIRECTORY . $setup['tpath'] . '/' . htmlspecialchars($prev_pic) . '.gif.swf"><embed src="' . DIRECTORY . $setup['tpath'] . '/' . htmlspecialchars($prev_pic) . '.gif.swf" style="width:128px; height:128px;"></embed></param></object><br/>';
} else if (!file_exists($setup['tpath'] . '/' . $prev_pic . '.gif.swf')) {
$pre .= '<img style="margin: 1px;" src="' . DIRECTORY . 'theme/' . $v['id'] . '" alt=""/><br/>';
}
} else if ($setup['jar_change'] && $ext == 'jar') {
if (file_exists($setup['ipath'] . '/' . $prev_pic . '.png')) {
$pre .= '<img style="margin: 1px;" src="' . DIRECTORY . $setup['ipath'] . '/' . htmlspecialchars($prev_pic) . '.png" width="16" height="16" alt=""/>';
} else if (jar_ico($v['path'], $setup['ipath'] . '/' . $prev_pic . '.png')) {
$pre .= '<img style="margin: 1px;" src="' . DIRECTORY . $setup['ipath'] . '/' . htmlspecialchars($prev_pic) . '.png" width="16" height="16" alt=""/>';
}
} else if ($setup['apk_change'] && $ext == 'apk') {
if (file_exists($setup['apkpath'] . '/' . $prev_pic . '.png')) {
$pre .= '<img style="margin: 1px;" src="' . DIRECTORY . $setup['apkpath'] . '/' . htmlspecialchars($prev_pic) . '.png" width="16" height="16" alt=""/>';
} else if (apk_ico($v['path'], $setup['apkpath'] . '/' . $prev_pic . '.png')) {
$pre .= '<img style="margin: 1px;" src="' . DIRECTORY . $setup['apkpath'] . '/' . htmlspecialchars($prev_pic) . '.png" width="16" height="16" alt=""/>';
}
} else if ($setup['swf_change'] && $ext == 'swf') {
$pre .= '<object style="width:128px; height:128px;"><param name="movie" value="' . DIRECTORY . htmlspecialchars($v['v']) . '"><embed src="' . DIRECTORY . htmlspecialchars($v['v']) . '" style="width:128px; height:128px;"></embed></param></object><br/>';
}
}
//Иконка к файлу
if (!$pre && file_exists('ext/' . $ext . '.png')) {
$ico = '<img src="' . DIRECTORY . 'ext/' . $ext . '.png" alt=""/> ';
} elseif(!$pre && !file_exists('ext/' . $ext . '.png')) {
$ico = '<img src="' . DIRECTORY . 'ext/stand.png" alt=""/> ';
}elseif($pre && file_exists('ext/' . $ext . '.png')){
$ico = '';
}
//Собсвенно вывод
$out .= $pre . ' ' . $ico . '<strong><a href="' . DIRECTORY . 'view/' . $v['id'] . '">' . htmlspecialchars($v['name'], ENT_NOQUOTES) . '</a></strong>' .$v['size']. '</div>';
}
//------------------------------------------------------------------------------------------
if ($pages > 1) {
$out .= '<div class="row">' . $_SESSION['language']['pages'] . ': ';
$asd = $page - 2;
$asd2 = $page + 3;
if ($asd < $all && $asd > 0 && $page > 3) {
$out .= '<a href="' . DIRECTORY . 'new/' . $cate .'1">1</a> ... ';
}
for ($i = $asd; $i < $asd2; ++$i) {
if($i < $all && $i > 0) {
if ($i > $pages ) {
break;
}
if ($page == $i) {
$out .= '<strong>' . $i . '</strong>, ';
} else {
$out .= '<a href="' . DIRECTORY . 'new/' . $cate . $i . '">' . $i . '</a>, ';
}
}
}
if ($i <= $pages) {
if ($asd2 < $all) {
$out .= ' ... <a href="' . DIRECTORY . 'new/' . $cate . $pages . '">' . $pages . '</a>';
}
}
$out .= '</div>';
}
//------------------------------------------------------------------------------------------
echo $out . '<div class="foot"><a href="' . DIRECTORY . '">' . $_SESSION['language']['downloads'] . '</a> |</div>'.$banner;
require 'moduls/foot.php';
?>