Esempio n. 1
0
 }
 if ($CONF['email_use'] && isset($store_files)) {
     $out .= PMBP_email_store($store_files, $backup_info);
 }
 // file backup per FTP
 if ($CONF['dir_backup'] && (isset($_POST['dirs']) || strlen($_POST['man_dirs']))) {
     $_POST['man_dirs'] = str_replace("\n", ",", $_POST['man_dirs']);
     $files = array();
     if (isset($_POST['dirs'])) {
         $_POST['dirs'] = array_merge(explode(",", $_POST['man_dirs']), $_POST['dirs']);
         foreach ($_POST['dirs'] as $dir) {
             $files = array_merge($files, PMBP_get_files($dir));
         }
     } else {
         foreach (explode("|", $_POST['man_dirs']) as $dir) {
             $files = array_merge($files, PMBP_get_files($dir));
         }
     }
     // backup files by emails
     if ($PMBP_SYS_VAR['dir_email_backup']) {
         $out .= PMBP_email_store($files, $_POST['comments']);
     }
     // backup files by FTP
     $out .= PMBP_save_FTP($files, $_POST['packed']);
 }
 // show execution duration
 if (function_exists("microtime")) {
     $microtime = explode(" ", microtime());
     $endtime = $microtime[0] + $microtime[1];
 } else {
     $endtime = time();
Esempio n. 2
0
function PMBP_get_files($dir)
{
    global $CONF;
    $dirs = array();
    $dir = trim($dir);
    if ($dir_handle = @opendir($dir)) {
        while (FALSE !== ($file = readdir($dir_handle))) {
            if ($file != "." && $file != "..") {
                if (!is_dir($dir . $file)) {
                    $dirs[] = $dir . $file;
                    // recursive listing of files
                } elseif ($CONF['dir_rec']) {
                    $tmp = PMBP_get_files($dir . $file . "/");
                    if (is_array($tmp)) {
                        foreach ($tmp as $value) {
                            $dirs[] = $value;
                        }
                    }
                }
            }
        }
        @closedir($dir_handle);
    }
    return $dirs;
}