Пример #1
0
         exit;
     } else {
         die('no zip file');
     }
 }
 header('Content-Type: text/event-stream');
 $size = 0;
 $max_size = 10000000;
 $id = time();
 $site = $_GET['site'];
 $file = $_GET['file'];
 $server->send_msg($id, 'Initializing');
 $is_dir = $server->is_dir($file);
 if (!$is_dir) {
     $files = array($file);
     if ($server->size($file) > $max_size) {
         $server->send_msg($id, 'File size limit exceeded ' . $file);
     }
 } else {
     $files = get_paths($file . '/');
     if (!$files) {
         $server->send_msg($id, 'File size limit exceeded');
         exit;
     }
 }
 $zip_file = tempnam("/tmp", "shiftedit_zip_");
 $zip = new ZipArchive();
 if ($zip->open($zip_file, ZipArchive::CREATE) !== TRUE) {
     die("cannot open <{$zip_file}>\n");
 }
 foreach ($files as $file) {