예제 #1
0
파일: ajax.php 프로젝트: brettex/pspark
 public function remote_save()
 {
     pb_backupbuddy::verify_nonce();
     require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
     $settings_form = pb_backupbuddy_destinations::configure(array('type' => pb_backupbuddy::_POST('pb_backupbuddy_type')), 'save');
     $save_result = $settings_form->process();
     $destination_id = trim(pb_backupbuddy::_GET('pb_backupbuddy_destinationid'));
     if (count($save_result['errors']) == 0) {
         if ($destination_id == 'NEW') {
             // ADD NEW.
             // Dropbox Kludge. Sigh.
             $save_result['data']['token'] = pb_backupbuddy::$options['dropboxtemptoken'];
             pb_backupbuddy::$options['remote_destinations'][] = $save_result['data'];
             pb_backupbuddy::save();
             echo 'Destination Added.';
         } elseif (!isset(pb_backupbuddy::$options['remote_destinations'][$destination_id])) {
             // EDITING NONEXISTANT.
             echo 'Error #54859. Invalid destination ID.';
         } else {
             // EDITING EXISTING -- Save!
             pb_backupbuddy::$options['remote_destinations'][$destination_id] = $save_result['data'];
             //echo '<pre>' . print_r( pb_backupbuddy::$options['remote_destinations'][$destination_id], true ) . '</pre>';
             pb_backupbuddy::save();
             echo 'Settings saved.';
         }
     } else {
         echo "Error saving settings.\n\n";
         echo implode("\n", $save_result['errors']);
     }
     die;
 }
    echo '<div style="margin-top: -14px; margin-bottom: 18px; margin-left: 12px;">';
    echo '<button class="button-secondary" onClick="jQuery(this).closest(\'.backupbuddy-destination-wrap\').find(\'.backupbuddy-destination-config\').toggle()">Configure Destination Settings</button>';
    echo '</div>';
    */
    // SETTINGS CONFIG FORM.
    echo '<div class="backupbuddy-destination-config" style="
		display: none;
		border: 1px solid rgb(229, 229, 229);
		-webkit-box-shadow: rgba(0, 0, 0, 0.0392157) 0px 1px 1px;
		box-shadow: rgba(0, 0, 0, 0.0392157) 0px 1px 1px;
		padding: 20px;
		margin-bottom: 40px;
		background: rgb(255, 255, 255);
	">';
    echo '<h3 style="margin-left: 0;">' . __('Destination Settings', 'it-l10n-backupbuddy') . '</h3>';
    $settings = pb_backupbuddy_destinations::configure($destination, 'edit', $destination_id);
    if ($settings === false) {
        echo 'Error #556656b. Unable to display configuration. This destination\'s settings may be corrupt. Removing this destination. Please refresh the page.';
        unset(pb_backupbuddy::$options['remote_destinations'][$destination_id]);
        pb_backupbuddy::save();
    } else {
        if ($pb_hide_test !== true) {
            $test_button = '<a href="#" class="button secondary-button pb_backupbuddy_destpicker_test" href="#" title="Test destination settings.">Test Settings<img class="pb_backupbuddy_destpicker_testload" src="' . pb_backupbuddy::plugin_url() . '/images/loading.gif" title="Testing... This may take several seconds..."></a>';
        } else {
            $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 = '';
예제 #3
0
<?php

backupbuddy_core::verifyAjaxAccess();
// Remote destination saving.
/*	remote_save()
*	
*	Remote destination saving.
*	
*	@return		null
*/
pb_backupbuddy::verify_nonce();
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
$settings_form = pb_backupbuddy_destinations::configure(array('type' => pb_backupbuddy::_POST('pb_backupbuddy_type')), 'save');
$save_result = $settings_form->process();
$destination_id = trim(pb_backupbuddy::_GET('pb_backupbuddy_destinationid'));
if (count($save_result['errors']) == 0) {
    // NO ERRORS SO SAVE.
    if ($destination_id == 'NEW') {
        // ADD NEW.
        // Copy over dropbox token.
        $save_result['data']['token'] = pb_backupbuddy::$options['dropboxtemptoken'];
        pb_backupbuddy::$options['remote_destinations'][] = $save_result['data'];
        $newDestination = array();
        $newDestination['title'] = $save_result['data']['title'];
        $newDestination['type'] = $save_result['data']['type'];
        backupbuddy_core::addNotification('destination_created', 'Remote destination created', 'A new remote destination "' . $newDestination['title'] . '" has been created.', $newDestination);
        pb_backupbuddy::save();
        echo 'Destination Added.';
    } elseif (!isset(pb_backupbuddy::$options['remote_destinations'][$destination_id])) {
        // EDITING NONEXISTANT.
        echo 'Error #54859. Invalid destination ID `' . $destination_id . '`.';
예제 #4
0
}
global $pb_hide_save;
if (pb_backupbuddy::_GET('add') != '') {
    $destination_type = pb_backupbuddy::_GET('add');
    echo '<h2>Add New Destination</h2>';
    // the following scrollTo is so that once scrolling page down to look at long list of destinations to add, coming here bumps them back to the proper place up top.
    ?>

	<script>
		var win = window.dialogArguments || opener || parent || top;
		win.window.scrollTo(0,0);
	</script>
	
	<?php 
    echo '<div class="pb_backupbuddy_destpicker_id bb-dest-option" rel="NEW">';
    $settings = pb_backupbuddy_destinations::configure(array('type' => $destination_type), 'add');
    if ($settings === false) {
        echo 'Error #556656a. Unable to display configuration.';
    } else {
        if ($pb_hide_test !== true) {
            $test_button = '<a href="#" class="button secondary-button pb_backupbuddy_destpicker_test" href="#" title="Test destination settings.">Test Settings<img class="pb_backupbuddy_destpicker_testload" src="' . pb_backupbuddy::plugin_url() . '/images/loading.gif" title="Testing... This may take several seconds..."></a>&nbsp;&nbsp;';
        } else {
            $test_button = '';
        }
        if ($pb_hide_save !== true) {
            $save_button = '<img class="pb_backupbuddy_destpicker_saveload" src="' . pb_backupbuddy::plugin_url() . '/images/loading.gif" title="Saving... This may take a few seconds...">';
            echo $settings->display_settings('+ Add Destination', $test_button, $save_button, 'pb_backupbuddy_destpicker_save');
            // title, before, after, class
        }
    }
    echo '</div>';
예제 #5
0
<?php

backupbuddy_core::verifyAjaxAccess();
pb_backupbuddy::$ui->ajax_header($js = true, $padding = true);
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
require_once pb_backupbuddy::plugin_path() . '/destinations/live/live.php';
require_once pb_backupbuddy::plugin_path() . '/destinations/live/live_periodic.php';
$destination_id = backupbuddy_live::getLiveID();
$destination_settings = backupbuddy_live_periodic::get_destination_settings();
echo '<h2>' . __('BackupBuddy Stash Live Settings', 'it-l10n-backupbuddy') . '</h2>';
// Settings form setup.
$settings_form = pb_backupbuddy_destinations::configure($destination_settings, $mode = 'edit', $destination_id, $url = pb_backupbuddy::ajax_url('live_settings'));
// Process saving.
if ('' != pb_backupbuddy::_POST('pb_backupbuddy_')) {
    pb_backupbuddy::verify_nonce();
    $save_result = $settings_form->process();
    if (count($save_result['errors']) == 0) {
        // NO ERRORS SO SAVE.
        pb_backupbuddy::$options['remote_destinations'][$destination_id] = array_merge(pb_backupbuddy::$options['remote_destinations'][$destination_id], $save_result['data']);
        pb_backupbuddy::save();
        pb_backupbuddy::alert(__('Settings saved. Restarting Live process so they take immediate effect.', 'it-l10n-backupbuddy'));
        set_transient('backupbuddy_live_jump', array('daily_init', array()), 60 * 60 * 48);
        // Tells Live process to restart from the beginning (if mid-process) so new settigns apply.
        // Add final entry to log if disabled
        if ($destination_settings['disable_logging'] == 0 && $save_result['data']['disable_logging'] == 1) {
            $previous_status_serial = pb_backupbuddy::get_status_serial();
            // Hold current serial.
            pb_backupbuddy::set_status_serial('live_periodic');
            // Redirect logging output to a certain log file.
            pb_backupbuddy::status('details', '-----');
            pb_backupbuddy::status('details', 'Logging disabled in Stash Live --> Settings --> Advanced.');