Example #1
0
function plugin_information($plugin_slug, $data)
{
    $plugin_path = $data['path'];
    ?>
	
	<textarea readonly="readonly" rows="7" cols="65" wrap="off" style="width: 100%;"><?php 
    //echo "Version History:\n\n";
    readfile($plugin_path . '/history.txt');
    ?>
</textarea>
	<script type="text/javascript">
		jQuery(document).ready(function() {
			jQuery("#pluginbuddy_<?php 
    echo $plugin_slug;
    ?>
_debugtoggle").click(function() {
				jQuery("#pluginbuddy_<?php 
    echo $plugin_slug;
    ?>
_debugtoggle_div").slideToggle();
			});
		});
	</script>
	<?php 
    if (pb_backupbuddy::_POST('reset_defaults') == $plugin_slug) {
        if (call_user_func('pb_' . $plugin_slug . '::reset_options', true) === true) {
            pb_backupbuddy::alert('Plugin settings have been reset to defaults for plugin `' . $data['name'] . '`.');
        } else {
            pb_backupbuddy::alert('Unable to reset plugin settings. Verify you are running the latest version.');
        }
    }
    ?>
	
	<?php 
}
Example #2
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;
 }
Example #3
0
function backupbuddy_register_sync_verbs($api)
{
    $verbs = array('backupbuddy-run-backup' => 'Ithemes_Sync_Verb_Backupbuddy_Run_Backup', 'backupbuddy-list-profiles' => 'Ithemes_Sync_Verb_Backupbuddy_List_Profiles', 'backupbuddy-list-schedules' => 'Ithemes_Sync_Verb_Backupbuddy_List_Schedules', 'backupbuddy-list-destinations' => 'Ithemes_Sync_Verb_Backupbuddy_List_Destinations', 'backupbuddy-get-overview' => 'Ithemes_Sync_Verb_Backupbuddy_Get_Overview', 'backupbuddy-get-latestBackupProcess' => 'Ithemes_Sync_Verb_Backupbuddy_Get_LatestBackupProcess', 'backupbuddy-get-everything' => 'Ithemes_Sync_Verb_Backupbuddy_Get_Everything', 'backupbuddy-get-importbuddy' => 'Ithemes_Sync_Verb_Backupbuddy_Get_Importbuddy');
    foreach ($verbs as $name => $class) {
        $api->register($name, $class, pb_backupbuddy::plugin_path() . "/classes/ithemes-sync/{$name}.php");
    }
}
Example #4
0
File: 1.php Project: verbazend/AWFA
/**
 *	get_archives_list()
 *
 *	Returns an array of backup archive zip filenames found.
 *
 *	@return		array		Array of .zip filenames; path NOT included.
 */
function get_archives_list() {
	if ( !isset( pb_backupbuddy::$classes['zipbuddy'] ) ) {
		require_once( pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php' );
		pb_backupbuddy::$classes['zipbuddy'] = new pluginbuddy_zipbuddy( ABSPATH );
	}
	
	// List backup files in this directory.
	$backup_archives_glob = glob( ABSPATH . 'backup*.zip' );
	if ( !is_array( $backup_archives_glob ) || empty( $backup_archives_glob ) ) { // On failure glob() returns false or an empty array depending on server settings so normalize here.
		$backup_archives_glob = array();
	}
	foreach( $backup_archives_glob as $backup_archive ) {
		$comment = pb_backupbuddy::$classes['zipbuddy']->get_comment( $backup_archive );
		if ( $comment === false ) {
			$comment = '';
		}
		
		$this_archive = array(
			'file'		=>		basename( $backup_archive ),
			'comment'	=>		$comment,
		);
		$backup_archives[] = $this_archive;
	}
	unset( $backup_archives_glob );
	
	
	return $backup_archives;
}
Example #5
0
File: 6.php Project: verbazend/AWFA
function remove_file($file, $description, $error_on_missing = false)
{
    pb_backupbuddy::status('message', 'Deleting `' . $description . '`...');
    @chmod($file, 0755);
    // High permissions to delete.
    if (is_dir($file)) {
        // directory.
        pb_backupbuddy::$filesystem->unlink_recursive($file);
        if (file_exists($file)) {
            pb_backupbuddy::status('error', 'Unable to delete directory: `' . $description . '`. You should manually delete it.');
        } else {
            pb_backupbuddy::status('message', 'Deleted.', false);
            // No logging of this action to prevent recreating log.
        }
    } else {
        // file
        if (file_exists($file)) {
            if (@unlink($file) != 1) {
                pb_backupbuddy::status('error', 'Unable to delete file: `' . $description . '`. You should manually delete it.');
            } else {
                pb_backupbuddy::status('message', 'Deleted.', false);
                // No logging of this action to prevent recreating log.
            }
        }
    }
}
function backupbuddy_dbMediaSince($includeThumbs = true)
{
    global $wpdb;
    $wpdb->show_errors();
    // Turn on error display.
    $mediaFiles = array();
    // Select all media attachments.
    $sql = "select " . $wpdb->prefix . "postmeta.meta_value as file," . $wpdb->prefix . "posts.post_modified as file_modified," . $wpdb->prefix . "postmeta.meta_key as meta_key from " . $wpdb->prefix . "postmeta," . $wpdb->prefix . "posts WHERE ( meta_key='_wp_attached_file' OR meta_key='_wp_attachment_metadata' ) AND " . $wpdb->prefix . "postmeta.post_id = " . $wpdb->prefix . "posts.id ORDER BY meta_key ASC";
    $results = $wpdb->get_results($sql, ARRAY_A);
    if (null === $results || false === $results) {
        pb_backupbuddy::status('error', 'Error #238933: Unable to calculate media with query `' . $sql . '`. Check database permissions or contact host.');
    }
    foreach ((array) $results as $result) {
        if ($result['meta_key'] == '_wp_attached_file') {
            $mediaFiles[$result['file']] = array('modified' => $result['file_modified']);
        }
        // Include thumbnail image files.
        if (true === $includeThumbs) {
            if ($result['meta_key'] == '_wp_attachment_metadata') {
                $data = unserialize($result['file']);
                foreach ($data['sizes'] as $size) {
                    // Go through each sized thumbnail file.
                    $mediaFiles[$size['file']] = array('modified' => $mediaFiles[$data['file']]['modified']);
                }
            }
        }
    }
    // end foreach $results.
    unset($results);
    return $mediaFiles;
}
 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     $profile = $arguments['profile'];
     if ('db' == $profile) {
         // db profile is always index 1.
         $profile = '1';
     } elseif ('full' == $profile) {
         // full profile is always index 2.
         $profile = '2';
     }
     if (is_numeric($profile)) {
         if (isset(pb_backupbuddy::$options['profiles'][$profile])) {
             $profileArray = pb_backupbuddy::$options['profiles'][$profile];
         } else {
             return array('api' => '0', 'status' => 'error', 'message' => 'Error #2332904: Invalid profile ID `' . htmlentities($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 {
         return array('api' => '0', 'status' => 'error', 'message' => 'Error #85489548955. Invalid profile ID not numeric: `' . htmlentities($profile) . '`.');
     }
     require_once pb_backupbuddy::plugin_path() . '/classes/backup.php';
     pb_backupbuddy::$classes['backup'] = new pb_backupbuddy_backup();
     // Set serial ahead of time so can be used by AJAX before backup procedure actually begins.
     $serial = pb_backupbuddy::random_string(10);
     $profileArray['backup_mode'] = '2';
     // Force modern mode when running under sync.
     // Run the backup!
     if (pb_backupbuddy::$classes['backup']->start_backup_process($profileArray, 'manual', array(), array(), 'it-sync', $serial, array()) !== true) {
         return array('api' => '0', 'status' => 'error', 'message' => 'Error #435832: Backup failed. See BackupBuddy log for details.');
     }
     return array('api' => '0', 'status' => 'ok', 'message' => 'Backup initiated successfully.');
 }
function enqueue_dashboard_stylesheet($hook)
{
    if ('index.php' != $hook) {
        return;
    }
    wp_enqueue_style('bub_dashboard_widget', pb_backupbuddy::plugin_url() . '/css/dashboard_widget.css');
}
Example #9
0
function parse_options($restoreData)
{
    if ('1' == pb_backupbuddy::_POST('restoreFiles')) {
        $restoreData['restoreFiles'] = true;
    } else {
        $restoreData['restoreFiles'] = false;
    }
    if ('1' == pb_backupbuddy::_POST('restoreDatabase')) {
        $restoreData['restoreDatabase'] = true;
    } else {
        $restoreData['restoreDatabase'] = false;
    }
    if ('1' == pb_backupbuddy::_POST('migrateHtaccess')) {
        $restoreData['migrateHtaccess'] = true;
    } else {
        $restoreData['migrateHtaccess'] = false;
    }
    if ('all' == pb_backupbuddy::_POST('zipMethodStrategy') || 'ziparchive' == pb_backupbuddy::_POST('zipMethodStrategy') || 'pclzip' == pb_backupbuddy::_POST('zipMethodStrategy')) {
        $restoreData['zipMethodStrategy'] = pb_backupbuddy::_POST('zipMethodStrategy');
    }
    /*
    if ( ( isset( $_POST['log_level'] ) ) && ( $_POST['log_level'] != '' ) ) {
    	pb_backupbuddy::$options['log_level'] = $_POST['log_level'];
    } else {
    	pb_backupbuddy::$options['log_level'] = '';
    }
    */
    return $restoreData;
}
 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     pb_backupbuddy::$options['remote_destinations'][] = $arguments['settings'];
     pb_backupbuddy::save();
     return array('api' => '0', 'status' => 'ok', 'message' => 'Destination added.');
 }
 public function execute($command)
 {
     if (stristr(PHP_OS, 'WIN') && !stristr(PHP_OS, 'DARWIN')) {
         // Windows; do nothing.
     } else {
         // Linux/Mac
         if (ini_get('exec_dir') !== false && ini_get('exec_dir') != '') {
             // exec_dir PHP patch in place: http://www.kyberdigi.cz/projects/execdir/
             pb_backupbuddy::status('details', 'exec_dir detected. Skipping path assignment.');
         } else {
             pb_backupbuddy::status('details', 'exec_dir not detected. Proceeding normally.');
             $command = 'PATH=$PATH:/usr/bin/:/usr/local/bin/:usr/local/bin:/usr/local/sbin/:/usr/sbin/:/sbin/:/usr/:/bin/' . '; ' . $command;
         }
     }
     // Output command (strips mysqldump passwords).
     if (strstr($command, '--password='******'--password='******' ', $password_portion_begin);
         //pb_backupbuddy::status( 'details', 'pass start: `' . $password_portion_begin . '`. pass end: `' . $password_portion_end . '`' );
         $password_portion = substr($command, $password_portion_begin, $password_portion_end - $password_portion_begin);
         //pb_backupbuddy::status( 'details', 'pass portion: `' . $password_portion . '`.' );
         $unpassworded_command = str_replace($password_portion, '--password=*HIDDEN*', $command);
         pb_backupbuddy::status('details', 'exec() command (password hidden) `' . $unpassworded_command . '` (with path definition).');
         unset($unpassworded_command);
     } else {
         pb_backupbuddy::status('details', 'exec() command `' . $command . '` (with path definition).');
     }
     $exec_output = array();
     @exec($command, $exec_output, $exec_exit_code);
     pb_backupbuddy::status('details', 'exec() command output: `' . implode(',', $exec_output) . '`; Exit code: `' . $exec_exit_code . '`; Exit code description: `' . pb_backupbuddy::$filesystem->exit_code_lookup($exec_exit_code) . '`');
     return array($exec_output, $exec_exit_code);
 }
Example #12
0
 public static function test($settings)
 {
     $email = $settings['address'];
     pb_backupbuddy::status('details', 'Testing email destination. Sending ImportBuddy.php.');
     $importbuddy_temp = backupbuddy_core::getTempDirectory() . 'importbuddy_' . pb_backupbuddy::random_string(10) . '.php.tmp';
     // Full path & filename to temporary importbuddy
     backupbuddy_core::importbuddy($importbuddy_temp);
     // Create temporary importbuddy.
     $files = array($importbuddy_temp);
     if (pb_backupbuddy::$options['email_return'] != '') {
         $email_return = pb_backupbuddy::$options['email_return'];
     } else {
         $email_return = get_option('admin_email');
     }
     $headers = 'From: BackupBuddy <' . $email_return . '>' . "\r\n";
     $wp_mail_result = wp_mail($email, 'BackupBuddy Test', 'BackupBuddy destination test for ' . site_url(), $headers, $files);
     pb_backupbuddy::status('details', 'Sent test email.');
     @unlink($importbuddy_temp);
     if ($wp_mail_result === true) {
         // WP sent. Hopefully it makes it!
         return true;
     } else {
         // WP couldn't try to send.
         echo 'WordPress was unable to attempt to send email. Check your WordPress & server settings.';
         return false;
     }
 }
Example #13
0
 public function execute($command)
 {
     if (stristr(PHP_OS, 'WIN') && !stristr(PHP_OS, 'DARWIN')) {
         // Windows; do nothing.
     } else {
         // Linux/Mac
         $command = 'PATH=$PATH:/usr/bin/:/usr/local/bin/:usr/local/bin:/usr/local/sbin/:/usr/sbin/:/sbin/:/usr/:/bin/' . '; ' . $command;
     }
     // Output command (strips mysqldump passwords).
     if (strstr($command, '--password='******'--password='******' ', $password_portion_begin);
         //pb_backupbuddy::status( 'details', 'pass start: `' . $password_portion_begin . '`. pass end: `' . $password_portion_end . '`' );
         $password_portion = substr($command, $password_portion_begin, $password_portion_end - $password_portion_begin);
         //pb_backupbuddy::status( 'details', 'pass portion: `' . $password_portion . '`.' );
         $unpassworded_command = str_replace($password_portion, '--password=*HIDDEN*', $command);
         pb_backupbuddy::status('details', 'exec() command (password hidden) `' . $unpassworded_command . '` (with path definition).');
         unset($unpassworded_command);
     } else {
         pb_backupbuddy::status('details', 'exec() command `' . $command . '` (with path definition).');
     }
     @exec($command, $exec_output, $exec_exit_code);
     pb_backupbuddy::status('details', 'exec() command output: `' . implode(',', $exec_output) . '`; Exit code: `' . $exec_exit_code . '`; Exit code description: `' . pb_backupbuddy::$filesystem->exit_code_lookup($exec_exit_code) . '`');
     return array($exec_output, $exec_exit_code);
 }
 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     pb_backupbuddy::$options['remote_destinations'][] = $arguments['settings'];
     pb_backupbuddy::save();
     $highest_destination_index = end(array_keys(pb_backupbuddy::$options['remote_destinations']));
     return array('api' => '1', 'status' => 'ok', 'message' => 'Destination added.', 'destination_id' => $highest_destination_index);
 }
Example #15
0
function pb_backupbuddy_stash_pass_form()
{
    echo 'Please enter your iThemes.com Member Password to access your full Stash listing including files stored from other sites:<br><br><br>';
    echo '<form method="post"><b>iThemes Member Password</b>: &nbsp;&nbsp;&nbsp; <input type="password" name="stash_password" size="20"> &nbsp;&nbsp;&nbsp; <input type="submit" name="submit" value="Authenticate" class="button button-primary">';
    pb_backupbuddy::nonce();
    echo '</form>';
    echo '<br><br><br><br>';
}
Example #16
0
function fatal_test_die()
{
    echo '<div style="padding: 10px;"><b>Fatal errors encountered during testing. Please resolve them to continue tests.</b></div>';
    if (pb_backupbuddy::_POST('skip_database_import') == '1') {
        echo '<br><span class="pb_label pb_label-info">Important</span> Database import set to be skipped based on advanced options. Any failures ignored.<br><br>';
        echo '<!-- Success. -->';
    }
    die;
}
Example #17
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;
 }
Example #18
0
 function get_authorize_url()
 {
     $oauth = new Dropbox_OAuth_PEAR($this->_key, $this->_secret);
     $this->_token['request'] = $oauth->getRequestToken();
     pb_backupbuddy::save();
     //echo 'authorizeurltoken:<pre>';
     //print_r( $this->_token );
     //echo '</pre>';
     return str_replace('api.', 'www.', $oauth->getAuthorizeUrl());
 }
 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     if (!isset(pb_backupbuddy::$options['remote_destinations'][$arguments['id']])) {
         return array('api' => '1', 'status' => 'error', 'message' => 'Error #847383: Invalid destination ID. Not found.');
     }
     unset(pb_backupbuddy::$options['remote_destinations'][$arguments['id']]);
     pb_backupbuddy::save();
     return array('api' => '1', 'status' => 'ok', 'message' => 'Destination deleted.', 'destination_id' => $arguments['id']);
 }
Example #20
0
 function upgrader_instantiate($plugin_slug)
 {
     $args = array('parent' => $this, 'remote_url' => 'http://updater2.ithemes.com/index.php', 'version' => pb_backupbuddy::settings('version'), 'plugin_slug' => pb_backupbuddy::settings('slug'), 'plugin_path' => plugin_basename(pb_backupbuddy::plugin_path() . '/' . pb_backupbuddy::settings('init')), 'plugin_url' => pb_backupbuddy::plugin_url(), 'product' => pb_backupbuddy::settings('slug'), 'time' => 43200, 'return_format' => 'json', 'method' => 'POST', 'upgrade_action' => 'check');
     // Instantiate object of latest updater (by namespace) and apply to this plugin's pluginbuddy class (in this namespace).
     //$class_name = $plugin_namespace . "\\updater";
     $target_plugin_class_name = 'pb_' . $plugin_slug . '_updater';
     $this_plugin_class_name = 'pb_' . $this->_slug;
     //$this_plugin_class_name::$_updater = new $target_plugin_class_name( $args );
     pb_backupbuddy::$_updater = new $target_plugin_class_name($args);
 }
 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
     if (true === ($results = pb_backupbuddy_destinations::test($settings))) {
         return array('api' => '0', 'status' => 'ok', 'message' => 'Supported destinations retrieved.');
     } else {
         return array('api' => '0', 'status' => 'error', 'message' => $results);
     }
 }
Example #22
0
 public static function test($settings)
 {
     /*
     if ( ( $settings['address'] == '' ) || ( $settings['username'] == '' ) || ( $settings['password'] == '' ) ) {
     	return __('Missing required input.', 'it-l10n-backupbuddy' );
     }
     */
     // Try sending a file.
     return pb_backupbuddy_destinations::send($settings, dirname(dirname(__FILE__)) . '/remote-send-test.php', $send_id = 'TEST-' . pb_backupbuddy::random_string(12));
     // 3rd param true forces clearing of any current uploads.
 }
 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
     $response = pb_backupbuddy_destinations::delete($arguments['id'], true);
     if (true === $response) {
         return array('api' => '0', 'status' => 'ok', 'message' => 'Destination deleted.');
     } else {
         return array('api' => '0', 'status' => 'error', 'message' => 'Error #384783783: Failure deleting destination.');
     }
 }
 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     pb_backupbuddy::$options['remote_destinations'][] = $arguments['settings'];
     pb_backupbuddy::save();
     $newDestination = array();
     $newDestination['title'] = $arguments['settings']['title'];
     $newDestination['type'] = $arguments['settings']['type'];
     backupbuddy_core::addNotification('destination_created', 'Remote destination created', 'A new remote destination "' . $newDestination['title'] . '" has been created.', $newDestination);
     $highest_destination_index = end(array_keys(pb_backupbuddy::$options['remote_destinations']));
     return array('api' => '1', 'status' => 'ok', 'message' => 'Destination added.', 'destination_id' => $highest_destination_index);
 }
Example #25
0
 /**
  * Constructor - if you're not using the class statically
  *
  * @param string $accessKey Access key
  * @param string $secretKey Secret key
  * @param boolean $useSSL Enable SSL
  * @return void
  */
 public function __construct($accessKey = null, $secretKey = null, $useSSL = true)
 {
     if ($accessKey !== null && $secretKey !== null) {
         self::setAuth($accessKey, $secretKey);
     }
     self::$useSSL = $useSSL;
     if ($useSSL === true) {
         pb_backupbuddy::status('details', 'Instantiated S3 with SSL enabled.');
     } else {
         pb_backupbuddy::status('details', 'Instantiated S3 with SSL disabled.');
     }
 }
 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     if (!class_exists('backupbuddy_core')) {
         require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
     }
     $overview = backupbuddy_api0::getOverview();
     // If archive file is set but actual file does not exist then clear out value.
     if (isset($overview['lastBackupStats']['archiveFile']) && !file_exists($overview['lastBackupStats']['archiveFile'])) {
         $overview['lastBackupStats']['archiveFile'] = '';
     }
     return array('version' => '4', 'status' => 'ok', 'message' => 'Overview retrieved successfully.', 'overview' => $overview);
 }
Example #27
0
function backupbuddy_register_sync_verbs($api)
{
    $verbs = array('backupbuddy-run-backup' => 'Ithemes_Sync_Verb_Backupbuddy_Run_Backup', 'backupbuddy-list-profiles' => 'Ithemes_Sync_Verb_Backupbuddy_List_Profiles', 'backupbuddy-list-schedules' => 'Ithemes_Sync_Verb_Backupbuddy_List_Schedules', 'backupbuddy-get-overview' => 'Ithemes_Sync_Verb_Backupbuddy_Get_Overview');
    foreach ($verbs as $name => $class) {
        $api->register($name, $class, pb_backupbuddy::plugin_path() . "/classes/ithemes-sync/{$name}.php");
    }
    //For testing:
    /*
    require_once( pb_backupbuddy::plugin_path() . "/classes/ithemes-sync/backupbuddy-get-overview.php" );
    $apple = new Ithemes_Sync_Verb_Backupbuddy_Get_Overview;
    error_log( $apple->run( array() ), true );
    */
}
 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     if ('' == $arguments['id'] || !is_numeric($arguments['id'])) {
         return array('api' => '1', 'status' => 'error', 'message' => 'Missing destination ID setting or not numeric.');
     }
     if (!isset(pb_backupbuddy::$options['remote_destinations'][$arguments['id']])) {
         return array('api' => '1', 'status' => 'error', 'message' => 'Invalid destination ID. Not found.');
     }
     // Merge passed settings over current ones.
     pb_backupbuddy::$options['remote_destinations'][$arguments['id']] = array_merge(pb_backupbuddy::$options['remote_destinations'][$arguments['id']], $arguments['settings']);
     pb_backupbuddy::save();
     return array('api' => '1', 'status' => 'ok', 'message' => 'Destination updated.', 'destination_id' => $arguments['id']);
 }
Example #29
0
 /**
  * Factory
  *
  * @param string $method Signature method
  *
  * @return HTTP_OAuth_Signature_Common Signature instance
  */
 public static function factory($method)
 {
     $method = str_replace('-', '_', $method);
     $class = 'HTTP_OAuth_Signature_' . $method;
     $file = str_replace('_', '/', $class) . '.php';
     include_once pb_backupbuddy::plugin_path() . '/destinations/dropbox/lib/dropbuddy/pear_includes/' . $file;
     if (class_exists($class) === false) {
         throw new InvalidArgumentException('No such signature class');
     }
     $instance = new $class();
     if (!$instance instanceof HTTP_OAuth_Signature_Common) {
         throw new InvalidArgumentException('Signature class does not extend HTTP_OAuth_Signature_Common');
     }
     return $instance;
 }
Example #30
0
function backupbuddy_dbMediaSince()
{
    global $wpdb;
    $wpdb->show_errors();
    // Turn on error display.
    $mediaFiles = array();
    $sql = "select " . $wpdb->prefix . "postmeta.meta_value as file," . $wpdb->prefix . "posts.post_modified as file_modified from " . $wpdb->prefix . "postmeta," . $wpdb->prefix . "posts WHERE meta_key='_wp_attached_file' AND " . $wpdb->prefix . "postmeta.post_id = " . $wpdb->prefix . "posts.id";
    $results = $wpdb->get_results($sql, ARRAY_A);
    if (null === $results || false === $results) {
        pb_backupbuddy::status('error', 'Error #238933: Unable to calculate media with query `' . $sql . '`. Check database permissions or contact host.');
    }
    foreach ((array) $results as $result) {
        $mediaFiles[$result['file']] = array('modified' => $result['file_modified']);
    }
    unset($results);
    return $mediaFiles;
}