Просмотр файла NuclearCMS_v.1.0.0/dl/zip.php

Размер файла: 5.55Kb
<?php

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";
include "sys/zip.php";



$mape=parbaude($_GET['mape']); //*
$fails=parbaude($_GET['fails']);
$vards=parbaude($_GET['vards']);
$open=parbaude($open);

echo '<img src="resursi/img/down.gif" alt=""> <b>'.$lang['zip_look'].'
</b><br><br>';
if($fails !==""){
if (!$action){

$zip=new PclZip("$fails");
if (($list = $zip->listContent()) != 0){
     
for ($i=0; $i<sizeof($list); $i++){
for(reset($list[$i]);
$key = key($list[$i]);
next($list[$i])) {
$zfilesize = strstr($listcontent,"--size"); 
$zfilesize = ereg_replace("--size:","",$zfilesize);
$zfilesize =@ereg_replace("$zfilesize","$zfilesize|",$zfilesize); 
$sizelist .="$zfilesize"; 
  
          	  
$listcontent = "[$i]--$key:".$list[$i][$key]."";
$zfile = strstr($listcontent,"--filename");
$zfile =ereg_replace("--filename:","",$zfile);
$zfile =@ereg_replace("$zfile","$zfile|",$zfile);
$savelist .="$zfile";
   		
}}

$sizefiles2 = explode("|",$sizelist);
$sizelist2=array_sum($sizefiles2);
$obkb=formatsizes($sizelist2);

$preview = explode("|",$savelist);

$count = count($preview)-1;
if(!empty($mape)){
echo '<img src="../images/img/zip.gif" alt=""> <b>'.$mape.'</b>';}
echo'<br><br>';

echo ''.$lang['zip_all_files'].': '.$count.'<br>'.$lang['zip_arh_ves'].': '.$obkb.'<hr>';

if (empty($_GET['start'])) $start = 0;
else $start = $_GET['start'];
if ($count < $start + $config_ziplist){ $end = $count; }
else {$end = $start + $config_ziplist; }
for ($i = $start; $i < $end; $i++){
	
$sizefiles = explode("|",$sizelist); //вырезаем элементы из массива с размерами файлов
$selectfile = explode("|",$savelist);
$path = $selectfile[$i];
$fname = ereg_replace(".*[\\/]","",$path);
$zdir = ereg_replace("[\\/]?[^\\/]*$","",$path);
$path = str_replace("/","*",$path);

$ext=strtolower(strrchr($fname, "."));



if(!$fname){
echo '<img src="resursi/img/folder.png" alt=""> <b>'.$lang['folder'].' '.$zdir.'</b><br>';
}else{
echo '<img src="resursi/img/file.png" alt=""> <a href="zip.php?action=preview&amp;mape='.$mape.'&amp;vards='.$vards.'&amp;fails='.$fails.'&open='.$path.'&amp;start='.$start.'">'.$zdir.'/'.$fname.'</a>';
echo ' ('.formatsizes($sizefiles[$i]).')<br>'; 

}}

echo '<hr>';
if ($start != 0) {echo '<a href="zip.php?start='.($start - $config_ziplist).'&amp;mape='.$mape.'&amp;vards='.$vards.'&amp;fails='.$fails.'">&lt;-'.$lang['back'].'</a> ';}else{echo'&lt;-'.$lang['back'].'';}
echo ' | ';
if ($count > $start + $config_ziplist) {echo ' <a href="zip.php?start='.($start + $config_ziplist).'&amp;mape='.$mape.'&amp;vards='.$vards.'&amp;fails='.$fails.'">'.$lang['go'].'-&gt;</a>';}else{echo''.$lang['go'].'-&gt;';}


$total=$count;
if($total>0){
$ba=ceil($total/$config_ziplist);
$ba2=$ba*$config_ziplist-$config_ziplist;
echo '<br>';
echo '<hr>'.$lang['pages'].':';
$asd=$start-($config_ziplist*3);
$asd2=$start+($config_ziplist*4);

if($asd<$total && $asd>0){echo ' <a href="zip.php?start=0&amp;mape='.$mape.'&amp;vards='.$vards.'&amp;fails='.$fails.'">1</a> ... ';}
for($i=$asd; $i<$asd2;)
{
if($i<$total && $i>=0){
$ii=floor(1+$i/$config_ziplist);

if ($start==$i) {
echo ' <b>'.$ii.'</b>';
} else {
echo ' <a href="zip.php?start='.$i.'&amp;mape='.$mape.'&amp;vards='.$vards.'&amp;fails='.$fails.'">'.$ii.'</a> ';
}}
$i=$i+$config_ziplist;
}
if($asd2<$total){echo ' ... <a href="zip.php?start='.$ba2.'&amp;mape='.$mape.'&amp;vards='.$vards.'&amp;fails='.$fails.'">'.$ba.'</a>';}
}

}else{
echo '<br><b>'.$lang['zip_error'].'</b><br>';
echo ''.$lang['zip_error2'].': '.$zip->errorInfo(true);

}
echo'<br><br><a href="about.php??mape='.$mape.'&amp;vards='.$vards.'&amp;fails='.$fails.'">'.$lang['atpakal'].'</a><br>'; 
}
////////////////////////////////// action preview \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
if($action=="preview"){
	
$open = str_replace("*","/",$open);	
	
$zip=new PclZip($fails);
$content = $zip->extract(PCLZIP_OPT_BY_NAME, $open,PCLZIP_OPT_EXTRACT_AS_STRING);
$content = $content[0]['content'];


$letters=array("а","б","в","г","д","е","ё","ж","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ч","ш","щ","ъ","ы","ь","э","ю","я","А","Б","В","Г","Д","Е","Ё","Ж","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","Ч","Ш","Щ","Ъ","Ы","Ь","Э","Ю","Я");

for ( $b=0; $b<66; $b++) {if(strstr($content,$letters[$b])!== false){$utf="ok";}}
$preview2 = explode("\r\n",$content);
$count = count($preview2);

function highlight_code($code) {
$code=trim($code);
return highlight_string($code,true);}

echo '<img src="../images/img/zip.gif" alt=""> <b>'.$vards.'</b><br>';
echo '<img src="../images/img/files.gif" alt=""> <b>'.$open.'</b><br>';
echo ''.$lang['zip_kol'].': '.(int)$count.'<br><hr>';

if($utf=="ok"){echo highlight_code($content);}else{echo highlight_code(win_to_utf($content));}

echo'<hr><br><img src="../images/img/back.gif" alt=""> ';
echo'<a href="zip.php?start='.$start.'&amp;mape='.$mape.'&amp;vards='.$vards.'&amp;fails='.$fails.'">'.$lang['zip_look'].'</a><br>'; 
}
}else{header ("Location: index.php?"); exit;}
echo'<a href="about.php?fails='.$fails.'&amp;mape='.$mape.'&amp;vards='.$vards.'">'.$lang['opis'].'</a><br>';	 
echo'<a href="index.php?mape='.$mape.'">'.$lang['category'].'</a><br>';
echo'<img src="resursi/img/act_home.gif" alt=""> <a href="http://'.$homeurl.'">'.$lang['galvena'].'</a>';

include"sys/foot.php";
?>