Exemple #1
0
 /**
  *	pb_backupbuddy::disalert()
  *
  *	Displays a DISMISSABLE message to the user at the top of the page when in the dashboard.
  *
  *	@param		string		$message		Message you want to display to the user.
  *	@param		boolean		$error			OPTIONAL! true indicates this alert is an error and displays as red. Default: false
  *	@param		int			$error_code		OPTIONAL! Error code number to use in linking in the wiki for easy reference.
  *	@return		null
  */
 public function disalert($unique_id, $message, $error = false)
 {
     if (!isset(pb_backupbuddy::$options['disalerts'][$unique_id])) {
         $message = '<a style="float: right;" class="pb_backupbuddy_disalert" href="#" title="' . __('Dismiss this alert. Unhide dismissed alerts on the Getting Started page.', 'it-l10n-backupbuddy') . '" alt="' . pb_backupbuddy::ajax_url('disalert') . '">' . __('Dismiss', 'it-l10n-backupbuddy') . '</a><div style="margin-right: 60px;">' . $message . '</div>';
         $this->alert($message, $error, '', $unique_id);
     } else {
         echo '<!-- Previously Dismissed Alert: `' . htmlentities($message) . '` -->';
     }
     return;
 }
    $hover_actions['hash'] = __('Checksum', 'it-l10n-backupbuddy');
    $bulk_actions = array('delete_backup' => __('Delete', 'it-l10n-backupbuddy'));
}
if ($listing_mode == 'migrate') {
    $hover_actions['migrate'] = __('Migrate', 'it-l10n-backupbuddy');
    $hover_actions[pb_backupbuddy::ajax_url('download_archive') . '&backupbuddy_backup='] = __('Download', 'it-l10n-backupbuddy');
    $hover_actions['note'] = __('Note', 'it-l10n-backupbuddy');
    $bulk_actions = array();
    foreach ($backups as $backup_id => $backup) {
        if ($backup[1] == 'Database') {
            unset($backups[$backup_id]);
        }
    }
}
if ($listing_mode == 'restore_migrate') {
    $hover_actions[pb_backupbuddy::ajax_url('download_archive') . '&backupbuddy_backup='] = __('Download', 'it-l10n-backupbuddy');
    $hover_actions['send'] = 'Send';
    $hover_actions['page=pb_backupbuddy_backup&zip_viewer'] = __('Browse & Restore Files', 'it-l10n-backupbuddy');
    $hover_actions['rollback'] = __('Database Rollback', 'it-l10n-backupbuddy') . ' (BETA)';
    $hover_actions['migrate'] = __('Migrate', 'it-l10n-backupbuddy');
    $hover_actions['note'] = __('Note', 'it-l10n-backupbuddy');
    $bulk_actions = array();
    /*
    foreach( $backups as $backup_id => $backup ) {
    	if ( $backup[1] == 'Database' ) {
    		unset( $backups[$backup_id] );
    	}
    }
    */
}
if (count($backups) == 0) {
				jQuery.get( '<?php 
    echo pb_backupbuddy::ajax_url('destination_ftp_pathpicker');
    ?>
&' + serializedFormData,
					function(data) {
						data = jQuery.trim( data );
						pathPickerBox.html( '<div class="jQueryOuterTree" style="width: 100%;">' + data + '</div>' );
						pathPickerBox.slideDown();
						
						// File picker.
						jQuery('.pb_backupbuddy_ftpdestination_pathpickerboxtree').fileTree(
							{
								root: '/',
								multiFolder: false,
								script: '<?php 
    echo pb_backupbuddy::ajax_url('destination_ftp_pathpicker');
    ?>
&' + serializedFormData
							},
							function(file) {
								alert( file );
							},
							function(directory) {
								
								thisPickObj.closest( 'form' ).find( '#pb_backupbuddy_path' ).val( directory );
								
							}
						);
						
						jQuery( '.pb_backupbuddy_ftppicker_load' ).hide();
						
Exemple #4
0
 public function backups_list($type = 'default', $subsite_mode = false)
 {
     if (pb_backupbuddy::_POST('bulk_action') == 'delete_backup') {
         $needs_save = false;
         pb_backupbuddy::verify_nonce(pb_backupbuddy::_POST('_wpnonce'));
         // Security check to prevent unauthorized deletions by posting from a remote place.
         $deleted_files = array();
         foreach (pb_backupbuddy::_POST('items') as $item) {
             if (file_exists(pb_backupbuddy::$options['backup_directory'] . $item)) {
                 if (@unlink(pb_backupbuddy::$options['backup_directory'] . $item) === true) {
                     $deleted_files[] = $item;
                     if (count(pb_backupbuddy::$options['backups']) > 3) {
                         // Keep a minimum number of backups in array for stats.
                         $this_serial = $this->get_serial_from_file($item);
                         unset(pb_backupbuddy::$options['backups'][$this_serial]);
                         $needs_save = true;
                     }
                 } else {
                     pb_backupbuddy::alert('Error: Unable to delete backup file `' . $item . '`. Please verify permissions.', true);
                 }
             }
             // End if file exists.
         }
         // End foreach.
         if ($needs_save === true) {
             pb_backupbuddy::save();
         }
         pb_backupbuddy::alert(__('Deleted backup(s):', 'it-l10n-backupbuddy') . ' ' . implode(', ', $deleted_files));
     }
     // End if deleting backup(s).
     $backups = array();
     $backup_sort_dates = array();
     $files = glob(pb_backupbuddy::$options['backup_directory'] . 'backup*.zip');
     if (is_array($files) && !empty($files)) {
         // For robustness. Without open_basedir the glob() function returns an empty array for no match. With open_basedir in effect the glob() function returns a boolean false for no match.
         $backup_prefix = $this->backup_prefix();
         // Backup prefix for this site. Used for MS checking that this user can see this backup.
         foreach ($files as $file_id => $file) {
             if ($subsite_mode === true && is_multisite()) {
                 // If a Network and NOT the superadmin must make sure they can only see the specific subsite backups for security purposes.
                 // Only allow viewing of their own backups.
                 if (!strstr($file, $backup_prefix)) {
                     unset($files[$file_id]);
                     // Remove this backup from the list. This user does not have access to it.
                     continue;
                     // Skip processing to next file.
                     echo 'bob';
                 }
             }
             $serial = pb_backupbuddy::$classes['core']->get_serial_from_file($file);
             // Populate integrity data structure in options.
             pb_backupbuddy::$classes['core']->backup_integrity_check($file);
             $pretty_status = array('pass' => 'Good', 'fail' => '<font color="red">Bad</font>');
             $pretty_type = array('full' => 'Full', 'db' => 'Database');
             //echo '<pre>' . print_r( pb_backupbuddy::$options['backups'][$serial], true ) . '</pre>';
             // Calculate time for each step.
             $step_times = array();
             $step_time_details = array();
             $zip_time = 0;
             if (isset(pb_backupbuddy::$options['backups'][$serial]['steps'])) {
                 foreach (pb_backupbuddy::$options['backups'][$serial]['steps'] as $step) {
                     if (!isset($step['finish_time']) || $step['finish_time'] == 0) {
                         $step_times[] = '<span class="description">Unknown</span>';
                     } else {
                         $step_time = $step['finish_time'] - $step['start_time'];
                         $step_times[] = $step_time;
                         // Pretty step name:
                         if ($step['function'] == 'backup_create_database_dump') {
                             $step_name = 'Database dump';
                         } elseif ($step['function'] == 'backup_zip_files') {
                             $step_name = 'Zip archive creation';
                         } elseif ($step['function'] == 'post_backup') {
                             $step_name = 'Post-backup cleanup';
                         } else {
                             $step_name = $step['function'];
                         }
                         $step_time_details[] = '<b>' . $step_name . '</b><br>&nbsp;&nbsp;&nbsp;' . $step_time . ' seconds in ' . $step['attempts'] . ' attempts.';
                         if ($step['function'] == 'backup_zip_files') {
                             $zip_time = $step_time;
                         }
                     }
                 }
                 // End foreach.
             } else {
                 // End if serial in array is set.
                 $step_times[] = '<span class="description">Unknown</span>';
             }
             // End if serial in array is NOT set.
             $step_times = implode(', ', $step_times);
             //echo '<pre>' . print_r( pb_backupbuddy::$options['backups'][$serial], true ) . '</pre>';
             // Calculate start and finish.
             if (isset(pb_backupbuddy::$options['backups'][$serial]['start_time']) && isset(pb_backupbuddy::$options['backups'][$serial]['finish_time']) && pb_backupbuddy::$options['backups'][$serial]['start_time'] > 0 && pb_backupbuddy::$options['backups'][$serial]['finish_time'] > 0) {
                 $start_time = pb_backupbuddy::$options['backups'][$serial]['start_time'];
                 $finish_time = pb_backupbuddy::$options['backups'][$serial]['finish_time'];
                 $total_time = $finish_time - $start_time;
             } else {
                 $total_time = '<span class="description">Unknown</span>';
             }
             // Calculate write speed in MB/sec for this backup.
             if ($zip_time == '0') {
                 // Took approx 0 seconds to backup so report this speed.
                 if (!isset($finish_time) || $finish_time == '0') {
                     $write_speed = '<span class="description">Unknown</span>';
                 } else {
                     $write_speed = '> ' . pb_backupbuddy::$format->file_size(pb_backupbuddy::$options['backups'][$serial]['integrity']['size']);
                 }
             } else {
                 $write_speed = pb_backupbuddy::$format->file_size(pb_backupbuddy::$options['backups'][$serial]['integrity']['size'] / $zip_time);
             }
             // Figure out trigger.
             if (isset(pb_backupbuddy::$options['backups'][$serial]['trigger'])) {
                 $trigger = pb_backupbuddy::$options['backups'][$serial]['trigger'];
             } else {
                 $trigger = __('Unknown', 'it-l10n-backupbuddy');
             }
             // HTML output for stats.
             $statistics = "\n\t\t\t\t\t<span style='width: 80px; display: inline-block;'>Total time:</span>{$total_time} secs<br>\n\t\t\t\t\t<span style='width: 80px; display: inline-block;'>Step times:</span>{$step_times}<br>\n\t\t\t\t\t<span style='width: 80px; display: inline-block;'>Write speed:</span>{$write_speed}/sec\n\t\t\t\t";
             // HTML output for stats details (for tooltip).
             $statistic_details = '<br><br>' . implode('<br>', $step_time_details) . '<br><br><i>Trigger: ' . $trigger . '</i>';
             // Calculate time ago.
             $time_ago = '<span class="description">' . pb_backupbuddy::$format->time_ago(pb_backupbuddy::$options['backups'][$serial]['integrity']['modified']) . ' ago</span>';
             // Calculate main row string.
             if ($type == 'default') {
                 // Default backup listing.
                 $main_string = '<a href="' . pb_backupbuddy::ajax_url('download_archive') . '&backupbuddy_backup=' . basename($file) . '">' . basename($file) . '</a>';
             } elseif ($type == 'migrate') {
                 // Migration backup listing.
                 $main_string = '<a class="pb_backupbuddy_hoveraction_migrate" rel="' . basename($file) . '" href="' . pb_backupbuddy::page_url() . '&migrate=' . basename($file) . '&value=' . basename($file) . '">' . basename($file) . '</a>';
             } else {
                 $main_string = '{Unknown type.}';
             }
             // Add comment to main row string if applicable.
             if (isset(pb_backupbuddy::$options['backups'][$serial]['integrity']['comment']) && pb_backupbuddy::$options['backups'][$serial]['integrity']['comment'] !== false && pb_backupbuddy::$options['backups'][$serial]['integrity']['comment'] !== '') {
                 $main_string .= '<br><span class="description">Note: <span class="pb_backupbuddy_notetext">' . pb_backupbuddy::$options['backups'][$serial]['integrity']['comment'] . '</span></span>';
             }
             $backups[basename($file)] = array(array(basename($file), $main_string), pb_backupbuddy::$format->date(pb_backupbuddy::$options['backups'][$serial]['integrity']['modified']) . '<br>' . $time_ago, pb_backupbuddy::$format->file_size(pb_backupbuddy::$options['backups'][$serial]['integrity']['size']), pb_backupbuddy::$format->prettify(pb_backupbuddy::$options['backups'][$serial]['integrity']['status'], $pretty_status) . ' ' . pb_backupbuddy::tip(pb_backupbuddy::$options['backups'][$serial]['integrity']['status_details'] . '<br><br>Checked ' . pb_backupbuddy::$format->date(pb_backupbuddy::$options['backups'][$serial]['integrity']['scan_time']) . $statistic_details, '', false) . ' <a href="' . pb_backupbuddy::page_url() . '&reset_integrity=' . $serial . '" title="' . __('Refresh backup integrity status for this file', 'it-l10n-backupbuddy') . '"><img src="' . pb_backupbuddy::plugin_url() . '/images/refresh_gray.gif" style="vertical-align: -1px;"></a>', pb_backupbuddy::$format->prettify(pb_backupbuddy::$options['backups'][$serial]['integrity']['detected_type'], $pretty_type), $statistics);
             $backup_sort_dates[basename($file)] = pb_backupbuddy::$options['backups'][$serial]['integrity']['modified'];
         }
         // End foreach().
     }
     // End if.
     // Sort backup sizes.
     arsort($backup_sort_dates);
     // Re-arrange backups based on sort dates.
     $sorted_backups = array();
     foreach ($backup_sort_dates as $backup_file => $backup_sort_date) {
         $sorted_backups[$backup_file] = $backups[$backup_file];
         unset($backups[$backup_file]);
     }
     unset($backups);
     return $sorted_backups;
 }
        }
        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) {
    }
    // 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 #7
0
 public function importexport_settings()
 {
     pb_backupbuddy::load();
     pb_backupbuddy::$ui->ajax_header();
     if (pb_backupbuddy::_POST('import_settings') != '') {
         $import = trim(stripslashes(pb_backupbuddy::_POST('import_data')));
         $import = base64_decode($import);
         if ($import === false) {
             // decode failed.
             pb_backupbuddy::alert('Unable to decode settings data. Import aborted. Insure that you fully copied the settings and did not change any of the text.');
         } else {
             // decode success.
             if (($import = maybe_unserialize($import)) === false) {
                 // unserialize fail.
                 pb_backupbuddy::alert('Unable to unserialize settings data. Import aborted. Insure that you fully copied the settings and did not change any of the text.');
             } else {
                 // unserialize success.
                 if (!isset($import['data_version'])) {
                     // missing expected content.
                     pb_backupbuddy::alert('Unserialized settings data but it did not contain expected data. Import aborted. Insure that you fully copied the settings and did not change any of the text.');
                 } else {
                     // contains expected content.
                     pb_backupbuddy::$options = $import;
                     require_once pb_backupbuddy::plugin_path() . '/controllers/activation.php';
                     // Run data migration to upgrade if needed.
                     pb_backupbuddy::save();
                     pb_backupbuddy::alert('Provided settings successfully imported. Prior settings overwritten.');
                 }
             }
         }
     }
     echo '<h2>Export BackupBuddy Settings</h2>';
     echo 'Copy the encoded plugin settings below and paste it into the destination BackupBuddy Settings Import page.<br><br>';
     echo '<textarea style="width: 100%; height: 100px;" wrap="on">';
     echo base64_encode(serialize(pb_backupbuddy::$options));
     echo '</textarea>';
     echo '<br><br><br>';
     echo '<h2>Import BackupBuddy Settings</h2>';
     echo 'Paste encoded plugin settings below to import & replace current settings.  If importing settings from an older version and errors are encountered please deactivate and reactivate the plugin.<br><br>';
     echo '<form method="post" action="' . pb_backupbuddy::ajax_url('importexport_settings') . '">';
     echo '<textarea style="width: 100%; height: 100px;" wrap="on" name="import_data"></textarea>';
     echo '<br><br><input type="submit" name="import_settings" value="Import Settings" class="button button-primary">';
     echo '</form>';
     pb_backupbuddy::$ui->ajax_footer();
     die;
 }
Exemple #8
0
?>
?page=pb_backupbuddy_backup&custom=remoteclient&destination_id=' + destination_id;
		}
	}
</script>


<?php 
pb_backupbuddy::$ui->title(__('Remote Destinations', 'it-l10n-backupbuddy'));
echo '<div style="width: 100%;">';
_e('BackupBuddy supports many remote destinations which you may transfer backups to.  You may manually send backups to these locations or automatically have them sent for scheduled backups. You may view the files in a remote destination by selecting a destination below once created. In addition to viewing files, you may copy remote backups to your server, and delete files.  All subscribed BackupBuddy customers are provided <b>free</b> storage to our own BackupBuddy Stash cloud destination.', 'it-l10n-backupbuddy');
echo '</div>';
echo '<br><br>';
pb_backupbuddy::$ui->start_tabs('destinations', array(array('title' => 'Remote Destinations', 'slug' => 'destinations'), array('title' => 'Recently Transferred Files', 'slug' => 'transfers')), 'width: 100%;');
pb_backupbuddy::$ui->start_tab('destinations');
echo '<iframe id="pb_backupbuddy_iframe" src="' . pb_backupbuddy::ajax_url('destination_picker') . '&action_verb=to%20manage%20files" width="100%" style="max-width: 850px;" height="1800" frameBorder="0">Error #4584594579. Browser not compatible with iframes.</iframe>';
pb_backupbuddy::$ui->end_tab();
pb_backupbuddy::$ui->start_tab('transfers');
echo '<div style="margin-left: 0px;">';
require_once 'server_info/remote_sends.php';
echo '</div>';
pb_backupbuddy::$ui->end_tab();
?>

<br style="clear: both;"><br style="clear: both;">

<?php 
// Handles thickbox auto-resizing. Keep at bottom of page to avoid issues.
if (!wp_script_is('media-upload')) {
    wp_enqueue_script('media-upload');
    wp_print_scripts('media-upload');
		
		// Show options on hover.
		jQuery(document).on('mouseover mouseout', '.jqueryFileTree > li a', function(event) {
			if ( event.type == 'mouseover' ) {
				jQuery(this).children( '.pb_backupbuddy_treeselect_control' ).css( 'visibility', 'visible' );
			} else {
				jQuery(this).children( '.pb_backupbuddy_treeselect_control' ).css( 'visibility', 'hidden' );
			}
		});
		
		jQuery('#exlude_dirs').fileTree(
			{
				root: '/',
				multiFolder: false,
				script: '<?php 
echo pb_backupbuddy::ajax_url('exclude_tree');
?>
'
			},
			function(file) {
				if ( ( file == 'wp-config.php' ) ) {
					alert( "<?php 
_e('You cannot exclude wp-config.php.', 'it-l10n-backupbuddy');
?>
" );
				} else {
					jQuery( '#pb_backupbuddy_profiles__<?php 
echo $profile_id;
?>
__excludes' ).val( file + "\n" + jQuery( '#pb_backupbuddy_profiles__<?php 
echo $profile_id;
">
				<div style="position: absolute; width: 382px;">
					<span style="position: absolute; z-index: 42; right: 0px; display: inline-block;">
						<img src="<?php 
echo pb_backupbuddy::plugin_url();
?>
/images/beta.png" title="Beta" width="60" height="60">
					</span>
				</div>
			</a>
			
			<?php 
if (pb_backupbuddy::$options['importbuddy_pass_hash'] == '') {
    echo '<a onclick="alert(\'' . __('Please set an ImportBuddy password on the BackupBuddy Settings page to download this script. This is required to prevent unauthorized access to the script when in use.', 'it-l10n-backupbuddy') . '\'); return false;" href="" style="text-decoration: none;" title="' . __('Download the restore & migration utility, importbuddy.php', 'it-l10n-backupbuddy') . '">';
} else {
    echo '<a href="' . pb_backupbuddy::ajax_url('importbuddy') . '" style="text-decoration: none;" title="' . __('Download the restore & migration utility, importbuddy.php', 'it-l10n-backupbuddy') . '">';
}
?>
				<div class="graybutton">
					<div class="restoremigrateicon"></div>
					<div class="bbbutton-text">
						<?php 
_e('ImportBuddy', 'it-l10n-backupbuddy');
?>
<br />
						<div class="bbbutton-smalltext"><?php 
_e('restoring & migration script', 'it-l10n-backupbuddy');
?>
</div>
					</div>
				</div>
Exemple #11
0
    public static function get_quota_bar($account_info, $settings = array(), $additionalOptions = false)
    {
        $settings = self::_init($settings);
        //echo '<pre>' . print_r( $account_info, true ) . '</pre>';
        $return = '<div class="backupbuddy-stash2-quotawrap">';
        $return .= '
		<style>
			.outer_progress {
				-moz-border-radius: 4px;
				-webkit-border-radius: 4px;
				-khtml-border-radius: 4px;
				border-radius: 4px;
				
				border: 1px solid #DDD;
				background: #EEE;
				
				max-width: 700px;
				
				margin-left: auto;
				margin-right: auto;
				
				height: 30px;
			}
			
			.inner_progress {
				border-right: 1px solid #85bb3c;
				background: #8cc63f url("' . pb_backupbuddy::plugin_url() . '/destinations/stash2/progress.png") 50% 50% repeat-x;
				
				height: 100%;
			}
			
			.progress_table {
				color: #5E7078;
				font-family: "Open Sans", Arial, Helvetica, Sans-Serif;
				font-size: 14px;
				line-height: 20px;
				text-align: center;
				
				margin-left: auto;
				margin-right: auto;
				margin-bottom: 20px;
				max-width: 700px;
			}
		</style>';
        if (isset($account_info['quota_warning']) && $account_info['quota_warning'] != '') {
            //echo '<div style="color: red; max-width: 700px; margin-left: auto; margin-right: auto;"><b>Warning</b>: ' . $account_info['quota_warning'] . '</div><br>';
        }
        $return .= '
		<div class="outer_progress">
			<div class="inner_progress" style="width: ' . $account_info['quota_used_percent'] . '%"></div>
		</div>
		
		<table align="center" class="progress_table">
			<tbody><tr align="center">
			    <td style="width: 10%; font-weight: bold; text-align: center">Free Tier</td>
			    <td style="width: 10%; font-weight: bold; text-align: center">Paid Tier</td>        
			    <td style="width: 10%"></td>
			    <td style="width: 10%; font-weight: bold; text-align: center">Total</td>
			    <td style="width: 10%; font-weight: bold; text-align: center">Used</td>
			    <td style="width: 10%; font-weight: bold; text-align: center">Available</td>        
			</tr>

			<tr align="center">
			    <td style="text-align: center">' . $account_info['quota_free_nice'] . '</td>
			    <td style="text-align: center">';
        if ($account_info['quota_paid'] == '0') {
            $return .= 'none';
        } else {
            $return .= $account_info['quota_paid_nice'];
        }
        $return .= '</td>
			    <td></td>
			    <td style="text-align: center">' . $account_info['quota_total_nice'] . '</td>
			    <td style="text-align: center">' . $account_info['quota_used_nice'] . ' (' . $account_info['quota_used_percent'] . '%)</td>
			    <td style="text-align: center">' . $account_info['quota_available_nice'] . '</td>
			</tr>
			';
        $return .= '
		</tbody></table>';
        $return .= '<div style="text-align: center;">';
        $return .= '
		<b>' . __('Upgrade storage', 'it-l10n-backupbuddy') . ':</b> &nbsp;
		<a href="https://ithemes.com/member/cart.php?action=add&id=290" target="_blank" style="text-decoration: none;">+ 5GB</a>, &nbsp;
		<a href="https://ithemes.com/member/cart.php?action=add&id=291" target="_blank" style="text-decoration: none;">+ 10GB</a>, &nbsp;
		<a href="https://ithemes.com/member/cart.php?action=add&id=292" target="_blank" style="text-decoration: none;">+ 25GB</a>
		
		&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="https://sync.ithemes.com/stash/" target="_blank" style="text-decoration: none;"><b>Manage Files & Account</b></a>';
        // Welcome text.
        $up_path = '/';
        if (count($settings) > 0 && true === $additionalOptions) {
            if ($settings['manage_all_files'] == '1') {
                if ('true' != pb_backupbuddy::_GET('listAll')) {
                    $manage_all_link = '<a href="' . pb_backupbuddy::ajax_url('remoteClient') . '&destination_id=' . htmlentities(pb_backupbuddy::_GET('destination_id')) . '&listAll=true" style="text-decoration: none;" title="By default, Stash will display files in the Stash directory for this particular site. Clicking this will display files for all your sites in Stash.">List all site\'s files</a>';
                } else {
                    $manage_all_link = '<a href="' . pb_backupbuddy::ajax_url('remoteClient') . '&destination_id=' . htmlentities(pb_backupbuddy::_GET('destination_id')) . '&listAll=false" style="text-decoration: none;" title="By default, Stash will display files in the Stash directory for this particular site. Clicking this will only show this site\'s files in Stash.">Only list this site\'s files</a>';
                }
            } else {
                $manage_all_link = '<!-- manage all disabled based on settings -->';
                if ($remote_path == '/') {
                    die('Access denied. Possible hacking attempt has been logged. Error #329773.');
                }
            }
            //$reauth_link = '<a href="' . pb_backupbuddy::ajax_url( 'remoteClient' ) . '&destination_id=' . htmlentities( pb_backupbuddy::_GET( 'destination_id' ) ) . '&force_stash_reauth=1" style="text-decoration: none;" title="Re-authenticate to Stash or change the Stash account this Stash destination uses.">Re-authenticate</a>';
            $return .= '&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;' . $manage_all_link;
        }
        $return .= '<br><br></div>';
        $return .= '</div>';
        return $return;
    }
        ?>
</button>
			<span class="backupbuddy_api_wpconfig-hide" style="display: none;">
				<b>For added security you must manually <i>add the following to your wp-config.php</i> file to enable. <i>Refresh this page after adding</i> the following:</b>
				<br>
<textarea style="width: 100%; padding: 15px;" readonly="readonly" onClick="this.focus();this.select();">
define( 'BACKUPBUDDY_API_ENABLE', true ); // Enable BackupBuddy Deployment access.
</textarea><!-- define( 'BACKUPBUDDY_API_SALT', '<?php 
        echo pb_backupbuddy::random_string(32);
        ?>
' ); // Random security identifier. 5+ characters. -->
			</span>
			<br>
			<?php 
    }
}
echo '</div>';
echo '<div class="backupbuddy-destination-sends" style="display: none;"><br>';
require_once 'server_info/remote_sends.php';
echo '<br></div>';
echo '<iframe id="pb_backupbuddy_iframe-dest-wrap" src="' . pb_backupbuddy::ajax_url('destinationTabs') . '&tab=' . $default_tab . '&action_verb=to%20manage%20files" width="100%" height="4000" frameBorder="0">Error #4584594579. Browser not compatible with iframes.</iframe>';
?>

<br style="clear: both;"><br style="clear: both;">

<?php 
// Handles thickbox auto-resizing. Keep at bottom of page to avoid issues.
if (!wp_script_is('media-upload')) {
    wp_enqueue_script('media-upload');
    wp_print_scripts('media-upload');
}
Exemple #13
0
			jQuery('#pb_infovis_container').slideToggle();
			jQuery.post( '<?php 
echo pb_backupbuddy::ajax_url('icicle');
?>
', 
				function( data ) {
					jQuery('#infovis').html('');
					icicle_init( data );
				}
			);
		});
		
		jQuery( '.pb_backupbuddy_site_size_listing_button' ).click( function() {
			jQuery( '#pb_backupbuddy_site_size_listing_intro > .pb_backupbuddy_loading' ).show();
			jQuery.post( '<?php 
echo pb_backupbuddy::ajax_url('site_size_listing');
?>
', 
				function( data ) {
					jQuery( '#pb_backupbuddy_site_size_listing_content' ).html( data );
					jQuery( '#pb_backupbuddy_site_size_listing_intro > .pb_backupbuddy_loading' ).hide();
					jQuery( '#pb_backupbuddy_site_size_listing_intro' ).slideUp();
					jQuery( '#pb_backupbuddy_site_size_listing_content' ).slideDown();
				}
			);
			jQuery( 'pb_backupbuddy_loading' ).hide();
		} );
		
	});
</script>
 function post_backup($fail_mode = false, $cancel_backup = false)
 {
     pb_backupbuddy::status('message', __('Cleaning up after backup.', 'it-l10n-backupbuddy'));
     // Delete temporary data directory.
     if (file_exists($this->_backup['temp_directory'])) {
         pb_backupbuddy::status('details', __('Removing temp data directory.', 'it-l10n-backupbuddy'));
         pb_backupbuddy::$filesystem->unlink_recursive($this->_backup['temp_directory']);
     }
     // Delete temporary ZIP directory.
     if (file_exists(backupbuddy_core::getBackupDirectory() . 'temp_zip_' . $this->_backup['serial'] . '/')) {
         pb_backupbuddy::status('details', __('Removing temp zip directory.', 'it-l10n-backupbuddy'));
         pb_backupbuddy::$filesystem->unlink_recursive(backupbuddy_core::getBackupDirectory() . 'temp_zip_' . $this->_backup['serial'] . '/');
     }
     if (true === $fail_mode) {
         pb_backupbuddy::status('warning', 'Backup archive limiting has been skipped since there was an error to avoid deleting potentially good backups to make room for a potentially bad backup.');
     } else {
         $this->trim_old_archives();
         // Clean up any old excess archives pushing us over defined limits in settings.
     }
     if (true === $cancel_backup) {
         pb_backupbuddy::status('details', 'Backup stopped so deleting backup ZIP file.');
         $unlink_result = @unlink($this->_backup['archive_file']);
         if (true === $unlink_result) {
             pb_backupbuddy::status('details', 'Deleted stopped backup file.');
         } else {
             pb_backupbuddy::status('error', 'Unable to delete stopped backup file. You should delete it manually as it may be damaged from stopping mid-backup. File to delete: `' . $this->_backup['archive_file'] . '`.');
         }
         $this->_backup['finish_time'] = -1;
         //pb_backupbuddy::save();
         $this->_backup_options->save();
     } else {
         // Not cancelled.
         $this->_backup['archive_size'] = @filesize($this->_backup['archive_file']);
         pb_backupbuddy::status('details', __('Final ZIP file size', 'it-l10n-backupbuddy') . ': ' . pb_backupbuddy::$format->file_size($this->_backup['archive_size']));
         pb_backupbuddy::status('archiveSize', pb_backupbuddy::$format->file_size($this->_backup['archive_size']));
         if ($fail_mode === false) {
             // Not cancelled and did not fail so mark finish time.
             //error_log( print_r( $this->_backup_options->options, true ) );
             $archiveFile = basename($this->_backup_options->options['archive_file']);
             // Calculate backup download URL, if any.
             //$downloadURL = pb_backupbuddy::ajax_url( 'download_archive' ) . '&backupbuddy_backup=' . $archiveFile;
             $downloadURL = '';
             $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());
             if (FALSE !== stristr($backup_dir, $abspath)) {
                 // Make sure file to download is in a publicly accessible location (beneath WP web root technically).
                 //pb_backupbuddy::status( 'details', 'mydir: `' . $backup_dir . '`, abs: `' . $abspath . '`.');
                 $sitepath = str_replace($abspath, '', $backup_dir);
                 $downloadURL = rtrim(site_url(), '/\\') . '/' . trim($sitepath, '/\\') . '/' . $archiveFile;
             }
             $integrityIsOK = '-1';
             if (isset($this->_backup_options->options['integrity']['is_ok'])) {
                 $integrityIsOK = $this->_backup_options->options['integrity']['is_ok'];
             }
             $destinations = array();
             foreach ($this->_backup_options->options['steps'] as $step) {
                 if ('send_remote_destination' == $step['function']) {
                     $destinations[] = array('id' => $step['args'][0], 'title' => pb_backupbuddy::$options['remote_destinations'][$step['args'][0]]['title'], 'type' => pb_backupbuddy::$options['remote_destinations'][$step['args'][0]]['type']);
                 }
             }
             pb_backupbuddy::status('details', 'Updating statistics for last backup completed and number of edits since last backup.');
             $finishTime = time();
             pb_backupbuddy::$options['last_backup_finish'] = $finishTime;
             pb_backupbuddy::$options['last_backup_stats'] = array('archiveFile' => $archiveFile, 'archiveURL' => $downloadURL, 'archiveSize' => $this->_backup['archive_size'], 'start' => pb_backupbuddy::$options['last_backup_start'], 'finish' => $finishTime, 'type' => $this->_backup_options->options['profile']['type'], 'profileTitle' => htmlentities($this->_backup_options->options['profile']['title']), 'scheduleTitle' => $this->_backup_options->options['schedule_title'], 'integrityStatus' => $integrityIsOK, 'destinations' => $destinations);
             //error_log( print_r( pb_backupbuddy::$options['last_backup_stats'], true ) );
             pb_backupbuddy::$options['edits_since_last'] = 0;
             // Reset edit stats for notifying user of how many posts/pages edited since last backup happened.
             pb_backupbuddy::save();
         }
     }
     backupbuddy_core::cleanTempDir();
     if ($this->_backup['trigger'] == 'manual') {
         // Do nothing. No notifications as of pre-3.0 2012.
     } elseif ($this->_backup['trigger'] == 'deployment') {
         // Do nothing. No notifications.
     } elseif ($this->_backup['trigger'] == 'deployment_pulling') {
         // Do nothing.
     } elseif ($this->_backup['trigger'] == 'scheduled') {
         if (false === $fail_mode && false === $cancel_backup) {
             pb_backupbuddy::status('details', __('Sending scheduled backup complete email notification.', 'it-l10n-backupbuddy'));
             $message = 'completed successfully in ' . pb_backupbuddy::$format->time_duration(time() - $this->_backup['start_time']) . ".\n";
             backupbuddy_core::mail_notify_scheduled($this->_backup['serial'], 'complete', __('Scheduled backup', 'it-l10n-backupbuddy') . ' "' . $this->_backup['schedule_title'] . '" ' . $message);
         }
     } else {
         pb_backupbuddy::status('error', 'Error #4343434. Unknown backup trigger `' . $this->_backup['trigger'] . '`.');
     }
     pb_backupbuddy::status('message', __('Finished cleaning up.', 'it-l10n-backupbuddy'));
     if (true === $cancel_backup) {
         pb_backupbuddy::status('details', 'Backup cancellation complete.');
         return false;
     } else {
         if (true === $fail_mode) {
             pb_backupbuddy::status('details', __('As this backup did not pass the integrity check you should verify it manually or re-scan. Integrity checks can fail on good backups due to permissions, large file size exceeding memory limits, etc. You may manually disable integrity check on the Settings page but you will no longer be notified of potentially bad backups.', 'it-l10n-backupbuddy'));
         } else {
             if ($this->_backup['trigger'] != 'deployment' && $this->_backup['trigger'] != 'deployment_pulling') {
                 //$stats = stat( $this->_backup['archive_file'] );
                 //$sizeFormatted = pb_backupbuddy::$format->file_size( $stats['size'] );
                 pb_backupbuddy::status('archiveInfo', json_encode(array('file' => basename($this->_backup['archive_file']), 'url' => pb_backupbuddy::ajax_url('download_archive') . '&backupbuddy_backup=' . basename($this->_backup['archive_file']))));
             }
         }
     }
     return 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>';
}
die;
Exemple #16
0
        echo '<div style="width: 100%; height: 600px; padding-top: 10px; padding-bottom: 10px; overflow: scroll; ">';
        ob_start();
        phpinfo();
        $info = ob_get_contents();
        ob_end_clean();
        $info = preg_replace('%^.*<body>(.*)</body>.*$%ms', '$1', $info);
        echo $info;
        unset($info);
        echo '</div>';
    }
} else {
    echo '<br>';
    echo '<center>';
    if (!defined('PB_IMPORTBUDDY')) {
        echo '<a href="#TB_inline?width=640&#038;height=600&#038;inlineId=pb_serverinfotext_modal" class="button button-secondary button-tertiary thickbox" title="Server Information Results">Display Server Configuration in Text Format</a> &nbsp;&nbsp;&nbsp; ';
        echo '<a href="' . pb_backupbuddy::ajax_url('phpinfo') . '&#038;TB_iframe=1&#038;width=640&#038;height=600" class="thickbox button secondary-button" title="' . __('Display Extended PHP Settings via phpinfo()', 'it-l10n-backupbuddy') . '">' . __('Display Extended PHP Settings via phpinfo()', 'it-l10n-backupbuddy') . '</a>';
    } else {
        echo '<a id="serverinfotext" class="button button-secondary button-tertiary button-primary thickbox toggle" title="Server Information Results">Display Results in Text Format</a> &nbsp;&nbsp;&nbsp; ';
    }
    echo '</center>';
    /*
    echo '<pre>';
    print_r( ini_get_all() );
    echo '</pre>';
    */
}
?>
<br>


            $test_button = '';
        }
        /*
        if ( $pb_hide_save !== true ) {
        	$save_and_delete_button = '<img class="pb_backupbuddy_destpicker_saveload" src="' . pb_backupbuddy::plugin_url() . '/images/loading.gif" title="Saving... This may take a few seconds...">';
        } else {
        	$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) {
Exemple #18
0
    public function site_size_listing()
    {
        $profile_id = 0;
        if (is_numeric(pb_backupbuddy::_GET('profile'))) {
            if (isset(pb_backupbuddy::$options['profiles'][pb_backupbuddy::_GET('profile')])) {
                $profile_id = pb_backupbuddy::_GET('profile');
                pb_backupbuddy::$options['profiles'][pb_backupbuddy::_GET('profile')] = array_merge(pb_backupbuddy::settings('profile_defaults'), pb_backupbuddy::$options['profiles'][pb_backupbuddy::_GET('profile')]);
                // Set defaults if not set.
            } else {
                pb_backupbuddy::alert('Error #45849458b: Invalid profile ID number `' . htmlentities(pb_backupbuddy::_GET('profile')) . '`. Displaying with default profile.', true);
            }
        }
        echo '<!-- profile: ' . $profile_id . ' -->';
        $exclusions = backupbuddy_core::get_directory_exclusions(pb_backupbuddy::$options['profiles'][$profile_id]);
        $result = pb_backupbuddy::$filesystem->dir_size_map(ABSPATH, ABSPATH, $exclusions, $dir_array);
        if (0 == $result) {
            pb_backupbuddy::alert('Error #5656653. Unable to access directory map listing for directory `' . ABSPATH . '`.');
            die;
        }
        $total_size = pb_backupbuddy::$options['stats']['site_size'] = $result[0];
        $total_size_excluded = pb_backupbuddy::$options['stats']['site_size_excluded'] = $result[1];
        pb_backupbuddy::$options['stats']['site_size_updated'] = time();
        pb_backupbuddy::save();
        arsort($dir_array);
        if (pb_backupbuddy::_GET('text') == 'true') {
            pb_backupbuddy::$ui->ajax_header();
            echo '<h3>' . __('Site Size Listing & Exclusions', 'it-l10n-backupbuddy') . '</h3>';
            echo '<textarea style="width:100%; height: 300px; font-family: monospace;" wrap="off">';
            echo __('Size + Children', 'it-l10n-backupbuddy') . "\t";
            echo __('- Exclusions', 'it-l10n-backupbuddy') . "\t";
            echo __('Directory', 'it-l10n-backupbuddy') . "\n";
        } else {
            ?>
			<style>
				.backupbuddy_sizemap_table th {
					white-space: nowrap;
				}
				.backupbuddy_sizemap_table td {
					word-break: break-all;
				}
			</style>
			<table class="widefat backupbuddy_sizemap_table">
				<thead>
					<tr class="thead">
						<?php 
            echo '<th>', __('Directory', 'it-l10n-backupbuddy'), '</th>', '<th>', __('Size with Children', 'it-l10n-backupbuddy'), '</th>', '<th>', __('Size with Exclusions', 'it-l10n-backupbuddy'), '<br><span class="description">Global defaults profile</span></th>';
            ?>
					</tr>
				</thead>
				<tfoot>
					<tr class="thead">
						<?php 
            echo '<th>', __('Directory', 'it-l10n-backupbuddy'), '</th>', '<th>', __('Size with Children', 'it-l10n-backupbuddy'), '</th>', '<th>', __('Size with Exclusions', 'it-l10n-backupbuddy'), '<br><span class="description">Global defaults profile</span></th>';
            ?>
					</tr>
				</tfoot>
				<tbody>
			<?php 
        }
        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>';
        }
        $item_count = 0;
        foreach ($dir_array as $id => $item) {
            // Each $item is in format array( TOTAL_SIZE, TOTAL_SIZE_TAKING_EXCLUSIONS_INTO_ACCOUNT );
            $item_count++;
            if ($item_count > 100) {
                flush();
                $item_count = 0;
            }
            if ($item[1] === false) {
                if (pb_backupbuddy::_GET('text') == 'true') {
                    $excluded_size = 'EXCLUDED';
                    echo '**';
                } else {
                    $excluded_size = '<span class="pb_label pb_label-important">Excluded</span>';
                    echo '<tr style="background: #fcc9c9;">';
                }
            } else {
                $excluded_size = pb_backupbuddy::$format->file_size($item[1]);
                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>';
        }
        die;
    }
Exemple #19
0
										jQuery( '.backup-function-' + action_line[1] ).find( '.backup-step-status-working' ).removeClass( 'backup-step-status-working' ).addClass( 'backup-step-status-finished' );
									} else if ( action_line[0] == 'error_function' ) {
										jQuery( '.backup-function-' + action_line[1] ).find( '.backup-step-status-working' ).removeClass( 'backup-step-status-working' ).addClass( 'backup-step-status-error' );
									} else if ( action_line[0] == 'start_subfunction' ) {
										backupbuddy_showsubfunction( action_line[2], '' );
									} else if ( action_line[0] == 'archive_url' ) {
										<?php 
if (defined('PB_DEMO_MODE')) {
    ?>
											jQuery( '#pb_backupbuddy_archive_download' ).slideDown();
											//jQuery( '#pb_backupbuddy_stop' ).css( 'visibility', 'hidden' );
										<?php 
} else {
    ?>
											jQuery( '#pb_backupbuddy_archive_url' ).attr( 'href', '<?php 
    echo pb_backupbuddy::ajax_url('download_archive') . '&backupbuddy_backup=';
    ?>
' + action_line[1] );
											jQuery( '#pb_backupbuddy_archive_send' ).attr( 'rel', action_line[1] );
											jQuery( '#pb_backupbuddy_archive_download' ).slideDown();
											//jQuery( '#pb_backupbuddy_stop' ).css( 'visibility', 'hidden' );
										<?php 
}
?>
									} else if ( action_line[0] == 'archive_deleted' ) {
											jQuery( '#pb_backupbuddy_archive_url' ).addClass( 'button-disabled' );
											jQuery( '#pb_backupbuddy_archive_url' ).attr( 'onClick', 'return false;' );
											jQuery( '#pb_backupbuddy_archive_send' ).addClass( 'button-disabled' );
											jQuery( '#pb_backupbuddy_archive_send' ).attr( 'onClick', 'var event = arguments[0] || window.event; event.stopPropagation(); return false;' );
									} else if ( action_line[0] == 'halt_script' ) {
										jQuery( '.backup-step-status-working' ).removeClass( 'backup-step-status-working' ).addClass( 'backup-step-status-error' ); // Anything that was currently running turns into an error.
     // <a class="pb_backupbuddy_remotesend_abort" href="' . pb_backupbuddy::ajax_url( 'remotesend_abort' ) . '&send_id=' . $send_id  . '">( Abort )</a>';
 } elseif ($remote_send['status'] == 'aborted') {
     $status = '<span class="pb_label pb_label-warning">Aborted by user</span>';
 } elseif ($remote_send['status'] == 'multipart') {
     $status = '<span class="pb_label pb_label-info">Multipart transfer</span>';
     // <a class="pb_backupbuddy_remotesend_abort" href="' . pb_backupbuddy::ajax_url( 'remotesend_abort' ) . '&send_id=' . $send_id  . '">( Abort )</a>';
 } else {
     $status = '<span class="pb_label pb_label-important">' . ucfirst($remote_send['status']) . '</span>';
 }
 if (isset($remote_send['_multipart_status'])) {
     $status .= '<br>' . $remote_send['_multipart_status'];
 }
 // Display 'View Log' link if log available for this send.
 $log_file = backupbuddy_core::getLogDirectory() . 'status-remote_send-' . $send_id . '_' . pb_backupbuddy::$options['log_serial'] . '.txt';
 if (file_exists($log_file)) {
     $status .= '<br><a title="' . __('Backup Process Technical Details', 'it-l10n-backupbuddy') . '" href="' . pb_backupbuddy::ajax_url('remotesend_details') . '&send_id=' . $send_id . '&#038;TB_iframe=1&#038;width=640&#038;height=600" class="thickbox">View Log</a>';
 }
 // Determine destination.
 if (isset(pb_backupbuddy::$options['remote_destinations'][$remote_send['destination']])) {
     // Valid destination.
     $destination = pb_backupbuddy::$options['remote_destinations'][$remote_send['destination']]['title'] . ' (' . pb_backupbuddy::$options['remote_destinations'][$remote_send['destination']]['type'] . ')';
 } else {
     // Invalid destination (been deleted since send?).
     $destination = '<span class="description">Unknown</span>';
 }
 $write_speed = '';
 if (isset($remote_send['write_speed']) && '' != $remote_send['write_speed']) {
     $write_speed = 'Transfer Speed: ' . pb_backupbuddy::$format->file_size($remote_send['write_speed']) . '/sec<br>';
 }
 $trigger = ucfirst($remote_send['trigger']);
 $base_file = basename($remote_send['file']);
            $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;
		}
	}
	
	
	function backupbuddy_bytesToSize(bytes) {
		var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
		if (bytes == 0) return '0 Byte';
		var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
		return (bytes / Math.pow(1024, i)).toFixed(2) + ' ' + sizes[i];
	};
	
	
	function pb_backupbuddy_selectdestination( destination_id, destination_title, callback_data, delete_after, mode ) {
		if ( callback_data != '' ) {
			jQuery.post( '<?php 
echo pb_backupbuddy::ajax_url('remote_send');
?>
', { destination_id: destination_id, destination_title: destination_title, file: callback_data, trigger: 'manual', delete_after: delete_after }, 
				function(data) {
					data = jQuery.trim( data );
					if ( data.charAt(0) != '1' ) {
						alert( "<?php 
_e("Error starting remote send", 'it-l10n-backupbuddy');
?>
:" + "\n\n" + data );
					} else {
						jQuery( '.bb_actions_remotesent' ).text( "<?php 
_e('Your file has been scheduled to be sent now. It should arrive shortly.', 'it-l10n-backupbuddy');
?>
 <?php 
_e('You will be notified by email if any problems are encountered.', 'it-l10n-backupbuddy');
    $hover_actions['hash'] = '<span class="dashicons dashicons-chart-line"></span> ' . __('Checksum', 'it-l10n-backupbuddy');
    $bulk_actions = array('delete_backup' => __('Delete', 'it-l10n-backupbuddy'));
}
if ($listing_mode == 'migrate') {
    $hover_actions['migrate'] = '<span class="dashicons dashicons-share-alt2"></span> ' . __('Migrate', 'it-l10n-backupbuddy');
    $hover_actions[pb_backupbuddy::ajax_url('download_archive') . '&backupbuddy_backup='] = '<span class="dashicons dashicons-download"></span> ' . __('Download', 'it-l10n-backupbuddy');
    $hover_actions['note'] = '<span class="dashicons dashicons-edit"></span> ' . __('Note', 'it-l10n-backupbuddy');
    $bulk_actions = array();
    foreach ($backups as $backup_id => $backup) {
        if ($backup[1] == 'Database') {
            unset($backups[$backup_id]);
        }
    }
}
if ($listing_mode == 'restore_migrate') {
    $hover_actions[pb_backupbuddy::ajax_url('download_archive') . '&backupbuddy_backup='] = '<span class="dashicons dashicons-download"></span> ' . __('Download', 'it-l10n-backupbuddy');
    $hover_actions['send'] = '<span class="dashicons dashicons-migrate"></span> ' . __('Send', 'it-l10n-backupbuddy');
    $hover_actions['page=pb_backupbuddy_backup&zip_viewer'] = '<span class="dashicons dashicons-visibility"></span>&nbsp; ' . __('Browse & Restore Files', 'it-l10n-backupbuddy');
    $hover_actions['rollback'] = '<span class="dashicons dashicons-backup"></span> ' . __('Database Rollback', 'it-l10n-backupbuddy');
    $hover_actions['migrate'] = '<span class="dashicons dashicons-share-alt2"></span> ' . __('Migrate', 'it-l10n-backupbuddy');
    $hover_actions['note'] = '<span class="dashicons dashicons-edit"></span> ' . __('Note', 'it-l10n-backupbuddy');
    $bulk_actions = array();
    /*
    foreach( $backups as $backup_id => $backup ) {
    	if ( $backup[1] == 'Database' ) {
    		unset( $backups[$backup_id] );
    	}
    }
    */
}
if (count($backups) == 0) {
Exemple #24
0
', jQuery('#pb_backupbuddy_remote_delete').is(':checked'), '<?php 
echo $mode;
?>
' );
			win.tb_remove();
			return false;
		});
		
		
		
		// Test a remote destination.
		jQuery( '.pb_backupbuddy_destpicker_test' ).click( function() {
			
			jQuery(this).children( '.pb_backupbuddy_destpicker_testload' ).show();
			jQuery.post( '<?php 
echo pb_backupbuddy::ajax_url('remote_test');
?>
', jQuery(this).parent( 'form' ).serialize(), 
				function(data) {
					jQuery( '.pb_backupbuddy_destpicker_testload' ).hide();
					data = jQuery.trim( data );
					alert( data );
				}
			);
			
			return false;
		} );
		
		
		
	});
Exemple #25
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 {
		jQuery(document).on( 'mouseleave', '.viewable a', function() {
			jQuery(this).find( '.viewlink' ).hide();
			jQuery(this).find( '.viewlink_place' ).show();
		});
		
		
	});

	function modal_live( ajax_url_name, source_obj_val ) {
		jQuery( '#pb_backupbuddy_modal_iframe' ).attr( 'src', 'about:blank' ); // clear while we load new URL.
		jQuery( '#pb_backupbuddy_title' ).html( '<?php 
_e("File Viewer", "it-l10n-backupbuddy");
?>
' );
		var url = '<?php 
echo pb_backupbuddy::ajax_url("");
?>
' + ajax_url_name + '&archive=<?php 
echo strip_tags($file);
?>
&file=' + source_obj_val.attr( 'rel' );
		jQuery( '#pb_backupbuddy_modal_iframe' ).attr( 'src', url );
		jQuery( '#leanModal_a' ).click();
	}
</script>



<?php 
// Set up zipbuddy.
if (!isset(pb_backupbuddy::$classes['zipbuddy'])) {
    echo '?page=pb_backupbuddy_settings">Settings</a> page before attempting to Migrate to a new server with the link in the backup list.
	</b><br><br>';
}
?>


The best way to Restore or Migrate your site is by using a standalone PHP script named <b>importbuddy.php</b>. This file is run without first
installing WordPress, in combination with your backup ZIP file will allow you to restore this server or to a new server entirely. Sites may be
restored to a new site URL or domain.
You should keep a copy of importbuddy.php for future restores.  It is also stored within backup ZIP files for your convenience. importbuddy.php files are not
site/backup specific.
<br><br>
<ol>
	<li>
		<a id="pb_backupbuddy_downloadimportbuddy" href="<?php 
echo pb_backupbuddy::ajax_url('importbuddy');
?>
" class="button button-primary pb_backupbuddy_get_importbuddy">Download importbuddy.php</a> or
		<a id="pb_backupbuddy_sendimportbuddy" href="" rel="importbuddy.php" class="button button-primary pb_backupbuddy_hoveraction_send">Send importbuddy.php to a Destination</a>
	</li>
	<li>
		Download a backup zip file from the list below or send it directly to a destination by selecting "Send file" when hovering over a backup below.
	</li>
	<li>
		Upload importbuddy.php & the downloaded backup zip file to the destination server directory where you want your site restored.
		<ul style="list-style-type: circle; margin-left: 20px; margin-top: 8px;">
			<li>
				Upload these into the FTP directory for your site's web root such as /home/buddy/public_html/.
				If you want to restore into a subdirectory, put these files in it.
			</li>
			<li>
Exemple #28
0
    public static function backups_list($type = 'default', $subsite_mode = false)
    {
        if (pb_backupbuddy::_POST('bulk_action') == 'delete_backup' && is_array(pb_backupbuddy::_POST('items'))) {
            $needs_save = false;
            pb_backupbuddy::verify_nonce(pb_backupbuddy::_POST('_wpnonce'));
            // Security check to prevent unauthorized deletions by posting from a remote place.
            $deleted_files = array();
            foreach (pb_backupbuddy::_POST('items') as $item) {
                if (file_exists(backupbuddy_core::getBackupDirectory() . $item)) {
                    if (@unlink(backupbuddy_core::getBackupDirectory() . $item) === true) {
                        $deleted_files[] = $item;
                        // Cleanup any related fileoptions files.
                        $serial = backupbuddy_core::get_serial_from_file($item);
                        $backup_files = glob(backupbuddy_core::getBackupDirectory() . '*.zip');
                        if (!is_array($backup_files)) {
                            $backup_files = array();
                        }
                        if (count($backup_files) > 5) {
                            // Keep a minimum number of backups in array for stats.
                            $this_serial = self::get_serial_from_file($item);
                            $fileoptions_file = backupbuddy_core::getLogDirectory() . 'fileoptions/' . $this_serial . '.txt';
                            if (file_exists($fileoptions_file)) {
                                @unlink($fileoptions_file);
                            }
                            if (file_exists($fileoptions_file . '.lock')) {
                                @unlink($fileoptions_file . '.lock');
                            }
                            $needs_save = true;
                        }
                    } else {
                        pb_backupbuddy::alert('Error: Unable to delete backup file `' . $item . '`. Please verify permissions.', true);
                    }
                }
                // End if file exists.
            }
            // End foreach.
            if ($needs_save === true) {
                pb_backupbuddy::save();
            }
            pb_backupbuddy::alert(__('Deleted:', 'it-l10n-backupbuddy') . ' ' . implode(', ', $deleted_files));
        }
        // End if deleting backup(s).
        $backups = array();
        $backup_sort_dates = array();
        $files = glob(backupbuddy_core::getBackupDirectory() . 'backup*.zip');
        if (is_array($files) && !empty($files)) {
            // For robustness. Without open_basedir the glob() function returns an empty array for no match. With open_basedir in effect the glob() function returns a boolean false for no match.
            $backup_prefix = self::backup_prefix();
            // Backup prefix for this site. Used for MS checking that this user can see this backup.
            foreach ($files as $file_id => $file) {
                if ($subsite_mode === true && is_multisite()) {
                    // If a Network and NOT the superadmin must make sure they can only see the specific subsite backups for security purposes.
                    // Only allow viewing of their own backups.
                    if (!strstr($file, $backup_prefix)) {
                        unset($files[$file_id]);
                        // Remove this backup from the list. This user does not have access to it.
                        continue;
                        // Skip processing to next file.
                    }
                }
                $serial = backupbuddy_core::get_serial_from_file($file);
                $options = array();
                if (file_exists(backupbuddy_core::getLogDirectory() . 'fileoptions/' . $serial . '.txt')) {
                    require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
                    pb_backupbuddy::status('details', 'Fileoptions instance #33.');
                    $backup_options = new pb_backupbuddy_fileoptions(backupbuddy_core::getLogDirectory() . 'fileoptions/' . $serial . '.txt', $read_only = false, $ignore_lock = false, $create_file = true);
                    // Will create file to hold integrity data if nothing exists.
                } else {
                    $backup_options = '';
                }
                $backup_integrity = backupbuddy_core::backup_integrity_check($file, $backup_options, $options);
                // Backup status.
                $pretty_status = array(true => '<span class="pb_label pb_label-success">Good</span>', 'pass' => '<span class="pb_label pb_label-success">Good</span>', false => '<span class="pb_label pb_label-important">Bad</span>', 'fail' => '<span class="pb_label pb_label-important">Bad</span>');
                // Backup type.
                $pretty_type = array('full' => 'Full', 'db' => 'Database', 'files' => 'Files');
                // Defaults...
                $detected_type = '';
                $file_size = '';
                $modified = '';
                $modified_time = 0;
                $integrity = '';
                $main_string = 'Warn#284.';
                if (is_array($backup_integrity)) {
                    // Data intact... put it all together.
                    // Calculate time ago.
                    $time_ago = '';
                    if (isset($backup_integrity['modified'])) {
                        $time_ago = pb_backupbuddy::$format->time_ago($backup_integrity['modified']) . ' ago';
                    }
                    $detected_type = pb_backupbuddy::$format->prettify($backup_integrity['detected_type'], $pretty_type);
                    if ($detected_type == '') {
                        $detected_type = 'Unknown';
                    } else {
                        if (isset($backup_options->options['profile'])) {
                            $detected_type = '
							<div>
								<span style="color: #AAA; float: left;">' . $detected_type . '</span>
								<span style="display: inline-block; float: left; height: 15px; border-right: 1px solid #EBEBEB; margin-left: 6px; margin-right: 6px;"></span>
								' . htmlentities($backup_options->options['profile']['title']) . '
							</div>
							';
                        }
                    }
                    $file_size = pb_backupbuddy::$format->file_size($backup_integrity['size']);
                    $modified = pb_backupbuddy::$format->date(pb_backupbuddy::$format->localize_time($backup_integrity['modified']), 'l, F j, Y - g:i:s a');
                    $modified_time = $backup_integrity['modified'];
                    if (isset($backup_integrity['status'])) {
                        // Pre-v4.0.
                        $status = $backup_integrity['status'];
                    } else {
                        // v4.0+
                        $status = $backup_integrity['is_ok'];
                    }
                    // Calculate main row string.
                    if ($type == 'default') {
                        // Default backup listing.
                        $main_string = '<a href="' . pb_backupbuddy::ajax_url('download_archive') . '&backupbuddy_backup=' . basename($file) . '" class="backupbuddyFileTitle" title="' . basename($file) . '">' . $modified . ' (' . $time_ago . ')</a>';
                    } elseif ($type == 'migrate') {
                        // Migration backup listing.
                        $main_string = '<a class="pb_backupbuddy_hoveraction_migrate backupbuddyFileTitle" rel="' . basename($file) . '" href="' . pb_backupbuddy::page_url() . '&migrate=' . basename($file) . '&value=' . basename($file) . '" title="' . basename($file) . '">' . $modified . ' (' . $time_ago . ')</a>';
                    } else {
                        $main_string = '{Unknown type.}';
                    }
                    // Add comment to main row string if applicable.
                    if (isset($backup_integrity['comment']) && $backup_integrity['comment'] !== false && $backup_integrity['comment'] !== '') {
                        $main_string .= '<br><span class="description">Note: <span class="pb_backupbuddy_notetext">' . htmlentities($backup_integrity['comment']) . '</span></span>';
                    }
                    $integrity = pb_backupbuddy::$format->prettify($status, $pretty_status) . ' ';
                    if (isset($backup_integrity['scan_notes']) && count((array) $backup_integrity['scan_notes']) > 0) {
                        foreach ((array) $backup_integrity['scan_notes'] as $scan_note) {
                            $integrity .= $scan_note . ' ';
                        }
                    }
                    $integrity .= '<a href="' . pb_backupbuddy::page_url() . '&reset_integrity=' . $serial . '" title="Rescan integrity. Last checked ' . pb_backupbuddy::$format->date($backup_integrity['scan_time']) . '."><img src="' . pb_backupbuddy::plugin_url() . '/images/refresh_gray.gif" style="vertical-align: -1px;"></a>';
                    $integrity .= '<div class="row-actions"><a title="' . __('Backup Status', 'it-l10n-backupbuddy') . '" href="' . pb_backupbuddy::ajax_url('integrity_status') . '&serial=' . $serial . '&#038;TB_iframe=1&#038;width=640&#038;height=600" class="thickbox">' . __('View Details', 'it-l10n-backupbuddy') . '</a></div>';
                    $sumLogFile = backupbuddy_core::getLogDirectory() . 'status-' . $serial . '_sum_' . pb_backupbuddy::$options['log_serial'] . '.txt';
                    if (file_exists($sumLogFile)) {
                        $integrity .= '<div class="row-actions"><a title="' . __('View Backup Log', 'it-l10n-backupbuddy') . '" href="' . pb_backupbuddy::ajax_url('view_log') . '&serial=' . $serial . '&#038;TB_iframe=1&#038;width=640&#038;height=600" class="thickbox">' . __('View Log', 'it-l10n-backupbuddy') . '</a></div>';
                    }
                }
                // end if is_array( $backup_options ).
                $backups[basename($file)] = array(array(basename($file), $main_string . '<br><span class="description" style="color: #AAA; display: inline-block; margin-top: 5px;">' . basename($file) . '</span>'), $detected_type, $file_size, $integrity);
                $backup_sort_dates[basename($file)] = $modified_time;
            }
            // End foreach().
        }
        // End if.
        // Sort backup by date.
        arsort($backup_sort_dates);
        // Re-arrange backups based on sort dates.
        $sorted_backups = array();
        foreach ($backup_sort_dates as $backup_file => $backup_sort_date) {
            $sorted_backups[$backup_file] = $backups[$backup_file];
            unset($backups[$backup_file]);
        }
        unset($backups);
        return $sorted_backups;
    }
Exemple #29
0
<script type="text/javascript">
	function pb_status_append( status_string ) {
		//console.log( status_string );
		target_id = 'pb_backupbuddy_status'; // importbuddy_status or pb_backupbuddy_status
		if( jQuery( '#' + target_id ).length == 0 ) { // No status box yet so suppress.
			return;
		}
		jQuery( '#' + target_id ).append( "\n" + status_string );
		textareaelem = document.getElementById( target_id );
		textareaelem.scrollTop = textareaelem.scrollHeight;
	}
</script>


<div id="message" style="display: none; padding: 9px;" rel="" class="pb_backupbuddy_alert updated fade below-h2">
	<?php 
_e('If the deployment should fail for any reason you may attempt to undo its changes at any time by visiting the URL', 'it-l10n-backupbuddy');
?>
:<br>
	<a href="" id="pb_backupbuddy_undourl" target="pb_backupbuddy_modal_iframe"></a>
</div>


<iframe id="pb_backupbuddy_modal_iframe" name="pb_backupbuddy_modal_iframe" src="<?php 
echo pb_backupbuddy::ajax_url('deploy');
?>
&step=init&deployment=<?php 
echo $deployment_id;
?>
" width="100%" height="1800" frameBorder="0" padding="0" margin="0">Error #4584594579. Browser not compatible with iframes.</iframe>
Exemple #30
0
        }
    }
    $remote_destinations = '<ul id="pb_backupbuddy_remotedestinations_list">' . $remote_destinations_html . '</ul>';
} else {
    $mode = 'add';
    $data['mode_title'] = __('Add New Schedule', 'it-l10n-backupbuddy');
    $savepoint = false;
    $first_run_value = date('m/d/Y h:i a', time() + (get_option('gmt_offset') * 3600 + 86400));
    $remote_destinations = '<ul id="pb_backupbuddy_remotedestinations_list"></ul>';
}
$schedule_form = new pb_backupbuddy_settings('scheduling', $savepoint, 'edit=' . pb_backupbuddy::_GET('edit'), 250);
$schedule_form->add_setting(array('type' => 'text', 'name' => 'title', 'title' => 'Schedule name', 'tip' => __('This is a name for your reference only.', 'it-l10n-backupbuddy'), 'rules' => 'required'));
$schedule_form->add_setting(array('type' => 'radio', 'name' => 'type', 'title' => 'Backup type', 'options' => array('db' => 'Database only', 'full' => 'Full backup'), 'tip' => __('Full backups contain all files (except exclusions) and your database. Database only backups consist of an export of your mysql database; no WordPress files or media. Database backups are typically much smaller and faster to perform and are typically the most quickly changing part of a site.', 'it-l10n-backupbuddy'), 'rules' => 'required'));
$schedule_form->add_setting(array('type' => 'select', 'name' => 'interval', 'title' => 'Backup interval', 'options' => array('monthly' => 'Monthly', 'twicemonthly' => 'Twice Monthly', 'weekly' => 'Weekly', 'daily' => 'Daily', 'hourly' => 'Hourly'), 'tip' => __('Time period between backups.', 'it-l10n-backupbuddy'), 'rules' => 'required'));
$schedule_form->add_setting(array('type' => 'text', 'name' => 'first_run', 'title' => 'Date/time of next run', 'tip' => __('IMPORTANT: For scheduled events to occur someone (or you) must visit this site on or after the scheduled time. If no one visits your site for a long period of time some backup events may not be triggered.', 'it-l10n-backupbuddy'), 'rules' => 'required', 'default' => $first_run_value, 'after' => ' ' . __('Currently', 'it-l10n-backupbuddy') . ' <code>' . date('m/d/Y h:i a ' . get_option('gmt_offset'), time() + get_option('gmt_offset') * 3600) . ' UTC</code> ' . __('based on', 'it-l10n-backupbuddy') . ' <a href="' . admin_url('options-general.php') . '">' . __('WordPress settings', 'it-l10n-backupbuddy') . '</a>.'));
$schedule_form->add_setting(array('type' => 'text', 'name' => 'remote_destinations', 'title' => 'Remote backup destination', 'rules' => '', 'css' => 'display: none;', 'after' => $remote_destinations . '<a href="' . pb_backupbuddy::ajax_url('destination_picker') . '&#038;TB_iframe=1&#038;width=640&#038;height=600" class="thickbox button secondary-button" style="margin-top: 3px;" title="' . __('Select a Destination', 'it-l10n-backupbuddy') . '">' . __('+ Add Remote Destination', 'it-l10n-backupbuddy') . '</a>'));
$schedule_form->add_setting(array('type' => 'checkbox', 'name' => 'delete_after', 'title' => 'Delete local backup after remote send?', 'options' => array('checked' => '1', 'unchecked' => '0'), 'rules' => ''));
// PROCESS ADDING SCHEDULE.
$submitted_schedule = $schedule_form->process();
// Handles processing the submitted form (if applicable).
if ($submitted_schedule != '' && count($submitted_schedule['errors']) == 0) {
    // ADD SCHEDULE.
    if (pb_backupbuddy::_GET('edit') == '') {
        $error = false;
        $schedule = pb_backupbuddy::settings('schedule_defaults');
        $schedule['title'] = $submitted_schedule['data']['title'];
        if (isset($submitted_schedule['data']['type'])) {
            $schedule['type'] = $submitted_schedule['data']['type'];
        }
        $schedule['interval'] = $submitted_schedule['data']['interval'];
        $schedule['first_run'] = pb_backupbuddy::$format->unlocalize_time(strtotime($submitted_schedule['data']['first_run']));