WP Security Audit Log - Version 1.1.0

Version Description

(2014-05-27) = * New Features * User avatar is shown in the alert to allow administrators to easily recognize users and their activity
* Clickable username in alerts allow administrators to access user's profile instantly * User role is reported in alert so administrators can easily track any suspicious behaviour * PHP Version checker; upon installation the plugin will check what version of PHP is installed on the system

  • New WordPress Security Alert for monitoring plugin files

    • Alert 2051: User changed a plugin file using the plugin editor (note: filename and location will also be reported in the alert)
  • Bug fixes

    • Fixed wrapping problem in alerts dashboard widget
    • Fixed upgrade script to properly create the new tables in the WordPress database
Download this release

Release Info

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

Code changes from version 1.0 to 1.1.0

classes/AlertManager.php CHANGED
@@ -37,6 +37,12 @@ final class WSAL_AlertManager {
37
  */
38
  protected $_pipeline = array();
39
 
 
 
 
 
 
 
40
  /**
41
  * Trigger an alert.
42
  * @param integer $type Alert type.
@@ -64,6 +70,7 @@ final class WSAL_AlertManager {
64
  );
65
  }
66
 
 
67
  /**
68
  * @internal Commit an alert now.
69
  */
@@ -72,6 +79,7 @@ final class WSAL_AlertManager {
72
  if($this->IsEnabled($type)){
73
  if(isset($this->_alerts[$type])){
74
  // ok, convert alert to a log entry
 
75
  $this->Log($type, $data);
76
  }else{
77
  // in general this shouldn't happen, but it could, so we handle it here :)
@@ -100,6 +108,15 @@ final class WSAL_AlertManager {
100
  return false;
101
  }
102
 
 
 
 
 
 
 
 
 
 
103
  /**
104
  * Register an alert type.
105
  * @param array $info Array of [type, code, category, description, message] respectively.
@@ -169,6 +186,8 @@ final class WSAL_AlertManager {
169
  $data['UserAgent'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
170
  if(!isset($data['CurrentUserID']))
171
  $data['CurrentUserID'] = function_exists('get_current_user_id') ? get_current_user_id() : 0;
 
 
172
 
173
  foreach($this->_loggers as $logger)
174
  $logger->Log($type, $data);
37
  */
38
  protected $_pipeline = array();
39
 
40
+ /**
41
+ * Contains an array of alerts that have been triggered for this request.
42
+ * @var int[]
43
+ */
44
+ protected $_triggered_types = array();
45
+
46
  /**
47
  * Trigger an alert.
48
  * @param integer $type Alert type.
70
  );
71
  }
72
 
73
+
74
  /**
75
  * @internal Commit an alert now.
76
  */
79
  if($this->IsEnabled($type)){
80
  if(isset($this->_alerts[$type])){
81
  // ok, convert alert to a log entry
82
+ $this->_triggered_types[] = $type;
83
  $this->Log($type, $data);
84
  }else{
85
  // in general this shouldn't happen, but it could, so we handle it here :)
108
  return false;
109
  }
110
 
111
+ /**
112
+ * @param int $type Alert type ID.
113
+ * @return boolean True if an alert has been or will be triggered in this request, false otherwise.
114
+ */
115
+ public function WillOrHasTriggered($type){
116
+ return in_array($type, $this->_triggered_types)
117
+ || $this->WillTrigger($type);
118
+ }
119
+
120
  /**
121
  * Register an alert type.
122
  * @param array $info Array of [type, code, category, description, message] respectively.
186
  $data['UserAgent'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
187
  if(!isset($data['CurrentUserID']))
188
  $data['CurrentUserID'] = function_exists('get_current_user_id') ? get_current_user_id() : 0;
189
+ if(!isset($data['CurrentUserRoles']) && is_user_logged_in())
190
+ $data['CurrentUserRoles'] = wp_get_current_user()->roles;
191
 
192
  foreach($this->_loggers as $logger)
193
  $logger->Log($type, $data);
classes/DB/Occurrence.php CHANGED
@@ -192,6 +192,9 @@ class WSAL_DB_Occurrence extends WSAL_DB_ActiveRecord {
192
  return parent::Delete();
193
  }
194
 
 
 
 
195
  public function GetUsername(){
196
  $meta = $this->GetFirstNamedMeta(array('Username', 'CurrentUserID'));
197
  if($meta){
@@ -205,8 +208,18 @@ class WSAL_DB_Occurrence extends WSAL_DB_ActiveRecord {
205
  return null;
206
  }
207
 
 
 
 
208
  public function GetSourceIP(){
209
  return $this->GetMetaValue('ClientIP', '');
210
  }
211
 
 
 
 
 
 
 
 
212
  }
192
  return parent::Delete();
193
  }
194
 
195
+ /**
196
+ * @return string User's username.
197
+ */
198
  public function GetUsername(){
199
  $meta = $this->GetFirstNamedMeta(array('Username', 'CurrentUserID'));
200
  if($meta){
208
  return null;
209
  }
210
 
211
+ /**
212
+ * @return string IP address of request.
213
+ */
214
  public function GetSourceIP(){
215
  return $this->GetMetaValue('ClientIP', '');
216
  }
217
 
218
+ /**
219
+ * @return array Array of user roles.
220
+ */
221
+ public function GetUserRoles(){
222
+ return $this->GetMetaValue('CurrentUserRoles', array());
223
+ }
224
+
225
  }
classes/Sensors/Content.php CHANGED
@@ -321,19 +321,19 @@ class WSAL_Sensors_Content extends WSAL_AbstractSensor {
321
  $newVisibility = '';
322
 
323
  if($oldpost->post_password){
324
- $oldVisibility = __('Password Protected');
325
  }elseif($oldStatus == 'publish'){
326
- $oldVisibility = __('Public');
327
  }elseif($oldStatus == 'private'){
328
- $oldVisibility = __('Private');
329
  }
330
 
331
  if($newpost->post_password){
332
- $newVisibility = __('Password Protected');
333
  }elseif($newStatus == 'publish'){
334
- $newVisibility = __('Public');
335
  }elseif($newStatus == 'private'){
336
- $newVisibility = __('Private');
337
  }
338
 
339
  if($oldVisibility && $newVisibility && ($oldVisibility != $newVisibility)){
321
  $newVisibility = '';
322
 
323
  if($oldpost->post_password){
324
+ $oldVisibility = __('Password Protected', 'wp-security-audit-log');
325
  }elseif($oldStatus == 'publish'){
326
+ $oldVisibility = __('Public', 'wp-security-audit-log');
327
  }elseif($oldStatus == 'private'){
328
+ $oldVisibility = __('Private', 'wp-security-audit-log');
329
  }
330
 
331
  if($newpost->post_password){
332
+ $newVisibility = __('Password Protected', 'wp-security-audit-log');
333
  }elseif($newStatus == 'publish'){
334
+ $newVisibility = __('Public', 'wp-security-audit-log');
335
  }elseif($newStatus == 'private'){
336
+ $newVisibility = __('Private', 'wp-security-audit-log');
337
  }
338
 
339
  if($oldVisibility && $newVisibility && ($oldVisibility != $newVisibility)){
classes/Sensors/Files.php CHANGED
@@ -36,12 +36,21 @@ class WSAL_Sensors_Files extends WSAL_AbstractSensor {
36
  public function EventAdminInit(){
37
  $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
38
  $is_theme_editor = basename($_SERVER['SCRIPT_NAME']) == 'theme-editor.php';
 
 
39
  if($is_theme_editor && $action == 'update'){
40
  $this->plugin->alerts->Trigger(2046, array(
41
  'File' => $_REQUEST['file'],
42
  'Theme' => $_REQUEST['theme'],
43
  ));
44
  }
 
 
 
 
 
 
 
45
  }
46
 
47
  }
36
  public function EventAdminInit(){
37
  $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
38
  $is_theme_editor = basename($_SERVER['SCRIPT_NAME']) == 'theme-editor.php';
39
+ $is_plugin_editor = basename($_SERVER['SCRIPT_NAME']) == 'plugin-editor.php';
40
+
41
  if($is_theme_editor && $action == 'update'){
42
  $this->plugin->alerts->Trigger(2046, array(
43
  'File' => $_REQUEST['file'],
44
  'Theme' => $_REQUEST['theme'],
45
  ));
46
  }
47
+
48
+ if($is_plugin_editor && $action == 'update'){
49
+ $this->plugin->alerts->Trigger(2051, array(
50
+ 'File' => $_REQUEST['file'],
51
+ 'Plugin' => $_REQUEST['plugin'],
52
+ ));
53
+ }
54
  }
55
 
56
  }
classes/Sensors/LogInOut.php CHANGED
@@ -9,7 +9,10 @@ class WSAL_Sensors_LogInOut extends WSAL_AbstractSensor {
9
  }
10
 
11
  public function EventLogin($user_login, $user){
12
- $this->plugin->alerts->Trigger(1000, array('Username' => $user_login));
 
 
 
13
  }
14
 
15
  public function EventLogout(){
@@ -18,13 +21,17 @@ class WSAL_Sensors_LogInOut extends WSAL_AbstractSensor {
18
 
19
  public function EventLoginFailure($username){
20
  list($y, $m, $d) = explode('-', date('Y-m-d'));
 
 
 
 
21
  $occ = WSAL_DB_Occurrence::LoadMultiQuery('
22
- SELECT * FROM `wp_wsal_occurrences`
23
  WHERE alert_id = %d AND site_id = %d
24
  AND (created_on BETWEEN %d AND %d)
25
  AND id IN (
26
  SELECT occurrence_id as id
27
- FROM wp_wsal_metadata
28
  WHERE (name = "ClientIP" AND value = %s)
29
  OR (name = "Username" AND value = %s)
30
  GROUP BY occurrence_id
@@ -38,6 +45,7 @@ class WSAL_Sensors_LogInOut extends WSAL_AbstractSensor {
38
  json_encode(isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''),
39
  json_encode($username),
40
  ));
 
41
  $occ = count($occ) ? $occ[0] : null;
42
 
43
  if($occ && $occ->IsLoaded()){
9
  }
10
 
11
  public function EventLogin($user_login, $user){
12
+ $this->plugin->alerts->Trigger(1000, array(
13
+ 'Username' => $user_login,
14
+ 'CurrentUserRoles' => $user->roles,
15
+ ));
16
  }
17
 
18
  public function EventLogout(){
21
 
22
  public function EventLoginFailure($username){
23
  list($y, $m, $d) = explode('-', date('Y-m-d'));
24
+
25
+ $tt1 = new WSAL_DB_Occurrence();
26
+ $tt2 = new WSAL_DB_Meta();
27
+
28
  $occ = WSAL_DB_Occurrence::LoadMultiQuery('
29
+ SELECT * FROM `' . $tt1->GetTable() . '`
30
  WHERE alert_id = %d AND site_id = %d
31
  AND (created_on BETWEEN %d AND %d)
32
  AND id IN (
33
  SELECT occurrence_id as id
34
+ FROM `' . $tt2->GetTable() . '`
35
  WHERE (name = "ClientIP" AND value = %s)
36
  OR (name = "Username" AND value = %s)
37
  GROUP BY occurrence_id
45
  json_encode(isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''),
46
  json_encode($username),
47
  ));
48
+
49
  $occ = count($occ) ? $occ[0] : null;
50
 
51
  if($occ && $occ->IsLoaded()){
classes/Sensors/Multisite.php CHANGED
@@ -56,24 +56,28 @@ class WSAL_Sensors_Multisite extends WSAL_AbstractSensor {
56
  }
57
 
58
  public function EventUserAddedToBlog($user_id, $role, $blog_id){
59
- $this->plugin->alerts->Trigger(4010, array(
60
- 'UserID' => $user_id,
61
- 'Username' => get_userdata($user_id)->user_login,
62
- 'UserRole' => $role,
63
  'BlogID' => $blog_id,
64
  'SiteName' => get_blog_option($blog_id, 'blogname'),
65
- ));
66
  }
67
 
68
  public function EventUserRemovedFromBlog($user_id){
69
  $user = get_userdata($user_id);
70
  $blog_id = (isset($_REQUEST['id']) ? $_REQUEST['id'] : 0);
71
- $this->plugin->alerts->Trigger(4011, array(
72
- 'UserID' => $user_id,
73
- 'Username' => $user->user_login,
74
- 'UserRole' => is_array($user->roles) ? implode(', ', $user->roles) : $user->roles,
75
  'BlogID' => $blog_id,
76
  'SiteName' => get_blog_option($blog_id, 'blogname'),
77
- ));
 
 
 
 
78
  }
79
  }
56
  }
57
 
58
  public function EventUserAddedToBlog($user_id, $role, $blog_id){
59
+ $this->plugin->alerts->TriggerIf(4010, array(
60
+ 'TargetUserID' => $user_id,
61
+ 'TargetUsername' => get_userdata($user_id)->user_login,
62
+ 'TargetUserRole' => $role,
63
  'BlogID' => $blog_id,
64
  'SiteName' => get_blog_option($blog_id, 'blogname'),
65
+ ), array($this, 'MustNotContainCreateUser'));
66
  }
67
 
68
  public function EventUserRemovedFromBlog($user_id){
69
  $user = get_userdata($user_id);
70
  $blog_id = (isset($_REQUEST['id']) ? $_REQUEST['id'] : 0);
71
+ $this->plugin->alerts->TriggerIf(4011, array(
72
+ 'TargetUserID' => $user_id,
73
+ 'TargetUsername' => $user->user_login,
74
+ 'TargetUserRole' => is_array($user->roles) ? implode(', ', $user->roles) : $user->roles,
75
  'BlogID' => $blog_id,
76
  'SiteName' => get_blog_option($blog_id, 'blogname'),
77
+ ), array($this, 'MustNotContainCreateUser'));
78
+ }
79
+
80
+ public function MustNotContainCreateUser(WSAL_AlertManager $mgr){
81
+ return !$mgr->WillTrigger(4012);
82
  }
83
  }
classes/Sensors/UserProfile.php CHANGED
@@ -46,12 +46,12 @@ class WSAL_Sensors_UserProfile extends WSAL_AbstractSensor {
46
  $oldRole = count($oldRoles) ? implode(', ', $oldRoles) : '';
47
  $newRole = $role;
48
  if($oldRole != $newRole){
49
- $this->plugin->alerts->Trigger(4002, array(
50
  'TargetUserID' => $user_id,
51
  'TargetUsername' => $user->user_login,
52
  'OldRole' => $oldRole,
53
  'NewRole' => $newRole,
54
- ));
55
  }
56
  }
57
 
@@ -143,4 +143,13 @@ class WSAL_Sensors_UserProfile extends WSAL_AbstractSensor {
143
  public function MustNotContainCreateUser(WSAL_AlertManager $mgr){
144
  return !$mgr->WillTrigger(4012);
145
  }
 
 
 
 
 
 
 
 
 
146
  }
46
  $oldRole = count($oldRoles) ? implode(', ', $oldRoles) : '';
47
  $newRole = $role;
48
  if($oldRole != $newRole){
49
+ $this->plugin->alerts->TriggerIf(4002, array(
50
  'TargetUserID' => $user_id,
51
  'TargetUsername' => $user->user_login,
52
  'OldRole' => $oldRole,
53
  'NewRole' => $newRole,
54
+ ), array($this, 'MustNotContainUserChanges'));
55
  }
56
  }
57
 
143
  public function MustNotContainCreateUser(WSAL_AlertManager $mgr){
144
  return !$mgr->WillTrigger(4012);
145
  }
146
+
147
+ public function MustNotContainUserChanges(WSAL_AlertManager $mgr){
148
+ return !( $mgr->WillOrHasTriggered(4010)
149
+ || $mgr->WillOrHasTriggered(4011)
150
+ || $mgr->WillOrHasTriggered(4012)
151
+ || $mgr->WillOrHasTriggered(4000)
152
+ || $mgr->WillOrHasTriggered(4001)
153
+ );
154
+ }
155
  }
classes/ViewManager.php CHANGED
@@ -119,7 +119,7 @@ class WSAL_ViewManager {
119
  $view_id = $this->GetBackendPageIndex();
120
  ?><div class="wrap">
121
  <div id="icon-plugins" class="icon32"><br></div>
122
- <h2><?php _e($this->views[$view_id]->GetTitle()); ?></h2>
123
  <?php $this->views[$view_id]->Render(); ?>
124
  </div><?php
125
  }
119
  $view_id = $this->GetBackendPageIndex();
120
  ?><div class="wrap">
121
  <div id="icon-plugins" class="icon32"><br></div>
122
+ <h2><?php _e($this->views[$view_id]->GetTitle(), 'wp-security-audit-log'); ?></h2>
123
  <?php $this->views[$view_id]->Render(); ?>
124
  </div><?php
125
  }
classes/Views/About.php CHANGED
@@ -3,7 +3,7 @@
3
  class WSAL_Views_About extends WSAL_AbstractView {
4
 
5
  public function GetTitle() {
6
- return 'About WP Security Audit Log';
7
  }
8
 
9
  public function GetIcon() {
@@ -11,7 +11,7 @@ class WSAL_Views_About extends WSAL_AbstractView {
11
  }
12
 
13
  public function GetName() {
14
- return 'About';
15
  }
16
 
17
  public function GetWeight(){
3
  class WSAL_Views_About extends WSAL_AbstractView {
4
 
5
  public function GetTitle() {
6
+ return __('About WP Security Audit Log', 'wp-security-audit-log');
7
  }
8
 
9
  public function GetIcon() {
11
  }
12
 
13
  public function GetName() {
14
+ return __('About', 'wp-security-audit-log');
15
  }
16
 
17
  public function GetWeight(){
classes/Views/AuditLog.php CHANGED
@@ -17,7 +17,7 @@ class WSAL_Views_AuditLog extends WSAL_AbstractView {
17
  }
18
 
19
  public function GetTitle() {
20
- return 'Audit Log Viewer';
21
  }
22
 
23
  public function GetIcon() {
@@ -27,7 +27,7 @@ class WSAL_Views_AuditLog extends WSAL_AbstractView {
27
  }
28
 
29
  public function GetName() {
30
- return 'Audit Log Viewer';
31
  }
32
 
33
  public function GetWeight(){
@@ -36,7 +36,7 @@ class WSAL_Views_AuditLog extends WSAL_AbstractView {
36
 
37
  public function Render(){
38
  if(!$this->_plugin->settings->CurrentUserCan('view')){
39
- wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
40
  }
41
 
42
  ?><form id="audit-log-viewer" method="post">
@@ -51,7 +51,7 @@ class WSAL_Views_AuditLog extends WSAL_AbstractView {
51
  WsalAuditLogInit(<?php echo json_encode(array(
52
  'ajaxurl' => admin_url('admin-ajax.php'),
53
  'tr8n' => array(
54
- 'numofitems' => __('Please enter the number of alerts you would like to see on one page:'),
55
  ),
56
  'autorefresh' => array(
57
  'enabled' => $this->_plugin->settings->IsRefreshAlertsEnabled(),
@@ -155,19 +155,19 @@ class WSAL_Views_AuditLogList_Internal extends WP_List_Table {
155
  }
156
 
157
  public function no_items(){
158
- _e('No events so far.');
159
  }
160
 
161
  public function extra_tablenav($which){
162
  // items-per-page widget
163
- $o = __('Other');
164
  $p = $this->_plugin->settings->GetViewPerPage();
165
  $items = array($o, 5, 10, 15, 30, 50);
166
  if (!in_array($p, $items)) $items[] = $p;
167
  if ($p == $o || $p == 0) $p = $o[1]; // a sane default if things goes bust
168
 
169
  ?><div class="wsal-ipp wsal-ipp-<?php echo $which; ?>">
170
- <?php _e('Show '); ?>
171
  <select class="wsal-ipps" onfocus="WsalIppsFocus(value);" onchange="WsalIppsChange(value);">
172
  <?php foreach($items as $item){ ?>
173
  <option
@@ -177,7 +177,7 @@ class WSAL_Views_AuditLogList_Internal extends WP_List_Table {
177
  ?></option>
178
  <?php } ?>
179
  </select>
180
- <?php _e(' Items'); ?>
181
  </div><?php
182
 
183
  // show site alerts widget
@@ -187,7 +187,7 @@ class WSAL_Views_AuditLogList_Internal extends WP_List_Table {
187
  $sites = wp_get_sites();
188
  ?><div class="wsal-ssa wsal-ssa-<?php echo $which; ?>">
189
  <select class="wsal-ssas" onchange="WsalSsasChange(value);">
190
- <option value="0"><?php _e('All Sites'); ?></option>
191
  <?php foreach($sites as $site){ ?>
192
  <?php $info = get_blog_details($site['blog_id'], true); ?>
193
  <option
@@ -256,11 +256,21 @@ class WSAL_Views_AuditLogList_Internal extends WP_List_Table {
256
  case 'crtd':
257
  return $item->created_on ? date('Y-m-d h:i:s A', $item->created_on) : '<i>unknown</i>';
258
  case 'user':
259
- $user = $item->GetUsername();
260
- $usid = get_userdatabylogin($user ? $user : 0);
261
- $usid = $usid ? $usid->ID : 0;
262
- $uimg = get_avatar($usid, 96);
263
- return !is_null($user) ? esc_html($user) : '<i>unknown</i>';
 
 
 
 
 
 
 
 
 
 
264
  case 'scip':
265
  return !is_null($item->GetSourceIP()) ? esc_html($item->GetSourceIP()) : '<i>unknown</i>';
266
  case 'site':
@@ -271,7 +281,7 @@ class WSAL_Views_AuditLogList_Internal extends WP_List_Table {
271
  return '<div id="Event' . $item->id . '">' . $item->GetMessage(array($this, 'meta_formatter')) . '</div>';
272
  case 'data':
273
  $url = admin_url('admin-ajax.php') . '?action=AjaxInspector&amp;occurrence=' . $item->id;
274
- return '<a class="more-info thickbox" title="Alert Data Inspector"'
275
  . ' href="' . $url . '&amp;TB_iframe=true&amp;width=600&amp;height=550">&hellip;</a>';
276
  default:
277
  return isset($item->$column_name)
@@ -361,7 +371,7 @@ class WSAL_Views_AuditLogList_Internal extends WP_List_Table {
361
 
362
  $bid = (int)$this->get_view_site_id();
363
  $sql = ($bid ? "site_id=$bid" : '1') . ' ORDER BY created_on DESC';
364
- $data = WSAL_DB_Occurrence::LoadMulti($sql);
365
 
366
  if(count($data)){
367
  $this->_orderby = (!empty($_REQUEST['orderby']) && isset($sortable[$_REQUEST['orderby']])) ? $_REQUEST['orderby'] : 'created_on';
17
  }
18
 
19
  public function GetTitle() {
20
+ return __('Audit Log Viewer', 'wp-security-audit-log');
21
  }
22
 
23
  public function GetIcon() {
27
  }
28
 
29
  public function GetName() {
30
+ return __('Audit Log Viewer', 'wp-security-audit-log');
31
  }
32
 
33
  public function GetWeight(){
36
 
37
  public function Render(){
38
  if(!$this->_plugin->settings->CurrentUserCan('view')){
39
+ wp_die( __( 'You do not have sufficient permissions to access this page.' , 'wp-security-audit-log') );
40
  }
41
 
42
  ?><form id="audit-log-viewer" method="post">
51
  WsalAuditLogInit(<?php echo json_encode(array(
52
  'ajaxurl' => admin_url('admin-ajax.php'),
53
  'tr8n' => array(
54
+ 'numofitems' => __('Please enter the number of alerts you would like to see on one page:', 'wp-security-audit-log'),
55
  ),
56
  'autorefresh' => array(
57
  'enabled' => $this->_plugin->settings->IsRefreshAlertsEnabled(),
155
  }
156
 
157
  public function no_items(){
158
+ _e('No events so far.', 'wp-security-audit-log');
159
  }
160
 
161
  public function extra_tablenav($which){
162
  // items-per-page widget
163
+ $o = __('Other', 'wp-security-audit-log');
164
  $p = $this->_plugin->settings->GetViewPerPage();
165
  $items = array($o, 5, 10, 15, 30, 50);
166
  if (!in_array($p, $items)) $items[] = $p;
167
  if ($p == $o || $p == 0) $p = $o[1]; // a sane default if things goes bust
168
 
169
  ?><div class="wsal-ipp wsal-ipp-<?php echo $which; ?>">
170
+ <?php _e('Show ', 'wp-security-audit-log'); ?>
171
  <select class="wsal-ipps" onfocus="WsalIppsFocus(value);" onchange="WsalIppsChange(value);">
172
  <?php foreach($items as $item){ ?>
173
  <option
177
  ?></option>
178
  <?php } ?>
179
  </select>
180
+ <?php _e(' Items', 'wp-security-audit-log'); ?>
181
  </div><?php
182
 
183
  // show site alerts widget
187
  $sites = wp_get_sites();
188
  ?><div class="wsal-ssa wsal-ssa-<?php echo $which; ?>">
189
  <select class="wsal-ssas" onchange="WsalSsasChange(value);">
190
+ <option value="0"><?php _e('All Sites', 'wp-security-audit-log'); ?></option>
191
  <?php foreach($sites as $site){ ?>
192
  <?php $info = get_blog_details($site['blog_id'], true); ?>
193
  <option
256
  case 'crtd':
257
  return $item->created_on ? date('Y-m-d h:i:s A', $item->created_on) : '<i>unknown</i>';
258
  case 'user':
259
+ $username = $item->GetUsername();
260
+ if($username && ($user = get_userdatabylogin($username))){
261
+ $image = get_avatar($user->ID, 32);
262
+ $uhtml = '<a href="' . admin_url('user-edit.php?user_id=' . $user->ID)
263
+ . '" target="_blank">' . esc_html($user->display_name) . '</a>';
264
+ $roles = $item->GetUserRoles();
265
+ $roles = (is_array($roles) && count($roles))
266
+ ? esc_html(ucwords(implode(', ', $roles)))
267
+ : '<i>' . __('Unknown', 'wp-security-audit-log') . '</i>';
268
+ }else{
269
+ $image = get_avatar(0, 32);
270
+ $uhtml = '<i>' . __('Unknown', 'wp-security-audit-log') . '</i>';
271
+ $roles = '<i>' . __('System', 'wp-security-audit-log') . '</i>';
272
+ }
273
+ return $image . $uhtml . '<br/>' . $roles;
274
  case 'scip':
275
  return !is_null($item->GetSourceIP()) ? esc_html($item->GetSourceIP()) : '<i>unknown</i>';
276
  case 'site':
281
  return '<div id="Event' . $item->id . '">' . $item->GetMessage(array($this, 'meta_formatter')) . '</div>';
282
  case 'data':
283
  $url = admin_url('admin-ajax.php') . '?action=AjaxInspector&amp;occurrence=' . $item->id;
284
+ return '<a class="more-info thickbox" title="' . __('Alert Data Inspector', 'wp-security-audit-log') . '"'
285
  . ' href="' . $url . '&amp;TB_iframe=true&amp;width=600&amp;height=550">&hellip;</a>';
286
  default:
287
  return isset($item->$column_name)
371
 
372
  $bid = (int)$this->get_view_site_id();
373
  $sql = ($bid ? "site_id=$bid" : '1') . ' ORDER BY created_on DESC';
374
+ $data = WSAL_DB_Occurrence::LoadMulti($sql, array());
375
 
376
  if(count($data)){
377
  $this->_orderby = (!empty($_REQUEST['orderby']) && isset($sortable[$_REQUEST['orderby']])) ? $_REQUEST['orderby'] : 'created_on';
classes/Views/Help.php CHANGED
@@ -3,7 +3,7 @@
3
  class WSAL_Views_Help extends WSAL_AbstractView {
4
 
5
  public function GetTitle() {
6
- return 'Help';
7
  }
8
 
9
  public function GetIcon() {
@@ -11,7 +11,7 @@ class WSAL_Views_Help extends WSAL_AbstractView {
11
  }
12
 
13
  public function GetName() {
14
- return 'Help';
15
  }
16
 
17
  public function GetWeight() {
3
  class WSAL_Views_Help extends WSAL_AbstractView {
4
 
5
  public function GetTitle() {
6
+ return __('Help', 'wp-security-audit-log');
7
  }
8
 
9
  public function GetIcon() {
11
  }
12
 
13
  public function GetName() {
14
+ return __('Help', 'wp-security-audit-log');
15
  }
16
 
17
  public function GetWeight() {
classes/Views/Sandbox.php CHANGED
@@ -8,7 +8,7 @@ class WSAL_Views_Sandbox extends WSAL_AbstractView {
8
  }
9
 
10
  public function GetTitle() {
11
- return 'Sandbox';
12
  }
13
 
14
  public function GetIcon() {
@@ -16,7 +16,7 @@ class WSAL_Views_Sandbox extends WSAL_AbstractView {
16
  }
17
 
18
  public function GetName() {
19
- return 'Sandbox';
20
  }
21
 
22
  public function GetWeight() {
@@ -152,7 +152,7 @@ class WSAL_Views_Sandbox extends WSAL_AbstractView {
152
  <?php $code = json_encode(admin_url('admin.php?page=wsal-sandbox') . '&snippet='); ?>
153
  <select id="sandbox-snippet" onchange="location = <?php echo esc_attr($code); ?> + encodeURIComponent(this.value);"><?php
154
  foreach(array_keys($this->snippets) as $name){
155
- ?><option value="<?php echo esc_attr($name); ?>"<?php if($name == $snpt)echo ' selected="selected"'; ?>><?php _e($name); ?></option><?php
156
  }
157
  ?></select>
158
  </label>
8
  }
9
 
10
  public function GetTitle() {
11
+ return __('Sandbox', 'wp-security-audit-log');
12
  }
13
 
14
  public function GetIcon() {
16
  }
17
 
18
  public function GetName() {
19
+ return __('Sandbox', 'wp-security-audit-log');
20
  }
21
 
22
  public function GetWeight() {
152
  <?php $code = json_encode(admin_url('admin.php?page=wsal-sandbox') . '&snippet='); ?>
153
  <select id="sandbox-snippet" onchange="location = <?php echo esc_attr($code); ?> + encodeURIComponent(this.value);"><?php
154
  foreach(array_keys($this->snippets) as $name){
155
+ ?><option value="<?php echo esc_attr($name); ?>"<?php if($name == $snpt)echo ' selected="selected"'; ?>><?php _e($name, 'wp-security-audit-log'); ?></option><?php
156
  }
157
  ?></select>
158
  </label>
classes/Views/Settings.php CHANGED
@@ -12,7 +12,7 @@ class WSAL_Views_Settings extends WSAL_AbstractView {
12
  }
13
 
14
  public function GetTitle() {
15
- return 'Settings';
16
  }
17
 
18
  public function GetIcon() {
@@ -20,7 +20,7 @@ class WSAL_Views_Settings extends WSAL_AbstractView {
20
  }
21
 
22
  public function GetName() {
23
- return 'Settings';
24
  }
25
 
26
  public function GetWeight() {
@@ -61,14 +61,14 @@ class WSAL_Views_Settings extends WSAL_AbstractView {
61
 
62
  public function Render(){
63
  if(!$this->_plugin->settings->CurrentUserCan('edit')){
64
- wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
65
  }
66
  if(isset($_POST['submit'])){
67
  try {
68
  $this->Save();
69
- ?><div class="updated"><p><?php _e('Settings have been saved.'); ?></p></div><?php
70
  }catch(Exception $ex){
71
- ?><div class="error"><p><?php _e('Error: '); ?><?php echo $ex->getMessage(); ?></p></div><?php
72
  }
73
  }
74
  ?><form id="audit-log-settings" method="post">
@@ -78,12 +78,12 @@ class WSAL_Views_Settings extends WSAL_AbstractView {
78
  <table class="form-table">
79
  <tbody>
80
  <tr>
81
- <th><label for="delete1"><?php _e('Security Alerts Pruning'); ?></label></th>
82
  <td>
83
  <fieldset>
84
- <?php $text = __('(eg: 1 month)'); ?>
85
  <!--<input type="radio" id="delete1" style="margin-top: 2px;"/>-->
86
- <label for="delete1"><?php echo __('Delete alerts older than'); ?></label>
87
  <input type="text" name="PruningDate" placeholder="<?php echo $text; ?>"
88
  value="<?php echo esc_attr($this->_plugin->settings->GetPruningDate()); ?>"/>
89
  <span> <?php echo $text; ?></span>
@@ -95,36 +95,36 @@ class WSAL_Views_Settings extends WSAL_AbstractView {
95
  <td>
96
  <fieldset>
97
  <?php $max = $this->_plugin->settings->GetMaxAllowedAlerts(); ?>
98
- <?php $text = sprintf(__('(1 to %d alerts)'), $max); ?>
99
  <!--<input type="radio" id="delete2" style="margin-top: 2px;"/>-->
100
- <label for="delete2"><?php echo __('Keep up to'); ?></label>
101
  <input type="text" name="PruningLimit" placeholder="<?php echo $text;?>"
102
  value="<?php echo esc_attr($this->_plugin->settings->GetPruningLimit()); ?>"/>
103
  <span><?php echo $text; ?></span>
104
  <p class="description"><?php
105
- echo sprintf(__('By default we keep up to %d WordPress Security Events.'), $max);
106
  ?></p>
107
  </fieldset>
108
  </td>
109
  </tr>
110
  <tr>
111
- <th><label for="dwoption_on"><?php _e('Alerts Dashboard Widget'); ?></label></th>
112
  <td>
113
  <fieldset>
114
  <?php $dwe = $this->_plugin->settings->IsWidgetsEnabled(); ?>
115
  <label for="dwoption_on">
116
  <input type="radio" name="EnableDashboardWidgets" id="dwoption_on" style="margin-top: 2px;" <?php if($dwe)echo 'checked="checked"'; ?> value="1">
117
- <span><?php _e('On'); ?></span>
118
  </label>
119
  <br/>
120
  <label for="dwoption_off">
121
  <input type="radio" name="EnableDashboardWidgets" id="dwoption_off" style="margin-top: 2px;" <?php if(!$dwe)echo 'checked="checked"'; ?> value="0">
122
- <span><?php _e('Off'); ?></span>
123
  </label>
124
  <br/>
125
  <p class="description"><?php
126
  echo sprintf(
127
- __('Display a dashboard widget with the latest %d security alerts.'),
128
  $this->_plugin->settings->GetDashboardWidgetMaxAlerts()
129
  );
130
  ?></p>
@@ -132,14 +132,14 @@ class WSAL_Views_Settings extends WSAL_AbstractView {
132
  </td>
133
  </tr>
134
  <tr>
135
- <th><label for="ViewerQueryBox"><?php _e('Can View Alerts'); ?></label></th>
136
  <td>
137
  <fieldset>
138
  <input type="text" id="ViewerQueryBox" style="float: left; display: block; width: 250px;">
139
  <input type="button" id="ViewerQueryAdd" style="float: left; display: block;" class="button-primary" value="Add">
140
  <br style="clear: both;"/>
141
  <p class="description"><?php
142
- _e('Users and Roles in this list can view the security alerts');
143
  ?></p>
144
  <div id="ViewerList"><?php
145
  foreach($this->_plugin->settings->GetAllowedPluginViewers() as $item){
@@ -154,14 +154,14 @@ class WSAL_Views_Settings extends WSAL_AbstractView {
154
  </td>
155
  </tr>
156
  <tr>
157
- <th><label for="EditorQueryBox"><?php _e('Can Manage Plugin'); ?></label></th>
158
  <td>
159
  <fieldset>
160
  <input type="text" id="EditorQueryBox" style="float: left; display: block; width: 250px;">
161
  <input type="button" id="EditorQueryAdd" style="float: left; display: block;" class="button-primary" value="Add">
162
  <br style="clear: both;"/>
163
  <p class="description"><?php
164
- _e('Users and Roles in this list can manage the plugin settings');
165
  ?></p>
166
  <div id="EditorList"><?php
167
  foreach($this->_plugin->settings->GetAllowedPluginEditors() as $item){
@@ -176,27 +176,27 @@ class WSAL_Views_Settings extends WSAL_AbstractView {
176
  </td>
177
  </tr>
178
  <tr>
179
- <th><label for="aroption_on"><?php _e('Refresh Audit View'); ?></label></th>
180
  <td>
181
  <fieldset>
182
  <?php $are = $this->_plugin->settings->IsRefreshAlertsEnabled(); ?>
183
  <label for="aroption_on">
184
  <input type="radio" name="EnableAuditViewRefresh" id="aroption_on" style="margin-top: 2px;" <?php if($are)echo 'checked="checked"'; ?> value="1">
185
- <span><?php _e('Automatic'); ?></span>
186
  </label>
187
- <span class="description"> &mdash; <?php _e('Refresh Audit View as soon as there are new events.'); ?></span>
188
  <br/>
189
  <label for="aroption_off">
190
  <input type="radio" name="EnableAuditViewRefresh" id="aroption_off" style="margin-top: 2px;" <?php if(!$are)echo 'checked="checked"'; ?> value="0">
191
- <span><?php _e('Manual'); ?></span>
192
  </label>
193
- <span class="description"> &mdash; <?php _e('Refresh Audit View only when page is reloaded.'); ?></span>
194
  <br/>
195
  </fieldset>
196
  </td>
197
  </tr>
198
  <tr>
199
- <th><label><?php _e('Developer Options'); ?></label></th>
200
  <td>
201
  <fieldset><?php
202
  foreach(array(
@@ -208,9 +208,9 @@ class WSAL_Views_Settings extends WSAL_AbstractView {
208
  ?><label for="devoption_<?php echo $opt; ?>">
209
  <input type="checkbox" name="DevOptions[]" id="devoption_<?php echo $opt; ?>" <?php
210
  if($this->_plugin->settings->IsDevOptionEnabled($opt))echo 'checked="checked"'; ?> value="<?php echo $opt; ?>">
211
- <span><?php _e($info[0]); ?></span>
212
  <?php if(isset($info[1]) && $info[1]){ ?>
213
- <span class="description"> &mdash; <?php _e($info[1]); ?></span>
214
  <?php }
215
  ?></label><br/><?php
216
  }
12
  }
13
 
14
  public function GetTitle() {
15
+ return __('Settings', 'wp-security-audit-log');
16
  }
17
 
18
  public function GetIcon() {
20
  }
21
 
22
  public function GetName() {
23
+ return __('Settings', 'wp-security-audit-log');
24
  }
25
 
26
  public function GetWeight() {
61
 
62
  public function Render(){
63
  if(!$this->_plugin->settings->CurrentUserCan('edit')){
64
+ wp_die( __( 'You do not have sufficient permissions to access this page.' , 'wp-security-audit-log') );
65
  }
66
  if(isset($_POST['submit'])){
67
  try {
68
  $this->Save();
69
+ ?><div class="updated"><p><?php _e('Settings have been saved.', 'wp-security-audit-log'); ?></p></div><?php
70
  }catch(Exception $ex){
71
+ ?><div class="error"><p><?php _e('Error: ', 'wp-security-audit-log'); ?><?php echo $ex->getMessage(); ?></p></div><?php
72
  }
73
  }
74
  ?><form id="audit-log-settings" method="post">
78
  <table class="form-table">
79
  <tbody>
80
  <tr>
81
+ <th><label for="delete1"><?php _e('Security Alerts Pruning', 'wp-security-audit-log'); ?></label></th>
82
  <td>
83
  <fieldset>
84
+ <?php $text = __('(eg: 1 month)', 'wp-security-audit-log'); ?>
85
  <!--<input type="radio" id="delete1" style="margin-top: 2px;"/>-->
86
+ <label for="delete1"><?php echo __('Delete alerts older than', 'wp-security-audit-log'); ?></label>
87
  <input type="text" name="PruningDate" placeholder="<?php echo $text; ?>"
88
  value="<?php echo esc_attr($this->_plugin->settings->GetPruningDate()); ?>"/>
89
  <span> <?php echo $text; ?></span>
95
  <td>
96
  <fieldset>
97
  <?php $max = $this->_plugin->settings->GetMaxAllowedAlerts(); ?>
98
+ <?php $text = sprintf(__('(1 to %d alerts)', 'wp-security-audit-log'), $max); ?>
99
  <!--<input type="radio" id="delete2" style="margin-top: 2px;"/>-->
100
+ <label for="delete2"><?php echo __('Keep up to', 'wp-security-audit-log'); ?></label>
101
  <input type="text" name="PruningLimit" placeholder="<?php echo $text;?>"
102
  value="<?php echo esc_attr($this->_plugin->settings->GetPruningLimit()); ?>"/>
103
  <span><?php echo $text; ?></span>
104
  <p class="description"><?php
105
+ echo sprintf(__('By default we keep up to %d WordPress Security Events.', 'wp-security-audit-log'), $max);
106
  ?></p>
107
  </fieldset>
108
  </td>
109
  </tr>
110
  <tr>
111
+ <th><label for="dwoption_on"><?php _e('Alerts Dashboard Widget', 'wp-security-audit-log'); ?></label></th>
112
  <td>
113
  <fieldset>
114
  <?php $dwe = $this->_plugin->settings->IsWidgetsEnabled(); ?>
115
  <label for="dwoption_on">
116
  <input type="radio" name="EnableDashboardWidgets" id="dwoption_on" style="margin-top: 2px;" <?php if($dwe)echo 'checked="checked"'; ?> value="1">
117
+ <span><?php _e('On', 'wp-security-audit-log'); ?></span>
118
  </label>
119
  <br/>
120
  <label for="dwoption_off">
121
  <input type="radio" name="EnableDashboardWidgets" id="dwoption_off" style="margin-top: 2px;" <?php if(!$dwe)echo 'checked="checked"'; ?> value="0">
122
+ <span><?php _e('Off', 'wp-security-audit-log'); ?></span>
123
  </label>
124
  <br/>
125
  <p class="description"><?php
126
  echo sprintf(
127
+ __('Display a dashboard widget with the latest %d security alerts.', 'wp-security-audit-log'),
128
  $this->_plugin->settings->GetDashboardWidgetMaxAlerts()
129
  );
130
  ?></p>
132
  </td>
133
  </tr>
134
  <tr>
135
+ <th><label for="ViewerQueryBox"><?php _e('Can View Alerts', 'wp-security-audit-log'); ?></label></th>
136
  <td>
137
  <fieldset>
138
  <input type="text" id="ViewerQueryBox" style="float: left; display: block; width: 250px;">
139
  <input type="button" id="ViewerQueryAdd" style="float: left; display: block;" class="button-primary" value="Add">
140
  <br style="clear: both;"/>
141
  <p class="description"><?php
142
+ _e('Users and Roles in this list can view the security alerts', 'wp-security-audit-log');
143
  ?></p>
144
  <div id="ViewerList"><?php
145
  foreach($this->_plugin->settings->GetAllowedPluginViewers() as $item){
154
  </td>
155
  </tr>
156
  <tr>
157
+ <th><label for="EditorQueryBox"><?php _e('Can Manage Plugin', 'wp-security-audit-log'); ?></label></th>
158
  <td>
159
  <fieldset>
160
  <input type="text" id="EditorQueryBox" style="float: left; display: block; width: 250px;">
161
  <input type="button" id="EditorQueryAdd" style="float: left; display: block;" class="button-primary" value="Add">
162
  <br style="clear: both;"/>
163
  <p class="description"><?php
164
+ _e('Users and Roles in this list can manage the plugin settings', 'wp-security-audit-log');
165
  ?></p>
166
  <div id="EditorList"><?php
167
  foreach($this->_plugin->settings->GetAllowedPluginEditors() as $item){
176
  </td>
177
  </tr>
178
  <tr>
179
+ <th><label for="aroption_on"><?php _e('Refresh Audit View', 'wp-security-audit-log'); ?></label></th>
180
  <td>
181
  <fieldset>
182
  <?php $are = $this->_plugin->settings->IsRefreshAlertsEnabled(); ?>
183
  <label for="aroption_on">
184
  <input type="radio" name="EnableAuditViewRefresh" id="aroption_on" style="margin-top: 2px;" <?php if($are)echo 'checked="checked"'; ?> value="1">
185
+ <span><?php _e('Automatic', 'wp-security-audit-log'); ?></span>
186
  </label>
187
+ <span class="description"> &mdash; <?php _e('Refresh Audit View as soon as there are new events.', 'wp-security-audit-log'); ?></span>
188
  <br/>
189
  <label for="aroption_off">
190
  <input type="radio" name="EnableAuditViewRefresh" id="aroption_off" style="margin-top: 2px;" <?php if(!$are)echo 'checked="checked"'; ?> value="0">
191
+ <span><?php _e('Manual', 'wp-security-audit-log'); ?></span>
192
  </label>
193
+ <span class="description"> &mdash; <?php _e('Refresh Audit View only when page is reloaded.', 'wp-security-audit-log'); ?></span>
194
  <br/>
195
  </fieldset>
196
  </td>
197
  </tr>
198
  <tr>
199
+ <th><label><?php _e('Developer Options', 'wp-security-audit-log'); ?></label></th>
200
  <td>
201
  <fieldset><?php
202
  foreach(array(
208
  ?><label for="devoption_<?php echo $opt; ?>">
209
  <input type="checkbox" name="DevOptions[]" id="devoption_<?php echo $opt; ?>" <?php
210
  if($this->_plugin->settings->IsDevOptionEnabled($opt))echo 'checked="checked"'; ?> value="<?php echo $opt; ?>">
211
+ <span><?php _e($info[0], 'wp-security-audit-log'); ?></span>
212
  <?php if(isset($info[1]) && $info[1]){ ?>
213
+ <span class="description"> &mdash; <?php _e($info[1], 'wp-security-audit-log'); ?></span>
214
  <?php }
215
  ?></label><br/><?php
216
  }
classes/Views/ToggleAlerts.php CHANGED
@@ -3,7 +3,7 @@
3
  class WSAL_Views_ToggleAlerts extends WSAL_AbstractView {
4
 
5
  public function GetTitle() {
6
- return 'Enable/Disable Alerts';
7
  }
8
 
9
  public function GetIcon() {
@@ -11,7 +11,7 @@ class WSAL_Views_ToggleAlerts extends WSAL_AbstractView {
11
  }
12
 
13
  public function GetName() {
14
- return 'Enable/Disable Alerts';
15
  }
16
 
17
  public function GetWeight() {
@@ -26,7 +26,7 @@ class WSAL_Views_ToggleAlerts extends WSAL_AbstractView {
26
 
27
  public function Render(){
28
  if(!$this->_plugin->settings->CurrentUserCan('edit')){
29
- wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
30
  }
31
  $alert = new WSAL_Alert(); // IDE type hinting
32
  $groupedAlerts = $this->_plugin->alerts->GetCategorizedAlerts();
@@ -40,14 +40,14 @@ class WSAL_Views_ToggleAlerts extends WSAL_AbstractView {
40
  if(!in_array($alert->type, $enabled))
41
  $disabled[] = $alert->type;
42
  $this->_plugin->alerts->SetDisabledAlerts($disabled);
43
- ?><div class="updated"><p><?php _e('Settings have been saved.'); ?></p></div><?php
44
  }catch(Exception $ex){
45
- ?><div class="error"><p><?php _e('Error: '); ?><?php echo $ex->getMessage(); ?></p></div><?php
46
  }
47
  }
48
  ?><h2 id="wsal-tabs" class="nav-tab-wrapper"><?php
49
  foreach($safeNames as $name => $safe){
50
- ?><a href="#tab-<?php echo $safe; ?>" class="nav-tab"><?php echo __($name); ?></a><?php
51
  }
52
  ?></h2>
53
  <form id="audit-log-viewer" method="post">
@@ -73,24 +73,24 @@ class WSAL_Views_ToggleAlerts extends WSAL_AbstractView {
73
  $attrs = '';
74
  switch(true){
75
  case !$alert->mesg:
76
- $attrs = ' title="Not Implemented" class="alert-incomplete"';
77
  break;
78
  case false:
79
- $attrs = ' title="Not Available" class="alert-unavailable"';
80
  break;
81
  }
82
  ?><tr<?php echo $attrs; ?>>
83
  <th><input name="alert[]" type="checkbox" <?php if($active[$alert->type])echo 'checked="checked"'; ?> value="<?php echo (int)$alert->type; ?>"></th>
84
  <td><?php echo str_pad($alert->type, 4, '0', STR_PAD_LEFT); ?></td>
85
  <td><?php echo $this->_plugin->constants->GetConstantBy('value', $alert->code)->name; ?></td>
86
- <td><?php echo esc_html(__($alert->desc)); ?></td>
87
  </tr><?php
88
  }
89
  ?></tbody>
90
  </table><?php
91
  }
92
  ?></div>
93
- <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes"></p>
94
  </form><?php
95
  }
96
 
3
  class WSAL_Views_ToggleAlerts extends WSAL_AbstractView {
4
 
5
  public function GetTitle() {
6
+ return __('Enable/Disable Alerts', 'wp-security-audit-log');
7
  }
8
 
9
  public function GetIcon() {
11
  }
12
 
13
  public function GetName() {
14
+ return __('Enable/Disable Alerts', 'wp-security-audit-log');
15
  }
16
 
17
  public function GetWeight() {
26
 
27
  public function Render(){
28
  if(!$this->_plugin->settings->CurrentUserCan('edit')){
29
+ wp_die( __( 'You do not have sufficient permissions to access this page.' , 'wp-security-audit-log') );
30
  }
31
  $alert = new WSAL_Alert(); // IDE type hinting
32
  $groupedAlerts = $this->_plugin->alerts->GetCategorizedAlerts();
40
  if(!in_array($alert->type, $enabled))
41
  $disabled[] = $alert->type;
42
  $this->_plugin->alerts->SetDisabledAlerts($disabled);
43
+ ?><div class="updated"><p><?php _e('Settings have been saved.', 'wp-security-audit-log'); ?></p></div><?php
44
  }catch(Exception $ex){
45
+ ?><div class="error"><p><?php _e('Error: ', 'wp-security-audit-log'); ?><?php echo $ex->getMessage(); ?></p></div><?php
46
  }
47
  }
48
  ?><h2 id="wsal-tabs" class="nav-tab-wrapper"><?php
49
  foreach($safeNames as $name => $safe){
50
+ ?><a href="#tab-<?php echo $safe; ?>" class="nav-tab"><?php echo $name; ?></a><?php
51
  }
52
  ?></h2>
53
  <form id="audit-log-viewer" method="post">
73
  $attrs = '';
74
  switch(true){
75
  case !$alert->mesg:
76
+ $attrs = ' title="'. __('Not Implemented', 'wp-security-audit-log') . '" class="alert-incomplete"';
77
  break;
78
  case false:
79
+ $attrs = ' title="'. __('Not Available', 'wp-security-audit-log') . '" class="alert-unavailable"';
80
  break;
81
  }
82
  ?><tr<?php echo $attrs; ?>>
83
  <th><input name="alert[]" type="checkbox" <?php if($active[$alert->type])echo 'checked="checked"'; ?> value="<?php echo (int)$alert->type; ?>"></th>
84
  <td><?php echo str_pad($alert->type, 4, '0', STR_PAD_LEFT); ?></td>
85
  <td><?php echo $this->_plugin->constants->GetConstantBy('value', $alert->code)->name; ?></td>
86
+ <td><?php echo esc_html($alert->desc); ?></td>
87
  </tr><?php
88
  }
89
  ?></tbody>
90
  </table><?php
91
  }
92
  ?></div>
93
+ <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="<?php echo esc_attr(__('Save Changes', 'wp-security-audit-log')); ?>"></p>
94
  </form><?php
95
  }
96
 
classes/WidgetManager.php CHANGED
@@ -16,7 +16,7 @@ class WSAL_WidgetManager {
16
  && $this->_plugin->settings->CurrentUserCan('view')){
17
  wp_add_dashboard_widget(
18
  'wsal',
19
- __('Latest Alerts') . ' | WP Security Audit Log',
20
  array($this, 'RenderWidget')
21
  );
22
  }
@@ -29,12 +29,13 @@ class WSAL_WidgetManager {
29
  );
30
  ?><div><?php
31
  if(!count($results)){
32
- ?><p><?php _e('No alerts found.'); ?></p><?php
33
  }else{
34
- ?><table class="wp-list-table widefat" cellspacing="0" cellpadding="0">
 
35
  <thead>
36
- <th class="manage-column" style="width: 15%;" scope="col"><?php _e('User'); ?></th>
37
- <th class="manage-column" style="width: 85%;" scope="col"><?php _e('Description'); ?></th>
38
  </thead>
39
  <tbody><?php
40
  $url = 'admin.php?page=' . $this->_plugin->views->views[0]->GetSafeViewName();
16
  && $this->_plugin->settings->CurrentUserCan('view')){
17
  wp_add_dashboard_widget(
18
  'wsal',
19
+ __('Latest Alerts', 'wp-security-audit-log') . ' | WP Security Audit Log',
20
  array($this, 'RenderWidget')
21
  );
22
  }
29
  );
30
  ?><div><?php
31
  if(!count($results)){
32
+ ?><p><?php _e('No alerts found.', 'wp-security-audit-log'); ?></p><?php
33
  }else{
34
+ ?><table class="wp-list-table widefat" cellspacing="0" cellpadding="0"
35
+ style="display: block; overflow-x: auto;">
36
  <thead>
37
+ <th class="manage-column" style="width: 15%;" scope="col"><?php _e('User', 'wp-security-audit-log'); ?></th>
38
+ <th class="manage-column" style="width: 85%;" scope="col"><?php _e('Description', 'wp-security-audit-log'); ?></th>
39
  </thead>
40
  <tbody><?php
41
  $url = 'admin.php?page=' . $this->_plugin->views->views[0]->GetSafeViewName();
css/auditlog.css CHANGED
@@ -29,7 +29,20 @@
29
  }
30
 
31
  .column-user {
32
- width: 110px;
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  }
34
 
35
  .column-scip {
29
  }
30
 
31
  .column-user {
32
+ width: 160px;
33
+ }
34
+
35
+ td.column-user {
36
+ font-size: 75% !important;
37
+ }
38
+
39
+ .column-user img {
40
+ float: left;
41
+ margin-right: 4px;
42
+ -webkit-border-radius: 50px;
43
+ -moz-border-radius: 50px;
44
+ -ms-border-radius: 50px;
45
+ border-radius: 50px;
46
  }
47
 
48
  .column-scip {
css/install-error.css ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .warn-icon-tri {
2
+ top: 5px;
3
+ left: 5px;
4
+ position: absolute;
5
+ border-left: 16px solid #FFF;
6
+ border-right: 16px solid #FFF;
7
+ border-bottom: 28px solid #C33;
8
+ height: 3px;
9
+ width: 4px
10
+ }
11
+
12
+ .warn-icon-chr {
13
+ top: 8px;
14
+ left: 18px;
15
+ position: absolute;
16
+ color: #FFF;
17
+ font: 26px Georgia;
18
+ }
19
+
20
+ .warn-icon-cir {
21
+ top: 2px;
22
+ left: 0px;
23
+ position: absolute;
24
+ overflow: hidden;
25
+ border: 6px solid #FFF;
26
+ border-radius: 32px;
27
+ width: 34px;
28
+ height: 34px;
29
+ }
30
+
31
+ .warn-wrap {
32
+ position: relative;
33
+ color: #A00;
34
+ font: 14px Arial;
35
+ padding: 6px 48px;
36
+ }
37
+
38
+ .warn-wrap a,
39
+ .warn-wrap a:hover {
40
+ color: #F56;
41
+ }
defaults.php CHANGED
@@ -3,142 +3,147 @@
3
  // if not included correctly...
4
  if ( !class_exists( 'WpSecurityAuditLog' ) ) exit();
5
 
 
6
  defined('E_CRITICAL') || define('E_CRITICAL', 'E_CRITICAL');
7
  defined('E_DEBUG') || define('E_DEBUG', 'E_DEBUG');
 
 
 
8
 
9
  WpSecurityAuditLog::GetInstance()
10
  ->constants->UseConstants(array(
11
  // default PHP constants
12
- array('name' => 'E_ERROR', 'description' => 'Fatal run-time error.'),
13
- array('name' => 'E_WARNING', 'description' => 'Run-time warning (non-fatal error).'),
14
- array('name' => 'E_PARSE', 'description' => 'Compile-time parse error.'),
15
- array('name' => 'E_NOTICE', 'description' => 'Run-time notice.'),
16
- array('name' => 'E_CORE_ERROR', 'description' => 'Fatal error that occurred during startup.'),
17
- array('name' => 'E_CORE_WARNING', 'description' => 'Warnings that occurred during startup.'),
18
- array('name' => 'E_COMPILE_ERROR', 'description' => 'Fatal compile-time error.'),
19
- array('name' => 'E_COMPILE_WARNING', 'description' => 'Compile-time warning.'),
20
- array('name' => 'E_USER_ERROR', 'description' => 'User-generated error message.'),
21
- array('name' => 'E_USER_WARNING', 'description' => 'User-generated warning message.'),
22
- array('name' => 'E_USER_NOTICE', 'description' => 'User-generated notice message. '),
23
- array('name' => 'E_STRICT', 'description' => 'Non-standard/optimal code warning.'),
24
- array('name' => 'E_RECOVERABLE_ERROR', 'description' => 'Catchable fatal error.'),
25
- array('name' => 'E_DEPRECATED', 'description' => 'Run-time deprecation notices.'),
26
- array('name' => 'E_USER_DEPRECATED', 'description' => 'Run-time user deprecation notices.'),
27
  // custom constants
28
- array('name' => 'E_CRITICAL', 'description' => 'Critical, high-impact messages.'),
29
- array('name' => 'E_DEBUG', 'description' => 'Debug informational messages.'),
30
  ));
31
 
32
  WpSecurityAuditLog::GetInstance()
33
  ->alerts->RegisterGroup(array(
34
  'Other User Activity' => array(
35
- array(1000, E_NOTICE, 'User logs in', 'Successfully logged in'),
36
- array(1001, E_NOTICE, 'User logs out', 'Successfully logged out'),
37
- array(1002, E_WARNING, 'Login failed', '%Attempts% failed login(s) detected'),
38
- array(2010, E_NOTICE, 'User uploaded file from Uploads directory', 'Uploaded the file %FileName% in %FilePath%'),
39
- array(2011, E_WARNING, 'User deleted file from Uploads directory', 'Deleted the file %FileName% from %FilePath%'),
40
- array(2046, E_CRITICAL, 'User changed a file using the editor', 'Modified %File% with the Theme Editor'),
 
41
  ),
42
  'Blog Posts' => array(
43
- array(2000, E_NOTICE, 'User created a new blog post and saved it as draft', 'Created a new blog post called %PostTitle%. Blog post ID is %PostID%'),
44
- array(2001, E_NOTICE, 'User published a blog post', 'Published a blog post called %PostTitle%. Blog post URL is %PostUrl%'),
45
- array(2002, E_NOTICE, 'User modified a published blog post', 'Modified the published blog post %PostTitle%. Blog post URL is %PostUrl%'),
46
- array(2003, E_NOTICE, 'User modified a draft blog post', 'Modified the draft blog post %PostTitle%. Blog post ID is %PostID%'),
47
- array(2008, E_NOTICE, 'User permanently deleted a blog post from the trash', 'Deleted the post %PostTitle%. Blog post ID is %PostID%'),
48
- array(2012, E_WARNING, 'User moved a blog post to the trash', 'Moved the blog post %PostTitle% to trash'),
49
- array(2014, E_CRITICAL, 'User restored a blog post from trash', 'Restored post %PostTitle% from trash'),
50
- array(2016, E_NOTICE, 'User changed blog post category', 'Changed the category of the post %PostTitle% from %OldCategories% to %NewCategories%'),
51
- array(2017, E_NOTICE, 'User changed blog post URL', 'Changed the URL of the post %PostTitle% from %OldUrl% to %NewUrl%'),
52
- array(2019, E_NOTICE, 'User changed blog post author', 'Changed the author of %PostTitle% post from %OldAuthor% to %NewAuthor%'),
53
- array(2021, E_NOTICE, 'User changed blog post status', 'Changed the status of %PostTitle% post from %OldStatus% to %NewStatus%'),
54
- array(2023, E_NOTICE, 'User created new category', 'Created a new category called %CategoryName%'),
55
- array(2024, E_WARNING, 'User deleted category', 'Deleted the %CategoryName% category'),
56
- array(2025, E_WARNING, 'User changed the visibility of a blog post', 'Changed the visibility of %PostTitle% blog post from %OldVisibility% to %NewVisibility%'),
57
- array(2027, E_NOTICE, 'User changed the date of a blog post', 'Changed the date of %PostTitle% blog post from %OldDate% to %NewDate%'),
58
- array(2049, E_NOTICE, 'User sets a post as sticky', 'Set the post %PostTitle% as Sticky'),
59
- array(2050, E_NOTICE, 'User removes post from sticky', 'Removed the post %PostTitle% from Sticky'),
60
  ),
61
  'Pages' => array(
62
- array(2004, E_NOTICE, 'User created a new WordPress page and saved it as draft', 'Created a new page called %PostTitle%. Page ID is %PostID%'),
63
- array(2005, E_NOTICE, 'User published a WorPress page', 'Published a page called %PostTitle%. Page URL is %PostUrl%'),
64
- array(2006, E_NOTICE, 'User modified a published WordPress page', 'Modified the published page %PostTitle%. Page URL is %PostUrl%'),
65
- array(2007, E_NOTICE, 'User modified a draft WordPress page', 'Modified the draft page %PostTitle%. page ID is %PostID%'),
66
- array(2009, E_NOTICE, 'User permanently deleted a page from the trash', 'Deleted the page %PostTitle%. Page ID is %PostID%'),
67
- array(2013, E_WARNING, 'User moved WordPress page to the trash', 'Moved the page %PostTitle% to trash'),
68
- array(2015, E_CRITICAL, 'User restored a WordPress page from trash', 'Restored page %PostTitle% from trash'),
69
- array(2018, E_NOTICE, 'User changed page URL', 'Changed the URL of the page %PostTitle% from %OldUrl% to %NewUrl%'),
70
- array(2020, E_NOTICE, 'User changed page author', 'Changed the author of %PostTitle% page from %OldAuthor% to %NewAuthor%'),
71
- array(2022, E_NOTICE, 'User changed page status', 'Changed the status of %PostTitle% page from %OldStatus% to %NewStatus%'),
72
- array(2026, E_WARNING, 'User changed the visibility of a page post', 'Changed the visibility of %PostTitle% page from %OldVisibility% to %NewVisibility%'),
73
- array(2028, E_NOTICE, 'User changed the date of a page post', 'Changed the date of %PostTitle% page from %OldDate% to %NewDate%'),
74
- array(2047, E_NOTICE, 'User changed the parent of a page', 'Changed the parent of %PostTitle% page from %OldParentName% to %NewParentName%'),
75
- array(2048, E_CRITICAL, 'User changes the template of a page', 'Changed the template of %PostTitle% page from %OldTemplate% to %NewTemplate%'),
76
  ),
77
  'Custom Posts' => array(
78
- array(2029, E_NOTICE, 'User created a new post with custom post type and saved it as draft', 'Created a new custom post called %PostTitle% of type %PostType%. Post ID is %PostID%'),
79
- array(2030, E_NOTICE, 'User published a post with custom post type', 'Published a custom post %PostTitle% of type %PostType%. Post URL is %PostUrl%'),
80
- array(2031, E_NOTICE, 'User modified a post with custom post type', 'Modified custom post %PostTitle% of type %PostType%. Post URL is %PostUrl%'),
81
- array(2032, E_NOTICE, 'User modified a draft post with custom post type', 'Modified draft custom post %PostTitle% of type is %PostType%. Post URL is %PostUrl%'),
82
- array(2033, E_WARNING, 'User permanently deleted post with custom post type', 'Deleted custom post %PostTitle% of type %PostType%'),
83
- array(2034, E_WARNING, 'User moved post with custom post type to trash', 'Moved custom post %PostTitle% to trash. Post type is %PostType%'),
84
- array(2035, E_CRITICAL, 'User restored post with custom post type from trash', 'Restored custom post %PostTitle% of type %PostType% from trash'),
85
- array(2036, E_NOTICE, 'User changed the category of a post with custom post type', 'Changed the category(ies) of custom post %PostTitle% of type %PostType% from %OldCategories% to %NewCategories%'),
86
- array(2037, E_NOTICE, 'User changed the URL of a post with custom post type', 'Changed the URL of custom post %PostTitle% of type %PostType% from %OldUrl% to %NewUrl%'),
87
- array(2038, E_NOTICE, 'User changed the author or post with custom post type', 'Changed the author of custom post %PostTitle% of type %PostType% from %OldAuthor% to %NewAuthor%'),
88
- array(2039, E_NOTICE, 'User changed the status of post with custom post type', 'Changed the status of custom post %PostTitle% of type %PostType% from %OldStatus% to %NewStatus%'),
89
- array(2040, E_WARNING, 'User changed the visibility of a post with custom post type', 'Changed the visibility of custom post %PostTitle% of type %PostType% from %OldVisibility% to %NewVisibility%'),
90
- array(2041, E_NOTICE, 'User changed the date of post with custom post type', 'Changed the date of custom post %PostTitle% of type %PostType% from %OldDate% to %NewDate%'),
91
  ),
92
  'Widgets' => array(
93
- array(2042, E_CRITICAL, 'User added a new widget', 'Added a new %WidgetName% widget in %Sidebar%'),
94
- array(2043, E_WARNING, 'User modified a widget', 'Modified the %WidgetName% widget in %Sidebar%'),
95
- array(2044, E_CRITICAL, 'User deleted widget', 'Deleted the %WidgetName% widget from %Sidebar%'),
96
- array(2045, E_NOTICE, 'User moved widget', 'Moved the %WidgetName% widget from %OldSidebar% to %NewSidebar%'),
97
  ),
98
  'User Profiles' => array(
99
- array(4000, E_CRITICAL, 'A new user was created on WordPress', 'User %NewUserData->Username% subscribed with a role of %NewUserData->Roles%'),
100
- array(4001, E_CRITICAL, 'A user created another WordPress user', 'Created a new user %NewUserData->Username% with the role of %NewUserData->Roles%'),
101
- array(4002, E_CRITICAL, 'The role of a user was changed by another WordPress user', 'Changed the role of user %TargetUsername% from %OldRole% to %NewRole%'),
102
- array(4003, E_CRITICAL, 'User has changed his or her password', 'Changed the password'),
103
- array(4004, E_CRITICAL, 'A user changed another user\'s password', 'Changed the password for user %TargetUserData->Username% with the role of %TargetUserData->Roles%'),
104
- array(4005, E_NOTICE, 'User changed his or her email address', 'Changed the email address from %OldEmail% to %NewEmail%'),
105
- array(4006, E_NOTICE, 'A user changed another user\'s email address', 'Changed the email address of user account %TargetUsername% from %OldEmail% to %NewEmail%'),
106
- array(4007, E_CRITICAL, 'A user was deleted by another user', 'Deleted User %TargetUserData->Username% with the role of %TargetUserData->Roles%'),
107
  ),
108
  'Plugins & Themes' => array(
109
- array(5000, E_CRITICAL, 'User installed a plugin', 'Installed the plugin %NewPlugin->Name% in %NewPlugin->plugin_dir_path%'),
110
- array(5001, E_CRITICAL, 'User activated a WordPress plugin', 'Activated the plugin %PluginData->Name% installed in %PluginFile%'),
111
- array(5002, E_CRITICAL, 'User deactivated a WordPress plugin', 'Deactivated the plugin %PluginData->Name% installed in %PluginFile%'),
112
- array(5003, E_CRITICAL, 'User uninstalled a plugin', 'Uninstalled the plugin %PluginData->Name% which was installed in %PluginFile%'),
113
- array(5004, E_WARNING, 'User upgraded a plugin', 'Upgraded the plugin %PluginData->Name% installed in %PluginFile%'),
114
- array(5005, E_CRITICAL, 'User installed a theme', 'Installed theme "%NewTheme->Name%" in %NewTheme->get_template_directory%'),
115
- array(5006, E_CRITICAL, 'User activated a theme', 'Activated theme "%NewTheme->Name%", installed in %NewTheme->get_template_directory%'),
116
  ),
117
  'System Activity' => array(
118
- array(0000, E_CRITICAL, 'Unknown Error', 'An unexpected error has occurred'),
119
- array(0001, E_CRITICAL, 'PHP error', '%Message%'),
120
- array(0002, E_WARNING, 'PHP warning', '%Message%'),
121
- array(0003, E_NOTICE, 'PHP notice', '%Message%'),
122
- array(0004, E_CRITICAL, 'PHP exception', '%Message%'),
123
- array(0005, E_CRITICAL, 'PHP shutdown error', '%Message%'),
124
- array(6000, E_NOTICE, 'Events automatically pruned by system', '%EventCount% event(s) automatically deleted by system'),
125
- array(6001, E_CRITICAL, 'Option Anyone Can Register in WordPress settings changed', '%NewValue% the option "Anyone can register"'),
126
- array(6002, E_CRITICAL, 'New User Default Role changed', 'Changed the New User Default Role from %OldRole% to %NewRole%'),
127
- array(6003, E_CRITICAL, 'WordPress Administrator Notification email changed', 'Changed the WordPress administrator notifications email address from %OldEmail% to %NewEmail%'),
128
- array(6004, E_CRITICAL, 'WordPress was updated', 'Updated WordPress from version %OldVersion% to %NewVersion%'),
129
- array(6005, E_CRITICAL, 'User changes the WordPress Permalinks', 'Changed the WordPress permalinks from %OldPattern% to %NewPattern%'),
130
  ),
131
  'MultiSite' => array(
132
- array(4008, E_CRITICAL, 'User granted Super Admin privileges', 'Granted Super Admin privileges to %TargetUsername%'),
133
- array(4009, E_CRITICAL, 'User revoked from Super Admin privileges', 'Revoked Super Admin privileges from %TargetUsername%'),
134
- array(4010, E_CRITICAL, 'Existing user added to a site', 'Added existing user %Username% with %UserRole% role to site %SiteName%'),
135
- array(4011, E_CRITICAL, 'User removed from site', 'Removed user %Username% with role %UserRole% from %SiteName% site'),
136
- array(4012, E_CRITICAL, 'New network user created', 'Created a new network user %NewUserData->Username%'),
137
- array(7000, E_CRITICAL, 'New site added on network', 'Added site %SiteName% to the network'),
138
- array(7001, E_CRITICAL, 'Existing site archived', 'Archived site %SiteName%'),
139
- array(7002, E_CRITICAL, 'Archived site has been unarchived', 'Unarchived site %SiteName%'),
140
- array(7003, E_CRITICAL, 'Deactivated site has been activated', 'Activated site %SiteName%'),
141
- array(7004, E_CRITICAL, 'Site has been deactivated', 'Deactivated site %SiteName%'),
142
- array(7005, E_CRITICAL, 'Existing site deleted from network', 'Deleted site %SiteName%'),
143
  ),
144
  ));
3
  // if not included correctly...
4
  if ( !class_exists( 'WpSecurityAuditLog' ) ) exit();
5
 
6
+ // define custom / new PHP constants
7
  defined('E_CRITICAL') || define('E_CRITICAL', 'E_CRITICAL');
8
  defined('E_DEBUG') || define('E_DEBUG', 'E_DEBUG');
9
+ defined('E_RECOVERABLE_ERROR') || define('E_RECOVERABLE_ERROR', 'E_RECOVERABLE_ERROR');
10
+ defined('E_DEPRECATED') || define('E_DEPRECATED', 'E_DEPRECATED');
11
+ defined('E_USER_DEPRECATED') || define('E_USER_DEPRECATED', 'E_USER_DEPRECATED');
12
 
13
  WpSecurityAuditLog::GetInstance()
14
  ->constants->UseConstants(array(
15
  // default PHP constants
16
+ array('name' => 'E_ERROR', 'description' => __('Fatal run-time error.', 'wp-security-audit-log')),
17
+ array('name' => 'E_WARNING', 'description' => __('Run-time warning (non-fatal error).', 'wp-security-audit-log')),
18
+ array('name' => 'E_PARSE', 'description' => __('Compile-time parse error.', 'wp-security-audit-log')),
19
+ array('name' => 'E_NOTICE', 'description' => __('Run-time notice.', 'wp-security-audit-log')),
20
+ array('name' => 'E_CORE_ERROR', 'description' => __('Fatal error that occurred during startup.', 'wp-security-audit-log')),
21
+ array('name' => 'E_CORE_WARNING', 'description' => __('Warnings that occurred during startup.', 'wp-security-audit-log')),
22
+ array('name' => 'E_COMPILE_ERROR', 'description' => __('Fatal compile-time error.', 'wp-security-audit-log')),
23
+ array('name' => 'E_COMPILE_WARNING', 'description' => __('Compile-time warning.', 'wp-security-audit-log')),
24
+ array('name' => 'E_USER_ERROR', 'description' => __('User-generated error message.', 'wp-security-audit-log')),
25
+ array('name' => 'E_USER_WARNING', 'description' => __('User-generated warning message.', 'wp-security-audit-log')),
26
+ array('name' => 'E_USER_NOTICE', 'description' => __('User-generated notice message. ', 'wp-security-audit-log')),
27
+ array('name' => 'E_STRICT', 'description' => __('Non-standard/optimal code warning.', 'wp-security-audit-log')),
28
+ array('name' => 'E_RECOVERABLE_ERROR', 'description' => __('Catchable fatal error.', 'wp-security-audit-log')),
29
+ array('name' => 'E_DEPRECATED', 'description' => __('Run-time deprecation notices.', 'wp-security-audit-log')),
30
+ array('name' => 'E_USER_DEPRECATED', 'description' => __('Run-time user deprecation notices.', 'wp-security-audit-log')),
31
  // custom constants
32
+ array('name' => 'E_CRITICAL', 'description' => __('Critical, high-impact messages.', 'wp-security-audit-log')),
33
+ array('name' => 'E_DEBUG', 'description' => __('Debug informational messages.', 'wp-security-audit-log')),
34
  ));
35
 
36
  WpSecurityAuditLog::GetInstance()
37
  ->alerts->RegisterGroup(array(
38
  'Other User Activity' => array(
39
+ array(1000, E_NOTICE, __('User logs in', 'wp-security-audit-log'), __('Successfully logged in', 'wp-security-audit-log')),
40
+ array(1001, E_NOTICE, __('User logs out', 'wp-security-audit-log'), __('Successfully logged out', 'wp-security-audit-log')),
41
+ array(1002, E_WARNING, __('Login failed', 'wp-security-audit-log'), __('%Attempts% failed login(s) detected', 'wp-security-audit-log')),
42
+ array(2010, E_NOTICE, __('User uploaded file from Uploads directory', 'wp-security-audit-log'), __('Uploaded the file %FileName% in %FilePath%', 'wp-security-audit-log')),
43
+ array(2011, E_WARNING, __('User deleted file from Uploads directory', 'wp-security-audit-log'), __('Deleted the file %FileName% from %FilePath%', 'wp-security-audit-log')),
44
+ 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')),
45
+ 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')),
46
  ),
47
  'Blog Posts' => array(
48
+ array(2000, E_NOTICE, __('User created a new blog post and saved it as draft', 'wp-security-audit-log'), __('Created a new blog post called %PostTitle%. Blog post ID is %PostID%', 'wp-security-audit-log')),
49
+ array(2001, E_NOTICE, __('User published a blog post', 'wp-security-audit-log'), __('Published a blog post called %PostTitle%. Blog post URL is %PostUrl%', 'wp-security-audit-log')),
50
+ array(2002, E_NOTICE, __('User modified a published blog post', 'wp-security-audit-log'), __('Modified the published blog post %PostTitle%. Blog post URL is %PostUrl%', 'wp-security-audit-log')),
51
+ array(2003, E_NOTICE, __('User modified a draft blog post', 'wp-security-audit-log'), __('Modified the draft blog post %PostTitle%. Blog post ID is %PostID%', 'wp-security-audit-log')),
52
+ array(2008, E_NOTICE, __('User permanently deleted a blog post from the trash', 'wp-security-audit-log'), __('Deleted the post %PostTitle%. Blog post ID is %PostID%', 'wp-security-audit-log')),
53
+ array(2012, E_WARNING, __('User moved a blog post to the trash', 'wp-security-audit-log'), __('Moved the blog post %PostTitle% to trash', 'wp-security-audit-log')),
54
+ array(2014, E_CRITICAL, __('User restored a blog post from trash', 'wp-security-audit-log'), __('Restored post %PostTitle% from trash', 'wp-security-audit-log')),
55
+ array(2016, E_NOTICE, __('User changed blog post category', 'wp-security-audit-log'), __('Changed the category of the post %PostTitle% from %OldCategories% to %NewCategories%', 'wp-security-audit-log')),
56
+ array(2017, E_NOTICE, __('User changed blog post URL', 'wp-security-audit-log'), __('Changed the URL of the post %PostTitle% from %OldUrl% to %NewUrl%', 'wp-security-audit-log')),
57
+ array(2019, E_NOTICE, __('User changed blog post author', 'wp-security-audit-log'), __('Changed the author of %PostTitle% post from %OldAuthor% to %NewAuthor%', 'wp-security-audit-log')),
58
+ array(2021, E_NOTICE, __('User changed blog post status', 'wp-security-audit-log'), __('Changed the status of %PostTitle% post from %OldStatus% to %NewStatus%', 'wp-security-audit-log')),
59
+ array(2023, E_NOTICE, __('User created new category', 'wp-security-audit-log'), __('Created a new category called %CategoryName%', 'wp-security-audit-log')),
60
+ array(2024, E_WARNING, __('User deleted category', 'wp-security-audit-log'), __('Deleted the %CategoryName% category', 'wp-security-audit-log')),
61
+ array(2025, E_WARNING, __('User changed the visibility of a blog post', 'wp-security-audit-log'), __('Changed the visibility of %PostTitle% blog post from %OldVisibility% to %NewVisibility%', 'wp-security-audit-log')),
62
+ array(2027, E_NOTICE, __('User changed the date of a blog post', 'wp-security-audit-log'), __('Changed the date of %PostTitle% blog post from %OldDate% to %NewDate%', 'wp-security-audit-log')),
63
+ array(2049, E_NOTICE, __('User sets a post as sticky', 'wp-security-audit-log'), __('Set the post %PostTitle% as Sticky', 'wp-security-audit-log')),
64
+ array(2050, E_NOTICE, __('User removes post from sticky', 'wp-security-audit-log'), __('Removed the post %PostTitle% from Sticky', 'wp-security-audit-log')),
65
  ),
66
  'Pages' => array(
67
+ array(2004, E_NOTICE, __('User created a new WordPress page and saved it as draft', 'wp-security-audit-log'), __('Created a new page called %PostTitle%. Page ID is %PostID%', 'wp-security-audit-log')),
68
+ array(2005, E_NOTICE, __('User published a WorPress page', 'wp-security-audit-log'), __('Published a page called %PostTitle%. Page URL is %PostUrl%', 'wp-security-audit-log')),
69
+ array(2006, E_NOTICE, __('User modified a published WordPress page', 'wp-security-audit-log'), __('Modified the published page %PostTitle%. Page URL is %PostUrl%', 'wp-security-audit-log')),
70
+ array(2007, E_NOTICE, __('User modified a draft WordPress page', 'wp-security-audit-log'), __('Modified the draft page %PostTitle%. page ID is %PostID%', 'wp-security-audit-log')),
71
+ array(2009, E_NOTICE, __('User permanently deleted a page from the trash', 'wp-security-audit-log'), __('Deleted the page %PostTitle%. Page ID is %PostID%', 'wp-security-audit-log')),
72
+ array(2013, E_WARNING, __('User moved WordPress page to the trash', 'wp-security-audit-log'), __('Moved the page %PostTitle% to trash', 'wp-security-audit-log')),
73
+ array(2015, E_CRITICAL, __('User restored a WordPress page from trash', 'wp-security-audit-log'), __('Restored page %PostTitle% from trash', 'wp-security-audit-log')),
74
+ array(2018, E_NOTICE, __('User changed page URL', 'wp-security-audit-log'), __('Changed the URL of the page %PostTitle% from %OldUrl% to %NewUrl%', 'wp-security-audit-log')),
75
+ array(2020, E_NOTICE, __('User changed page author', 'wp-security-audit-log'), __('Changed the author of %PostTitle% page from %OldAuthor% to %NewAuthor%', 'wp-security-audit-log')),
76
+ array(2022, E_NOTICE, __('User changed page status', 'wp-security-audit-log'), __('Changed the status of %PostTitle% page from %OldStatus% to %NewStatus%', 'wp-security-audit-log')),
77
+ array(2026, E_WARNING, __('User changed the visibility of a page post', 'wp-security-audit-log'), __('Changed the visibility of %PostTitle% page from %OldVisibility% to %NewVisibility%', 'wp-security-audit-log')),
78
+ array(2028, E_NOTICE, __('User changed the date of a page post', 'wp-security-audit-log'), __('Changed the date of %PostTitle% page from %OldDate% to %NewDate%', 'wp-security-audit-log')),
79
+ array(2047, E_NOTICE, __('User changed the parent of a page', 'wp-security-audit-log'), __('Changed the parent of %PostTitle% page from %OldParentName% to %NewParentName%', 'wp-security-audit-log')),
80
+ array(2048, E_CRITICAL, __('User changes the template of a page', 'wp-security-audit-log'), __('Changed the template of %PostTitle% page from %OldTemplate% to %NewTemplate%', 'wp-security-audit-log')),
81
  ),
82
  'Custom Posts' => array(
83
+ 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%. Post ID is %PostID%', 'wp-security-audit-log')),
84
+ 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%', 'wp-security-audit-log')),
85
+ array(2031, E_NOTICE, __('User modified a post with custom post type', 'wp-security-audit-log'), __('Modified custom post %PostTitle% of type %PostType%. Post URL is %PostUrl%', 'wp-security-audit-log')),
86
+ array(2032, E_NOTICE, __('User modified a draft post with custom post type', 'wp-security-audit-log'), __('Modified draft custom post %PostTitle% of type is %PostType%. Post URL is %PostUrl%', 'wp-security-audit-log')),
87
+ array(2033, E_WARNING, __('User permanently deleted post with custom post type', 'wp-security-audit-log'), __('Deleted custom post %PostTitle% of type %PostType%', 'wp-security-audit-log')),
88
+ array(2034, E_WARNING, __('User moved post with custom post type to trash', 'wp-security-audit-log'), __('Moved custom post %PostTitle% to trash. Post type is %PostType%', 'wp-security-audit-log')),
89
+ array(2035, E_CRITICAL, __('User restored post with custom post type from trash', 'wp-security-audit-log'), __('Restored custom post %PostTitle% of type %PostType% from trash', 'wp-security-audit-log')),
90
+ array(2036, E_NOTICE, __('User changed the category of a post with custom post type', 'wp-security-audit-log'), __('Changed the category(ies) of custom post %PostTitle% of type %PostType% from %OldCategories% to %NewCategories%', 'wp-security-audit-log')),
91
+ array(2037, E_NOTICE, __('User changed the URL of a post with custom post type', 'wp-security-audit-log'), __('Changed the URL of custom post %PostTitle% of type %PostType% from %OldUrl% to %NewUrl%', 'wp-security-audit-log')),
92
+ array(2038, E_NOTICE, __('User changed the author or post with custom post type', 'wp-security-audit-log'), __('Changed the author of custom post %PostTitle% of type %PostType% from %OldAuthor% to %NewAuthor%', 'wp-security-audit-log')),
93
+ array(2039, E_NOTICE, __('User changed the status of post with custom post type', 'wp-security-audit-log'), __('Changed the status of custom post %PostTitle% of type %PostType% from %OldStatus% to %NewStatus%', 'wp-security-audit-log')),
94
+ array(2040, E_WARNING, __('User changed the visibility of a post with custom post type', 'wp-security-audit-log'), __('Changed the visibility of custom post %PostTitle% of type %PostType% from %OldVisibility% to %NewVisibility%', 'wp-security-audit-log')),
95
+ array(2041, E_NOTICE, __('User changed the date of post with custom post type', 'wp-security-audit-log'), __('Changed the date of custom post %PostTitle% of type %PostType% from %OldDate% to %NewDate%', 'wp-security-audit-log')),
96
  ),
97
  'Widgets' => array(
98
+ array(2042, E_CRITICAL, __('User added a new widget', 'wp-security-audit-log'), __('Added a new %WidgetName% widget in %Sidebar%', 'wp-security-audit-log')),
99
+ array(2043, E_WARNING, __('User modified a widget', 'wp-security-audit-log'), __('Modified the %WidgetName% widget in %Sidebar%', 'wp-security-audit-log')),
100
+ array(2044, E_CRITICAL, __('User deleted widget', 'wp-security-audit-log'), __('Deleted the %WidgetName% widget from %Sidebar%', 'wp-security-audit-log')),
101
+ array(2045, E_NOTICE, __('User moved widget', 'wp-security-audit-log'), __('Moved the %WidgetName% widget from %OldSidebar% to %NewSidebar%', 'wp-security-audit-log')),
102
  ),
103
  'User Profiles' => array(
104
+ array(4000, E_CRITICAL, __('A new user was created on WordPress', 'wp-security-audit-log'), __('User %NewUserData->Username% subscribed with a role of %NewUserData->Roles%', 'wp-security-audit-log')),
105
+ array(4001, E_CRITICAL, __('A user created another WordPress user', 'wp-security-audit-log'), __('Created a new user %NewUserData->Username% with the role of %NewUserData->Roles%', 'wp-security-audit-log')),
106
+ array(4002, E_CRITICAL, __('The role of a user was changed by another WordPress user', 'wp-security-audit-log'), __('Changed the role of user %TargetUsername% from %OldRole% to %NewRole%', 'wp-security-audit-log')),
107
+ array(4003, E_CRITICAL, __('User has changed his or her password', 'wp-security-audit-log'), __('Changed the password', 'wp-security-audit-log')),
108
+ array(4004, E_CRITICAL, __('A user changed another user\'s password', 'wp-security-audit-log'), __('Changed the password for user %TargetUserData->Username% with the role of %TargetUserData->Roles%', 'wp-security-audit-log')),
109
+ array(4005, E_NOTICE, __('User changed his or her email address', 'wp-security-audit-log'), __('Changed the email address from %OldEmail% to %NewEmail%', 'wp-security-audit-log')),
110
+ array(4006, E_NOTICE, __('A user changed another user\'s email address', 'wp-security-audit-log'), __('Changed the email address of user account %TargetUsername% from %OldEmail% to %NewEmail%', 'wp-security-audit-log')),
111
+ array(4007, E_CRITICAL, __('A user was deleted by another user', 'wp-security-audit-log'), __('Deleted User %TargetUserData->Username% with the role of %TargetUserData->Roles%', 'wp-security-audit-log')),
112
  ),
113
  'Plugins & Themes' => array(
114
+ array(5000, E_CRITICAL, __('User installed a plugin', 'wp-security-audit-log'), __('Installed the plugin %NewPlugin->Name% in %NewPlugin->plugin_dir_path%', 'wp-security-audit-log')),
115
+ array(5001, E_CRITICAL, __('User activated a WordPress plugin', 'wp-security-audit-log'), __('Activated the plugin %PluginData->Name% installed in %PluginFile%', 'wp-security-audit-log')),
116
+ array(5002, E_CRITICAL, __('User deactivated a WordPress plugin', 'wp-security-audit-log'), __('Deactivated the plugin %PluginData->Name% installed in %PluginFile%', 'wp-security-audit-log')),
117
+ array(5003, E_CRITICAL, __('User uninstalled a plugin', 'wp-security-audit-log'), __('Uninstalled the plugin %PluginData->Name% which was installed in %PluginFile%', 'wp-security-audit-log')),
118
+ array(5004, E_WARNING, __('User upgraded a plugin', 'wp-security-audit-log'), __('Upgraded the plugin %PluginData->Name% installed in %PluginFile%', 'wp-security-audit-log')),
119
+ array(5005, E_CRITICAL, __('User installed a theme', 'wp-security-audit-log'), __('Installed theme "%NewTheme->Name%" in %NewTheme->get_template_directory%', 'wp-security-audit-log')),
120
+ array(5006, E_CRITICAL, __('User activated a theme', 'wp-security-audit-log'), __('Activated theme "%NewTheme->Name%", installed in %NewTheme->get_template_directory%', 'wp-security-audit-log')),
121
  ),
122
  'System Activity' => array(
123
+ array(0000, E_CRITICAL, __('Unknown Error', 'wp-security-audit-log'), __('An unexpected error has occurred', 'wp-security-audit-log')),
124
+ array(0001, E_CRITICAL, __('PHP error', 'wp-security-audit-log'), __('%Message%', 'wp-security-audit-log')),
125
+ array(0002, E_WARNING, __('PHP warning', 'wp-security-audit-log'), __('%Message%', 'wp-security-audit-log')),
126
+ array(0003, E_NOTICE, __('PHP notice', 'wp-security-audit-log'), __('%Message%', 'wp-security-audit-log')),
127
+ array(0004, E_CRITICAL, __('PHP exception', 'wp-security-audit-log'), __('%Message%', 'wp-security-audit-log')),
128
+ array(0005, E_CRITICAL, __('PHP shutdown error', 'wp-security-audit-log'), __('%Message%', 'wp-security-audit-log')),
129
+ array(6000, E_NOTICE, __('Events automatically pruned by system', 'wp-security-audit-log'), __('%EventCount% event(s) automatically deleted by system', 'wp-security-audit-log')),
130
+ array(6001, E_CRITICAL, __('Option Anyone Can Register in WordPress settings changed', 'wp-security-audit-log'), __('%NewValue% the option "Anyone can register"', 'wp-security-audit-log')),
131
+ array(6002, E_CRITICAL, __('New User Default Role changed', 'wp-security-audit-log'), __('Changed the New User Default Role from %OldRole% to %NewRole%', 'wp-security-audit-log')),
132
+ array(6003, E_CRITICAL, __('WordPress Administrator Notification email changed', 'wp-security-audit-log'), __('Changed the WordPress administrator notifications email address from %OldEmail% to %NewEmail%', 'wp-security-audit-log')),
133
+ array(6004, E_CRITICAL, __('WordPress was updated', 'wp-security-audit-log'), __('Updated WordPress from version %OldVersion% to %NewVersion%', 'wp-security-audit-log')),
134
+ array(6005, E_CRITICAL, __('User changes the WordPress Permalinks', 'wp-security-audit-log'), __('Changed the WordPress permalinks from %OldPattern% to %NewPattern%', 'wp-security-audit-log')),
135
  ),
136
  'MultiSite' => array(
137
+ array(4008, E_CRITICAL, __('User granted Super Admin privileges', 'wp-security-audit-log'), __('Granted Super Admin privileges to %TargetUsername%', 'wp-security-audit-log')),
138
+ array(4009, E_CRITICAL, __('User revoked from Super Admin privileges', 'wp-security-audit-log'), __('Revoked Super Admin privileges from %TargetUsername%', 'wp-security-audit-log')),
139
+ array(4010, E_CRITICAL, __('Existing user added to a site', 'wp-security-audit-log'), __('Added existing user %TargetUsername% with %TargetUserRole% role to site %SiteName%', 'wp-security-audit-log')),
140
+ array(4011, E_CRITICAL, __('User removed from site', 'wp-security-audit-log'), __('Removed user %TargetUsername% with role %TargetUserRole% from %SiteName% site', 'wp-security-audit-log')),
141
+ array(4012, E_CRITICAL, __('New network user created', 'wp-security-audit-log'), __('Created a new network user %NewUserData->Username%', 'wp-security-audit-log')),
142
+ array(7000, E_CRITICAL, __('New site added on network', 'wp-security-audit-log'), __('Added site %SiteName% to the network', 'wp-security-audit-log')),
143
+ array(7001, E_CRITICAL, __('Existing site archived', 'wp-security-audit-log'), __('Archived site %SiteName%', 'wp-security-audit-log')),
144
+ array(7002, E_CRITICAL, __('Archived site has been unarchived', 'wp-security-audit-log'), __('Unarchived site %SiteName%', 'wp-security-audit-log')),
145
+ array(7003, E_CRITICAL, __('Deactivated site has been activated', 'wp-security-audit-log'), __('Activated site %SiteName%', 'wp-security-audit-log')),
146
+ array(7004, E_CRITICAL, __('Site has been deactivated', 'wp-security-audit-log'), __('Deactivated site %SiteName%', 'wp-security-audit-log')),
147
+ array(7005, E_CRITICAL, __('Existing site deleted from network', 'wp-security-audit-log'), __('Deleted site %SiteName%', 'wp-security-audit-log')),
148
  ),
149
  ));
readme.txt CHANGED
@@ -1,11 +1,13 @@
1
  === WP Security Audit Log ===
2
  Contributors: WPWhiteSecurity, uuf6429
 
 
3
  License: GPLv3
4
  License URI: http://www.gnu.org/licenses/gpl.html
5
- 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, security audit trail, wordpress security alerts, wordpress monitor, wordpress security monitor, wordpress admin, wordpress admin monitoring, analytics, activity, admin, multisite, wordpress multisite
6
  Requires at least: 3.6
7
  Tested up to: 3.9.1
8
- Stable tag: 1.0.0
9
 
10
  Identify WordPress issues before they become a security problem by keeping an audit log of users and all of the under the hood WordPress activity.
11
 
@@ -60,6 +62,28 @@ Plugins and themes customizations are most probably the norm of the day on large
60
 
61
  With WP Security Audit Log now it is easier than ever before to monitor your plugins', theme's and other code behaviour, it will generate a alert when a PHP error, warning, exception or shutdown is detected. It is also possible to log all HTTP GET and POST requests that are reaching your WordPress installation to a log file with WP Security Audit Log. Simply enable the PHP Errors monitoring or logging from the plugins settings.
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  = WordPress Security Tips & Tricks =
64
  Even if WordPress security is not your cup of tea, the security of your WordPress is your responsibility. Keep yourself up to date with the latest WordPress Security Tips & Tricks. WP White Security frequently publishes WordPress security tips & tricks on the [WordPress Security section](http://www.wpwhitesecurity.com/wordpress-security/) of their blog.
65
 
@@ -104,6 +128,20 @@ Yes, WP Security Audit Log works on WordPress Multisite networks, i.e. it can mo
104
 
105
  == Changelog ==
106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  = 1.0 (2014-05-20) =
108
  * Complete plugin rewrite making the new version more stable and scalable
109
 
@@ -256,4 +294,4 @@ Yes, WP Security Audit Log works on WordPress Multisite networks, i.e. it can mo
256
 
257
  = 0.1 (2013-05-24) =
258
 
259
- * Initial beta release of WP Security Audit Log.
1
  === WP Security Audit Log ===
2
  Contributors: WPWhiteSecurity, uuf6429
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=payments%40wpwhitesecurity%2ecom&lc=US&item_name=WP%20Security%20Audit%20Log%20WordPress%20Plugin&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
4
+ Plugin URI: http://www.wpwhitesecurity.com/wordpress-security-plugins/wp-security-audit-log/
5
  License: GPLv3
6
  License URI: http://www.gnu.org/licenses/gpl.html
7
+ Tags: wordpress security plugin, wordpress security audit log, audit log, wordpress log, event log wordpress, wordpress user tracking, wordpress activity log, wordpress audit, security event log, audit trail, security audit trail, wordpress security alerts, wordpress monitor, wordpress security monitor, wordpress admin, wordpress admin monitoring, analytics, activity, admin, multisite, wordpress multisite
8
  Requires at least: 3.6
9
  Tested up to: 3.9.1
10
+ Stable tag: 1.1.0
11
 
12
  Identify WordPress issues before they become a security problem by keeping an audit log of users and all of the under the hood WordPress activity.
13
 
62
 
63
  With WP Security Audit Log now it is easier than ever before to monitor your plugins', theme's and other code behaviour, it will generate a alert when a PHP error, warning, exception or shutdown is detected. It is also possible to log all HTTP GET and POST requests that are reaching your WordPress installation to a log file with WP Security Audit Log. Simply enable the PHP Errors monitoring or logging from the plugins settings.
64
 
65
+ = Other Noteworthy Features =
66
+ WP Security Audit Log plugin also has a number of features that make WordPress and WordPress multisite monitoring and auditing easier, such as:
67
+
68
+ * Limit who can view the security alerts by users or roles
69
+ * Limit who can manage the plugin by users or roles
70
+ * Configurable WordPress dashboard widget highlighting the most recent critical activity
71
+ * Configure WordPress security alerts purging by time or by number of alerts
72
+ * User role is reported in alerts for a complete overview of what is happening
73
+ * User avatar is reported in the alerts for better recognizability
74
+ * Enable or disable any security alerts so they are not logged
75
+ * And much more...
76
+
77
+ * From where WordPress users are logging in
78
+ * Users who created. modified or deleted categories
79
+ * Users who created a blog post, page or a custom post
80
+ * Users who published a blog post, page or a custom post
81
+ * Users who modified published WordPress content such as custom posts, pages or a blog posts
82
+ * Users who moves content such as blog posts or WordPress pages to trash or permanently deletes it
83
+ * Users who modify WordPress widgets
84
+ * Uses who upload or delete any sort of files
85
+ * and much more...
86
+
87
  = WordPress Security Tips & Tricks =
88
  Even if WordPress security is not your cup of tea, the security of your WordPress is your responsibility. Keep yourself up to date with the latest WordPress Security Tips & Tricks. WP White Security frequently publishes WordPress security tips & tricks on the [WordPress Security section](http://www.wpwhitesecurity.com/wordpress-security/) of their blog.
89
 
128
 
129
  == Changelog ==
130
 
131
+ = 1.1.0 (2014-05-27) =
132
+ * New Features
133
+ * User avatar is shown in the alert to allow administrators to easily recognize users and their activity
134
+ * Clickable username in alerts allow administrators to access user's profile instantly
135
+ * User role is reported in alert so administrators can easily track any suspicious behaviour
136
+ * PHP Version checker; upon installation the plugin will check what version of PHP is installed on the system
137
+
138
+ * New WordPress Security Alert for monitoring plugin files
139
+ * Alert 2051: User changed a plugin file using the plugin editor (note: filename and location will also be reported in the alert)
140
+
141
+ * Bug fixes
142
+ * Fixed wrapping problem in alerts dashboard widget
143
+ * Fixed upgrade script to properly create the new tables in the WordPress database
144
+
145
  = 1.0 (2014-05-20) =
146
  * Complete plugin rewrite making the new version more stable and scalable
147
 
294
 
295
  = 0.1 (2013-05-24) =
296
 
297
+ * Initial beta release of WP Security Audit Log.
wp-security-audit-log.php CHANGED
@@ -4,7 +4,8 @@ Plugin Name: WP Security Audit Log
4
  Plugin URI: http://www.wpwhitesecurity.com/wordpress-security-plugins/wp-security-audit-log/
5
  Description: Identify WordPress security issues before they become a problem and keep track of everything happening on your WordPress, including WordPress users activity. Similar to Windows Event Log and Linux Syslog, WP Security Audit Log will generate a security alert for everything that happens on your WordPress blog or website. Use the Audit Log Viewer included in the plugin to see all the security alerts.
6
  Author: WP White Security
7
- Version: 1.0.0
 
8
  Author URI: http://www.wpwhitesecurity.com/
9
  License: GPL2
10
 
@@ -31,6 +32,8 @@ class WpSecurityAuditLog {
31
 
32
  const PLG_CLS_PRFX = 'WSAL_';
33
 
 
 
34
  /**
35
  * Views supervisor.
36
  * @var WSAL_ViewManager
@@ -85,6 +88,7 @@ class WpSecurityAuditLog {
85
  * Initialize plugin.
86
  */
87
  public function __construct(){
 
88
  spl_autoload_register(array($this, 'LoadClass'));
89
 
90
  // load dependencies
@@ -101,28 +105,45 @@ class WpSecurityAuditLog {
101
  // listen for installation event
102
  register_activation_hook(__FILE__, array($this, 'Install'));
103
 
 
 
 
104
  // listen for cleanup event
105
  add_action('wsal_cleanup', array($this, 'CleanUp'));
106
- //add_action('init', array($this, 'CleanUp'));
107
- }
108
-
109
- public function CleanUp(){
110
- foreach($this->_cleanup_hooks as $hook)
111
- call_user_func($hook);
112
- }
113
-
114
- public function AddCleanupHook($hook){
115
- $this->_cleanup_hooks[] = $hook;
116
  }
117
 
118
- public function RemoveCleanupHook($hook){
119
- while(($pos = array_search($hook, $this->_cleanup_hooks)) !== false)
120
- unset($this->_cleanup_hooks[$pos]);
 
 
 
 
 
121
  }
122
 
123
  public function Install(){
124
- WSAL_DB_ActiveRecord::InstallAll();
125
- if($this->CanUpgrade())$this->Upgrade();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  wp_schedule_event(0, 'hourly', 'wsal_cleanup');
127
  }
128
 
@@ -131,10 +152,8 @@ class WpSecurityAuditLog {
131
  wp_unschedule_event(0, 'wsal_cleanup');
132
  }
133
 
134
- public function CanUpgrade(){
135
- global $wpdb;
136
- $table = $wpdb->base_prefix . 'wordpress_auditlog_events';
137
- return $wpdb->get_var('SHOW TABLES LIKE "'.$table.'"') == $table;
138
  }
139
 
140
  public function Upgrade(){
@@ -193,20 +212,10 @@ class WpSecurityAuditLog {
193
  $this->settings->SetWidgetsEnabled(!!$s->showDW);
194
  }
195
 
196
- public function GetBaseUrl(){
197
- return plugins_url('', __FILE__);
198
- }
199
-
200
- public function GetBaseDir(){
201
- return plugin_dir_path(__FILE__);
202
- }
203
-
204
- public function GetBaseName(){
205
- return plugin_basename(__FILE__);
206
- }
207
-
208
  // </editor-fold>
209
 
 
 
210
  /**
211
  * This is the class autoloader. You should not call this directly.
212
  * @param string $class Class name.
@@ -238,6 +247,57 @@ class WpSecurityAuditLog {
238
  substr($file, 0, -4)
239
  );
240
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  }
242
 
243
  // Load extra files
4
  Plugin URI: http://www.wpwhitesecurity.com/wordpress-security-plugins/wp-security-audit-log/
5
  Description: Identify WordPress security issues before they become a problem and keep track of everything happening on your WordPress, including WordPress users activity. Similar to Windows Event Log and Linux Syslog, WP Security Audit Log will generate a security alert for everything that happens on your WordPress blog or website. Use the Audit Log Viewer included in the plugin to see all the security alerts.
6
  Author: WP White Security
7
+ Version: 1.1.0
8
+ Text Domain: wp-security-audit-log
9
  Author URI: http://www.wpwhitesecurity.com/
10
  License: GPL2
11
 
32
 
33
  const PLG_CLS_PRFX = 'WSAL_';
34
 
35
+ const MIN_PHP_VERSION = '5.3.0';
36
+
37
  /**
38
  * Views supervisor.
39
  * @var WSAL_ViewManager
88
  * Initialize plugin.
89
  */
90
  public function __construct(){
91
+ // register autoloader
92
  spl_autoload_register(array($this, 'LoadClass'));
93
 
94
  // load dependencies
105
  // listen for installation event
106
  register_activation_hook(__FILE__, array($this, 'Install'));
107
 
108
+ // makes sure everything is ready
109
+ add_action('init', array($this, 'CheckInstall'));
110
+
111
  // listen for cleanup event
112
  add_action('wsal_cleanup', array($this, 'CleanUp'));
113
+
114
+ // internationalize plugin
115
+ add_action('plugins_loaded', array($this, 'LoadPluginTextdomain'));
 
 
 
 
 
 
 
116
  }
117
 
118
+ public function CheckInstall(){
119
+ // upgrade/update as necesary
120
+ if(!$this->IsInstalled()){
121
+ WSAL_DB_ActiveRecord::InstallAll();
122
+ if ($this->CanUpgrade()) $this->Upgrade();
123
+ }else{
124
+ $this->Update();
125
+ }
126
  }
127
 
128
  public function Install(){
129
+ if (version_compare(PHP_VERSION, self::MIN_PHP_VERSION) < 0) {
130
+ ?><html>
131
+ <head>
132
+ <link rel="stylesheet" href="<?php
133
+ echo esc_attr($this->GetBaseUrl() . '/css/install-error.css?v=' . filemtime($this->GetBaseDir() . '/css/install-error.css'));
134
+ ?>" type="text/css" media="all"/>
135
+ </head><body>
136
+ <div class="warn-wrap">
137
+ <div class="warn-icon-tri"></div><div class="warn-icon-chr">!</div><div class="warn-icon-cir"></div>
138
+ <?php echo sprintf(__('You are using a version of PHP that is older than %s, which is no longer supported.<br/>Contact us on <a href="mailto:plugins@wpwhitesecurity.com">plugins@wpwhitesecurity.com</a> to help you switch the version of PHP you are using.'), self::MIN_PHP_VERSION); ?>
139
+ </div>
140
+ </body>
141
+ </html><?php
142
+ die(1);
143
+ }
144
+
145
+ $this->CheckInstall();
146
+
147
  wp_schedule_event(0, 'hourly', 'wsal_cleanup');
148
  }
149
 
152
  wp_unschedule_event(0, 'wsal_cleanup');
153
  }
154
 
155
+ public function Update(){
156
+
 
 
157
  }
158
 
159
  public function Upgrade(){
212
  $this->settings->SetWidgetsEnabled(!!$s->showDW);
213
  }
214
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  // </editor-fold>
216
 
217
+ // <editor-fold desc="Utility Methods">
218
+
219
  /**
220
  * This is the class autoloader. You should not call this directly.
221
  * @param string $class Class name.
247
  substr($file, 0, -4)
248
  );
249
  }
250
+
251
+ /**
252
+ * @return boolean Whether we are running on multisite or not.
253
+ */
254
+ public function IsMultisite(){
255
+ return funciton_exists('is_multisite') && is_multisite();
256
+ }
257
+
258
+ public function CleanUp(){
259
+ foreach($this->_cleanup_hooks as $hook)
260
+ call_user_func($hook);
261
+ }
262
+
263
+ public function LoadPluginTextdomain(){
264
+ load_plugin_textdomain('wp-security-audit-log', false, $this->GetBaseDir() . 'languages/');
265
+ }
266
+
267
+ public function AddCleanupHook($hook){
268
+ $this->_cleanup_hooks[] = $hook;
269
+ }
270
+
271
+ public function RemoveCleanupHook($hook){
272
+ while(($pos = array_search($hook, $this->_cleanup_hooks)) !== false)
273
+ unset($this->_cleanup_hooks[$pos]);
274
+ }
275
+
276
+ public function IsInstalled(){
277
+ global $wpdb;
278
+ $table = $wpdb->base_prefix . 'wsal_occurrences';
279
+ return ($wpdb->get_var('SHOW TABLES LIKE "'.$table.'"') == $table);
280
+ }
281
+
282
+ public function CanUpgrade(){
283
+ global $wpdb;
284
+ $table = $wpdb->base_prefix . 'wordpress_auditlog_events';
285
+ return ($wpdb->get_var('SHOW TABLES LIKE "'.$table.'"') == $table);
286
+ }
287
+
288
+ public function GetBaseUrl(){
289
+ return plugins_url('', __FILE__);
290
+ }
291
+
292
+ public function GetBaseDir(){
293
+ return plugin_dir_path(__FILE__);
294
+ }
295
+
296
+ public function GetBaseName(){
297
+ return plugin_basename(__FILE__);
298
+ }
299
+
300
+ // </editor-fold>
301
  }
302
 
303
  // Load extra files