PluginProbe
The WP Remote WordPress Plugin / 5.88
The WP Remote WordPress Plugin v5.88
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 | wp_actlog.php +34 -17 4.875.88 View file →
@@ -8,8 +8,11 @@
8 8 public static $actlog_table = 'activities_store';
9 9 public $db;
10 10 public $settings;
11 11 public $bvinfo;
12 + public $request_id;
13 + public $ip_header;
14 + public $ignored_events;
12 15
13 16 public function __construct($db, $settings, $info, $config) {
14 17 $this->db = $db;
15 18 $this->settings = $settings;
@@ -106,21 +109,21 @@
106 109 function get_ip($ipHeader) {
107 110 $ip = '127.0.0.1';
108 111 if ($ipHeader && is_array($ipHeader)) {
109 112 if (array_key_exists($ipHeader['hdr'], $_SERVER)) {
110 - $_ips = preg_split("/(,| |\t)/", $_SERVER[$ipHeader['hdr']]);
113 + $_ips = preg_split("/(,| |\t)/", wp_unslash($_SERVER[$ipHeader['hdr']])); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
111 114 if (array_key_exists(intval($ipHeader['pos']), $_ips)) {
112 115 $ip = $_ips[intval($ipHeader['pos'])];
113 116 }
114 117 }
115 118 } else if (array_key_exists('REMOTE_ADDR', $_SERVER)) {
116 - $ip = $_SERVER['REMOTE_ADDR'];
119 + $ip = wp_unslash(sanitize_text_field(wp_unslash($_SERVER['REMOTE_ADDR'])));
117 120 }
118 121
119 122 $ip = trim($ip);
120 - if (preg_match('/^\[([0-9a-fA-F:]+)\](:[0-9]+)$/', $ip, $matches)) {
123 + if (WPRHelper::safePregMatch('/^\[([0-9a-fA-F:]+)\](:[0-9]+)$/', $ip, $matches)) {
121 124 $ip = $matches[1];
122 - } elseif (preg_match('/^([0-9.]+)(:[0-9]+)$/', $ip, $matches)) {
125 + } elseif (WPRHelper::safePregMatch('/^([0-9.]+)(:[0-9]+)$/', $ip, $matches)) {
123 126 $ip = $matches[1];
124 127 }
125 128
126 129 return $ip;
@@ -149,9 +152,9 @@
149 152 function is_key_ignored($ignored_keys, $value) {
150 153 $is_ignored = false;
151 154 if (array_key_exists("post_types_regex", $ignored_keys)) {
152 155 foreach ($ignored_keys['post_types_regex'] as $val) {
153 - if (preg_match($val, $value)) {
156 + if (WPRHelper::safePregMatch($val, $value)) {
154 157 return true;
155 158 }
156 159 }
157 160 }
@@ -208,9 +211,11 @@
208 211 $post = $this->get_post($post_id);
209 212 if ($this->is_key_ignored($this->ignored_events, $post["type"]))
210 213 return;
211 214 $event_data = array();
212 - if ($post["type"] === "product") {
215 + if (!isset($post["type"])) {
216 + $event_data["post"] = $post;
217 + } elseif ($post["type"] === "product") {
213 218 $event_data["product"] = $post;
214 219 } elseif ($post["type"] === "shop_order") {
215 220 $event_data["order"] = $post;
216 221 } else {
@@ -223,9 +228,11 @@
223 228 $post = $this->get_post($post_id);
224 229 if ($this->is_key_ignored($this->ignored_events, $post["type"]))
225 230 return;
226 231 $event_data = array();
227 - if ($post["type"] === "product") {
232 + if (!isset($post["type"])) {
233 + $event_data["post"] = $post;
234 + } elseif ($post["type"] === "product") {
228 235 $event_data["product"] = $post;
229 236 } elseif ($post["type"] === "shop_order") {
230 237 $event_data["order"] = $post;
231 238 } else {
@@ -362,9 +369,11 @@
362 369 $data = array();
363 370 if (!empty($plugins) && defined('WP_PLUGIN_DIR')) {
364 371 foreach ($plugins as $plugin) {
365 372 $plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
366 - $install_data = array('title' => $plugin_data['Name'], 'version' => $plugin_data['Version']);
373 + $title = isset($plugin_data['Name']) ? $plugin_data['Name'] : '';
374 + $version = isset($plugin_data['Version']) ? $plugin_data['Version'] : '';
375 + $install_data = array('title' => $title, 'version' => $version);
367 376 array_push($data, $install_data);
368 377 }
369 378 }
370 379 return $data;
@@ -374,9 +383,11 @@
374 383 $data = array();
375 384 if (!empty($themes)) {
376 385 foreach ($themes as $theme) {
377 386 $theme_data = wp_get_theme($theme);
378 - $install_data = array('title' => $theme_data['Name'], 'version' => $theme_data['Version']);
387 + $title = isset($theme_data['Name']) ? $theme_data['Name'] : '';
388 + $version = isset($theme_data['Version']) ? $theme_data['Version'] : '';
389 + $install_data = array('title' => $title, 'version' => $version);
379 390 array_push($data, $install_data);
380 391 }
381 392 }
382 393 return $data;
@@ -385,9 +396,11 @@
385 396 function get_plugin_install_data($upgrader) {
386 397 $data = array();
387 398 if ($upgrader->bulk != "1") {
388 399 $plugin_data = $upgrader->new_plugin_data;
389 - $install_data = array('title' => $plugin_data['Name'], 'version' => $plugin_data['Version']);
400 + $title = isset($plugin_data['Name']) ? $plugin_data['Name'] : '';
401 + $version = isset($plugin_data['Version']) ? $plugin_data['Version'] : '';
402 + $install_data = array('title' => $title, 'version' => $version);
390 403 array_push($data, $install_data);
391 404 }
392 405 return $data;
393 406 }
@@ -394,9 +407,11 @@
394 407
395 408 function get_theme_install_data($upgrader) {
396 409 $data = array();
397 410 $theme_data = $upgrader->new_theme_data;
398 - $install_data = array('title' => $theme_data['Name'], 'version' => $theme_data['Version']);
411 + $title = isset($theme_data['Name']) ? $theme_data['Name'] : '';
412 + $version = isset($theme_data['Version']) ? $theme_data['Version'] : '';
413 + $install_data = array('title' => $title, 'version' => $version);
399 414 array_push($data, $install_data);
400 415 return $data;
401 416 }
402 417
@@ -435,15 +450,17 @@
435 450 }
436 451
437 452 function upgrade_handler($upgrader, $data) {
438 453 $event_data = array();
439 - if ($data['action'] === 'update') {
440 - if ('core' === $data['type']) {
441 - return;
454 + if (isset($data['action'])) {
455 + if ($data['action'] === 'update') {
456 + if ('core' === $data['type']) {
457 + return;
458 + }
459 + $event_data = $this->get_update_data($data);
460 + } else if ($data['action'] === 'install') {
461 + $event_data = $this->get_install_data($upgrader, $data);
442 462 }
443 - $event_data = $this->get_update_data($data);
444 - } else if ($data['action'] === 'install') {
445 - $event_data = $this->get_install_data($upgrader, $data);
446 463 }
447 464 $this->add_activity($event_data);
448 465 }
449 466