View file dl/index.php

File size: 9.13Kb
<?php
#---------------------------------------------------#
#                                                   #
#    ********* AgS DOWNLOAD centre 1.0 *********    #
#                                                   #
#             Author   :   Agris Cišs               #
#             E-mail   :   [email protected]       #
#           WAP-site   :   http://ags.h2m.ru        #
#               Home   :   LATVIA J-city            #
#                                                   #
#            Don't sell the skript!                 #
#    If you do it, I will hit to your face! :D      #
#                                                   #
#---------------------------------------------------#

include "sys/cons.php";
include "sys/cepumi.php";
include "sys/funct.php";
include "sys/lang/$language.php";
include "sys/head.php";
include "sys/msg.php";


$lapa = parbaude($_GET['lapa']);//lapa
$mape = error_checker(parbaude($_GET['mape']));//mapes apstrāde
echo'<div id="up" class="a"><a href="index.php?"><b>'.NOSAUKUMS.'</b></a></div><br>';

####################### ADMINKA ###########################
include"sys/admin_main.php";

if($mape == '\\' or empty($mape)) {
if(FRAZE == '1') {
include_once 'resursi/fraze.php';
echo '<br />';
}
}elseif(FRAZE_visiem == '1') {
include_once 'resursi/fraze.php';
echo '<br />';}
echo'<div class="dl">';
//----------------
if($lapa == "") {$lapa=0; }
$ss = 0; $con = 0; $sok = 0;

if($mape) {
if(strstr($mape,'..')) {exit(ERROR_MESAGE);}
$dir = @opendir('./'.$mape);
} else {
$dir = @opendir('./');
}
$s = 2;

while($file = @readdir($dir)) {
$ign=format($file);
if($file != '.' && $file != '..' && $ign != 'php' && $ign != 'html' && $ign != 'op' && $file != '.htaccess' && $file != 'screens' && $file != 'apraksts' && $file != 'dati' && $file != 'temp' && $file != 'screen.jpg' && $file != 'screen.JPG' && $file != 'screen.gif' && $file != 'screen.png' && $file != 'resursi' && $file != 'sys' && $file != 'admin' && $file != 'Thumbs.db') {

if($con < $lapa) {
$con++;
continue;
}



if($sok < FILES_ON_PAGE) {

$vards = $file;//file
$vards = str_replace(' ','_',$vards);//aizvietojam
$er = strrchr($vards,'.');//formāts ar .
$fotka = format($vards);//dabujam pliku formātu
$neimss = format($vards);//nogriežam formātu
$neimss=str_replace(".$neimss","",$vards);

if($mape) {
$sz = filesize($mape.'/'.$file);
$file = $mape.'/'.$file;
}else{
$sz = filesize($file);//izmērs
}
$fsize = formatsizes($sz);//izmērs
if(is_file($file)) {//fails ir fails
//sort($array);//sakartojam

if($er == '.png' or $er == '.gif' or $er == '.jpg' or $er == '.bmp' or $er == '.JPG' or $er == '.PNG' or $er == '.GIF') {
echo'<div class="file">';
if(time() - filectime($file) < IS_NEW_FILE) {
echo '<img src="resursi/img/new.png" alt="!"> ';
}//new file
echo '<a href="about.php?fails='.$file.'&vards='.$vards.'&mape='.$mape.'&tips=img">'.$transs($neimss,$transs_bildem).'</a> ['.$fsize.']<br>
<img src="prev.php?fails='.$file.'" />  <b>[<a href="downer.php?fails='.$file.'&vards='.$vards.'">'.$lang['down'].'</a>]';
echo'</div>';

} elseif(file_exists('resursi/img/ico/'.$fotka.'.gif')) {
echo'<div class="file">';
if(time() - filectime($file) < IS_NEW_FILE) {
echo '<img src="resursi/img/new.png" alt="!"> ';
}//new file
echo '<img src="resursi/img/ico/'.$fotka.'.gif" /> ';
echo'<a href="about.php?vards='.$vards.'&fails='.$file.'&mape='.$mape.'"><b>'.$transs($neimss,TRANSLATE_FILE).'</b></a> ['.$fsize.']<b>[<a href="downer.php?fails='.$file.'&vards='.$vards.'">'.$lang['down'].'</a>]';
echo'</div>';
}else{
echo'<div class="file">';
if(time() - filectime($file) < IS_NEW_FILE) {
echo '<img src="resursi/img/new.png" alt="!"> ';
}//new file
echo '<img src="resursi/img/file.png" /> ';
echo'<a href="about.php?vards='.$vards.'&fails='.$file.'&mape='.$mape.'"><b>'.$transs($neimss,TRANSLATE_FILE).'</b></a> ['.$fsize.']<b>[<a href="downer.php?fails='.$file.'&vards='.$vards.'">'.$lang['down'].'</a>]';
echo'</div>';
}
    $sok++;
    $ss = $ss + $con;

//kopējais viss failu skaits
} else {
#######################################################
#######                   MAPES                ########
#######################################################

//-------failu skaits ------//
if(FILES_DIR_COUNT == 1){
$mapis = allfilescount($file);
if(empty($mapis)) {$mapis = 0;}
$jaunifaili = newfilecount($file);
$svaramape=izmersall($file);
if($jaunifaili == 0 or empty($jaunifaili)){$jaunifaili ="";
}else{$jaunifaili= '/<font color="red">+</font>'.$jaunifaili;}
if($svaramape == 0 or empty($svaramape)){$svaramape ="";
}else{$svaramape= ' ['.formatsizes($svaramape).']';}
$filecountings = ' ['.$mapis.$jaunifaili.']'.$svaramape;
} else {$filecountings = '';}
//sort($array);


if (file_exists("$file/folder.op")){
$fp = file_get_contents($file.'/folder.op');
$str=explode("|",$fp);
if($str[1] !==""){$opis=$str[1];
$opis = htmlspecialchars($opis);
}else{$opis="";}
if($str[0] !==""){$vards=$str[0];
}else{$vards = $transs($vards,$transs_mapem);}
}else{$opis=""; $vards = $transs($vards,$transs_mapem);}

if(file_exists($file.'/screen.jpg')){
$urla='<img src="prev.php?fails='.$file.'/screen.jpg&w=30&h=30" />';
}elseif(file_exists($file.'/screen.gif')){$urla='<img src="prev.php?fails='.$file.'/screen.gif&w=30&h=30" />';
}elseif(file_exists($file.'/screen.png')){$urla='<img src="prev.php?fails='.$file.'/screen.png&w=30&h=30" />';} else{
$urla='<img src="resursi/img/folder.gif" alt=""/>';}

if ($_SESSION['nick'] !== "" && md5($_SESSION['par']) !=="" && md5($_SESSION['par']) == $admins_par && $_SESSION['nick'] == $admins_nick ) {
$adminka=' [<a href="admin/dir.php?act=deldir&del_dir='.$file.'&amp;mape='.$mape.'">DEL</a>][<a href="admin/dir.php?act=clea&clea='.$file.'&amp;mape='.$mape.'">CLEAN</a>]';

}else{$adminka="";}



echo'<div class="file">';

echo ''.$urla.' <b><a href="?mape='.$file.'">'.$vards.'</a></b>'.$filecountings.''.$adminka.'<br>';
if(!empty($opis)){
echo'<small>'.$opis.'</small><br>';}
echo'</div>';

$sok++;

}//fails ir
}//if($sok < FILES_ON_PAGE)
$con++;//kopējais
}
}

@closedir($dir);

if(empty($con)) {echo '<div class="file">'.$lang['empty_folder'].'</div>';}//ja con ir tukš

echo'</div>';//visiem failiem

if($mape == '.' or empty($mape)) {
if(OBSHEE == '1') {
echo '<div class="info">';
########################################3
$mapesves= izmersall('.');//svars
$kopafaili = allfilescount('.');	//v
$newfilecount = newfilecount('.');	//skaitan
$allsvara = formatsizes($mapesves);//formatejam

echo'<b>'.$lang['inf_files'].':</b> '.$kopafaili.'<br>';
echo'<b>'.$lang['inf_newfiles'].':</b> '.$newfilecount.'<br>';
echo'<b>'.$lang['inf_allves'].':</b> '.$allsvara.'<br>';
#########################################

echo'</div>';
}
}

echo'<div align="center" class="dl">';
echo'<div class="file">';
if($lapa != 0) {
echo '<a href="?mape='.$mape.'&lapa=0"><b>'.$lang['start'].'</b></a>|';
echo '<a href="index.php?mape='.$mape.'&lapa='.($lapa - FILES_ON_PAGE).'"><b><-'.$lang['back'].'</b></a>';
}else{echo'<b>'.$lang['start'].'|<-'.$lang['back'].'</b>';}
echo' | ';

if(!$sok < FILES_ON_PAGE && $sok + $lapa != $con) {
echo '<a href="?mape='.$mape.'&lapa='.($sok + $lapa).'"><b>'.$lang['go'].'-></b></a>';
echo '|<a href="?mape='.$mape.'&lapa='.(abs($con - FILES_ON_PAGE)).'"><b> '.$lang['end'].'</b></a>';
}else{echo'<b>'.$lang['go'].'->|'.$lang['end'].'</b>';}

echo'</div></div>';

$ss = round($ss/1024,1);
$pag = round($con/10);
if(($con - $pag * 10) > 0) {
$pag++;
}
if($con>FILES_ON_PAGE){
echo'<div class="dl"><div class="file">';
echo ''.$lang['pages'].':<b>'.round($ss*10+1,1).'</b> '.$lang['pages_no'].' <b>'.$pag.'</b>';
echo'</div>';}
if($con>FILES_ON_PAGE*3){
echo'<div class="file">';
$ba=ceil($con/FILES_ON_PAGE);
$ba2=$ba*FILES_ON_PAGE-FILES_ON_PAGE;
echo ''.$lang['pages'].':';
$asd=$lapa-(FILES_ON_PAGE*3);
$asd2=$lapa+(FILES_ON_PAGE*4);
if($asd<$con && $asd>0){
echo ' <a href="index.php?mape='.$mape.'&lapa=0">1</a> ... ';}
for($i=$asd; $i<$asd2;){
if($i<$con && $i>=0){
$ii=floor(1+$i/FILES_ON_PAGE);
if ($lapa==$i) {
echo ' <b>('.$ii.')</b>';
}else {
echo ' <a href="index.php?mape='.$mape.'&lapa='.$i.'">'.$ii.'</a>';
}}

$i=$i+FILES_ON_PAGE;}
if($asd2<$con){echo ' ... <a href="index.php?mape='.$mape.'&lapa='.$ba2.'">'.$ba.'</a>';}
echo'</div>';
}
echo'</div>';

// --------------------- beigas ----------------------\\
$kategorijas = strtok($mape,'/');//kategorijas
$obsheeee = strrchr($mape,'/');//mapi atpakaļ apstrāde
$folderup = str_replace($obsheeee,'',$mape);//mapi atpakaļ
echo'<center>';

if($kategorijas !==$mape && !empty($mape)){
echo'[<a href="index.php?mape='.$folderup.'">'.$lang['folderup'].'</a>]<br>';
echo'[<a href="index.php?mape='.$kategorijas.'">'.$lang['category'].'</a>]<br>';
}
if ($_SESSION['nick'] !== "" && md5($_SESSION['par']) !=="" && md5($_SESSION['par']) == $admins_par && $_SESSION['nick'] == $admins_nick ) {
echo'[<a href="admin/index.php?">'.$lang['ADMIN'].'</a>]<br>';
}
echo'[<a href="index.php?">'.$lang['dl'].'</a>]<br>';
echo'[<a href="http://'.$homeurl.'">'.$lang['galvena'].'</a>]<br>';
echo'</center>';
include_once"sys/foot.php";
?>