PluginProbe
The WP Remote WordPress Plugin / 5.93
The WP Remote WordPress Plugin v5.93
6.72 6.69 6.65 6.62 6.48 6.47 4.87 4.97 5.05 5.09 5.16 5.22 5.24 5.25 5.38 5.41 5.42 5.45 5.47 5.53 5.56 5.65 5.68 5.72 5.73 All 53 releases
← All changes | callback/request.php +19 -28 5.455.93 View file →
@@ -50,38 +50,25 @@
50 50 public function isAPICall() {
51 51 return array_key_exists('apicall', $this->params);
52 52 }
53 53
54 - public function curlRequest($url, $body) {
55 - $ch = curl_init($url);
56 - curl_setopt($ch, CURLOPT_POST, 1);
57 - curl_setopt($ch, CURLOPT_TIMEOUT, 15);
58 - curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($body));
59 - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
60 - return curl_exec($ch);
61 - }
54 + public function http_request($url, $body) {
55 + $body = http_build_query($body);
56 + $response = wp_remote_post($url, array(
57 + 'body' => $body,
58 + 'timeout' => 15,
59 + 'headers' => array(
60 + 'Content-Type' => 'application/x-www-form-urlencoded',
61 + ),
62 + ));
62 63
63 - public function fileGetContentRequest($url, $body) {
64 - $options = array(
65 - 'http' => array(
66 - 'header' => "Content-type: application/x-www-form-urlencoded\r\n",
67 - 'method' => 'POST',
68 - 'content' => http_build_query($body)
69 - )
70 - );
64 + if (is_wp_error($response)) {
65 + return false;
66 + }
71 67
72 - $context = stream_context_create($options);
73 - return file_get_contents($url, false, $context);
68 + return wp_remote_retrieve_body($response);
74 69 }
75 70
76 - public function http_request($url, $body) {
77 - if (in_array('curl', get_loaded_extensions())) {
78 - return $this->curlRequest($url, $body);
79 - } else {
80 - return $this->fileGetContentRequest($url, $body);
81 - }
82 - }
83 -
84 71 public function get_params_via_api($params_key, $apiurl) {
85 72 $res = $this->http_request($apiurl, array('bvkey' => $params_key));
86 73
87 74 if ($res === FALSE) {
@@ -185,8 +172,9 @@
185 172 }
186 173
187 174 if (array_key_exists('memset', $in_params)) {
188 175 $val = intval($in_params['memset']);
176 + // phpcs:ignore Squiz.PHP.DiscouragedFunctions.Discouraged -- Required for memory limit adjustment
189 177 @ini_set('memory_limit', $val.'M');
190 178 }
191 179
192 180 return $params;
@@ -246,14 +234,16 @@
246 234 $this->error["message"] = "OPENSSL_FUNCS_NOT_FOUND";
247 235 return false;
248 236 }
249 237
250 - $key_file = dirname( __FILE__ ) . '/../public_keys/' . $this->pubkey_name . '.pub';
238 + $key_file = dirname( __DIR__ ) . '/public_keys/' . $this->pubkey_name . '.pub';
251 239 if (!file_exists($key_file)) {
252 240 $this->error["message"] = "PUBLIC_KEY_NOT_FOUND";
253 241 return false;
254 242 }
255 - $public_key_str = file_get_contents($key_file);
243 +
244 + $public_key_str = WPRWPFileSystem::getInstance()->getContents($key_file);
245 +
256 246 $public_key = openssl_pkey_get_public($public_key_str);
257 247 if (!$public_key) {
258 248 $this->error["message"] = "UNABLE_TO_LOAD_PUBLIC_KEY";
259 249 return false;
@@ -295,8 +285,9 @@
295 285 "request_info" => $this->info(),
296 286 "bvinfo" => $bvinfo->info(),
297 287 "statusmsg" => "FAILED_AUTH",
298 288 "api_pubkey" => substr($api_public_key, 0, 8),
289 + "def_key_status" => WPRRecover::getSecretStatus($this->settings),
299 290 "def_sigmatch" => substr(hash('sha1', $this->method.$default_secret.$this->time.$this->version), 0, 8)
300 291 );
301 292
302 293 if (is_string($default_account_pubkey) && strlen($default_account_pubkey) >= 32) {