public static function ZipTest($from_file) { $zip = new PclZip($from_file); return $zip->privCheckFormat() === true; /* if (class_exists('ZipArchive', false)) { $zip = new ZipArchive(); return ($zip->open($from_file, ZIPARCHIVE::CHECKCONS) === true); } else { $zip = new PclZip($from_file); return ($zip->privCheckFormat() === true); } */ }
/** * @desc try to open a zip file in order to check if it's valid * @return bool success */ public static function ZipTest($from_file) { if (class_exists('ZipArchive', false)) { $zip = new ZipArchive(); return $zip->open($from_file, ZIPARCHIVE::CHECKCONS) === true; } else { require_once _PS_ROOT_DIR_ . '/tools/pclzip/pclzip.lib.php'; $zip = new PclZip($from_file); return $zip->privCheckFormat() === true; } }
/** * @desc try to open a zip file in order to check if it's valid * @return bool success */ public static function ZipTest($fromFile) { if (class_exists('ZipArchive', false)) { $zip = new ZipArchive(); return $zip->open($fromFile, ZIPARCHIVE::CHECKCONS) === true; } else { require_once dirname(__FILE__) . '/pclzip.lib.php'; $zip = new PclZip($fromFile); return $zip->privCheckFormat() === true; } }