Merged in feature/MAW-855-import-code-into-aws (pull request #2)
code import from pantheon * code import from pantheon
This commit is contained in:
@@ -6098,7 +6098,7 @@ HTML;
|
||||
'loadTwoFactor', 'sendTestEmail',
|
||||
'email_summary_email_address_debug', 'unblockNetwork',
|
||||
'sendDiagnostic', 'saveDisclosureState', 'saveWAFConfig', 'updateWAFRules', 'loadLiveTraffic', 'whitelistWAFParamKey',
|
||||
'disableDirectoryListing', 'fixFPD', 'deleteAdminUser', 'revokeAdminUser',
|
||||
'disableDirectoryListing', 'fixFPD', 'deleteAdminUser', 'revokeAdminUser', 'acknowledgeAdminUser',
|
||||
'hideFileHtaccess', 'saveDebuggingConfig',
|
||||
'whitelistBulkDelete', 'whitelistBulkEnable', 'whitelistBulkDisable',
|
||||
'dismissNotification', 'utilityScanForBlacklisted', 'dashboardShowMore',
|
||||
@@ -7608,6 +7608,35 @@ SQL
|
||||
'user_login' => $userLogin,
|
||||
);
|
||||
}
|
||||
|
||||
public static function ajax_acknowledgeAdminUser_callback() {
|
||||
$issueID = absint(!empty($_POST['issueID']) ? $_POST['issueID'] : 0);
|
||||
$wfIssues = new wfIssues();
|
||||
$issue = $wfIssues->getIssueByID($issueID);
|
||||
if (!$issue) {
|
||||
return array('errorMsg' => __("We could not find that issue in the database.", 'wordfence'));
|
||||
}
|
||||
$data = $issue['data'];
|
||||
if (empty($data['userID'])) {
|
||||
return array('errorMsg' => __("We could not find that user in the database.", 'wordfence'));
|
||||
}
|
||||
$user = new WP_User($data['userID']);
|
||||
if (!$user->exists()) {
|
||||
return array('errorMsg' => __("We could not find that user in the database.", 'wordfence'));
|
||||
}
|
||||
$userLogin = $user->user_login;
|
||||
|
||||
$adminUsers = new wfAdminUserMonitor();
|
||||
$adminUsers->addAdmin($data['userID']);
|
||||
|
||||
$wfIssues->deleteIssue($issueID);
|
||||
wfScanEngine::refreshScanNotification($wfIssues);
|
||||
|
||||
return array(
|
||||
'ok' => 1,
|
||||
'user_login' => $userLogin,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -9464,9 +9493,23 @@ if (file_exists(__DIR__.%1$s)) {
|
||||
}
|
||||
|
||||
$request = new wfCentralAPIRequest('/site/access-token', 'GET', $authGrant);
|
||||
$response = $request->execute();
|
||||
try {
|
||||
$response = $request->execute();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
wfCentralAPIRequest::handleInternalCentralAPIError($e);
|
||||
}
|
||||
catch (Throwable $t) {
|
||||
wfCentralAPIRequest::handleInternalCentralAPIError($t);
|
||||
}
|
||||
|
||||
if ($response->isError()) {
|
||||
if (!isset($response)) {
|
||||
return array(
|
||||
'err' => 1,
|
||||
'errorMsg' => __('Internal error when connecting to Wordfence Central (see server error log)', 'wordfence'),
|
||||
);
|
||||
}
|
||||
else if ($response->isError()) {
|
||||
return $response->returnErrorArray();
|
||||
}
|
||||
|
||||
@@ -9539,9 +9582,23 @@ if (file_exists(__DIR__.%1$s)) {
|
||||
),
|
||||
),
|
||||
));
|
||||
$response = $request->execute();
|
||||
|
||||
if ($response->isError()) {
|
||||
try {
|
||||
$response = $request->execute();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
wfCentralAPIRequest::handleInternalCentralAPIError($e);
|
||||
}
|
||||
catch (Throwable $t) {
|
||||
wfCentralAPIRequest::handleInternalCentralAPIError($t);
|
||||
}
|
||||
|
||||
if (!isset($response)) {
|
||||
return array(
|
||||
'err' => 1,
|
||||
'errorMsg' => __('Internal error when connecting to Wordfence Central (see server error log)', 'wordfence'),
|
||||
);
|
||||
}
|
||||
else if ($response->isError()) {
|
||||
return $response->returnErrorArray();
|
||||
}
|
||||
|
||||
@@ -9577,12 +9634,27 @@ if (file_exists(__DIR__.%1$s)) {
|
||||
'success' => 1,
|
||||
);
|
||||
|
||||
} catch (wfCentralAPIException $e) {
|
||||
}
|
||||
catch (wfCentralAPIException $e) {
|
||||
return array(
|
||||
'error' => 1,
|
||||
'errorMsg' => $e->getMessage(),
|
||||
);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
wfCentralAPIRequest::handleInternalCentralAPIError($e);
|
||||
return array(
|
||||
'error' => 1,
|
||||
'errorMsg' => $e->getMessage(),
|
||||
);
|
||||
}
|
||||
catch (Throwable $t) {
|
||||
wfCentralAPIRequest::handleInternalCentralAPIError($t);
|
||||
return array(
|
||||
'error' => 1,
|
||||
'errorMsg' => $t->getMessage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static function ajax_wfcentral_step4_callback() {
|
||||
@@ -9647,12 +9719,27 @@ if (file_exists(__DIR__.%1$s)) {
|
||||
rawurlencode(wfConfig::get('wordfenceCentralSiteID')), rawurlencode($body['access-token'])),
|
||||
);
|
||||
|
||||
} catch (wfCentralAPIException $e) {
|
||||
}
|
||||
catch (wfCentralAPIException $e) {
|
||||
return array(
|
||||
'error' => 1,
|
||||
'errorMsg' => $e->getMessage(),
|
||||
);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
wfCentralAPIRequest::handleInternalCentralAPIError($e);
|
||||
return array(
|
||||
'error' => 1,
|
||||
'errorMsg' => $e->getMessage(),
|
||||
);
|
||||
}
|
||||
catch (Throwable $t) {
|
||||
wfCentralAPIRequest::handleInternalCentralAPIError($t);
|
||||
return array(
|
||||
'error' => 1,
|
||||
'errorMsg' => $t->getMessage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
public static function ajax_wfcentral_step6_callback() {
|
||||
$wfCentralUserSiteAccessToken = wfConfig::get('wordfenceCentralUserSiteAccessToken');
|
||||
@@ -9683,9 +9770,16 @@ if (file_exists(__DIR__.%1$s)) {
|
||||
sprintf('/site/%s', wfConfig::get('wordfenceCentralSiteID')),
|
||||
'DELETE');
|
||||
$response = $request->execute();
|
||||
} catch (wfCentralAPIException $e) {
|
||||
}
|
||||
catch (wfCentralAPIException $e) {
|
||||
|
||||
}
|
||||
catch (Exception $e) {
|
||||
wfCentralAPIRequest::handleInternalCentralAPIError($e);
|
||||
}
|
||||
catch (Throwable $t) {
|
||||
wfCentralAPIRequest::handleInternalCentralAPIError($t);
|
||||
}
|
||||
|
||||
wfRESTConfigController::disconnectConfig();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user