Просмотр файла dl/top.php

Размер файла: 6.32Kb
<?php
#********************************** AgS MOD DOWNLOAD CENTR SEA *************************************#
#***************************************************************************************************#
#  /||||||||||||||| *********************  /||||||||||||||| *********************  /||||||||||||||| #
# | ||||||||||||||| ********************* | ||||||||||||||| ********************* | ||||||||||||||| #
# | |||||/////||||| ********************* | |||||/////////  ********************* | |||||/////////  #
# | |||||   | ||||| ****** E-MAIL ******* | |||||           ****** WAP/WEB ****** | |||||           #
# | |||||   | ||||| *** [email protected] *** | |||||           * http://ags.h2m.ru * | ||||||||||||||| #
# | |||||   | ||||| ********************* | ||||||||||||||| ********************* | ||||||||||||||| #
# | |||||   | ||||| ********************* | |||||/////||||| ********************* |///////////||||| #
# | ||||||||||||||| ****** SKYPE ******** | |||||   | ||||| ***** MOD AUTHOR ****           | ||||| #
# | |||||////|||||| ***** agrizz15 ****** | |||||   | ||||| ***** Agris Cišs ****  /||||||||||||||| #
# | |||||   | ||||| ********************* | ||||||||||||||| ********************* | ||||||||||||||| #
# |/////    |/////  ********************* |///////////////  ********************* |///////////////  #
#***************************************************************************************************#
#********************************* MOD by AgS in 2010 @ LATVIA *************************************#


require_once"system/start.php";
require_once"system/config.php";
require_once"system/db.php";
require_once"system/head.php";
require_once"lng/$setup[lng]/lng.php";
require_once"system/functions.php";
require_once"system/cookies.php";
require_once"system/counter.php";
include_once"thm/$setup[thm]/index.php";
include_once"system/msg.php";



/* TOPS ieslēgts */
if($setup['top_change']){

/* Datu pārbaude */
$onpage = iegut_sesiju('onpage');
$sort = iegut_sesiju('sort');
$id = intval($_GET['id']);
$page = intval($_GET['page']);
ir_numurs($onpage,'onpage');

/* Kārtošana */
$valid_sort = array('load' => '','eval' =>'');
if(!isset($valid_sort[$sort])) $sort = 'load';
if($sort == 'load') $MODE = '`loads` > 0 AND `size` > 0 ORDER BY `loads` DESC';
if($sort == 'eval' and $setup['eval_change']) $MODE = '`yes` > 0 AND `size` > 0 ORDER BY `yes` DESC';

/* Nosaukuma sagatave */
if($setup['eval_change']==1){ 
$eval = '<a href="top.php?sort=eval">'.dl_107.'</a> <br>'; }else{ 
$eval='';}

if ($sort == 'load'){ 
$sortlink = $eval;}
if ($sort == 'eval' and $setup['eval_change']==1){ 
$sortlink = '<a href="top.php?sort=load">'.dl_108.'</a><br>';}

/* Failu saraksts */
$query = mysql_query('SELECT * FROM `'.$MY_pre.'faili` WHERE '.$MODE.' LIMIT 0, '.$setup['top_num']);

while($list_sw = mysql_fetch_array($query)){
$array_id[] = $list_sw['id'];
}
$all = sizeof($array_id);


/* Izvade */
echo '<img src="pic/main/search.gif" alt=""><b> '.dl_114.' '.$setup['top_num'].'</b><br><br>'.sys_sortby.': '.$sortlink.'<br>' ;

/* lapas */
if(!isset($page)){ $page=1;}
$n = 0;
$pages = ceil($all/$onpage);
if(!$pages){ $pages = 1;}
if ($page){ $n = ($onpage*$page)-$onpage;}


/* Ja TOPs tukšs */
if($all == 0){ echo '<b>'.dl_120.'<br></b>';}

/* Izvade no saraksta */
for($i=1; $i<=$onpage; $i++){
if(!isset($array_id[$n])){
$n++;
continue;}

if(is_integer($n / 2)) $row = '<div class="b">'; else $row = '<div class="b">';

$file_info = mysql_fetch_array(mysql_query('SELECT * FROM `'.$MY_pre.'faili` WHERE `id` = '.$array_id[$n]));
$backdir = @mysql_fetch_array(mysql_query("SELECT * FROM `'.$MY_pre.'faili` WHERE `path` = '".tirit($file_info['infolder'])."'"));

$basename = basename($file_info['path']);
$ex = pathinfo($file_info['path']);
$ext = strtolower($ex['extension']);
$name_file = str_replace('.'.$ex,'',$basename);

/* Translējam */
if(strpos($basename , '!') !== false){
$name_file = trans($name_file);}else{
$name_file = trans2($name_file);}

/* Skaists izmērs */
$file_info['size'] = izmers($file_info['size']);

/* Priekšskats */
$pre='';
if($setup['modulis_preview']==ON){
if($ext == 'bmp'){
$pre = '<br>';}elseif($ext == 'gif' or $ext == 'jpeg' or $ext == 'jpe' or $ext == 'jpg' or $ext == 'png'){
$pre = '<img style="margin: 1px;" src="screen_pic.php?id='.$file_info['id'].'" alt=""/><br/>';}}

/* Info */
$new_info='';
if ($sort=='load'){ 
$info = '[<b>'.$file_info['loads'].']</b>';}
if ($sort=='eval' and $setup['eval_change']==1){ 
$info = '[<font color="#800000">'.$file_info['yes'].'</font>/<font color="#004080">'.$file_info['no'].'</font>]';}

/* Jauns fails */
$filtime2 = $file_info['timeupload']+(3600*24*$setup['day_new']);
if($filtime2>=$time){ $new_info = 'NEW';}

/* Ikona pie faila */
if ($ext !== 'thm' && $ext !== 'nth' && $ext !== 'gif' && $ext !== 'jpeg' && $ext !== 'jpg' && $ext !== 'png'){
if(!file_exists('pic/icons/'.$ext.'.gif')){ 
$ico = '<img src="pic/icons/other.gif" alt="">';}else{ 
$ico = '<img src="pic/icons/'.$ext.'.gif" alt="">';}
}else{
$ico = '';}

/* Formāta izvade */
if($setup['ext']==1){ $extension = '('.$ext.')'; }else{ $extension = '';}


/* Pats izvads */
echo $row;
echo $pre;
echo $ico;
echo ' <b><a href="about.php?id='.$file_info['id'].'">'.$name_file.'</a></b>';
echo $extension;
echo $file_info['size'];
echo $info;
echo '[<a href="index.php?id='.$backdir['id'].'">'.sys_category.'</a>]<br>';
echo '</div>';

$n++;}


/* Lapu izvade */

if($all > 1) {

echo '<br>'.sys_pages.': ';
$asd = $page - 2;
$asd2 = $page + 3;
if($asd<$all && $asd>0 && $page>3){ echo '<a href="top.php?page=1&amp;onpage='.$onpage.'&amp;'.SID.'">1</a> ... ';}

for($i=$asd; $i<$asd2;$i++){
if($i<$all && $i>0){
if ($i > $pages ) break;
if ($page==$i){ 
echo '<b>['.$i.']</b> ';}else{ 
echo '<a href="top.php?page='.$i.'&amp;onpage='.$onpage.'">'.$i.'</a> ';}}}
if ($i <= $pages){
if($asd2<$all) {
echo ' ... <a href="top.php?page='.$pages.'&amp;onpage='.$onpage.'">'.$pages.'</a>';}}
}



echo '<br><br>';
echo '<img src="pic/main/dot.gif" alt=""> <a href="index.php?'.SID.'">'.sys_dl.'</a><br>';
echo '<img src="pic/main/home.gif" alt=""> <a href="'.$setup['home'].'/?'.SID.'">'.sys_home.'</a><br>';
} else { header ("Location: index.php?sayer=404&".SID); exit;}

include_once"thm/$setup[thm]/foot.php";

?>