PluginProbe
The WP Remote WordPress Plugin / 4.81
The WP Remote WordPress Plugin v4.81
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 +7 -50 5.684.81 View file →
@@ -8,11 +8,8 @@
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;
15 12
16 13 public function __construct($db, $settings, $info, $config) {
17 14 $this->db = $db;
18 15 $this->settings = $settings;
@@ -18,9 +15,8 @@
18 15 $this->settings = $settings;
19 16 $this->bvinfo = $info;
20 17 $this->request_id = WPRInfo::getRequestID();
21 18 $this->ip_header = array_key_exists('ip_header', $config) ? $config['ip_header'] : false;
22 - $this->ignored_events = array_key_exists('ignored_events', $config) ? $config['ignored_events'] : array();
23 19 }
24 20
25 21 function init() {
26 22 $this->add_actions_and_listeners();
@@ -65,9 +61,8 @@
65 61 $data = array('id' => $user_id);
66 62 if (!empty($user)) {
67 63 $data['username'] = $user->user_login;
68 64 $data['email'] = $user->user_email;
69 - $data['role'] = $user->roles;
70 65 }
71 66 return $data;
72 67 }
73 68
@@ -119,11 +114,11 @@
119 114 $ip = $_SERVER['REMOTE_ADDR'];
120 115 }
121 116
122 117 $ip = trim($ip);
123 - if (WPRHelper::safePregMatch('/^\[([0-9a-fA-F:]+)\](:[0-9]+)$/', $ip, $matches)) {
118 + if (preg_match('/^\[([0-9a-fA-F:]+)\](:[0-9]+)$/', $ip, $matches)) {
124 119 $ip = $matches[1];
125 - } elseif (WPRHelper::safePregMatch('/^([0-9.]+)(:[0-9]+)$/', $ip, $matches)) {
120 + } elseif (preg_match('/^([0-9.]+)(:[0-9]+)$/', $ip, $matches)) {
126 121 $ip = $matches[1];
127 122 }
128 123
129 124 return $ip;
@@ -148,27 +143,8 @@
148 143 $values["time"] = time();
149 144 $this->db->replaceIntoBVTable(BVWPActLog::$actlog_table, $values);
150 145 }
151 146
152 - function is_key_ignored($ignored_keys, $value) {
153 - $is_ignored = false;
154 - if (array_key_exists("post_types_regex", $ignored_keys)) {
155 - foreach ($ignored_keys['post_types_regex'] as $val) {
156 - if (WPRHelper::safePregMatch($val, $value)) {
157 - return true;
158 - }
159 - }
160 - }
161 - if (array_key_exists("post_types", $ignored_keys)) {
162 - foreach ($ignored_keys['post_types'] as $val) {
163 - if ($val == $value) {
164 - return true;
165 - }
166 - }
167 - }
168 - return $is_ignored;
169 - }
170 -
171 147 function user_login_handler($user_login, $user) {
172 148 $event_data = array("user" => $this->get_user($user->ID));
173 149 $this->add_activity($event_data);
174 150 }
@@ -208,10 +184,8 @@
208 184 }
209 185
210 186 function post_handler($post_id) {
211 187 $post = $this->get_post($post_id);
212 - if ($this->is_key_ignored($this->ignored_events, $post["type"]))
213 - return;
214 188 $event_data = array();
215 189 if ($post["type"] === "product") {
216 190 $event_data["product"] = $post;
217 191 } elseif ($post["type"] === "shop_order") {
@@ -223,10 +197,8 @@
223 197 }
224 198
225 199 function post_saved_handler($post_id, $post, $update) {
226 200 $post = $this->get_post($post_id);
227 - if ($this->is_key_ignored($this->ignored_events, $post["type"]))
228 - return;
229 201 $event_data = array();
230 202 if ($post["type"] === "product") {
231 203 $event_data["product"] = $post;
232 204 } elseif ($post["type"] === "shop_order") {
@@ -403,25 +375,22 @@
403 375 return $data;
404 376 }
405 377
406 378 function get_update_data($options) {
379 + global $wp_version;
407 380 $event_data = array('action' => 'update');
408 381 if ($options['type'] === 'plugin') {
409 382 $event_data['type'] = 'plugin';
410 - if (array_key_exists("plugin", $options)) {
411 - $options['plugins'] = array($options['plugin']);
412 - unset($options['plugin']);
413 - }
414 383 $event_data['plugins'] = $this->get_plugin_update_data($options['plugins']);
415 384 }
416 385 else if ($options['type'] === 'theme') {
417 386 $event_data['type'] = 'theme';
418 - if (array_key_exists("theme", $options)) {
419 - $options['themes'] = array($options['theme']);
420 - unset($options['theme']);
421 - }
422 387 $event_data['themes'] = $this->get_theme_update_data($options['themes']);
423 388 }
389 + else if ($options['type'] === 'core') {
390 + $event_data['type'] = 'core';
391 + $event_data['wp_core'] = array('prev_version' => $wp_version);
392 + }
424 393 return $event_data;
425 394 }
426 395
427 396 function get_install_data($upgrader, $options) {
@@ -439,11 +408,8 @@
439 408
440 409 function upgrade_handler($upgrader, $data) {
441 410 $event_data = array();
442 411 if ($data['action'] === 'update') {
443 - if ('core' === $data['type']) {
444 - return;
445 - }
446 412 $event_data = $this->get_update_data($data);
447 413 } else if ($data['action'] === 'install') {
448 414 $event_data = $this->get_install_data($upgrader, $data);
449 415 }
@@ -449,16 +415,8 @@
449 415 }
450 416 $this->add_activity($event_data);
451 417 }
452 418
453 - function core_upgrade_handler($new_wp_version) {
454 - global $wp_version;
455 - $event_data = array();
456 - $event_data['type'] = 'core';
457 - $event_data['wp_core'] = array('prev_version' => $wp_version, 'new_version' => $new_wp_version);
458 - $this->add_activity($event_data);
459 - }
460 -
461 419 /* ADDING ACTION AND LISTENERS FOR SENSING EVENTS. */
462 420 public function add_actions_and_listeners() {
463 421 /* SENSORS FOR POST AND PAGE CHANGES */
464 422 add_action('pre_post_update', array($this, 'post_handler'));
@@ -504,9 +462,8 @@
504 462 add_action('password_reset', array( $this, 'password_reset_handler'), 10, 2);
505 463
506 464 /* SENSOR FOR PLUGIN, THEME, WPCORE UPGRADES */
507 465 add_action('upgrader_process_complete', array($this, 'upgrade_handler'), 10, 2);
508 - add_action('_core_updated_successfully', array($this, 'core_upgrade_handler'), 10, 1);
509 466
510 467 /* SENSORS FOR WOOCOMMERCE EVENTS */
511 468 add_action('woocommerce_attribute_added', array($this, 'woocommerce_attribute_created_handler'), 10, 2);
512 469 add_action('woocommerce_attribute_updated', array($this, 'woocommerce_attribute_handler'), 10, 1);