Edit File by line
/home/barbar84/www/wp-conte.../plugins/updraftp.../includes
File: updraftcentral.php
<?php
[0] Fix | Delete
[1] Fix | Delete
if (!defined('UPDRAFTPLUS_DIR')) die('No direct access allowed.');
[2] Fix | Delete
[3] Fix | Delete
if (!class_exists('UpdraftPlus_Login')) require_once('updraftplus-login.php');
[4] Fix | Delete
[5] Fix | Delete
class UpdraftPlus_UpdraftCentral_Cloud extends UpdraftPlus_Login {
[6] Fix | Delete
[7] Fix | Delete
/**
[8] Fix | Delete
* Pulls the appropriate message for the given code and translate it before
[9] Fix | Delete
* returning it to the caller
[10] Fix | Delete
*
[11] Fix | Delete
* @internal
[12] Fix | Delete
* @param string $code The code of the message to pull
[13] Fix | Delete
* @return string - The translated message
[14] Fix | Delete
*/
[15] Fix | Delete
protected function translate_message($code) {
[16] Fix | Delete
switch ($code) {
[17] Fix | Delete
case 'generic':
[18] Fix | Delete
default:
[19] Fix | Delete
return __('An error has occurred while processing your request. The server might be busy or you have lost your connection to the internet at the time of the request. Please try again later.', 'updraftplus');
[20] Fix | Delete
break;
[21] Fix | Delete
}
[22] Fix | Delete
}
[23] Fix | Delete
[24] Fix | Delete
/**
[25] Fix | Delete
* Executes login or registration process. Connects and sends request to the UpdraftCentral Cloud
[26] Fix | Delete
* and returns the response coming from the server
[27] Fix | Delete
*
[28] Fix | Delete
* @internal
[29] Fix | Delete
* @param array $data The submitted form data
[30] Fix | Delete
* @param boolean $register Indicates whether the current call is for a registration process or not. Defaults to false.
[31] Fix | Delete
* @return array - The response from the request
[32] Fix | Delete
*/
[33] Fix | Delete
protected function login_or_register($data, $register = false) {
[34] Fix | Delete
global $updraftplus, $updraftcentral_main;
[35] Fix | Delete
[36] Fix | Delete
$action = ($register) ? 'updraftcentral_cloud_register' : 'updraftcentral_cloud_login';
[37] Fix | Delete
if (empty($data['site_url'])) $data['site_url'] = trailingslashit(network_site_url());
[38] Fix | Delete
[39] Fix | Delete
$response = $this->send_remote_request($data, $action);
[40] Fix | Delete
if (is_wp_error($response)) {
[41] Fix | Delete
$response = array('error' => true, 'code' => $response->get_error_code(), 'message' => $response->get_error_message());
[42] Fix | Delete
} else {
[43] Fix | Delete
if (isset($response['status'])) {
[44] Fix | Delete
if (in_array($response['status'], array('authenticated', 'registered'))) {
[45] Fix | Delete
$response['redirect_url'] = $updraftplus->get_url('mothership').'/?udm_action=updraftcentral_cloud_redirect';
[46] Fix | Delete
[47] Fix | Delete
if (is_a($updraftcentral_main, 'UpdraftCentral_Main')) {
[48] Fix | Delete
$response['keys_table'] = $updraftcentral_main->get_keys_table();
[49] Fix | Delete
}
[50] Fix | Delete
[51] Fix | Delete
if (!empty($data['addons_options_connect']) && class_exists('UpdraftPlus_Options')) {
[52] Fix | Delete
UpdraftPlus_Options::update_updraft_option('updraftplus_com_and_udc_connection_success', 1, false);
[53] Fix | Delete
}
[54] Fix | Delete
[55] Fix | Delete
} else {
[56] Fix | Delete
if ('error' === $response['status']) {
[57] Fix | Delete
$response = array(
[58] Fix | Delete
'error' => true,
[59] Fix | Delete
'code' => isset($response['code']) ? $response['code'] : -1,
[60] Fix | Delete
'message' => isset($response['message']) ? $response['message'] : $this->translate_message('generic'),
[61] Fix | Delete
'response' => $response
[62] Fix | Delete
);
[63] Fix | Delete
}
[64] Fix | Delete
}
[65] Fix | Delete
} else {
[66] Fix | Delete
$response = array('error' => true, 'message' => $this->translate_message('generic'));
[67] Fix | Delete
}
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
return $response;
[71] Fix | Delete
}
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function