Просмотр файла download/zip.php

Размер файла: 5.78Kb
<?php
#-----------------------------------------------------#
#          ********* WAP-MOTORS *********             #
#             Made by   :  VANTUZ                     #
#               E-mail  :  [email protected]             #
#                 Site  :  http://pizdec.ru           #
#             WAP-Site  :  http://visavi.net          #
#                  ICQ  :  36-44-66                   #
#  Вы не имеете право вносить изменения в код скрипта #
#-----------------------------------------------------#	
require_once"../template/start.php";
require_once"../template/regglobals.php";
require_once"../template/config.php";
require_once"../template/functions.php";
require_once"../template/maincore.php";
require_once"../template/antidos.php";
require_once"../template/cookies.php";
require_once"../template/gzip.php";
require_once"../template/header.php";
require_once"../template/referer.php";
include_once"../themes/$config_themes/index.php";

include_once"../template/pclzip.php";

echo '<img src="../images/img/partners.gif" alt=""> <b><font color="#FFFF00">Просмотр архива</font></b><br><br>';

if (!$action){

$zip=new PclZip("$dir/$arch");
if (($list = $zip->listContent()) == 0){die("Ошибка: ".$zip->errorInfo(true));}
     
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=round($sizelist2/1024,2);

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

$count = count($preview)-1;
echo '<b>'.$arch.'</b><br>Всего файлов: '.$count.'<br>Вес распакованного архива: '.$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);


echo $zdir.'/';
echo '<a href="zip.php?action=preview&amp;dir='.$dir.'&amp;arch='.$arch.'&amp;open='.$path.'&amp;start='.$start.'&amp;'.SID.'">'.$fname.'</a>';
if($sizefiles[$i]!="0"){
$sizekb=round($sizefiles[$i]/1024,2);
echo ' ('.$sizekb.' кб)'; 
}
echo'<br>';
}

echo'<hr>';
if ($start != 0) {echo '<a href="zip.php?start='.($start - $config_ziplist).'&amp;dir='.$dir.'&amp;arch='.$arch.'&amp;'.SID.'">&lt;-Назад |</a> ';}else{echo'&lt;-Назад |';}

if ($count > $start + $config_ziplist) {echo ' <a href="zip.php?start='.($start + $config_ziplist).'&amp;dir='.$dir.'&amp;arch='.$arch.'&amp;'.SID.'">| Далее-&gt;</a>';}else{echo'| Далее-&gt;';}


$total=$count;
$ba=ceil($total/$config_ziplist);
$ba2=$ba*$config_ziplist-$config_ziplist;
echo '<br>';
echo'<hr>Страницы:';
$asd=$start-($config_ziplist*3);
$asd2=$start+($config_ziplist*4);

if($asd<$total && $asd>0){echo ' <a href="zip.php?start=0&amp;dir='.$dir.'&amp;arch='.$arch.'&amp;'.SID.'">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;dir='.$dir.'&amp;arch='.$arch.'&amp;'.SID.'">'.$ii.'</a> ';
                     }}
$i=$i+$config_ziplist;}
if($asd2<$total){echo ' ... <a href="zip.php?start='.$ba2.'&amp;dir='.$dir.'&amp;arch='.$arch.'&amp;'.SID.'">'.$ba.'</a>';}

echo'<br><br><a href="down.php?action=ob&amp;did='.$dir.'&amp;fid='.$arch.'&amp;'.SID.'">Вернуться</a><br>'; 
}
//////////////////////////////////action preview////////////////////////////////
if($action=="preview")
{
$open = str_replace("*","/",$open);	
	
$zip=new PclZip("$dir/$arch");
$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 '<b>Файл: '.$open.'</b><br>строчек: '.$count.'<br><hr>';

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

echo'<hr>';
echo'<br><a href="zip.php?start='.$start.'&amp;dir='.$dir.'&amp;arch='.$arch.'&amp;'.SID.'">Назад</a><br>'; 
}
 
echo'<a href="down.php?did='.$dir.'&amp;'.SID.'">В раздел</a><br>';	 
echo'<img src="../images/img/panel.gif" alt=""> <a href="index.php?'.SID.'">К категориям</a><br>';	
echo'<img src="../images/img/homepage.gif" alt=""> <a href="../index.php?'.SID.'">На главную</a>';
include_once"../themes/$config_themes/foot.php";
?>