function unzip() { global $dir, $file; if (!MRights::can("unzip")) { $this->popupError("unzip"); return; } $firstCount = MFile::countDir($dir); $file = _START_FOLDER . urldecode($file); $info = MFile::info($file); $archive = new PclZip($file); $status = $archive->extract(PCLZIP_OPT_PATH, $dir); $error = ""; foreach ($status as $item) { if ($item['status'] != "ok") { $error .= ' - <b>' . $item['stored_filename'] . ":</b> " . MText::_($item['status']) . '<br>'; } } if ($error != "") { $error = 'newDarkenPopup(\'error\',mText.error,\'' . $error . '\',500,250);'; } $secondCount = MFile::countDir($dir); $refresh = ""; if ($secondCount > $firstCount) { $refresh = 'refreshFolder("' . MURL::safePath($dir) . '"); '; } $this->view->add2Content('<div style="display:none;">' . md5(uniqid()) . '</div>'); $this->view->add2Content(fmGetFiles()); $this->view->add2Content('<script noCache="1">' . $refresh . $error . '</script>'); }