Advanced Access Manager - Version 6.7.5

Version Description

  • Fixed Bug: Access Policy breaks Broadcaster Plugin by @SEA-NET https://github.com/aamplugin/advanced-access-manager/issues/170
  • Changed: Enhanced the premium life-cycle management https://github.com/aamplugin/advanced-access-manager/issues/173
Download this release

Release Info

Developer vasyltech
Plugin Icon 128x128 Advanced Access Manager
Version 6.7.5
Comparing to
See all releases

Code changes from version 6.7.4 to 6.7.5

aam.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  * Plugin Name: Advanced Access Manager
5
  * Description: Collection of features to manage your WordPress website authentication, authorization and monitoring
6
- * Version: 6.7.4
7
  * Author: Vasyl Martyniuk <vasyl@vasyltech.com>
8
  * Author URI: https://vasyltech.com
9
  * Text Domain: advanced-access-manager
@@ -264,7 +264,7 @@ if (defined('ABSPATH')) {
264
  //define few common constants
265
  define('AAM_MEDIA', plugins_url('/media', __FILE__));
266
  define('AAM_KEY', 'advanced-access-manager');
267
- define('AAM_VERSION', '6.7.4');
268
  define('AAM_BASEDIR', __DIR__);
269
 
270
  //load vendor
3
  /**
4
  * Plugin Name: Advanced Access Manager
5
  * Description: Collection of features to manage your WordPress website authentication, authorization and monitoring
6
+ * Version: 6.7.5
7
  * Author: Vasyl Martyniuk <vasyl@vasyltech.com>
8
  * Author URI: https://vasyltech.com
9
  * Text Domain: advanced-access-manager
264
  //define few common constants
265
  define('AAM_MEDIA', plugins_url('/media', __FILE__));
266
  define('AAM_KEY', 'advanced-access-manager');
267
+ define('AAM_VERSION', '6.7.5');
268
  define('AAM_BASEDIR', __DIR__);
269
 
270
  //load vendor
application/Addon/Repository.php CHANGED
@@ -10,6 +10,7 @@
10
  /**
11
  * Addon repository
12
  *
 
13
  * @since 6.4.3 Fixed https://github.com/aamplugin/advanced-access-manager/issues/92
14
  * @since 6.4.2 Implemented https://github.com/aamplugin/advanced-access-manager/issues/88
15
  * @since 6.4.1 Fixed https://github.com/aamplugin/advanced-access-manager/issues/81
@@ -19,7 +20,7 @@
19
  * @since 6.0.0 Initial implementation of the class
20
  *
21
  * @package AAM
22
- * @version 6.4.3
23
  */
24
  class AAM_Addon_Repository
25
  {
@@ -33,6 +34,45 @@ class AAM_Addon_Repository
33
  */
34
  const DB_OPTION = 'aam_addons';
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  /**
37
  * Constructor
38
  *
@@ -64,24 +104,67 @@ class AAM_Addon_Repository
64
  * @access public
65
  * @version 6.4.2
66
  */
67
- public function getRegistry($license_only = false)
68
  {
69
- $response = array();
70
- $registry = AAM_Core_API::getOption(
71
- self::DB_OPTION, array(), AAM_Core_API::getMainSiteId()
72
- );
 
 
 
73
 
74
- if ($license_only === true) {
75
- foreach($registry as $slug => $data) {
76
- if (!empty($data['license'])) {
77
- $response[$slug] = $data['license'];
 
 
 
 
 
 
 
 
78
  }
79
  }
80
- } else {
81
- $response = $registry;
82
  }
83
 
84
- return (is_array($response) ? $response : array());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  }
86
 
87
  /**
@@ -97,6 +180,19 @@ class AAM_Addon_Repository
97
  return count($this->getRegistry()) > 0;
98
  }
99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  /**
101
  * Store the license key
102
  *
@@ -105,11 +201,12 @@ class AAM_Addon_Repository
105
  *
106
  * @return boolean
107
  *
 
108
  * @since 6.4.2 Fixed https://github.com/aamplugin/advanced-access-manager/issues/81
109
  * @since 6.0.5 Initial implementation of the method
110
  *
111
  * @access public
112
- * @version 6.4.2
113
  */
114
  public function registerLicense($package, $license)
115
  {
@@ -120,9 +217,64 @@ class AAM_Addon_Repository
120
  );
121
 
122
  // Update the registry
123
- return AAM_Core_API::updateOption(
124
  self::DB_OPTION, $list, AAM_Core_API::getMainSiteId()
125
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  }
127
 
128
  /**
@@ -130,50 +282,27 @@ class AAM_Addon_Repository
130
  *
131
  * @return array
132
  *
 
133
  * @since 6.4.2 Added https://github.com/aamplugin/advanced-access-manager/issues/88
134
  * @since 6.0.0 Initial implementation of the method
135
  *
136
  * @access public
137
- * @version 6.4.2
138
  */
139
  public function getList()
140
  {
141
- return array(
142
- 'aam-plus-package' => $this->buildAddonObject(
143
- 'Plus Package',
144
- 'plus-package',
145
- __('Manage access to your WordPress website posts, pages, media, custom post types, categories, tags and custom taxonomies for any role, individual user, visitors or even define default access for everybody; and do this separately for frontend, backend or API levels.', AAM_KEY),
146
- '5.4.2'
147
- ),
148
- 'aam-ip-check' => $this->buildAddonObject(
149
- 'IP Check',
150
- 'ip-check',
151
- __('Manage access to your WordPress website by users IP address or referred host and completely lock down the entire website if necessary. Define the unlimited number of whitelisted or blacklisted IPs or hosts.', AAM_KEY),
152
- '4.1.4'
153
- ),
154
- 'aam-role-hierarchy' => $this->buildAddonObject(
155
- 'Role Hierarchy',
156
- 'role-hierarchy',
157
- __('Define and manage complex WordPress role hierarchy where all the access settings are propagated down the tree with the ability to override any settings for any specific role.', AAM_KEY),
158
- '3.0.1'
159
- ),
160
- /**
161
- * TODO: Release this extension after AAM 6.0.0. Enhance it with
162
- * subscription functionality and possibly with email notification
163
- * integration
164
- 'aam-ecommerce' => $this->buildAddonObject(
165
- 'E-Commerce',
166
- 'ecommerce',
167
- __('Start monetizing access to your premium content. Restrict access to read any WordPress post, page or custom post type until user purchase access to it.', AAM_KEY)
168
- ),
169
- */
170
- 'aam-complete-package' => $this->buildAddonObject(
171
- 'Complete Package',
172
- 'complete-package',
173
- __('Get the complete list of all premium AAM addons in one package and all future premium addons will be included for now additional cost.', AAM_KEY),
174
- '5.2.8'
175
- )
176
- );
177
  }
178
 
179
  /**
@@ -293,7 +422,7 @@ class AAM_Addon_Repository
293
  */
294
  protected function isPluginActive($plugin)
295
  {
296
- $data = self::getPluginData($plugin);
297
 
298
  if (!empty($data)) {
299
  $active = is_plugin_active($plugin);
10
  /**
11
  * Addon repository
12
  *
13
+ * @since 6.7.5 https://github.com/aamplugin/advanced-access-manager/issues/173
14
  * @since 6.4.3 Fixed https://github.com/aamplugin/advanced-access-manager/issues/92
15
  * @since 6.4.2 Implemented https://github.com/aamplugin/advanced-access-manager/issues/88
16
  * @since 6.4.1 Fixed https://github.com/aamplugin/advanced-access-manager/issues/81
20
  * @since 6.0.0 Initial implementation of the class
21
  *
22
  * @package AAM
23
+ * @version 6.7.5
24
  */
25
  class AAM_Addon_Repository
26
  {
34
  */
35
  const DB_OPTION = 'aam_addons';
36
 
37
+ /**
38
+ * Collection of license violations
39
+ *
40
+ * @version 6.7.5
41
+ */
42
+ const DB_VIOLATION_OPTION = 'aam_violations';
43
+
44
+ /**
45
+ * Official list of available addons
46
+ *
47
+ * @version 6.7.5
48
+ */
49
+ const OFFICIAL_ADDON_LIST = array(
50
+ 'aam-plus-package' => array(
51
+ 'title' => 'Plus Package',
52
+ 'slug' => 'plus-package',
53
+ 'description' => 'Manage access to your WordPress website posts, pages, media, custom post types, categories, tags and custom taxonomies for any role, individual user, visitors or even define default access for everybody; and do this separately for frontend, backend or API levels.',
54
+ 'version' => '5.4.2'
55
+ ),
56
+ 'aam-ip-check' => array(
57
+ 'title' => 'IP Check',
58
+ 'slug' => 'ip-check',
59
+ 'description' => 'Manage access to your WordPress website by users IP address or referred host and completely lock down the entire website if necessary. Define the unlimited number of whitelisted or blacklisted IPs or hosts.',
60
+ 'version' => '4.1.4'
61
+ ),
62
+ 'aam-role-hierarchy' => array(
63
+ 'title' => 'Role Hierarchy',
64
+ 'slug' => 'role-hierarchy',
65
+ 'description' => 'Define and manage complex WordPress role hierarchy where all the access settings are propagated down the tree with the ability to override any settings for any specific role.',
66
+ 'version' => '3.0.1'
67
+ ),
68
+ 'aam-complete-package' => array(
69
+ 'title' => 'Complete Package',
70
+ 'slug' => 'complete-package',
71
+ 'description' => 'Get the complete list of all premium AAM addons in one package and all future premium addons will be included for now additional cost.',
72
+ 'version' => '5.2.8'
73
+ ),
74
+ );
75
+
76
  /**
77
  * Constructor
78
  *
104
  * @access public
105
  * @version 6.4.2
106
  */
107
+ public function getRegistry()
108
  {
109
+ static $registry = null;
110
+
111
+ if (is_null($registry)) {
112
+ $registry = array();
113
+ $option = AAM_Core_API::getOption(
114
+ self::DB_OPTION, array(), AAM_Core_API::getMainSiteId()
115
+ );
116
 
117
+ // Iterate over the list of official add-ons and check if there is any
118
+ // installed
119
+ foreach(array_keys(self::OFFICIAL_ADDON_LIST) as $id) {
120
+ $plugin = $this->getPluginData($id);
121
+
122
+ if (!is_null($plugin)) { // Capturing the fact that add-on is installed
123
+ $registry[$id] = null;
124
+ }
125
+
126
+ // Finally merge official addons with respective licenses
127
+ if (!empty($option[$id])) {
128
+ $registry[$id] = $option[$id];
129
  }
130
  }
 
 
131
  }
132
 
133
+ return $registry;
134
+ }
135
+
136
+ /**
137
+ * Get key/value pair of add-ons
138
+ *
139
+ * @return array
140
+ *
141
+ * @access public
142
+ * @version 6.7.5
143
+ */
144
+ public function getAddonLicenseMap()
145
+ {
146
+ $response = array();
147
+
148
+ foreach($this->getRegistry() as $id => $data) {
149
+ $response[$id] = !empty($data['license']) ? $data['license'] : null;
150
+ }
151
+
152
+ return $response;
153
+ }
154
+
155
+ /**
156
+ * Get list of violations
157
+ *
158
+ * @return array
159
+ *
160
+ * @access public
161
+ * @version 6.7.5
162
+ */
163
+ public function getViolations()
164
+ {
165
+ return AAM_Core_API::getOption(
166
+ self::DB_VIOLATION_OPTION, array(), AAM_Core_API::getMainSiteId()
167
+ );
168
  }
169
 
170
  /**
180
  return count($this->getRegistry()) > 0;
181
  }
182
 
183
+ /**
184
+ * Check if there are any violations registered
185
+ *
186
+ * @return boolean
187
+ *
188
+ * @access public
189
+ * @since 6.7.5
190
+ */
191
+ public function hasViolations()
192
+ {
193
+ return count($this->getViolations()) > 0;
194
+ }
195
+
196
  /**
197
  * Store the license key
198
  *
201
  *
202
  * @return boolean
203
  *
204
+ * @since 6.7.5 https://github.com/aamplugin/advanced-access-manager/issues/173
205
  * @since 6.4.2 Fixed https://github.com/aamplugin/advanced-access-manager/issues/81
206
  * @since 6.0.5 Initial implementation of the method
207
  *
208
  * @access public
209
+ * @version 6.7.5
210
  */
211
  public function registerLicense($package, $license)
212
  {
217
  );
218
 
219
  // Update the registry
220
+ $result = AAM_Core_API::updateOption(
221
  self::DB_OPTION, $list, AAM_Core_API::getMainSiteId()
222
  );
223
+
224
+ // If there are any violations, clear them
225
+ $this->removeViolation($package['slug']);
226
+
227
+ return $result;
228
+ }
229
+
230
+ /**
231
+ * Remove registered violation for a given addon
232
+ *
233
+ * @param string $addon
234
+ *
235
+ * @return void
236
+ *
237
+ * @access public
238
+ * @version 6.7.5
239
+ */
240
+ public function removeViolation($addon)
241
+ {
242
+ $violations = $this->getViolations();
243
+
244
+ if (isset($violations[$addon])) {
245
+ unset($violations[$addon]);
246
+
247
+ AAM_Core_API::updateOption(
248
+ self::DB_VIOLATION_OPTION, $violations, AAM_Core_API::getMainSiteId()
249
+ );
250
+ }
251
+ }
252
+
253
+ /**
254
+ * Register new license violation and process the action if defined
255
+ *
256
+ * @param string $addon
257
+ * @param string $message
258
+ * @param string $action
259
+ *
260
+ * @return void
261
+ *
262
+ * @access public
263
+ * @version 6.7.5
264
+ */
265
+ public function processViolation($addon, $message, $action = null)
266
+ {
267
+ $violations = $this->getViolations();
268
+ $violations[$addon] = $message;
269
+
270
+ // Store the violation for the further displaying
271
+ AAM_Core_API::updateOption(
272
+ self::DB_VIOLATION_OPTION, $violations, AAM_Core_API::getMainSiteId()
273
+ );
274
+
275
+ if ($action === 'deactivate') {
276
+ deactivate_plugins("{$addon}/bootstrap.php", true, is_network_admin());
277
+ }
278
  }
279
 
280
  /**
282
  *
283
  * @return array
284
  *
285
+ * @since 6.7.5 https://github.com/aamplugin/advanced-access-manager/issues/173
286
  * @since 6.4.2 Added https://github.com/aamplugin/advanced-access-manager/issues/88
287
  * @since 6.0.0 Initial implementation of the method
288
  *
289
  * @access public
290
+ * @version 6.7.5
291
  */
292
  public function getList()
293
  {
294
+ $response = array();
295
+
296
+ foreach(self::OFFICIAL_ADDON_LIST as $id => $details) {
297
+ $response[$id] = $this->buildAddonObject(
298
+ $details['title'],
299
+ $details['slug'],
300
+ __($details['description'], AAM_KEY),
301
+ $details['version']
302
+ );
303
+ }
304
+
305
+ return $response;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
306
  }
307
 
308
  /**
422
  */
423
  protected function isPluginActive($plugin)
424
  {
425
+ $data = $this->getPluginData($plugin);
426
 
427
  if (!empty($data)) {
428
  $active = is_plugin_active($plugin);
application/Backend/Feature/Addons/Manager.php CHANGED
@@ -10,8 +10,11 @@
10
  /**
11
  * Add-on manager
12
  *
 
 
 
13
  * @package AAM
14
- * @version 6.0.5
15
  */
16
  class AAM_Backend_Feature_Addons_Manager extends AAM_Backend_Feature_Abstract
17
  {
@@ -53,13 +56,16 @@ class AAM_Backend_Feature_Addons_Manager extends AAM_Backend_Feature_Abstract
53
  *
54
  * @return string
55
  *
 
 
 
56
  * @access public
57
- * @version 6.0.5
58
  */
59
  public function getRegistry()
60
  {
61
  return wp_json_encode(
62
- AAM_Addon_Repository::getInstance()->getRegistry(true)
63
  );
64
  }
65
 
@@ -68,8 +74,11 @@ class AAM_Backend_Feature_Addons_Manager extends AAM_Backend_Feature_Abstract
68
  *
69
  * @return string
70
  *
 
 
 
71
  * @access public
72
- * @version 6.0.5
73
  */
74
  public function checkForPluginUpdates()
75
  {
@@ -85,6 +94,14 @@ class AAM_Backend_Feature_Addons_Manager extends AAM_Backend_Feature_Abstract
85
  $current->response[$data->plugin] = $data;
86
  unset($current->no_update[$data->plugin]);
87
  }
 
 
 
 
 
 
 
 
88
  }
89
  }
90
 
10
  /**
11
  * Add-on manager
12
  *
13
+ * @since 6.7.5 https://github.com/aamplugin/advanced-access-manager/issues/173
14
+ * @since 6.0.5 Initial implementation of the class
15
+ *
16
  * @package AAM
17
+ * @version 6.7.5
18
  */
19
  class AAM_Backend_Feature_Addons_Manager extends AAM_Backend_Feature_Abstract
20
  {
56
  *
57
  * @return string
58
  *
59
+ * @since 6.7.5 https://github.com/aamplugin/advanced-access-manager/issues/173
60
+ * @since 6.0.5 Initial version of the method
61
+ *
62
  * @access public
63
+ * @version 6.7.5
64
  */
65
  public function getRegistry()
66
  {
67
  return wp_json_encode(
68
+ AAM_Addon_Repository::getInstance()->getAddonLicenseMap()
69
  );
70
  }
71
 
74
  *
75
  * @return string
76
  *
77
+ * @since 6.7.5 https://github.com/aamplugin/advanced-access-manager/issues/173
78
+ * @since 6.0.5 Initial implementation of the method
79
+ *
80
  * @access public
81
+ * @version 6.7.5
82
  */
83
  public function checkForPluginUpdates()
84
  {
94
  $current->response[$data->plugin] = $data;
95
  unset($current->no_update[$data->plugin]);
96
  }
97
+
98
+ if (!empty($data->violation)) {
99
+ AAM_Addon_Repository::getInstance()->processViolation(
100
+ $data->slug,
101
+ $data->violation,
102
+ (isset($data->action) ? $data->action : null)
103
+ );
104
+ }
105
  }
106
  }
107
 
application/Backend/tmpl/page/addon-panel.php CHANGED
@@ -1,12 +1,14 @@
1
  <?php
2
- /**
3
- * @since 6.4.0 Fixed https://github.com/aamplugin/advanced-access-manager/issues/78
4
- * @since 6.2.0 Removed expiration date for license to avoid confusion
5
- * @since 6.0.5 Fixed typo in the license expiration property. Enriched plugin' status display
6
- * @since 6.0.0 Initial implementation of the template
7
- *
8
- * @version 6.4.0
9
- * */
 
 
10
  ?>
11
 
12
  <?php if (defined('AAM_KEY')) { ?>
@@ -19,15 +21,26 @@
19
  </div>
20
  </div>
21
 
22
- <label for="extension-key"><?php echo __('Download Addon', AAM_KEY); ?> <a href="#license-key-info-modal" data-toggle="modal"><i class="icon-help-circled"></i></a></label>
23
  <div class="row">
24
- <div class="col-xs-8">
25
  <div class="form-group">
26
  <input type="text" class="form-control" id="extension-key" placeholder="<?php echo __('Enter The License Key', AAM_KEY); ?>" />
27
  </div>
28
  </div>
29
- <div class="col-xs-4">
30
- <button class="btn btn-primary btn-block" id="download-extension"><i class="icon-download-cloud"></i> <?php echo __('Download', AAM_KEY); ?></button>
 
 
 
 
 
 
 
 
 
 
 
31
  </div>
32
  </div>
33
 
@@ -119,4 +132,4 @@
119
  </div>
120
  </div>
121
  </div>
122
- <?php }
1
  <?php
2
+
3
+ /**
4
+ * @since 6.7.5 https://github.com/aamplugin/advanced-access-manager/issues/173
5
+ * @since 6.4.0 Fixed https://github.com/aamplugin/advanced-access-manager/issues/78
6
+ * @since 6.2.0 Removed expiration date for license to avoid confusion
7
+ * @since 6.0.5 Fixed typo in the license expiration property. Enriched plugin' status display
8
+ * @since 6.0.0 Initial implementation of the template
9
+ *
10
+ * @version 6.7.5
11
+ * */
12
  ?>
13
 
14
  <?php if (defined('AAM_KEY')) { ?>
21
  </div>
22
  </div>
23
 
24
+ <label for="extension-key"><?php echo __('License Key', AAM_KEY); ?> <a href="#license-key-info-modal" data-toggle="modal"><i class="icon-help-circled"></i></a></label>
25
  <div class="row">
26
+ <div class="col-xs-6">
27
  <div class="form-group">
28
  <input type="text" class="form-control" id="extension-key" placeholder="<?php echo __('Enter The License Key', AAM_KEY); ?>" />
29
  </div>
30
  </div>
31
+ <div class="col-xs-3">
32
+ <button class="btn btn-primary btn-block" id="download-extension"><i class="icon-download-cloud"></i> <?php echo __('Download Addon', AAM_KEY); ?></button>
33
+ </div>
34
+ <div class="col-xs-3">
35
+ <div class="btn-group">
36
+ <button type="button" class="btn btn-success btn-block dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
37
+ <?php echo __('Register Website As', AAM_KEY); ?> <span class="caret"></span>
38
+ </button>
39
+ <ul class="dropdown-menu">
40
+ <li><a href="#" class="register-license" data-type="dev"><?php echo __('Development Site', AAM_KEY); ?></a></li>
41
+ <li><a href="#" class="register-license" data-type="prod"><?php echo __('Live Site', AAM_KEY); ?></a></li>
42
+ </ul>
43
+ </div>
44
  </div>
45
  </div>
46
 
132
  </div>
133
  </div>
134
  </div>
135
+ <?php }
application/Backend/tmpl/partial/license-violation-notice.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /** @version 6.7.5 */ ?>
2
+
3
+ <?php if (defined('AAM_KEY')) { ?>
4
+ <?php $violations = AAM_Addon_Repository::getInstance()->getViolations(); ?>
5
+ <div class="notice notice-warning is-dismissible">
6
+ <p>
7
+ <?php if (count($violations) === 1) { ?>
8
+ <?php echo __('There is an issue with one Advanced Access Manager premium license.', AAM_KEY); ?>
9
+ <?php } else { ?>
10
+ <?php echo __('There are multiple issues with Advanced Access Manager premium licenses.', AAM_KEY); ?>
11
+ <?php } ?>
12
+ <?php echo sprintf(__('For more information, please follow %sthe link%s.', AAM_KEY), '<a href="' . admin_url('admin.php?page=aam') . '">', '</a>'); ?>
13
+ </p>
14
+ </div>
15
+ <?php } ?>
application/Core/Server.php CHANGED
@@ -45,7 +45,7 @@ final class AAM_Core_Server
45
  $endpoint = getenv("AAM_API_{$v}_ENDPOINT");
46
 
47
  if (empty($endpoint)) {
48
- $endpoint = ($v === 'V1' ? self::SERVER_V1_URL : self::SERVER_V2_URL);
49
  }
50
 
51
  return $endpoint;
45
  $endpoint = getenv("AAM_API_{$v}_ENDPOINT");
46
 
47
  if (empty($endpoint)) {
48
+ $endpoint = self::SERVER_V2_URL;
49
  }
50
 
51
  return $endpoint;
application/Service/Core.php CHANGED
@@ -10,6 +10,7 @@
10
  /**
11
  * AAM core service
12
  *
 
13
  * @since 6.5.3 https://github.com/aamplugin/advanced-access-manager/issues/126
14
  * @since 6.4.2 Fixed https://github.com/aamplugin/advanced-access-manager/issues/82
15
  * @since 6.4.0 Added "Manage Access" toolbar item to single & multisite network
@@ -18,7 +19,7 @@
18
  * @since 6.0.0 Initial implementation of the class
19
  *
20
  * @package AAM
21
- * @version 6.5.3
22
  */
23
  class AAM_Service_Core
24
  {
@@ -134,6 +135,23 @@ class AAM_Service_Core
134
  add_action('aam_set_user_expiration_action', function($settings) {
135
  AAM::getUser()->setUserExpiration($settings);
136
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  }
138
 
139
  /**
@@ -145,11 +163,12 @@ class AAM_Service_Core
145
  *
146
  * @return array
147
  *
 
148
  * @since 6.5.3 https://github.com/aamplugin/advanced-access-manager/issues/126
149
  * @since 6.0.0 Initial implementation of the method
150
  *
151
  * @access public
152
- * @version 6.5.3
153
  */
154
  public function checkForUpdates($response, $r, $url)
155
  {
@@ -164,8 +183,7 @@ class AAM_Service_Core
164
  'Accept' => 'application/json',
165
  'Content-Type' => 'application/json'
166
  ),
167
- // Here we are passing ONLY license numbers and expiration dates
168
- 'body' => wp_json_encode($repository->getRegistry(true))
169
  )
170
  );
171
 
@@ -189,6 +207,14 @@ class AAM_Service_Core
189
  if (!empty($v) && (version_compare($v, $new_v) === -1)) {
190
  $original['plugins'][$item['plugin']] = $item;
191
  }
 
 
 
 
 
 
 
 
192
  }
193
  }
194
 
10
  /**
11
  * AAM core service
12
  *
13
+ * @since 6.7.5 https://github.com/aamplugin/advanced-access-manager/issues/173
14
  * @since 6.5.3 https://github.com/aamplugin/advanced-access-manager/issues/126
15
  * @since 6.4.2 Fixed https://github.com/aamplugin/advanced-access-manager/issues/82
16
  * @since 6.4.0 Added "Manage Access" toolbar item to single & multisite network
19
  * @since 6.0.0 Initial implementation of the class
20
  *
21
  * @package AAM
22
+ * @version 6.7.5
23
  */
24
  class AAM_Service_Core
25
  {
135
  add_action('aam_set_user_expiration_action', function($settings) {
136
  AAM::getUser()->setUserExpiration($settings);
137
  });
138
+
139
+ // If there are any license violations. Display the notification for users
140
+ // that have enough permissions to manage AAM
141
+ if (is_admin() && current_user_can('aam_manager')) {
142
+ if (AAM_Addon_Repository::getInstance()->hasViolations()) {
143
+ if (!AAM::isAAM()) {
144
+ add_action('admin_notices', function() {
145
+ require __DIR__ . '/../Backend/tmpl/partial/license-violation-notice.php';
146
+ });
147
+ }
148
+
149
+ // Also add all the identified violations to the AAM console
150
+ foreach(AAM_Addon_Repository::getInstance()->getViolations() as $v) {
151
+ AAM_Core_Console::add($v);
152
+ }
153
+ }
154
+ }
155
  }
156
 
157
  /**
163
  *
164
  * @return array
165
  *
166
+ * @since 6.7.5 https://github.com/aamplugin/advanced-access-manager/issues/173
167
  * @since 6.5.3 https://github.com/aamplugin/advanced-access-manager/issues/126
168
  * @since 6.0.0 Initial implementation of the method
169
  *
170
  * @access public
171
+ * @version 6.7.5
172
  */
173
  public function checkForUpdates($response, $r, $url)
174
  {
183
  'Accept' => 'application/json',
184
  'Content-Type' => 'application/json'
185
  ),
186
+ 'body' => wp_json_encode($repository->getAddonLicenseMap())
 
187
  )
188
  );
189
 
207
  if (!empty($v) && (version_compare($v, $new_v) === -1)) {
208
  $original['plugins'][$item['plugin']] = $item;
209
  }
210
+
211
+ if (!empty($item['violation'])) {
212
+ $repository->processViolation(
213
+ $item['slug'],
214
+ $item['violation'],
215
+ (isset($item['action']) ? $item['action'] : null)
216
+ );
217
+ }
218
  }
219
  }
220
 
application/Service/Multisite.php CHANGED
@@ -10,13 +10,14 @@
10
  /**
11
  * Multisite service
12
  *
 
13
  * @since 6.4.2 Fixed https://github.com/aamplugin/advanced-access-manager/issues/81
14
  * @since 6.3.0 Rewrote the way options are synced across the network
15
  * @since 6.2.2 Fixed the bug where reset settings was not synced across all sites
16
  * @since 6.2.0 Initial implementation of the class
17
  *
18
  * @package AAM
19
- * @version 6.4.2
20
  */
21
  class AAM_Service_Multisite
22
  {
@@ -42,19 +43,6 @@ class AAM_Service_Multisite
42
  */
43
  protected $syncing = false;
44
 
45
- /**
46
- * Previously used blog ID
47
- *
48
- * When multisite setup, AAM stores all the policies in the main blog so they
49
- * can be applied to the entire network.
50
- *
51
- * @var int
52
- *
53
- * @access protected
54
- * @version 6.2.0
55
- */
56
- protected $switch_back_blog_id = null;
57
-
58
  /**
59
  * Constructor
60
  *
@@ -90,13 +78,14 @@ class AAM_Service_Multisite
90
  *
91
  * @return void
92
  *
 
93
  * @since 6.4.2 Fixed https://github.com/aamplugin/advanced-access-manager/issues/81
94
  * @since 6.3.0 Optimized for Multisite setup
95
  * @since 6.2.2 Hooks to the setting clearing and policy table list
96
  * @since 6.2.0 Initial implementation of the method
97
  *
98
  * @access protected
99
- * @version 6.4.2
100
  */
101
  protected function initializeHooks()
102
  {
@@ -163,12 +152,11 @@ class AAM_Service_Multisite
163
  });
164
 
165
  add_action('aam_pre_policy_fetch_action', function() {
166
- $this->switch_back_blog_id = get_current_blog_id();
167
  switch_to_blog(AAM_Core_API::getMainSiteId());
168
  });
169
 
170
  add_action('aam_post_policy_fetch_action', function() {
171
- switch_to_blog($this->switch_back_blog_id);
172
  });
173
 
174
  add_action('wp', function() {
10
  /**
11
  * Multisite service
12
  *
13
+ * @since 6.7.5 https://github.com/aamplugin/advanced-access-manager/issues/170
14
  * @since 6.4.2 Fixed https://github.com/aamplugin/advanced-access-manager/issues/81
15
  * @since 6.3.0 Rewrote the way options are synced across the network
16
  * @since 6.2.2 Fixed the bug where reset settings was not synced across all sites
17
  * @since 6.2.0 Initial implementation of the class
18
  *
19
  * @package AAM
20
+ * @version 6.7.5
21
  */
22
  class AAM_Service_Multisite
23
  {
43
  */
44
  protected $syncing = false;
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  /**
47
  * Constructor
48
  *
78
  *
79
  * @return void
80
  *
81
+ * @since 6.7.5 https://github.com/aamplugin/advanced-access-manager/issues/170
82
  * @since 6.4.2 Fixed https://github.com/aamplugin/advanced-access-manager/issues/81
83
  * @since 6.3.0 Optimized for Multisite setup
84
  * @since 6.2.2 Hooks to the setting clearing and policy table list
85
  * @since 6.2.0 Initial implementation of the method
86
  *
87
  * @access protected
88
+ * @version 6.7.5
89
  */
90
  protected function initializeHooks()
91
  {
152
  });
153
 
154
  add_action('aam_pre_policy_fetch_action', function() {
 
155
  switch_to_blog(AAM_Core_API::getMainSiteId());
156
  });
157
 
158
  add_action('aam_post_policy_fetch_action', function() {
159
+ restore_current_blog();
160
  });
161
 
162
  add_action('wp', function() {
media/css/aam.css CHANGED
@@ -1127,7 +1127,7 @@ input[type=radio]:checked + label:before {
1127
  }
1128
 
1129
  .aam-notification-metabox {
1130
- background-color: #CB413A;
1131
  color: #FFFFFF;
1132
  letter-spacing: 0.5px;
1133
  }
1127
  }
1128
 
1129
  .aam-notification-metabox {
1130
+ background-color: #d9534f;
1131
  color: #FFFFFF;
1132
  letter-spacing: 0.5px;
1133
  }
media/js/aam.js CHANGED
@@ -4315,7 +4315,7 @@
4315
  * @param {type} cb
4316
  * @returns {undefined}
4317
  */
4318
- function downloadAddon(license, cb, error) {
4319
  $.ajax(`${getLocal().system.apiEndpoint}/download/${license}`, {
4320
  type: 'GET',
4321
  dataType: 'json',
@@ -4333,6 +4333,34 @@
4333
 
4334
  /**
4335
  *
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4336
  */
4337
  function checkForUpdates(cb) {
4338
  $.ajax(getLocal().ajaxurl, {
@@ -4399,7 +4427,7 @@
4399
  }
4400
 
4401
  $('i', _this).attr('class', 'icon-spin4 animate-spin');
4402
- downloadAddon(license, function (response) {
4403
  if (response) {
4404
  getAAM().downloadFile(
4405
  response.content,
@@ -4418,6 +4446,36 @@
4418
  });
4419
  });
4420
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4421
  $('#check-for-updates').bind('click', function() {
4422
  $('i', $(this)).attr('class', 'icon-spin4 animate-spin');
4423
  checkForUpdates(function() {
4315
  * @param {type} cb
4316
  * @returns {undefined}
4317
  */
4318
+ function validateLicense(license, cb, error) {
4319
  $.ajax(`${getLocal().system.apiEndpoint}/download/${license}`, {
4320
  type: 'GET',
4321
  dataType: 'json',
4333
 
4334
  /**
4335
  *
4336
+ * @param {*} license
4337
+ * @param {*} type
4338
+ * @param {*} cb
4339
+ * @param {*} error
4340
+ */
4341
+ function registerDomain(license, type, cb, error) {
4342
+ $.ajax(`${getLocal().system.apiEndpoint}/register/${license}`, {
4343
+ type: 'POST',
4344
+ dataType: 'json',
4345
+ headers: {
4346
+ "Content-Type": "application/json",
4347
+ "Accept": "application/json"
4348
+ },
4349
+ data: JSON.stringify({
4350
+ is_dev: (type === 'dev')
4351
+ }),
4352
+ success: function (response) {
4353
+ cb(response);
4354
+ },
4355
+ error: function (response) {
4356
+ error(response.responseJSON);
4357
+ }
4358
+ });
4359
+ }
4360
+
4361
+ /**
4362
+ *
4363
+ * @param {*} cb
4364
  */
4365
  function checkForUpdates(cb) {
4366
  $.ajax(getLocal().ajaxurl, {
4427
  }
4428
 
4429
  $('i', _this).attr('class', 'icon-spin4 animate-spin');
4430
+ validateLicense(license, function (response) {
4431
  if (response) {
4432
  getAAM().downloadFile(
4433
  response.content,
4446
  });
4447
  });
4448
 
4449
+ $('.register-license').each(function() {
4450
+ $(this).bind('click', function () {
4451
+ $('#extension-key').parent().removeClass('error');
4452
+
4453
+ var _this = $(this);
4454
+ var license = $.trim($('#extension-key').val());
4455
+
4456
+ if (!license) {
4457
+ $('#extension-key').parent().addClass('error');
4458
+ $('#extension-key').focus();
4459
+ return;
4460
+ }
4461
+
4462
+ $('i', _this).attr('class', 'icon-spin4 animate-spin');
4463
+
4464
+ registerDomain(license, $(this).data('type'), function (response) {
4465
+ getAAM().notification(
4466
+ 'success',
4467
+ 'The website has been registered successfully'
4468
+ );
4469
+ // Store the license in the internal add-ons registry
4470
+ registerLicense(license, response.slug, response.expire);
4471
+ $('i', _this).attr('class', 'icon-check');
4472
+ }, function (response) {
4473
+ getAAM().notification('danger', response.reason);
4474
+ $('i', _this).attr('class', 'icon-check');
4475
+ });
4476
+ });
4477
+ });
4478
+
4479
  $('#check-for-updates').bind('click', function() {
4480
  $('i', $(this)).attr('class', 'icon-spin4 animate-spin');
4481
  checkForUpdates(function() {
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: vasyltech
3
  Tags: access control, membership, backend menu, user role, restricted content, security, jwt
4
  Requires at least: 4.7.0
5
  Requires PHP: 5.6.0
6
- Tested up to: 5.6.1
7
- Stable tag: 6.7.4
8
 
9
  All you need to manage access to WordPress websites on the frontend, backend and API levels for any role, user or visitors.
10
 
@@ -91,6 +91,10 @@ We take security and privacy very seriously, that is why there are several non-n
91
 
92
  == Changelog ==
93
 
 
 
 
 
94
  = 6.7.4 =
95
  * Fixed Bug: Access settings are not saved, reported by @argolein [https://github.com/aamplugin/advanced-access-manager/issues/167](https://github.com/aamplugin/advanced-access-manager/issues/167)
96
  * Changed: INI format warning, reported by @dannysummerlinjstartorg [https://github.com/aamplugin/advanced-access-manager/issues/160](https://github.com/aamplugin/advanced-access-manager/issues/160)
3
  Tags: access control, membership, backend menu, user role, restricted content, security, jwt
4
  Requires at least: 4.7.0
5
  Requires PHP: 5.6.0
6
+ Tested up to: 5.7.0
7
+ Stable tag: 6.7.5
8
 
9
  All you need to manage access to WordPress websites on the frontend, backend and API levels for any role, user or visitors.
10
 
91
 
92
  == Changelog ==
93
 
94
+ = 6.7.5 =
95
+ * Fixed Bug: Access Policy breaks Broadcaster Plugin by @SEA-NET [https://github.com/aamplugin/advanced-access-manager/issues/170](https://github.com/aamplugin/advanced-access-manager/issues/170)
96
+ * Changed: Enhanced the premium life-cycle management [https://github.com/aamplugin/advanced-access-manager/issues/173](https://github.com/aamplugin/advanced-access-manager/issues/173)
97
+
98
  = 6.7.4 =
99
  * Fixed Bug: Access settings are not saved, reported by @argolein [https://github.com/aamplugin/advanced-access-manager/issues/167](https://github.com/aamplugin/advanced-access-manager/issues/167)
100
  * Changed: INI format warning, reported by @dannysummerlinjstartorg [https://github.com/aamplugin/advanced-access-manager/issues/160](https://github.com/aamplugin/advanced-access-manager/issues/160)