<?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/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";
$dir=check($dir);
$arch=check($arch);
$open=check($open);
echo '<img src="../images/img/partners.gif" alt=""> <b>Просмотр архива</b><br><br>';
if($dir!="" && $arch!=""){
if (!$action){
$zip=new PclZip("$dir/$arch");
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=round($sizelist2/1024,2);
$preview = explode("|",$savelist);
$count = count($preview)-1;
echo '<img src="../images/img/zip.gif" alt=""> <b>'.$arch.'</b><br><br>';
echo 'Всего файлов: '.$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);
$ext=strtolower(strrchr($fname, "."));
switch($ext){
case 'dir': $ico='dir.gif'; break;
case '.jpg': case '.jpeg': $ico='jpg.gif'; break;
case '.gif': $ico='gif.gif'; break;
case '.mid': $ico='mid.gif'; break;
case '.mp3': $ico='mp3.gif'; break;
case '.wav': case '.amr': $ico='wav.gif'; break;
case '.mmf': $ico='mmf.gif'; break;
case '.jad': $ico='jad.gif'; break;
case '.jar': $ico='jar.gif'; break;
case '.zip': $ico='zip.gif'; break;
case '.txt': $ico='txt.gif'; break;
case '.exe': $ico='exe.gif'; break;
case '.htm': $ico='htm.gif'; break;
case '.html': $ico='htm.gif'; break;
case '.php': $ico='php.gif'; break;
default: $ico='file.gif'; break; }
if(!$fname){
echo '<img src="../images/icons/dir.gif" alt=""> <b>Директория '.$zdir.'</b><br>';
}else{
echo '<img src="../images/icons/'.$ico.'" alt=""> <a href="zip.php?action=preview&dir='.$dir.'&arch='.$arch.'&open='.$path.'&start='.$start.'&'.SID.'">'.$zdir.'/'.$fname.'</a>';
echo ' ('.formatsize($sizefiles[$i]).')<br>';
}}
echo '<hr>';
if ($start != 0) {echo '<a href="zip.php?start='.($start - $config_ziplist).'&dir='.$dir.'&arch='.$arch.'&'.SID.'"><-Назад</a> ';}else{echo'<-Назад';}
echo ' | ';
if ($count > $start + $config_ziplist) {echo ' <a href="zip.php?start='.($start + $config_ziplist).'&dir='.$dir.'&arch='.$arch.'&'.SID.'">Далее-></a>';}else{echo'Далее->';}
$total=$count;
if($total>0){
$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&dir='.$dir.'&arch='.$arch.'&'.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.'&dir='.$dir.'&arch='.$arch.'&'.SID.'">'.$ii.'</a> ';
}}
$i=$i+$config_ziplist;
}
if($asd2<$total){echo ' ... <a href="zip.php?start='.$ba2.'&dir='.$dir.'&arch='.$arch.'&'.SID.'">'.$ba.'</a>';}
}
}else{
echo '<br><img src="../images/img/error.gif" alt=""> <b>Невозможно открыть архив!</b><br>';
echo 'Ошибка: '.$zip->errorInfo(true);
}
echo'<br><br><img src="../images/img/back.gif" alt=""> <a href="down.php?action=ob&did='.$dir.'&fid='.$arch.'&'.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 '<img src="../images/img/zip.gif" alt=""> <b>'.$arch.'</b><br>';
echo '<img src="../images/img/files.gif" alt=""> <b>'.$open.'</b><br>';
echo 'Всего строчек: '.(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.'&dir='.$dir.'&arch='.$arch.'&'.SID.'">Вернуться</a><br>';
}
}else{header ("Location: index.php?".SID); exit;}
echo'<img src="../images/img/dir.gif" alt=""> <a href="down.php?did='.$dir.'&'.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";
?>