Activity Log - Version 2.1.4

Version Description

  • Fixed! Store real IP address in Proxy too (#53)
Download this release

Release Info

Developer KingYes
Plugin Icon 128x128 Activity Log
Version 2.1.4
Comparing to
See all releases

Code changes from version 2.1.3 to 2.1.4

aryo-activity-log.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://wordpress.org/plugins/aryo-activity-log/
5
  Description: Get aware of any activities that are taking place on your dashboard! Imagine it like a black-box for your WordPress site. e.g. post was deleted, plugin was activated, user logged in or logged out - it's all these for you to see.
6
  Author: Yakir Sitbon, Maor Chasen, Ariel Klikstein
7
  Author URI: http://www.aryodigital.com
8
- Version: 2.1.3
9
  Text Domain: aryo-aal
10
  Domain Path: /language/
11
  License: GPLv2 or later
5
  Description: Get aware of any activities that are taking place on your dashboard! Imagine it like a black-box for your WordPress site. e.g. post was deleted, plugin was activated, user logged in or logged out - it's all these for you to see.
6
  Author: Yakir Sitbon, Maor Chasen, Ariel Klikstein
7
  Author URI: http://www.aryodigital.com
8
+ Version: 2.1.4
9
  Text Domain: aryo-aal
10
  Domain Path: /language/
11
  License: GPLv2 or later
classes/class-aal-api.php CHANGED
@@ -16,12 +16,42 @@ class AAL_API {
16
  if ( empty( $logs_lifespan ) )
17
  return;
18
 
19
- $wpdb->query( $wpdb->prepare(
20
- 'DELETE FROM `%1$s`
21
- WHERE `hist_time` < %2$d',
22
- $wpdb->activity_log,
23
- strtotime( '-' . $logs_lifespan . ' days', current_time( 'timestamp' ) )
24
- ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  }
26
 
27
  /**
@@ -31,10 +61,12 @@ class AAL_API {
31
  public function erase_all_items() {
32
  global $wpdb;
33
 
34
- $wpdb->query( $wpdb->prepare(
35
- 'TRUNCATE %1$s',
36
- $wpdb->activity_log
37
- ) );
 
 
38
  }
39
 
40
  /**
@@ -52,7 +84,7 @@ class AAL_API {
52
  'object_subtype' => '',
53
  'object_name' => '',
54
  'object_id' => '',
55
- 'hist_ip' => $_SERVER['REMOTE_ADDR'],
56
  'hist_time' => current_time( 'timestamp' ),
57
  ) );
58
 
@@ -60,11 +92,11 @@ class AAL_API {
60
  if ( $user ) {
61
  $args['user_caps'] = strtolower( key( $user->caps ) );
62
  if ( empty( $args['user_id'] ) )
63
- $args['user_id'] = $user->ID;
64
  } else {
65
  $args['user_caps'] = 'guest';
66
  if ( empty( $args['user_id'] ) )
67
- $args['user_id'] = 0;
68
  }
69
 
70
  // TODO: Find better way to Multisite compatibility.
@@ -72,32 +104,35 @@ class AAL_API {
72
  $args['user_caps'] = 'administrator';
73
 
74
  // Make sure for non duplicate.
75
- $check_duplicate = $wpdb->get_row( $wpdb->prepare(
76
- 'SELECT `histid` FROM %1$s
77
- WHERE `user_caps` = \'%2$s\'
78
- AND `action` = \'%3$s\'
79
- AND `object_type` = \'%4$s\'
80
- AND `object_subtype` = \'%5$s\'
81
- AND `object_name` = \'%6$s\'
82
- AND `user_id` = \'%7$s\'
83
- AND `hist_ip` = \'%8$s\'
84
- AND `hist_time` = \'%9$s\'
85
- ;',
86
- $wpdb->activity_log,
87
- $args['user_caps'],
88
- $args['action'],
89
- $args['object_type'],
90
- $args['object_subtype'],
91
- $args['object_name'],
92
- $args['user_id'],
93
- $args['hist_ip'],
94
- $args['hist_time']
95
- ) );
 
 
96
 
97
  if ( $check_duplicate )
98
  return;
99
 
100
- $wpdb->insert( $wpdb->activity_log,
 
101
  array(
102
  'action' => $args['action'],
103
  'object_type' => $args['object_type'],
@@ -109,7 +144,7 @@ class AAL_API {
109
  'hist_ip' => $args['hist_ip'],
110
  'hist_time' => $args['hist_time'],
111
  ),
112
- array( "%s", "%s", "%s", "%s", "%d", "%d", "%s", "%s", "%d" )
113
  );
114
 
115
  // Remove old items.
16
  if ( empty( $logs_lifespan ) )
17
  return;
18
 
19
+ $wpdb->query(
20
+ $wpdb->prepare(
21
+ 'DELETE FROM `%1$s`
22
+ WHERE `hist_time` < %2$d',
23
+ $wpdb->activity_log,
24
+ strtotime( '-' . $logs_lifespan . ' days', current_time( 'timestamp' ) )
25
+ )
26
+ );
27
+ }
28
+
29
+ /**
30
+ * Get real address
31
+ *
32
+ * @since 2.1.4
33
+ *
34
+ * @return string real address IP
35
+ */
36
+ protected function _get_ip_address() {
37
+ $server_ip_keys = array(
38
+ 'HTTP_CLIENT_IP',
39
+ 'HTTP_X_FORWARDED_FOR',
40
+ 'HTTP_X_FORWARDED',
41
+ 'HTTP_X_CLUSTER_CLIENT_IP',
42
+ 'HTTP_FORWARDED_FOR',
43
+ 'HTTP_FORWARDED',
44
+ 'REMOTE_ADDR',
45
+ );
46
+
47
+ foreach ( $server_ip_keys as $key ) {
48
+ if ( isset( $_SERVER[ $key ] ) ) {
49
+ return $_SERVER[ $key ];
50
+ }
51
+ }
52
+
53
+ // Fallback local ip.
54
+ return '127.0.0.1';
55
  }
56
 
57
  /**
61
  public function erase_all_items() {
62
  global $wpdb;
63
 
64
+ $wpdb->query(
65
+ $wpdb->prepare(
66
+ 'TRUNCATE %1$s',
67
+ $wpdb->activity_log
68
+ )
69
+ );
70
  }
71
 
72
  /**
84
  'object_subtype' => '',
85
  'object_name' => '',
86
  'object_id' => '',
87
+ 'hist_ip' => $this->_get_ip_address(),
88
  'hist_time' => current_time( 'timestamp' ),
89
  ) );
90
 
92
  if ( $user ) {
93
  $args['user_caps'] = strtolower( key( $user->caps ) );
94
  if ( empty( $args['user_id'] ) )
95
+ $args['user_id'] = $user->ID;
96
  } else {
97
  $args['user_caps'] = 'guest';
98
  if ( empty( $args['user_id'] ) )
99
+ $args['user_id'] = 0;
100
  }
101
 
102
  // TODO: Find better way to Multisite compatibility.
104
  $args['user_caps'] = 'administrator';
105
 
106
  // Make sure for non duplicate.
107
+ $check_duplicate = $wpdb->get_row(
108
+ $wpdb->prepare(
109
+ 'SELECT `histid` FROM %1$s
110
+ WHERE `user_caps` = \'%2$s\'
111
+ AND `action` = \'%3$s\'
112
+ AND `object_type` = \'%4$s\'
113
+ AND `object_subtype` = \'%5$s\'
114
+ AND `object_name` = \'%6$s\'
115
+ AND `user_id` = \'%7$s\'
116
+ AND `hist_ip` = \'%8$s\'
117
+ AND `hist_time` = \'%9$s\'
118
+ ;',
119
+ $wpdb->activity_log,
120
+ $args['user_caps'],
121
+ $args['action'],
122
+ $args['object_type'],
123
+ $args['object_subtype'],
124
+ $args['object_name'],
125
+ $args['user_id'],
126
+ $args['hist_ip'],
127
+ $args['hist_time']
128
+ )
129
+ );
130
 
131
  if ( $check_duplicate )
132
  return;
133
 
134
+ $wpdb->insert(
135
+ $wpdb->activity_log,
136
  array(
137
  'action' => $args['action'],
138
  'object_type' => $args['object_type'],
144
  'hist_ip' => $args['hist_ip'],
145
  'hist_time' => $args['hist_time'],
146
  ),
147
+ array( '%s', '%s', '%s', '%s', '%d', '%d', '%s', '%s', '%d' )
148
  );
149
 
150
  // Remove old items.
language/aryo-aal.pot CHANGED
@@ -6,9 +6,9 @@
6
  #, fuzzy
7
  msgid ""
8
  msgstr ""
9
- "Project-Id-Version: aryo-activity-log 2.1.3\n"
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2014-06-15 16:48+0300\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
6
  #, fuzzy
7
  msgid ""
8
  msgstr ""
9
+ "Project-Id-Version: aryo-activity-log 2.1.4\n"
10
  "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2014-06-24 00:22+0300\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === ARYO Activity Log ===
2
- Contributors: KingYes, ariel.k, maor
3
- Tags: access, administration, activity, community, event, monitor, multisite, multi-users, log, logger, audit log, login, network, stats, security, tracking, madeinisrael, woocommerce
4
  Requires at least: 3.5
5
  Tested up to: 3.9
6
- Stable tag: 2.1.3
7
  License: GPLv2 or later
8
 
9
  Get aware of any activities that are taking place on your dashboard! Imagine it like a black-box for your WordPress site.
@@ -37,6 +37,8 @@ If you have tens of users or more, you really can’t know who did it. This plug
37
  * <strong>bbPress</strong> - Forums, Topics, Replies, Taxonomies and other actions
38
  * and much more...
39
 
 
 
40
  <h4>What people are saying</h4>
41
  * <em>“Thanks to this step, we’ve discovered that our site was undergoing a brute force attack”</em> - [artdriver.com](http://www.artdriver.com/wordpress-site-hacked-solution-time/)
42
  * <em>“Optimized code - The plugin itself is blazing fast and leaves almost no footprint on the server.”</em> - [freshtechtips.com](http://www.freshtechtips.com/2014/01/best-audit-trail-plugins-for-wordpress.html)
@@ -71,6 +73,7 @@ Would you like to like to contribute to Activity Log? You are more than welcome
71
  1. The log viewer page
72
  2. The settings page
73
  3. Screen Options
 
74
 
75
  == Frequently Asked Questions ==
76
 
@@ -84,6 +87,9 @@ Would you like to like to contribute to Activity Log? You are more than welcome
84
 
85
  == Changelog ==
86
 
 
 
 
87
  = 2.1.3 =
88
  * New! Added translate: Dutch (nl_NL) - Thanks to [Tom Aalbers](http://securancy.com/) ([#55](https://github.com/KingYes/wordpress-aryo-activity-log/issues/55))
89
 
1
  === ARYO Activity Log ===
2
+ Contributors: pojo.me, KingYes, ariel.k, maor
3
+ Tags: access, administration, activity, community, event, monitor, multisite, multi-users, log, logger, audit log, login, network, stats, security, tracking, madeinisrael, woocommerce, notifications, email notifications
4
  Requires at least: 3.5
5
  Tested up to: 3.9
6
+ Stable tag: 2.1.4
7
  License: GPLv2 or later
8
 
9
  Get aware of any activities that are taking place on your dashboard! Imagine it like a black-box for your WordPress site.
37
  * <strong>bbPress</strong> - Forums, Topics, Replies, Taxonomies and other actions
38
  * and much more...
39
 
40
+ <strong>New!</strong> You are now able to get email notifications once an event you have defined (via rules) has occured. This is useful in cases you must know right away when someone does something on your site.
41
+
42
  <h4>What people are saying</h4>
43
  * <em>“Thanks to this step, we’ve discovered that our site was undergoing a brute force attack”</em> - [artdriver.com](http://www.artdriver.com/wordpress-site-hacked-solution-time/)
44
  * <em>“Optimized code - The plugin itself is blazing fast and leaves almost no footprint on the server.”</em> - [freshtechtips.com](http://www.freshtechtips.com/2014/01/best-audit-trail-plugins-for-wordpress.html)
73
  1. The log viewer page
74
  2. The settings page
75
  3. Screen Options
76
+ 4. Interface for defining notification rules
77
 
78
  == Frequently Asked Questions ==
79
 
87
 
88
  == Changelog ==
89
 
90
+ = 2.1.4 =
91
+ * Fixed! Store real IP address in Proxy too ([#53](https://github.com/KingYes/wordpress-aryo-activity-log/issues/53))
92
+
93
  = 2.1.3 =
94
  * New! Added translate: Dutch (nl_NL) - Thanks to [Tom Aalbers](http://securancy.com/) ([#55](https://github.com/KingYes/wordpress-aryo-activity-log/issues/55))
95
 
screenshot-4.png ADDED
Binary file