function rename_recursive_dirs($dirsource, $dirdest, $deep = 0)
{
    if (true === is_dir($dirsource)) {
        $dir = dir($dirsource);
        while ($file = $dir->read()) {
            if ($file[0] != ".") {
                if (!is_dir($dirsource . "/" . $file)) {
                    copy($dirsource . "/" . $file, $dirdest . "/" . $file);
                    change_mode($dirdest . "/" . $file);
                } else {
                    make_dir($dirdest . "/" . $file);
                    rename_recursive_dirs($dirsource . "/" . $file, $dirdest . '/' . $file, $deep + 1);
                }
            }
        }
        $dir->close();
    }
    if ($deep == 0) {
        rm_full_dir($dirsource);
    }
    return true;
}
Example #2
0
    }
    // Remove temp file
    $admin->print_error($MESSAGE['TEMPLATES_BAD_PERMISSIONS']);
}
// Set template dir
$template_dir = LEPTON_PATH . '/templates/' . $template_directory;
// Make sure the template dir exists, and chmod if needed
if (!file_exists($template_dir)) {
    make_dir($template_dir);
} else {
    change_mode($template_dir);
}
if (!function_exists("rename_recursive_dirs")) {
    require_once LEPTON_PATH . "/framework/functions/function.rename_recursive_dirs.php";
}
rename_recursive_dirs($temp_unzip, $template_dir);
// Delete the temp zip file
if (file_exists($temp_file)) {
    unlink($temp_file);
}
// Chmod all the uploaded files
$dir = dir($template_dir);
while (false !== ($entry = $dir->read())) {
    // Skip pointers
    if (substr($entry, 0, 1) != '.' and $entry != '.svn' and !is_dir($template_dir . '/' . $entry)) {
        // Chmod file
        change_mode($template_dir . '/' . $entry);
    }
}
// is done by function rename_recursive_dirs
//rm_full_dir(LEPTON_PATH.'/temp/unzip/');
Example #3
0
         */
        if (versionCompare($module_version, $new_lepton_module_version, '>=')) {
            cleanup($temp_unzip, $temp_file);
            $admin->print_error($MESSAGE['GENERIC_ALREADY_INSTALLED']);
        }
    }
}
// Set module directory
$module_dir = LEPTON_PATH . '/modules/' . $module_directory;
// Make sure the module dir exists, and chmod if needed
make_dir($module_dir);
// copy files from temp folder
if (!function_exists("rename_recursive_dirs")) {
    require_once LEPTON_PATH . "/framework/functions/function.rename_recursive_dirs.php";
}
if (rename_recursive_dirs($temp_subdir, $module_dir) !== true) {
    cleanup($temp_unzip, $temp_file);
    $admin->print_error($MESSAGE['GENERIC_NOT_UPGRADED']);
}
// remove temp
cleanup($temp_unzip, $temp_file);
// load info.php again to have current values
if (file_exists(LEPTON_PATH . '/modules/' . $module_directory . '/info.php')) {
    require LEPTON_PATH . '/modules/' . $module_directory . '/info.php';
}
// Run the modules install // upgrade script if there is one
if (file_exists($module_dir . '/' . $action . '.php')) {
    require $module_dir . '/' . $action . '.php';
}
// Print success message
if ($action == "install") {