// include PclZip and create object from Add-on zip archive
require_once WB_PATH . '/include/pclzip/pclzip.lib.php';
$archive = new PclZip($temp_file);
// extract Add-on files into WBCE temp folder
$addon_root_path = find_addon_root_path($archive);
$list = $archive->extract(PCLZIP_OPT_PATH, $temp_unzip, PCLZIP_CB_PRE_EXTRACT, 'pclzip_extraction_filter', PCLZIP_OPT_REPLACE_NEWER);
// Check if uploaded file is a valid Add-On zip file
if (!($list && file_exists($temp_unzip . 'info.php'))) {
    $admin->print_error($MESSAGE['GENERIC_INVALID_ADDON_FILE']);
}
// Include module info file
unset($module_directory);
require $temp_unzip . 'info.php';
// Perform Add-on requirement checks before proceeding
require WB_PATH . '/framework/addon.precheck.inc.php';
preCheckAddon($temp_file);
// Delete temporary unzip directory
rm_full_dir($temp_unzip);
// Check if the file is valid
if (!isset($module_directory)) {
    if (file_exists($temp_file)) {
        unlink($temp_file);
    }
    // Remove temp file
    $admin->print_error($MESSAGE['GENERIC_INVALID']);
}
// Check if this module is already installed
// and compare versions if so
$new_module_version = $module_version;
$action = "install";
if (is_dir(WB_PATH . '/modules/' . $module_directory)) {
示例#2
0
}
// Check if uploaded file is a valid Add-On zip file
if (!($list && file_exists($temp_subdir . 'index.php'))) {
    cleanup($temp_unzip, $temp_file);
    $admin->print_error($MESSAGE['GENERIC_INVALID_ADDON_FILE'] . "[1]");
}
// As we are going to check for a valid info.php, let's unset all vars expected
// there to see if they're set correctly
foreach (array('module_license', 'module_author', 'module_name', 'module_directory', 'module_version', 'module_function', 'module_description', 'module_platform') as $varname) {
    unset(${$varname});
}
// Include the modules info file
require $temp_subdir . 'info.php';
// Perform Add-on requirement checks before proceeding
require LEPTON_PATH . '/framework/summary.addon_precheck.php';
preCheckAddon($temp_file, $temp_subdir);
// Delete the temp unzip directory
// ----- MOVED! Why should we unzip more than once? ------
// rm_full_dir($temp_unzip);
// Check if the file is valid
if (!isset($module_license) || !isset($module_author) || !isset($module_directory) || !isset($module_name) || !isset($module_version) || !isset($module_function)) {
    cleanup($temp_unzip, $temp_file);
    $admin->print_error(sprintf($MESSAGE["MOD_MISSING_PARTS_NOTICE"], $module_name));
}
foreach (array('module_license', 'module_author', 'module_name', 'module_directory', 'module_version', 'module_function', 'module_description', 'module_platform') as $varname) {
    ${'new_lepton_' . $varname} = ${$varname};
    unset(${$varname});
}
// So, now we have done all preinstall checks, lets see what to do next
$module_directory = $new_lepton_module_directory;
$action = "install";