Example #1
0
function unzip($file, $dir = "./")
{
    $zip = new MyZip();
    $res = $zip->open($file);
    if ($res === TRUE) {
        $zip->extractTo($dir);
        $zip->close();
        return true;
    } else {
        return $res;
    }
}
Example #2
0
         $upload = new MyUploader();
         $upload->init(ROOT_PATH . "/" . $path_upload, true);
         $upload->DoIt(false);
         if ($upload->upload_result[0]['error'] == 0) {
             $theFile = ROOT_PATH . "/" . $path_upload . "/" . $upload->upload_result[0]['new_name'];
             require ROOT_PATH . "/source/class/myzip.class.php";
             $zip = new MyZip();
             $res = $zip->open($theFile);
             if ($res === TRUE) {
                 for ($i = 0; $i < $zip->numFiles; $i++) {
                     $theName = $zip->getNameIndex($i);
                     if (stripos($theName, "images/") !== 0 && stripos($theName, "template/") !== 0 || stripos($theName, "admin") > 0 || stripos($theName, ".php") > 0) {
                         $zip->deleteIndex($i);
                     }
                 }
                 $zip->close();
                 if (unzip($theFile, ROOT_PATH) == false) {
                     showInfo($setting['language']['admin_web_template_upload_error']);
                 }
             } else {
                 showInfo($setting['language']['admin_web_template_upload_error']);
             }
         } else {
             showInfo($setting['language']['admin_web_template_upload_error']);
         }
         unset($upload);
     }
     $idx = "";
     break;
 case "add_ok":
 case "edit_ok":