Exemple #1
0
 function api()
 {
     die('0');
     // TODO: Internal security lockout.
     if (!isset(pb_backupbuddy::$options['api_key_test']) || pb_backupbuddy::$options['api_key_test'] == '') {
         die('0');
     }
     if (pb_backupbuddy::$options['api_key_test'] != 'dsnfilasbfisybfdjybfjalybsfaklsbfa') {
         die('0');
     }
     $run = pb_backupbuddy::_POST('run');
     // TODO: TESTING temp allow GET method:
     if ('' == $run) {
         $run = pb_backupbuddy::_GET('run');
     }
     if ('' == $run) {
         die(json_encode(array('success' => false, 'error' => 'Error #489384: Missing run command.')));
     } else {
         if (false === ($return = call_user_func('backupbuddy_api::' . $run))) {
             die(json_encode(array('success' => false, 'error' => 'Error #328983: Command failed.')));
         } else {
             die(json_encode(array('success' => true, 'version' => pb_backupbuddy::settings('version'), 'data' => $return)));
         }
     }
     die;
 }
Exemple #2
0
 public static function configure($destination_settings, $mode)
 {
     // Initialize destination.
     $destination_class = self::_init_destination($destination_settings['type']);
     if (!class_exists($destination_class)) {
         echo '{Error #546893498a. Destination configuration file missing. Missing class: `' . $destination_class . '`}';
         return false;
     }
     // Default settings.
     // Get default settings from class. Was using a variable class name but had to change this for PHP 5.2 compat.
     $vars = get_class_vars($destination_class);
     $default_settings = $vars['default_settings'];
     unset($vars);
     $destination_settings = array_merge($default_settings, $destination_settings);
     // Merge in defaults.
     // Get default info from class. Was using a variable class name but had to change this for PHP 5.2 compat.
     $vars = get_class_vars($destination_class);
     $default_info = $vars['destination_info'];
     unset($vars);
     $destination_info = array_merge(self::$_destination_info_defaults, $default_info);
     // Merge in defaults.
     $settings_form = new pb_backupbuddy_settings('settings', $destination_settings, 'sending=' . pb_backupbuddy::_GET('sending'));
     $settings_form->add_setting(array('type' => 'hidden', 'name' => 'type', 'value' => $destination_settings['type']));
     $config_file = pb_backupbuddy::plugin_path() . '/destinations/' . $destination_settings['type'] . '/_configure.php';
     if (file_exists($config_file)) {
         require $config_file;
     } else {
         echo '{Error #54556543. Missing destination config file `' . $config_file . '`.}';
         return false;
     }
     return $settings_form;
 }
Exemple #3
0
 public static function check($force_check = false)
 {
     if (true === self::$_checked && $force_check === false) {
         // Skip checking if already skipped unless forcing.
         return self::$_authenticated;
     }
     $login_attempt_file = ABSPATH . 'importbuddy/_login_attempts.php';
     $login_attempts = 1;
     if (file_exists($login_attempt_file)) {
         $login_attempts = @file_get_contents($login_attempt_file);
     }
     if (false !== $login_attempts) {
         $login_attempts = trim(str_replace('<?php die(); ?>', '', $login_attempts));
         if ($login_attempts > self::MAX_LOGIN_ATTEMPTS_ALLOWED) {
             die('Access Denied. Maximum login attempts exceeded. You must delete "_login_attempts.php" in the importbuddy directory to unloack this script to allow it to continue.');
         }
     }
     $actual_pass_hash = PB_PASSWORD;
     if ('#PASSWORD#' == $actual_pass_hash || '' == $actual_pass_hash) {
         die('Error #84578459745. A password must be set.');
     }
     if (pb_backupbuddy::_POST('password') != '') {
         $supplied_pass_hash = md5(pb_backupbuddy::_POST('password'));
     } else {
         if (pb_backupbuddy::_GET('v') != '') {
             // Hash submitted by magic migration.
             $supplied_pass_hash = pb_backupbuddy::_GET('v');
         } else {
             // Normal form submitted hash.
             if (pb_backupbuddy::_POST('pass_hash') != '') {
                 $supplied_pass_hash = pb_backupbuddy::_POST('pass_hash');
             } elseif (pb_backupbuddy::_POST('pb_backupbuddy_pass_hash') != '') {
                 $supplied_pass_hash = pb_backupbuddy::_POST('pb_backupbuddy_pass_hash');
             } else {
                 $supplied_pass_hash = '';
             }
         }
     }
     if ($supplied_pass_hash == $actual_pass_hash) {
         self::$_authenticated = true;
     } else {
         // Incorrect hash. Reset settings & track attempts.
         if ('' != $supplied_pass_hash) {
             // Dont count blank hash as an attempt.
             if (true === self::RESET_DEFAULTS_ON_INVALID_LOGIN) {
                 pb_backupbuddy::reset_defaults();
             }
             if (false !== $login_attempts) {
                 global $pb_login_attempts;
                 $pb_login_attempts = $login_attempts;
                 @file_put_contents($login_attempt_file, '<?php die(); ?>' . ($login_attempts + 1));
             }
         }
     }
     self::$_checked = true;
     return self::$_authenticated;
 }
		if( jQuery( '#' + target_id ).length == 0 ) { // No status box yet so suppress.
			return;
		}
		jQuery( '#' + target_id ).append( "\n" + message );
		textareaelem = document.getElementById( target_id );
		textareaelem.scrollTop = textareaelem.scrollHeight;
	}
	
	function backupbuddy_hourpad(n) { return ("0" + n).slice(-2); }
</script>
<?php 
$success = false;
global $pb_backupbuddy_js_status;
$pb_backupbuddy_js_status = true;
echo pb_backupbuddy::status_box('Restoring . . .');
echo '<div id="pb_backupbuddy_working" style="width: 100px;"><br><center><img src="' . pb_backupbuddy::plugin_url() . '/images/working.gif" title="Working... Please wait as this may take a moment..."></center></div>';
pb_backupbuddy::set_status_serial('restore');
global $wp_version;
pb_backupbuddy::status('details', 'BackupBuddy v' . pb_backupbuddy::settings('version') . ' using WordPress v' . $wp_version . ' on ' . PHP_OS . '.');
$archive_file = pb_backupbuddy::_GET('archive');
// archive to extract from.
require pb_backupbuddy::plugin_path() . '/classes/_restoreFiles.php';
$result = backupbuddy_restore_files::restore(backupbuddy_core::getBackupDirectory() . $archive_file, $files, $finalPath = ABSPATH);
echo '<script type="text/javascript">jQuery("#pb_backupbuddy_working").hide();</script>';
pb_backupbuddy::flush();
if (false === $result) {
} else {
}
pb_backupbuddy::$ui->ajax_footer();
pb_backupbuddy::$ui->ajax_footer();
die;
	</script>
	<?php 
}
$default_name = NULL;
if ('add' == $mode) {
    $default_name = 'My FTP';
}
$settings_form->add_setting(array('type' => 'text', 'name' => 'title', 'title' => __('Destination name', 'it-l10n-backupbuddy'), 'tip' => __('Name of the new destination to create. This is for your convenience only.', 'it-l10n-backupbuddy'), 'rules' => 'required|string[1-45]', 'default' => $default_name));
$settings_form->add_setting(array('type' => 'text', 'name' => 'address', 'title' => __('Server address', 'it-l10n-backupbuddy'), 'tip' => __('[Example: ftp.foo.com] - FTP server address.  Do not include http:// or ftp:// or any other prefixes. You may specify an alternate port in the format of ftp_address:ip_address such as yourftp.com:21', 'it-l10n-backupbuddy'), 'rules' => 'required|string[0-500]'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'username', 'title' => __('Username', 'it-l10n-backupbuddy'), 'tip' => __('[Example: foo] - Username to use when connecting to the FTP server.', 'it-l10n-backupbuddy'), 'rules' => 'required|string[0-250]'));
$settings_form->add_setting(array('type' => 'password', 'name' => 'password', 'title' => __('Password', 'it-l10n-backupbuddy'), 'tip' => __('[Example: 1234xyz] - Password to use when connecting to the FTP server.', 'it-l10n-backupbuddy'), 'rules' => 'required|string[0-250]'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'path', 'title' => __('Remote path (optional)', 'it-l10n-backupbuddy'), 'tip' => __('[Example: /public_html/backups] - Remote path to place uploaded files into on the destination FTP server. Make sure this path is correct; if it does not exist BackupBuddy will attempt to create it. No trailing slash is needed.', 'it-l10n-backupbuddy'), 'rules' => 'string[0-500]', 'after' => ' <span class="pb_backupbuddy_ftpdestination_pathpicker">
							<a href="#" class="button secondary-button" title="Browse FTP Folders">Browse & Select FTP Path</a>
							<img class="pb_backupbuddy_ftppicker_load" style="vertical-align: -3px; margin-left: 5px; display: none;" src="' . pb_backupbuddy::plugin_url() . '/images/loading.gif" title="Loading... This may take a few seconds...">
						</span>
						<div class="pb_backupbuddy_ftpdestination_pathpickerbox" style="margin-top: 10px; display: none;">Loading...</div>'));
if (pb_backupbuddy::_GET('add') != '') {
    // set default only when adding.
    $default_url = rtrim(site_url(), '/\\') . '/';
} else {
    $default_url = '';
}
$settings_form->add_setting(array('type' => 'text', 'name' => 'url', 'title' => __('Migration URL', 'it-l10n-backupbuddy') . '<br><span class="description">Optional, for migrations</span>', 'tip' => __('Enter the URL corresponding to the FTP destination path. This URL must lead to the location where files uploaded to this remote destination would end up. If the destination is in a subdirectory make sure to match it in the corresponding URL.', 'it-l10n-backupbuddy'), 'css' => 'width: 50%; max-width: 700px;', 'default' => $default_url, 'rules' => 'string[0-500]'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'archive_limit', 'title' => __('Archive limit', 'it-l10n-backupbuddy'), 'tip' => __('[Example: 5] - Enter 0 for no limit. This is the maximum number of archives to be stored in this specific destination. If this limit is met the oldest backups will be deleted.', 'it-l10n-backupbuddy'), 'rules' => 'required|int[0-9999999]', 'css' => 'width: 50px;', 'after' => ' backups'));
$settings_form->add_setting(array('type' => 'title', 'name' => 'advanced_begin', 'title' => '<span class="dashicons dashicons-arrow-right"></span> ' . __('Advanced Options', 'it-l10n-backupbuddy'), 'row_class' => 'advanced-toggle-title'));
$settings_form->add_setting(array('type' => 'select', 'name' => 'active_mode', 'title' => __('Transfer mode', 'it-l10n-backupbuddy'), 'options' => array('1' => __('Active', 'it-l10n-backupbuddy'), '0' => __('Passive (default)', 'it-l10n-backupbuddy')), 'tip' => __('[Default: Passive] - Determines whether the FTP file transfer happens in FTP active or passive mode.  Some servers or those behind a firewall may need to use PASV, or passive mode as a workaround.', 'it-l10n-backupbuddy'), 'rules' => 'required', 'row_class' => 'advanced-toggle'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'ftps', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Use FTPs encryption', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled] - Select whether this connection is for FTP or FTPs (enabled; FTP over SSL). Note that FTPs is NOT the same as sFTP (FTP over SSH) and is not compatible or equal.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Not supported by most servers', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required', 'row_class' => 'advanced-toggle'));
if ($mode !== 'edit') {
    $settings_form->add_setting(array('type' => 'checkbox', 'name' => 'disable_file_management', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Disable file management', 'it-l10n-backupbuddy'), 'tip' => __('[Default: unchecked] - When checked, selecting this destination disables browsing or accessing files stored at this destination from within BackupBuddy.', 'it-l10n-backupbuddy'), 'css' => '', 'rules' => '', 'row_class' => 'advanced-toggle'));
}
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'disabled', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Disable destination', 'it-l10n-backupbuddy'), 'tip' => __('[Default: unchecked] - When checked, this destination will be disabled and unusable until re-enabled. Use this if you need to temporary turn a destination off but don\\t want to delete it.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Check to disable this destination until re-enabled.', 'it-l10n-backupbuddy') . '</span>', 'rules' => '', 'row_class' => 'advanced-toggle'));
Exemple #6
0
                    echo '<li>Return to this window and click the <b>' . __("Yes, I've Authorized BackupBuddy with Dropbox", 'it-l10n-backupbuddy') . '</b> button below.</li>';
                    echo '<li>Configure the destination and click the <b>+' . __('Add Destination', 'it-l10n-backupbuddy') . '</b> button.</li>';
                    echo '</ol>';
                    echo '<a href="' . $dropbuddy->get_authorize_url() . '" class="button-primary pb_dropbox_authorize" target="_new">' . __('Connect to Dropbox & Authorize (opens new window)', 'it-l10n-backupbuddy') . '</a>';
                } else {
                    pb_backupbuddy::$options['dropboxtemptoken'] = '';
                    // Clear temp token.
                    pb_backupbuddy::save();
                    pb_backupbuddy::alert('Error #6557565: Dropbox authentication failed; BackupBuddy access to your account is no longer valid. You should delete this destination and re-add it.', true);
                }
            }
        }
    }
    // Yes, I've Authorized BackupBuddy with Dropbox BUTTON.
    echo '<a href="';
    echo pb_backupbuddy::ajax_url('destination_picker') . '&add=dropbox&callback_data=' . pb_backupbuddy::_GET('callback_data') . '&t=' . time() . '&dropbox_auth=true';
    echo '" id="pb_dropbox_authorize" style="display: none;" class="button-primary">' . __("Yes, I've Authorized BackupBuddy with Dropbox", 'it-l10n-backupbuddy') . '</a>';
    //echo '<br>';
} else {
    // end add & edit mode.
    $hide_add = false;
}
// ACCOUNT INFO ONCE ACCEPTED.
if ($hide_add !== true) {
    if ($mode == 'edit' || $mode == 'add') {
        if (!isset($account_info)) {
            $dropbuddy = new pb_backupbuddy_dropbuddy(pb_backupbuddy::$options['remote_destinations'][$_GET['edit']]['token']);
            if ($dropbuddy->authenticate() === true) {
                $dropbox_connected = true;
                $account_info = $dropbuddy->get_account_info();
            } else {
Exemple #7
0
$log_file = WP_CONTENT_DIR . '/uploads/pb_' . self::settings('slug') . '/log-' . self::$options['log_serial'] . '.txt';
// Reset log.
if (pb_backupbuddy::_GET('reset_log') != '') {
    if (file_exists($log_file)) {
        @unlink($log_file);
    }
    if (file_exists($log_file)) {
        // Didnt unlink.
        pb_backupbuddy::alert('Unable to clear log file. Please verify permissions on file `' . $log_file . '`.');
    } else {
        // Unlinked.
        pb_backupbuddy::alert('Cleared log file.');
    }
}
// Reset disalerts.
if (pb_backupbuddy::_GET('reset_disalerts') != '') {
    pb_backupbuddy::$options['disalerts'] = array();
    pb_backupbuddy::save();
    pb_backupbuddy::alert('Dismissed alerts have been reset. They may now be visible again.');
}
echo '<textarea readonly="readonly" style="width: 100%;" wrap="off" cols="65" rows="7">';
if (file_exists($log_file)) {
    readfile($log_file);
} else {
    echo __('Nothing has been logged.', 'it-l10n-backupbuddy');
}
echo '</textarea>';
echo '<a href="' . pb_backupbuddy::page_url() . '&reset_log=true" class="button secondary-button">' . __('Clear Log', 'it-l10n-backupbuddy') . '</a>';
pb_backupbuddy::$ui->end_metabox();
plugin_information(pb_backupbuddy::settings('slug'), array('name' => pb_backupbuddy::settings('name'), 'path' => pb_backupbuddy::plugin_path()));
?>
<?php

if (!is_admin()) {
    die('Access denied.');
}
// File viewer (view content only) in the file restore page.
/* restore_file_view()
*
* View contents of a file (text) that is inside a zip archive.
*
*/
pb_backupbuddy::$ui->ajax_header(true, false);
// js, no padding
$archive_file = pb_backupbuddy::_GET('archive');
// archive to extract from.
$file = pb_backupbuddy::_GET('file');
// file to extract.
$serial = backupbuddy_core::get_serial_from_file($archive_file);
// serial of archive.
$temp_file = uniqid();
// temp filename to extract into.
require_once pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php';
$zipbuddy = new pluginbuddy_zipbuddy(backupbuddy_core::getBackupDirectory());
// Calculate temp directory & lock it down.
$temp_dir = get_temp_dir();
$destination = $temp_dir . 'backupbuddy-' . $serial;
if (!file_exists($destination) && false === mkdir($destination)) {
    $error = 'Error #458485945b: Unable to create temporary location.';
    pb_backupbuddy::status('error', $error);
    die($error);
}
            $backup_type = 'Full';
        } else {
            $backup_type = 'Unknown';
        }
    }
    // Make list without directory in name.
    $removePrefixDirs = array('full/', 'db/');
    $filesNoDir = str_replace($removePrefixDirs, '', $file);
    // Generate array of table rows.
    $backup_list_temp[$last_modified] = array(array($file, $filesNoDir), pb_backupbuddy::$format->date(pb_backupbuddy::$format->localize_time($last_modified)) . '<br /><span class="description">(' . pb_backupbuddy::$format->time_ago($last_modified) . ' ago)</span>', pb_backupbuddy::$format->file_size($size), $backup_type);
}
krsort($backup_list_temp);
$backup_list = array();
foreach ($backup_list_temp as $backup_item) {
    $backup_list[$backup_item[0][0]] = $backup_item;
    //str_replace( 'db/', '', str_replace( 'full/', '', $backup_item ) );
}
unset($backup_list_temp);
$urlPrefix = pb_backupbuddy::ajax_url('remoteClient') . '&destination_id=' . htmlentities(pb_backupbuddy::_GET('destination_id'));
// Render table listing files.
if (count($backup_list) == 0) {
    echo '<b>';
    _e('You have not completed sending any backups to BackupBuddy Stash for this site yet.', 'it-l10n-backupbuddy');
    echo '</b>';
} else {
    pb_backupbuddy::$ui->list_table($backup_list, array('action' => pb_backupbuddy::ajax_url('remoteClient') . '&function=remoteClient&destination_id=' . htmlentities(pb_backupbuddy::_GET('destination_id')) . '&remote_path=' . htmlentities(pb_backupbuddy::_GET('remote_path') . '&stashhash=' . $stash_hash), 'columns' => array('Backup File', 'Uploaded <img src="' . pb_backupbuddy::plugin_url() . '/images/sort_down.png" style="vertical-align: 0px;" title="Sorted most recent first">', 'File Size', 'Type'), 'hover_actions' => array($urlPrefix . '&cpy_file=' => 'Copy to Local', $urlPrefix . '&downloadlink_file=' => 'Get download link'), 'hover_action_column_key' => '0', 'bulk_actions' => array('delete_backup' => 'Delete'), 'css' => 'width: 100%;'));
}
// Display troubleshooting subscriber key.
echo '<span class="description" style="margin-top: -20px; float: right;">Subscriber key: ' . $subscriber_prefix . '</span>';
echo '<br style="clear: both;">';
return;
            }
        }
        if ($missing_field !== false) {
            pb_backupbuddy::alert('One or more required fields were missing. Destination settings not saved.');
        } else {
            savesettings($_POST['savepoint']);
            pb_backupbuddy::alert(__('Destination settings saved.', 'it-l10n-backupbuddy'));
        }
    } else {
        pb_backupbuddy::alert('Access denied in demo mode.', true);
    }
}
pb_backupbuddy::$ui->start_tab('ftp');
require_once '_destination_ftp.php';
pb_backupbuddy::$ui->end_tab();
if (pb_backupbuddy::_GET('migrate') != '1') {
    // Show all destinations if not a migration.
    pb_backupbuddy::$ui->start_tab('email');
    require_once '_destination_email.php';
    pb_backupbuddy::$ui->end_tab();
    pb_backupbuddy::$ui->start_tab('rackspace');
    require_once '_destination_rackspace.php';
    pb_backupbuddy::$ui->end_tab();
    pb_backupbuddy::$ui->start_tab('s3');
    require_once '_destination_s3.php';
    pb_backupbuddy::$ui->end_tab();
    pb_backupbuddy::$ui->start_tab('dropbox');
    require_once '_destination_dropbox.php';
    pb_backupbuddy::$ui->end_tab();
}
// End if not a migration.
<?php

if (!current_user_can(pb_backupbuddy::$options['role_access'])) {
    die('Access Denied. Error 445543454754.');
}
pb_backupbuddy::load_script('jquery.leanModal.min.js');
pb_backupbuddy::load_style('admin.css');
pb_backupbuddy::load_script('filetree.js');
pb_backupbuddy::load_style('filetree.css');
if (pb_backupbuddy::_GET('value') == '') {
    $file = pb_backupbuddy::_GET('zip_viewer');
} else {
    $file = pb_backupbuddy::_GET('value');
}
$file = str_replace('\\', '', $file);
$file = str_replace('/', '', $file);
$serial = backupbuddy_core::get_serial_from_file($file);
pb_backupbuddy::disalert('restore_caution', __('Caution: Restored files may overwrite existing files of the same name.  Use caution when restoring, especially when restoring large numbers of files to avoid breaking the site.', 'it-l10n-backupbuddy'));
?>

<script type="text/javascript">
	jQuery(document).ready(function() {
		
		
		
		jQuery('#pb_backupbuddy_file_browser').fileTree(
			{
				root: '',
				multiFolder: false,
				script: '<?php 
echo pb_backupbuddy::ajax_url('file_tree');
Exemple #12
0
function pb_bb_add_box($mode, $picker_url, $hideBack = false)
{
    ?>
	<div class="bb_destinations-group bb_destinations-new">
		<h3>What kind of destination do you want to add?</h3>
		<ul>
			<?php 
    $i = 0;
    foreach (pb_backupbuddy_destinations::get_destinations_list() as $destination_name => $destination) {
        if ($mode == 'migration') {
            if ($destination_name != 'local' && $destination_name != 'ftp' && $destination_name != 'sftp') {
                // if not local or ftp when in migration mode then skip.
                continue;
            }
        }
        // Filter only showing certain destination type.
        if ('' != pb_backupbuddy::_GET('filter')) {
            if ($destination_name != pb_backupbuddy::_GET('filter')) {
                continue;
                // Move along to next destination.
            }
        }
        $i++;
        echo '<li class="bb_destination-item bb_destination-' . $destination_name . ' bb_destination-new-item"><a href="' . $picker_url . '&add=' . $destination_name . '&callback_data=' . pb_backupbuddy::_GET('callback_data') . '&sending=' . pb_backupbuddy::_GET('sending') . '" rel="' . $destination_name . '">' . $destination['name'] . '</a></li>';
        if ($i >= 5) {
            echo '<span class="bb_destination-break"></span>';
            $i = 0;
        }
    }
    if (false === $hideBack) {
        ?>
				<br><br>
				<a href="javascript:void(0)" class="btn btn-small btn-white btn-with-icon btn-back btn-back-add"  onClick="jQuery('.bb_destinations-new').hide(); jQuery('.bb_destinations-existing').show();"><span class="btn-icon"></span>Back to existing destinations</a>
			<?php 
    }
    ?>
		</ul>
	</div>
	<?php 
}
if ('embed' != pb_backupbuddy::_GET('display_mode')) {
    echo '<div class="topNav">';
    if (true === Auth::is_authenticated()) {
        // Only display these links if logged in.
        echo '<a ';
        if (pb_backupbuddy::_GET('step') != '') {
            echo 'class="activePage" ';
        }
        echo 'href="importbuddy.php">Restore / Migrate</a>';
        echo '<a ';
        if (pb_backupbuddy::_GET('page') == 'serverinfo') {
            echo 'class="activePage" ';
        }
        echo 'href="?page=serverinfo">Server Information</a>';
        echo '<a ';
        if (pb_backupbuddy::_GET('page') == 'dbreplace') {
            echo 'class="activePage" ';
        }
        echo 'href="?page=dbreplace">Database Text Replace</a>';
        echo '<a href="http://ithemes.com/codex/page/BackupBuddy" target="_new">Knowledge Base</a>';
        echo '<a href="http://ithemes.com/support/" target="_new">Support Forum</a>';
    }
    $simpleVersion = pb_backupbuddy::$options['bb_version'];
    if (strpos(pb_backupbuddy::$options['bb_version'], ' ') > 0) {
        $simpleVersion = substr(pb_backupbuddy::$options['bb_version'], 0, strpos(pb_backupbuddy::$options['bb_version'], ' '));
    }
    echo '<a href="http://ithemes.com/purchase/backupbuddy/" target="_new" title="Visit BackupBuddy Website in New Window" style="float: right;"><img src="importbuddy/images/icon_menu_32x32.png" width="16" height="16">&nbsp;&nbsp;ImportBuddy v' . $simpleVersion . ' for BackupBuddy</a>';
    echo '</div>';
}
?>
		
    $deployData['destination_id'] = pb_backupbuddy::_POST('destination_id');
    if ('push' == pb_backupbuddy::_GET('direction')) {
        $post_backup_steps = array(array('function' => 'deploy_push_start', 'args' => array($deployData), 'start_time' => 0, 'finish_time' => 0, 'attempts' => 0));
        pb_backupbuddy::status('details', 'Deployment PUSH set to send to remote destination `' . $deployData['destination_id'] . '`. Added to post backup function steps.');
    }
    // end if PUSH type deployment.
    if ('pull' == pb_backupbuddy::_GET('direction')) {
        $post_backup_steps = array(array('function' => 'deploy_pull_start', 'args' => array($deployData), 'start_time' => 0, 'finish_time' => 0, 'attempts' => 0));
        pb_backupbuddy::status('details', 'Deployment PULL set to send to remote destination `' . $deployData['destination_id'] . '`. Added to post backup function steps.');
    }
    // end if PULL type deployment.
}
// end if deployment.
$deployDestination = null;
if (isset($deployData['destination'])) {
    $deployDestination = $deployData['destination'];
}
pb_backupbuddy::load_script('backupEvents.js');
pb_backupbuddy::load_script('backupPerform.js');
// Run the backup!
pb_backupbuddy::flush();
// Flush any buffer to screen just before the backup begins.
if ($newBackup->start_backup_process($profile_array, $trigger, array(), $post_backup_steps, '', $serial_override, $export_plugins, pb_backupbuddy::_GET('direction'), $deployDestination) !== true) {
    pb_backupbuddy::alert(__('Fatal Error #4344443: Backup failure. Please see any errors listed in the Status Log for details.', 'it-l10n-backupbuddy'), true);
}
?>


</div>

Exemple #15
0
    public function rollback()
    {
        pb_backupbuddy::$ui->ajax_header();
        pb_backupbuddy::load_script('jquery');
        echo '<div id="pb_backupbuddy_working" style="width: 100px; margin-bottom: 30px;"><br><center><img src="' . pb_backupbuddy::plugin_url() . '/images/working.gif" title="Working... Please wait as this may take a moment..."></center></div>';
        ?>
		
		
		<script>
		function pb_status_append( status_string ) {
			var win = window.dialogArguments || opener || parent || top;
			win.pb_status_append( status_string );
		}
		function pb_status_undourl( undo_url ) {
			var win = window.dialogArguments || opener || parent || top;
			win.pb_status_undourl( undo_url );
		}
		
		var win = window.dialogArguments || opener || parent || top;
		win.window.scrollTo(0,0);
		</script>
		
		
		<?php 
        global $pb_backupbuddy_js_status;
        $pb_backupbuddy_js_status = true;
        pb_backupbuddy::set_status_serial('restore');
        $step = strip_tags(pb_backupbuddy::_GET('step'));
        if ('' == $step || !is_numeric($step)) {
            $step = 0;
        }
        $backupFile = strip_tags(pb_backupbuddy::_GET('archive'));
        if ('' == $backupFile) {
            pb_backupbuddy::alert('The backup file to restore from must be specified.');
            die;
        }
        $stepFile = pb_backupbuddy::plugin_path() . '/controllers/pages/rollback/_step' . $step . '.php';
        if (!file_exists($stepFile)) {
            pb_backupbuddy::alert('Error #849743. Invalid roll back step `' . htmlentities(pb_backupbuddy::_GET('step')) . '` (' . $step . ').');
            die;
        }
        require $stepFile;
        echo '<br><br><br>';
        echo '<script type="text/javascript">jQuery("#pb_backupbuddy_working").hide();</script>';
        pb_backupbuddy::$ui->ajax_footer();
        pb_backupbuddy::flush();
        die;
    }
Exemple #16
0
 public function db_repair()
 {
     $table = base64_decode(pb_backupbuddy::_GET('table'));
     pb_backupbuddy::$ui->ajax_header();
     echo '<h2>Database Table Repair</h2>';
     echo 'Repairing table `' . $table . '`...<br><br>';
     $result = mysql_query("REPAIR TABLE `" . mysql_real_escape_string($table) . "`");
     echo '<b>Results:</b><br><br>';
     echo '<table class="widefat">';
     while ($rs = mysql_fetch_array($result)) {
         echo '<tr>';
         echo '<td>' . $rs['Msg_type'] . '</td>';
         echo '<td>' . $rs['Msg_text'] . '</td>';
         echo '</tr>';
     }
     echo '</table>';
     pb_backupbuddy::$ui->ajax_footer();
     die;
 }
}
// Make sure file exists we are trying to get.
if (!file_exists(backupbuddy_core::getBackupDirectory() . pb_backupbuddy::_GET('backupbuddy_backup'))) {
    // Does not exist.
    die('Error #548957857584784332. The requested backup file does not exist. It may have already been deleted.');
}
$abspath = str_replace('\\', '/', ABSPATH);
// Change slashes to handle Windows as we store backup_directory with Linux-style slashes even on Windows.
$backup_dir = str_replace('\\', '/', backupbuddy_core::getBackupDirectory());
// Make sure file to download is in a publicly accessible location (beneath WP web root technically).
if (FALSE === stristr($backup_dir, $abspath)) {
    die('Error #5432532. You cannot download backups stored outside of the WordPress web root. Please use FTP or other means.');
}
// Made it this far so download dir is within this WP install.
$sitepath = str_replace($abspath, '', $backup_dir);
$download_url = rtrim(site_url(), '/\\') . '/' . trim($sitepath, '/\\') . '/' . pb_backupbuddy::_GET('backupbuddy_backup');
if (pb_backupbuddy::$options['lock_archives_directory'] == '1') {
    // High security mode.
    if (file_exists(backupbuddy_core::getBackupDirectory() . '.htaccess')) {
        $unlink_status = @unlink(backupbuddy_core::getBackupDirectory() . '.htaccess');
        if ($unlink_status === false) {
            die('Error #844594. Unable to temporarily remove .htaccess security protection on archives directory to allow downloading. Please verify permissions of the BackupBuddy archives directory or manually download via FTP.');
        }
    }
    header('Location: ' . $download_url);
    ob_clean();
    flush();
    sleep(8);
    // Wait 8 seconds before creating security file.
    $htaccess_creation_status = @file_put_contents(backupbuddy_core::getBackupDirectory() . '.htaccess', 'deny from all');
    if ($htaccess_creation_status === false) {
<?php

backupbuddy_core::verifyAjaxAccess();
// Abort an in-process remote destination send.
/* remotesend_abort()
 *
 * Abort an in-progress demote destination file transfer. Dies with outputting "1" on success.
 *
 */
$send_id = pb_backupbuddy::_GET('send_id');
$send_id = str_replace('/\\', '', $send_id);
pb_backupbuddy::status('details', 'About to load fileoptions data.');
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
pb_backupbuddy::status('details', 'Fileoptions instance #25.');
$fileoptions_obj = new pb_backupbuddy_fileoptions(backupbuddy_core::getLogDirectory() . 'fileoptions/send-' . $send_id . '.txt', $read_only = false, $ignore_lock = true, $create_file = false);
if (true !== ($result = $fileoptions_obj->is_ok())) {
    pb_backupbuddy::status('error', __('Fatal Error #9034.324544. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
    return false;
}
pb_backupbuddy::status('details', 'Fileoptions data loaded.');
$fileoptions =& $fileoptions_obj->options;
$fileoptions['status'] = 'aborted';
$fileoptions_obj->save();
die('1');
Exemple #19
0
 function backup_integrity_check($file)
 {
     $serial = $this->get_serial_from_file($file);
     // User selected to rescan a file.
     if (pb_backupbuddy::_GET('reset_integrity') == $serial) {
         pb_backupbuddy::alert('Rescanning backup integrity for backup file `' . basename($file) . '`');
     }
     if (isset(pb_backupbuddy::$options['backups'][$serial]['integrity']) && count(pb_backupbuddy::$options['backups'][$serial]['integrity']) > 0 && pb_backupbuddy::_GET('reset_integrity') != $serial) {
         // Already have integrity data and NOT resetting this one.
         pb_backupbuddy::status('details', 'Integrity data for backup `' . $serial . '` is cached; not scanning again.');
         return;
     } elseif (pb_backupbuddy::_GET('reset_integrity') == $serial) {
         // Resetting this one.
         pb_backupbuddy::status('details', 'Resetting backup integrity stats for backup with serial `' . $serial . '`.');
     }
     if (pb_backupbuddy::$options['integrity_check'] == '0') {
         // Integrity checking disabled.
         $file_stats = @stat($file);
         if ($file_stats === false) {
             // stat failure.
             pb_backupbuddy::alert('Error #4539774. Unable to get file details ( via stat() ) for file `' . $file . '`. The file may be corrupt or too large for the server.');
             $file_size = 0;
             $file_modified = 0;
         } else {
             // stat success.
             $file_size = $file_stats['size'];
             $file_modified = $file_stats['mtime'];
         }
         unset($file_stats);
         $integrity = array('status' => 'Unknown', 'status_details' => __('Integrity checking disabled based on settings. This file has not been verified.', 'it-l10n-backupbuddy'), 'scan_time' => 0, 'detected_type' => 'unknown', 'size' => $file_size, 'modified' => $file_modified, 'file' => basename($file), 'comment' => false);
         pb_backupbuddy::$options['backups'][$serial]['integrity'] = array_merge(pb_backupbuddy::settings('backups_integrity_defaults'), $integrity);
         pb_backupbuddy::save();
         return;
     }
     // Defaults
     $integrity_checked = true;
     $found_dat = false;
     $found_sql = false;
     $found_wpc = false;
     $backup_type = '';
     if (!isset(pb_backupbuddy::$classes['zipbuddy'])) {
         require_once pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php';
         pb_backupbuddy::$classes['zipbuddy'] = new pluginbuddy_zipbuddy(pb_backupbuddy::$options['backup_directory']);
     }
     // Redirect logging output to a certain log file.
     pb_backupbuddy::set_status_serial('zipbuddy_test');
     // Look for comment.
     $comment = pb_backupbuddy::$classes['zipbuddy']->get_comment($file);
     // Check for DAT file.
     if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-content/uploads/backupbuddy_temp/' . $serial . '/backupbuddy_dat.php') === true) {
         // Post 2.0 full backup
         $found_dat = true;
         $backup_type = 'full';
     }
     if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-content/uploads/temp_' . $serial . '/backupbuddy_dat.php') === true) {
         // Pre 2.0 full backup
         $found_dat = true;
         $backup_type = 'full';
     }
     if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'backupbuddy_dat.php') === true) {
         // DB backup
         $found_dat = true;
         $backup_type = 'db';
     }
     // Check for DB SQL file.
     if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-content/uploads/backupbuddy_temp/' . $serial . '/db_1.sql') === true) {
         // post 2.0 full backup
         $found_sql = true;
         $backup_type = 'full';
     }
     if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-content/uploads/temp_' . $serial . '/db.sql') === true) {
         // pre 2.0 full backup
         $found_sql = true;
         $backup_type = 'full';
     }
     if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'db_1.sql') === true) {
         // db only backup 2.0+
         $found_sql = true;
         $backup_type = 'db';
     }
     if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'db.sql') === true) {
         // db only backup pre-2.0
         $found_sql = true;
         $backup_type = 'db';
     }
     // Check for WordPress config file.
     if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-config.php') === true) {
         $found_wpc = true;
         $backup_type = 'full';
     }
     if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-content/uploads/backupbuddy_temp/' . $serial . '/wp-config.php') === true) {
         $found_wpc = true;
         $backup_type = 'full';
     }
     // Calculate status from results.
     $integrity_status = 'pass';
     $integrity_description = '';
     $status_items = pb_backupbuddy::get_status('zipbuddy_test');
     $integrity_zipresult_details = array();
     foreach ((array) $status_items as $status_item) {
         $integrity_zipresult_details[] = $status_item[4];
     }
     $integrity_zipresult_details = implode('<br />', $integrity_zipresult_details);
     // Clear logging to certain file.
     pb_backupbuddy::set_status_serial('');
     // Calculate status descriptions.
     if ($found_dat !== true) {
         $integrity_status = 'fail';
         $integrity_description .= __('Missing .dat file.', 'it-l10n-backupbuddy') . '<br />';
     }
     if ($found_sql !== true) {
         $integrity_status = 'fail';
         $integrity_description .= __('Missing DB SQL file.', 'it-l10n-backupbuddy') . '<br />';
     }
     if ($backup_type == 'full' && $found_wpc !== true) {
         $integrity_status = 'fail';
         $integrity_description .= __('Missing WP config file.', 'it-l10n-backupbuddy') . '<br />';
     }
     $integrity_scantime = time();
     if ($integrity_status == 'pass') {
         // All tests passed.
         $integrity_description = 'All tests passed.';
     } else {
         // One or more test failures encountered.
         $integrity_description .= '<br />' . __('Technical Details', 'it-l10n-backupbuddy') . ':<br />' . $integrity_zipresult_details;
     }
     // Get file information from file system.
     $file_stats = @stat($file);
     if ($file_stats === false) {
         // stat failure.
         pb_backupbuddy::alert('Error #4539774. Unable to get file details ( via stat() ) for file `' . $file . '`. The file may be corrupt or too large for the server.');
         $file_size = 0;
         $file_modified = 0;
     } else {
         // stat success.
         $file_size = $file_stats['size'];
         $file_modified = $file_stats['ctime'];
         // Created time.
     }
     unset($file_stats);
     // Compile array of results for saving into data structure.
     $integrity = array('status' => $integrity_status, 'status_details' => $integrity_description, 'scan_time' => $integrity_scantime, 'detected_type' => $backup_type, 'size' => $file_size, 'modified' => $file_modified, 'file' => basename($file), 'comment' => $comment);
     pb_backupbuddy::$options['backups'][$serial]['integrity'] = array_merge(pb_backupbuddy::settings('backups_integrity_defaults'), $integrity);
     pb_backupbuddy::save();
     //pb_backupbuddy::$classes['zipbuddy']->clear_status();
     if ($integrity_status == 'pass') {
         // 100% success
         return true;
     } else {
         return false;
     }
 }
        if (pb_backupbuddy::_GET('text') != 'true') {
            echo '<tr>';
        }
    }
    if (pb_backupbuddy::_GET('text') == 'true') {
        echo str_pad(pb_backupbuddy::$format->file_size($item[0]), 10, ' ', STR_PAD_RIGHT) . "\t" . str_pad($excluded_size, 10, ' ', STR_PAD_RIGHT) . "\t" . $id . "\n";
    } else {
        echo '<td>' . $id . '</td><td>' . pb_backupbuddy::$format->file_size($item[0]) . '</td><td>' . $excluded_size . '</td></tr>';
    }
}
if (pb_backupbuddy::_GET('text') == 'true') {
    echo str_pad(pb_backupbuddy::$format->file_size($total_size), 10, ' ', STR_PAD_RIGHT) . "\t" . str_pad(pb_backupbuddy::$format->file_size($total_size_excluded), 10, ' ', STR_PAD_RIGHT) . "\t" . __('TOTALS', 'it-l10n-backupbuddy') . "\n";
} else {
    echo '<tr><td align="right"><b>' . __('TOTALS', 'it-l10n-backupbuddy') . ':</b></td><td><b>' . pb_backupbuddy::$format->file_size($total_size) . '</b></td><td><b>' . pb_backupbuddy::$format->file_size($total_size_excluded) . '</b></td></tr>';
}
if (pb_backupbuddy::_GET('text') == 'true') {
    echo "\n\nEXCLUSIONS (" . count($exclusions) . "):" . "\n" . implode("\n", $exclusions);
    echo '</textarea>';
    pb_backupbuddy::$ui->ajax_footer();
} else {
    echo '</tbody>';
    echo '</table>';
    echo '<br>';
    echo 'Exclusions (' . count($exclusions) . ')';
    pb_backupbuddy::tip('List of directories that will be excluded in an actual backup. This includes user-defined directories and BackupBuddy directories such as the archive directory and temporary directories.');
    echo '<div id="pb_backupbuddy_serverinfo_exclusions" style="background-color: #EEEEEE; padding: 4px; float: right; white-space: nowrap; height: 90px; width: 70%; min-width: 400px; overflow: auto;"><i>' . implode("<br>", $exclusions) . '</i></div>';
    echo '<br style="clear: both;">';
    echo '<br><br><center>';
    echo '<a href="' . pb_backupbuddy::ajax_url('site_size_listing') . '&text=true&#038;TB_iframe=1&#038;width=640&#038;height=600" class="thickbox button secondary-button">' . __('Display Directory Size Listing in Text Format', 'it-l10n-backupbuddy') . '</a>';
    echo '</center>';
}
        }
        if (false === $bad_auth_code) {
            $dropboxClient = new \Dropbox\Client($accessToken, 'BackupBuddy v' . pb_backupbuddy::settings('version'));
            $accountInfo = $dropboxClient->getAccountInfo();
            $show_config_form = true;
        }
    }
    if ('' == pb_backupbuddy::_POST('dropbox_authorization_code') || true === $bad_auth_code) {
        // No authorization code entered yet so user needs to authorize.
        try {
            $authorizeUrl = $webAuth->start();
        } catch (Exception $e) {
            pb_backupbuddy::alert('Error #8778656: Dropbox error. Details: `' . $e->getMessage() . '`.', true);
            return false;
        }
        echo '<form method="post" action="' . pb_backupbuddy::ajax_url('destination_picker') . '&add=dropbox2&callback_data=' . pb_backupbuddy::_GET('callback_data') . '">';
        echo '<br><b>Adding a Dropbox destination</b><ol>';
        echo '<li> <a href="' . $authorizeUrl . '" class="button-primary pb_dropbox_authorize" target="_new">' . __('Connect to Dropbox.com & Authorize (opens new window)', 'it-l10n-backupbuddy') . '</a></li>';
        echo '<li>Click <b>Allow</b> in the new window (you may need to login to Dropbox.com first).</li>';
        echo '<li>Enter the provided <b>Authorization Code</b>: <input type="text" name="dropbox_authorization_code" size="45"></li>';
        echo '<li><input type="submit" class="button-primary" value="' . __("Yes, I've Authorized BackupBuddy with Dropbox & Entered the Code above", 'it-l10n-backupbuddy') . '"></li>';
        echo '</ol>';
        echo '</form>';
    }
    // end authorication code submitted.
} elseif ('edit' == $mode) {
    // EDIT mode.
    $accessToken = $destination_settings['access_token'];
    try {
        $dropboxClient = new \Dropbox\Client($accessToken, 'BackupBuddy v' . pb_backupbuddy::settings('version'));
    } catch (\Exception $e) {
        	$save_and_delete_button = '';
        }
        */
        $save_and_delete_button = '';
        $save_and_delete_button .= '<a href="#" class="button secondary-button pb_backupbuddy_destpicker_delete" href="javascript:void(0)" title="Delete this Destination">Delete Destination</a>';
        echo $settings->display_settings('Save Settings', $save_and_delete_button . '&nbsp;&nbsp;' . $test_button . '&nbsp;&nbsp;', $afterText = ' <img class="pb_backupbuddy_destpicker_saveload" src="' . pb_backupbuddy::plugin_url() . '/images/loading.gif" title="Saving... This may take a few seconds...">', 'pb_backupbuddy_destpicker_save');
        // title, before, after, class
    }
    echo '</div>';
    $url = pb_backupbuddy::ajax_url('remoteClient') . '&destination_id=' . $destination_id;
    echo '<iframe id="pb_backupbuddy_iframe-dest-' . $destination_id . '" src="' . $url . '" width="100%" height="3000" frameBorder="0">Error #4584594579. Browser not compatible with iframes.</iframe>';
    echo '</div>';
    pb_backupbuddy::$ui->end_tab();
}
pb_backupbuddy::$ui->start_tab('add_new');
$destination_type = pb_backupbuddy::_GET('add');
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
?>
	<div class="bb_destinations" style="display: block; margin: 0;">
		<div class="bb_destinations-group bb_destinations-new" style="display: block;">
			<h3>What kind of destination do you want to add?</h3>
			<ul>
				<?php 
$i = 0;
foreach (pb_backupbuddy_destinations::get_destinations_list($showUnavailable = true) as $destination_name => $destination) {
    $i++;
    if (true === $destination['compatible']) {
        echo '<li class="bb_destination-item bb_destination-' . $destination_name . ' bb_destination-new-item">';
        /*
        if ( 's32' == $destination_name ) {
        	echo '<div class="bb-ribbon"><span>New</span></div>';
Exemple #23
0
 function __construct()
 {
     if (false !== stristr(pb_backupbuddy::_GET('page'), 'backupbuddy') || 'true' == pb_backupbuddy::_GET('activate')) {
         pb_backupbuddy::add_action(array('admin_notices', 'admin_notices'));
     }
 }
    }
    // Generate array of table rows.
    $backup_files[$filename] = array($filename, $last_modified, pb_backupbuddy::$format->file_size($size), $backup_type, 'file_timestamp' => $last_modified);
}
// For sorting by array item value.
function pb_backupbuddy_aasort(&$array, $key)
{
    $sorter = array();
    $ret = array();
    reset($array);
    foreach ($array as $ii => $va) {
        $sorter[$ii] = $va[$key];
    }
    asort($sorter);
    foreach ($sorter as $ii => $va) {
        $ret[$ii] = $array[$ii];
    }
    $array = $ret;
}
pb_backupbuddy_aasort($backup_files, 'file_timestamp');
// Sort by multidimensional array with key start_timestamp.
$backup_files = array_reverse($backup_files);
// Reverse array order to show newest first.
$urlPrefix = pb_backupbuddy::ajax_url('remoteClient') . '&destination_id=' . htmlentities(pb_backupbuddy::_GET('destination_id'));
// Render table listing files.
if (count($backup_files) == 0) {
    echo '<b>' . __('You have not completed sending any backups to this destination yet.', 'it-l10n-backupbuddy') . '</b>';
} else {
    pb_backupbuddy::$ui->list_table($backup_files, array('action' => $urlPrefix, 'columns' => array('Backup File', 'Uploaded <img src="' . pb_backupbuddy::plugin_url() . '/images/sort_down.png" style="vertical-align: 0px;" title="Sorted most recent first">', 'File Size', 'Type'), 'hover_actions' => array($urlPrefix . '&cpy=' => 'Copy to Local'), 'hover_action_column_key' => '0', 'bulk_actions' => array('delete_backup' => 'Delete'), 'css' => 'width: 100%;'));
}
return;
Exemple #25
0
<?php

// Settings to display in a form for a user to configure.
/*
	Pre-populated variables coming into this script:
		$destination_settings
		$mode
*/
global $pb_hide_test, $pb_hide_save;
$pb_hide_test = false;
$itxapi_username = '';
$itxapi_password = '';
if ($mode == 'add') {
    // ADD MODE.
    $credentials_form = new pb_backupbuddy_settings('pre_settings', false, 'action=pb_backupbuddy_backupbuddy&function=destination_picker&quickstart=' . htmlentities(pb_backupbuddy::_GET('quickstart')) . '&add=' . htmlentities(pb_backupbuddy::_GET('add')) . '&callback_data=' . htmlentities(pb_backupbuddy::_GET('callback_data')) . '&sending=' . pb_backupbuddy::_GET('sending'));
    // name, savepoint|false, additional querystring
    $credentials_form->add_setting(array('type' => 'text', 'name' => 'itxapi_username', 'title' => __('iThemes username', 'it-l10n-backupbuddy'), 'tip' => __('[Example: kerfuffle] - Your iThemes.com / PluginBuddy membership username.', 'it-l10n-backupbuddy'), 'rules' => 'required|string[1-45]'));
    $credentials_form->add_setting(array('type' => 'password', 'name' => 'itxapi_password_raw', 'title' => __('iThemes password', 'it-l10n-backupbuddy'), 'tip' => __('[Example: 48dsds!s08K%x2s] - Your iThemes.com / PluginBuddy membership password.', 'it-l10n-backupbuddy'), 'rules' => 'required|string[1-250]'));
    $settings_result = $credentials_form->process();
    $login_welcome = __('Log in with your iThemes.com member account to begin.', 'it-l10n-backupbuddy');
    if (count($settings_result) == 0) {
        // No form submitted.
        echo $login_welcome;
        $credentials_form->display_settings('Submit');
        $pb_hide_test = true;
        $pb_hide_save = true;
        return;
    } else {
        // Form submitted.
        if (count($settings_result['errors']) > 0) {
            // Form errors.
Exemple #26
0







<div class="wrap">

<?php 
if (pb_backupbuddy::_GET('file') != '') {
    $backup_archives = array(pb_backupbuddy::_GET('file'));
    echo '<div style="padding: 15px; background: #FFFFFF;">Restoring from backup <i>' . htmlentities(pb_backupbuddy::_GET('file')) . '</i></div>
	<form action="?ajax=2" method="post" target="restorebuddy_iframe">';
    echo '<input type="hidden" name="file" value="' . pb_backupbuddy::_GET('file') . '">';
} else {
    ?>
	
	<div class="backup_select_buttons">
		<button href="#pb_upload_modal" class="button button-secondary leanModal createdb_modal_link" style="font-size: 14px;">Upload a Backup</button>
		<button href="#pb_stash_modal" class="button button-secondary leanModal createdb_modal_link" style="font-size: 14px;">Restore from Stash</button>
	</div>
	
	<?php 
    $backup_archives = get_archives_list();
    if (0 == count($backup_archives)) {
        // No backups found.
        // Look for manually unzipped
        pb_backupbuddy::alert('<b>No BackupBuddy Zip backup found in this directory `' . ABSPATH . '`</b> - 
			You must upload a backup file by FTP (into the same directory as this importbuddy.php file), the upload tab, or import from Stash via the Stash tab above to continue.
Exemple #27
0
	array( 'siteurl' => 'http://backupbuddy2', 'api_key' => 'xxx' )
);
pb_backupbuddy::save();

if ( pb_backupbuddy::_GET( 'deployment' ) == '' ) {
	foreach( pb_backupbuddy::$options['deployments'] as $deployment_id => $deployment ) {
		echo '<a href="' . pb_backupbuddy::page_url() . '&deployment=' . $deployment_id . '">' . $deployment['siteurl'] . '</a>';
		
		echo '<pre>';
		print_r( $deployment );
		echo '</pre>';
	}
	return;
}
*/
$deployment_id = pb_backupbuddy::_GET('deployment');
?>





<script>
function pb_status_undourl( undo_url ) {
	if ( '' == undo_url ) {
		jQuery( '#pb_backupbuddy_undourl' ).parent('#message').slideUp();
		return;
	}
	jQuery( '#pb_backupbuddy_undourl' ).attr( 'href', undo_url );
	jQuery( '#pb_backupbuddy_undourl' ).text( undo_url );
	jQuery( '#pb_backupbuddy_undourl' ).parent('#message').slideDown();
Exemple #28
0
}
if ($ajax != '') {
    Auth::require_authentication();
    // Die if not logged in.
    $page = ABSPATH . 'importbuddy/controllers/ajax/' . $ajax . '.php';
    if (file_exists($page)) {
        require_once $page;
    } else {
        echo '{Error: Invalid AJAX action `' . htmlentities($ajax) . '`.}';
    }
    /********** PAGES **********/
} elseif (pb_backupbuddy::_GET('step') != '' && is_numeric(pb_backupbuddy::_GET('step'))) {
    $step = pb_backupbuddy::_GET('step');
    if ($step > 1) {
        Auth::require_authentication();
        // Die if not logged in.
    }
    $page = ABSPATH . 'importbuddy/controllers/pages/' . pb_backupbuddy::_GET('step') . '.php';
    if (file_exists($page)) {
        $step = pb_backupbuddy::_GET('step');
        echo '<!-- Starting step ' . htmlentities(pb_backupbuddy::_GET('step')) . '. Page: `' . basename($page) . '`. -->';
        require_once $page;
        pb_backupbuddy::status('details', 'Finished step ' . htmlentities(pb_backupbuddy::_GET('step')) . '.');
    } else {
        echo '{Error: Invalid page `' . htmlentities(pb_backupbuddy::_GET('step')) . '.php' . '`.}';
        die;
    }
    /********** ASSUME DEFAULT PAGE **********/
} else {
    require_once '1.php';
}
            } else {
                // Cron not found, error.
                pb_backupbuddy::alert('Invalid CRON job. Not found.', true);
            }
        }
        pb_backupbuddy::alert(__('Deleted sheduled CRON event(s):', 'it-l10n-backupbuddy') . '<br>' . implode('<br>', $deleted_crons));
        $cron = get_option('cron');
        // Reset to most up to date status for cron listing below. Takes into account deletions.
    }
}
// Handle RUNNING cron jobs manually.
if (!empty($_GET['run_cron'])) {
    if (defined('PB_DEMO_MODE')) {
        pb_backupbuddy::alert('Access denied in demo mode.', true);
    } else {
        $cron_parts = explode('|', pb_backupbuddy::_GET('run_cron'));
        $timestamp = $cron_parts[0];
        $cron_hook = $cron_parts[1];
        $cron_key = $cron_parts[2];
        if (isset($cron[$timestamp][$cron_hook][$cron_key])) {
            // Run cron.
            $cron_array = $cron[$timestamp][$cron_hook][$cron_key];
            // Get cron array based on passed values.
            /*
            if ( count( $cron_array['args'] ) == 1 ) {
            	$args = $cron_array['args'][0];
            } else {
            	$args = $cron_array['args'];
            }
            */
            do_action_ref_array($cron_hook, $cron_array['args']);
Exemple #30
0
    // NOT MULTISITE EXPORT.
    if (is_numeric($requested_profile)) {
        if (isset(pb_backupbuddy::$options['profiles'][$requested_profile])) {
            $profile_array = pb_backupbuddy::$options['profiles'][$requested_profile];
        } else {
            die('Error #84537483: Invalid profile ID `' . htmlentities($requested_profile) . '`. Profile with this number was not found. Try deactivating then reactivating the plugin. If this fails please reset the plugin Settings back to Defaults from the Settings page.');
        }
    } else {
        die('Error #85489548955. Invalid profile ID not numeric: `' . htmlentities($requested_profile) . '`.');
    }
}
// Sending to remote destination after manual backup completes?
$post_backup_steps = array();
if (pb_backupbuddy::_GET('after_destination') != '' && is_numeric(pb_backupbuddy::_GET('after_destination'))) {
    $destination_id = (int) pb_backupbuddy::_GET('after_destination');
    if (pb_backupbuddy::_GET('delete_after') == 'true') {
        $delete_after = true;
    } else {
        $delete_after = false;
    }
    $post_backup_steps = array(array('function' => 'send_remote_destination', 'args' => array($destination_id, $delete_after), 'start_time' => 0, 'finish_time' => 0, 'attempts' => 0));
    pb_backupbuddy::status('details', 'Manual backup set to send to remote destination `' . $destination_id . '`.  Delete after: `' . $delete_after . '`. Added to post backup function steps.');
}
// Run the backup!
pb_backupbuddy::flush();
// Flush any buffer to screen just before the backup begins.
if (pb_backupbuddy::$classes['backup']->start_backup_process($profile_array, 'manual', array(), $post_backup_steps, '', $serial_override, $export_plugins) !== true) {
    pb_backupbuddy::alert(__('Fatal Error #4344443: Backup failure', 'it-l10n-backupbuddy'), true);
}
?>