WP Security Audit Log - Version 3.1.0

Version Description

Download this release

Release Info

Developer WPWhiteSecurity
Plugin Icon 128x128 WP Security Audit Log
Version 3.1.0
Comparing to
See all releases

Code changes from version 3.0.1 to 3.1.0

classes/Adapters/MySQL/ActiveRecordAdapter.php CHANGED
@@ -47,12 +47,21 @@ class WSAL_Adapters_MySQL_ActiveRecord implements WSAL_Adapters_ActiveRecordInte
47
  /**
48
  * Method: Constructor.
49
  *
50
- * @param array $conn - Connection array.
51
  */
52
  public function __construct( $conn ) {
53
  $this->connection = $conn;
54
  }
55
 
 
 
 
 
 
 
 
 
 
56
  /**
57
  * Returns the model class for adapter.
58
  *
@@ -143,7 +152,25 @@ class WSAL_Adapters_MySQL_ActiveRecord implements WSAL_Adapters_ActiveRecordInte
143
  */
144
  public function Uninstall() {
145
  $_wpdb = $this->connection;
146
- $_wpdb->query( $this->_GetUninstallQuery() );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  }
148
 
149
  /**
@@ -431,14 +458,17 @@ class WSAL_Adapters_MySQL_ActiveRecord implements WSAL_Adapters_ActiveRecordInte
431
  * @param timestamp $_end_timestamp - To created_on.
432
  * @param timestamp $_next_date - (Optional) Created on >.
433
  * @param int $_limit - (Optional) Limit.
 
 
434
  * @return array Report results
435
  */
436
- public function GetReporting( $_site_id, $_user_id, $_role_name, $_alert_code, $_start_timestamp, $_end_timestamp, $_next_date = null, $_limit = 0 ) {
437
  global $wpdb;
438
  $user_names = $this->GetUserNames( $_user_id );
439
 
440
  $_wpdb = $this->connection;
441
  $_wpdb->set_charset( $_wpdb->dbh, 'utf8mb4', 'utf8mb4_general_ci' );
 
442
  // Tables.
443
  $meta = new WSAL_Adapters_MySQL_Meta( $this->connection );
444
  $table_meta = $meta->GetTable(); // Metadata.
@@ -447,40 +477,99 @@ class WSAL_Adapters_MySQL_ActiveRecord implements WSAL_Adapters_ActiveRecordInte
447
 
448
  $condition_date = ! empty( $_next_date ) ? ' AND occ.created_on < ' . $_next_date : '';
449
 
450
- $sql = "SELECT DISTINCT
451
- occ.id,
452
- occ.alert_id,
453
- occ.site_id,
454
- occ.created_on,
455
- replace(replace(replace((
456
- SELECT t1.value FROM $table_meta AS t1 WHERE t1.name = 'CurrentUserRoles' AND t1.occurrence_id = occ.id LIMIT 1), '[', ''), ']', ''), '\\'', '') AS roles,
457
- (SELECT replace(t2.value, '\"','') FROM $table_meta as t2 WHERE t2.name = 'ClientIP' AND t2.occurrence_id = occ.id LIMIT 1) AS ip,
458
- (SELECT replace(t3.value, '\"', '') FROM $table_meta as t3 WHERE t3.name = 'UserAgent' AND t3.occurrence_id = occ.id LIMIT 1) AS ua,
459
- COALESCE(
460
- (SELECT replace(t4.value, '\"', '') FROM $table_meta as t4 WHERE t4.name = 'Username' AND t4.occurrence_id = occ.id LIMIT 1),
461
- (SELECT replace(t5.value, '\"', '') FROM $table_meta as t5 WHERE t5.name = 'CurrentUserID' AND t5.occurrence_id = occ.id LIMIT 1)
462
- ) as user_id
463
- FROM $table_occ AS occ
464
- JOIN $table_meta AS meta ON meta.occurrence_id = occ.id
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
  WHERE
466
  (@siteId is NULL OR find_in_set(occ.site_id, @siteId) > 0)
467
- AND (@userId is NULL OR (
468
- (meta.name = 'CurrentUserID' AND find_in_set(meta.value, @userId) > 0)
469
- OR (meta.name = 'Username' AND replace(meta.value, '\"', '') IN ($user_names))
470
- ))
471
- AND (@roleName is NULL OR (meta.name = 'CurrentUserRoles'
472
- AND replace(replace(replace(meta.value, ']', ''), '[', ''), '\\'', '') REGEXP @roleName
473
- ))
 
 
 
 
 
 
474
  AND (@alertCode is NULL OR find_in_set(occ.alert_id, @alertCode) > 0)
475
  AND (@startTimestamp is NULL OR occ.created_on >= @startTimestamp)
476
  AND (@endTimestamp is NULL OR occ.created_on <= @endTimestamp)
 
 
 
 
 
 
 
 
 
 
477
  {$condition_date}
478
  ORDER BY
479
  created_on DESC
480
- ";
 
481
 
482
  $_wpdb->query( "SET @siteId = $_site_id" );
483
  $_wpdb->query( "SET @userId = $_user_id" );
 
 
484
  $_wpdb->query( "SET @roleName = $_role_name" );
485
  $_wpdb->query( "SET @alertCode = $_alert_code" );
486
  $_wpdb->query( "SET @startTimestamp = $_start_timestamp" );
@@ -490,6 +579,7 @@ class WSAL_Adapters_MySQL_ActiveRecord implements WSAL_Adapters_ActiveRecordInte
490
  $sql .= " LIMIT {$_limit}";
491
  }
492
  $results = $_wpdb->get_results( $sql );
 
493
  if ( ! empty( $results ) ) {
494
  foreach ( $results as $row ) {
495
  $sql = "SELECT t6.ID FROM $wpdb->users AS t6 WHERE t6.user_login = \"$row->user_id\"";
@@ -516,6 +606,8 @@ class WSAL_Adapters_MySQL_ActiveRecord implements WSAL_Adapters_ActiveRecordInte
516
  public function CheckMatchReportCriteria( $criteria ) {
517
  $_site_id = $criteria['siteId'];
518
  $_user_id = $criteria['userId'];
 
 
519
  $_role_name = $criteria['roleName'];
520
  $_alert_code = $criteria['alertCode'];
521
  $_start_timestamp = $criteria['startTimestamp'];
@@ -532,25 +624,66 @@ class WSAL_Adapters_MySQL_ActiveRecord implements WSAL_Adapters_ActiveRecordInte
532
 
533
  $user_names = $this->GetUserNames( $_user_id );
534
 
535
- $sql = "SELECT COUNT(DISTINCT occ.id) FROM $table_occ AS occ
536
- JOIN $table_meta AS meta ON meta.occurrence_id = occ.id
537
- WHERE
538
- (@siteId is NULL OR find_in_set(occ.site_id, @siteId) > 0)
539
- AND (@userId is NULL OR (
540
- (meta.name = 'CurrentUserID' AND find_in_set(meta.value, @userId) > 0)
541
- OR (meta.name = 'Username' AND replace(meta.value, '\"', '') IN ($user_names))
542
- ))
543
- AND (@roleName is NULL OR (meta.name = 'CurrentUserRoles'
544
- AND replace(replace(replace(meta.value, ']', ''), '[', ''), '\\'', '') REGEXP @roleName
545
- ))
546
- AND (@alertCode is NULL OR find_in_set(occ.alert_id, @alertCode) > 0)
547
- AND (@startTimestamp is NULL OR occ.created_on >= @startTimestamp)
548
- AND (@endTimestamp is NULL OR occ.created_on <= @endTimestamp)
549
- AND (@ipAddress is NULL OR (meta.name = 'ClientIP' AND find_in_set(meta.value, @ipAddress) > 0))
550
- ";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
551
 
552
  $_wpdb->query( "SET @siteId = $_site_id" );
553
  $_wpdb->query( "SET @userId = $_user_id" );
 
 
554
  $_wpdb->query( "SET @roleName = $_role_name" );
555
  $_wpdb->query( "SET @alertCode = $_alert_code" );
556
  $_wpdb->query( "SET @startTimestamp = $_start_timestamp" );
47
  /**
48
  * Method: Constructor.
49
  *
50
+ * @param object $conn - DB connection object.
51
  */
52
  public function __construct( $conn ) {
53
  $this->connection = $conn;
54
  }
55
 
56
+ /**
57
+ * Method: Get connection.
58
+ *
59
+ * @return object – DB connection object.
60
+ */
61
+ public function get_connection() {
62
+ return $this->connection;
63
+ }
64
+
65
  /**
66
  * Returns the model class for adapter.
67
  *
152
  */
153
  public function Uninstall() {
154
  $_wpdb = $this->connection;
155
+
156
+ // Check if table exists.
157
+ if ( $this->table_exists() ) {
158
+ $_wpdb->query( $this->_GetUninstallQuery() );
159
+ }
160
+ }
161
+
162
+ /**
163
+ * Check if table exists.
164
+ *
165
+ * @return bool – True if exists, false if not.
166
+ */
167
+ public function table_exists() {
168
+ $_wpdb = $this->connection;
169
+
170
+ // Query table exists.
171
+ $table_exists_query = 'SHOW TABLES LIKE "' . $this->GetTable() . '"';
172
+ $result = $_wpdb->query( $table_exists_query );
173
+ return $result;
174
  }
175
 
176
  /**
458
  * @param timestamp $_end_timestamp - To created_on.
459
  * @param timestamp $_next_date - (Optional) Created on >.
460
  * @param int $_limit - (Optional) Limit.
461
+ * @param string $_post_types - (Optional) Post types.
462
+ * @param string $_post_statuses - (Optional) Post statuses.
463
  * @return array Report results
464
  */
465
+ public function GetReporting( $_site_id, $_user_id, $_role_name, $_alert_code, $_start_timestamp, $_end_timestamp, $_next_date = null, $_limit = 0, $_post_types = '', $_post_statuses = '' ) {
466
  global $wpdb;
467
  $user_names = $this->GetUserNames( $_user_id );
468
 
469
  $_wpdb = $this->connection;
470
  $_wpdb->set_charset( $_wpdb->dbh, 'utf8mb4', 'utf8mb4_general_ci' );
471
+
472
  // Tables.
473
  $meta = new WSAL_Adapters_MySQL_Meta( $this->connection );
474
  $table_meta = $meta->GetTable(); // Metadata.
477
 
478
  $condition_date = ! empty( $_next_date ) ? ' AND occ.created_on < ' . $_next_date : '';
479
 
480
+ if ( 'null' === $_post_types && 'null' === $_post_statuses ) {
481
+ $sql = "SELECT DISTINCT
482
+ occ.id,
483
+ occ.alert_id,
484
+ occ.site_id,
485
+ occ.created_on,
486
+ replace(replace(replace((SELECT t1.value FROM $table_meta AS t1 WHERE t1.name = 'CurrentUserRoles' AND t1.occurrence_id = occ.id LIMIT 1), '[', ''), ']', ''), '\\'', '') AS roles,
487
+ (SELECT replace(t2.value, '\"','') FROM $table_meta as t2 WHERE t2.name = 'ClientIP' AND t2.occurrence_id = occ.id LIMIT 1) AS ip,
488
+ (SELECT replace(t3.value, '\"', '') FROM $table_meta as t3 WHERE t3.name = 'UserAgent' AND t3.occurrence_id = occ.id LIMIT 1) AS ua,
489
+ COALESCE(
490
+ (SELECT replace(t4.value, '\"', '') FROM $table_meta as t4 WHERE t4.name = 'Username' AND t4.occurrence_id = occ.id LIMIT 1),
491
+ (SELECT replace(t5.value, '\"', '') FROM $table_meta as t5 WHERE t5.name = 'CurrentUserID' AND t5.occurrence_id = occ.id LIMIT 1)
492
+ ) as user_id
493
+ FROM $table_occ AS occ
494
+ JOIN $table_meta AS meta ON meta.occurrence_id = occ.id
495
+ WHERE
496
+ (@siteId is NULL OR find_in_set(occ.site_id, @siteId) > 0)
497
+ AND (
498
+ @userId is NULL
499
+ OR (
500
+ (meta.name = 'CurrentUserID' AND find_in_set(meta.value, @userId) > 0)
501
+ OR
502
+ (meta.name = 'Username' AND replace(meta.value, '\"', '') IN ($user_names))
503
+ )
504
+ )
505
+ AND (
506
+ @roleName is NULL
507
+ OR (
508
+ meta.name = 'CurrentUserRoles'
509
+ AND
510
+ replace(replace(replace(meta.value, ']', ''), '[', ''), '\\'', '') REGEXP @roleName
511
+ )
512
+ )
513
+ AND (@alertCode is NULL OR find_in_set(occ.alert_id, @alertCode) > 0)
514
+ AND (@startTimestamp is NULL OR occ.created_on >= @startTimestamp)
515
+ AND (@endTimestamp is NULL OR occ.created_on <= @endTimestamp)
516
+ {$condition_date}
517
+ ORDER BY
518
+ created_on DESC
519
+ ";
520
+ } else {
521
+ $sql = "SELECT
522
+ occ.id,
523
+ occ.alert_id,
524
+ occ.site_id,
525
+ occ.created_on,
526
+ replace(replace(replace((SELECT t1.value FROM $table_meta AS t1 WHERE t1.name = 'CurrentUserRoles' AND t1.occurrence_id = occ.id LIMIT 1), '[', ''), ']', ''), '\\'', '') AS roles,
527
+ (SELECT replace(t2.value, '\"','') FROM $table_meta as t2 WHERE t2.name = 'ClientIP' AND t2.occurrence_id = occ.id LIMIT 1) AS ip,
528
+ (SELECT replace(t3.value, '\"', '') FROM $table_meta as t3 WHERE t3.name = 'UserAgent' AND t3.occurrence_id = occ.id LIMIT 1) AS ua,
529
+ COALESCE(
530
+ (SELECT replace(t4.value, '\"', '') FROM $table_meta as t4 WHERE t4.name = 'Username' AND t4.occurrence_id = occ.id LIMIT 1),
531
+ (SELECT replace(t5.value, '\"', '') FROM $table_meta as t5 WHERE t5.name = 'CurrentUserID' AND t5.occurrence_id = occ.id LIMIT 1)
532
+ ) as user_id
533
+ FROM
534
+ $table_occ as occ
535
  WHERE
536
  (@siteId is NULL OR find_in_set(occ.site_id, @siteId) > 0)
537
+ AND (
538
+ @userId is NULL
539
+ OR (
540
+ EXISTS(SELECT 1 FROM $table_meta as meta WHERE meta.occurrence_id = occ.id AND meta.name='CurrentUserID' AND find_in_set(meta.value, @userId) > 0)
541
+ OR
542
+ EXISTS(SELECT 1 FROM $table_meta as meta WHERE meta.occurrence_id = occ.id AND meta.name='Username' AND replace(meta.value, '\"', '') IN ($user_names))
543
+ )
544
+ )
545
+ AND (
546
+ @roleName is NULL
547
+ OR
548
+ EXISTS(SELECT 1 FROM $table_meta as meta WHERE meta.occurrence_id = occ.id AND meta.name='CurrentUserRoles' AND replace(replace(replace(meta.value, ']', ''), '[', ''), '\\'', '') REGEXP @roleName)
549
+ )
550
  AND (@alertCode is NULL OR find_in_set(occ.alert_id, @alertCode) > 0)
551
  AND (@startTimestamp is NULL OR occ.created_on >= @startTimestamp)
552
  AND (@endTimestamp is NULL OR occ.created_on <= @endTimestamp)
553
+ AND (
554
+ @postType is NULL
555
+ OR
556
+ EXISTS(SELECT 1 FROM $table_meta as meta WHERE meta.occurrence_id = occ.id AND meta.name='PostType' AND find_in_set(meta.value, @postType) > 0)
557
+ )
558
+ AND (
559
+ @postStatus is NULL
560
+ OR
561
+ EXISTS(SELECT 1 FROM $table_meta as meta WHERE meta.occurrence_id = occ.id AND meta.name='PostStatus' AND find_in_set(meta.value, @postStatus) > 0)
562
+ )
563
  {$condition_date}
564
  ORDER BY
565
  created_on DESC
566
+ ";
567
+ }
568
 
569
  $_wpdb->query( "SET @siteId = $_site_id" );
570
  $_wpdb->query( "SET @userId = $_user_id" );
571
+ $_wpdb->query( "SET @postType = $_post_types" );
572
+ $_wpdb->query( "SET @postStatus = $_post_statuses" );
573
  $_wpdb->query( "SET @roleName = $_role_name" );
574
  $_wpdb->query( "SET @alertCode = $_alert_code" );
575
  $_wpdb->query( "SET @startTimestamp = $_start_timestamp" );
579
  $sql .= " LIMIT {$_limit}";
580
  }
581
  $results = $_wpdb->get_results( $sql );
582
+
583
  if ( ! empty( $results ) ) {
584
  foreach ( $results as $row ) {
585
  $sql = "SELECT t6.ID FROM $wpdb->users AS t6 WHERE t6.user_login = \"$row->user_id\"";
606
  public function CheckMatchReportCriteria( $criteria ) {
607
  $_site_id = $criteria['siteId'];
608
  $_user_id = $criteria['userId'];
609
+ $_post_types = $criteria['post_types'];
610
+ $_post_statuses = $criteria['post_statuses'];
611
  $_role_name = $criteria['roleName'];
612
  $_alert_code = $criteria['alertCode'];
613
  $_start_timestamp = $criteria['startTimestamp'];
624
 
625
  $user_names = $this->GetUserNames( $_user_id );
626
 
627
+ if ( 'null' === $_post_types && 'null' === $_post_statuses ) {
628
+ $sql = "SELECT COUNT(DISTINCT occ.id) FROM $table_occ AS occ
629
+ JOIN $table_meta AS meta ON meta.occurrence_id = occ.id
630
+ WHERE
631
+ (@siteId is NULL OR find_in_set(occ.site_id, @siteId) > 0)
632
+ AND (@userId is NULL OR (
633
+ (meta.name = 'CurrentUserID' AND find_in_set(meta.value, @userId) > 0)
634
+ OR (meta.name = 'Username' AND replace(meta.value, '\"', '') IN ($user_names))
635
+ ))
636
+ AND (@roleName is NULL OR (meta.name = 'CurrentUserRoles'
637
+ AND replace(replace(replace(meta.value, ']', ''), '[', ''), '\\'', '') REGEXP @roleName
638
+ ))
639
+ AND (@alertCode is NULL OR find_in_set(occ.alert_id, @alertCode) > 0)
640
+ AND (@startTimestamp is NULL OR occ.created_on >= @startTimestamp)
641
+ AND (@endTimestamp is NULL OR occ.created_on <= @endTimestamp)
642
+ AND (@ipAddress is NULL OR (meta.name = 'ClientIP' AND find_in_set(meta.value, @ipAddress) > 0))
643
+ ";
644
+ } else {
645
+ $sql = "SELECT COUNT(DISTINCT occ.id)
646
+ FROM $table_occ AS occ
647
+ WHERE
648
+ (@siteId is NULL OR find_in_set(occ.site_id, @siteId) > 0)
649
+ AND (
650
+ @userId is NULL
651
+ OR (
652
+ EXISTS(SELECT 1 FROM $table_meta as meta WHERE meta.occurrence_id = occ.id AND meta.name='CurrentUserID' AND find_in_set(meta.value, @userId) > 0)
653
+ OR
654
+ EXISTS(SELECT 1 FROM $table_meta as meta WHERE meta.occurrence_id = occ.id AND meta.name='Username' AND replace(meta.value, '\"', '') IN ($user_names))
655
+ )
656
+ )
657
+ AND (
658
+ @roleName is NULL
659
+ OR
660
+ EXISTS(SELECT 1 FROM $table_meta as meta WHERE meta.occurrence_id = occ.id AND meta.name='CurrentUserRoles' AND replace(replace(replace(meta.value, ']', ''), '[', ''), '\\'', '') REGEXP @roleName)
661
+ )
662
+ AND (@alertCode is NULL OR find_in_set(occ.alert_id, @alertCode) > 0)
663
+ AND (@startTimestamp is NULL OR occ.created_on >= @startTimestamp)
664
+ AND (@endTimestamp is NULL OR occ.created_on <= @endTimestamp)
665
+ AND (
666
+ @ipAddress is NULL
667
+ OR
668
+ EXISTS(SELECT 1 FROM $table_meta as meta WHERE meta.occurrence_id = occ.id AND meta.name='ClientIP' AND find_in_set(meta.value, @ipAddress) > 0)
669
+ )
670
+ AND (
671
+ @postType is NULL
672
+ OR
673
+ EXISTS(SELECT 1 FROM $table_meta as meta WHERE meta.occurrence_id = occ.id AND meta.name='PostType' AND find_in_set(meta.value, @postType) > 0)
674
+ )
675
+ AND (
676
+ @postStatus is NULL
677
+ OR
678
+ EXISTS(SELECT 1 FROM $table_meta as meta WHERE meta.occurrence_id = occ.id AND meta.name='PostStatus' AND find_in_set(meta.value, @postStatus) > 0)
679
+ )
680
+ ";
681
+ }
682
 
683
  $_wpdb->query( "SET @siteId = $_site_id" );
684
  $_wpdb->query( "SET @userId = $_user_id" );
685
+ $_wpdb->query( "SET @postType = $_post_types" );
686
+ $_wpdb->query( "SET @postStatus = $_post_statuses" );
687
  $_wpdb->query( "SET @roleName = $_role_name" );
688
  $_wpdb->query( "SET @alertCode = $_alert_code" );
689
  $_wpdb->query( "SET @startTimestamp = $_start_timestamp" );
classes/AuditLogListView.php CHANGED
@@ -218,7 +218,7 @@ class WSAL_AuditLogListView extends WP_List_Table {
218
  }
219
  $cols = array(
220
  'type' => __( 'Alert ID', 'wp-security-audit-log' ),
221
- 'code' => __( 'Type', 'wp-security-audit-log' ),
222
  'crtd' => __( 'Date', 'wp-security-audit-log' ),
223
  'user' => $name_column,
224
  'scip' => __( 'Source IP', 'wp-security-audit-log' ),
@@ -237,7 +237,7 @@ class WSAL_AuditLogListView extends WP_List_Table {
237
  $cols['type'] = __( 'Alert ID', 'wp-security-audit-log' );
238
  break;
239
  case 'type':
240
- $cols['code'] = __( 'Type', 'wp-security-audit-log' );
241
  break;
242
  case 'date':
243
  $cols['crtd'] = __( 'Date', 'wp-security-audit-log' );
@@ -351,13 +351,16 @@ class WSAL_AuditLogListView extends WP_List_Table {
351
  )
352
  ) : '<i>unknown</i>';
353
  case 'user':
354
- $username = $item->GetUsername();
355
- $type_name = $this->_plugin->settings->get_type_username();
356
- if ( $username && ( $user = get_user_by( 'login', $username ) ) ) {
 
 
 
357
  $image = get_avatar( $user->ID, 32 );
358
- if ( 'display_name' == $type_name ) {
359
  $display_name = $user->first_name . ' ' . $user->last_name;
360
- } elseif ( 'username' == $type_name ) {
361
  $display_name = $user->user_login;
362
  }
363
 
@@ -516,7 +519,12 @@ class WSAL_AuditLogListView extends WP_List_Table {
516
  }
517
 
518
  case '%RevisionLink%' == $name:
519
- return ' Click <a target="_blank" href="' . esc_url( $value ) . '">here</a> to see the content changes.';
 
 
 
 
 
520
 
521
  case '%EditorLinkPost%' == $name:
522
  return ' <a target="_blank" href="' . esc_url( $value ) . '">View the post</a>';
@@ -569,6 +577,13 @@ class WSAL_AuditLogListView extends WP_List_Table {
569
  case strncmp( $value, 'https://', 7 ) === 0:
570
  return '<a href="' . esc_html( $value ) . '" title="' . esc_html( $value ) . '" target="_blank">' . esc_html( $value ) . '</a>';
571
 
 
 
 
 
 
 
 
572
  default:
573
  return '<strong>' . esc_html( $value ) . '</strong>';
574
  }
218
  }
219
  $cols = array(
220
  'type' => __( 'Alert ID', 'wp-security-audit-log' ),
221
+ 'code' => __( 'Severity', 'wp-security-audit-log' ),
222
  'crtd' => __( 'Date', 'wp-security-audit-log' ),
223
  'user' => $name_column,
224
  'scip' => __( 'Source IP', 'wp-security-audit-log' ),
237
  $cols['type'] = __( 'Alert ID', 'wp-security-audit-log' );
238
  break;
239
  case 'type':
240
+ $cols['code'] = __( 'Severity', 'wp-security-audit-log' );
241
  break;
242
  case 'date':
243
  $cols['crtd'] = __( 'Date', 'wp-security-audit-log' );
351
  )
352
  ) : '<i>unknown</i>';
353
  case 'user':
354
+ $username = $item->GetUsername(); // Get username.
355
+ $type_name = $this->_plugin->settings->get_type_username(); // Get the data to display.
356
+ $user = get_user_by( 'login', $username ); // Get user.
357
+
358
+ // Check if the username and user exists.
359
+ if ( $username && $user ) {
360
  $image = get_avatar( $user->ID, 32 );
361
+ if ( 'display_name' === $type_name && ! empty( $user->first_name ) ) {
362
  $display_name = $user->first_name . ' ' . $user->last_name;
363
+ } else {
364
  $display_name = $user->user_login;
365
  }
366
 
519
  }
520
 
521
  case '%RevisionLink%' == $name:
522
+ $check_value = (string) $value;
523
+ if ( 'NULL' !== $check_value ) {
524
+ return ' Click <a target="_blank" href="' . esc_url( $value ) . '">here</a> to see the content changes.';
525
+ } else {
526
+ return false;
527
+ }
528
 
529
  case '%EditorLinkPost%' == $name:
530
  return ' <a target="_blank" href="' . esc_url( $value ) . '">View the post</a>';
577
  case strncmp( $value, 'https://', 7 ) === 0:
578
  return '<a href="' . esc_html( $value ) . '" title="' . esc_html( $value ) . '" target="_blank">' . esc_html( $value ) . '</a>';
579
 
580
+ case '%PostStatus%' === $name:
581
+ if ( ! empty( $value ) && 'publish' === $value ) {
582
+ return '<strong>' . esc_html__( 'published', 'wp-security-audit-log' ) . '</strong>';
583
+ } else {
584
+ return '<strong>' . esc_html( $value ) . '</strong>';
585
+ }
586
+
587
  default:
588
  return '<strong>' . esc_html( $value ) . '</strong>';
589
  }
classes/Loggers/Database.php CHANGED
@@ -60,11 +60,6 @@ class WSAL_Loggers_Database extends WSAL_AbstractLogger {
60
 
61
  // Set up meta data.
62
  $occ->SetMeta( $data );
63
-
64
- // Inject for promoting the paid add-ons.
65
- if ( 9999 != $type ) {
66
- $this->AlertInject( $occ );
67
- }
68
  }
69
 
70
  /**
@@ -128,6 +123,7 @@ class WSAL_Loggers_Database extends WSAL_AbstractLogger {
128
  * Inject Promo alert every $count alerts if no Add-ons are activated.
129
  *
130
  * @param object $occurrence - Occurrence, instance of WSAL_Models_Occurrence.
 
131
  */
132
  private function AlertInject( $occurrence ) {
133
  $count = $this->CheckPromoToShow();
@@ -165,6 +161,7 @@ class WSAL_Loggers_Database extends WSAL_AbstractLogger {
165
  * keeping the last id saved in the DB.
166
  *
167
  * @return integer $promoToSend - The array index.
 
168
  */
169
  private function GetPromoAlert() {
170
  $last_promo_sent_id = $this->plugin->GetGlobalOption( 'promo-send-id' );
@@ -188,6 +185,7 @@ class WSAL_Loggers_Database extends WSAL_AbstractLogger {
188
  * Array of promo.
189
  *
190
  * @return array $promo_alerts - The array of promo.
 
191
  */
192
  private function GetActivePromoText() {
193
  $promo_alerts = array();
@@ -206,6 +204,7 @@ class WSAL_Loggers_Database extends WSAL_AbstractLogger {
206
  * Check condition to show promo.
207
  *
208
  * @return integer|null - Counter alert.
 
209
  */
210
  private function CheckPromoToShow() {
211
  // If the package is free, show the promo.
60
 
61
  // Set up meta data.
62
  $occ->SetMeta( $data );
 
 
 
 
 
63
  }
64
 
65
  /**
123
  * Inject Promo alert every $count alerts if no Add-ons are activated.
124
  *
125
  * @param object $occurrence - Occurrence, instance of WSAL_Models_Occurrence.
126
+ * @deprecated 3.1.0
127
  */
128
  private function AlertInject( $occurrence ) {
129
  $count = $this->CheckPromoToShow();
161
  * keeping the last id saved in the DB.
162
  *
163
  * @return integer $promoToSend - The array index.
164
+ * @deprecated 3.1.0
165
  */
166
  private function GetPromoAlert() {
167
  $last_promo_sent_id = $this->plugin->GetGlobalOption( 'promo-send-id' );
185
  * Array of promo.
186
  *
187
  * @return array $promo_alerts - The array of promo.
188
+ * @deprecated 3.1.0
189
  */
190
  private function GetActivePromoText() {
191
  $promo_alerts = array();
204
  * Check condition to show promo.
205
  *
206
  * @return integer|null - Counter alert.
207
+ * @deprecated 3.1.0
208
  */
209
  private function CheckPromoToShow() {
210
  // If the package is free, show the promo.
classes/Sensors/Content.php CHANGED
@@ -224,6 +224,8 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
224
  2125, array(
225
  'tag' => $new_name,
226
  'TagLink' => $term_link,
 
 
227
  )
228
  );
229
  }
@@ -492,13 +494,13 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
492
  $is_scheduled = false;
493
  switch ( $new_post->post_status ) {
494
  case 'publish':
495
- $event = $this->GetEventTypeForPostType( $new_post, 2001, 2005, 2030 );
496
  break;
497
  case 'draft':
498
- $event = $this->GetEventTypeForPostType( $new_post, 2000, 2004, 2029 );
499
  break;
500
  case 'future':
501
- $event = $this->GetEventTypeForPostType( $new_post, 2074, 2075, 2076 );
502
  $is_scheduled = true;
503
  break;
504
  case 'pending':
@@ -516,6 +518,7 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
516
  'PostStatus' => $new_post->post_status,
517
  'PostDate' => $new_post->post_date,
518
  'PublishingDate' => $new_post->post_date,
 
519
  $editor_link['name'] => $editor_link['value'],
520
  )
521
  );
@@ -544,22 +547,18 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
544
  */
545
  public function EventPublishFuture( $post_id ) {
546
  $post = get_post( $post_id );
547
- $event = $this->GetEventTypeForPostType( $post, 2001, 2005, 2030 );
548
-
549
- if ( $event ) {
550
- $editor_link = $this->GetEditorLink( $post );
551
- $this->plugin->alerts->Trigger(
552
- $event, array(
553
- 'PostID' => $post->ID,
554
- 'PostType' => $post->post_type,
555
- 'PostTitle' => $post->post_title,
556
- 'PostStatus' => $post->post_status,
557
- 'PostDate' => $post->post_date,
558
- 'PostUrl' => get_permalink( $post->ID ),
559
- $editor_link['name'] => $editor_link['value'],
560
- )
561
- );
562
- }
563
  }
564
 
565
  /**
@@ -588,7 +587,7 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
588
  $wp_actions = array( 'delete' );
589
  if ( isset( $get_array['action'] ) && in_array( $get_array['action'], $wp_actions ) ) {
590
  if ( ! in_array( $post->post_type, array( 'attachment', 'revision', 'nav_menu_item' ) ) ) { // Ignore attachments, revisions and menu items.
591
- $event = $this->GetEventTypeForPostType( $post, 2008, 2009, 2033 );
592
  // Check WordPress backend operations.
593
  if ( $this->CheckAutoDraft( $event, $post->post_title ) ) {
594
  return;
@@ -601,6 +600,7 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
601
  'PostTitle' => $post->post_title,
602
  'PostStatus' => $post->post_status,
603
  'PostDate' => $post->post_date,
 
604
  )
605
  );
606
  }
@@ -618,10 +618,9 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
618
  if ( $this->CheckOtherSensors( $post ) ) {
619
  return;
620
  }
621
- $event = $this->GetEventTypeForPostType( $post, 2012, 2013, 2034 );
622
  $editor_link = $this->GetEditorLink( $post );
623
  $this->plugin->alerts->Trigger(
624
- $event, array(
625
  'PostID' => $post->ID,
626
  'PostType' => $post->post_type,
627
  'PostTitle' => $post->post_title,
@@ -643,15 +642,15 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
643
  if ( $this->CheckOtherSensors( $post ) ) {
644
  return;
645
  }
646
- $event = $this->GetEventTypeForPostType( $post, 2014, 2015, 2035 );
647
  $editor_link = $this->GetEditorLink( $post );
648
  $this->plugin->alerts->Trigger(
649
- $event, array(
650
  'PostID' => $post->ID,
651
  'PostType' => $post->post_type,
652
  'PostTitle' => $post->post_title,
653
  'PostStatus' => $post->post_status,
654
  'PostDate' => $post->post_date,
 
655
  $editor_link['name'] => $editor_link['value'],
656
  )
657
  );
@@ -666,23 +665,21 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
666
  protected function CheckDateChange( $oldpost, $newpost ) {
667
  $from = strtotime( $oldpost->post_date );
668
  $to = strtotime( $newpost->post_date );
 
669
  if ( 'draft' == $oldpost->post_status ) {
670
  return 0;
671
  }
672
- $pending = $this->CheckReviewPendingChange( $oldpost, $newpost );
673
- if ( $pending ) {
674
- return 0;
675
- }
676
  if ( $from != $to ) {
677
- $event = $this->GetEventTypeForPostType( $oldpost, 2027, 2028, 2041 );
678
  $editor_link = $this->GetEditorLink( $oldpost );
679
  $this->plugin->alerts->Trigger(
680
- $event, array(
681
  'PostID' => $oldpost->ID,
682
  'PostType' => $oldpost->post_type,
683
  'PostTitle' => $oldpost->post_title,
684
  'PostStatus' => $oldpost->post_status,
685
  'PostDate' => $newpost->post_date,
 
686
  'OldDate' => $oldpost->post_date,
687
  'NewDate' => $newpost->post_date,
688
  $editor_link['name'] => $editor_link['value'],
@@ -693,30 +690,6 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
693
  return 0;
694
  }
695
 
696
- /**
697
- * Revision used.
698
- *
699
- * @param stdClass $oldpost - Old post.
700
- * @param stdClass $newpost - New post.
701
- */
702
- protected function CheckReviewPendingChange( $oldpost, $newpost ) {
703
- if ( 'pending' == $oldpost->post_status ) {
704
- $editor_link = $this->GetEditorLink( $oldpost );
705
- $this->plugin->alerts->Trigger(
706
- 2072, array(
707
- 'PostID' => $oldpost->ID,
708
- 'PostType' => $oldpost->post_type,
709
- 'PostTitle' => $oldpost->post_title,
710
- 'PostStatus' => $oldpost->post_status,
711
- 'PostDate' => $oldpost->post_date,
712
- $editor_link['name'] => $editor_link['value'],
713
- )
714
- );
715
- return 1;
716
- }
717
- return 0;
718
- }
719
-
720
  /**
721
  * Categories changed.
722
  *
@@ -728,7 +701,7 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
728
  $old_cats = implode( ', ', $old_cats );
729
  $new_cats = implode( ', ', $new_cats );
730
  if ( $old_cats != $new_cats ) {
731
- $event = $this->GetEventTypeForPostType( $post, 2016, 0, 2036 );
732
  if ( $event ) {
733
  $editor_link = $this->GetEditorLink( $post );
734
  $this->plugin->alerts->Trigger(
@@ -738,6 +711,7 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
738
  'PostTitle' => $post->post_title,
739
  'PostStatus' => $post->post_status,
740
  'PostDate' => $post->post_date,
 
741
  'OldCategories' => $old_cats ? $old_cats : 'no categories',
742
  'NewCategories' => $new_cats ? $new_cats : 'no categories',
743
  $editor_link['name'] => $editor_link['value'],
@@ -772,41 +746,39 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
772
  $add_event = '';
773
  $remove_event = '';
774
  if ( $old_tags !== $new_tags && ! empty( $added_tags ) ) {
775
- $add_event = $this->GetEventTypeForPostType( $post, 2119, 0, 0 );
776
- if ( $add_event ) {
777
- $editor_link = $this->GetEditorLink( $post );
778
- $post_status = ( 'publish' === $post->post_status ) ? 'published' : $post->post_status;
779
- $this->plugin->alerts->Trigger(
780
- $add_event, array(
781
- 'PostID' => $post->ID,
782
- 'PostStatus' => $post_status,
783
- 'PostTitle' => $post->post_title,
784
- 'PostType' => $post->post_type,
785
- 'PostDate' => $post->post_date,
786
- 'tag' => $added_tags ? $added_tags : 'no tags',
787
- $editor_link['name'] => $editor_link['value'],
788
- )
789
- );
790
- }
791
  }
792
 
793
  if ( $old_tags !== $new_tags && ! empty( $removed_tags ) ) {
794
- $remove_event = $this->GetEventTypeForPostType( $post, 2120, 0, 0 );
795
- if ( $remove_event ) {
796
- $editor_link = $this->GetEditorLink( $post );
797
- $post_status = ( 'publish' === $post->post_status ) ? 'published' : $post->post_status;
798
- $this->plugin->alerts->Trigger(
799
- $remove_event, array(
800
- 'PostID' => $post->ID,
801
- 'PostStatus' => $post_status,
802
- 'PostTitle' => $post->post_title,
803
- 'PostType' => $post->post_type,
804
- 'PostDate' => $post->post_date,
805
- 'tag' => $removed_tags ? $removed_tags : 'no tags',
806
- $editor_link['name'] => $editor_link['value'],
807
- )
808
- );
809
- }
810
  }
811
 
812
  if ( $add_event || $remove_event ) {
@@ -822,19 +794,19 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
822
  */
823
  protected function CheckAuthorChange( $oldpost, $newpost ) {
824
  if ( $oldpost->post_author != $newpost->post_author ) {
825
- $event = $this->GetEventTypeForPostType( $oldpost, 2019, 2020, 2038 );
826
  $editor_link = $this->GetEditorLink( $oldpost );
827
  $old_author = get_userdata( $oldpost->post_author );
828
  $old_author = (is_object( $old_author )) ? $old_author->user_login : 'N/A';
829
  $new_author = get_userdata( $newpost->post_author );
830
  $new_author = (is_object( $new_author )) ? $new_author->user_login : 'N/A';
831
  $this->plugin->alerts->Trigger(
832
- $event, array(
833
  'PostID' => $oldpost->ID,
834
  'PostType' => $oldpost->post_type,
835
  'PostTitle' => $oldpost->post_title,
836
  'PostStatus' => $oldpost->post_status,
837
  'PostDate' => $oldpost->post_date,
 
838
  'OldAuthor' => $old_author,
839
  'NewAuthor' => $new_author,
840
  $editor_link['name'] => $editor_link['value'],
@@ -867,10 +839,9 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
867
  if ( $oldpost->post_status != $newpost->post_status ) {
868
  if ( isset( $post_array['publish'] ) ) {
869
  // Special case (publishing a post).
870
- $event = $this->GetEventTypeForPostType( $oldpost, 2001, 2005, 2030 );
871
  $editor_link = $this->GetEditorLink( $newpost );
872
  $this->plugin->alerts->Trigger(
873
- $event, array(
874
  'PostID' => $newpost->ID,
875
  'PostType' => $newpost->post_type,
876
  'PostTitle' => $newpost->post_title,
@@ -881,15 +852,15 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
881
  )
882
  );
883
  } else {
884
- $event = $this->GetEventTypeForPostType( $oldpost, 2021, 2022, 2039 );
885
  $editor_link = $this->GetEditorLink( $oldpost );
886
  $this->plugin->alerts->Trigger(
887
- $event, array(
888
  'PostID' => $oldpost->ID,
889
  'PostType' => $oldpost->post_type,
890
  'PostTitle' => $oldpost->post_title,
891
  'PostStatus' => $newpost->post_status,
892
  'PostDate' => $oldpost->post_date,
 
893
  'OldStatus' => $oldpost->post_status,
894
  'NewStatus' => $newpost->post_status,
895
  $editor_link['name'] => $editor_link['value'],
@@ -939,10 +910,9 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
939
  */
940
  protected function CheckPermalinkChange( $old_link, $new_link, $post ) {
941
  if ( $old_link != $new_link ) {
942
- $event = $this->GetEventTypeForPostType( $post, 2017, 2018, 2037 );
943
  $editor_link = $this->GetEditorLink( $post );
944
  $this->plugin->alerts->Trigger(
945
- $event, array(
946
  'PostID' => $post->ID,
947
  'PostType' => $post->post_type,
948
  'PostTitle' => $post->post_title,
@@ -991,15 +961,15 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
991
  }
992
 
993
  if ( $old_visibility && $new_visibility && ($old_visibility != $new_visibility) ) {
994
- $event = $this->GetEventTypeForPostType( $oldpost, 2025, 2026, 2040 );
995
  $editor_link = $this->GetEditorLink( $oldpost );
996
  $this->plugin->alerts->Trigger(
997
- $event, array(
998
  'PostID' => $oldpost->ID,
999
  'PostType' => $oldpost->post_type,
1000
  'PostTitle' => $oldpost->post_title,
1001
  'PostStatus' => $newpost->post_status,
1002
  'PostDate' => $oldpost->post_date,
 
1003
  'OldVisibility' => $old_visibility,
1004
  'NewVisibility' => $new_visibility,
1005
  $editor_link['name'] => $editor_link['value'],
@@ -1083,22 +1053,12 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
1083
 
1084
  if ( $oldpost->post_modified != $newpost->post_modified ) {
1085
  $event = 0;
1086
- // @see http://codex.wordpress.org/Class_Reference/WP_Query#Status_Parameters
1087
- switch ( $oldpost->post_status ) { // TODO or should this be $newpost?
1088
- case 'draft':
1089
- if ( $content_changed ) {
1090
- $event = $this->GetEventTypeForPostType( $newpost, 2068, 2069, 2070 );
1091
- } else {
1092
- $event = $this->GetEventTypeForPostType( $newpost, 2003, 2007, 2032 );
1093
- }
1094
- break;
1095
- case 'publish':
1096
- if ( $content_changed ) {
1097
- $event = $this->GetEventTypeForPostType( $newpost, 2065, 2066, 2067 );
1098
- } else {
1099
- $event = $this->GetEventTypeForPostType( $newpost, 2002, 2006, 2031 );
1100
- }
1101
- break;
1102
  }
1103
  if ( $event ) {
1104
  $editor_link = $this->GetEditorLink( $oldpost );
@@ -1206,11 +1166,13 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
1206
 
1207
  foreach ( $category_ids as $category_id ) {
1208
  $category = get_category( $category_id );
 
1209
  $this->plugin->alerts->Trigger(
1210
  2024, array(
1211
  'CategoryID' => $category_id,
1212
  'CategoryName' => $category->cat_name,
1213
  'Slug' => $category->slug,
 
1214
  )
1215
  );
1216
  }
@@ -1465,15 +1427,16 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
1465
  return;
1466
  }
1467
  if ( ! empty( $post->post_title ) ) {
1468
- $event = $this->GetEventTypeForPostType( $post, 2101, 2103, 2105 );
1469
  $this->plugin->alerts->Trigger(
1470
- $event, array(
1471
- 'PostID' => $post->ID,
1472
  'PostType' => $post->post_type,
1473
  'PostTitle' => $post->post_title,
1474
  'PostStatus' => $post->post_status,
1475
  'PostDate' => $post->post_date,
1476
  'PostUrl' => get_permalink( $post->ID ),
 
1477
  )
1478
  );
1479
  }
@@ -1496,14 +1459,14 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
1496
  // Filter $_SERVER array for security.
1497
  $server_array = filter_input_array( INPUT_SERVER );
1498
 
1499
- $current_path = $server_array['SCRIPT_NAME'] . '?post=' . $post->ID;
1500
  if ( ! empty( $server_array['HTTP_REFERER'] )
1501
  && strpos( $server_array['HTTP_REFERER'], $current_path ) !== false ) {
1502
  // Ignore this if we were on the same page so we avoid double audit entries.
1503
  return $post;
1504
  }
1505
  if ( ! empty( $post->post_title ) ) {
1506
- $event = $this->GetEventTypeForPostType( $post, 2100, 2102, 2104 );
1507
  if ( ! $this->WasTriggered( $event ) ) {
1508
  $editor_link = $this->GetEditorLink( $post );
1509
  $this->plugin->alerts->Trigger(
@@ -1513,6 +1476,7 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
1513
  'PostTitle' => $post->post_title,
1514
  'PostStatus' => $post->post_status,
1515
  'PostDate' => $post->post_date,
 
1516
  $editor_link['name'] => $editor_link['value'],
1517
  )
1518
  );
@@ -1550,15 +1514,15 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
1550
  */
1551
  private function CheckTitleChange( $oldpost, $newpost ) {
1552
  if ( $oldpost->post_title != $newpost->post_title ) {
1553
- $event = $this->GetEventTypeForPostType( $newpost, 2086, 2087, 2088 );
1554
  $editor_link = $this->GetEditorLink( $oldpost );
1555
  $this->plugin->alerts->Trigger(
1556
- $event, array(
1557
- 'PostID' => $oldpost->ID,
 
1558
  'PostTitle' => $newpost->post_title,
1559
- 'PostType' => $oldpost->post_type,
1560
- 'PostStatus' => $oldpost->post_status,
1561
- 'PostDate' => $oldpost->post_date,
1562
  'OldTitle' => $oldpost->post_title,
1563
  'NewTitle' => $newpost->post_title,
1564
  $editor_link['name'] => $editor_link['value'],
@@ -1595,7 +1559,9 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
1595
  'PostStatus' => $newpost->post_status,
1596
  'PostDate' => $newpost->post_date,
1597
  'PostTitle' => $newpost->post_title,
 
1598
  'PostUrl' => get_permalink( $newpost->ID ),
 
1599
  )
1600
  );
1601
  $result = 1;
@@ -1615,10 +1581,11 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
1615
  'Type' => $type,
1616
  'PostID' => $newpost->ID,
1617
  'PostType' => $newpost->post_type,
 
1618
  'PostStatus' => $newpost->post_status,
1619
  'PostDate' => $newpost->post_date,
1620
- 'PostTitle' => $newpost->post_title,
1621
  'PostUrl' => get_permalink( $newpost->ID ),
 
1622
  )
1623
  );
1624
  $result = 1;
@@ -1633,34 +1600,10 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
1633
  * @param string $status - The status.
1634
  */
1635
  private function GetCommentsPingsEvent( $post, $status ) {
1636
- if ( 'post' == $post->post_type ) {
1637
- if ( 'publish' == $post->post_status ) {
1638
- if ( 'disable' == $status ) {
1639
- $event = 2111;
1640
- } else {
1641
- $event = 2112;
1642
- }
1643
- } else {
1644
- if ( 'disable' == $status ) {
1645
- $event = 2113;
1646
- } else {
1647
- $event = 2114;
1648
- }
1649
- }
1650
  } else {
1651
- if ( 'publish' == $post->post_status ) {
1652
- if ( 'disable' == $status ) {
1653
- $event = 2115;
1654
- } else {
1655
- $event = 2116;
1656
- }
1657
- } else {
1658
- if ( 'disable' == $status ) {
1659
- $event = 2117;
1660
- } else {
1661
- $event = 2118;
1662
- }
1663
- }
1664
  }
1665
  return $event;
1666
  }
@@ -1672,8 +1615,8 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
1672
  * @return array $editor_link - Name and value link.
1673
  */
1674
  private function GetEditorLink( $post ) {
1675
- $name = 'EditorLink';
1676
- $name .= ( 'page' == $post->post_type ) ? 'Page' : 'Post' ;
1677
  $value = get_edit_post_link( $post->ID );
1678
  $editor_link = array(
1679
  'name' => $name,
224
  2125, array(
225
  'tag' => $new_name,
226
  'TagLink' => $term_link,
227
+ 'old_desc' => $old_desc,
228
+ 'new_desc' => $new_desc,
229
  )
230
  );
231
  }
494
  $is_scheduled = false;
495
  switch ( $new_post->post_status ) {
496
  case 'publish':
497
+ $event = 2001;
498
  break;
499
  case 'draft':
500
+ $event = 2000;
501
  break;
502
  case 'future':
503
+ $event = 2074;
504
  $is_scheduled = true;
505
  break;
506
  case 'pending':
518
  'PostStatus' => $new_post->post_status,
519
  'PostDate' => $new_post->post_date,
520
  'PublishingDate' => $new_post->post_date,
521
+ 'PostUrl' => get_permalink( $new_post->ID ),
522
  $editor_link['name'] => $editor_link['value'],
523
  )
524
  );
547
  */
548
  public function EventPublishFuture( $post_id ) {
549
  $post = get_post( $post_id );
550
+ $editor_link = $this->GetEditorLink( $post );
551
+ $this->plugin->alerts->Trigger(
552
+ 2001, array(
553
+ 'PostID' => $post->ID,
554
+ 'PostType' => $post->post_type,
555
+ 'PostTitle' => $post->post_title,
556
+ 'PostStatus' => $post->post_status,
557
+ 'PostDate' => $post->post_date,
558
+ 'PostUrl' => get_permalink( $post->ID ),
559
+ $editor_link['name'] => $editor_link['value'],
560
+ )
561
+ );
 
 
 
 
562
  }
563
 
564
  /**
587
  $wp_actions = array( 'delete' );
588
  if ( isset( $get_array['action'] ) && in_array( $get_array['action'], $wp_actions ) ) {
589
  if ( ! in_array( $post->post_type, array( 'attachment', 'revision', 'nav_menu_item' ) ) ) { // Ignore attachments, revisions and menu items.
590
+ $event = 2008;
591
  // Check WordPress backend operations.
592
  if ( $this->CheckAutoDraft( $event, $post->post_title ) ) {
593
  return;
600
  'PostTitle' => $post->post_title,
601
  'PostStatus' => $post->post_status,
602
  'PostDate' => $post->post_date,
603
+ 'PostUrl' => get_permalink( $post->ID ),
604
  )
605
  );
606
  }
618
  if ( $this->CheckOtherSensors( $post ) ) {
619
  return;
620
  }
 
621
  $editor_link = $this->GetEditorLink( $post );
622
  $this->plugin->alerts->Trigger(
623
+ 2012, array(
624
  'PostID' => $post->ID,
625
  'PostType' => $post->post_type,
626
  'PostTitle' => $post->post_title,
642
  if ( $this->CheckOtherSensors( $post ) ) {
643
  return;
644
  }
 
645
  $editor_link = $this->GetEditorLink( $post );
646
  $this->plugin->alerts->Trigger(
647
+ 2014, array(
648
  'PostID' => $post->ID,
649
  'PostType' => $post->post_type,
650
  'PostTitle' => $post->post_title,
651
  'PostStatus' => $post->post_status,
652
  'PostDate' => $post->post_date,
653
+ 'PostUrl' => get_permalink( $post->ID ),
654
  $editor_link['name'] => $editor_link['value'],
655
  )
656
  );
665
  protected function CheckDateChange( $oldpost, $newpost ) {
666
  $from = strtotime( $oldpost->post_date );
667
  $to = strtotime( $newpost->post_date );
668
+
669
  if ( 'draft' == $oldpost->post_status ) {
670
  return 0;
671
  }
672
+
 
 
 
673
  if ( $from != $to ) {
 
674
  $editor_link = $this->GetEditorLink( $oldpost );
675
  $this->plugin->alerts->Trigger(
676
+ 2027, array(
677
  'PostID' => $oldpost->ID,
678
  'PostType' => $oldpost->post_type,
679
  'PostTitle' => $oldpost->post_title,
680
  'PostStatus' => $oldpost->post_status,
681
  'PostDate' => $newpost->post_date,
682
+ 'PostUrl' => get_permalink( $oldpost->ID ),
683
  'OldDate' => $oldpost->post_date,
684
  'NewDate' => $newpost->post_date,
685
  $editor_link['name'] => $editor_link['value'],
690
  return 0;
691
  }
692
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
693
  /**
694
  * Categories changed.
695
  *
701
  $old_cats = implode( ', ', $old_cats );
702
  $new_cats = implode( ', ', $new_cats );
703
  if ( $old_cats != $new_cats ) {
704
+ $event = $this->GetEventTypeForPostType( $post, 2016, 0, 2016 );
705
  if ( $event ) {
706
  $editor_link = $this->GetEditorLink( $post );
707
  $this->plugin->alerts->Trigger(
711
  'PostTitle' => $post->post_title,
712
  'PostStatus' => $post->post_status,
713
  'PostDate' => $post->post_date,
714
+ 'PostUrl' => get_permalink( $post->ID ),
715
  'OldCategories' => $old_cats ? $old_cats : 'no categories',
716
  'NewCategories' => $new_cats ? $new_cats : 'no categories',
717
  $editor_link['name'] => $editor_link['value'],
746
  $add_event = '';
747
  $remove_event = '';
748
  if ( $old_tags !== $new_tags && ! empty( $added_tags ) ) {
749
+ $add_event = 2119;
750
+ $editor_link = $this->GetEditorLink( $post );
751
+ $post_status = ( 'publish' === $post->post_status ) ? 'published' : $post->post_status;
752
+ $this->plugin->alerts->Trigger(
753
+ $add_event, array(
754
+ 'PostID' => $post->ID,
755
+ 'PostType' => $post->post_type,
756
+ 'PostStatus' => $post_status,
757
+ 'PostTitle' => $post->post_title,
758
+ 'PostDate' => $post->post_date,
759
+ 'PostUrl' => get_permalink( $post->ID ),
760
+ 'tag' => $added_tags ? $added_tags : 'no tags',
761
+ $editor_link['name'] => $editor_link['value'],
762
+ )
763
+ );
 
764
  }
765
 
766
  if ( $old_tags !== $new_tags && ! empty( $removed_tags ) ) {
767
+ $remove_event = 2120;
768
+ $editor_link = $this->GetEditorLink( $post );
769
+ $post_status = ( 'publish' === $post->post_status ) ? 'published' : $post->post_status;
770
+ $this->plugin->alerts->Trigger(
771
+ $remove_event, array(
772
+ 'PostID' => $post->ID,
773
+ 'PostType' => $post->post_type,
774
+ 'PostStatus' => $post_status,
775
+ 'PostTitle' => $post->post_title,
776
+ 'PostDate' => $post->post_date,
777
+ 'PostUrl' => get_permalink( $post->ID ),
778
+ 'tag' => $removed_tags ? $removed_tags : 'no tags',
779
+ $editor_link['name'] => $editor_link['value'],
780
+ )
781
+ );
 
782
  }
783
 
784
  if ( $add_event || $remove_event ) {
794
  */
795
  protected function CheckAuthorChange( $oldpost, $newpost ) {
796
  if ( $oldpost->post_author != $newpost->post_author ) {
 
797
  $editor_link = $this->GetEditorLink( $oldpost );
798
  $old_author = get_userdata( $oldpost->post_author );
799
  $old_author = (is_object( $old_author )) ? $old_author->user_login : 'N/A';
800
  $new_author = get_userdata( $newpost->post_author );
801
  $new_author = (is_object( $new_author )) ? $new_author->user_login : 'N/A';
802
  $this->plugin->alerts->Trigger(
803
+ 2019, array(
804
  'PostID' => $oldpost->ID,
805
  'PostType' => $oldpost->post_type,
806
  'PostTitle' => $oldpost->post_title,
807
  'PostStatus' => $oldpost->post_status,
808
  'PostDate' => $oldpost->post_date,
809
+ 'PostUrl' => get_permalink( $oldpost->ID ),
810
  'OldAuthor' => $old_author,
811
  'NewAuthor' => $new_author,
812
  $editor_link['name'] => $editor_link['value'],
839
  if ( $oldpost->post_status != $newpost->post_status ) {
840
  if ( isset( $post_array['publish'] ) ) {
841
  // Special case (publishing a post).
 
842
  $editor_link = $this->GetEditorLink( $newpost );
843
  $this->plugin->alerts->Trigger(
844
+ 2001, array(
845
  'PostID' => $newpost->ID,
846
  'PostType' => $newpost->post_type,
847
  'PostTitle' => $newpost->post_title,
852
  )
853
  );
854
  } else {
 
855
  $editor_link = $this->GetEditorLink( $oldpost );
856
  $this->plugin->alerts->Trigger(
857
+ 2021, array(
858
  'PostID' => $oldpost->ID,
859
  'PostType' => $oldpost->post_type,
860
  'PostTitle' => $oldpost->post_title,
861
  'PostStatus' => $newpost->post_status,
862
  'PostDate' => $oldpost->post_date,
863
+ 'PostUrl' => get_permalink( $oldpost->ID ),
864
  'OldStatus' => $oldpost->post_status,
865
  'NewStatus' => $newpost->post_status,
866
  $editor_link['name'] => $editor_link['value'],
910
  */
911
  protected function CheckPermalinkChange( $old_link, $new_link, $post ) {
912
  if ( $old_link != $new_link ) {
 
913
  $editor_link = $this->GetEditorLink( $post );
914
  $this->plugin->alerts->Trigger(
915
+ 2017, array(
916
  'PostID' => $post->ID,
917
  'PostType' => $post->post_type,
918
  'PostTitle' => $post->post_title,
961
  }
962
 
963
  if ( $old_visibility && $new_visibility && ($old_visibility != $new_visibility) ) {
 
964
  $editor_link = $this->GetEditorLink( $oldpost );
965
  $this->plugin->alerts->Trigger(
966
+ 2025, array(
967
  'PostID' => $oldpost->ID,
968
  'PostType' => $oldpost->post_type,
969
  'PostTitle' => $oldpost->post_title,
970
  'PostStatus' => $newpost->post_status,
971
  'PostDate' => $oldpost->post_date,
972
+ 'PostUrl' => get_permalink( $oldpost->ID ),
973
  'OldVisibility' => $old_visibility,
974
  'NewVisibility' => $new_visibility,
975
  $editor_link['name'] => $editor_link['value'],
1053
 
1054
  if ( $oldpost->post_modified != $newpost->post_modified ) {
1055
  $event = 0;
1056
+
1057
+ // Check if content changed.
1058
+ if ( $content_changed ) {
1059
+ $event = 2065;
1060
+ } else {
1061
+ $event = 2002;
 
 
 
 
 
 
 
 
 
 
1062
  }
1063
  if ( $event ) {
1064
  $editor_link = $this->GetEditorLink( $oldpost );
1166
 
1167
  foreach ( $category_ids as $category_id ) {
1168
  $category = get_category( $category_id );
1169
+ $category_link = $this->getCategoryLink( $category_id );
1170
  $this->plugin->alerts->Trigger(
1171
  2024, array(
1172
  'CategoryID' => $category_id,
1173
  'CategoryName' => $category->cat_name,
1174
  'Slug' => $category->slug,
1175
+ 'CategoryLink' => $category_link,
1176
  )
1177
  );
1178
  }
1427
  return;
1428
  }
1429
  if ( ! empty( $post->post_title ) ) {
1430
+ $editor_link = $this->GetEditorLink( $post );
1431
  $this->plugin->alerts->Trigger(
1432
+ 2101, array(
1433
+ 'PostID' => $post->ID,
1434
  'PostType' => $post->post_type,
1435
  'PostTitle' => $post->post_title,
1436
  'PostStatus' => $post->post_status,
1437
  'PostDate' => $post->post_date,
1438
  'PostUrl' => get_permalink( $post->ID ),
1439
+ $editor_link['name'] => $editor_link['value'],
1440
  )
1441
  );
1442
  }
1459
  // Filter $_SERVER array for security.
1460
  $server_array = filter_input_array( INPUT_SERVER );
1461
 
1462
+ $current_path = isset( $server_array['SCRIPT_NAME'] ) ? $server_array['SCRIPT_NAME'] . '?post=' . $post->ID : false;
1463
  if ( ! empty( $server_array['HTTP_REFERER'] )
1464
  && strpos( $server_array['HTTP_REFERER'], $current_path ) !== false ) {
1465
  // Ignore this if we were on the same page so we avoid double audit entries.
1466
  return $post;
1467
  }
1468
  if ( ! empty( $post->post_title ) ) {
1469
+ $event = 2100;
1470
  if ( ! $this->WasTriggered( $event ) ) {
1471
  $editor_link = $this->GetEditorLink( $post );
1472
  $this->plugin->alerts->Trigger(
1476
  'PostTitle' => $post->post_title,
1477
  'PostStatus' => $post->post_status,
1478
  'PostDate' => $post->post_date,
1479
+ 'PostUrl' => get_permalink( $post->ID ),
1480
  $editor_link['name'] => $editor_link['value'],
1481
  )
1482
  );
1514
  */
1515
  private function CheckTitleChange( $oldpost, $newpost ) {
1516
  if ( $oldpost->post_title != $newpost->post_title ) {
 
1517
  $editor_link = $this->GetEditorLink( $oldpost );
1518
  $this->plugin->alerts->Trigger(
1519
+ 2086, array(
1520
+ 'PostID' => $newpost->ID,
1521
+ 'PostType' => $newpost->post_type,
1522
  'PostTitle' => $newpost->post_title,
1523
+ 'PostStatus' => $newpost->post_status,
1524
+ 'PostDate' => $newpost->post_date,
1525
+ 'PostUrl' => get_permalink( $newpost->ID ),
1526
  'OldTitle' => $oldpost->post_title,
1527
  'NewTitle' => $newpost->post_title,
1528
  $editor_link['name'] => $editor_link['value'],
1559
  'PostStatus' => $newpost->post_status,
1560
  'PostDate' => $newpost->post_date,
1561
  'PostTitle' => $newpost->post_title,
1562
+ 'PostStatus' => $newpost->post_status,
1563
  'PostUrl' => get_permalink( $newpost->ID ),
1564
+ $editor_link['name'] => $editor_link['value'],
1565
  )
1566
  );
1567
  $result = 1;
1581
  'Type' => $type,
1582
  'PostID' => $newpost->ID,
1583
  'PostType' => $newpost->post_type,
1584
+ 'PostTitle' => $newpost->post_title,
1585
  'PostStatus' => $newpost->post_status,
1586
  'PostDate' => $newpost->post_date,
 
1587
  'PostUrl' => get_permalink( $newpost->ID ),
1588
+ $editor_link['name'] => $editor_link['value'],
1589
  )
1590
  );
1591
  $result = 1;
1600
  * @param string $status - The status.
1601
  */
1602
  private function GetCommentsPingsEvent( $post, $status ) {
1603
+ if ( 'disable' == $status ) {
1604
+ $event = 2111;
 
 
 
 
 
 
 
 
 
 
 
 
1605
  } else {
1606
+ $event = 2112;
 
 
 
 
 
 
 
 
 
 
 
 
1607
  }
1608
  return $event;
1609
  }
1615
  * @return array $editor_link - Name and value link.
1616
  */
1617
  private function GetEditorLink( $post ) {
1618
+ $name = 'EditorLinkPost';
1619
+ // $name .= ( 'page' == $post->post_type ) ? 'Page' : 'Post' ;
1620
  $value = get_edit_post_link( $post->ID );
1621
  $editor_link = array(
1622
  'name' => $name,
classes/Sensors/Database.php CHANGED
@@ -58,7 +58,7 @@ class WSAL_Sensors_Database extends WSAL_AbstractSensor {
58
  // Filter $_SERVER array for security.
59
  $server_array = filter_input_array( INPUT_SERVER );
60
 
61
- $actype = basename( $server_array['SCRIPT_NAME'], '.php' );
62
  $alert_options = $this->GetActionType( $actype );
63
  }
64
 
@@ -109,7 +109,7 @@ class WSAL_Sensors_Database extends WSAL_AbstractSensor {
109
  // Filter $_SERVER array for security.
110
  $server_array = filter_input_array( INPUT_SERVER );
111
 
112
- $actype = basename( $server_array['SCRIPT_NAME'], '.php' );
113
  $alert_options = $this->GetActionType( $actype );
114
 
115
  foreach ( $type_queries as $query_type => $table_names ) {
58
  // Filter $_SERVER array for security.
59
  $server_array = filter_input_array( INPUT_SERVER );
60
 
61
+ $actype = ( isset( $server_array['SCRIPT_NAME'] ) ) ? basename( $server_array['SCRIPT_NAME'], '.php' ) : false;
62
  $alert_options = $this->GetActionType( $actype );
63
  }
64
 
109
  // Filter $_SERVER array for security.
110
  $server_array = filter_input_array( INPUT_SERVER );
111
 
112
+ $actype = ( isset( $server_array['SCRIPT_NAME'] ) ) ? basename( $server_array['SCRIPT_NAME'], '.php' ) : false;
113
  $alert_options = $this->GetActionType( $actype );
114
 
115
  foreach ( $type_queries as $query_type => $table_names ) {
classes/Sensors/Files.php CHANGED
@@ -101,8 +101,9 @@ class WSAL_Sensors_Files extends WSAL_AbstractSensor {
101
  $server_array = filter_input_array( INPUT_SERVER );
102
 
103
  $action = isset( $post_array['action'] ) ? $post_array['action'] : '';
104
- $is_theme_editor = 'theme-editor.php' == basename( $server_array['SCRIPT_NAME'] );
105
- $is_plugin_editor = 'plugin-editor.php' == basename( $server_array['SCRIPT_NAME'] );
 
106
 
107
  if ( $is_theme_editor && 'update' === $action ) {
108
  $this->plugin->alerts->Trigger(
101
  $server_array = filter_input_array( INPUT_SERVER );
102
 
103
  $action = isset( $post_array['action'] ) ? $post_array['action'] : '';
104
+ $script_name = isset( $server_array['SCRIPT_NAME'] ) ? basename( $server_array['SCRIPT_NAME'] ) : false;
105
+ $is_theme_editor = 'theme-editor.php' == $script_name;
106
+ $is_plugin_editor = 'plugin-editor.php' == $script_name;
107
 
108
  if ( $is_theme_editor && 'update' === $action ) {
109
  $this->plugin->alerts->Trigger(
classes/Sensors/LogInOut.php CHANGED
@@ -204,7 +204,7 @@ class WSAL_Sensors_LogInOut extends WSAL_AbstractSensor {
204
  // Filter $_POST global array for security.
205
  $post_array = filter_input_array( INPUT_POST );
206
 
207
- $username = array_key_exists( 'log', $post_array ) ? $post_array['log'] : $username;
208
  $username = sanitize_user( $username );
209
  $new_alert_code = 1003;
210
  $user = get_user_by( 'login', $username );
204
  // Filter $_POST global array for security.
205
  $post_array = filter_input_array( INPUT_POST );
206
 
207
+ $username = isset( $post_array['log'] ) ? $post_array['log'] : $username;
208
  $username = sanitize_user( $username );
209
  $new_alert_code = 1003;
210
  $user = get_user_by( 'login', $username );
classes/Sensors/MetaData.php CHANGED
@@ -161,45 +161,20 @@ class WSAL_Sensors_MetaData extends WSAL_AbstractSensor {
161
 
162
  if ( isset( $post_array['action'] ) && ( 'editpost' == $post_array['action'] || in_array( $post_array['action'], $wp_action ) ) ) {
163
  $editor_link = $this->GetEditorLink( $post );
164
- switch ( $post->post_type ) {
165
- case 'page':
166
- $this->plugin->alerts->Trigger(
167
- 2059, array(
168
- 'PostID' => $object_id,
169
- 'PostTitle' => $post->post_title,
170
- 'MetaKey' => $meta_key,
171
- 'MetaValue' => $meta_value,
172
- 'MetaLink' => $meta_key,
173
- $editor_link['name'] => $editor_link['value'],
174
- )
175
- );
176
- break;
177
- case 'post':
178
- $this->plugin->alerts->Trigger(
179
- 2053, array(
180
- 'PostID' => $object_id,
181
- 'PostTitle' => $post->post_title,
182
- 'MetaKey' => $meta_key,
183
- 'MetaValue' => $meta_value,
184
- 'MetaLink' => $meta_key,
185
- $editor_link['name'] => $editor_link['value'],
186
- )
187
- );
188
- break;
189
- default:
190
- $this->plugin->alerts->Trigger(
191
- 2056, array(
192
- 'PostID' => $object_id,
193
- 'PostTitle' => $post->post_title,
194
- 'PostType' => $post->post_type,
195
- 'MetaKey' => $meta_key,
196
- 'MetaValue' => $meta_value,
197
- 'MetaLink' => $meta_key,
198
- $editor_link['name'] => $editor_link['value'],
199
- )
200
- );
201
- break;
202
- }
203
  }
204
  }
205
 
@@ -253,97 +228,39 @@ class WSAL_Sensors_MetaData extends WSAL_AbstractSensor {
253
  if ( isset( $this->old_meta[ $meta_id ] ) ) {
254
  // Check change in meta key.
255
  if ( $this->old_meta[ $meta_id ]->key != $meta_key ) {
256
- switch ( $post->post_type ) {
257
- case 'page':
258
- $this->plugin->alerts->Trigger(
259
- 2064, array(
260
- 'PostID' => $object_id,
261
- 'PostTitle' => $post->post_title,
262
- 'MetaID' => $meta_id,
263
- 'MetaKeyNew' => $meta_key,
264
- 'MetaKeyOld' => $this->old_meta[ $meta_id ]->key,
265
- 'MetaValue' => $meta_value,
266
- 'MetaLink' => $meta_key,
267
- $editor_link['name'] => $editor_link['value'],
268
- )
269
- );
270
- break;
271
- case 'post':
272
- $this->plugin->alerts->Trigger(
273
- 2062, array(
274
- 'PostID' => $object_id,
275
- 'PostTitle' => $post->post_title,
276
- 'MetaID' => $meta_id,
277
- 'MetaKeyNew' => $meta_key,
278
- 'MetaKeyOld' => $this->old_meta[ $meta_id ]->key,
279
- 'MetaValue' => $meta_value,
280
- 'MetaLink' => $meta_key,
281
- $editor_link['name'] => $editor_link['value'],
282
- )
283
- );
284
- break;
285
- default:
286
- $this->plugin->alerts->Trigger(
287
- 2063, array(
288
- 'PostID' => $object_id,
289
- 'PostTitle' => $post->post_title,
290
- 'PostType' => $post->post_type,
291
- 'MetaID' => $meta_id,
292
- 'MetaKeyNew' => $meta_key,
293
- 'MetaKeyOld' => $this->old_meta[ $meta_id ]->key,
294
- 'MetaValue' => $meta_value,
295
- 'MetaLink' => $smeta_key,
296
- $editor_link['name'] => $editor_link['value'],
297
- )
298
- );
299
- break;
300
- }
301
  } elseif ( $this->old_meta[ $meta_id ]->val != $meta_value ) { // Check change in meta value.
302
- switch ( $post->post_type ) {
303
- case 'page':
304
- $this->plugin->alerts->Trigger(
305
- 2060, array(
306
- 'PostID' => $object_id,
307
- 'PostTitle' => $post->post_title,
308
- 'MetaID' => $meta_id,
309
- 'MetaKey' => $meta_key,
310
- 'MetaValueNew' => $meta_value,
311
- 'MetaValueOld' => $this->old_meta[ $meta_id ]->val,
312
- 'MetaLink' => $meta_key,
313
- $editor_link['name'] => $editor_link['value'],
314
- )
315
- );
316
- break;
317
- case 'post':
318
- $this->plugin->alerts->Trigger(
319
- 2054, array(
320
- 'PostID' => $object_id,
321
- 'PostTitle' => $post->post_title,
322
- 'MetaID' => $meta_id,
323
- 'MetaKey' => $meta_key,
324
- 'MetaValueNew' => $meta_value,
325
- 'MetaValueOld' => $this->old_meta[ $meta_id ]->val,
326
- 'MetaLink' => $meta_key,
327
- $editor_link['name'] => $editor_link['value'],
328
- )
329
- );
330
- break;
331
- default:
332
- $this->plugin->alerts->Trigger(
333
- 2057, array(
334
- 'PostID' => $object_id,
335
- 'PostTitle' => $post->post_title,
336
- 'PostType' => $post->post_type,
337
- 'MetaID' => $meta_id,
338
- 'MetaKey' => $meta_key,
339
- 'MetaValueNew' => $meta_value,
340
- 'MetaValueOld' => $this->old_meta[ $meta_id ]->val,
341
- 'MetaLink' => $meta_key,
342
- $editor_link['name'] => $editor_link['value'],
343
- )
344
- );
345
- break;
346
- }
347
  }
348
  // Remove old meta update data.
349
  unset( $this->old_meta[ $meta_id ] );
@@ -386,45 +303,20 @@ class WSAL_Sensors_MetaData extends WSAL_AbstractSensor {
386
  if ( ! $this->CanLogMetaKey( $object_id, $meta_key ) ) {
387
  continue;
388
  }
389
- switch ( $post->post_type ) {
390
- case 'page':
391
- $this->plugin->alerts->Trigger(
392
- 2061, array(
393
- 'PostID' => $object_id,
394
- 'PostTitle' => $post->post_title,
395
- 'MetaID' => $meta_id,
396
- 'MetaKey' => $meta_key,
397
- 'MetaValue' => $meta_value,
398
- $editor_link['name'] => $editor_link['value'],
399
- )
400
- );
401
- break;
402
- case 'post':
403
- $this->plugin->alerts->Trigger(
404
- 2055, array(
405
- 'PostID' => $object_id,
406
- 'PostTitle' => $post->post_title,
407
- 'MetaID' => $meta_id,
408
- 'MetaKey' => $meta_key,
409
- 'MetaValue' => $meta_value,
410
- $editor_link['name'] => $editor_link['value'],
411
- )
412
- );
413
- break;
414
- default:
415
- $this->plugin->alerts->Trigger(
416
- 2058, array(
417
- 'PostID' => $object_id,
418
- 'PostTitle' => $post->post_title,
419
- 'PostType' => $post->post_type,
420
- 'MetaID' => $meta_id,
421
- 'MetaKey' => $meta_key,
422
- 'MetaValue' => $meta_value,
423
- $editor_link['name'] => $editor_link['value'],
424
- )
425
- );
426
- break;
427
- }
428
  }
429
  }
430
  }
161
 
162
  if ( isset( $post_array['action'] ) && ( 'editpost' == $post_array['action'] || in_array( $post_array['action'], $wp_action ) ) ) {
163
  $editor_link = $this->GetEditorLink( $post );
164
+ $this->plugin->alerts->Trigger(
165
+ 2053, array(
166
+ 'PostID' => $object_id,
167
+ 'PostTitle' => $post->post_title,
168
+ 'PostStatus' => $post->post_status,
169
+ 'PostType' => $post->post_type,
170
+ 'PostDate' => $post->post_date,
171
+ 'PostUrl' => get_permalink( $post->ID ),
172
+ 'MetaKey' => $meta_key,
173
+ 'MetaValue' => $meta_value,
174
+ 'MetaLink' => $meta_key,
175
+ $editor_link['name'] => $editor_link['value'],
176
+ )
177
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  }
179
  }
180
 
228
  if ( isset( $this->old_meta[ $meta_id ] ) ) {
229
  // Check change in meta key.
230
  if ( $this->old_meta[ $meta_id ]->key != $meta_key ) {
231
+ $this->plugin->alerts->Trigger(
232
+ 2062, array(
233
+ 'PostID' => $object_id,
234
+ 'PostTitle' => $post->post_title,
235
+ 'PostStatus' => $post->post_status,
236
+ 'PostType' => $post->post_type,
237
+ 'PostDate' => $post->post_date,
238
+ 'PostUrl' => get_permalink( $post->ID ),
239
+ 'MetaID' => $meta_id,
240
+ 'MetaKeyNew' => $meta_key,
241
+ 'MetaKeyOld' => $this->old_meta[ $meta_id ]->key,
242
+ 'MetaValue' => $meta_value,
243
+ 'MetaLink' => $meta_key,
244
+ $editor_link['name'] => $editor_link['value'],
245
+ )
246
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  } elseif ( $this->old_meta[ $meta_id ]->val != $meta_value ) { // Check change in meta value.
248
+ $this->plugin->alerts->Trigger(
249
+ 2054, array(
250
+ 'PostID' => $object_id,
251
+ 'PostTitle' => $post->post_title,
252
+ 'PostStatus' => $post->post_status,
253
+ 'PostType' => $post->post_type,
254
+ 'PostDate' => $post->post_date,
255
+ 'PostUrl' => get_permalink( $post->ID ),
256
+ 'MetaID' => $meta_id,
257
+ 'MetaKey' => $meta_key,
258
+ 'MetaValueNew' => $meta_value,
259
+ 'MetaValueOld' => $this->old_meta[ $meta_id ]->val,
260
+ 'MetaLink' => $meta_key,
261
+ $editor_link['name'] => $editor_link['value'],
262
+ )
263
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
264
  }
265
  // Remove old meta update data.
266
  unset( $this->old_meta[ $meta_id ] );
303
  if ( ! $this->CanLogMetaKey( $object_id, $meta_key ) ) {
304
  continue;
305
  }
306
+ $this->plugin->alerts->Trigger(
307
+ 2055, array(
308
+ 'PostID' => $object_id,
309
+ 'PostTitle' => $post->post_title,
310
+ 'PostStatus' => $post->post_status,
311
+ 'PostType' => $post->post_type,
312
+ 'PostDate' => $post->post_date,
313
+ 'PostUrl' => get_permalink( $post->ID ),
314
+ 'MetaID' => $meta_id,
315
+ 'MetaKey' => $meta_key,
316
+ 'MetaValue' => $meta_value,
317
+ $editor_link['name'] => $editor_link['value'],
318
+ )
319
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
320
  }
321
  }
322
  }
classes/Sensors/PluginsThemes.php CHANGED
@@ -102,7 +102,10 @@ class WSAL_Sensors_PluginsThemes extends WSAL_AbstractSensor {
102
  $action = $post_array['action2'];
103
  }
104
 
105
- $actype = basename( $server_array['SCRIPT_NAME'], '.php' );
 
 
 
106
  $is_themes = 'themes' == $actype;
107
  $is_plugins = 'plugins' == $actype;
108
 
@@ -455,20 +458,20 @@ class WSAL_Sensors_PluginsThemes extends WSAL_AbstractSensor {
455
  || ! empty( $post->post_title ) ) {
456
  // If the plugin modify the post.
457
  if ( false !== strpos( $get_array['action'], 'edit' ) ) {
458
- $event = $this->GetEventTypeForPostType( $post, 2106, 2107, 2108 );
459
  $editor_link = $this->GetEditorLink( $post );
460
  $this->plugin->alerts->Trigger(
461
- $event, array(
462
  'PostID' => $post->ID,
463
  'PostType' => $post->post_type,
464
  'PostTitle' => $post->post_title,
 
 
465
  $editor_link['name'] => $editor_link['value'],
466
  )
467
  );
468
  } else {
469
- $event = $this->GetEventTypeForPostType( $post, 5019, 5020, 5021 );
470
  $this->plugin->alerts->Trigger(
471
- $event, array(
472
  'PostID' => $post->ID,
473
  'PostType' => $post->post_type,
474
  'PostTitle' => $post->post_title,
@@ -523,9 +526,8 @@ class WSAL_Sensors_PluginsThemes extends WSAL_AbstractSensor {
523
  $post = get_post( $post_id );
524
  if ( ! in_array( $post->post_type, array( 'attachment', 'revision', 'nav_menu_item', 'customize_changeset', 'custom_css' ) )
525
  || ! empty( $post->post_title ) ) {
526
- $event = $this->GetEventTypeForPostType( $post, 5025, 5026, 5027 );
527
  $this->plugin->alerts->Trigger(
528
- $event, array(
529
  'PostID' => $post->ID,
530
  'PostType' => $post->post_type,
531
  'PostTitle' => $post->post_title,
@@ -539,9 +541,8 @@ class WSAL_Sensors_PluginsThemes extends WSAL_AbstractSensor {
539
  $post = get_post( $post_id );
540
  if ( ! in_array( $post->post_type, array( 'attachment', 'revision', 'nav_menu_item', 'customize_changeset', 'custom_css' ) )
541
  || ! empty( $post->post_title ) ) {
542
- $event = $this->GetEventTypeForPostType( $post, 5025, 5026, 5027 );
543
  $this->plugin->alerts->Trigger(
544
- $event, array(
545
  'PostID' => $post->ID,
546
  'PostType' => $post->post_type,
547
  'PostTitle' => $post->post_title,
102
  $action = $post_array['action2'];
103
  }
104
 
105
+ $actype = '';
106
+ if ( isset( $server_array['SCRIPT_NAME'] ) ) {
107
+ $actype = basename( $server_array['SCRIPT_NAME'], '.php' );
108
+ }
109
  $is_themes = 'themes' == $actype;
110
  $is_plugins = 'plugins' == $actype;
111
 
458
  || ! empty( $post->post_title ) ) {
459
  // If the plugin modify the post.
460
  if ( false !== strpos( $get_array['action'], 'edit' ) ) {
 
461
  $editor_link = $this->GetEditorLink( $post );
462
  $this->plugin->alerts->Trigger(
463
+ 2106, array(
464
  'PostID' => $post->ID,
465
  'PostType' => $post->post_type,
466
  'PostTitle' => $post->post_title,
467
+ 'PostStatus' => $post->post_status,
468
+ 'PostUrl' => get_permalink( $post->ID ),
469
  $editor_link['name'] => $editor_link['value'],
470
  )
471
  );
472
  } else {
 
473
  $this->plugin->alerts->Trigger(
474
+ 5019, array(
475
  'PostID' => $post->ID,
476
  'PostType' => $post->post_type,
477
  'PostTitle' => $post->post_title,
526
  $post = get_post( $post_id );
527
  if ( ! in_array( $post->post_type, array( 'attachment', 'revision', 'nav_menu_item', 'customize_changeset', 'custom_css' ) )
528
  || ! empty( $post->post_title ) ) {
 
529
  $this->plugin->alerts->Trigger(
530
+ 5025, array(
531
  'PostID' => $post->ID,
532
  'PostType' => $post->post_type,
533
  'PostTitle' => $post->post_title,
541
  $post = get_post( $post_id );
542
  if ( ! in_array( $post->post_type, array( 'attachment', 'revision', 'nav_menu_item', 'customize_changeset', 'custom_css' ) )
543
  || ! empty( $post->post_title ) ) {
 
544
  $this->plugin->alerts->Trigger(
545
+ 5025, array(
546
  'PostID' => $post->ID,
547
  'PostType' => $post->post_type,
548
  'PostTitle' => $post->post_title,
classes/Sensors/Request.php CHANGED
@@ -53,9 +53,12 @@ class WSAL_Sensors_Request extends WSAL_AbstractSensor {
53
 
54
  $file = $uploads_dir_path . 'Request.log.php';
55
 
 
 
 
56
  $line = '[' . date( 'Y-m-d H:i:s' ) . '] '
57
- . $server_array['REQUEST_METHOD'] . ' '
58
- . $server_array['REQUEST_URI'] . ' '
59
  . ( ! empty( $post_array ) ? str_pad( PHP_EOL, 24 ) . json_encode( $post_array ) : '')
60
  . ( ! empty( self::$envvars ) ? str_pad( PHP_EOL, 24 ) . json_encode( self::$envvars ) : '')
61
  . PHP_EOL;
53
 
54
  $file = $uploads_dir_path . 'Request.log.php';
55
 
56
+ $request_method = isset( $server_array['REQUEST_METHOD'] ) ? $server_array['REQUEST_METHOD'] : false;
57
+ $request_uri = isset( $server_array['REQUEST_URI'] ) ? $server_array['REQUEST_URI'] : false;
58
+
59
  $line = '[' . date( 'Y-m-d H:i:s' ) . '] '
60
+ . $request_method . ' '
61
+ . $request_uri . ' '
62
  . ( ! empty( $post_array ) ? str_pad( PHP_EOL, 24 ) . json_encode( $post_array ) : '')
63
  . ( ! empty( self::$envvars ) ? str_pad( PHP_EOL, 24 ) . json_encode( self::$envvars ) : '')
64
  . PHP_EOL;
classes/Sensors/System.php CHANGED
@@ -249,8 +249,8 @@ class WSAL_Sensors_System extends WSAL_AbstractSensor {
249
 
250
  list( $y, $m, $d ) = explode( '-', date( 'Y-m-d' ) );
251
 
252
- $site_id = ( function_exists( 'get_current_blog_id' ) ? get_current_blog_id() : 0 );
253
- $ip = $this->plugin->settings->GetMainClientIP();
254
 
255
  if ( ! is_user_logged_in() ) {
256
  $username = 'Website Visitor';
@@ -283,7 +283,7 @@ class WSAL_Sensors_System extends WSAL_AbstractSensor {
283
 
284
  $occ = count( $occ ) ? $occ[0] : null;
285
  if ( ! empty( $occ ) ) {
286
- // update existing record.
287
  $this->Increment404( $site_id, $username, $ip );
288
  $new = ( (int) $occ->GetMetaValue( 'Attempts', 0 ) ) + 1;
289
 
@@ -800,17 +800,32 @@ class WSAL_Sensors_System extends WSAL_AbstractSensor {
800
  // Get option to log referrer.
801
  $log_referrer = $this->plugin->GetGlobalOption( 'log-404-referrer' );
802
 
 
 
 
 
 
803
  if ( 'on' === $log_referrer ) {
804
  // Get the referer.
805
- if ( isset( $server_array['HTTP_REFERER'] ) ) {
806
- $referrer = filter_input( INPUT_SERVER, 'HTTP_REFERER', FILTER_SANITIZE_URL );
807
- }
 
 
 
 
808
 
809
  // Create/Append to the log file.
810
- $data = 'Request URL ' . $url . ' Referer ' . $referrer . ',';
811
  } else {
 
 
 
 
 
 
812
  // Create/Append to the log file.
813
- $data = 'Request URL ' . $url . ',';
814
  }
815
 
816
  if ( ! is_user_logged_in() ) {
@@ -819,9 +834,6 @@ class WSAL_Sensors_System extends WSAL_AbstractSensor {
819
  $username = $username . '_';
820
  }
821
 
822
- if ( '127.0.0.1' == $ip || '::1' == $ip ) {
823
- $ip = 'localhost';
824
- }
825
  $upload_dir = wp_upload_dir();
826
  $uploads_dir_path = trailingslashit( $upload_dir['basedir'] ) . 'wp-security-audit-log/404s/users/';
827
  $uploads_url = trailingslashit( $upload_dir['baseurl'] ) . 'wp-security-audit-log/404s/users/';
@@ -868,24 +880,35 @@ class WSAL_Sensors_System extends WSAL_AbstractSensor {
868
  // Get option to log referrer.
869
  $log_referrer = $this->plugin->GetGlobalOption( 'log-visitor-404-referrer' );
870
 
 
 
 
 
 
871
  if ( 'on' === $log_referrer ) {
872
  // Get the referer.
873
- if ( isset( $server_array['HTTP_REFERER'] ) ) {
874
- $referrer = filter_input( INPUT_SERVER, 'HTTP_REFERER', FILTER_SANITIZE_URL );
875
- }
 
 
 
 
876
 
877
  // Create/Append to the log file.
878
- $data = 'Request URL ' . $url . ' Referer ' . $referrer . ',';
879
  } else {
 
 
 
 
 
 
880
  // Create/Append to the log file.
881
- $data = 'Request URL ' . $url . ',';
882
  }
883
 
884
  $username = '';
885
-
886
- if ( '127.0.0.1' == $ip || '::1' == $ip ) {
887
- $ip = 'localhost';
888
- }
889
  $upload_dir = wp_upload_dir();
890
  $uploads_dir_path = trailingslashit( $upload_dir['basedir'] ) . 'wp-security-audit-log/404s/visitors/';
891
  $uploads_url = trailingslashit( $upload_dir['baseurl'] ) . 'wp-security-audit-log/404s/visitors/';
249
 
250
  list( $y, $m, $d ) = explode( '-', date( 'Y-m-d' ) );
251
 
252
+ $site_id = ( function_exists( 'get_current_blog_id' ) ? get_current_blog_id() : 0 );
253
+ $ip = $this->plugin->settings->GetMainClientIP();
254
 
255
  if ( ! is_user_logged_in() ) {
256
  $username = 'Website Visitor';
283
 
284
  $occ = count( $occ ) ? $occ[0] : null;
285
  if ( ! empty( $occ ) ) {
286
+ // Update existing record.
287
  $this->Increment404( $site_id, $username, $ip );
288
  $new = ( (int) $occ->GetMetaValue( 'Attempts', 0 ) ) + 1;
289
 
800
  // Get option to log referrer.
801
  $log_referrer = $this->plugin->GetGlobalOption( 'log-404-referrer' );
802
 
803
+ // Check localhost.
804
+ if ( '127.0.0.1' == $ip || '::1' == $ip ) {
805
+ $ip = 'localhost';
806
+ }
807
+
808
  if ( 'on' === $log_referrer ) {
809
  // Get the referer.
810
+ $referrer = ( isset( $server_array['HTTP_REFERER'] ) ) ? $server_array['HTTP_REFERER'] : false;
811
+
812
+ // Data to write.
813
+ $data = '';
814
+
815
+ // Append IP if it exists.
816
+ $data = ( $ip ) ? $ip . ',' : '';
817
 
818
  // Create/Append to the log file.
819
+ $data = $data . 'Request URL ' . $url . ',Referer ' . $referrer . ',';
820
  } else {
821
+ // Data to write.
822
+ $data = '';
823
+
824
+ // Append IP if it exists.
825
+ $data = ( $ip ) ? $ip . ',' : '';
826
+
827
  // Create/Append to the log file.
828
+ $data = $data . 'Request URL ' . $url . ',';
829
  }
830
 
831
  if ( ! is_user_logged_in() ) {
834
  $username = $username . '_';
835
  }
836
 
 
 
 
837
  $upload_dir = wp_upload_dir();
838
  $uploads_dir_path = trailingslashit( $upload_dir['basedir'] ) . 'wp-security-audit-log/404s/users/';
839
  $uploads_url = trailingslashit( $upload_dir['baseurl'] ) . 'wp-security-audit-log/404s/users/';
880
  // Get option to log referrer.
881
  $log_referrer = $this->plugin->GetGlobalOption( 'log-visitor-404-referrer' );
882
 
883
+ // Check localhost.
884
+ if ( '127.0.0.1' == $ip || '::1' == $ip ) {
885
+ $ip = 'localhost';
886
+ }
887
+
888
  if ( 'on' === $log_referrer ) {
889
  // Get the referer.
890
+ $referrer = ( isset( $server_array['HTTP_REFERER'] ) ) ? $server_array['HTTP_REFERER'] : false;
891
+
892
+ // Data to write.
893
+ $data = '';
894
+
895
+ // Append IP if it exists.
896
+ $data = ( $ip ) ? $ip . ',' : '';
897
 
898
  // Create/Append to the log file.
899
+ $data = $data . 'Request URL ' . $url . ',Referer ' . $referrer . ',';
900
  } else {
901
+ // Data to write.
902
+ $data = '';
903
+
904
+ // Append IP if it exists.
905
+ $data = ( $ip ) ? $ip . ',' : '';
906
+
907
  // Create/Append to the log file.
908
+ $data = $data . 'Request URL ' . $url . ',';
909
  }
910
 
911
  $username = '';
 
 
 
 
912
  $upload_dir = wp_upload_dir();
913
  $uploads_dir_path = trailingslashit( $upload_dir['basedir'] ) . 'wp-security-audit-log/404s/visitors/';
914
  $uploads_url = trailingslashit( $upload_dir['baseurl'] ) . 'wp-security-audit-log/404s/visitors/';
classes/Settings.php CHANGED
@@ -441,17 +441,6 @@ class WSAL_Settings {
441
  return $this->_plugin->SetGlobalOption( 'hide-plugin', $enabled );
442
  }
443
 
444
- /**
445
- * Checking if Logging is enabled.
446
- */
447
- public function IsLoggingDisabled() {
448
- return $this->_plugin->GetGlobalOption( 'disable-logging' );
449
- }
450
-
451
- public function SetLoggingDisabled( $disabled ) {
452
- return $this->_plugin->SetGlobalOption( 'disable-logging', $disabled );
453
- }
454
-
455
  /**
456
  * Checking if the data will be removed.
457
  */
@@ -759,9 +748,6 @@ class WSAL_Settings {
759
  elseif ( preg_match( '/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/', $ip ) ) {
760
  return $ip;
761
  }
762
- if ( ! $this->IsLoggingDisabled ) {
763
- error_log( 'Invalid IP in ValidateIP function: ' . $ip );
764
- }
765
  return false;
766
  } else {
767
  return $filtered_ip;
441
  return $this->_plugin->SetGlobalOption( 'hide-plugin', $enabled );
442
  }
443
 
 
 
 
 
 
 
 
 
 
 
 
444
  /**
445
  * Checking if the data will be removed.
446
  */
748
  elseif ( preg_match( '/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/', $ip ) ) {
749
  return $ip;
750
  }
 
 
 
751
  return false;
752
  } else {
753
  return $filtered_ip;
classes/ViewManager.php CHANGED
@@ -42,6 +42,16 @@ class WSAL_ViewManager {
42
 
43
  $skip_views = array();
44
 
 
 
 
 
 
 
 
 
 
 
45
  // Load views.
46
  foreach ( glob( dirname( __FILE__ ) . '/Views/*.php' ) as $file ) {
47
  if ( empty( $skip_views ) || ! in_array( $file, $skip_views ) ) {
42
 
43
  $skip_views = array();
44
 
45
+ // Array of views to skip for premium version.
46
+ if ( wsal_freemius()->is_plan__premium_only( 'starter' ) ) {
47
+ $skip_views[] = dirname( __FILE__ ) . '/Views/EmailNotifications.php';
48
+ $skip_views[] = dirname( __FILE__ ) . '/Views/ExternalDB.php';
49
+ $skip_views[] = dirname( __FILE__ ) . '/Views/Licensing.php';
50
+ $skip_views[] = dirname( __FILE__ ) . '/Views/LogInUsers.php';
51
+ $skip_views[] = dirname( __FILE__ ) . '/Views/Reports.php';
52
+ $skip_views[] = dirname( __FILE__ ) . '/Views/Search.php';
53
+ }
54
+
55
  // Load views.
56
  foreach ( glob( dirname( __FILE__ ) . '/Views/*.php' ) as $file ) {
57
  if ( empty( $skip_views ) || ! in_array( $file, $skip_views ) ) {
classes/Views/Settings.php CHANGED
@@ -151,7 +151,6 @@ class WSAL_Views_Settings extends WSAL_AbstractView {
151
  $this->_plugin->settings->SetMainIPFromProxy( isset( $post_array['EnableProxyIpCapture'] ) );
152
  $this->_plugin->settings->SetInternalIPsFiltering( isset( $post_array['EnableIpFiltering'] ) );
153
  $this->_plugin->settings->SetIncognito( isset( $post_array['Incognito'] ) );
154
- $this->_plugin->settings->SetLoggingDisabled( isset( $post_array['Logging'] ) );
155
  $this->_plugin->settings->SetDeleteData( isset( $post_array['DeleteData'] ) );
156
  $this->_plugin->settings->SetTimezone( $post_array['Timezone'] );
157
  $this->_plugin->settings->set_type_username( $post_array['type_username'] );
@@ -467,27 +466,6 @@ class WSAL_Views_Settings extends WSAL_AbstractView {
467
  </fieldset>
468
  </td>
469
  </tr>
470
- <!-- Logging -->
471
- <tr>
472
- <th><label for="Logging"><?php esc_html_e( 'Logging', 'wp-security-audit-log' ); ?></label></th>
473
- <td>
474
- <fieldset>
475
- <label for="Logging">
476
- <span class="f-container">
477
- <span class="f-left">
478
- <input type="checkbox" name="Logging" value="1" class="switch" id="logging_status"/>
479
- <label for="logging_status"></label>
480
- </span>
481
- <span class="f-right f-text"><span id="logging_status_text"></span></span>
482
- </span>
483
- </label>
484
- <br/>
485
- <span class="description">
486
- <?php esc_html_e( 'Disable all plugin logging.', 'wp-security-audit-log' ); ?>
487
- </span>
488
- </fieldset>
489
- </td>
490
- </tr>
491
  <!-- Remove Data on Uninstall -->
492
  <tr>
493
  <th><label for="DeleteData"><?php esc_html_e( 'Remove Data on Uninstall', 'wp-security-audit-log' ); ?></label></th>
@@ -855,27 +833,6 @@ class WSAL_Views_Settings extends WSAL_AbstractView {
855
  }
856
 
857
  jQuery( document ).ready( function() {
858
- var statusConfig = <?php echo ( $this->_plugin->settings->IsLoggingDisabled() ) ? 1 : 0; ?>;
859
- var logging_status = jQuery('#logging_status');
860
- var txtNot = jQuery('#logging_status_text');
861
-
862
- function wsalUpdateLoggingStatus(checkbox, label) {
863
- if (checkbox.prop('checked')) {
864
- label.text('On');
865
- } else {
866
- label.text('Off');
867
- }
868
- }
869
- // Set On
870
- if (statusConfig) {
871
- logging_status.prop( 'checked', true );
872
- }
873
- wsalUpdateLoggingStatus(logging_status, txtNot);
874
-
875
- logging_status.on( 'change', function() {
876
- wsalUpdateLoggingStatus( logging_status, txtNot );
877
- } );
878
-
879
  // Enable/disable login notification textarea.
880
  function wsal_update_login_page_text( checkbox, textarea ) {
881
  if ( checkbox.prop( 'checked' ) ) {
151
  $this->_plugin->settings->SetMainIPFromProxy( isset( $post_array['EnableProxyIpCapture'] ) );
152
  $this->_plugin->settings->SetInternalIPsFiltering( isset( $post_array['EnableIpFiltering'] ) );
153
  $this->_plugin->settings->SetIncognito( isset( $post_array['Incognito'] ) );
 
154
  $this->_plugin->settings->SetDeleteData( isset( $post_array['DeleteData'] ) );
155
  $this->_plugin->settings->SetTimezone( $post_array['Timezone'] );
156
  $this->_plugin->settings->set_type_username( $post_array['type_username'] );
466
  </fieldset>
467
  </td>
468
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
469
  <!-- Remove Data on Uninstall -->
470
  <tr>
471
  <th><label for="DeleteData"><?php esc_html_e( 'Remove Data on Uninstall', 'wp-security-audit-log' ); ?></label></th>
833
  }
834
 
835
  jQuery( document ).ready( function() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
836
  // Enable/disable login notification textarea.
837
  function wsal_update_login_page_text( checkbox, textarea ) {
838
  if ( checkbox.prop( 'checked' ) ) {
classes/Views/ToggleAlerts.php CHANGED
@@ -129,8 +129,20 @@ class WSAL_Views_ToggleAlerts extends WSAL_AbstractView {
129
  <?php foreach ( $grouped_alerts as $name => $group ) : ?>
130
  <div class="wsal-tab" id="tab-<?php echo esc_attr( $safe_names[ $name ] ); ?>">
131
  <h2 class="nav-tab-wrapper wsal-sub-tabs">
132
- <?php foreach ( $group as $subname => $alerts ) : ?>
133
- <a href="#tab-<?php echo esc_attr( $this->GetSafeCatgName( $subname ) ); ?>" class="nav-tab" data-parent="tab-<?php echo esc_attr( $safe_names[ $name ] ); ?>"><?php echo esc_html( $subname ); ?></a>
 
 
 
 
 
 
 
 
 
 
 
 
134
  <?php endforeach; ?>
135
  </h2>
136
  <?php
@@ -149,6 +161,13 @@ class WSAL_Views_ToggleAlerts extends WSAL_AbstractView {
149
  $allactive = false;
150
  }
151
  }
 
 
 
 
 
 
 
152
  ?>
153
  <table class="wp-list-table wsal-tab widefat fixed wsal-sub-tab" cellspacing="0" id="tab-<?php echo esc_attr( $this->GetSafeCatgName( $subname ) ); ?>">
154
  <thead>
129
  <?php foreach ( $grouped_alerts as $name => $group ) : ?>
130
  <div class="wsal-tab" id="tab-<?php echo esc_attr( $safe_names[ $name ] ); ?>">
131
  <h2 class="nav-tab-wrapper wsal-sub-tabs">
132
+ <?php
133
+ foreach ( $group as $subname => $alerts ) :
134
+ $tab_id = $this->GetSafeCatgName( $subname );
135
+
136
+ // Skip Pages and CPTs section.
137
+ if ( 'custom-post-types' === $tab_id || 'pages' === $tab_id ) {
138
+ continue;
139
+ }
140
+ ?>
141
+ <a href="#tab-<?php echo esc_attr( $tab_id ); ?>"
142
+ class="nav-tab"
143
+ data-parent="tab-<?php echo esc_attr( $safe_names[ $name ] ); ?>">
144
+ <?php echo esc_html( $subname ); ?>
145
+ </a>
146
  <?php endforeach; ?>
147
  </h2>
148
  <?php
161
  $allactive = false;
162
  }
163
  }
164
+
165
+ $tab_id = $this->GetSafeCatgName( $subname );
166
+
167
+ // Skip Pages and CPTs section.
168
+ if ( 'custom-post-types' === $tab_id || 'pages' === $tab_id ) {
169
+ continue;
170
+ }
171
  ?>
172
  <table class="wp-list-table wsal-tab widefat fixed wsal-sub-tab" cellspacing="0" id="tab-<?php echo esc_attr( $this->GetSafeCatgName( $subname ) ); ?>">
173
  <thead>
css/auditlog.css CHANGED
@@ -297,3 +297,7 @@ div.wsal_notice__wrapper p {
297
  top: 0;
298
  text-decoration: none;
299
  }
 
 
 
 
297
  top: 0;
298
  text-decoration: none;
299
  }
300
+
301
+ .wp-list-table #code {
302
+ width: 55px;
303
+ }
defaults.php CHANGED
@@ -130,48 +130,46 @@ function wsaldefaults_wsal_init( WpSecurityAuditLog $wsal ) {
130
  $wsal->alerts->RegisterGroup(
131
  array(
132
  __( 'Content & Comments', 'wp-security-audit-log' ) => array(
133
- __( 'Blog Posts', 'wp-security-audit-log' ) => array(
134
- array( 2000, E_NOTICE, __( 'User created a new blog post and saved it as draft', 'wp-security-audit-log' ), __( 'Created a new post called %PostTitle% and saved it as draft. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
135
- array( 2001, E_NOTICE, __( 'User published a blog post', 'wp-security-audit-log' ), __( 'Published a post called %PostTitle%. Post URL is %PostUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
136
- array( 2002, E_NOTICE, __( 'User modified a published blog post', 'wp-security-audit-log' ), __( 'Modified the published post %PostTitle%. Post URL is %PostUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
137
- array( 2003, E_NOTICE, __( 'User modified a draft blog post', 'wp-security-audit-log' ), __( 'Modified the draft post with the %PostTitle%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
138
- array( 2008, E_WARNING, __( 'User permanently deleted a blog post from the trash', 'wp-security-audit-log' ), __( 'Permanently deleted the post %PostTitle%.', 'wp-security-audit-log' ) ),
139
- array( 2012, E_WARNING, __( 'User moved a blog post to the trash', 'wp-security-audit-log' ), __( 'Moved the post %PostTitle% to trash. Post URL is %PostUrl%.', 'wp-security-audit-log' ) ),
140
- array( 2014, E_CRITICAL, __( 'User restored a blog post from trash', 'wp-security-audit-log' ), __( 'Post %PostTitle% has been restored from trash. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
141
- array( 2016, E_NOTICE, __( 'User changed blog post category', 'wp-security-audit-log' ), __( 'Changed the category of the post %PostTitle% from %OldCategories% to %NewCategories%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
142
- array( 2017, E_NOTICE, __( 'User changed blog post URL', 'wp-security-audit-log' ), __( 'Changed the URL of the post %PostTitle% from %OldUrl% to %NewUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
143
- array( 2019, E_NOTICE, __( 'User changed blog post author', 'wp-security-audit-log' ), __( 'Changed the author of %PostTitle% post from %OldAuthor% to %NewAuthor%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
144
- array( 2021, E_NOTICE, __( 'User changed blog post status', 'wp-security-audit-log' ), __( 'Changed the status of %PostTitle% post from %OldStatus% to %NewStatus%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
145
  array( 2023, E_NOTICE, __( 'User created new category', 'wp-security-audit-log' ), __( 'Created a new category called %CategoryName%. Category slug is %Slug%. %CategoryLink%.', 'wp-security-audit-log' ) ),
146
- array( 2024, E_WARNING, __( 'User deleted category', 'wp-security-audit-log' ), __( 'Deleted the category %CategoryName%. Category slug was %Slug%.', 'wp-security-audit-log' ) ),
147
- array( 2025, E_WARNING, __( 'User changed the visibility of a blog post', 'wp-security-audit-log' ), __( 'Changed the visibility of the post %PostTitle% from %OldVisibility% to %NewVisibility%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
148
- array( 2027, E_NOTICE, __( 'User changed the date of a blog post', 'wp-security-audit-log' ), __( 'Changed the date of the post %PostTitle% from %OldDate% to %NewDate%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
 
 
149
  array( 2049, E_NOTICE, __( 'User set a post as sticky', 'wp-security-audit-log' ), __( 'Set the post %PostTitle% as Sticky. Post URL is %PostUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
150
  array( 2050, E_NOTICE, __( 'User removed post from sticky', 'wp-security-audit-log' ), __( 'Removed the post %PostTitle% from Sticky. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
151
- array( 2052, E_NOTICE, __( 'User changed generic tables', 'wp-security-audit-log' ), __( 'Changed the parent of the category %CategoryName% from %OldParent% to %NewParent%. %CategoryLink%.', 'wp-security-audit-log' ) ),
152
- array( 2053, E_CRITICAL, __( 'User created a custom field for a post', 'wp-security-audit-log' ), __( 'Created a new custom field %MetaKey% with value %MetaValue% in the post %PostTitle%' . ' %EditorLinkPost%.' . '<br>%MetaLink%.', 'wp-security-audit-log' ) ),
153
- array( 2054, E_CRITICAL, __( 'User updated a custom field value for a post', 'wp-security-audit-log' ), __( 'Modified the value of the custom field %MetaKey% from %MetaValueOld% to %MetaValueNew% in the post %PostTitle%' . ' %EditorLinkPost%.' . '<br>%MetaLink%.', 'wp-security-audit-log' ) ),
154
- array( 2055, E_CRITICAL, __( 'User deleted a custom field from a post', 'wp-security-audit-log' ), __( 'Deleted the custom field %MetaKey% with id %MetaID% from the post %PostTitle%' . ' %EditorLinkPost%.' . '<br>%MetaLink%.', 'wp-security-audit-log' ) ),
155
- array( 2062, E_CRITICAL, __( 'User updated a custom field name for a post', 'wp-security-audit-log' ), __( 'Changed the custom field name from %MetaKeyOld% to %MetaKeyNew% in the post %PostTitle%' . ' %EditorLinkPost%.' . '<br>%MetaLink%.', 'wp-security-audit-log' ) ),
156
- array( 2065, E_WARNING, __( 'User modified content for a published post', 'wp-security-audit-log' ), __( 'Modified the content of the published post %PostTitle%.' . '%RevisionLink%' . ' %EditorLinkPost%.', 'wp-security-audit-log' ) ),
157
- array( 2068, E_NOTICE, __( 'User modified content for a draft post', 'wp-security-audit-log' ), __( 'Modified the content of the draft post %PostTitle%.' . '%RevisionLink%' . ' %EditorLinkPost%.', 'wp-security-audit-log' ) ),
158
- array( 2072, E_NOTICE, __( 'User modified content of a post', 'wp-security-audit-log' ), __( 'Modified the content of post %PostTitle% which is submitted for review.' . '%RevisionLink%' . ' %EditorLinkPost%.', 'wp-security-audit-log' ) ),
159
- array( 2073, E_NOTICE, __( 'User submitted a post for review', 'wp-security-audit-log' ), __( 'Submitted the post %PostTitle% for review. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
160
- array( 2074, E_NOTICE, __( 'User scheduled a post', 'wp-security-audit-log' ), __( 'Scheduled the post %PostTitle% to be published %PublishingDate%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
161
- array( 2086, E_NOTICE, __( 'User changed title of a post', 'wp-security-audit-log' ), __( 'Changed the title of the post %OldTitle% to %NewTitle%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
162
- array( 2100, E_NOTICE, __( 'User opened a post in the editor', 'wp-security-audit-log' ), __( 'Opened the post %PostTitle% in the editor. View the post: %EditorLinkPost%.', 'wp-security-audit-log' ) ),
163
- array( 2101, E_NOTICE, __( 'User viewed a post', 'wp-security-audit-log' ), __( 'Viewed the post %PostTitle%. View the post: %PostUrl%.', 'wp-security-audit-log' ) ),
164
- array( 2111, E_NOTICE, __( 'User disabled Comments/Trackbacks and Pingbacks on a published post', 'wp-security-audit-log' ), __( 'Disabled %Type% on the published post %PostTitle%. View the post: %PostUrl%.', 'wp-security-audit-log' ) ),
165
- array( 2112, E_NOTICE, __( 'User enabled Comments/Trackbacks and Pingbacks on a published post', 'wp-security-audit-log' ), __( 'Enabled %Type% on the published post %PostTitle%. View the post: %PostUrl%.', 'wp-security-audit-log' ) ),
166
- array( 2113, E_NOTICE, __( 'User disabled Comments/Trackbacks and Pingbacks on a draft post', 'wp-security-audit-log' ), __( 'Disabled %Type% on the draft post %PostTitle%. View the post: %PostUrl%.', 'wp-security-audit-log' ) ),
167
- array( 2114, E_NOTICE, __( 'User enabled Comments/Trackbacks and Pingbacks on a draft post', 'wp-security-audit-log' ), __( 'Enabled %Type% on the draft post %PostTitle%. View the post: %PostUrl%.', 'wp-security-audit-log' ) ),
168
- array( 2119, E_NOTICE, __( 'User added blog post tag', 'wp-security-audit-log' ), __( 'Added the tag %tag% on the %PostStatus% post %PostTitle%. View the post: %EditorLinkPost%.', 'wp-security-audit-log' ) ),
169
- array( 2120, E_NOTICE, __( 'User removed blog post tag', 'wp-security-audit-log' ), __( 'Removed the tag %tag% on the %PostStatus% post %PostTitle%. View the post: %EditorLinkPost%.', 'wp-security-audit-log' ) ),
170
- array( 2121, E_NOTICE, __( 'User created new tag', 'wp-security-audit-log' ), __( 'Created a new tag called %TagName% .Tag slug is %Slug%. %TagLink%.', 'wp-security-audit-log' ) ),
171
- array( 2122, E_NOTICE, __( 'User deleted tag', 'wp-security-audit-log' ), __( 'Deleted the tag %TagName%. Tag slug was %Slug%.', 'wp-security-audit-log' ) ),
172
- array( 2123, E_NOTICE, __( 'User renamed tag', 'wp-security-audit-log' ), __( 'Renamed a tag from %old_name% to %new_name%. %TagLink%.', 'wp-security-audit-log' ) ),
173
- array( 2124, E_NOTICE, __( 'User changed tag slug', 'wp-security-audit-log' ), __( 'Changed the slug of tag %tag% from %old_slug% to %new_slug%. %TagLink%.', 'wp-security-audit-log' ) ),
174
- array( 2125, E_NOTICE, __( 'User changed tag description', 'wp-security-audit-log' ), __( 'Changed the description of tag %tag%. %TagLink%.', 'wp-security-audit-log' ) ),
175
  ),
176
  __( 'Comments', 'wp-security-audit-log' ) => array(
177
  array( 2090, E_NOTICE, __( 'User approved a comment', 'wp-security-audit-log' ), __( 'Approved the comment posted in response to the post %PostTitle% by %Author% on %CommentLink%.', 'wp-security-audit-log' ) ),
@@ -186,6 +184,7 @@ function wsaldefaults_wsal_init( WpSecurityAuditLog $wsal ) {
186
  array( 2099, E_NOTICE, __( 'User posted a comment', 'wp-security-audit-log' ), __( '%CommentMsg% on %CommentLink%.', 'wp-security-audit-log' ) ),
187
  ),
188
  __( 'Custom Post Types', 'wp-security-audit-log' ) => array(
 
189
  array( 2029, E_NOTICE, __( 'User created a new post with custom post type and saved it as draft', 'wp-security-audit-log' ), __( 'Created a new custom post called %PostTitle% of type %PostType%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
190
  array( 2030, E_NOTICE, __( 'User published a post with custom post type', 'wp-security-audit-log' ), __( 'Published a custom post %PostTitle% of type %PostType%. Post URL is %PostUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
191
  array( 2031, E_NOTICE, __( 'User modified a post with custom post type', 'wp-security-audit-log' ), __( 'Modified the custom post %PostTitle% of type %PostType%. Post URL is %PostUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
@@ -204,7 +203,9 @@ function wsaldefaults_wsal_init( WpSecurityAuditLog $wsal ) {
204
  array( 2058, E_CRITICAL, __( 'User deleted a custom field from a custom post type', 'wp-security-audit-log' ), __( 'Deleted the custom field %MetaKey% with id %MetaID% from custom post %PostTitle% of type %PostType%' . ' %EditorLinkPost%.' . '<br>%MetaLink%.', 'wp-security-audit-log' ) ),
205
  array( 2063, E_CRITICAL, __( 'User updated a custom field name for a custom post type', 'wp-security-audit-log' ), __( 'Changed the custom field name from %MetaKeyOld% to %MetaKeyNew% in custom post %PostTitle% of type %PostType%' . ' %EditorLinkPost%.' . '<br>%MetaLink%.', 'wp-security-audit-log' ) ),
206
  array( 2067, E_WARNING, __( 'User modified content for a published custom post type', 'wp-security-audit-log' ), __( 'Modified the content of the published custom post type %PostTitle%. Post URL is %PostUrl%.' . '%EditorLinkPost%.', 'wp-security-audit-log' ) ),
 
207
  array( 2070, E_NOTICE, __( 'User modified content for a draft custom post type', 'wp-security-audit-log' ), __( 'Modified the content of the draft custom post type %PostTitle%.' . '%EditorLinkPost%.', 'wp-security-audit-log' ) ),
 
208
  array( 2076, E_NOTICE, __( 'User scheduled a custom post type', 'wp-security-audit-log' ), __( 'Scheduled the custom post type %PostTitle% to be published %PublishingDate%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
209
  array( 2088, E_NOTICE, __( 'User changed title of a custom post type', 'wp-security-audit-log' ), __( 'Changed the title of the custom post %OldTitle% to %NewTitle%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
210
  array( 2104, E_NOTICE, __( 'User opened a custom post type in the editor', 'wp-security-audit-log' ), __( 'Opened the custom post %PostTitle% of type %PostType% in the editor. View the post: %EditorLinkPost%.', 'wp-security-audit-log' ) ),
@@ -223,8 +224,6 @@ function wsaldefaults_wsal_init( WpSecurityAuditLog $wsal ) {
223
  array( 2022, E_NOTICE, __( 'User changed page status', 'wp-security-audit-log' ), __( 'Changed the status of the page %PostTitle% from %OldStatus% to %NewStatus%. %EditorLinkPage%.', 'wp-security-audit-log' ) ),
224
  array( 2026, E_WARNING, __( 'User changed the visibility of a page post', 'wp-security-audit-log' ), __( 'Changed the visibility of the page %PostTitle% from %OldVisibility% to %NewVisibility%. %EditorLinkPage%.', 'wp-security-audit-log' ) ),
225
  array( 2028, E_NOTICE, __( 'User changed the date of a page post', 'wp-security-audit-log' ), __( 'Changed the date of the page %PostTitle% from %OldDate% to %NewDate%. %EditorLinkPage%.', 'wp-security-audit-log' ) ),
226
- array( 2047, E_NOTICE, __( 'User changed the parent of a page', 'wp-security-audit-log' ), __( 'Changed the parent of the page %PostTitle% from %OldParentName% to %NewParentName%. %EditorLinkPage%.', 'wp-security-audit-log' ) ),
227
- array( 2048, E_CRITICAL, __( 'User changed the template of a page', 'wp-security-audit-log' ), __( 'Changed the template of the page %PostTitle% from %OldTemplate% to %NewTemplate%. %EditorLinkPage%.', 'wp-security-audit-log' ) ),
228
  array( 2059, E_CRITICAL, __( 'User created a custom field for a page', 'wp-security-audit-log' ), __( 'Created a new custom field called %MetaKey% with value %MetaValue% in the page %PostTitle%' . ' %EditorLinkPage%.' . '<br>%MetaLink%.', 'wp-security-audit-log' ) ),
229
  array( 2060, E_CRITICAL, __( 'User updated a custom field value for a page', 'wp-security-audit-log' ), __( 'Modified the value of the custom field %MetaKey% from %MetaValueOld% to %MetaValueNew% in the page %PostTitle%' . ' %EditorLinkPage%.' . '<br>%MetaLink%.', 'wp-security-audit-log' ) ),
230
  array( 2061, E_CRITICAL, __( 'User deleted a custom field from a page', 'wp-security-audit-log' ), __( 'Deleted the custom field %MetaKey% with id %MetaID% from page %PostTitle%' . ' %EditorLinkPage%.' . '<br>%MetaLink%.', 'wp-security-audit-log' ) ),
@@ -235,6 +234,8 @@ function wsaldefaults_wsal_init( WpSecurityAuditLog $wsal ) {
235
  array( 2087, E_NOTICE, __( 'User changed title of a page', 'wp-security-audit-log' ), __( 'Changed the title of the page %OldTitle% to %NewTitle%.' . ' %EditorLinkPage%.', 'wp-security-audit-log' ) ),
236
  array( 2102, E_NOTICE, __( 'User opened a page in the editor', 'wp-security-audit-log' ), __( 'Opened the page %PostTitle% in the editor. View the page: %EditorLinkPage%.', 'wp-security-audit-log' ) ),
237
  array( 2103, E_NOTICE, __( 'User viewed a page', 'wp-security-audit-log' ), __( 'Viewed the page %PostTitle%. View the page: %PostUrl%.', 'wp-security-audit-log' ) ),
 
 
238
  array( 2115, E_NOTICE, __( 'User disabled Comments/Trackbacks and Pingbacks on a published page', 'wp-security-audit-log' ), __( 'Disabled %Type% on the published page %PostTitle%. View the page: %PostUrl%.', 'wp-security-audit-log' ) ),
239
  array( 2116, E_NOTICE, __( 'User enabled Comments/Trackbacks and Pingbacks on a published page', 'wp-security-audit-log' ), __( 'Enabled %Type% on the published page %PostTitle%. View the page: %PostUrl%.', 'wp-security-audit-log' ) ),
240
  array( 2117, E_NOTICE, __( 'User disabled Comments/Trackbacks and Pingbacks on a draft page', 'wp-security-audit-log' ), __( 'Disabled %Type% on the draft page %PostTitle%. View the page: %PostUrl%.', 'wp-security-audit-log' ) ),
@@ -278,16 +279,15 @@ function wsaldefaults_wsal_init( WpSecurityAuditLog $wsal ) {
278
  array( 5005, E_WARNING, __( 'User installed a theme', 'wp-security-audit-log' ), __( 'Installed the theme "%Theme->Name%" in %Theme->get_template_directory%.', 'wp-security-audit-log' ) ),
279
  array( 5006, E_CRITICAL, __( 'User activated a theme', 'wp-security-audit-log' ), __( 'Activated the theme "%Theme->Name%", installed in %Theme->get_template_directory%.', 'wp-security-audit-log' ) ),
280
  array( 5007, E_CRITICAL, __( 'User uninstalled a theme', 'wp-security-audit-log' ), __( 'Deleted the theme "%Theme->Name%" installed in %Theme->get_template_directory%.', 'wp-security-audit-log' ) ),
281
- array( 5019, E_CRITICAL, __( 'A plugin created a post', 'wp-security-audit-log' ), __( 'A plugin automatically created the following post: %PostTitle%.', 'wp-security-audit-log' ) ),
282
  array( 5020, E_CRITICAL, __( 'A plugin created a page', 'wp-security-audit-log' ), __( 'A plugin automatically created the following page: %PostTitle%.', 'wp-security-audit-log' ) ),
283
  array( 5021, E_CRITICAL, __( 'A plugin created a custom post', 'wp-security-audit-log' ), __( 'A plugin automatically created the following custom post: %PostTitle%.', 'wp-security-audit-log' ) ),
284
- array( 5025, E_CRITICAL, __( 'A plugin deleted a post', 'wp-security-audit-log' ), __( 'A plugin automatically deleted the following post: %PostTitle%.', 'wp-security-audit-log' ) ),
285
  array( 5026, E_CRITICAL, __( 'A plugin deleted a page', 'wp-security-audit-log' ), __( 'A plugin automatically deleted the following page: %PostTitle%.', 'wp-security-audit-log' ) ),
286
  array( 5027, E_CRITICAL, __( 'A plugin deleted a custom post', 'wp-security-audit-log' ), __( 'A plugin automatically deleted the following custom post: %PostTitle%.', 'wp-security-audit-log' ) ),
287
  array( 5031, E_WARNING, __( 'User updated a theme', 'wp-security-audit-log' ), __( 'Updated the theme "%Theme->Name%" installed in %Theme->get_template_directory%.', 'wp-security-audit-log' ) ),
288
  array( 2046, E_CRITICAL, __( 'User changed a file using the theme editor', 'wp-security-audit-log' ), __( 'Modified %File% with the Theme Editor.', 'wp-security-audit-log' ) ),
289
  array( 2051, E_CRITICAL, __( 'User changed a file using the plugin editor', 'wp-security-audit-log' ), __( 'Modified %File% with the Plugin Editor.', 'wp-security-audit-log' ) ),
290
- array( 2106, E_NOTICE, __( 'A plugin modified a post', 'wp-security-audit-log' ), __( 'Plugin modified the post %PostTitle%. View the post: %EditorLinkPost%.', 'wp-security-audit-log' ) ),
291
  array( 2107, E_NOTICE, __( 'A plugin modified a page', 'wp-security-audit-log' ), __( 'Plugin modified the page %PostTitle%. View the page: %EditorLinkPage%.', 'wp-security-audit-log' ) ),
292
  array( 2108, E_NOTICE, __( 'A plugin modified a custom post', 'wp-security-audit-log' ), __( 'Plugin modified the custom post %PostTitle%. View the post: %EditorLinkPost%.', 'wp-security-audit-log' ) ),
293
  ),
130
  $wsal->alerts->RegisterGroup(
131
  array(
132
  __( 'Content & Comments', 'wp-security-audit-log' ) => array(
133
+ __( 'Content', 'wp-security-audit-log' ) => array(
134
+ array( 2000, E_NOTICE, __( 'User created a new post and saved it as draft', 'wp-security-audit-log' ), __( 'Created a new %PostType% titled %PostTitle% and saved it as draft. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
135
+ array( 2001, E_NOTICE, __( 'User published a post', 'wp-security-audit-log' ), __( 'Published a %PostType% titled %PostTitle%. URL is %PostUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
136
+ array( 2002, E_NOTICE, __( 'User modified a post', 'wp-security-audit-log' ), __( 'Modified the %PostStatus% %PostType% titled %PostTitle%. URL is: %PostUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
137
+ array( 2008, E_WARNING, __( 'User permanently deleted a post from the trash', 'wp-security-audit-log' ), __( 'Permanently deleted the %PostType% titled %PostTitle%. URL was %PostUrl%.', 'wp-security-audit-log' ) ),
138
+ array( 2012, E_WARNING, __( 'User moved a post to the trash', 'wp-security-audit-log' ), __( 'Moved the %PostStatus% %PostType% titled %PostTitle% to trash. URL is %PostUrl%.', 'wp-security-audit-log' ) ),
139
+ array( 2014, E_CRITICAL, __( 'User restored a post from trash', 'wp-security-audit-log' ), __( 'The %PostStatus% %PostType% titled %PostTitle% has been restored from trash. URL is: %PostUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
140
+ array( 2016, E_NOTICE, __( 'User changed post category', 'wp-security-audit-log' ), __( 'Changed the category of the %PostStatus% %PostType% titled %PostTitle% from %OldCategories% to %NewCategories%. URL is: %PostUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
141
+ array( 2017, E_NOTICE, __( 'User changed post URL', 'wp-security-audit-log' ), __( 'Changed the URL of the %PostStatus% %PostType% titled %PostTitle% from %OldUrl% to %NewUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
142
+ array( 2019, E_NOTICE, __( 'User changed post author', 'wp-security-audit-log' ), __( 'Changed the author of the %PostStatus% %PostType% titled %PostTitle% from %OldAuthor% to %NewAuthor%. URL is: %PostUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
143
+ array( 2021, E_NOTICE, __( 'User changed post status', 'wp-security-audit-log' ), __( 'Changed the status of the %PostType% titled %PostTitle% from %OldStatus% to %NewStatus%. URL is: %PostUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
 
144
  array( 2023, E_NOTICE, __( 'User created new category', 'wp-security-audit-log' ), __( 'Created a new category called %CategoryName%. Category slug is %Slug%. %CategoryLink%.', 'wp-security-audit-log' ) ),
145
+ array( 2024, E_WARNING, __( 'User deleted category', 'wp-security-audit-log' ), __( 'Deleted the %CategoryName% category. Category slug was %Slug%. %CategoryLink%.', 'wp-security-audit-log' ) ),
146
+ array( 2025, E_WARNING, __( 'User changed the visibility of a post', 'wp-security-audit-log' ), __( 'Changed the visibility of the %PostStatus% %PostType% titled %PostTitle% from %OldVisibility% to %NewVisibility%. URL is: %PostUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
147
+ array( 2027, E_NOTICE, __( 'User changed the date of a post', 'wp-security-audit-log' ), __( 'Changed the date of the %PostStatus% %PostType% titled %PostTitle% from %OldDate% to %NewDate%. URL is: %PostUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
148
+ array( 2047, E_NOTICE, __( 'User changed the parent of a page', 'wp-security-audit-log' ), __( 'Changed the parent of the %PostStatus% %PostType% titled %PostTitle% from %OldParentName% to %NewParentName%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
149
+ array( 2048, E_CRITICAL, __( 'User changed the template of a page', 'wp-security-audit-log' ), __( 'Changed the template of the %PostStatus% %PostType% titled %PostTitle% from %OldTemplate% to %NewTemplate%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
150
  array( 2049, E_NOTICE, __( 'User set a post as sticky', 'wp-security-audit-log' ), __( 'Set the post %PostTitle% as Sticky. Post URL is %PostUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
151
  array( 2050, E_NOTICE, __( 'User removed post from sticky', 'wp-security-audit-log' ), __( 'Removed the post %PostTitle% from Sticky. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
152
+ array( 2052, E_NOTICE, __( 'Changed the parent of a category.', 'wp-security-audit-log' ), __( 'Changed the parent of the category %CategoryName% from %OldParent% to %NewParent%. %CategoryLink%.', 'wp-security-audit-log' ) ),
153
+ array( 2053, E_CRITICAL, __( 'User created a custom field for a post', 'wp-security-audit-log' ), __( 'Created a new custom field called %MetaKey% with value %MetaValue% in the %PostStatus% %PostType% titled %PostTitle%. URL is: %PostUrl%. %EditorLinkPost%.<br>%MetaLink%.', 'wp-security-audit-log' ) ),
154
+ array( 2054, E_CRITICAL, __( 'User updated a custom field value for a post', 'wp-security-audit-log' ), __( 'Modified the value of the custom field %MetaKey% from %MetaValueOld% to %MetaValueNew% in the %PostStatus% %PostType% titled %PostTitle%. URL is: %PostUrl%. %EditorLinkPost%.<br>%MetaLink%.', 'wp-security-audit-log' ) ),
155
+ array( 2055, E_CRITICAL, __( 'User deleted a custom field from a post', 'wp-security-audit-log' ), __( 'Deleted the custom field %MetaKey% with value %MetaValue% from %PostStatus% %PostType% titled %PostTitle%. URL is: %PostUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
156
+ array( 2062, E_CRITICAL, __( 'User updated a custom field name for a post', 'wp-security-audit-log' ), __( 'Changed the custom field\'s name from %MetaKeyOld% to %MetaKeyNew% in the %PostStatus% %PostType% titled %PostTitle%. URL is: %PostUrl%. %EditorLinkPost%.<br>%MetaLink%.', 'wp-security-audit-log' ) ),
157
+ array( 2065, E_WARNING, __( 'User modified the content of a post.', 'wp-security-audit-log' ), __( 'Modified the content of the %PostStatus% %PostType% titled %PostTitle%. Post URL is %PostUrl%. %RevisionLink% %EditorLinkPost%.', 'wp-security-audit-log' ) ),
158
+ array( 2073, E_NOTICE, __( 'User submitted a post for review', 'wp-security-audit-log' ), __( 'Submitted the %PostType% titled %PostTitle% for review. URL is: %PostUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
159
+ array( 2074, E_NOTICE, __( 'User scheduled a post', 'wp-security-audit-log' ), __( 'Scheduled the %PostType% titled %PostTitle% to be published on %PublishingDate%. URL is: %PostUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
160
+ array( 2086, E_NOTICE, __( 'User changed title of a post', 'wp-security-audit-log' ), __( 'Changed the title of the %PostStatus% %PostType% from %OldTitle% to %NewTitle%. URL is: %PostUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
161
+ array( 2100, E_NOTICE, __( 'User opened a post in the editor', 'wp-security-audit-log' ), __( 'Opened the %PostStatus% %PostType% titled %PostTitle% in the editor. URL is: %PostUrl%. View the post: %EditorLinkPost%.', 'wp-security-audit-log' ) ),
162
+ array( 2101, E_NOTICE, __( 'User viewed a post', 'wp-security-audit-log' ), __( 'Viewed the %PostStatus% %PostType% titled %PostTitle%. URL is: %PostUrl%. View the post: %EditorLinkPost%.', 'wp-security-audit-log' ) ),
163
+ array( 2106, E_NOTICE, __( 'A plugin modified a post', 'wp-security-audit-log' ), __( 'Plugin modified the %PostStatus% %PostType% titled %PostTitle% of type %PostType%. URL is: %PostUrl%. View the post: %EditorLinkPost%.', 'wp-security-audit-log' ) ),
164
+ array( 2111, E_NOTICE, __( 'User disabled Comments/Trackbacks and Pingbacks in a post.', 'wp-security-audit-log' ), __( 'Disabled %Type% on the %PostStatus% %PostType% titled %PostTitle%. URL is: %PostUrl%. View the post: %EditorLinkPost%.', 'wp-security-audit-log' ) ),
165
+ array( 2112, E_NOTICE, __( 'User enabled Comments/Trackbacks and Pingbacks in a post.', 'wp-security-audit-log' ), __( 'Enabled %Type% on the %PostStatus% %PostType% titled %PostTitle%. URL is: %PostUrl%. View the post: %EditorLinkPost%.', 'wp-security-audit-log' ) ),
166
+ array( 2119, E_NOTICE, __( 'User added post tag', 'wp-security-audit-log' ), __( 'Added the tag %tag% to the %PostStatus% post titled %PostTitle%. URL is: %PostUrl%. View the post: %EditorLinkPost%.', 'wp-security-audit-log' ) ),
167
+ array( 2120, E_NOTICE, __( 'User removed post tag', 'wp-security-audit-log' ), __( 'Removed the tag %tag% from the %PostStatus% post titled %PostTitle%. URL is: %PostUrl%. View the post: %EditorLinkPost%.', 'wp-security-audit-log' ) ),
168
+ array( 2121, E_NOTICE, __( 'User created new tag', 'wp-security-audit-log' ), __( 'Added a new tag called %TagName%. View the tag: %TagLink%.', 'wp-security-audit-log' ) ),
169
+ array( 2122, E_NOTICE, __( 'User deleted tag', 'wp-security-audit-log' ), __( 'Deleted the tag %TagName%.', 'wp-security-audit-log' ) ),
170
+ array( 2123, E_NOTICE, __( 'User renamed tag', 'wp-security-audit-log' ), __( 'Renamed a tag from %old_name% to %new_name%. View the tag: %TagLink%.', 'wp-security-audit-log' ) ),
171
+ array( 2124, E_NOTICE, __( 'User changed tag slug', 'wp-security-audit-log' ), __( 'Changed the slug of tag %tag% from %old_slug% to %new_slug%. View the tag: %TagLink%.', 'wp-security-audit-log' ) ),
172
+ array( 2125, E_NOTICE, __( 'User changed tag description', 'wp-security-audit-log' ), __( 'Changed the description of the tag %tag% from %old_desc% to %new_desc%. View the tag: %TagLink%.', 'wp-security-audit-log' ) ),
 
 
 
173
  ),
174
  __( 'Comments', 'wp-security-audit-log' ) => array(
175
  array( 2090, E_NOTICE, __( 'User approved a comment', 'wp-security-audit-log' ), __( 'Approved the comment posted in response to the post %PostTitle% by %Author% on %CommentLink%.', 'wp-security-audit-log' ) ),
184
  array( 2099, E_NOTICE, __( 'User posted a comment', 'wp-security-audit-log' ), __( '%CommentMsg% on %CommentLink%.', 'wp-security-audit-log' ) ),
185
  ),
186
  __( 'Custom Post Types', 'wp-security-audit-log' ) => array(
187
+ array( 2003, E_NOTICE, __( 'User modified a draft blog post', 'wp-security-audit-log' ), __( 'Modified the draft post with the %PostTitle%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
188
  array( 2029, E_NOTICE, __( 'User created a new post with custom post type and saved it as draft', 'wp-security-audit-log' ), __( 'Created a new custom post called %PostTitle% of type %PostType%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
189
  array( 2030, E_NOTICE, __( 'User published a post with custom post type', 'wp-security-audit-log' ), __( 'Published a custom post %PostTitle% of type %PostType%. Post URL is %PostUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
190
  array( 2031, E_NOTICE, __( 'User modified a post with custom post type', 'wp-security-audit-log' ), __( 'Modified the custom post %PostTitle% of type %PostType%. Post URL is %PostUrl%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
203
  array( 2058, E_CRITICAL, __( 'User deleted a custom field from a custom post type', 'wp-security-audit-log' ), __( 'Deleted the custom field %MetaKey% with id %MetaID% from custom post %PostTitle% of type %PostType%' . ' %EditorLinkPost%.' . '<br>%MetaLink%.', 'wp-security-audit-log' ) ),
204
  array( 2063, E_CRITICAL, __( 'User updated a custom field name for a custom post type', 'wp-security-audit-log' ), __( 'Changed the custom field name from %MetaKeyOld% to %MetaKeyNew% in custom post %PostTitle% of type %PostType%' . ' %EditorLinkPost%.' . '<br>%MetaLink%.', 'wp-security-audit-log' ) ),
205
  array( 2067, E_WARNING, __( 'User modified content for a published custom post type', 'wp-security-audit-log' ), __( 'Modified the content of the published custom post type %PostTitle%. Post URL is %PostUrl%.' . '%EditorLinkPost%.', 'wp-security-audit-log' ) ),
206
+ array( 2068, E_NOTICE, __( 'User modified content for a draft post', 'wp-security-audit-log' ), __( 'Modified the content of the draft post %PostTitle%.' . '%RevisionLink%' . ' %EditorLinkPost%.', 'wp-security-audit-log' ) ),
207
  array( 2070, E_NOTICE, __( 'User modified content for a draft custom post type', 'wp-security-audit-log' ), __( 'Modified the content of the draft custom post type %PostTitle%.' . '%EditorLinkPost%.', 'wp-security-audit-log' ) ),
208
+ array( 2072, E_NOTICE, __( 'User modified content of a post', 'wp-security-audit-log' ), __( 'Modified the content of post %PostTitle% which is submitted for review.' . '%RevisionLink%' . ' %EditorLinkPost%.', 'wp-security-audit-log' ) ),
209
  array( 2076, E_NOTICE, __( 'User scheduled a custom post type', 'wp-security-audit-log' ), __( 'Scheduled the custom post type %PostTitle% to be published %PublishingDate%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
210
  array( 2088, E_NOTICE, __( 'User changed title of a custom post type', 'wp-security-audit-log' ), __( 'Changed the title of the custom post %OldTitle% to %NewTitle%. %EditorLinkPost%.', 'wp-security-audit-log' ) ),
211
  array( 2104, E_NOTICE, __( 'User opened a custom post type in the editor', 'wp-security-audit-log' ), __( 'Opened the custom post %PostTitle% of type %PostType% in the editor. View the post: %EditorLinkPost%.', 'wp-security-audit-log' ) ),
224
  array( 2022, E_NOTICE, __( 'User changed page status', 'wp-security-audit-log' ), __( 'Changed the status of the page %PostTitle% from %OldStatus% to %NewStatus%. %EditorLinkPage%.', 'wp-security-audit-log' ) ),
225
  array( 2026, E_WARNING, __( 'User changed the visibility of a page post', 'wp-security-audit-log' ), __( 'Changed the visibility of the page %PostTitle% from %OldVisibility% to %NewVisibility%. %EditorLinkPage%.', 'wp-security-audit-log' ) ),
226
  array( 2028, E_NOTICE, __( 'User changed the date of a page post', 'wp-security-audit-log' ), __( 'Changed the date of the page %PostTitle% from %OldDate% to %NewDate%. %EditorLinkPage%.', 'wp-security-audit-log' ) ),
 
 
227
  array( 2059, E_CRITICAL, __( 'User created a custom field for a page', 'wp-security-audit-log' ), __( 'Created a new custom field called %MetaKey% with value %MetaValue% in the page %PostTitle%' . ' %EditorLinkPage%.' . '<br>%MetaLink%.', 'wp-security-audit-log' ) ),
228
  array( 2060, E_CRITICAL, __( 'User updated a custom field value for a page', 'wp-security-audit-log' ), __( 'Modified the value of the custom field %MetaKey% from %MetaValueOld% to %MetaValueNew% in the page %PostTitle%' . ' %EditorLinkPage%.' . '<br>%MetaLink%.', 'wp-security-audit-log' ) ),
229
  array( 2061, E_CRITICAL, __( 'User deleted a custom field from a page', 'wp-security-audit-log' ), __( 'Deleted the custom field %MetaKey% with id %MetaID% from page %PostTitle%' . ' %EditorLinkPage%.' . '<br>%MetaLink%.', 'wp-security-audit-log' ) ),
234
  array( 2087, E_NOTICE, __( 'User changed title of a page', 'wp-security-audit-log' ), __( 'Changed the title of the page %OldTitle% to %NewTitle%.' . ' %EditorLinkPage%.', 'wp-security-audit-log' ) ),
235
  array( 2102, E_NOTICE, __( 'User opened a page in the editor', 'wp-security-audit-log' ), __( 'Opened the page %PostTitle% in the editor. View the page: %EditorLinkPage%.', 'wp-security-audit-log' ) ),
236
  array( 2103, E_NOTICE, __( 'User viewed a page', 'wp-security-audit-log' ), __( 'Viewed the page %PostTitle%. View the page: %PostUrl%.', 'wp-security-audit-log' ) ),
237
+ array( 2113, E_NOTICE, __( 'User disabled Comments/Trackbacks and Pingbacks on a draft post', 'wp-security-audit-log' ), __( 'Disabled %Type% on the draft post %PostTitle%. View the post: %PostUrl%.', 'wp-security-audit-log' ) ),
238
+ array( 2114, E_NOTICE, __( 'User enabled Comments/Trackbacks and Pingbacks on a draft post', 'wp-security-audit-log' ), __( 'Enabled %Type% on the draft post %PostTitle%. View the post: %PostUrl%.', 'wp-security-audit-log' ) ),
239
  array( 2115, E_NOTICE, __( 'User disabled Comments/Trackbacks and Pingbacks on a published page', 'wp-security-audit-log' ), __( 'Disabled %Type% on the published page %PostTitle%. View the page: %PostUrl%.', 'wp-security-audit-log' ) ),
240
  array( 2116, E_NOTICE, __( 'User enabled Comments/Trackbacks and Pingbacks on a published page', 'wp-security-audit-log' ), __( 'Enabled %Type% on the published page %PostTitle%. View the page: %PostUrl%.', 'wp-security-audit-log' ) ),
241
  array( 2117, E_NOTICE, __( 'User disabled Comments/Trackbacks and Pingbacks on a draft page', 'wp-security-audit-log' ), __( 'Disabled %Type% on the draft page %PostTitle%. View the page: %PostUrl%.', 'wp-security-audit-log' ) ),
279
  array( 5005, E_WARNING, __( 'User installed a theme', 'wp-security-audit-log' ), __( 'Installed the theme "%Theme->Name%" in %Theme->get_template_directory%.', 'wp-security-audit-log' ) ),
280
  array( 5006, E_CRITICAL, __( 'User activated a theme', 'wp-security-audit-log' ), __( 'Activated the theme "%Theme->Name%", installed in %Theme->get_template_directory%.', 'wp-security-audit-log' ) ),
281
  array( 5007, E_CRITICAL, __( 'User uninstalled a theme', 'wp-security-audit-log' ), __( 'Deleted the theme "%Theme->Name%" installed in %Theme->get_template_directory%.', 'wp-security-audit-log' ) ),
282
+ array( 5019, E_CRITICAL, __( 'A plugin created a post', 'wp-security-audit-log' ), __( 'A plugin automatically created the following %PostType% called %PostTitle%. View the post: %EditorLinkPost%.', 'wp-security-audit-log' ) ),
283
  array( 5020, E_CRITICAL, __( 'A plugin created a page', 'wp-security-audit-log' ), __( 'A plugin automatically created the following page: %PostTitle%.', 'wp-security-audit-log' ) ),
284
  array( 5021, E_CRITICAL, __( 'A plugin created a custom post', 'wp-security-audit-log' ), __( 'A plugin automatically created the following custom post: %PostTitle%.', 'wp-security-audit-log' ) ),
285
+ array( 5025, E_CRITICAL, __( 'A plugin deleted a post', 'wp-security-audit-log' ), __( 'A plugin automatically deleted the following %PostType% called %PostTitle%.', 'wp-security-audit-log' ) ),
286
  array( 5026, E_CRITICAL, __( 'A plugin deleted a page', 'wp-security-audit-log' ), __( 'A plugin automatically deleted the following page: %PostTitle%.', 'wp-security-audit-log' ) ),
287
  array( 5027, E_CRITICAL, __( 'A plugin deleted a custom post', 'wp-security-audit-log' ), __( 'A plugin automatically deleted the following custom post: %PostTitle%.', 'wp-security-audit-log' ) ),
288
  array( 5031, E_WARNING, __( 'User updated a theme', 'wp-security-audit-log' ), __( 'Updated the theme "%Theme->Name%" installed in %Theme->get_template_directory%.', 'wp-security-audit-log' ) ),
289
  array( 2046, E_CRITICAL, __( 'User changed a file using the theme editor', 'wp-security-audit-log' ), __( 'Modified %File% with the Theme Editor.', 'wp-security-audit-log' ) ),
290
  array( 2051, E_CRITICAL, __( 'User changed a file using the plugin editor', 'wp-security-audit-log' ), __( 'Modified %File% with the Plugin Editor.', 'wp-security-audit-log' ) ),
 
291
  array( 2107, E_NOTICE, __( 'A plugin modified a page', 'wp-security-audit-log' ), __( 'Plugin modified the page %PostTitle%. View the page: %EditorLinkPage%.', 'wp-security-audit-log' ) ),
292
  array( 2108, E_NOTICE, __( 'A plugin modified a custom post', 'wp-security-audit-log' ), __( 'Plugin modified the custom post %PostTitle%. View the post: %EditorLinkPost%.', 'wp-security-audit-log' ) ),
293
  ),
languages/wp-security-audit-log-it_IT.mo CHANGED
Binary file
readme.txt CHANGED
@@ -5,8 +5,8 @@ License: GPLv3
5
  License URI: http://www.gnu.org/licenses/gpl.html
6
  Tags: wordpress security plugin, wordpress security audit log, audit log, event log wordpress, wordpress user tracking, wordpress activity log, wordpress audit, security event log, audit trail, wordpress security monitor, wordpress admin, wordpress admin monitoring, user activity, admin, multisite, dashboard, notification, wordpress monitoring, email notification, wordpress email alerts, tracking, user tracking, user activity report, wordpress audit trail
7
  Requires at least: 3.6
8
- Tested up to: 4.9.2
9
- Stable tag: 3.0.1
10
  Requires PHP: 5.3
11
 
12
  Keep an audit trail of all changes on your WordPress - ensure productivity & thwart attacks with the most comprehensive audit trail plugin.
@@ -179,18 +179,29 @@ Please refer to our [Support & Documentation pages](https://www.wpsecurityauditl
179
 
180
  == Changelog ==
181
 
182
- =3.0.1 (2018-01-31)
183
 
184
  * **New Features**
185
- * Added a new editable message that is shown on login page alerting users that their actions are logged (plugin is GDPR compliant).
186
- *
 
 
 
 
187
 
188
  * **Improvements**
189
- * Changed the name of a setting from "Security Alerts Pruning" to "Audit Log Retention" (using correct terms for GDPR compliance).
 
 
 
 
 
 
 
 
190
 
191
  * **Bug Fixes**
192
- * Updated Freemius SDK - Freemius was not firing on new installs.
193
- * Fixed an issue where a URL was reported as NULL in email alerts (PREMIUM).
194
- * Removed promo alerts when premium add-ons are installed.
195
 
196
  Refer to the [WP Security Audit Log change log](https://www.wpsecurityauditlog.com/plugin-change-log/) page for the complete change log.
5
  License URI: http://www.gnu.org/licenses/gpl.html
6
  Tags: wordpress security plugin, wordpress security audit log, audit log, event log wordpress, wordpress user tracking, wordpress activity log, wordpress audit, security event log, audit trail, wordpress security monitor, wordpress admin, wordpress admin monitoring, user activity, admin, multisite, dashboard, notification, wordpress monitoring, email notification, wordpress email alerts, tracking, user tracking, user activity report, wordpress audit trail
7
  Requires at least: 3.6
8
+ Tested up to: 4.9.4
9
+ Stable tag: 3.1.0
10
  Requires PHP: 5.3
11
 
12
  Keep an audit trail of all changes on your WordPress - ensure productivity & thwart attacks with the most comprehensive audit trail plugin.
179
 
180
  == Changelog ==
181
 
182
+ = 3.1.0(2018-02-28)
183
 
184
  * **New Features**
185
+ * Added Post Status and Post Type in alerts.
186
+ * Consolidated all Posts / Pages / Custom Post alerts [Read more](https://www.wpsecurityauditlog.com/wordpress-user-monitoring-plugin-releases/version-3-1-post-type-status-alerts/).
187
+ * Added Post Status and Post Type filters in search.
188
+ * Added Post Status and Post Type criteria in Email Notifications trigger builder.
189
+ * Added Post Status and Post Type criteria in Reports.
190
+ * Fallback system for display names - when user does not have first and last name, the username will be used.
191
 
192
  * **Improvements**
193
+ * Improved the priority of our hooks so logins from custom forms are captured (e.g. better support for Restrict Content PRO and similar plugins).
194
+ * Improved the tabs / UI of the Enable/Disable Alerts section.
195
+ * Changed the column Type to Severity in Audit Log viewer.
196
+ * Better handling of errors and variables during plugin activation.
197
+ * Consolidated Post ID, Page ID and Custom Post ID in just Post ID in Email notifications trigger builder.
198
+ * Improved the look & feel of the login page notification (GDPR compliance).
199
+ * Improved the UI and queries used for the Users Sessions management.
200
+ * Added the IP address requesting the non-existing page in the 404 log files.
201
+ * Users can now specify the number of 404 and failed login alerts before being alerted in the built-in alerts section.
202
 
203
  * **Bug Fixes**
204
+ * Removed a Disable All Logging option from plugin settings - was redundant.
205
+ * Improved handling of global arrays [support ticket](https://wordpress.org/support/topic/notice-undefined-index-script_name-sensors-content-php-on-line-1499/#post-10004967)
 
206
 
207
  Refer to the [WP Security Audit Log change log](https://www.wpsecurityauditlog.com/plugin-change-log/) page for the complete change log.
sdk/freemius/.gitignore DELETED
@@ -1,16 +0,0 @@
1
- output/
2
- assets/img/icon.*
3
-
4
- pootle-page-builder.png
5
- rating-widget.jpg
6
- hello-dolly-pro.png
7
- woocommerce-fiscalita-italiana.png
8
- assets/img/content-aware-sidebars.png
9
- assets/img/custom-post-type-ui.png
10
- .idea
11
- nextgen-gallery.png
12
- node_modules
13
- languages/_freemius-en.mo
14
- languages/_freemius-en.po
15
- foobox-image-lightbox.png
16
- transifex-config.json
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
sdk/wsal-freemius.php CHANGED
@@ -31,18 +31,18 @@ if ( file_exists( dirname( __FILE__ ) . '/freemius/start.php' ) ) {
31
  require_once dirname( __FILE__ ) . '/freemius/start.php';
32
 
33
  $wsal_freemius = fs_dynamic_init( array(
34
- 'id' => '94',
35
- 'slug' => 'wp-security-audit-log',
36
- 'type' => 'plugin',
37
- 'public_key' => 'pk_d602740d3088272d75906045af9fa',
38
- 'is_premium' => false,
39
- 'has_addons' => false,
40
  'has_paid_plans' => true,
41
- 'menu' => array(
42
- 'slug' => 'wsal-auditlog',
43
  'support' => false,
44
  ),
45
- 'live' => true,
46
  ) );
47
  }
48
 
31
  require_once dirname( __FILE__ ) . '/freemius/start.php';
32
 
33
  $wsal_freemius = fs_dynamic_init( array(
34
+ 'id' => '94',
35
+ 'slug' => 'wp-security-audit-log',
36
+ 'type' => 'plugin',
37
+ 'public_key' => 'pk_d602740d3088272d75906045af9fa',
38
+ 'is_premium' => false,
39
+ 'has_addons' => false,
40
  'has_paid_plans' => true,
41
+ 'menu' => array(
42
+ 'slug' => 'wsal-auditlog',
43
  'support' => false,
44
  ),
45
+ 'live' => true,
46
  ) );
47
  }
48
 
wp-security-audit-log.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: http://www.wpsecurityauditlog.com/
5
  * Description: Identify WordPress security issues before they become a problem. Keep track of everything happening on your WordPress including WordPress users activity. Similar to Windows Event Log and Linux Syslog, WP Security Audit Log generates a security alert for everything that happens on your WordPress blogs and websites. Use the Audit Log Viewer included in the plugin to see all the security alerts.
6
  * Author: WP White Security
7
- * Version: 3.0.1
8
  * Text Domain: wp-security-audit-log
9
  * Author URI: http://www.wpsecurityauditlog.com/
10
  * License: GPL2
@@ -54,7 +54,7 @@ if ( ! function_exists( 'wsal_freemius' ) ) {
54
  *
55
  * @var string
56
  */
57
- public $version = '3.0.1';
58
 
59
  // Plugin constants.
60
  const PLG_CLS_PRFX = 'WSAL_';
@@ -222,6 +222,11 @@ if ( ! function_exists( 'wsal_freemius' ) ) {
222
  // Register freemius uninstall event.
223
  wsal_freemius()->add_action( 'after_uninstall', array( $this, 'wsal_freemius_uninstall_cleanup' ) );
224
 
 
 
 
 
 
225
  // Add filters to customize freemius welcome message.
226
  wsal_freemius()->add_filter( 'connect_message', array( $this, 'wsal_freemius_connect_message' ), 10, 6 );
227
  wsal_freemius()->add_filter( 'connect_message_on_update', array( $this, 'wsal_freemius_update_connect_message' ), 10, 6 );
@@ -243,6 +248,9 @@ if ( ! function_exists( 'wsal_freemius' ) ) {
243
  'br' => array(),
244
  'em' => array(),
245
  'strong' => array(),
 
 
 
246
  );
247
  }
248
 
@@ -278,6 +286,25 @@ if ( ! function_exists( 'wsal_freemius' ) ) {
278
  }
279
  }
280
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
  /**
282
  * Customize Freemius connect message for new users.
283
  *
@@ -580,6 +607,13 @@ if ( ! function_exists( 'wsal_freemius' ) ) {
580
  // Install cleanup hook (remove older one if it exists).
581
  wp_clear_scheduled_hook( 'wsal_cleanup' );
582
  wp_schedule_event( current_time( 'timestamp' ) + 600, 'hourly', 'wsal_cleanup' );
 
 
 
 
 
 
 
583
  }
584
 
585
  /**
@@ -1078,13 +1112,32 @@ if ( ! function_exists( 'wsal_freemius' ) ) {
1078
 
1079
  // Default message.
1080
  if ( ! $message ) {
1081
- $message = wp_kses( __( 'For security and auditing purposes, a record of all of your logged-in actions and changes within the WordPress dashboard will be recorded in an audit log with the <a href="https://www.wpsecurityauditlog.com/" target="_blank">WP Security Audit Log plugin</a>. The audit log also includes the IP address where you accessed this site from.', 'wp-security-audit-log' ), $this->allowed_html_tags );
 
 
1082
  }
1083
  }
 
1084
  // Return message.
1085
  return $message;
1086
  }
1087
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1088
  }
1089
 
1090
  // Profile WSAL load time.
4
  * Plugin URI: http://www.wpsecurityauditlog.com/
5
  * Description: Identify WordPress security issues before they become a problem. Keep track of everything happening on your WordPress including WordPress users activity. Similar to Windows Event Log and Linux Syslog, WP Security Audit Log generates a security alert for everything that happens on your WordPress blogs and websites. Use the Audit Log Viewer included in the plugin to see all the security alerts.
6
  * Author: WP White Security
7
+ * Version: 3.1.0
8
  * Text Domain: wp-security-audit-log
9
  * Author URI: http://www.wpsecurityauditlog.com/
10
  * License: GPL2
54
  *
55
  * @var string
56
  */
57
+ public $version = '3.1.0';
58
 
59
  // Plugin constants.
60
  const PLG_CLS_PRFX = 'WSAL_';
222
  // Register freemius uninstall event.
223
  wsal_freemius()->add_action( 'after_uninstall', array( $this, 'wsal_freemius_uninstall_cleanup' ) );
224
 
225
+ // Include premium extensions through freemius.
226
+ if ( wsal_freemius()->is_plan__premium_only( 'starter' ) ) {
227
+ $this->include_extensions__premium_only();
228
+ }
229
+
230
  // Add filters to customize freemius welcome message.
231
  wsal_freemius()->add_filter( 'connect_message', array( $this, 'wsal_freemius_connect_message' ), 10, 6 );
232
  wsal_freemius()->add_filter( 'connect_message_on_update', array( $this, 'wsal_freemius_update_connect_message' ), 10, 6 );
248
  'br' => array(),
249
  'em' => array(),
250
  'strong' => array(),
251
+ 'p' => array(
252
+ 'class' => array(),
253
+ ),
254
  );
255
  }
256
 
286
  }
287
  }
288
 
289
+ /**
290
+ * Method: Include extensions for premium version.
291
+ *
292
+ * @since 2.7.0
293
+ */
294
+ public function include_extensions__premium_only() {
295
+ /**
296
+ * Class for extensions managment.
297
+ *
298
+ * @since 2.7.0
299
+ */
300
+ if ( file_exists( WSAL_BASE_DIR . '/extensions/class-wsal-extension-manager.php' ) ) {
301
+ require_once( WSAL_BASE_DIR . '/extensions/class-wsal-extension-manager.php' );
302
+ }
303
+
304
+ // Initiate the extensions manager.
305
+ $this->extensions = new WSAL_Extension_Manager( $this );
306
+ }
307
+
308
  /**
309
  * Customize Freemius connect message for new users.
310
  *
607
  // Install cleanup hook (remove older one if it exists).
608
  wp_clear_scheduled_hook( 'wsal_cleanup' );
609
  wp_schedule_event( current_time( 'timestamp' ) + 600, 'hourly', 'wsal_cleanup' );
610
+
611
+ if ( wsal_freemius()->is__premium_only() ) {
612
+ // Call to user sessions management activation hook function.
613
+ if ( wsal_freemius()->is_premium() && wsal_freemius()->is_registered() && wsal_freemius()->can_use_premium_code() ) {
614
+ $this->extensions->activate_sessions_management();
615
+ }
616
+ }
617
  }
618
 
619
  /**
1112
 
1113
  // Default message.
1114
  if ( ! $message ) {
1115
+ $message = wp_kses( __( '<p class="message">For security and auditing purposes, a record of all of your logged-in actions and changes within the WordPress dashboard will be recorded in an audit log with the <a href="https://www.wpsecurityauditlog.com/" target="_blank">WP Security Audit Log plugin</a>. The audit log also includes the IP address where you accessed this site from.</p>', 'wp-security-audit-log' ), $this->allowed_html_tags );
1116
+ } else {
1117
+ $message = '<p class="message">' . $message . '</p>';
1118
  }
1119
  }
1120
+
1121
  // Return message.
1122
  return $message;
1123
  }
1124
 
1125
+ /**
1126
+ * Error Logger
1127
+ *
1128
+ * Logs given input into debug.log file in debug mode.
1129
+ *
1130
+ * @param mix $message - Error message.
1131
+ */
1132
+ function wsal_log( $message ) {
1133
+ if ( WP_DEBUG === true ) {
1134
+ if ( is_array( $message ) || is_object( $message ) ) {
1135
+ error_log( print_r( $message, true ) );
1136
+ } else {
1137
+ error_log( $message );
1138
+ }
1139
+ }
1140
+ }
1141
  }
1142
 
1143
  // Profile WSAL load time.