Вход Регистрация
Файл: public_html/load/zip.php
Строк: 151
<?php
#-----------------------------------------------------#
#          ********* ROTORCMS *********               #
#             Made by   :  VANTUZ                     #
#               E-mail  :  visavi.net@mail.ru         #
#                 Site  :  http://pizdec.ru           #
#             WAP-Site  :  http://visavi.net          #
#                  ICQ  :  36-44-66                   #
#  Вы не имеете право вносить изменения в код скрипта #
#        для его дальнейшего распространения          #
#-----------------------------------------------------#    
require_once ('../includes/start.php');
require_once (
'../includes/functions.php');
require_once (
'../includes/header.php');
include_once (
'../themes/' . $config['themes'] . '/index.php');
require_once (
'../includes/pclzip.php');

if (isset(
$_GET['id'])) {
  
$id = abs(intval($_GET['id']));
} else {
  
$id = 0;
} 
if (isset(
$_GET['start'])) {
  
$start = abs(intval($_GET['start']));
} else {
  
$start = 0;
} 
if (isset(
$_GET['act'])) {
  
$act = check($_GET['act']);
} else {
  
$act = 'index';
} 

show_title('down.png', 'Просмотр архива');

switch (
$act):
# ###########################################################################################
# #                                    Главная страница                                    ##
# ###########################################################################################
case 'index':
  
$downs = DB :: $dbh -> queryFetch("SELECT `downs`.*, `cats`.`cats_id`, `cats`.`cats_name` FROM `downs` LEFT JOIN `cats` ON `downs`.`downs_cats_id`=`cats`.`cats_id` WHERE `downs_id`=? LIMIT 1;", array($id));

  if (
$downs > 0) {
    if (
strrchr($downs['downs_link'], '.') == '.zip') {
      
$config['newtitle'] = 'Просмотр архива - ' . $downs['downs_title'];

      
$zip = new PclZip('files/' . $downs['downs_link']);
      if ((
$list = $zip -> listContent()) != 0) {
        
$intotal = $zip -> properties();
        
$total = $intotal['nb'];

        
sort($list);

        if (
$total > 0) {
          echo 
'<img src="../images/img/zip.gif" alt="image" /> <b>' . $downs['downs_title'] . '</b><br /><br />';
          echo 
'Всего файлов: ' . $total . '<hr />';

          
$arrext = array('.xml', '.wml', '.asp', '.aspx', '.shtml', '.htm', '.phtml', '.html', '.php', '.htt', '.dat', '.tpl', '.htaccess', '.pl', '.js', '.jsp', '.css', '.txt', '.sql', '.gif', '.png', '.bmp', '.wbmp', '.jpg', '.jpeg');

          if (
$start < 0 || $start >= $total) {
            
$start = 0;
          } 
          if (
$total < $start + $config['ziplist']) {
            
$end = $total;
          } else {
            
$end = $start + $config['ziplist'];
          } 
          for (
$i = $start; $i < $end; $i++) {
            if (
$list[$i]['folder'] == 1) {
              
$filename = substr($list[$i]['filename'], 0, -1);
              echo 
'<img src="../images/icons/dir.gif" alt="image" /> <b>Директория ' . $filename . '</b><br />';
            } else {
              
$ext = strtolower(strrchr($list[$i]['filename'], "."));

              echo 
'<img src="../images/icons/' . icons($ext) . '" alt="image" /> ';

              if (
in_array($ext, $arrext)) {
                echo 
'<a href="zip.php?act=preview&amp;id=' . $id . '&amp;view=' . $list[$i]['index'] . '&amp;start=' . $start . '&amp;' . SID . '">' . $list[$i]['filename'] . '</a>';
              } else {
                echo 
$list[$i]['filename'];
              } 
              echo 
' (' . formatsize($list[$i]['size']) . ')<br />';
            } 
          } 
          
page_jumpnavigation('zip.php?id=' . $id . '&amp;', $config['ziplist'], $start, $total);
          
page_strnavigation('zip.php?id=' . $id . '&amp;', $config['ziplist'], $start, $total);

          echo 
'<img src="../images/img/back.gif" alt="image" /> <a href="down.php?cid=' . $downs['cats_id'] . '&amp;' . SID . '">' . $downs['cats_name'] . '</a><br />';
        } else {
          
show_error('Ошибка! В данном архиве нет файлов!');
        } 
      } else {
        
show_error('Ошибка! Невозможно открыть архив!');
      } 
    } else {
      
show_error('Ошибка! Невозможно просмотреть данный файл, т.к. он не является архивом!');
    } 
  } else {
    
show_error('Ошибка! Данного файла не существует!');
  } 
  break;
# ###########################################################################################
# #                                    Просмотр файла                                      ##
# ###########################################################################################
case "preview":

  
$view = abs(intval($_GET['view']));

  
$querydown = DB :: $dbh -> query("SELECT * FROM downs WHERE downs_id=? LIMIT 1;", array($id));
  
$downs = $querydown -> fetch();

  if (
$downs > 0) {
    
$zip = new PclZip('files/' . $downs['downs_link']);

    
$content = $zip -> extract(PCLZIP_OPT_BY_INDEX, $view, PCLZIP_OPT_EXTRACT_AS_STRING);
    if (!empty(
$content)) {
      
$filecontent = $content[0]['content'];
      
$filename = $content[0]['filename'];

      
$config['newtitle'] = 'Просмотр файла - ' . $filename;

      echo 
'<img src="../images/img/zip.gif" alt="image" /> <b>' . $downs['downs_title'] . '</b><br /><br />';

      echo 
'<b>' . $filename . '</b> (' . formatsize($content[0]['size']) . ')<hr />';

      if (!
preg_match("/.(gif|png|bmp|wbmp|jpg|jpeg)$/", $filename)) {
        if (
$content[0]['size'] > 0) {
          if (
is_utf($filecontent)) {
            echo 
'<div class="d">' . highlight_string($filecontent, 1) . '</div><br />';
          } else {
            echo 
'<div class="d">' . highlight_string(win_to_utf($filecontent), 1) . '</div><br />';
          } 
        } else {
          
show_error('Данный файл пустой!');
        } 
      } else {
        if (!empty(
$_GET['img'])) {
          
$ext = strtolower(substr($filename, strrpos($filename, '.') + 1));

          
ob_end_clean();
          
ob_clean();

          
header("Content-type: image/$ext");
          
header("Content-Length: " . strlen($filecontent));
          
header('Content-Disposition: inline; filename="' . $filename . '";');

          echo 
$filecontent;
          exit;
        } 

        echo 
'<img src="zip.php?act=preview&amp;id=' . $id . '&amp;view=' . $view . '&amp;img=1" alt="image" /><br /><br />';
      } 
    } else {
      
show_error('Ошибка! Не удалось извлечь файл!');
    } 
  } else {
    
show_error('Ошибка! Данного файла не существует!');
  } 

  echo 
'<img src="../images/img/back.gif" alt="image" /> <a href="zip.php?id=' . $id . '&amp;start=' . $start . '&amp;' . SID . '">Вернуться</a><br />';
  break;

default:
  
header("location: zip.php?" . SID);
  exit;
  endswitch;

  echo 
'<img src="../images/img/reload.gif" alt="image" /> <a href="index.php?' . SID . '">Категории</a><br />';
  echo 
'<img src="../images/img/homepage.gif" alt="image" /> <a href="../index.php?' . SID . '">На главную</a>';

  include_once (
'../themes/' . $config['themes'] . '/foot.php');

  
?>
Онлайн: 2
Реклама