Esempio n. 1
0
//This file cannot be called directly, only included.
if (str_replace(DIRECTORY_SEPARATOR, "/", __FILE__) == $_SERVER['SCRIPT_FILENAME']) {
    exit;
}
if (!EfrontUser::isOptionVisible('backup')) {
    eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure");
}
if (isset($currentUser->coreAccess['backup']) && $currentUser->coreAccess['backup'] == 'hidden') {
    eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure");
}
$basedir = G_BACKUPPATH;
if (isset($_GET['restore'])) {
    //ini_set("memory_limit", "-1");
    try {
        $restoreFile = new EfrontFile($_GET['restore']);
        if (!EfrontSystem::restore($_GET['restore'], $_GET['force'] ? $_GET['force'] : false)) {
            $message = _ERRORRESTORINGFILE;
            $message_type = 'failure';
        } else {
            $message = _SUCCESFULLYRESTOREDSYSTEM;
            $message_type = 'success';
        }
    } catch (Exception $e) {
        handleNormalFlowExceptions($e);
        if ($e->getCode() == EfrontSystemException::INCOMPATIBLE_VERSIONS) {
            $message .= ' - <a href = "javascript:void(0)" onclick = "location=location+\'&force=1\'">Force restore</a>';
        }
    }
}
try {
    $url = basename($_SERVER['PHP_SELF']) . '?ctg=backup';
Esempio n. 2
0
                echo Installation::printErrorMessage("You must have a valid configuration file for the emergency restore to work");
                exit;
            }
        } catch (Exception $e) {
            $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
            $message = $e->getMessage() . ' (' . $e->getCode() . ') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
            $message_type = 'failure';
        }
        foreach ($it = new DirectoryIterator(G_BACKUPPATH) as $key => $value) {
            if (!$value->isDir() && pathinfo($value->getFileName(), PATHINFO_EXTENSION) == 'zip') {
                $files[] = basename($value);
            }
        }
        $smarty->assign("T_BACKUP_FILES", $files);
        if (isset($_GET['file']) && in_array($_GET['file'], $files)) {
            EfrontSystem::restore(G_BACKUPPATH . $_GET['file']);
            //Auto backup database
            $message = "The restoring procedure completed successfully";
            $message_type = "success";
        }
    } catch (Exception $e) {
        Installation::handleInstallationExceptions($e);
    }
}
$loadScripts = array('EfrontScripts', 'scriptaculous/prototype', 'scriptaculous/scriptaculous', 'scriptaculous/effects', 'efront_ajax');
$smarty->assign("T_HEADER_LOAD_SCRIPTS", implode(",", array_unique($loadScripts)));
//array_unique, so it doesn't send duplicate entries
$smarty->assign("T_MESSAGE", $message);
$smarty->assign("T_MESSAGE_TYPE", $message_type);
$smarty->load_filter('output', 'eF_template_applyImageMap');
$smarty->load_filter('output', 'eF_template_applyThemeToImages');