<?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";
/* Datu pārbaude */
$onpage = iegut_sesiju('onpage'); ## Sesija faili uz lapas
$sort = iegut_sesiju('sort'); ## Sesija kārtošanai
$id = intval($_GET['id']); ## Faila vai mapes ID (cipars)
$page = intval($_GET['page']); ## Izvades lapas
$start = intval($_GET['start']); ## Izvades sākums
ir_numurs($onpage,'onpage'); ## Iestatījums uz lapas
$backid=$id; ## atpakaļ adresei
/* Kārtojam MYSQL tabulas datus */
if($sort == 'name'){ /* pēc vārda */
$MODE = '`priority` DESC,`name` ASC';
}elseif($sort == 'nameup'){ /* pēc vārda */
$MODE = '`priority` DESC,`name` DESC';
}elseif($sort == 'dataup'){ /* pēc datuma */
$MODE = '`priority` DESC,`timeupload` ASC';
}elseif($sort == 'data'){ /* pēc datuma */
$MODE = '`priority` DESC,`timeupload` DESC';
}elseif($sort == 'sizeup'){ /* pēc izmēra */
$MODE = '`priority` DESC,`size` DESC';
}elseif($sort == 'size'){ /* pēc izmēra */
$MODE = '`priority` DESC,`size` ASC';
}elseif($sort == 'load'){ /* pēc kačājuma */
$MODE = '`priority` DESC,`loads` DESC';
}elseif($sort == 'loadup'){ /* pēc kačājuma */
$MODE = '`priority` DESC,`loads` ASC';
}elseif($sort == 'eval' and $setup['eval_change'] == 1){ /* pēc reitinga */
$MODE = '`priority` DESC,`yes` DESC ,`no` ASC';
}elseif($sort == 'evalup' and $setup['eval_change'] == 1){ /* pēc reitinga */
$MODE = '`priority` DESC,`yes` ASC ,`no` DESC';
}else { /* noklusējums - pēc vārda */
$MODE = '`priority` DESC,`name` ASC';}
/* Iegūstam pašreizējo mapi */
if(!$id) {
$d['path'] = $setup['dir_faili'].'/';// Ja nav ID, tad liekam noklusējuma mapi ar failiem
}else {
/* Ņemam no MySQL bāzes */
$d = mysql_fetch_assoc(mysql_query('SELECT `path` FROM `'.$MY_pre.'faili` WHERE `id` = '.$id.' LIMIT 1'));
}
/* Pārbaudam mapes esamību */
if(!is_dir($d['path'])){
echo dl_153.'<br/>';
include_once"thm/$setup[thm]/foot.php"; exit;}
/* Kataloga izvade vairākās lapās */
$all = mysql_fetch_row(mysql_query('SELECT COUNT(*) FROM `'.$MY_pre.'faili` WHERE `infolder` = "'.$d['path'].'"'));
$all = $all[0];
$pages = ceil($all / $onpage);
if(!$pages){ $pages = 1;}
if($page > $pages or $page <= 0){ $page = 1;}
if($start > $all or $start <= 0){ $start = 0;}
if($page){ $start = ($page - 1) * $onpage;}else{ $start = 0;}
/* Iegūstam failu sarakstiņu */
$query = mysql_query('SELECT `id` FROM `'.$MY_pre.'faili` WHERE `infolder` = "'.$d['path'].'" ORDER BY '.$MODE.' LIMIT '.$start.', '.$onpage);
while($list_sw = mysql_fetch_row($query)) $array_id[] = $list_sw[0];
/* Gatavojam nosaukumu ielādēm */
$ex = explode('/',$d['path']);
$sizeof = sizeof($ex) - 2;
foreach($ex as $k => $v) {
if($v != '' and $v != '.' and $v != '..' and $v != $setup['dir_faili']) {
$s = mysql_fetch_array(mysql_query("SELECT `id`,`name` FROM `".$MY_pre."faili` WHERE `path` LIKE '%".tirit($v)."/' AND `size` = 0"));
$s['name'] = str_replace('*','',$s['name']);
if($k >= $sizeof){ $put .= $s['name'];}else{
$put .= '<a href="index.php?id='.$s['id'].'">'.$s['name'].'</a>»';}
}}
/* Nosaukumu izvade */
echo '<div class="a"><img src="pic/main/download.gif" alt=""> <b><a href="index.php">'.sys_dl.'</a>»'.$put.'</b><br></div><br>';
/* Kārtošanas izvēlnes linka izveide */
$sort = $_SESSION['sort'];//dabujam no sesijas kārtošanas veidu
//ģenerējam lapas priekš izvades
if($setup['eval_change']==1){
if($sort == 'eval'){
$sorteval = '|<img src="pic/main/ups.gif" alt=""> <a href="index.php?sort=evalup&onpage='.$onpage.'&id='.$id.'&'.SID.'">'.sys_rate.'</a>';
}else{
$sorteval = '|<img src="pic/main/downs.gif" alt=""> <a href="index.php?sort=eval&onpage='.$onpage.'&id='.$id.'&'.SID.'">'.sys_rate.'</a>';}
}else{
$sorteval="";}
if($sort == 'name'){
$sortname = '<img src="pic/main/ups.gif" alt=""> <a href="index.php?sort=nameup&onpage='.$onpage.'&id='.$id.'&'.SID.'">'.sys_soname.'</a>';
}else{
$sortname = '<img src="pic/main/downs.gif" alt=""> <a href="index.php?sort=name&onpage='.$onpage.'&id='.$id.'&'.SID.'">'.sys_soname.'</a>';}
if($sort == 'data'){
$sortdata = '|<img src="pic/main/ups.gif" alt=""> <a href="index.php?sort=dataup&onpage='.$onpage.'&id='.$id.'&'.SID.'">'.sys_sodate.'</a>';
}else{
$sortdata = '|<img src="pic/main/downs.gif" alt=""> <a href="index.php?sort=data&onpage='.$onpage.'&id='.$id.'&'.SID.'">'.sys_sodate.'</a>';}
if($sort == 'load'){
$sortload = '|<img src="pic/main/ups.gif" alt=""> <a href="index.php?sort=loadup&onpage='.$onpage.'&id='.$id.'&'.SID.'">'.sys_dwtime.'</a>';
}else{
$sortload = '|<img src="pic/main/downs.gif" alt=""> <a href="index.php?sort=load&onpage='.$onpage.'&id='.$id.'&'.SID.'">'.sys_dwtime.'</a>';}
if($sort == 'size'){
$sortsize = '|<img src="pic/main/ups.gif" alt=""> <a href="index.php?sort=sizeup&onpage='.$onpage.'&id='.$id.'&'.SID.'">'.sys_sosize.'</a>';
}else{
$sortsize = '|<img src="pic/main/downs.gif" alt=""> <a href="index.php?sort=size&onpage='.$onpage.'&id='.$id.'&'.SID.'">'.sys_sosize.'</a>';}
if($sort == 'name' or $sort == 'data' or $sort == 'size' or $sort == 'load' or $sort == 'eval' or $sort == 'nameup' or $sort == 'dataup' or $sort == 'sizeup' or $sort == 'loadup' or $sort == 'evalup'){
$sortlink = $sortname.$sortdata.$sortsize.$sortload.$sorteval;}elseif(
$sort == '' and $setup['eval_change']==1){
$sortlink = dl_154.'<br>';}
/* ADMIN - Jauna mapes izveide */
if ($setup['adnick']==$_SESSION['log'] && $setup['adpass']==md5($_SESSION['par']) && $_SESSION['log']!="" && md5($_SESSION['par'])!="") {
echo '<img src="pic/main/adddir.gif" alt=""><a href="admin.php?id='.$id.'&backid='.$backid.'&act=newdir">'.dl_155.'</a><br>';
}
/* Meklētāja un TOPa izvade */
if($setup['search_change'] == 1 or $setup['top_change'] == 1){ ## Izvadam tikai, tad, ja kāds ir ieslēgts
if($setup['search_change'] == 1){ ## Izvadam meklētāju
echo '<img src="pic/main/search.gif" alt=""><a href="search.php">'.sys_src.'</a><br>';}
if($setup['top_change'] == 1){ ##Izvadam TOPu
echo '<img src="pic/main/top20_dir.gif" alt=""><a href="top.php">TOP '.$setup['top_num'].'</a><br>';}
}
if($setup['modulis_komentari']){
echo '<img src="pic/main/comments.gif" alt=""><a href="allkomm.php">'.dl_156.' '.dl_158.'</a><br>';}
echo'<br/>';
/* Pati kārtošanas izvade izvade */
echo '<b>'.sys_sortby.': '.$sortlink.'</b><br>';
##########################################################################################################################################
##########################################################################################################################################
## ##
## Failu un mapju izvade ##
## ##
##########################################################################################################################################
##########################################################################################################################################
/* Pārbaudam vai katalogā ir faili */
if($all) {
/* Iegūstam MSYSQL bāzes datus priekš katra */
foreach($array_id as $key => $value) {
/* Visi faila informācija */
$file_info = mysql_fetch_assoc(mysql_query('SELECT `id`,`name`,`path`,`fastabout`,`timeupload`,`infolder`,`size`,`loads`,`yes`,`no` FROM `'.$MY_pre.'faili` WHERE `id` = "'.$value.'";'));
/* Veidojam stilu */
if(is_integer($key / 2)){
$row = '<div class="b">';
}else{
$row = '<div class="b">';
}
/* Ātrā faila apraksta pārbaude un ieguve */
if(!empty($file_info['fastabout'])){
$file_info['about'] = str_replace("\n",'<br>',$file_info['about']);
}
/* Mapju izvade */
if(is_dir($file_info['path'])) { ## Izvadam tikai ja ir mape
/* Jauna faila noteikšana */
$new_all = ''; ## Izvadam tukšu
$stime = $time - (86400 * $setup['day_new']); ## Iegūstam laiku, kurš skaitās jauns
/* Meklējam DB failus, protams, ja jauno failu izvade ir ieslēgta */
if($setup['day_new'] != 0){
$new_all = mysql_fetch_row(mysql_query('SELECT COUNT(*) FROM `'.$MY_pre.'faili` WHERE `timeupload` > '.$stime.' AND `infolder` LIKE "'.$file_info['path'].'%" AND `size` > 0;'));}
/* Izvadam iegūtos jauno failu datus */
if($new_all[0] and $setup['day_new'] != 0){
$new_all = ' <b>/</b><font color="#00bb00">+'.$new_all[0].'</font>]';}else{
$new_all = ']';}
/* Iegūstam kopējo failu skaitu mapē */
$allinfolder = mysql_fetch_row(mysql_query('SELECT COUNT(*) FROM `'.$MY_pre.'faili` WHERE `infolder` LIKE "'.$file_info['path'].'%" AND `size` > 0;'));
/* Aizvietojam "*" mapes nosaukumā */
$name = str_replace('*','',$file_info['name']);
/* Ikona pie mapes */
$picdir = explode('*',$setup['prev_size']); ## izgriežam iestatījumu datus
$platums = round(intval($picdir[0])); ## izgrieztais iestatījumu platums (w)
$augstums = round(intval($picdir[1])); ## izgrieztais iestatījumu augstums (h)
if(file_exists($file_info['path'].'folder.png')) {
$imgpx = GetImageSize($file_info['path'].'folder.png'); ## iegūstam mapes ikonas datus priekšskatam
}
if(!file_exists($file_info['path'].'folder.png')) {
$ico = '<img src="pic/main/dir.gif" alt="">';
/* Ja bildes izmēri ir lielāki nekā iestatījumos, tad izvadam ar samazinājumu */
}elseif($imgpx[0]>$platums && $imgpx[1]>$augstums){
$ico = '<img src="screen_folder.php?fails='.$file_info['path'].'folder.png&h='.$augstums.'&w='.$platums.'" alt=""/>';
/* Izvadam ielādētās ikonas orģinālu */
}else{
$ico = '<img src="'.$file_info['path'].'folder.png" alt="">';}
/* Ikonas pievienošana */
if(!file_exists($file_info['path'].'folder.png')) {
$addico = '[<a href="admin.php?act=addico&backid='.$backid.'&id='.$file_info['id'].'">+I</a>]';}else {
$addico = '[<a href="admin.php?act=reico&backid='.$backid.'&id='.$file_info['id'].'">-I</a>]';}
/* Mape augšup */
$updown = '[<a href="admin.php?id='.$file_info['id'].'&backid='.$backid.'&act=pos&to=up">UP</a>]';
/* Mape lejup */
$updown2 = '[<a href="admin.php?id='.$file_info['id'].'&backid='.$backid.'&act=pos&to=down">DOWN</a>]';
/* Mapes dzēšana */
$dl = '[<a href="admin.php?act=redir&backid='.$backid.'&id='.$file_info['id'].'">D</a>]';
/* Failu pievienošana */
$adflash = '[<a href="admin.php?id='.$file_info['id'].'&backid='.$backid.'&act=flash">F</a>]';
/* Mapes pārsaukšana */
$adrename = '[<a href="admin.php?id='.$file_info['id'].'&backid='.$backid.'&act=rename">R</a>]';
/* Mapes ātrais apraksts */
$adfast = '[<a href="admin.php?id='.$file_info['id'].'&backid='.$backid.'&act=fast">Fast</a>]';
/* Tieši pati izvade */
echo $row; ## Stils Mapei
echo $ico; ## Ikona mapei
echo'<b><a href="index.php?id='.$file_info['id'].'">'.$name.'</a></b>'; ## Links uz mapi
echo' ['.(int)$allinfolder[0].''.$new_all; ## Faili kopā, kā arī jauni
/* Administrēšana mapēm */
if ($setup['adnick']==$_SESSION['log'] && $setup['adpass']==md5($_SESSION['par']) && $_SESSION['log']!="" && md5($_SESSION['par'])!="") {
/* Pati ADMIN izvade */
echo $dl; ## Mapes dzēšana
echo $addico; ## Ikonas pievienošana
echo $updown; ## Mape augšup
echo $updown2; ## Mape lejup
echo $adflash; ## Jaunu failu pievienošana noteiktai mapei
echo $adrename; ## Mapes pārsaukšana
echo $adfast ; ## Ātrais mapes apraksts
}
if(!empty($file_info['fastabout'])) { ## Mapes ātrais apraksts
echo '<br>'.str_replace("\n",'<br>',$file_info['fastabout']);}
echo '</div>'; ## Stila beigas
/* Failu izvade */
} elseif(is_file($file_info['path'])) { ## Izvadam visu pārējo (failus)
$ex = pathinfo($file_info['path']); ## Gatavojam formātu
$ext = strtolower($ex['extension']); ## Iegūstam formātu
$exfor = $ext; ## Iegūstam formātu
/* Priekšskats failiem */
$pre = ''; ## Tukšs priekškats
if($setup['modulis_preview'] == ON) { ## Priekškats ja ieslēgts
if($ext == 'bmp') {$pre = ''; ## BMP formātam tukšs
/* Priekšskats bildēm gif, jpeg, jpg, png */
} elseif($ext == 'gif' or $ext == 'jpeg' or $ext == 'jpg' or $ext == 'png') {
$pre = '<img style="margin: 1px;" src="screen_pic.php?id='.$file_info['id'].'" alt=""/><br>';
/* Priekškats video avi, 3gp mp4 ( ja ir ffmpeg datu bāze serverim ) */
} elseif(($ext == 'avi' || $ext == '3gp' || $ext == 'mp4') && extension_loaded('ffmpeg')) {
$pre = '<img style="margin: 1px;" src="screen_mpeg.php??id='.$file_info['id'].'" alt=""/><br>';
/* Priekškats tēmām thm, nth */
} elseif($ext == 'thm' || $ext == 'nth') {
$pre = '<img style="margin: 1px;" src="screen_theme.php??id='.$file_info['id'].'" alt=""/><br>';}}
/* Apstrādājam INFOrmācijas datus, ko ieguvām no DB */
$all_komments = @mysql_fetch_row(mysql_query('SELECT COUNT(*) FROM `'.$MY_pre.'komentari` WHERE `file_id` = '.$file_info['id']));
$all_komments = $all_komments[0];
$all_loads = $file_info['loads'];
$file_time = date('d.m.y',$file_info['timeupload']);
/* Unikālā info izvade, kas ir atkarīga no veida, kā tiek kārtotas ielādes */
if($sort == 'name' or $sort == 'size'){
$info = '';
}elseif($sort == 'load' or $sort == 'loadup'){
$info = '(<font color="#FFFF00">'.$all_loads.'</font>)';
}elseif($sort == 'data' or $sort == 'dataup'){
$info = '('.$file_time.')';
}elseif($sort == 'eval' and $setup['eval_change'] == 1){
$info = '(<font color="#800000">'.$file_info['yes'].'</font>/<font color="#004080">'.$file_info[no].'</font>)';
}elseif($sort == 'evalup' and $setup['eval_change'] == 1){
$info = '(<font color="#004080">'.$file_info[no].'</font>/<font color="#800000">'.$file_info['yes'].'</font>)';}
/* Isceļam jaunos failus */
$new_info = '';
$filtime2 = $file_info['timeupload'] + (3600 * 24 * $setup['day_new']);
if($filtime2 >= $time and $setup['day_new'] != 0) $new_info = '<font color="red">NEW</font>';
/* Formāta izvade */
if($setup['ext'] == 1){
$extension = "($ext)";}else{
$extension = '';}
/* 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 = '';}
/* Faila dzēšana */
$dl = '[<a href="admin.php?act=refile&backid='.$backid.'&id='.$file_info['id'].'">D</a>]';
/* Arhīva atarhivēšana */
if($ext == 'zip'){
$unzip = '[<a href="admin.php?id='.$file_info['id'].'&backid='.$backid.'&act=unpack">ZIP</a>]';}else{
$unzip = '';}
/* Priekšskata pievienošana */
if ($ext !== 'thm' && $ext !== 'nth' && $ext !== 'gif' && $ext !== 'jpeg' && $ext !== 'jpg' && $ext !== 'png'){
$add_screen = '+S';}else{
$add_screen = '-S';}
$screen = '[<a href="admin.php?id='.$file_info['id'].'&backid='.$backid.'&act=screen">'.$add_screen.'</a>]';
/* Faila pārsaukšana */
$adfilr = '[<a href="admin.php?id='.$file_info['id'].'&backid='.$backid.'&act=rename">R</a>]';
/* Ātrā apraksta pievienošana */
$adfilf = '[<a href="admin.php?id='.$file_info['id'].'&backid='.$backid.'&act=fast">Fast</a>]';
/* Paša izvade */
echo $row; ## Stila izvade
echo $pre; ## Priekšskats
echo $ico; ## Ikona
echo '<a href="about.php?id='.$file_info['id'].'&backid='.$backid.'"><b>'.$file_info['name'].'</b></a> ';
echo $extension;
echo ' '.$info;
echo $new_info;
echo '<br>[<a href="load.php?id='.$file_info['id'].'"><b>'.sys_ieladet.'</b></a>]';
echo ' ['.izmers($file_info['size']).']';
if ($setup['adnick']==$_SESSION['log'] && $setup['adpass']==md5($_SESSION['par']) && $_SESSION['log']!="" && md5($_SESSION['par'])!="") {
echo '<br>';
echo $unzip ; ## Arhīva atarhivēšana
echo $dl ; ## Faila dzēšana
echo $screen ; ## Priekšskata augšuplāde
echo $adfilr ; ## Faila pārsaukšana
echo $adfilf ; ## Faila apraksta pievienošana
}
echo'<br>';
/* Ātrais apraksts */
if(!empty($file_info['fastabout'])){
echo str_replace("\n",'<br>',$file_info['fastabout']);}
echo '</div>';
}}
/* Failu navigācija izvade */
if($all > 1) {
echo '<br>'.sys_pages.': ';
$asd = $page - 2;
$asd2 = $page + 3;
if($asd < $all && $asd > 0 && $page > 3){echo '<a href="index.php?id='.$id.'&page=1">1</a> ... ';}
for($i = $asd; $i < $asd2; $i++) {
if($i < $all && $i > 0) {
if($i > $pages) break;
if($page == $i){
echo '<strong>['.$i.']</strong> ';}else{
echo '<a href="index.php?id='.$id.'&page='.$i.'">'.$i.'</a> ';}}}
if($i <= $pages) {
if($asd2 < $all) {
echo ' ... <a href="index.php?id='.$id.'&page='.$pages.'">'.$pages.'</a>';}}
echo '<br>';
/* Ar roku vadītas lapas */
if($pages > $setup['pagehand'] and $setup['pagehand_change'] == 1) {
echo sys_pgg.' '.$page.' '.sys_at.' '.$pages.':<br>';
echo'<form action="index.php?" method="get">';
echo'<input type="hidden" name="id" value="'.$id.'"/>';
echo'<input name="page" type="text" maxlength="8" size="8"> ';
echo'<input type="submit" value=" >>"></form>';}
}
/* Lejas izvade */
echo'<br>';
}else{echo '<div class="b"><b>'.dl_157.'</b></div>';}
echo '<img src="pic/main/dot2.gif" alt=""> <a href="admin_user.php?id='.$id.'&page='.$page.'&'.SID.'">'.sys_sets.'</a>';
if ($setup['adnick']==$_SESSION['log'] && $setup['adpass']==md5($_SESSION['par']) && $_SESSION['log']!="" && md5($_SESSION['par'])!="") {
echo ' | <a href="admin.php">'.dl_163.'</a>';}
if($setup['stat_change'] == 1){
echo ' | <a href="statistika.php?'.SID.'">'.sys_stat.'</a>';}
if($setup['zakaz'] == 1){
echo ' | <a href="orders.php">'.sys_tab.'</a>';}
echo '<br><img src="pic/main/home.gif" alt=""> <a href="'.$setup['home'].'">'.sys_home.'</a>';
include_once"thm/$setup[thm]/foot.php";
?>