<script language="JavaScript1.2" type="text/javascript">
tb = parent.AfianHandler['allTabs']['<?echo $_GET['fromtabid'];?>'];
<?
$filename = $str->fromHTML($_GET['filename']);
$extractTo = $str->fromHTML($_GET['foldername']);
$fromfolder	= $str->fromHTML($_GET['fromfolder']);
$sys['fullPath'] = gluePath($permissions['path'], $fromfolder);


$list = new iconlist($_GET['fromtabid']);

/* check user permission*/
if ($permissions['readonly']) {
	iframeAlert($lang->get($lang->get("You are not allowed to perform this action.")));
	echo "parent.MyFilesEndAction(tb);</script>";
	exit();
}


if ($permissions['unlimitedSpace'] == false && $quota->canAddToSpace() == false) {
	iframeAlert($lang->get("Not enough space available"));
	echo "parent.MyFilesEndAction(tb);</script>";
	exit();
}

if (!isCleanPath($extractTo)) {
	iframeAlert($lang->get('Ilegal path: ').$extractTo);
	echo "parent.MyFilesEndAction(tb);</script>";
	exit();
}

if (!isCleanPath($fromfolder)) {
	iframeAlert($lang->get('Ilegal path: ').$fromfolder);
	echo "parent.MyFilesEndAction(tb);</script>";
	exit();
}


$zip = new PclZip(gluePath($sys['fullPath'], $filename));
if (!$extractTo) {
		iframeAlert($lang->get("Please specify a folder name"));
		echo "parent.MyFilesEndAction(tb);</script>";
		exit();
} else {
	if (is_dir(gluePath($sys['fullPath'],$extractTo))) {
		iframeAlert($lang->get("Folder '%1' already exists", array($extractTo)));
		echo "parent.MyFilesEndAction(tb);</script>";
		exit();
	}
}

$zip->extract(PCLZIP_OPT_PATH, gluePath($sys['fullPath'],$extractTo));
$log->act("0", "archive extraction", "\"".gluePath($sys['fullPath'], $filename)."\" TO \"".gluePath($sys['fullPath'],$extractTo)."\"");

?>
if (tb != undefined) {
tb.destroyItems();
}
<?
/* insert created folder in list */
		$data['name'] = $extractTo;
		$data['lcname'] = strtolower($data['name']);
		$data['mdate'] = filemtime(gluePath($sys['fullPath'],$extractTo));
		$data['isdir'] = true;
		$data['size'] = $fm->getDirSize(gluePath($sys['fullPath'],$extractTo));
		$data['ext'] = "";
		$data['filetypedescription'] = $lang->get("Folder");
		$data['icon_img'] = "images/icons/filetypes/big/folder.gif";
		$data['thumb_img'] = "images/icons/filetypes/big/folder.gif";
		$data['list_img'] = "images/icons/filetypes/small/folder.gif";
		$data['filetype'] = "folder";
		$data['ondblclick'] = "cd('".gluePath($fromfolder, $data['name'])."')";
		$list->drawIcon($data);
?>
parent.AfianBubbleMessage('<?$lang->display("Archive unzipped.");?>');

parent.MyFilesEndAction(tb);
if (tb != undefined) {
	tb.buildItems();
	if (tb.active) {
		tb.showItems();
		tb.focusItem('<?echo $str->safeJS($extractTo);?>');
	}
}
parent.reloadTreeByPath('<?echo $str->safeJS($fromfolder);?>');

<?iframeAlert($iframeAlertMsg);?>
</script>