示例#1
0
 /**
  * Check Jobs worked and Cleanup logs and so on
  */
 public static function check_cleanup()
 {
     $job_object = BackWPup_Job::get_working_data();
     $log_folder = get_site_option('backwpup_cfg_logfolder');
     $log_folder = BackWPup_File::get_absolute_path($log_folder);
     // check aborted jobs for longer than a tow hours, abort them courtly and send mail
     if (is_object($job_object) && !empty($job_object->logfile)) {
         $not_worked_time = microtime(TRUE) - $job_object->timestamp_last_update;
         if ($not_worked_time > 3600) {
             $job_object->log(E_USER_ERROR, __('Aborted, because no progress for one hour!', 'backwpup'), __FILE__, __LINE__);
             unlink(BackWPup::get_plugin_data('running_file'));
             $job_object->update_working_data();
         }
     }
     //Compress not compressed logs
     if (is_readable($log_folder) && function_exists('gzopen') && get_site_option('backwpup_cfg_gzlogs') && !is_object($job_object)) {
         //Compress old not compressed logs
         if ($dir = opendir($log_folder)) {
             $jobids = BackWPup_Option::get_job_ids();
             while (FALSE !== ($file = readdir($dir))) {
                 if (is_writeable($log_folder . $file) && '.html' == substr($file, -5)) {
                     $compress = new BackWPup_Create_Archive($log_folder . $file . '.gz');
                     if ($compress->add_file($log_folder . $file)) {
                         unlink($log_folder . $file);
                         //change last logfile in jobs
                         foreach ($jobids as $jobid) {
                             $job_logfile = BackWPup_Option::get($jobid, 'logfile');
                             if (!empty($job_logfile) && $job_logfile === $log_folder . $file) {
                                 BackWPup_Option::update($jobid, 'logfile', $log_folder . $file . '.gz');
                             }
                         }
                     }
                     unset($compress);
                 }
             }
             closedir($dir);
         }
     }
     //Jobs cleanings
     if (!is_object($job_object)) {
         //remove restart cron
         wp_clear_scheduled_hook('backwpup_cron', array('id' => 'restart'));
         //temp cleanup
         BackWPup_Job::clean_temp_folder();
     }
     //check scheduling jobs that not found will removed because there are single scheduled
     $activejobs = BackWPup_Option::get_job_ids('activetype', 'wpcron');
     if (!empty($activejobs)) {
         foreach ($activejobs as $jobid) {
             $cron_next = wp_next_scheduled('backwpup_cron', array('id' => $jobid));
             if (!$cron_next || $cron_next < time()) {
                 wp_unschedule_event($cron_next, 'backwpup_cron', array('id' => $jobid));
                 $cron_next = BackWPup_Cron::cron_next(BackWPup_Option::get($jobid, 'cron'));
                 wp_schedule_single_event($cron_next, 'backwpup_cron', array('id' => $jobid));
             }
         }
     }
 }
示例#2
0
 /**
  * create manifest file
  * @return bool
  */
 public function create_manifest()
 {
     $this->substeps_todo = 3;
     $this->log(sprintf(__('%d. Trying to generate a manifest file&#160;&hellip;', 'backwpup'), $this->steps_data[$this->step_working]['STEP_TRY']));
     //build manifest
     $manifest = array();
     // add blog information
     $manifest['blog_info']['url'] = home_url();
     $manifest['blog_info']['wpurl'] = site_url();
     $manifest['blog_info']['prefix'] = $GLOBALS['wpdb']->prefix;
     $manifest['blog_info']['description'] = get_option('blogdescription');
     $manifest['blog_info']['stylesheet_directory'] = get_template_directory_uri();
     $manifest['blog_info']['activate_plugins'] = wp_get_active_and_valid_plugins();
     $manifest['blog_info']['activate_theme'] = wp_get_theme()->get('Name');
     $manifest['blog_info']['admin_email'] = get_option('admin_email');
     $manifest['blog_info']['charset'] = get_bloginfo('charset');
     $manifest['blog_info']['version'] = BackWPup::get_plugin_data('wp_version');
     $manifest['blog_info']['backwpup_version'] = BackWPup::get_plugin_data('version');
     $manifest['blog_info']['language'] = get_bloginfo('language');
     $manifest['blog_info']['name'] = get_bloginfo('name');
     $manifest['blog_info']['abspath'] = ABSPATH;
     $manifest['blog_info']['uploads'] = wp_upload_dir(null, false, true);
     $manifest['blog_info']['contents']['basedir'] = WP_CONTENT_DIR;
     $manifest['blog_info']['contents']['baseurl'] = WP_CONTENT_URL;
     $manifest['blog_info']['plugins']['basedir'] = WP_PLUGIN_DIR;
     $manifest['blog_info']['plugins']['baseurl'] = WP_PLUGIN_URL;
     $manifest['blog_info']['themes']['basedir'] = get_theme_root();
     $manifest['blog_info']['themes']['baseurl'] = get_theme_root_uri();
     // add job settings
     $manifest['job_settings'] = $this->job;
     // add archive info
     foreach ($this->additional_files_to_backup as $file) {
         $manifest['archive']['extra_files'][] = basename($file);
     }
     if (isset($this->steps_data['JOB_FILE'])) {
         if ($this->job['backuproot']) {
             $manifest['archive']['abspath'] = trailingslashit($this->get_destination_path_replacement(ABSPATH));
         }
         if ($this->job['backupuploads']) {
             $manifest['archive']['uploads'] = trailingslashit($this->get_destination_path_replacement(BackWPup_File::get_upload_dir()));
         }
         if ($this->job['backupcontent']) {
             $manifest['archive']['contents'] = trailingslashit($this->get_destination_path_replacement(WP_CONTENT_DIR));
         }
         if ($this->job['backupplugins']) {
             $manifest['archive']['plugins'] = trailingslashit($this->get_destination_path_replacement(WP_PLUGIN_DIR));
         }
         if ($this->job['backupthemes']) {
             $manifest['archive']['themes'] = trailingslashit($this->get_destination_path_replacement(get_theme_root()));
         }
     }
     if (!file_put_contents(BackWPup::get_plugin_data('TEMP') . 'manifest.json', json_encode($manifest))) {
         return false;
     }
     $this->substeps_done = 1;
     //Create backwpup_readme.txt
     $readme_text = __('You may have noticed the manifest.json file in this archive.', 'backwpup') . PHP_EOL;
     $readme_text .= __('manifest.json might be needed for later restoring a backup from this archive.', 'backwpup') . PHP_EOL;
     $readme_text .= __('Please leave manifest.json untouched and in place. Otherwise it is safe to be ignored.', 'backwpup') . PHP_EOL;
     if (!file_put_contents(BackWPup::get_plugin_data('TEMP') . 'backwpup_readme.txt', $readme_text)) {
         return false;
     }
     $this->substeps_done = 2;
     //add file to backup files
     if (is_readable(BackWPup::get_plugin_data('TEMP') . 'manifest.json')) {
         $this->additional_files_to_backup[] = BackWPup::get_plugin_data('TEMP') . 'manifest.json';
         $this->additional_files_to_backup[] = BackWPup::get_plugin_data('TEMP') . 'backwpup_readme.txt';
         $this->log(sprintf(__('Added manifest.json file with %1$s to backup file list.', 'backwpup'), size_format(filesize(BackWPup::get_plugin_data('TEMP') . 'manifest.json'), 2)));
     }
     $this->substeps_done = 3;
     return true;
 }
    /**
     * Displaying last logs
     */
    private static function mb_last_logs()
    {
        if (!current_user_can('backwpup_logs')) {
            return;
        }
        ?>
		<table class="wp-list-table widefat" cellspacing="0">
			<caption><?php 
        _e('Last logs', 'backwpup');
        ?>
</caption>
			<thead>
			<tr><th style="width:30%"><?php 
        _e('Time', 'backwpup');
        ?>
</th><th style="width:55%"><?php 
        _e('Job', 'backwpup');
        ?>
</th><th style="width:20%"><?php 
        _e('Result', 'backwpup');
        ?>
</th></tr>
			</thead>
			<?php 
        //get log files
        $logfiles = array();
        $log_folder = get_site_option('backwpup_cfg_logfolder');
        $log_folder = BackWPup_File::get_absolute_path($log_folder);
        if (is_readable($log_folder) && ($dir = opendir($log_folder))) {
            while (($file = readdir($dir)) !== FALSE) {
                if (is_readable($log_folder . $file) && is_file($log_folder . $file) && FALSE !== strpos($file, 'backwpup_log_') && FALSE !== strpos($file, '.html')) {
                    $logfiles[filemtime($log_folder . $file)] = $file;
                }
            }
            closedir($dir);
            krsort($logfiles, SORT_NUMERIC);
        }
        if (count($logfiles) > 0) {
            $count = 0;
            $alternate = TRUE;
            foreach ($logfiles as $logfile) {
                $logdata = BackWPup_Job::read_logheader($log_folder . $logfile);
                if (!$alternate) {
                    echo '<tr>';
                    $alternate = TRUE;
                } else {
                    echo '<tr class="alternate">';
                    $alternate = FALSE;
                }
                echo '<td>' . sprintf(__('%1$s at %2$s', 'backwpup'), date_i18n(get_option('date_format'), $logdata['logtime']), date_i18n(get_option('time_format'), $logdata['logtime'])) . '</td>';
                echo '<td><a class="thickbox" href="' . admin_url('admin-ajax.php') . '?&action=backwpup_view_log&logfile=' . basename($logfile) . '&_ajax_nonce=' . wp_create_nonce('view-logs') . '&amp;TB_iframe=true&amp;width=640&amp;height=440" title="' . esc_attr(basename($logfile)) . '">' . $logdata['name'] . '</i></a></td>';
                echo '<td>';
                if ($logdata['errors'] > 0) {
                    printf('<span style="color:red;font-weight:bold;">' . _n("%d ERROR", "%d ERRORS", $logdata['errors'], 'backwpup') . '</span><br />', $logdata['errors']);
                }
                if ($logdata['warnings'] > 0) {
                    printf('<span style="color:#e66f00;font-weight:bold;">' . _n("%d WARNING", "%d WARNINGS", $logdata['warnings'], 'backwpup') . '</span><br />', $logdata['warnings']);
                }
                if ($logdata['errors'] == 0 && $logdata['warnings'] == 0) {
                    echo '<span style="color:green;font-weight:bold;">' . __('OK', 'backwpup') . '</span>';
                }
                echo '</td></tr>';
                $count++;
                if ($count >= 5) {
                    break;
                }
            }
        } else {
            echo '<tr><td colspan="3">' . __('none', 'backwpup') . '</td></tr>';
        }
        ?>
		</table>
		<?php 
    }
示例#4
0
 /**
  * For displaying log files with ajax
  */
 public static function ajax_view_log()
 {
     if (!current_user_can('backwpup_logs') || !isset($_GET['log']) || strstr($_GET['log'], 'backwpup_log_') === false) {
         die('-1');
     }
     check_ajax_referer('view-log_' . $_GET['log']);
     $log_folder = get_site_option('backwpup_cfg_logfolder');
     $log_folder = BackWPup_File::get_absolute_path($log_folder);
     $log_file = $log_folder . esc_attr(trim($_GET['log']));
     if (file_exists($log_file . '.html') && is_readable($log_file . '.html')) {
         echo file_get_contents($log_file . '.html', FALSE);
     } elseif (file_exists($log_file . '.html.gz') && is_readable($log_file . '.html.gz')) {
         echo file_get_contents('compress.zlib://' . $log_file . '.html.gz', FALSE);
     } else {
         die(__('Logfile not found!', 'backwpup'));
     }
     die;
 }
示例#5
0
 /**
  *
  * Function to generate json data
  *
  */
 public static function ajax_working()
 {
     check_ajax_referer('backwpupworking_ajax_nonce');
     if (!current_user_can('backwpup_jobs_start')) {
         die('-1');
     }
     $log_folder = get_site_option('backwpup_cfg_logfolder');
     $log_folder = BackWPup_File::get_absolute_path($log_folder);
     $logfile = isset($_GET['logfile']) ? $log_folder . basename(trim($_GET['logfile'])) : NULL;
     $logpos = isset($_GET['logpos']) ? absint($_GET['logpos']) : 0;
     $restart_url = '';
     //check if logfile renamed
     if (file_exists($logfile . '.gz')) {
         $logfile .= '.gz';
     }
     if (!is_readable($logfile) || strstr($_GET['logfile'], 'backwpup_log_') === false) {
         die('0');
     }
     $job_object = BackWPup_Job::get_working_data();
     $done = 0;
     if (is_object($job_object)) {
         $warnings = $job_object->warnings;
         $errors = $job_object->errors;
         $step_percent = $job_object->step_percent;
         $substep_percent = $job_object->substep_percent;
         $runtime = current_time('timestamp') - $job_object->start_time;
         $onstep = $job_object->steps_data[$job_object->step_working]['NAME'];
         $lastmsg = $job_object->lastmsg;
         $lasterrormsg = $job_object->lasterrormsg;
     } else {
         $logheader = BackWPup_Job::read_logheader($logfile);
         $warnings = $logheader['warnings'];
         $runtime = $logheader['runtime'];
         $errors = $logheader['errors'];
         $step_percent = 100;
         $substep_percent = 100;
         $onstep = '<div class="backwpup-message backwpup-info"><p>' . esc_html__('Job completed', 'backwpup') . '</p></div>';
         if ($errors > 0) {
             $lastmsg = '<div class="error"><p>' . esc_html__('ERROR:', 'backwpup') . ' ' . sprintf(esc_html__('Job has ended with errors in %s seconds. You must resolve the errors for correct execution.', 'backwpup'), $logheader['runtime']) . '</p></div>';
         } elseif ($warnings > 0) {
             $lastmsg = '<div class="backwpup-message backwpup-warning"><p>' . esc_html__('WARNING:', 'backwpup') . ' ' . sprintf(esc_html__('Job has done with warnings in %s seconds. Please resolve them for correct execution.', 'backwpup'), $logheader['runtime']) . '</p></div>';
         } else {
             $lastmsg = '<div class="updated"><p>' . sprintf(esc_html__('Job done in %s seconds.', 'backwpup'), $logheader['runtime']) . '</p></div>';
         }
         $lasterrormsg = '';
         $done = 1;
     }
     if ('.gz' == substr($logfile, -3)) {
         $logfiledata = file_get_contents('compress.zlib://' . $logfile, FALSE, NULL, $logpos);
     } else {
         $logfiledata = file_get_contents($logfile, FALSE, NULL, $logpos);
     }
     preg_match('/<body[^>]*>/si', $logfiledata, $match);
     if (!empty($match[0])) {
         $startpos = strpos($logfiledata, $match[0]) + strlen($match[0]);
     } else {
         $startpos = 0;
     }
     $endpos = stripos($logfiledata, '</body>');
     if (FALSE === $endpos) {
         $endpos = strlen($logfiledata);
     }
     $length = strlen($logfiledata) - (strlen($logfiledata) - $endpos) - $startpos;
     //check if restart must done on ALTERNATE_WP_CRON
     if (is_object($job_object) && defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON) {
         $restart = BackWPup_Job::get_jobrun_url('restartalt');
         if ($job_object->pid === 0 && $job_object->uniqid === '') {
             $restart_url = $restart['url'];
         }
         $last_update = microtime(TRUE) - $job_object->timestamp_last_update;
         if (empty($job_object->pid) && $last_update > 10) {
             $restart_url = $restart['url'];
         }
     }
     wp_send_json(array('log_pos' => strlen($logfiledata) + $logpos, 'log_text' => substr($logfiledata, $startpos, $length), 'warning_count' => $warnings, 'error_count' => $errors, 'running_time' => $runtime, 'step_percent' => $step_percent, 'on_step' => $onstep, 'last_msg' => $lastmsg, 'last_error_msg' => $lasterrormsg, 'sub_step_percent' => $substep_percent, 'restart_url' => $restart_url, 'job_done' => $done));
 }
示例#6
0
 /**
  *
  * Check is folder readable and exists create it if not
  * add .htaccess or index.html file in folder to prevent directory listing
  *
  * @param string $folder the folder to check
  * @param bool   $donotbackup Create a file that the folder will not backuped
  *
  * @return string with error message if one
  */
 public static function check_folder($folder, $donotbackup = FALSE)
 {
     $folder = BackWPup_File::get_absolute_path($folder);
     $folder = untrailingslashit($folder);
     //check that is not home of WP
     $uploads = BackWPup_File::get_upload_dir();
     if ($folder === untrailingslashit(str_replace('\\', '/', ABSPATH)) || $folder === untrailingslashit(str_replace('\\', '/', dirname(ABSPATH))) || $folder === untrailingslashit(str_replace('\\', '/', WP_PLUGIN_DIR)) || $folder === untrailingslashit(str_replace('\\', '/', WP_CONTENT_DIR)) || $folder === untrailingslashit($uploads) || $folder === '/') {
         return sprintf(__('Folder %1$s not allowed, please use another folder.', 'backwpup'), $folder);
     }
     //open base dir check
     if (!BackWPup_File::is_in_open_basedir($folder)) {
         return sprintf(__('Folder %1$s is not in open basedir, please use another folder.', 'backwpup'), $folder);
     }
     //create folder if it not exists
     if (!is_dir($folder)) {
         if (!wp_mkdir_p($folder)) {
             return sprintf(__('Cannot create folder: %1$s', 'backwpup'), $folder);
         }
     }
     //check is writable dir
     if (!is_writable($folder)) {
         return sprintf(__('Folder "%1$s" is not writable', 'backwpup'), $folder);
     }
     //create files for securing folder
     if (get_site_option('backwpup_cfg_protectfolders')) {
         $server_software = strtolower($_SERVER['SERVER_SOFTWARE']);
         //IIS
         if (strstr($server_software, 'microsoft-iis')) {
             if (!file_exists($folder . '/web.config')) {
                 file_put_contents($folder . '/web.config', "<configuration>" . PHP_EOL . "\t<system.webServer>" . PHP_EOL . "\t\t<authorization>" . PHP_EOL . "\t\t\t<deny users=" * " />" . PHP_EOL . "\t\t</authorization>" . PHP_EOL . "\t</system.webServer>" . PHP_EOL . "</configuration>");
             }
         } elseif (strstr($server_software, 'nginx')) {
             if (!file_exists($folder . '/index.php')) {
                 file_put_contents($folder . '/index.php', "<?php" . PHP_EOL . "header( \$_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found' );" . PHP_EOL . "header( 'Status: 404 Not Found' );" . PHP_EOL);
             }
         } else {
             if (!file_exists($folder . '/.htaccess')) {
                 file_put_contents($folder . '/.htaccess', "<Files \"*\">" . PHP_EOL . "<IfModule mod_access.c>" . PHP_EOL . "Deny from all" . PHP_EOL . "</IfModule>" . PHP_EOL . "<IfModule !mod_access_compat>" . PHP_EOL . "<IfModule mod_authz_host.c>" . PHP_EOL . "Deny from all" . PHP_EOL . "</IfModule>" . PHP_EOL . "</IfModule>" . PHP_EOL . "<IfModule mod_access_compat>" . PHP_EOL . "Deny from all" . PHP_EOL . "</IfModule>" . PHP_EOL . "</Files>");
             }
             if (!file_exists($folder . '/index.php')) {
                 file_put_contents($folder . '/index.php', "<?php" . PHP_EOL . "header( \$_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found' );" . PHP_EOL . "header( 'Status: 404 Not Found' );" . PHP_EOL);
             }
         }
     }
     //Create do not backup file for this folder
     if ($donotbackup && !file_exists($folder . '/.donotbackup')) {
         file_put_contents($folder . '/.donotbackup', __('BackWPup will not backup folders and its sub folders when this file is inside.', 'backwpup'));
     }
     return '';
 }
示例#7
0
 /**
  * For displaying log files with ajax
  */
 public static function ajax_view_log()
 {
     if (!current_user_can('backwpup_logs')) {
         die(-1);
     }
     check_ajax_referer('view-logs');
     $log_folder = get_site_option('backwpup_cfg_logfolder');
     $log_folder = BackWPup_File::get_absolute_path($log_folder);
     $log_file = $log_folder . $_GET['logfile'];
     if (!is_readable($log_file) && !is_readable($log_file . '.gz') && !is_readable($log_file . '.bz2')) {
         die(-1);
     }
     //change file end if not html helps if log file compression is on
     if (!file_exists($log_file) && file_exists($log_file . '.gz')) {
         $log_file = $log_file . '.gz';
     }
     if (!file_exists($log_file) && file_exists($log_file . '.bz2')) {
         $log_file = $log_file . '.bz2';
     }
     //output file
     if ('.gz' == substr($log_file, -3)) {
         echo file_get_contents('compress.zlib://' . $log_file, FALSE);
     } else {
         echo file_get_contents($log_file, FALSE);
     }
     die;
 }
 /**
  * @param $jobdest
  * @return mixed
  */
 public function file_get_list($jobdest)
 {
     list($jobid, $dest) = explode('_', $jobdest, 2);
     $filecounter = 0;
     $files = array();
     $backup_folder = BackWPup_Option::get($jobid, 'backupdir');
     $backup_folder = BackWPup_File::get_absolute_path($backup_folder);
     if (is_dir($backup_folder) && ($dir = opendir($backup_folder))) {
         //make file list
         while (FALSE !== ($file = readdir($dir))) {
             if (in_array($file, array('.', '..', 'index.php', '.htaccess', '.donotbackup')) || is_dir($backup_folder . $file) || is_link($backup_folder . $file)) {
                 continue;
             }
             if (is_readable($backup_folder . $file)) {
                 //file list for backups
                 $files[$filecounter]['folder'] = $backup_folder;
                 $files[$filecounter]['file'] = $backup_folder . $file;
                 $files[$filecounter]['filename'] = $file;
                 $files[$filecounter]['downloadurl'] = add_query_arg(array('page' => 'backwpupbackups', 'action' => 'downloadfolder', 'file' => $file, 'jobid' => $jobid), network_admin_url('admin.php'));
                 $files[$filecounter]['filesize'] = filesize($backup_folder . $file);
                 $files[$filecounter]['time'] = filemtime($backup_folder . $file);
                 $filecounter++;
             }
         }
         closedir($dir);
     }
     return $files;
 }
    /**
     * Page Output
     */
    public static function page()
    {
        global $wpdb;
        ?>
    <div class="wrap" id="backwpup-page">
		<h2><span id="backwpup-page-icon">&nbsp;</span><?php 
        echo sprintf(__('%s Settings', 'backwpup'), BackWPup::get_plugin_data('name'));
        ?>
</h2>
		<?php 
        $tabs = array('general' => __('General', 'backwpup'), 'job' => __('Jobs', 'backwpup'), 'log' => __('Logs', 'backwpup'), 'net' => __('Network', 'backwpup'), 'apikey' => __('API Keys', 'backwpup'), 'information' => __('Information', 'backwpup'));
        $tabs = apply_filters('backwpup_page_settings_tab', $tabs);
        echo '<h2 class="nav-tab-wrapper">';
        foreach ($tabs as $id => $name) {
            echo '<a href="#backwpup-tab-' . $id . '" class="nav-tab">' . $name . '</a>';
        }
        echo '</h2>';
        BackWPup_Admin::display_messages();
        ?>

    <form id="settingsform" action="<?php 
        echo admin_url('admin-post.php?action=backwpup');
        ?>
" method="post">
		<?php 
        wp_nonce_field('backwpupsettings_page');
        ?>
        <input type="hidden" name="page" value="backwpupsettings" />
    	<input type="hidden" name="anchor" value="#backwpup-tab-general" />

		<div class="table ui-tabs-hide" id="backwpup-tab-general">

			<h3 class="title"><?php 
        _e('Display Settings', 'backwpup');
        ?>
</h3>
            <p><?php 
        _e('Do you want to see BackWPup in the WordPress admin bar?', 'backwpup');
        ?>
</p>
            <table class="form-table">
                <tr>
                    <th scope="row"><?php 
        _e('Admin bar', 'backwpup');
        ?>
</th>
                    <td>
                        <fieldset>
                            <legend class="screen-reader-text"><span><?php 
        _e('Admin Bar', 'backwpup');
        ?>
</span>
                            </legend>
                            <label for="showadminbar">
                                <input name="showadminbar" type="checkbox" id="showadminbar"
                                       value="1" <?php 
        checked(get_site_option('backwpup_cfg_showadminbar'), TRUE);
        ?>
 />
								<?php 
        _e('Show BackWPup links in admin bar.', 'backwpup');
        ?>
</label>
                        </fieldset>
                    </td>
                </tr>
                <tr>
                    <th scope="row"><?php 
        _e('Folder sizes', 'backwpup');
        ?>
</th>
                    <td>
                        <fieldset>
                            <legend class="screen-reader-text"><span><?php 
        _e('Folder sizes', 'backwpup');
        ?>
</span>
                            </legend>
                            <label for="showfoldersize">
                                <input name="showfoldersize" type="checkbox" id="showfoldersize"
                                       value="1" <?php 
        checked(get_site_option('backwpup_cfg_showfoldersize'), TRUE);
        ?>
 />
								<?php 
        _e('Display folder sizes in the files tab when editing a job. (Might increase loading time of files tab.)', 'backwpup');
        ?>
</label>
                        </fieldset>
                    </td>
                </tr>
            </table>
			<h3 class="title"><?php 
        _e('Security', 'backwpup');
        ?>
</h3>
			<p><?php 
        _e('Security option for BackWPup', 'backwpup');
        ?>
</p>
            <table class="form-table">
                <tr>
                    <th scope="row"><?php 
        _e('Protect folders', 'backwpup');
        ?>
</th>
                    <td>
                        <fieldset>
                            <legend class="screen-reader-text"><span><?php 
        _e('Protect folders', 'backwpup');
        ?>
</span>
                            </legend>
                            <label for="protectfolders">
                                <input name="protectfolders" type="checkbox" id="protectfolders"
                                       value="1" <?php 
        checked(get_site_option('backwpup_cfg_protectfolders'), TRUE);
        ?>
 />
								<?php 
        _e('Protect BackWPup folders ( Temp, Log and Backups ) with <code>.htaccess</code> and <code>index.php</code>', 'backwpup');
        ?>
                            </label>
                        </fieldset>
                    </td>
                </tr>
            </table>

			<?php 
        do_action('backwpup_page_settings_tab_generel');
        ?>

		</div>

        <div class="table ui-tabs-hide" id="backwpup-tab-log">

            <p><?php 
        _e('Every time BackWPup runs a backup job, a log file is being generated. Choose where to store your log files and how many of them.', 'backwpup');
        ?>
</p>
            <table class="form-table">
                <tr>
                    <th scope="row"><label for="logfolder"><?php 
        _e('Log file folder', 'backwpup');
        ?>
</label></th>
                    <td>
                        <input name="logfolder" type="text" id="logfolder" title="<?php 
        esc_attr_e('You can use absolute or relative path! Relative path is relative to WP_CONTENT_DIR.', 'backwpup');
        ?>
"
                               value="<?php 
        echo get_site_option('backwpup_cfg_logfolder');
        ?>
"
                               class="regular-text code help-tip"/>
                    </td>
                </tr>
                <tr>
                    <th scope="row"><label for="maxlogs"><?php 
        _e('Maximum number of log files in folder', 'backwpup');
        ?>
</label>
                    </th>
                    <td>
                        <input name="maxlogs" type="text" id="maxlogs" title="<?php 
        esc_attr_e('Oldest files will be deleted first.', 'backwpup');
        ?>
"
                               value="<?php 
        echo get_site_option('backwpup_cfg_maxlogs');
        ?>
" class="small-text code help-tip"/>
                    </td>
                </tr>
                <tr>
                    <th scope="row"><?php 
        _e('Compression', 'backwpup');
        ?>
</th>
                    <td>
                        <fieldset>
                            <legend class="screen-reader-text"><span><?php 
        _e('Compression', 'backwpup');
        ?>
</span>
                            </legend>
                            <label for="gzlogs">
                                <input name="gzlogs" type="checkbox" id="gzlogs"
                                       value="1" <?php 
        checked(get_site_option('backwpup_cfg_gzlogs'), TRUE);
        if (!function_exists('gzopen')) {
            echo " disabled=\"disabled\"";
        }
        ?>
 />
								<?php 
        _e('Compress log files with GZip.', 'backwpup');
        ?>
</label>
                        </fieldset>
                    </td>
                </tr>
	            <tr>
		            <th scope="row"><?php 
        _e('Logging Level', 'backwpup');
        ?>
</th>
		            <td>
			            <fieldset>
				            <legend class="screen-reader-text"><span><?php 
        _e('Logging Level', 'backwpup');
        ?>
</span>
				            </legend>
				            <label for="loglevel">
					            <select name="loglevel" size="1" class="help-tip" title="<?php 
        esc_attr_e('Debug log has much more informations than normal logs. It is for support and should be handled carefully. For support is the best to use a not translated log file. Usage of not translated logs can reduce the PHP memory usage.', 'backwpup');
        ?>
">
						            <option value="normal_translated" <?php 
        selected(get_site_option('backwpup_cfg_loglevel'), 'normal_translated');
        ?>
><?php 
        _e('Normal (translated)', 'backwpup');
        ?>
</option>
						            <option value="normal" <?php 
        selected(get_site_option('backwpup_cfg_loglevel'), 'normal');
        ?>
><?php 
        _e('Normal (not translated)', 'backwpup');
        ?>
</option>
						            <option value="debug_translated" <?php 
        selected(get_site_option('backwpup_cfg_loglevel'), 'debug_translated');
        ?>
><?php 
        _e('Debug (translated)', 'backwpup');
        ?>
</option>
						            <option value="debug" <?php 
        selected(get_site_option('backwpup_cfg_loglevel'), 'debug');
        ?>
><?php 
        _e('Debug (not translated)', 'backwpup');
        ?>
</option>
					            </select>
				            </label>
			            </fieldset>
		            </td>
	            </tr>
            </table>

        </div>
        <div class="table ui-tabs-hide" id="backwpup-tab-job">

            <p><?php 
        _e('There are a couple of general options for backup jobs. Set them here.', 'backwpup');
        ?>
</p>
            <table class="form-table">
                <tr>
                    <th scope="row">
                        <label for="jobstepretry"><?php 
        _e("Maximum number of retries for job steps", 'backwpup');
        ?>
</label></th>
                    <td>
                        <input name="jobstepretry" type="text" id="jobstepretry"
                               value="<?php 
        echo get_site_option('backwpup_cfg_jobstepretry');
        ?>
"
                               class="small-text code" />
                    </td>
                </tr>
				<tr>
                    <th scope="row"><?php 
        _e('Maximum script execution time', 'backwpup');
        ?>
</th>
                    <td>
                        <fieldset>
                            <legend class="screen-reader-text"><span><?php 
        _e('Maximum PHP Script execution time', 'backwpup');
        ?>
</span>
                            </legend>
                            <label for="jobmaxexecutiontime">
                                <input name="jobmaxexecutiontime" type="text" id="jobmaxexecutiontime" size="3" title="<?php 
        esc_attr_e('Job will restart before hitting maximum execution time. It will not work with CLI and not on every step during execution. If <code>ALTERNATE_WP_CRON</code> has been defined, WordPress Cron will be used.', 'backwpup');
        ?>
"
                                       value="<?php 
        echo get_site_option('backwpup_cfg_jobmaxexecutiontime');
        ?>
" class="help-tip" />
								<?php 
        _e('seconds. 0 = disabled.', 'backwpup');
        ?>
							</label>
                        </fieldset>
                    </td>
                </tr>
				<tr>
                    <th scope="row"><?php 
        _e('Method for creating ZIP-file archives', 'backwpup');
        ?>
</th>
                    <td>
                        <fieldset>
                            <legend class="screen-reader-text"><span><?php 
        _e('Method for creating ZIP-file archives', 'backwpup');
        ?>
</span>
                            </legend>
                            <label for="jobziparchivemethod">
								<select name="jobziparchivemethod" size="1" class="help-tip" title="<?php 
        esc_attr_e('Auto = Uses PHP class ZipArchive if available; otherwise uses PclZip.<br />ZipArchive = Uses less memory, but many open files at a time.<br />PclZip = Uses more memory, but only 2 open files at a time.', 'backwpup');
        ?>
">
									<option value="" <?php 
        selected(get_site_option('backwpup_cfg_jobziparchivemethod'), '');
        ?>
><?php 
        _e('Auto', 'backwpup');
        ?>
</option>
                                    <option value="ZipArchive" <?php 
        selected(get_site_option('backwpup_cfg_jobziparchivemethod'), 'ZipArchive');
        disabled(function_exists('ZipArchive'), TRUE);
        ?>
><?php 
        _e('ZipArchive', 'backwpup');
        ?>
</option>
                                    <option value="PclZip" <?php 
        selected(get_site_option('backwpup_cfg_jobziparchivemethod'), 'PclZip');
        ?>
><?php 
        _e('PclZip', 'backwpup');
        ?>
</option>
                                </select>
                            </label>
                        </fieldset>
                    </td>
                </tr>
                <tr>
                    <th scope="row">
                        <label for="jobrunauthkey"><?php 
        _e('Key to start jobs externally with an URL', 'backwpup');
        ?>
</label>
                    </th>
                    <td>
                        <input name="jobrunauthkey" type="text" id="jobrunauthkey" title="<?php 
        esc_attr_e('empty = deactivated. Will be used to protect job starts from unauthorized person.', 'backwpup');
        ?>
"
                               value="<?php 
        echo get_site_option('backwpup_cfg_jobrunauthkey');
        ?>
" class="text code help-tip"/>
                    </td>
                </tr>
                <tr>
                    <th scope="row"><?php 
        _e('Reduce server load', 'backwpup');
        ?>
</th>
                    <td>
                        <fieldset>
                            <legend class="screen-reader-text"><span><?php 
        _e('Reduce server load', 'backwpup');
        ?>
</span>
                            </legend>
                            <label for="jobwaittimems">
								<select name="jobwaittimems" size="1" class="help-tip" title="<?php 
        esc_attr_e('This adds short pauses to the process. Can be used to reduce the CPU load.<br /> Disabled = off<br /> minimum = shortest sleep<br /> medium = middle between minimum and maximum<br /> maximum = longest sleep<br />', 'backwpup');
        ?>
">
									<option value="0" <?php 
        selected(get_site_option('backwpup_cfg_jobwaittimems'), 0);
        ?>
><?php 
        _e('disabled', 'backwpup');
        ?>
</option>
                                    <option value="10000" <?php 
        selected(get_site_option('backwpup_cfg_jobwaittimems'), 10000);
        ?>
><?php 
        _e('minimum', 'backwpup');
        ?>
</option>
                                    <option value="30000" <?php 
        selected(get_site_option('backwpup_cfg_jobwaittimems'), 30000);
        ?>
><?php 
        _e('medium', 'backwpup');
        ?>
</option>
                                    <option value="90000" <?php 
        selected(get_site_option('backwpup_cfg_jobwaittimems'), 90000);
        ?>
><?php 
        _e('maximum', 'backwpup');
        ?>
</option>
                                </select>
                            </label>
                        </fieldset>
                    </td>
                </tr>
	            <tr>
		            <th scope="row"><?php 
        _e('Empty output on working', 'backwpup');
        ?>
</th>
		            <td>
			            <fieldset>
				            <legend class="screen-reader-text"><span><?php 
        _e('Enable an empty Output on backup working.', 'backwpup');
        ?>
</span>
				            </legend>
				            <label for="jobdooutput">
					            <input name="jobdooutput" type="checkbox" id="jobdooutput" class="help-tip" title="<?php 
        esc_attr_e('This do an empty output on job working. This can help in some situations or can brake the working. You must test it.', 'backwpup');
        ?>
"
						            value="1" <?php 
        checked(get_site_option('backwpup_cfg_jobdooutput'), TRUE);
        ?>
 />
					            <?php 
        _e('Enable an empty Output on backup working.', 'backwpup');
        ?>
				            </label>
			            </fieldset>
		            </td>
	            </tr>
            </table>

        </div>

        <div class="table ui-tabs-hide" id="backwpup-tab-net">

			<h3 class="title"><?php 
        echo sprintf(__('Authentication for <code>%s</code>', 'backwpup'), site_url('wp-cron.php'));
        ?>
</h3>
            <p><?php 
        _e('Is your blog protected with HTTP basic authentication (.htaccess)? Or did you use a Plugin to secure wp-cron.php than use the authentication methods below', 'backwpup');
        ?>
</p>
            <?php 
        $authentication = get_site_option('backwpup_cfg_authentication', array('method' => '', 'basic_user' => '', 'basic_password' => '', 'user_id' => 0, 'query_arg' => ''));
        ?>
	        <table class="form-table">
	            <tr>
		            <th scope="row"><?php 
        _e('Authentication method', 'backwpup');
        ?>
</th>
		            <td>
			            <fieldset>
				            <legend class="screen-reader-text"><span><?php 
        _e('Authentication method', 'backwpup');
        ?>
</span></legend>
				            <label for="authentication_method">
					            <select name="authentication_method" id="authentication_method" size="1" >
						            <option value="" <?php 
        selected($authentication['method'], '');
        ?>
><?php 
        _e('none', 'backwpup');
        ?>
</option>
						            <option value="basic" <?php 
        selected($authentication['method'], 'basic');
        ?>
><?php 
        _e('Basic auth', 'backwpup');
        ?>
</option>
						            <option value="user" <?php 
        selected($authentication['method'], 'user');
        ?>
><?php 
        _e('WordPress User', 'backwpup');
        ?>
</option>
						            <option value="query_arg" <?php 
        selected($authentication['method'], 'query_arg');
        ?>
><?php 
        _e('Query argument', 'backwpup');
        ?>
</option>
					            </select>
				            </label>
			            </fieldset>
		            </td>
	            </tr>
                <tr class="authentication_basic" <?php 
        if ($authentication['method'] != 'basic') {
            echo 'style="display:none"';
        }
        ?>
>
                    <th scope="row"><label for="authentication_basic_user"><?php 
        _e('Basic Auth Username:'******'backwpup');
        ?>
</label></th>
                    <td>
                        <input name="authentication_basic_user" type="text" id="authentication_basic_user"
                               value="<?php 
        echo $authentication['basic_user'];
        ?>
"
                               class="regular-text" autocomplete="off" />
                    </td>
                </tr>
                <tr class="authentication_basic" <?php 
        if ($authentication['method'] != 'basic') {
            echo 'style="display:none"';
        }
        ?>
>
			        <th scope="row"><label for="authentication_basic_password"><?php 
        _e('Basic Auth Password:'******'backwpup');
        ?>
</label></th>
			        <td>
				        <input name="authentication_basic_password" type="password" id="authentication_basic_password"
					        value="<?php 
        echo BackWPup_Encryption::decrypt($authentication['basic_password']);
        ?>
"
					        class="regular-text" autocomplete="off" />
		        </tr>
		        <tr class="authentication_user" <?php 
        if ($authentication['method'] != 'user') {
            echo 'style="display:none"';
        }
        ?>
>
			        <th scope="row"><?php 
        _e('Select WordPress User', 'backwpup');
        ?>
</th>
			        <td>
				        <fieldset>
					        <legend class="screen-reader-text"><span><?php 
        _e('Select WordPress User', 'backwpup');
        ?>
</span>
					        </legend>
					        <label for="authentication_user_id">
						        <select name="authentication_user_id" size="1" >
							        <?php 
        $users = get_users(array('who' => 'administrators', 'number' => 99, 'orderby' => 'display_name'));
        foreach ($users as $user) {
            echo '<option value="' . $user->ID . '" ' . selected($authentication['user_id'], $user->ID, FALSE) . '>' . esc_attr($user->display_name) . '</option>';
        }
        ?>
						        </select>
					        </label>
				        </fieldset>
			        </td>
		        </tr>
		        <tr class="authentication_query_arg" <?php 
        if ($authentication['method'] != 'query_arg') {
            echo 'style="display:none"';
        }
        ?>
>
			        <th scope="row"><label for="authentication_query_arg"><?php 
        _e('Query arg key=value:', 'backwpup');
        ?>
</label></th>
			        <td>
				        ?<input name="authentication_query_arg" type="text" id="authentication_query_arg"
					        value="<?php 
        echo $authentication['query_arg'];
        ?>
"
					        class="regular-text" />
		        </tr>
            </table>

        </div>

        <div class="table ui-tabs-hide" id="backwpup-tab-apikey">

			<?php 
        do_action('backwpup_page_settings_tab_apikey');
        ?>

        </div>

        <div class="table ui-tabs-hide" id="backwpup-tab-information">
			<br />
			<?php 
        echo '<table class="wp-list-table widefat fixed" cellspacing="0" style="width: 85%;margin-left:auto;;margin-right:auto;">';
        echo '<thead><tr><th width="35%">' . __('Setting', 'backwpup') . '</th><th>' . __('Value', 'backwpup') . '</th></tr></thead>';
        echo '<tfoot><tr><th>' . __('Setting', 'backwpup') . '</th><th>' . __('Value', 'backwpup') . '</th></tr></tfoot>';
        echo '<tr title="&gt;=3.2"><td>' . __('WordPress version', 'backwpup') . '</td><td>' . BackWPup::get_plugin_data('wp_version') . '</td></tr>';
        if (!class_exists('BackWPup_Pro', FALSE)) {
            echo '<tr title=""><td>' . __('BackWPup version', 'backwpup') . '</td><td>' . BackWPup::get_plugin_data('Version') . ' <a href="' . translate(BackWPup::get_plugin_data('pluginuri'), 'backwpup') . '">' . __('Get pro.', 'backwpup') . '</a></td></tr>';
        } else {
            echo '<tr title=""><td>' . __('BackWPup Pro version', 'backwpup') . '</td><td>' . BackWPup::get_plugin_data('Version') . '</td></tr>';
        }
        $bit = '';
        if (PHP_INT_SIZE === 4) {
            $bit = ' (32bit)';
        }
        if (PHP_INT_SIZE === 8) {
            $bit = ' (64bit)';
        }
        echo '<tr title="&gt;=5.3.3"><td>' . __('PHP version', 'backwpup') . '</td><td>' . PHP_VERSION . ' ' . $bit . '</td></tr>';
        echo '<tr title="&gt;=5.0.7"><td>' . __('MySQL version', 'backwpup') . '</td><td>' . $wpdb->get_var("SELECT VERSION() AS version") . '</td></tr>';
        if (function_exists('curl_version')) {
            $curlversion = curl_version();
            echo '<tr title=""><td>' . __('cURL version', 'backwpup') . '</td><td>' . $curlversion['version'] . '</td></tr>';
            echo '<tr title=""><td>' . __('cURL SSL version', 'backwpup') . '</td><td>' . $curlversion['ssl_version'] . '</td></tr>';
        } else {
            echo '<tr title=""><td>' . __('cURL version', 'backwpup') . '</td><td>' . __('unavailable', 'backwpup') . '</td></tr>';
        }
        echo '<tr title=""><td>' . __('WP-Cron url:', 'backwpup') . '</td><td>' . site_url('wp-cron.php') . '</td></tr>';
        //response test
        echo '<tr><td>' . __('Server self connect:', 'backwpup') . '</td><td>';
        $raw_response = BackWPup_Job::get_jobrun_url('test');
        $test_result = '';
        if (is_wp_error($raw_response)) {
            $test_result .= sprintf(__('The HTTP response test get an error "%s"', 'backwpup'), $raw_response->get_error_message());
        } elseif (200 != wp_remote_retrieve_response_code($raw_response) && 204 != wp_remote_retrieve_response_code($raw_response)) {
            $test_result .= sprintf(__('The HTTP response test get a false http status (%s)', 'backwpup'), wp_remote_retrieve_response_code($raw_response));
        }
        $headers = wp_remote_retrieve_headers($raw_response);
        if (isset($headers['x-backwpup-ver']) && $headers['x-backwpup-ver'] != BackWPup::get_plugin_data('version')) {
            $test_result .= sprintf(__('The BackWPup HTTP response header returns a false value: "%s"', 'backwpup'), $headers['x-backwpup-ver']);
        }
        if (empty($test_result)) {
            _e('Response Test O.K.', 'backwpup');
        } else {
            echo $test_result;
        }
        echo '</td></tr>';
        //folder test
        echo '<tr><td>' . __('Temp folder:', 'backwpup') . '</td><td>';
        if (!is_dir(BackWPup::get_plugin_data('TEMP'))) {
            echo sprintf(__('Temp folder %s doesn\'t exist.', 'backwpup'), BackWPup::get_plugin_data('TEMP'));
        } elseif (!is_writable(BackWPup::get_plugin_data('TEMP'))) {
            echo sprintf(__('Temporary folder %s is not writable.', 'backwpup'), BackWPup::get_plugin_data('TEMP'));
        } else {
            echo BackWPup::get_plugin_data('TEMP');
        }
        echo '</td></tr>';
        $log_folder = get_site_option('backwpup_cfg_logfolder');
        $log_folder = BackWPup_File::get_absolute_path($log_folder);
        echo '<tr><td>' . __('Log folder:', 'backwpup') . '</td><td>';
        if (!is_dir($log_folder)) {
            echo sprintf(__('Logs folder %s not exist.', 'backwpup'), $log_folder);
        } elseif (!is_writable($log_folder)) {
            echo sprintf(__('Log folder %s is not writable.', 'backwpup'), $log_folder);
        } else {
            echo $log_folder;
        }
        echo '</td></tr>';
        echo '<tr title=""><td>' . __('Server', 'backwpup') . '</td><td>' . $_SERVER['SERVER_SOFTWARE'] . '</td></tr>';
        echo '<tr title=""><td>' . __('Operating System', 'backwpup') . '</td><td>' . PHP_OS . '</td></tr>';
        echo '<tr title=""><td>' . __('PHP SAPI', 'backwpup') . '</td><td>' . PHP_SAPI . '</td></tr>';
        echo '<tr title=""><td>' . __('Current PHP user', 'backwpup') . '</td><td>' . get_current_user() . '</td></tr>';
        $text = (bool) ini_get('safe_mode') ? __('On', 'backwpup') : __('Off', 'backwpup');
        echo '<tr title=""><td>' . __('Safe Mode', 'backwpup') . '</td><td>' . $text . '</td></tr>';
        echo '<tr title="&gt;=30"><td>' . __('Maximum execution time', 'backwpup') . '</td><td>' . ini_get('max_execution_time') . ' ' . __('seconds', 'backwpup') . '</td></tr>';
        if (defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON) {
            echo '<tr title="ALTERNATE_WP_CRON"><td>' . __('Alternative WP Cron', 'backwpup') . '</td><td>' . __('On', 'backwpup') . '</td></tr>';
        } else {
            echo '<tr title="ALTERNATE_WP_CRON"><td>' . __('Alternative WP Cron', 'backwpup') . '</td><td>' . __('Off', 'backwpup') . '</td></tr>';
        }
        if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON) {
            echo '<tr title="DISABLE_WP_CRON"><td>' . __('Disabled WP Cron', 'backwpup') . '</td><td>' . __('On', 'backwpup') . '</td></tr>';
        } else {
            echo '<tr title="DISABLE_WP_CRON"><td>' . __('Disabled WP Cron', 'backwpup') . '</td><td>' . __('Off', 'backwpup') . '</td></tr>';
        }
        if (defined('FS_CHMOD_DIR')) {
            echo '<tr title="FS_CHMOD_DIR"><td>' . __('CHMOD Dir', 'backwpup') . '</td><td>' . FS_CHMOD_DIR . '</td></tr>';
        } else {
            echo '<tr title="FS_CHMOD_DIR"><td>' . __('CHMOD Dir', 'backwpup') . '</td><td>0755</td></tr>';
        }
        $now = localtime(time(), TRUE);
        echo '<tr title=""><td>' . __('Server Time', 'backwpup') . '</td><td>' . $now['tm_hour'] . ':' . $now['tm_min'] . '</td></tr>';
        echo '<tr title=""><td>' . __('Blog Time', 'backwpup') . '</td><td>' . date('H:i', current_time('timestamp')) . '</td></tr>';
        echo '<tr title=""><td>' . __('Blog Timezone', 'backwpup') . '</td><td>' . get_option('timezone_string') . '</td></tr>';
        echo '<tr title=""><td>' . __('Blog Time offset', 'backwpup') . '</td><td>' . sprintf(__('%s hours', 'backwpup'), get_option('gmt_offset')) . '</td></tr>';
        echo '<tr title="WPLANG"><td>' . __('Blog language', 'backwpup') . '</td><td>' . get_bloginfo('language') . '</td></tr>';
        echo '<tr title="utf8"><td>' . __('MySQL Client encoding', 'backwpup') . '</td><td>';
        echo defined('DB_CHARSET') ? DB_CHARSET : '';
        echo '</td></tr>';
        echo '<tr title="URF-8"><td>' . __('Blog charset', 'backwpup') . '</td><td>' . get_bloginfo('charset') . '</td></tr>';
        echo '<tr title="&gt;=128M"><td>' . __('PHP Memory limit', 'backwpup') . '</td><td>' . ini_get('memory_limit') . '</td></tr>';
        echo '<tr title="WP_MEMORY_LIMIT"><td>' . __('WP memory limit', 'backwpup') . '</td><td>' . WP_MEMORY_LIMIT . '</td></tr>';
        echo '<tr title="WP_MAX_MEMORY_LIMIT"><td>' . __('WP maximum memory limit', 'backwpup') . '</td><td>' . WP_MAX_MEMORY_LIMIT . '</td></tr>';
        echo '<tr title=""><td>' . __('Memory in use', 'backwpup') . '</td><td>' . size_format(@memory_get_usage(TRUE), 2) . '</td></tr>';
        //disabled PHP functions
        $disabled = ini_get('disable_functions');
        if (!empty($disabled)) {
            $disabledarry = explode(',', $disabled);
            echo '<tr title=""><td>' . __('Disabled PHP Functions:', 'backwpup') . '</td><td>';
            echo implode(', ', $disabledarry);
            echo '</td></tr>';
        }
        //Loaded PHP Extensions
        echo '<tr title=""><td>' . __('Loaded PHP Extensions:', 'backwpup') . '</td><td>';
        $extensions = get_loaded_extensions();
        sort($extensions);
        echo implode(', ', $extensions);
        echo '</td></tr>';
        echo '</table>';
        ?>
        </div>

		<?php 
        do_action('backwpup_page_settings_tab_content');
        ?>

        <p class="submit">
            <input type="submit" name="submit" id="submit" class="button-primary" value="<?php 
        _e('Save Changes', 'backwpup');
        ?>
" />
			&nbsp;
			<input type="submit" name="default_settings" id="default_settings" class="button-secondary" value="<?php 
        _e('Reset all settings to default', 'backwpup');
        ?>
" />
        </p>
    </form>
    </div>
	<?php 
    }
示例#10
0
 /**
  *
  * Get folder to exclude from a given folder for file backups
  *
  * @param $folder string folder to check for excludes
  *
  * @return array of folder to exclude
  */
 private function get_exclude_dirs($folder)
 {
     $folder = trailingslashit(str_replace('\\', '/', realpath($folder)));
     $excludedir = array();
     $excludedir[] = trailingslashit(str_replace('\\', '/', realpath(BackWPup::get_plugin_data('TEMP'))));
     //exclude temp
     $excludedir[] = trailingslashit(str_replace('\\', '/', realpath(get_site_option('backwpup_cfg_logfolder'))));
     //exclude log folder
     if (FALSE !== strpos(trailingslashit(str_replace('\\', '/', realpath(ABSPATH))), $folder) && trailingslashit(str_replace('\\', '/', realpath(ABSPATH))) != $folder) {
         $excludedir[] = trailingslashit(str_replace('\\', '/', realpath(ABSPATH)));
     }
     if (FALSE !== strpos(trailingslashit(str_replace('\\', '/', realpath(WP_CONTENT_DIR))), $folder) && trailingslashit(str_replace('\\', '/', realpath(WP_CONTENT_DIR))) != $folder) {
         $excludedir[] = trailingslashit(str_replace('\\', '/', realpath(WP_CONTENT_DIR)));
     }
     if (FALSE !== strpos(trailingslashit(str_replace('\\', '/', realpath(WP_PLUGIN_DIR))), $folder) && trailingslashit(str_replace('\\', '/', realpath(WP_PLUGIN_DIR))) != $folder) {
         $excludedir[] = trailingslashit(str_replace('\\', '/', realpath(WP_PLUGIN_DIR)));
     }
     if (FALSE !== strpos(trailingslashit(str_replace('\\', '/', realpath(get_theme_root()))), $folder) && trailingslashit(str_replace('\\', '/', realpath(get_theme_root()))) != $folder) {
         $excludedir[] = trailingslashit(str_replace('\\', '/', realpath(get_theme_root())));
     }
     if (FALSE !== strpos(trailingslashit(realpath(BackWPup_File::get_upload_dir())), $folder) && trailingslashit(realpath(BackWPup_File::get_upload_dir())) != $folder) {
         $excludedir[] = trailingslashit(realpath(BackWPup_File::get_upload_dir()));
     }
     //Exclude Backup dirs
     $jobids = BackWPup_Option::get_job_ids();
     foreach ($jobids as $id) {
         $backupdir = realpath(BackWPup_Option::get($id, 'backupdir'));
         if (!empty($backupdir) && $backupdir != '/') {
             $excludedir[] = trailingslashit(str_replace('\\', '/', $backupdir));
         }
     }
     return array_unique($excludedir);
 }
 /**
  *
  * Get folder to exclude from a given folder for file backups
  *
  * @param $folder string folder to check for excludes
  *
  * @return array of folder to exclude
  */
 private function get_exclude_dirs($folder)
 {
     $folder = trailingslashit(str_replace('\\', '/', realpath($folder)));
     $excludedir = array();
     if (FALSE !== strpos(trailingslashit(str_replace('\\', '/', realpath(ABSPATH))), $folder) && trailingslashit(str_replace('\\', '/', realpath(ABSPATH))) != $folder) {
         $excludedir[] = trailingslashit(str_replace('\\', '/', realpath(ABSPATH)));
     }
     if (FALSE !== strpos(trailingslashit(str_replace('\\', '/', realpath(WP_CONTENT_DIR))), $folder) && trailingslashit(str_replace('\\', '/', realpath(WP_CONTENT_DIR))) != $folder) {
         $excludedir[] = trailingslashit(str_replace('\\', '/', realpath(WP_CONTENT_DIR)));
     }
     if (FALSE !== strpos(trailingslashit(str_replace('\\', '/', realpath(WP_PLUGIN_DIR))), $folder) && trailingslashit(str_replace('\\', '/', realpath(WP_PLUGIN_DIR))) != $folder) {
         $excludedir[] = trailingslashit(str_replace('\\', '/', realpath(WP_PLUGIN_DIR)));
     }
     if (FALSE !== strpos(trailingslashit(str_replace('\\', '/', realpath(get_theme_root()))), $folder) && trailingslashit(str_replace('\\', '/', realpath(get_theme_root()))) != $folder) {
         $excludedir[] = trailingslashit(str_replace('\\', '/', realpath(get_theme_root())));
     }
     if (FALSE !== strpos(trailingslashit(str_replace('\\', '/', realpath(BackWPup_File::get_upload_dir()))), $folder) && trailingslashit(str_replace('\\', '/', realpath(BackWPup_File::get_upload_dir()))) != $folder) {
         $excludedir[] = trailingslashit(str_replace('\\', '/', realpath(BackWPup_File::get_upload_dir())));
     }
     return array_unique($excludedir);
 }
 function mainwp_backwpup_get_exclude_dirs($folder)
 {
     $folder = trailingslashit(str_replace('\\', '/', realpath($folder)));
     $exclude_dir_array = array();
     if (false !== strpos(trailingslashit(str_replace('\\', '/', realpath(ABSPATH))), $folder) && trailingslashit(str_replace('\\', '/', realpath(ABSPATH))) != $folder) {
         $exclude_dir_array[] = trailingslashit(str_replace('\\', '/', realpath(ABSPATH)));
     }
     if (false !== strpos(trailingslashit(str_replace('\\', '/', realpath(WP_CONTENT_DIR))), $folder) && trailingslashit(str_replace('\\', '/', realpath(WP_CONTENT_DIR))) != $folder) {
         $exclude_dir_array[] = trailingslashit(str_replace('\\', '/', realpath(WP_CONTENT_DIR)));
     }
     if (false !== strpos(trailingslashit(str_replace('\\', '/', realpath(WP_PLUGIN_DIR))), $folder) && trailingslashit(str_replace('\\', '/', realpath(WP_PLUGIN_DIR))) != $folder) {
         $exclude_dir_array[] = trailingslashit(str_replace('\\', '/', realpath(WP_PLUGIN_DIR)));
     }
     if (false !== strpos(trailingslashit(str_replace('\\', '/', realpath(get_theme_root()))), $folder) && trailingslashit(str_replace('\\', '/', realpath(get_theme_root()))) != $folder) {
         $exclude_dir_array[] = trailingslashit(str_replace('\\', '/', realpath(get_theme_root())));
     }
     if (false !== strpos(trailingslashit(str_replace('\\', '/', realpath(BackWPup_File::get_upload_dir()))), $folder) && trailingslashit(str_replace('\\', '/', realpath(BackWPup_File::get_upload_dir()))) != $folder) {
         $exclude_dir_array[] = trailingslashit(str_replace('\\', '/', realpath(BackWPup_File::get_upload_dir())));
     }
     return array_unique($exclude_dir_array);
 }
示例#13
0
 /**
  * @param $jobid
  */
 public static function start_cli($jobid)
 {
     if (php_sapi_name() != 'cli') {
         return;
     }
     //define DOING_CRON to prevent caching
     if (!defined('DOING_CRON')) {
         define('DOING_CRON', true);
     }
     //load text domain
     $log_level = get_site_option('backwpup_cfg_loglevel', 'normal_translated');
     if (strstr($log_level, 'translated')) {
         BackWPup::load_text_domain();
     } else {
         add_filter('override_load_textdomain', '__return_true');
         $GLOBALS['l10n'] = array();
     }
     $jobid = absint($jobid);
     //Logs Folder
     $log_folder = get_site_option('backwpup_cfg_logfolder');
     $log_folder = BackWPup_File::get_absolute_path($log_folder);
     //check job id exists
     $jobids = BackWPup_Option::get_job_ids();
     if (!in_array($jobid, $jobids, true)) {
         die(__('Wrong BackWPup JobID', 'backwpup'));
     }
     //check folders
     $log_folder_message = BackWPup_File::check_folder($log_folder);
     if (!empty($log_folder_message)) {
         die($log_folder_message);
     }
     $log_folder_message = BackWPup_File::check_folder(BackWPup::get_plugin_data('TEMP'), true);
     if (!empty($log_folder_message)) {
         die($log_folder_message);
     }
     //check running job
     if (file_exists(BackWPup::get_plugin_data('running_file'))) {
         die(__('A BackWPup job is already running', 'backwpup'));
     }
     //start class
     $backwpup_job_object = new self();
     $backwpup_job_object->create('runcli', (int) $jobid);
     $backwpup_job_object->run();
 }