コード例 #1
0
ファイル: live.php プロジェクト: arobbins/spellestate
        break;
    }
}
// Handle disconnect.
if ('disconnect' == pb_backupbuddy::_GET('live_action') && false !== $liveDestinationID) {
    // If disconnecting and not already disconnected.
    $disconnected = false;
    require_once pb_backupbuddy::plugin_path() . '/destinations/live/live_periodic.php';
    require_once pb_backupbuddy::plugin_path() . '/destinations/stash2/class.itx_helper2.php';
    $destination_settings = backupbuddy_live_periodic::get_destination_settings();
    if ('yes' == pb_backupbuddy::_POST('disconnect')) {
        pb_backupbuddy::verify_nonce();
        // Pass itxapi_password to disconnect.
        global $wp_version;
        $password_hash = iThemes_Credentials::get_password_hash($destination_settings['itxapi_username'], pb_backupbuddy::_POST('password'));
        $access_token = ITXAPI_Helper2::get_access_token($destination_settings['itxapi_username'], $password_hash, site_url(), $wp_version);
        $settings = array('itxapi_username' => $destination_settings['itxapi_username'], 'itxapi_password' => $access_token, 'itxapi_token' => $destination_settings['itxapi_token']);
        $response = pb_backupbuddy_destination_live::stashAPI($settings, 'disconnect');
        if (!is_array($response)) {
            pb_backupbuddy::alert('Error Disconnecting: ' . $response);
        } elseif (!isset($response['success']) || '1' != $response['success']) {
            pb_backupbuddy::alert('Error #483948944. Unexpected response disconnecting: `' . print_r($response, true) . '`.');
        } else {
            $disconnected = true;
            // Clear destination settings.
            unset(pb_backupbuddy::$options['remote_destinations'][$liveDestinationID]);
            pb_backupbuddy::save();
            // Clear cached Live credentials.
            require_once pb_backupbuddy::plugin_path() . '/destinations/live/init.php';
            delete_transient(pb_backupbuddy_destination_live::LIVE_ACTION_TRANSIENT_NAME);
            pb_backupbuddy::disalert('', 'You have disconnected from Stash Live.');
コード例 #2
0
     // Form errors.
     echo $login_welcome;
     pb_backupbuddy::alert(implode('<br>', $settings_result['errors']));
     $credentials_form->display_settings('Submit');
     $pb_hide_test = true;
     $pb_hide_save = true;
     return;
 } else {
     // No form errors; process!
     $pb_hide_test = true;
     $pb_hide_save = true;
     require_once dirname(__FILE__) . '/class.itx_helper2.php';
     global $wp_version;
     $itxapi_username = strtolower($settings_result['data']['itxapi_username']);
     $password_hash = iThemes_Credentials::get_password_hash($itxapi_username, $settings_result['data']['itxapi_password_raw']);
     $access_token = ITXAPI_Helper2::get_access_token($itxapi_username, $password_hash, site_url(), $wp_version);
     $settings = array('itxapi_username' => $itxapi_username, 'itxapi_password' => $access_token);
     $response = pb_backupbuddy_destination_stash2::stashAPI($settings, 'connect');
     if (!is_array($response)) {
         // Error message.
         pb_backupbuddy::alert('Error #23333: Unexpected server response. Check your login and try again. Detailed response: `' . print_r($response, true) . '`.');
         $credentials_form->display_settings('Submit');
     } else {
         if (isset($response['error'])) {
             pb_backupbuddy::alert('Error: ' . $response['error']['message']);
             $credentials_form->display_settings('Submit');
         } else {
             if (isset($response['token'])) {
                 $itxapi_token = $response['token'];
             } else {
                 pb_backupbuddy::alert('Error #382383232: Unexpected server response. Token missing. Check your login and try again. Detailed response: `' . print_r($response, true) . '`.');
コード例 #3
0
ファイル: _configure.php プロジェクト: Offirmo/base-wordpress
            global $wp_version;
            $itxapi_username = strtolower($settings_result['data']['itxapi_username']);
            $itxapi_password = iThemes_Credentials::get_password_hash($itxapi_username, $settings_result['data']['itxapi_password_raw']);
            $itxapi_token = ITXAPI_Helper2::get_wordpress_phpass('jwooley', $itxapi_password, 'http://jordan.dev.ithemes.com', '4.1');
            //site_url(), $wp_version );
            $url_params = array('action' => 'connect', 'user' => $itxapi_username, 'wp' => $wp_version, 'site' => site_url(), 'timestamp' => time());
            $post_params = array('auth_token' => $itxapi_token);
            echo 'username: '******'passhash: ';
            echo $itxapi_password . '<br>';
            echo '<pre>';
            print_r($url_params);
            print_r($post_params);
            echo '</pre>';
            $response = ITXAPI_Helper2::remote_post($url_params, $post_params);
            if (!is_array($response)) {
                // Error message.
                die($response);
            } else {
                print_r($response);
                $credentials_form->display_settings('Submit');
            }
        }
    }
    // end form submitted.
} elseif ($mode == 'edit') {
    // EDIT MODE.
    //echo 'editmode?';
    $account_info = pb_backupbuddy_destination_stash::get_quota(array('itxapi_username' => $destination_settings['itxapi_username'], 'itxapi_password' => $destination_settings['itxapi_password']));
    $itxapi_username = $destination_settings['itxapi_username'];