function getZipHeaderFilepointer($filename, &$MP3fileInfo)
{
    if (!function_exists('zip_open')) {
        $MP3fileInfo['error'] = "\n" . 'Zip functions not available (requires at least PHP 4.0.7RC1 and ZZipLib (http://zziplib.sourceforge.net/) - see http://www.php.net/manual/en/ref.zip.php)';
        return FALSE;
    } else {
        if ($zip = zip_open($filename)) {
            $zipentrycounter = 0;
            while ($zip_entry = zip_read($zip)) {
                $MP3fileInfo['zip']['entries']["{$zipentrycounter}"]['name'] = zip_entry_name($zip_entry);
                $MP3fileInfo['zip']['entries']["{$zipentrycounter}"]['filesize'] = zip_entry_filesize($zip_entry);
                $MP3fileInfo['zip']['entries']["{$zipentrycounter}"]['compressedsize'] = zip_entry_compressedsize($zip_entry);
                $MP3fileInfo['zip']['entries']["{$zipentrycounter}"]['compressionmethod'] = zip_entry_compressionmethod($zip_entry);
                //if (zip_entry_open($zip, $zip_entry, "r")) {
                //	$MP3fileInfo['zip']['entries']["$zipentrycounter"]['contents'] = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                //	zip_entry_close($zip_entry);
                //}
                $zipentrycounter++;
            }
            zip_close($zip);
            return TRUE;
        } else {
            $MP3fileInfo['error'] = "\n" . 'Could not open file';
            return FALSE;
        }
    }
}
Example #2
0
 private function read_data()
 {
     $data = array();
     while ($entry = zip_read($this->ref)) {
         $item = array("ref" => $entry, "name" => zip_entry_name($entry), "filesize" => zip_entry_filesize($entry), "compressedsize" => zip_entry_compressedsize($entry), "compressionmethod" => zip_entry_compressionmethod($entry));
         $name = $item["name"];
         $item["type"] = $name[strlen($name) - 1] == '/' ? RA_ZIP_DIRECTORY : RA_ZIP_FILE;
         $data[] = $item;
     }
     $this->content_data = $data;
 }
Example #3
0
 public function infosZip($src, $data = true)
 {
     if ($zip = zip_open(realpath($src))) {
         while ($zip_entry = zip_read($zip)) {
             $path = zip_entry_name($zip_entry);
             if (zip_entry_open($zip, $zip_entry, "r")) {
                 $content[$path] = array('Ratio' => zip_entry_filesize($zip_entry) ? round(100 - zip_entry_compressedsize($zip_entry) / zip_entry_filesize($zip_entry) * 100, 1) : false, 'Size' => zip_entry_compressedsize($zip_entry), 'NormalSize' => zip_entry_filesize($zip_entry));
                 if ($data) {
                     $content[$path]['Data'] = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                 }
                 zip_entry_close($zip_entry);
             } else {
                 $content[$path] = false;
             }
         }
         zip_close($zip);
         return $content;
     }
     return false;
 }
Example #4
0
File: zip.php Project: xepan/xepan
 function readFile($src, $filename)
 {
     $content = array();
     if ($zip = zip_open(realpath($src))) {
         while ($zip_entry = zip_read($zip)) {
             $path = zip_entry_name($zip_entry);
             if ($path == $filename) {
                 if (zip_entry_open($zip, $zip_entry, "r")) {
                     $content[$path] = array('Ratio' => zip_entry_filesize($zip_entry) ? round(100 - zip_entry_compressedsize($zip_entry) / zip_entry_filesize($zip_entry) * 100, 1) : false, 'Size' => zip_entry_compressedsize($zip_entry), 'UnCompSize' => zip_entry_filesize($zip_entry));
                     $content[$path]['Data'] = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                     zip_entry_close($zip_entry);
                 } else {
                     $content[$path] = false;
                 }
             }
         }
         zip_close($zip);
         return $content;
     }
     return false;
 }
Example #5
0
function unzip($zip_file)
{
    $zip_file = zip_open($zip_file);
    if ($zip_file) {
        while ($zip_entry = zip_read($zip_file)) {
            $name = zip_entry_name($zip_entry);
            $ext = substr($name, strrpos($name, '.') + 1);
            $size = zip_entry_filesize($zip_entry);
            $csize = zip_entry_compressedsize($zip_entry);
            $method = zip_entry_compressionmethod($zip_entry);
            if (zip_entry_open($zip_file, $zip_entry, "r")) {
                $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                zip_entry_close($zip_entry);
            }
            $zip[] = array('info' => array('name' => $name, 'ext' => $ext, 'actual_filesize' => $size, 'compressed_size' => $csize, 'compression_method' => $method), 'content' => $buf);
        }
        zip_close($zip_file);
        return $zip;
    } else {
        return false;
    }
}
Example #6
0
 public function compressedsize()
 {
     return zip_entry_compressedsize($this->handler);
 }
 public function ExtractZip($Filename)
 {
     $Files = array();
     $Zip = zip_open($Filename);
     if (!is_resource($Zip)) {
         return false;
     }
     while ($ZE = zip_read($Zip)) {
         $pi = pathinfo(zip_entry_name($ZE));
         $filesize = zip_entry_compressedsize($ZE);
         $filename = sprintf('%s.%s', md5($pi['filename']), $pi['extension']);
         $fullPath = UPLOAD . $filename;
         // check if file extension is allowed
         // check if file size is ok
         if (zip_entry_open($Zip, $ZE)) {
             $buf = zip_entry_read($ZE, zip_entry_filesize($ZE));
             $fh = fopen($fullPath, 'w+');
             fwrite($fh, $buf);
             fclose($fh);
             if (file_exists($fullPath)) {
                 $Files[] = array('Filename' => $fullPath, 'Original' => UPLOAD . basename(zip_entry_name($ZE)));
             }
             zip_entry_close($ZE);
         }
     }
     zip_close($Zip);
     return $Files;
 }
Example #8
0
        if ($bytes >= pow(1024, 2)) {
            $filesize = sprintf("%.2fMB", $bytes / pow(1024, 2));
        } else {
            if ($bytes >= 1024) {
                $filesize = sprintf("%.2fKB", $bytes / 1024);
            }
        }
    }
    return $filesize;
}
$zipfile = "error" . intval($_GET[PARAM_REPORTID]) . ".zip";
if (empty($_GET[PARAM_REPORTID]) || !is_numeric($_GET[PARAM_REPORTID])) {
    $output["rows"][] = array('<b>Bad report ID.</b>', "", "", "", "");
    die(json_encode($output));
}
$zip = @zip_open("../reports/" . $zipfile);
if (!file_exists("../reports/" . $zipfile) || !is_resource($zip)) {
    $output["rows"][] = array('<b>No detail found for this report.</b>', "", "", "", "");
    die(json_encode($output));
}
$output["rows"][] = array('-', '<a href="reports/' . $zipfile . '">Download</a>', '<div class="leftAlign">' . $zipfile . '</div>', '<div class="rightAlign"><b>' . format_filesize(filesize("../reports/" . $zipfile)) . '</b></div>', '<div class="rightAlign"><b>' . format_filesize(filesize("../reports/" . $zipfile)) . '</b></div>');
while ($zipfile = zip_read($zip)) {
    $filename = zip_entry_name($zipfile);
    $rawFilesize = zip_entry_filesize($zipfile);
    $filesize = format_filesize($rawFilesize);
    $compressed = format_filesize(zip_entry_compressedsize($zipfile));
    $viewLink = '<a href="api/file.php?' . PARAM_FILE . '=' . urlencode($filename) . '&amp;' . PARAM_REPORTID . '=' . $_GET[PARAM_REPORTID] . '" target="_blank">View</a>';
    $downloadLink = '<a href="api/file.php?' . PARAM_DOWNLOAD . '=1&amp;' . PARAM_FILE . '=' . urlencode($filename) . '&amp;' . PARAM_REPORTID . '=' . $_GET[PARAM_REPORTID] . '">Download</a>';
    $output["rows"][] = array($viewLink, $downloadLink, '<div class="leftAlign">' . $filename . '</div>', '<div class="rightAlign">' . $filesize . '</div>', '<div class="rightAlign">' . $compressed . '</div>');
}
echo json_encode($output);
function fm_view_zipped($file, $groupid)
{
    global $CFG, $USER;
    if ($file->folder == 0) {
        if ($groupid == 0) {
            $ziploc = $CFG->dataroot . "/" . fm_get_user_dir_space();
            //."/".$file->link;
        } else {
            $ziploc = $CFG->dataroot . "/" . fm_get_group_dir_space($groupid);
            //."/".$file->link;
        }
    } else {
        if ($groupid == 0) {
            $ziploc = $CFG->dataroot . "/" . fm_get_user_dir_space() . fm_get_folder_path($file->folder, false, $goupid);
            //."/".$file->link;
        } else {
            $ziploc = $CFG->dataroot . "/" . fm_get_group_dir_space($groupid) . fm_get_folder_path($file->folder, false, $goupid);
            //."/".$file->link;
        }
    }
    $filelist = array();
    $zip = zip_open($ziploc);
    if ($zip) {
        $count = 0;
        while ($zip_entry = zip_read($zip)) {
            $filelist[$count]->name = zip_entry_name($zip_entry);
            $filelist[$count]->actualsize = zip_entry_filesize($zip_entry);
            $filelist[$count]->compsize = zip_entry_compressedsize($zip_entry);
            $count++;
        }
        zip_close($zip);
    }
    return $filelist;
}
         echo '<tr><td>', zip_entry_name($ZipRead), '</td><td>';
         $S = 0;
         $B = sprintf('%u', zip_entry_filesize($ZipRead));
         while ($B >= 1024) {
             $B /= 1024;
             ++$S;
         }
         if ($S === 0) {
             echo $B, ' Bytes';
         } else {
             printf('%.3f %s', $B, $T[$S - 1]);
             $S = 0;
         }
         echo '</td><td>';
         $S = 0;
         $B = sprintf('%u', zip_entry_compressedsize($ZipRead));
         while ($B >= 1024) {
             $B /= 1024;
             ++$S;
         }
         if ($S === 0) {
             echo $B, ' Bytes';
         } else {
             printf('%.3f %s', $B, $T[$S - 1]);
             $S = 0;
         }
         echo '</td><td>', zip_entry_compressionmethod($ZipRead), '</td></tr>';
     }
     echo '</table>';
     zip_close($ZipRes);
 } else {
function Unzip($dir, $file, $destiny = "")
{
    $dir .= DIRECTORY_SEPARATOR;
    $path_file = $dir . $file;
    $zip = zip_open($path_file);
    $_tmp = array();
    $count = 0;
    if ($zip) {
        while ($zip_entry = zip_read($zip)) {
            $_tmp[$count]["filename"] = zip_entry_name($zip_entry);
            $_tmp[$count]["stored_filename"] = zip_entry_name($zip_entry);
            $_tmp[$count]["size"] = zip_entry_filesize($zip_entry);
            $_tmp[$count]["compressed_size"] = zip_entry_compressedsize($zip_entry);
            $_tmp[$count]["mtime"] = "";
            $_tmp[$count]["comment"] = "";
            $_tmp[$count]["folder"] = dirname(zip_entry_name($zip_entry));
            $_tmp[$count]["index"] = $count;
            $_tmp[$count]["status"] = "ok";
            $_tmp[$count]["method"] = zip_entry_compressionmethod($zip_entry);
            if (zip_entry_open($zip, $zip_entry, "r")) {
                $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                if ($destiny) {
                    $path_file = str_replace("/", DIRECTORY_SEPARATOR, $destiny . zip_entry_name($zip_entry));
                } else {
                    $path_file = str_replace("/", DIRECTORY_SEPARATOR, $dir . zip_entry_name($zip_entry));
                }
                $new_dir = dirname($path_file);
                // Create Recursive Directory
                mkdirr($new_dir);
                $fp = fopen($dir . zip_entry_name($zip_entry), "w");
                fwrite($fp, $buf);
                fclose($fp);
                zip_entry_close($zip_entry);
            }
            echo "\n</pre>";
            $count++;
        }
        zip_close($zip);
    }
}
Example #12
0
$data_uncompressed_size = 0;
$data_used_size = 0;
$data_overhead_size = 0;
$update_entries = array();
$update_entry_maxlen = 0;
foreach ($update_file as $update_line) {
    list($file, $hash) = explode(' ', trim($update_line), 2);
    $update = array('file' => $file, 'adler32' => $hash, 'filesize' => filesize($file), 'size' => 0, 'used_entry_count' => 0, 'used_size' => 0, 'uncompressed_size' => 0);
    $update_file_maxlen = max($update_file_maxlen, strlen($file));
    $entries = array();
    $zip = zip_open(realpath($file));
    if ($zip && !is_int($zip)) {
        while ($zip_entry = zip_read($zip)) {
            $update['uncompressed_size'] += zip_entry_filesize($zip_entry);
            $entry_name = zip_entry_name($zip_entry);
            $entry_size = zip_entry_compressedsize($zip_entry);
            $entry_used = !array_key_exists($entry_name, $update_entries);
            $entries[$entry_name] = array('name' => $entry_name, 'size' => $entry_size, 'used' => $entry_used);
            $update['size'] += $entry_size;
            if ($entry_used) {
                $update['used_entry_count']++;
                $update['used_size'] += $entry_size;
                $update_entries[$entry_name] = $update;
            }
            $update_entry_maxlen = max($update_entry_maxlen, strlen($entry_name));
        }
        zip_close($zip);
    } else {
        $update['zip_error'] = $zip or true;
    }
    ksort($entries);
Example #13
0
function filemgr($cmd, $stroka, $path, $fileforaction, $mask, $pid)
{
    // is a part filemgr- fileio
    //hidekey ("pid",$pid);
    global $defaultpath, $protect, $prauth, $ADM, $pr, $sd;
    //..,$file
    global $filemgrmod, $daysleft, $codekey, $noscreenmode, $maxmgrs, $OSTYPE, $coreredir;
    global $multiaction, $scriptpath, $scriptpath;
    if ($codekey == 4) {
        needupgrade();
    }
    $file = $fileforaction;
    global $filscheader, $filscdata, $filscplevel, $filsccount, $languageprofile;
    if ($filscdata) {
        if ($filsccount < 1) {
            echo "Filemgr don't have configured scripts<br>";
        } else {
            echo "";
        }
        //additional keys by   filescript.cfg and starting it
        // 4.3.4добавлено: cmsg не отрабатывает теперь значения начинающиеся с точки
        // filescript для генерации кнопок исполнения скриптов ,  заданных администраторами.
        // dbscore - исправлена ошибка из за которой иногда не вычислялся count
        //версия конфигов при создании конфигурации теперь берется из ядра
        //..+++if (!$unauthorized) { //незарегистрированные в любом случае не будут видеть список пользователей ресурса в раздаче.
        // теперь репозитории работать будут раздельно, проприетарная версия будет отличатся только возможностью подключать специальные модули.
        //если вы не планируете их заказывать можно использоватьобычную версию.
        $keylanguage = 1;
        //if not detected;  function detectlanguageidfromheader
        for ($i = 0; $i < 30; $i++) {
            //echo "DEBUG ibane $filscheader[$i],  languageprofile=$languageprofile<br>";
            // echo  "iDEBUG (".substr($filscheader[$i],0,6)."==".substr($languageprofile,0,6).") <br>";
            if (substr($filscheader[$i], 0, 6) == substr($languageprofile, 0, 6)) {
                $keylanguage = $i;
            }
            // теперь хрен открутится, правда ограничились 6 знаками но пофиг , главное ?  не пролезет
            // if (strpos ($filscheader[$i],$languageprofile)) $keylanguage=$i;
            // ну вот почему всегда вместо простой функции приходится городить черт знает что.
            //  if ($filscheader[$i]==$languageprofile) $keylanguage=$i; // придется сделать по дебильному - ибо // что за ? - откуда оно взялось блджад!!!!
        }
        if ($keylanguage == 29) {
            $keylanguage = 1;
        }
        //if
    }
    //..потом добавим проверку на дебильный символ в конце любой строки с утф...вообще бы в парсере как то опознавание глючны файлов сделать
    if ($filscdata) {
        //echo "<br>DEBUG Script:$cmd Key=$keylanguage Lang=$languageprofile Selected=".$filscheader[$keylanguage]."<br>";
        for ($i = 1; $i < $filsccount; $i++) {
            // echo "debug $i = $filscdata[$i][$keylanguage]   , key=[$keylanguage]<br>";
            // plevel checking NOT added!!!!  graphical icon NOT released!  CFG OPT FUTURE disable all scripts not added
            //echo "  if (".$filscdata[$i][$keylanguage]."==$cmd) <br>";
            if ($filscdata[$i][$keylanguage] . $pid === $cmd) {
                $plevelrequired = $filscdata[$i][3];
                $directcommand = $filscdata[$i][2];
                if ($debug) {
                    echo "DEBUG Command= {$directcommand} (rightsreq={$plevelrequired})<br>";
                }
            }
            //path2 redirector?
            if (strlen($directcommand) < 2) {
                continue;
            }
            $massivedynamics = 0;
            if ($debug) {
                echo "DEBUG for (i=1;i<" . strlen($directcommand) . ");{$i}++) {<br>";
            }
            $parsedcommand = $directcommand;
            //echo "здесь должен быть выход ибо сцуко виснет ";
            for ($i = 1; $i < strlen($directcommand) + 5; $i++) {
                $a1 = strpos($directcommand, "%", $i + 0) + 1;
                if ($a1) {
                    $massivedynamics++;
                    $a2 = strpos($directcommand, "%", 0 + $a1 + 1);
                    //this is first   просто это первый , общественный российский.
                    //echo "Try to corrent schetckik -LAAA!!!$i+$a2-1!!!!!!!new $i==$a2!!!!!!!!!!!!!!!!;<br>       ";
                    $oldi = $i;
                    //$i=$i+($a2-1);  почти верно
                    $i = $a2;
                    //echo "old i=$oldi  new i=$i<br>";
                    if ($oldi > $i) {
                        //echo "Logic error, breaking cycling<br>";
                        $i = $oldi;
                        $i = 100500;
                        continue;
                    }
                    $firstcoord[$massivedynamics] = $a1;
                    $lastcoord[$massivedynamics] = $a2;
                    $cut = substr($directcommand, $a1, $a2 - $a1);
                    $cutnow[$massivedynamics] = $cut;
                    $cutwprc = substr($directcommand, $a1 - 1, $a2 - $a1 + 2);
                    $cutwpercent[$massivedynamics] = $cutwprc;
                    $md = $massivedynamics;
                    if ($debug) {
                        echo "DEBUG Parse [{$i}] param=:: f=" . $firstcoord[$md] . " ; a2-l=" . $lastcoord[$md] . ";- is cut=" . $cutnow[$md] . " = %%::<blu>" . $cutwpercent[$md] . "</blu> = <grn>" . ${$cut} . "</grn><br>";
                    }
                    $replaceto = ${$cut};
                    // fukken shit - admin.php?/   а где все остальное?  крап$parsedcommand=str_replace ($parsedcommand, $cutwprc,$replaceto, $count=1);
                    $parsedcommand = str_replace($cutwprc, $replaceto, $parsedcommand, $count = 2);
                }
                //al@al-desktop:/media# mencoder
                //mencoder: relocation error: mencoder: symbol codec_wav_tags, version LIBAVFORMAT_52 not defined in file libavformat.so.52 with link time reference
            }
        }
        if ($debug) {
            echo "DEBUG Parsed command :: {$parsedcommand}<br>";
        }
        if ($parsedcommand) {
            echo " executing (if you enable system () of course )...<br>";
            $x = system($parsedcommand);
            //ping
            $f = fopen("_logs/cmd.log", "w");
            if ($f) {
                fwrite($f, $x);
            }
            fclose($f);
            lprint("5MIN");
            if ($debug) {
                echo "DEBUG {$x}";
            }
        }
        //    ob_flush () ;
        ////exit;
    }
    //echo "ACTION:cmd=$cmd,str ok,path ok,file=$fileforaction,pid=$pid>";// -+++-
    $path = str_replace("\\\\", "\\", $path);
    // проверка на вшивость -
    //$path=str_replace ("/","\\",$path);
    if ($cmd == cmsg("FMG_CPY_F") and $prauth[$ADM][12]) {
        global $path2;
        copy($path . $fileforaction, $path2 . $fileforaction);
        echo "copy({$path}{$fileforaction},{$path2});";
        echo cmsg("CP_END");
    }
    if ($cmd == cmsg("FMG_MOV_F") and $prauth[$ADM][12]) {
        global $path2;
        copy($path . $fileforaction, $path2 . $fileforaction);
        unlink($path . $fileforaction);
        echo cmsg("MOV_END");
    }
    if ($pr[101]) {
        if ($cmd == cmsg("FMG_DOWNLOAD") and $prauth[$ADM][9]) {
            ob_clean();
            $err = sendfile($path . "/" . $fileforaction);
        }
    }
    //костыль, ибо на некоторых тупых компьютерах почему то пропадает косая и соответственно файл скачать невозможно. куда она пропадает никто не знает.
    if ($cmd == cmsg("FMG_DOWNLOAD") and $prauth[$ADM][9]) {
        ob_clean();
        $err = sendfile($path . $fileforaction);
    }
    if ($cmd == cmsg("FMG_UPLOAD") and $prauth[$ADM][36] or $cmd == cmsg("FMG_DUMP_UPLOAD") and $prauth[$ADM][36]) {
        $path = del_endslash($path);
        //	if ($codekey==7) demo ();
        //<input type="hidden" name="MAX_FILE_SIZE" value="8000000000">
        ?>
<form enctype="multipart/form-data" action="filemgr.php" method="post">
	<input name=userfile type=file class=buttonS> <input type=Submit name=go class=buttonS>
	<input type = hidden name = path value ="<?php 
        echo $path;
        ?>
"><?php 
        hidekey("pid", $pid);
        if ($cmd == cmsg("FMG_DUMP_UPLOAD")) {
            echo "Dump loading.<br>";
        }
        echo "</form>";
        hidekey("write", $cmd);
        exit;
        //moved from non-function zone
    }
    //возможно сюда присобачим кнопку удаления из админки точнее ссылки с нее из w.php :)
    //if (($cmd==cmsg("FMG_UNSHARE"))and($prauth[$ADM][36])) {    echo "not implemented";}
    if ($cmd == cmsg("FMG_SHARE") and $prauth[$ADM][36] or $coreredir == "SH_UPDD_FL") {
        $path = del_endslash($path);
        // -- SHARE STEP 1 --
        if ($multiaction) {
            global $filearrcount;
            // 0
            if ($filearrcount > 0) {
                exit;
            }
            // disables FMG_SHARE for cycle executing;  only one action allowed for one or multiaction files.
            global $fileforaction;
            $filearrcount = count($fileforaction);
        }
        // праздник главное вовремя закончить  тогда он ьудет долго помниться как приятное событие
        // multiaction==1  CFG OPT FUTURE  должен добавлять много файлов по идее, однако пока отрабатывается по файлу за раз.
        if ($multiaction) {
            echo "Multiaction mode.  Selected files={$filearrcount}<br>";
        }
        //..if ($multiaction==1) {global $filearrcount;$stroka.=$filearrcount;};
        if (!$multiaction) {
            $file = $path . "/" . $fileforaction;
        }
        if ($multiaction) {
            for ($a = 0; $a < $filearrcount; $a++) {
                $file[$a] = $path . "/" . $fileforaction[$a];
                echo "File {$a}: {$fileforaction[$a]}<br>;";
            }
            $filelistmassive = base64_encode(implode($fileforaction, "¦"));
            //список и число объектов надо передать вместе с multiaction
        }
        //лучше всего массив с файлами передать в виде одной переменной
        if ($coreredir == "SH_UPDD_FL") {
            // maybe
            if (!$multiaction) {
                global $destinationfilename, $filesizeinmb;
                $file = $destinationfilename;
            }
            if ($multiaction) {
                global $destinationfilename, $filesizeinmb;
                echo "SH_UPDD_FL unimplemented<br>";
                echo "I dont know where i take destfilename {$destinationfilename} -- {$file} (file)<bR>";
                //   $file=$destinationfilename;
            }
        }
        ?>
<form enctype="multipart/form-data" action="filemgr.php" method="post"><?php 
        if (!$multiaction) {
            echo "File: {$file}<br>";
        }
        //Sif (!$multiaction) {   echo "File: $file<br>";}
        lprint(GEN_OPT);
        echo "<br>";
        radio("share", "#GENLNK_UNREG", "GENLNK_UNREG");
        echo "<br>";
        radio("share", "FMG_UNSHARE", "FMG_UNSHARE");
        echo "<br>";
        if (!$pr[70]) {
            radio("share", "GENLNK_REG", "GENLNK_REG");
            if ($ADM < 1) {
                lprint("FILE_UNAUTH_NOTE");
            }
            echo "<br>";
            if ($ADM > 0) {
                radio("share", "GEN_PLVL_USR", "GEN_PLVL_USR");
                echo "<select name=groupplevels>";
                for ($a = 0; $a < 10; $a++) {
                    echo "<option>" . $a;
                }
                echo "</select>";
                //if ($ADM<1) lprint ("FILE_UNAUTH_NOTE"); - check unauthorized access
                echo "<br>";
                //незарегистрированные в любом случае не будут видеть список пользователей ресурса в раздаче.
                radio("share", "GENLNK_USR", "GENLNK_USR");
                echo "<br>";
                echo "<select name=\"username[]\" multiple size=15>";
                for ($a = 1; $a < count($prauth); $a++) {
                    echo "<option>" . $prauth[$a][0] . "";
                    $cnt++;
                }
                echo "</select>";
            }
            echo "<br>";
        }
        lprint(COMM);
        inputtext("commfile", 15, $commfile);
        echo "<br>";
        if ($prauth[$ADM][2]) {
            checkbox(1, "yes");
            lprint(GEN_FL_EPX);
        } else {
            hidekey("yes", 1);
        }
        checkbox(1, "srchen");
        lprint(GEN_FILENSRCH);
        echo "<br>";
        if ($coreredir == "SH_UPDD_FL") {
            hidekey("coreredir", "step2");
        }
        if (!$multiaction) {
            hidekey("file", $file);
        }
        if ($multiaction) {
            hidekey("multiactionsign", $multiaction);
            hidekey("file", $filelistmassive);
            $path = add_endslash($path);
            hidekey("pathmulti", base64_encode($path));
            hidekey("filelistmassive", $filelistmassive);
            //посылаем дважды на пробу   и каждый раз нихрена нет почему то  какого ???
            hidekey("filearrcount", $filearrcount);
        }
        submitkey("go", "FMG_SHARE");
        // кнопка раздать файл
        hidekey("pid", $pid);
        ?>
</form>
<?php 
        echo " ";
        hidekey("write", $cmd);
        if ($multiaction == 1) {
            exit;
        }
        //   !
        ////moved from non-function zone -- SHARE STEP 1 -- ENDING
        //ЭТО ОКончание первого шага раздачи
    }
    //
    //	echo "Мы получили из пред сессии  $cmd $fileforaction!<br> <BR>";   ikonki mlya !
    //echo "<br>".cmsg ("FMG_MHLP")."<br>";  ХЕЛП ОТКЛЮЧЕН
    if ($noscreenmode == false) {
        echo "";
    }
    //тут пишем команды и выполняем их
    //echo "628_Failure-- protect::";print_r ($protect); неправильно обрабатывался массив  почему то вместо него шла переменная о_О CFG OPT FUTURE
    if (is_Array($protect)) {
        if (!$prauth[$ADM][38]) {
            $protect[] = "*.php";
        }
    }
    // скрываем файлы скрипта чтобы их никто не стер.
    //$protect[]="*.key";// не снимать комментарий - безопасность снизится до 0
    //if ($OSTYPE=="LINUX") if (($sd[10])AND($ADM==0)) $path=$path."/";  //bug with unregistered users  folder lost /
    //if ($OSTYPE=="WINDOWS") if (($sd[10])AND($ADM==0)) $path=$path."\\";
    if ($OSTYPE == "WINDOWS") {
        if ($cmd == cmsg("FMG_ENTER") and $prauth[$ADM][7]) {
            $path = $path . $fileforaction . "\\";
        }
    }
    if ($OSTYPE == "LINUX") {
        if ($cmd == cmsg("FMG_ENTER") and $prauth[$ADM][7]) {
            $path = $path . $fileforaction . "/";
        }
    }
    if ($OSTYPE == "WINDOWS") {
        if ($cmd == cmsg("FMG_DRV") and $prauth[$ADM][8]) {
            $path = $stroka . ":/";
        }
    }
    if ($OSTYPE == "LINUX") {
        if ($cmd == cmsg("FMG_DRV") and $prauth[$ADM][8]) {
            $path = "/media/{$stroka}/";
        }
    }
    if ($OSTYPE == "LINUXALT") {
        if ($cmd == cmsg("FMG_DRV") and $prauth[$ADM][8]) {
            $path = "/mnt/{$stroka}/";
        }
    }
    //CFG OPT FUTURE
    if ($OSTYPE == "WINDOWS") {
        if ($cmd == cmsg("FMG_EXIT") and $prauth[$ADM][7]) {
            $path = dirname($path) . "\\";
        }
    }
    //$path=folderupdir ($path);
    if ($OSTYPE == "LINUX") {
        if ($cmd == cmsg("FMG_EXIT") and $prauth[$ADM][7]) {
            $path = dirname($path) . "/";
        }
    }
    if ($cmd == cmsg("FMG_SRCH") and $prauth[$ADM][7]) {
        $file = $path . $fileforaction;
        // далее скрипт рассчитан на эту переменную, к томуже массив стереть надо:)
        $a = searchplus($file, $fileforaction, $stroka);
        if ($pr[12]) {
            $act = "FILEMGR_SRCH {$cmd} {$file} word={$stroka}";
            logwrite($act);
        }
        // логируемся
        //if ($a==false) die ("<br>Ошибка!Файл $file не найден!!!.<br>");
        echo " <form action=filemgr.php method=post>";
        hidekey("pid", $pid);
        hidekey("write", $cmd);
        submitkey("cmd" . $pid, "FMG_RESET");
        echo "</form>";
        exit;
    }
    //If ($prauth[$ADM][2]==true) {
    // blocked commands
    if ($cmd == cmsg("FMG_MKDIR") and $prauth[$ADM][12]) {
        //if ($codekey==7) demo ();
        if ($multiaction == 1) {
            global $filearrcount;
            $stroka .= $filearrcount;
        }
        $err = mkdir($path . $stroka);
    }
    //if ($cmd==cmsg("FMG_DELALL")) $err=rmdir ($path.$fileforaction);
    if ($cmd == cmsg("FMG_JOINFIL") and $prauth[$ADM][12]) {
        if ($codekey == 7) {
            demo();
        }
        $err = joinfiles($path, $mask, $protect, $stroka);
    }
    if ($cmd == cmsg("FMG_DELALL") and $prauth[$ADM][13]) {
        // rmdir теперь  полное удаление (!)
        if ($codekey == 7) {
            demo();
        }
        if ($prauth[$ADM][5] == true) {
            if ($stroka == "accept") {
                $err = kill_dir($path . $fileforaction);
            } else {
                echo "Вы не сказали accept";
            }
        } else {
            msgexiterror("notright", "", "disable");
            exit;
        }
        // круто удаляет отключим
    }
    if ($cmd == cmsg("FMG_EXECUTE") and $prauth[$ADM][8]) {
        if ($codekey == 7) {
            demo();
        }
        echo cmsg("FMG_MOD_IN") . "<br>";
        require $filemgrmod;
        echo cmsg("FMG_MOD_OUT") . "<br>";
    }
    if ($OSTYPE == "LINUX") {
        if ($cmd == cmsg("FMG_UNRAR") and $prauth[$ADM][12]) {
            $file = $path . $fileforaction;
            //rar_open rar_list PHP by standart is unsupported!!!
            $unrared = substr($fileforaction, 0, strrpos($fileforaction, '.'));
            // elf  elfkz  удаляем расширение рар
            @mkdir($path . $unrared);
            echo "Creating folder {$unrared}<br>";
            $extractionpoint = $path . $unrared;
            echo "Extracting to " . $extractionpoint . ";<br>";
            $zip = system("unrar x \"{$file}\" \"{$extractionpoint}\"");
            echo "<br>Result={$zip}  ";
            //echo '"unrar e \"'.$file.'\" \"'.$extractionpoint.'\""'; echo " <br>";
        }
    }
    if ($OSTYPE == "LINUX") {
        if ($cmd == cmsg("FMG_RAR") and $prauth[$ADM][12]) {
            $file = $path . $fileforaction;
            //rar_open rar_list PHP by standart is unsupported!!!
            $unrared = substr($fileforaction, 0, strrpos($fileforaction, '.'));
            // elf  elfkz  удаляем расширение рар
            // @mkdir ($path.$unrared);
            // echo "Creating folder $unrared<br>";
            $extractionpoint = $path . $unrared;
            echo "Archiving to  to " . $fileforaction . ".rar;<br>";
            $zip = system("rar a \"{$fileforaction}\".rar \"{$file}\"");
            echo "<br>Result={$zip}  ";
            //echo '"unrar e \"'.$file.'\" \"'.$extractionpoint.'\""'; echo " <br>";
        }
    }
    if ($cmd == cmsg("FMG_UNZIP") and $prauth[$ADM][12]) {
        $file = $path . $fileforaction;
        //rar_open rar_list PHP by standart is unsupported!!!
        $zip = zip_open($file);
        $unrared = substr($fileforaction, 0, strrpos($fileforaction, '.'));
        // elf  elfkz  удаляем расширение рар
        @mkdir($path . $unrared);
        if ($zip) {
            while ($zip_entry = zip_read($zip)) {
                echo "Name: " . zip_entry_name($zip_entry) . "\n";
                echo "Actual Filesize: " . zip_entry_filesize($zip_entry) . "\n";
                echo "Compressed Size: " . zip_entry_compressedsize($zip_entry) . "\n";
                echo "Compression Method: " . zip_entry_compressionmethod($zip_entry) . "\n";
                if (zip_entry_open($zip, $zip_entry, "r")) {
                    echo "File Contents:\n";
                    $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                    //echo "$buf\n";
                    $x = fopen($path . zip_entry_name($zip_entry), "w");
                    @fwrite($x, $buf);
                    @fclose($x);
                    zip_entry_close($zip_entry);
                }
                echo "\n";
            }
            zip_close($zip);
        }
    }
    if ($cmd == cmsg("FMG_TEST")) {
        //at this moment start new script
        echo cmsg("FMG_MOD_IN") . "<br>";
        require "mp3runonce.php";
        echo cmsg("FMG_MOD_OUT") . "<br>";
    }
    if ($cmd == cmsg("FMG_DEL") and $prauth[$ADM][13]) {
        if ($codekey == 7) {
            demo();
        }
        @($err1 = unlink($path . $fileforaction));
        @($err2 = rmdir($path . $fileforaction));
    }
    if ($cmd == cmsg("FMG_NEW") and $prauth[$ADM][12]) {
        //if ($codekey==7) demo ();
        //echo "ibane ug if ($multiaction==1) {global $filearrcount;$stroka.=$filearrcount;};<br>";
        if ($multiaction == 1) {
            global $filearrcount;
            $stroka .= $filearrcount;
        }
        @($err = fopen($path . $stroka, "r"));
        if ($err == false) {
            $err = fopen($path . $stroka, "a");
        }
    }
    if ($cmd == cmsg("FMG_REN") and $prauth[$ADM][12]) {
        if ($codekey == 7) {
            demo();
        }
        if ($multiaction == 1) {
            global $filearrcount;
            $stroka .= $filearrcount;
        }
        $err = rename($path . $fileforaction, $path . $stroka);
    }
    if ($cmd == cmsg("FMG_EDIT") and $prauth[$ADM][12]) {
        if ($codekey == 7) {
            demo();
        }
        $err = simpleedit($path . $fileforaction, $stroka);
    }
    if ($pr[12]) {
        $act = "FILEMGR_CMD {$cmd} {$file}({$path} {$fileforaction}) word={$stroka}";
        if ($cmd) {
            if ($cmd !== cmsg("FMG_ENTER") and $cmd !== cmsg("FMG_EXIT")) {
                logwrite($act);
            }
        }
    }
    // логируемся
    // } else { echo "<br><font color=red id=errfnt>".cmsg ("LIM")."</font>".cmsg ("FMG_HLP2");}
    #selectin files using  fileio.php
    if (!$path or $cmd == cmsg("FMG_RESET")) {
        $path = $defaultpath;
        $mask = "*.*";
        $file = "";
        $stroka = "";
    }
    //$path=str_replace ("//","/",$path);проверка на вшивость -
    if ($err) {
        echo "{$err} <br>";
    }
    //global disables visual menu for executing action
    if (!$multiaction) {
        // start menu show
        // маска для файла может быть поиск по части имени и поиск по формату
        //выделить обращение к директории и режим парсинга (маска)
        //насчет маски - возможно стоит ее добавить в поисковик МЕ
        if ($pid == 1) {
            if ($pr[86]) {
                if ($pr[87] or $prauth[$ADM][7]) {
                    //либо право на чтение у юзера, либо разрешение искать всем.
                    echo "<br><form action=filemgr.php method=post>";
                    lprint("SRCH_FILE");
                    inputtxt("searchfilenew", 30);
                    submitkey("start", "DALEE");
                    echo "</form>";
                    if ($searchfilenew) {
                        echo $searchfilenew;
                    }
                }
            }
        }
        echo "<form action=filemgr.php method=post>";
        hidekey("write", $cmd);
        //выделить отдельно модуль создания меню выбора файла.
        $file = getdirdata($path, $mask, $protect);
        //print_r ($file);
        if ($file) {
            asort($file);
        }
        $dircnt = count($file);
        if ($ADM > 0) {
            echo "<font color=blue>{$path}</font><br>";
        }
        hidekey("pid", $pid);
        // cобственно это и мешает многооконной идее ))   вроде теперь кое-
        for ($a = 1; $a < $maxmgrs + 1; $a++) {
            // save pid data
            $strokaname = "stroka" . $a;
            $pathname = "path" . $a;
            $fileforactionname = "fileforaction" . $a;
            $maskname = "mask" . $a;
            global ${$strokaname}, ${$pathname}, ${$fileforactionname}, ${$maskname};
            ${$pathname} = str_replace("\\\\", "\\", ${$pathname});
            ${$pathname} = str_replace("\\\\", "\\", ${$pathname});
            if ($OSTYPE == "WINDOWS") {
                $path = str_replace("\\\\", "\\", $path);
            }
            // проверка на вшивость -
            if ($OSTYPE == "LINUX") {
                $path = str_replace("\\\\", "\\", $path);
            }
            // проверка на вшивость -xc
            hidekey("stroka" . $a, ${$strokaname});
            hidekey("mask" . $a, ${$maskname});
            hidekey("path" . $a, ${$pathname});
            hidekey("fileforaction" . $a, ${$fileforactionname});
        }
        //lprint ("FMG_CREATE");
        if ($ADM > 0) {
            inputtext("stroka" . $pid, 15, $stroka);
        }
        //<textarea type = text name=stroka<?=$pid  cols= 15 rows=1 wrap=NONE><?=$stroka; </textarea>
        if ($ADM > 0) {
            $hidefolder = $prauth[$ADM][52];
        } else {
            $hidefolder = $pr[73];
        }
        if (!$hidefolder) {
            lprint("FMG_MASK");
            inputtext("mask" . $pid, 15, $mask);
        }
        //<textarea type = text name=mask<?=$pid  cols= 7 rows=1 wrap=NONE><?=$mask; </textarea> <?
        if ($noscreenmode) {
            if ($prauth[$ADM][7]) {
                //FMG.pid удален
                echo "generate cmd{$pid}<br>";
                //$cmdx="cmd".$pid;
                //работает но передает только вторую букву [1] FIXED?
                submitkey("cmd", "FMG_SRCH");
                submitkey("cmd", "FMG_ENTER");
                submitkey("cmd", "FMG_EXIT");
            }
            if ($prauth[$ADM][8]) {
                submitkey("cmd", "FMG_DRV");
                if ($filemgrmod and $prauth[$ADM][2] == true) {
                    submitkey("cmd", "FMG_EXECUTE");
                }
            }
            if ($prauth[$ADM][12]) {
                submitkey("cmd", "FMG_MKDIR");
                submitkey("cmd", "FMG_JOINFIL");
                submitkey("cmd", "FMG_UNZIP");
                submitkey("cmd", "FMG_TEST");
                if ($OSTYPE == "LINUX") {
                    submitkey("cmd", "FMG_UNRAR");
                }
                if ($OSTYPE == "LINUX") {
                    submitkey("cmd", "FMG_RAR");
                }
                submitkey("cmd", "FMG_REN");
                submitkey("cmd", "FMG_EDIT");
                submitkey("cmd", "FMG_NEW");
            }
            if ($prauth[$ADM][13]) {
                submitkey("cmd", "FMG_DELALL");
                submitkey("cmd", "FMG_DEL");
            }
            if ($prauth[$ADM][9]) {
                submitkey("cmd", "FMG_DOWNLOAD");
            }
            if ($prauth[$ADM][36]) {
                submitkey("cmd", "FMG_UPLOAD");
            }
            if ($prauth[$ADM][54]) {
                submitkey("cmd", "FMG_SHARE");
                //	 submitkey ("cmd","FMG_UNSHARE");
            }
            if (!$pr[75]) {
                submitkey("cmd", "FMG_REF");
                submitkey("cmd", "FMG_RESET");
            }
            if (!$hidefolder) {
                submitkey("cmd", "FMG_MASKAPPLY");
            }
            //scripting showkey mechanism
            if ($filscdata) {
                echo "<br>Configured scripts:<br>";
                for ($i = 1; $i < $filsccount; $i++) {
                    // echo "debug $i = $filscdata[$i][$keylanguage]   , key=[$keylanguage]<br>";
                    if ($filscdata[$i][$keylanguage] == "") {
                        continue;
                    }
                    submitkey("cmd", "." . $filscdata[$i][$keylanguage]);
                }
                //  fwrite ($a,"ID¦NAME¦Script¦Plevel¦keynames-icon¦russian¦english¦f1_russian¦f1_english¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦".$addOSenter);
                /*.*1¦mencoder %path%%file% -oac mp3lame -ovc x264 -o %path%%file%.avi¦0¦0¦перекодить в h264¦encode h264¦0¦0¦0¦0¦0
                2¦mencoder %path%%file% -oac mp3lame -ovc mpg -o %path%%file%.avi¦0¦0¦перекодить в mpeg¦encode mpeg¦0¦0¦0¦0¦0¦0
                */
            }
        }
        if ($noscreenmode == false) {
            if ($prauth[$ADM][7]) {
                submitimg("cmd" . $pid, "FMG_SRCH", "_ico/target.png");
                submitimg("cmd" . $pid, "FMG_ENTER", "_ico/openfolder.png");
                submitimg("cmd" . $pid, "FMG_EXIT", "_ico/folderup.png");
            }
            if ($prauth[$ADM][8]) {
                submitimg("cmd" . $pid, "FMG_DRV", "_ico/drv.png");
                submitimg("cmd" . $pid, "FMG_EXECUTE", "_ico/execute.png");
            }
            if ($prauth[$ADM][12]) {
                submitimg("cmd" . $pid, "FMG_MKDIR", "_ico/newfolder.png");
                submitimg("cmd" . $pid, "FMG_REN", "_ico/rename.png");
                submitimg("cmd" . $pid, "FMG_EDIT", "_ico/editfmg.png");
                submitimg("cmd" . $pid, "FMG_NEW", "_ico/newfile.png");
                submitimg("cmd" . $pid, "FMG_JOINFIL", "_ico/joinfiles.png");
                submitimg("cmd" . $pid, "FMG_UNZIP", "_ico/backup.png");
                submitimg("cmd" . $pid, "FMG_TEST", "_ico/apply_f2.png");
                if ($OSTYPE === "LINUX") {
                    submitimg("cmd" . $pid, "FMG_UNRAR", "_ico/backup.png");
                }
                if ($OSTYPE === "LINUX") {
                    submitimg("cmd" . $pid, "FMG_RAR", "_ico/backup.png");
                }
            }
            if ($prauth[$ADM][13]) {
                if ($prauth[$ADM][5] == true) {
                    submitimg("cmd" . $pid, "FMG_DELALL", "_ico/removefolder.png");
                }
                submitimg("cmd" . $pid, "FMG_DEL", "_ico/removefile.png");
            }
            if ($prauth[$ADM][9]) {
                submitimg("cmd" . $pid, "FMG_DOWNLOAD", "_ico/download.png");
            }
            if ($prauth[$ADM][36]) {
                if (!$pr[75]) {
                    submitimg("cmd" . $pid, "FMG_UPLOAD", "_ico/upload.png");
                }
                if ($pr[75]) {
                    submitimg("cmd" . $pid, "FMG_UPLOAD", "_ico/uploadalt.png");
                }
            }
            if ($prauth[$ADM][54]) {
                submitimg("cmd" . $pid, "FMG_SHARE", "_ico/w_accept.png");
                //submitimg ("cmd".$pid,"FMG_UNSHARE","_ico/w_close.png");
            }
            if (!$pr[75]) {
                submitimg("cmd" . $pid, "FMG_REF", "_ico/refresh.png");
                submitimg("cmd" . $pid, "FMG_RESET", "_ico/reset.png");
            }
            if (!$hidefolder) {
                submitimg("cmd" . $pid, "FMG_MASKAPPLY", "_ico/stargreen.png");
            }
        }
        if ($pid == 1 and $prauth[$ADM][12]) {
            // только 1 раз исполняется этот блок .  на 1 пиде.
            echo "<br>";
            echo cmsg("FMG2");
            submitimg("cmd" . $pid, "FMG_CPY_F", "_ico/copyfile.png");
            echo " ";
            submitimg("cmd" . $pid, "FMG_MOV_F", "_ico/movefile.png");
            echo " ";
            //submitimg ("cmd".$pid,"FMG_CPY_FLD","_ico/copyfolder.png");echo " ";
            submitimg("cmd" . $pid, "FMG_MOV_FLD", "_ico/movefolder.png");
            echo " ";
        }
        ?>
 <input type = hidden name = path<?php 
        echo $pid;
        ?>
 value ="<?php 
        echo $path;
        ?>
" >
<?php 
        if ($hidefolder) {
            unset($file);
        }
        //no filelist
        if ($file) {
            echo "<BR>" . cmsg("FMG_FILDB") . ":<select name =fileforaction" . $pid . "[] multiple size = " . $prauth[$ADM][49] . ">";
            sort($file);
            //нет реакции... print_r ($file); echo "Rewefkowe";
            for ($a = 0; $a < $dircnt; $a++) {
                if ($file[$a][0] === ".") {
                    continue;
                }
                if ($file[$a][0] === "..") {
                    continue;
                }
                if ($file[$a][0] === false) {
                    continue;
                }
                if ($file[$a][1]) {
                    $dir = "==>";
                } else {
                    $dir = "";
                }
                $fsizer = "";
                if ($dir !== "==>") {
                    $fsize = $file[$a][2];
                    // settype ($fsizer,"string");
                    if ($fsize < 1024) {
                        $fsizer = "[" . round($fsize, 1) . "b]";
                    }
                    if ($fsize < 1) {
                        $fsizer = "";
                    }
                    if ($fsize > 1024) {
                        $fsizer = "[" . round($fsize / 1024, 1) . "Kb]";
                    }
                    if ($fsize > 1024 * 1024) {
                        $fsizer = "[" . round($fsize / 1024 / 1024, 2) . "Mb]";
                    }
                    if ($fsize > 1024 * 1024 * 1024) {
                        $fsizer = "[" . round($fsize / 1024 / 1024 / 1024, 2) . "Gb]";
                    }
                }
                //$filesizemb=$file[$a][2]/1024;
                echo "<option value=\"" . $file[$a][0] . "\">" . $dir . $file[$a][0] . "" . $fsizer . "</option>";
            }
            // size (".$file[$a][2].")
            if ($pr[11] == 1) {
                //protected cmds
            }
            echo "</select></form>";
        }
        echo "<br>";
        $dbsdiskfree = round((int) (@disk_free_space($path) / (1024 * 1024 * 1024)), 1);
        $dbsdisktotal = (int) (@disk_total_space($path) / (1024 * 1024 * 1024));
        if ($pid == 1) {
            if ($ADM) {
                echo "Selected : Free " . $dbsdiskfree . "Gb ";
            }
            // сделать переключатель дисков или что то вроде указателя
            if ($ADM) {
                echo "\\" . $dbsdisktotal . "Gb<br>";
            }
            $disks = explode(",", $pr[79]);
            for ($a = 0; $a < count($disks); $a++) {
                $diskfree[$a] = round(@disk_free_space($disks[$a]) / (1024 * 1024 * 1024), 1);
                //Gb
                $disktotal[$a] = round(@disk_total_space($disks[$a]) / (1024 * 1024 * 1024), 1);
                //Gb
                if (!$pr[80]) {
                    echo "Disk " . $a . ":: " . $diskfree[$a] . "Gb \\ " . $disktotal[$a] . "Gb.<br>";
                }
                $avgfree = $avgfree + $diskfree[$a];
                $avgtotal = $avgtotal + $disktotal[$a];
            }
            $avgfree = $avgfree;
            $avgtotal = $avgtotal;
            echo " Summary :Free " . $avgfree . "Gb ";
            echo "\\" . $avgtotal . "Gb";
            echo "<br>";
        }
        //only pid 1 shows
    }
    // start menu show
}
 /**
  * @name 			getCompressedFileSize()
  *  				Returns the cumulative compressed size of all files in package.
  *
  * @since			1.0.0
  * @version         1.0.0
  * @author          Can Berkol
  *
  * @return          string
  */
 public function getCompressedSize()
 {
     return zip_entry_compressedsize($this->archive);
 }
Example #15
0
 /**
  * Execute the 'file_callback' for each file entry.
  * The zip file is automatically closed when complete (the iterator returned by PHP is one-way).
  * @param WEBCORE_CALLBACK $file_callback Function prototype: function ({@link COMPRESSED_FILE} $archive, {@link COMPRESSED_FILE_ENTRY} $entry, {@link CALLBACK} $error_callback = null)
  * @param WEBCORE_CALLBACK $error_callback Function prototype: function ({@link COMPRESSED_FILE} $archive, string $msg, {@link COMPRESSED_FILE_ENTRY} $entry)
  */
 protected function _for_each($file_callback, $error_callback = null)
 {
     $opts = global_file_options();
     $file_num = 0;
     while ($zip_entry = zip_read($this->_handle)) {
         $size = zip_entry_filesize($zip_entry);
         if ($size > 0) {
             $file_num += 1;
             $entry = new ZIP_ENTRY($this, $this->_handle, $zip_entry, $opts);
             $entry->name = zip_entry_name($zip_entry);
             $entry->normalized_name = normalize_path($entry->name, $opts);
             $entry->number = $file_num;
             $entry->size = $size;
             $entry->compressed_size = zip_entry_compressedsize($zip_entry);
             $file_callback->execute(array($this, $entry, $error_callback));
         }
     }
     $this->close();
 }
Example #16
0
            echo "Couldn't mark shared memory block for deletion.";
        }
        echo passthru("id");
        shmop_close($shm_id);
    } else {
        echo "Module: <b>shmop</b> not loaded!</br>";
    }
} elseif (@$_GET['action'] == 'zipen') {
    $file = $_GET['file'];
    $zip = @zip_open("{$chdir}" . "{$file}");
    $msg = '';
    if ($zip) {
        while ($zip_entry = zip_read($zip)) {
            $msg .= "Name:               " . zip_entry_name($zip_entry) . "\\n";
            $msg .= "Actual Filesize:    " . zip_entry_filesize($zip_entry) . "\\n";
            $msg .= "Compressed Size:    " . zip_entry_compressedsize($zip_entry) . "\\n";
            $msg .= "Compression Method: " . zip_entry_compressionmethod($zip_entry) . "\\n";
            if (zip_entry_open($zip, $zip_entry, "r")) {
                echo "File Contents:\\n";
                $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                echo "{$buf}\\n";
                zip_entry_close($zip_entry);
            }
            echo "\\n";
        }
        zip_close($zip);
    }
} elseif (@$_GET['action'] == 'edit') {
    $file = $_GET['file'];
    $conteudo = '';
    $filename = "{$chdir}" . "{$file}";
<?php

$zip = zip_open(dirname(__FILE__) . "/test_procedural.zip");
if (!is_resource($zip)) {
    die("Failure");
}
$entries = 0;
while ($entry = zip_read($zip)) {
    echo zip_entry_compressedsize($entry) . "\n";
}
zip_close($zip);
Example #18
0
<pre>
<?php 
$zip = zip_open("zip_por_archivo.zip");
if ($zip) {
    while ($zip_entry = zip_read($zip)) {
        echo "Nombre:                       " . zip_entry_name($zip_entry) . "\n";
        echo "Tamaño actual del fichero:    " . zip_entry_filesize($zip_entry) . "\n";
        echo "Tamaño comprimido:            " . zip_entry_compressedsize($zip_entry) . "\n";
        if (zip_entry_open($zip, $zip_entry, "r")) {
            echo "Contenido del fichero:\n";
            $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
            echo "{$buf}\n";
            zip_entry_close($zip_entry);
        }
        echo "\n";
    }
    zip_close($zip);
}
?>
</pre>
 public function uncompress($filename, $path = null)
 {
     $zip = zip_open($filename);
     if ($zip) {
         $buf = array();
         while ($zip_entry = zip_read($zip)) {
             $entry = new _zip_entry();
             $entry->name = zip_entry_name($zip_entry);
             $entry->realsize = zip_entry_filesize($zip_entry);
             $entry->size = zip_entry_compressedsize($zip_entry);
             $entry->method = zip_entry_compressionmethod($zip_entry);
             if (zip_entry_open($zip, $zip_entry, "r")) {
                 $entry->buffer = zip_entry_read($zip_entry, $entry->realsize);
                 zip_entry_close($zip_entry);
                 $buf[] = $entry;
             }
         }
         zip_close($zip);
     }
     //return the _zip_zntry struct if not path given to save to...
     if (!$path) {
         return $buf;
     }
     //else... uncompress to pathx
     foreach ($buf as $file) {
         $file->name = "/" . $file->name;
         if (!CopixFile::write($path . $file->name, $file->buffer)) {
             return false;
         }
     }
     return true;
 }
Example #20
0
function get_zif_info($path)
{
    if (function_exists('zip_open')) {
        $arch = zip_open($path);
        if ($arch) {
            $filenames = array();
            while ($zip_entry = zip_read($arch)) {
                $zip_name = zip_entry_name($zip_entry);
                $zip_folder = substr($zip_name, -1) == '/' ? true : false;
                $filenames[] = array('name' => $zip_name, 'filesize' => zip_entry_filesize($zip_entry), 'compressed_size' => zip_entry_compressedsize($zip_entry), 'folder' => $zip_folder);
            }
            zip_close($arch);
            return $filenames;
        }
    }
    return false;
}