Exemple #1
0
function confirmBackup($option)
{
    // ----------------------------------------------------------
    // Routine to display a confirmation screen prior to backup
    // containing the selectable folders and a confirmation for
    // backing up the database
    // ----------------------------------------------------------
    global $_CONFIG;
    if (!is_writeable($_CONFIG['clonerPath'])) {
        E_print("Your backup directory {$_CONFIG['clonerPath']} is not writeable or does not exists(Backup Store Path:)! <br />Please note, the ./administrator/backups/ folder needs to be created and made writeable!");
        return;
    }
    # Initialise list arrays, directories and files separately and array counters for them
    $excludedFolders = array();
    $d_arr = array();
    $d = 0;
    $ds_arr = array();
    $f_arr = array();
    $f = 0;
    $s_arr = array();
    $s = 0;
    $d_arr[$d] = $_CONFIG['backup_path'];
    #if($_CONFIG['select_folders']==0){
    # obtain the list of folders by recursing the mambo file store
    #recurseFiles($d_arr, $ds_arr, $f_arr, $s_arr, $d, $f, $s, $excludedFolders, '');
    #}
    if ($_CONFIG['select_folders'] == 2) {
        if ($fp = @fopen($_CONFIG['exfile'], 'w')) {
            $excl = explode("\r\n", $_CONFIG['cron_exclude']);
            foreach ($excl as $value) {
                if ($value != "") {
                    $value = str_replace($_CONFIG['backup_path'], "", $value);
                    if ($value[0] != '/') {
                        $value = '/' . $value;
                    }
                    if (substr($value, strlen($value) - 1, 1) == '/' && strlen($value) != 1) {
                        $value = substr($value, 0, strlen($value) - 1);
                    }
                    fwrite($fp, $value . "\r\n");
                }
            }
            fclose($fp);
        }
    }
    # load presentation layer
    if ($option != 'nohtml') {
        HTML_cloner::confirmBackups($d_arr, $ds_arr, $_CONFIG['clonerPath'], $option);
    } else {
        return $d_arr;
    }
}