Advanced Access Manager - Version 2.7

Version Description

  • Fixed bug with subject managing check
  • Fixed bug with update hook
  • Fixed issue with extension activation hook
  • Added AAM Security Feature. First iteration
  • Improved CSS
Download this release

Release Info

Developer vasyl_m
Plugin Icon 128x128 Advanced Access Manager
Version 2.7
Comparing to
See all releases

Code changes from version 2.6 to 2.7

Files changed (54) hide show
  1. aam.php +19 -4
  2. application/core/extension.php +5 -13
  3. application/core/repository.php +1 -8
  4. application/core/update.php +12 -2
  5. application/view/abstract.php +2 -0
  6. application/view/tmpl/configpress.phtml +17 -7
  7. application/view/tmpl/extension.phtml +10 -4
  8. application/view/tmpl/manager.phtml +2 -9
  9. application/view/tmpl/metabox.phtml +2 -2
  10. application/view/user.php +1 -2
  11. config.php +1 -1
  12. extension/AAM_Secure/extension.php +384 -0
  13. extension/AAM_Secure/geoip/freegeoip.php +31 -0
  14. extension/AAM_Secure/geoip/geoip.php +15 -0
  15. extension/AAM_Secure/index.php +17 -0
  16. extension/AAM_Secure/javascript/loader.js +41 -0
  17. extension/AAM_Secure/javascript/security.js +48 -0
  18. extension/AAM_Secure/security.php +85 -0
  19. extension/AAM_Secure/stylesheet/flags32.css +260 -0
  20. extension/AAM_Secure/stylesheet/images/deny.png +0 -0
  21. extension/AAM_Secure/stylesheet/images/flags32.png +0 -0
  22. extension/AAM_Secure/stylesheet/images/large-iconset.png +0 -0
  23. extension/AAM_Secure/stylesheet/images/restriction.png +0 -0
  24. extension/AAM_Secure/stylesheet/security.css +84 -0
  25. extension/AAM_Secure/view/security.phtml +156 -0
  26. media/css/aam.css +2 -314
  27. media/css/common.css +353 -0
  28. media/css/configpress.css +0 -102
  29. media/css/extension.css +0 -64
  30. media/css/images/common/add.png +0 -0
  31. media/css/images/common/large-iconset.png +0 -0
  32. media/css/images/common/medium-iconset.png +0 -0
  33. media/css/images/{warning.png → common/warning.png} +0 -0
  34. media/css/images/cpanel/help-forum-active.png +0 -0
  35. media/css/images/cpanel/help-forum.png +0 -0
  36. media/css/images/cpanel/message-active.png +0 -0
  37. media/css/images/cpanel/message.png +0 -0
  38. media/css/images/cpanel/restore-active.png +0 -0
  39. media/css/images/cpanel/restore.png +0 -0
  40. media/css/images/cpanel/save-active.png +0 -0
  41. media/css/images/cpanel/save.png +0 -0
  42. media/css/images/cpanel/star-active.png +0 -0
  43. media/css/images/cpanel/star.png +0 -0
  44. media/css/images/cpanel/twitter-active.png +0 -0
  45. media/css/images/cpanel/twitter.png +0 -0
  46. media/css/images/extension/link-active.png +0 -0
  47. media/css/images/extension/link.png +0 -0
  48. media/css/images/extension/message-active.png +0 -0
  49. media/css/images/extension/message.png +0 -0
  50. media/css/images/extension/twitter-active.png +0 -0
  51. media/css/images/extension/twitter.png +0 -0
  52. media/js/aam.js +49 -24
  53. readme.txt +53 -45
  54. screenshot-6.png +0 -0
aam.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  Plugin Name: Advanced Access Manager
5
  Description: Manage User and Role Access to WordPress Backend and Frontend.
6
- Version: 2.6
7
  Author: Vasyl Martyniuk <support@wpaam.com>
8
  Author URI: http://www.wpaam.com
9
 
@@ -727,7 +727,12 @@ class aam {
727
  wp_enqueue_style('global');
728
  wp_enqueue_style('wp-admin');
729
  wp_enqueue_style('aam-ui-style', AAM_MEDIA_URL . 'css/jquery-ui.css');
730
- wp_enqueue_style('aam-style', AAM_MEDIA_URL . 'css/aam.css');
 
 
 
 
 
731
  wp_enqueue_style('aam-datatables', AAM_MEDIA_URL . 'css/jquery.dt.css');
732
  wp_enqueue_style('wp-pointer');
733
  wp_enqueue_style(
@@ -738,10 +743,20 @@ class aam {
738
  wp_enqueue_style('global');
739
  wp_enqueue_style('wp-admin');
740
  wp_enqueue_style('aam-ui-style', AAM_MEDIA_URL . 'css/jquery-ui.css');
741
- wp_enqueue_style('aam-style', AAM_MEDIA_URL . 'css/extension.css');
 
 
 
 
 
742
  wp_enqueue_style('aam-datatables', AAM_MEDIA_URL . 'css/jquery.dt.css');
743
  } elseif ($this->isAAMConfigPressScreen()) {
744
- wp_enqueue_style('aam-style', AAM_MEDIA_URL . 'css/configpress.css');
 
 
 
 
 
745
  wp_enqueue_style('aam-codemirror', AAM_MEDIA_URL . 'css/codemirror.css');
746
  }
747
 
3
  /**
4
  Plugin Name: Advanced Access Manager
5
  Description: Manage User and Role Access to WordPress Backend and Frontend.
6
+ Version: 2.7
7
  Author: Vasyl Martyniuk <support@wpaam.com>
8
  Author URI: http://www.wpaam.com
9
 
727
  wp_enqueue_style('global');
728
  wp_enqueue_style('wp-admin');
729
  wp_enqueue_style('aam-ui-style', AAM_MEDIA_URL . 'css/jquery-ui.css');
730
+ wp_enqueue_style('aam-common-style', AAM_MEDIA_URL . 'css/common.css');
731
+ wp_enqueue_style(
732
+ 'aam-style',
733
+ AAM_MEDIA_URL . 'css/aam.css',
734
+ array('aam-common-style')
735
+ );
736
  wp_enqueue_style('aam-datatables', AAM_MEDIA_URL . 'css/jquery.dt.css');
737
  wp_enqueue_style('wp-pointer');
738
  wp_enqueue_style(
743
  wp_enqueue_style('global');
744
  wp_enqueue_style('wp-admin');
745
  wp_enqueue_style('aam-ui-style', AAM_MEDIA_URL . 'css/jquery-ui.css');
746
+ wp_enqueue_style('aam-common-style', AAM_MEDIA_URL . 'css/common.css');
747
+ wp_enqueue_style(
748
+ 'aam-style',
749
+ AAM_MEDIA_URL . 'css/extension.css',
750
+ array('aam-common-style')
751
+ );
752
  wp_enqueue_style('aam-datatables', AAM_MEDIA_URL . 'css/jquery.dt.css');
753
  } elseif ($this->isAAMConfigPressScreen()) {
754
+ wp_enqueue_style('aam-common-style', AAM_MEDIA_URL . 'css/common.css');
755
+ wp_enqueue_style(
756
+ 'aam-style',
757
+ AAM_MEDIA_URL . 'css/configpress.css',
758
+ array('aam-common-style')
759
+ );
760
  wp_enqueue_style('aam-codemirror', AAM_MEDIA_URL . 'css/codemirror.css');
761
  }
762
 
application/core/extension.php CHANGED
@@ -16,11 +16,6 @@
16
  */
17
  class AAM_Core_Extension {
18
 
19
- /**
20
- * Extension iterator
21
- */
22
- const ITERATOR = 1;
23
-
24
  /**
25
  * Parent AAM object
26
  *
@@ -44,19 +39,16 @@ class AAM_Core_Extension {
44
  }
45
 
46
  /**
47
- * Get extension iterator
48
  *
49
- * Extension iterator is kind of extension's version with the only difference:
50
- * the iterator is incremented only when activation hook has to be fired.
51
- *
52
- * @return int
53
  *
54
  * @access public
55
  */
56
- public function getInterator(){
57
- return self::ITERATOR;
58
  }
59
-
60
  /**
61
  * Set Parent Object
62
  *
16
  */
17
  class AAM_Core_Extension {
18
 
 
 
 
 
 
19
  /**
20
  * Parent AAM object
21
  *
39
  }
40
 
41
  /**
42
+ * Activate hook
43
  *
44
+ * @return boolean
 
 
 
45
  *
46
  * @access public
47
  */
48
+ public function activate(){
49
+ return true;
50
  }
51
+
52
  /**
53
  * Set Parent Object
54
  *
application/core/repository.php CHANGED
@@ -221,7 +221,6 @@ class aam_Core_Repository {
221
  $repository[$extension] = (object) array(
222
  'status' => self::STATUS_INSTALLED,
223
  'license' => $license,
224
- 'iteration' => 0, //this counter is used for extension activation
225
  //ugly way but quick
226
  'basedir' => "{$this->_basedir}/" . str_replace(' ', '_', $extension)
227
  );
@@ -349,13 +348,7 @@ class aam_Core_Repository {
349
  if (file_exists($bootstrap) && !isset($this->_cache[$extension])) {
350
  //bootstrap the extension
351
  $this->_cache[$extension] = require_once($bootstrap);
352
- //TODO - Implement Iterator here!!
353
- //check if activation hook still present and trigger warning if yes
354
- if (file_exists($this->_basedir . "/{$extension}/activation.php")){
355
- aam_Core_Console::add(
356
- "Activation hook for {$extension} is not deleted"
357
- );
358
- }
359
  }
360
  }
361
 
221
  $repository[$extension] = (object) array(
222
  'status' => self::STATUS_INSTALLED,
223
  'license' => $license,
 
224
  //ugly way but quick
225
  'basedir' => "{$this->_basedir}/" . str_replace(' ', '_', $extension)
226
  );
348
  if (file_exists($bootstrap) && !isset($this->_cache[$extension])) {
349
  //bootstrap the extension
350
  $this->_cache[$extension] = require_once($bootstrap);
351
+ $this->_cache[$extension]->activate();
 
 
 
 
 
 
352
  }
353
  }
354
 
application/core/update.php CHANGED
@@ -17,6 +17,15 @@
17
  */
18
  final class aam_Core_Update {
19
 
 
 
 
 
 
 
 
 
 
20
  /**
21
  * List of stages
22
  *
@@ -33,7 +42,8 @@ final class aam_Core_Update {
33
  *
34
  * @access public
35
  */
36
- public function __construct() {
 
37
  //register update stages
38
  $this->_stages = apply_filters('aam_update_stages', array(
39
  array($this, 'downloadRepository'),
@@ -72,7 +82,7 @@ final class aam_Core_Update {
72
  $response = true;
73
  if ($extensions = aam_Core_API::getBlogOption('aam_extensions')) {
74
  if (is_array($extensions)){
75
- $repo = new aam_Core_Repository();
76
  $repo->download();
77
  }
78
  }
17
  */
18
  final class aam_Core_Update {
19
 
20
+ /**
21
+ * Reference to AAM
22
+ *
23
+ * @var aam
24
+ *
25
+ * @access private
26
+ */
27
+
28
+ private $_parent = null;
29
  /**
30
  * List of stages
31
  *
42
  *
43
  * @access public
44
  */
45
+ public function __construct($parent) {
46
+ $this->_parent = $parent;
47
  //register update stages
48
  $this->_stages = apply_filters('aam_update_stages', array(
49
  array($this, 'downloadRepository'),
82
  $response = true;
83
  if ($extensions = aam_Core_API::getBlogOption('aam_extensions')) {
84
  if (is_array($extensions)){
85
+ $repo = aam_Core_Repository::getInstance($this->_parent);
86
  $repo->download();
87
  }
88
  }
application/view/abstract.php CHANGED
@@ -82,6 +82,8 @@ abstract class aam_View_Abstract {
82
  );
83
  }
84
  }
 
 
85
  }
86
 
87
  /**
82
  );
83
  }
84
  }
85
+
86
+ return true;
87
  }
88
 
89
  /**
application/view/tmpl/configpress.phtml CHANGED
@@ -55,14 +55,24 @@
55
  <span><?php echo __('Control Panel', 'aam'); ?></span>
56
  </h3>
57
  <div class="inside">
58
- <div class="cpanel-major">
59
- <a href="#" class="cpanel-item cpanel-item-save" id="save_config" ><?php echo __('Save', 'aam'); ?></a>
 
 
60
  </div>
61
- <div class="cpanel-minor">
62
- <a href="https://twitter.com/wpaam" target="_blank" class="cpanel-item cpanel-item-twitter" id="aam_twitter" aam-tooltip="<?php echo __('Follow @wpaam', 'aam'); ?>"><?php echo __('Follow', 'aam'); ?></a>
63
- <a href="http://wpaam.com/support" target="_blank" class="cpanel-item cpanel-item-help" id="aam_help" aam-tooltip="<?php echo __('Help Forum', 'aam'); ?>"><?php echo __('Help', 'aam'); ?></a>
64
- <a href="mailto:support@wpaam.com" class="cpanel-item cpanel-item-message" id="aam_message" aam-tooltip="<?php echo __('E-mail Us', 'aam'); ?>"><?php echo __('E-mail Us', 'aam'); ?></a>
65
- <a href="http://wordpress.org/support/view/plugin-reviews/advanced-access-manager" target="_blank" class="cpanel-item cpanel-item-star" aam-tooltip="<?php echo __('Rate AAM', 'aam'); ?>"><?php echo __('Rate Us', 'aam'); ?></a>
 
 
 
 
 
 
 
 
66
  </div>
67
  </div>
68
  </div>
55
  <span><?php echo __('Control Panel', 'aam'); ?></span>
56
  </h3>
57
  <div class="inside">
58
+ <div class="large-icons-row">
59
+ <a href="#" class="aam-icon aam-icon-large aam-icon-large-save" id="save_config" >
60
+ <span></span><?php echo __('Save', 'aam'); ?>
61
+ </a>
62
  </div>
63
+ <div class="medium-icons-row">
64
+ <a href="https://twitter.com/wpaam" target="_blank" class="aam-icon aam-icon-medium aam-icon-medium-twitter" aam-tooltip="<?php echo __('Follow @wpaam', 'aam'); ?>">
65
+ <span></span><?php echo __('Follow', 'aam'); ?>
66
+ </a>
67
+ <a href="http://wpaam.com/support" target="_blank" class="aam-icon aam-icon-medium aam-icon-medium-help" aam-tooltip="<?php echo __('Help Forum', 'aam'); ?>">
68
+ <span></span><?php echo __('Help', 'aam'); ?>
69
+ </a>
70
+ <a href="mailto:support@wpaam.com" class="aam-icon aam-icon-medium aam-icon-medium-message" id="aam_message" aam-tooltip="<?php echo __('E-mail Us', 'aam'); ?>">
71
+ <span></span><?php echo __('E-mail Us', 'aam'); ?>
72
+ </a>
73
+ <a href="http://wordpress.org/support/view/plugin-reviews/advanced-access-manager" target="_blank" class="aam-icon aam-icon-medium aam-icon-medium-star" aam-tooltip="<?php echo __('Rate AAM', 'aam'); ?>">
74
+ <span></span><?php echo __('Rate Us', 'aam'); ?>
75
+ </a>
76
  </div>
77
  </div>
78
  </div>
application/view/tmpl/extension.phtml CHANGED
@@ -169,10 +169,16 @@
169
  <span><?php echo __('Connect with AAM', 'aam'); ?></span>
170
  </h3>
171
  <div class="inside">
172
- <div id="misc-publishing-actions" class="cpanel">
173
- <a href="https://twitter.com/wpaam" class="cpanel-item cpanel-item-twitter" aam-tooltip="Follow @wpaam" target="_blank">Follow</a>
174
- <a href="mailto:support@wpaam.com" class="cpanel-item cpanel-item-message" aam-tooltip="Send Us Email">Send Message</a>
175
- <a href="http://wpaam.com" class="cpanel-item cpanel-item-website" aam-tooltip="Visit Us" target="_blank">Website</a>
 
 
 
 
 
 
176
  </div>
177
  </div>
178
  </div>
169
  <span><?php echo __('Connect with AAM', 'aam'); ?></span>
170
  </h3>
171
  <div class="inside">
172
+ <div class="large-icons-row">
173
+ <a href="https://twitter.com/wpaam" class="aam-icon aam-icon-large aam-icon-large-twitter" aam-tooltip="Follow @wpaam" target="_blank">
174
+ <span></span><?php echo __('Follow Us', 'aam'); ?>
175
+ </a>
176
+ <a href="mailto:support@wpaam.com" class="aam-icon aam-icon-large aam-icon-large-message" aam-tooltip="Send Us Email">
177
+ <span></span><?php echo __('Send Message', 'aam'); ?>
178
+ </a>
179
+ <a href="http://wpaam.com" class="aam-icon aam-icon-large aam-icon-large-link" aam-tooltip="Visit Us" target="_blank">
180
+ <span></span><?php echo __('Website', 'aam'); ?>
181
+ </a>
182
  </div>
183
  </div>
184
  </div>
application/view/tmpl/manager.phtml CHANGED
@@ -59,16 +59,9 @@
59
  <span><?php echo __('Control Panel', 'aam'); ?></span>
60
  </h3>
61
  <div class="inside">
62
- <div class="cpanel-major">
63
- <a href="#" class="cpanel-item cpanel-item-restore" id="aam_roleback" aam-tooltip="<?php echo __('Restore Default', 'aam'); ?>"><?php echo __('Default', 'aam'); ?></a>
64
- <a href="#" class="cpanel-item cpanel-item-save" id="aam_save" ><?php echo __('Save', 'aam'); ?></a>
65
- </div>
66
- <div class="cpanel-minor">
67
- <a href="https://twitter.com/wpaam" target="_blank" class="cpanel-item cpanel-item-twitter" id="aam_twitter" aam-tooltip="<?php echo __('Follow @wpaam', 'aam'); ?>"><?php echo __('Follow', 'aam'); ?></a>
68
- <a href="http://wpaam.com/support" target="_blank" class="cpanel-item cpanel-item-help" id="aam_help" aam-tooltip="<?php echo __('Help Forum', 'aam'); ?>"><?php echo __('Help', 'aam'); ?></a>
69
- <a href="#" class="cpanel-item cpanel-item-message" id="aam_message" aam-tooltip="<?php echo __('E-mail Us', 'aam'); ?>"><?php echo __('E-mail Us', 'aam'); ?></a>
70
- <a href="http://wordpress.org/support/view/plugin-reviews/advanced-access-manager" target="_blank" class="cpanel-item cpanel-item-star" aam-tooltip="<?php echo __('Rate AAM', 'aam'); ?>"><?php echo __('Rate Us', 'aam'); ?></a>
71
  </div>
 
72
  <div class="aam-metabox-loader"></div>
73
  </div>
74
  <div id="restore_dialog" class="aam-dialog" title="<?php echo __('Undo Change', 'aam'); ?>">
59
  <span><?php echo __('Control Panel', 'aam'); ?></span>
60
  </h3>
61
  <div class="inside">
62
+ <div class="large-icons-row" id="cpanel_major">
 
 
 
 
 
 
 
 
63
  </div>
64
+ <div class="medium-icons-row" id="cpanel_minor"></div>
65
  <div class="aam-metabox-loader"></div>
66
  </div>
67
  <div id="restore_dialog" class="aam-dialog" title="<?php echo __('Undo Change', 'aam'); ?>">
application/view/tmpl/metabox.phtml CHANGED
@@ -12,8 +12,8 @@
12
  <div class="metabox-top-action-link">
13
  <input type="text" class="link-text" id="metabox_link" />
14
  </div>
15
- <a href="#" class="aam-icon aam-icon-medium aam-icon-add" id="retrieve_url" aam-tooltip="<?php echo __('Retrieve Metaboxes From Link', 'aam') ;?>"><span></span></a>
16
- <a href="#" class="aam-icon aam-icon-medium aam-icon-refresh" id="refresh_metaboxes" aam-tooltip="<?php echo __('Refresh the List', 'aam') ;?>"><span></span></a>
17
  <br class="clear" />
18
  </div>
19
  <div class="aam-metabox-loader"></div>
12
  <div class="metabox-top-action-link">
13
  <input type="text" class="link-text" id="metabox_link" />
14
  </div>
15
+ <a href="#" class="aam-icon aam-icon-medium aam-icon-medium-add" id="retrieve_url" aam-tooltip="<?php echo __('Retrieve Metaboxes From Link', 'aam') ;?>"><span></span></a>
16
+ <a href="#" class="aam-icon aam-icon-medium aam-icon-medium-refresh" id="refresh_metaboxes" aam-tooltip="<?php echo __('Refresh the List', 'aam') ;?>"><span></span></a>
17
  <br class="clear" />
18
  </div>
19
  <div class="aam-metabox-loader"></div>
application/view/user.php CHANGED
@@ -124,8 +124,7 @@ class aam_View_User extends aam_View_Abstract {
124
  * @access public
125
  */
126
  public function block() {
127
- if ($this->isManagable($this->getSubject()->getUser())
128
- && $this->getSubject()->block()){
129
  $response = array(
130
  'status' => 'success',
131
  'user_status' => $this->getSubject()->user_status
124
  * @access public
125
  */
126
  public function block() {
127
+ if ($this->isManagable() && $this->getSubject()->block()){
 
128
  $response = array(
129
  'status' => 'success',
130
  'user_status' => $this->getSubject()->user_status
config.php CHANGED
@@ -8,7 +8,7 @@
8
  */
9
 
10
  //AAM Version for Update purpose
11
- define('AAM_VERSION', '2.5.1');
12
 
13
  define('AAM_BASE_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
14
 
8
  */
9
 
10
  //AAM Version for Update purpose
11
+ define('AAM_VERSION', '2.7');
12
 
13
  define('AAM_BASE_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
14
 
extension/AAM_Secure/extension.php ADDED
@@ -0,0 +1,384 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * ======================================================================
5
+ * LICENSE: This file is subject to the terms and conditions defined in *
6
+ * file 'license.txt', which is part of this source code package. *
7
+ * ======================================================================
8
+ */
9
+
10
+ /**
11
+ * Feature Secure
12
+ *
13
+ * @package AAM
14
+ * @author Vasyl Martyniuk <support@wpaam.com>
15
+ * @copyright Copyright C Vasyl Martyniuk
16
+ * @license GNU General Public License {@link http://www.gnu.org/licenses/}
17
+ */
18
+ class AAM_Secure extends AAM_Core_Extension {
19
+
20
+ /**
21
+ * Unique Feature ID
22
+ */
23
+ const FEATURE_ID = 'secure';
24
+
25
+ /**
26
+ *
27
+ * @var type
28
+ */
29
+ private $_cache = array();
30
+
31
+ /**
32
+ *
33
+ * @var type
34
+ */
35
+ private $_cacheLimit = 1000;
36
+
37
+ /**
38
+ *
39
+ * @var type
40
+ */
41
+ private $_stats = array();
42
+
43
+ /**
44
+ * Constructor
45
+ *
46
+ * @param aam $parent Main AAM object
47
+ *
48
+ * @return void
49
+ *
50
+ * @access public
51
+ */
52
+ public function __construct(aam $parent) {
53
+ parent::__construct($parent);
54
+
55
+ if (is_admin()) {
56
+ //print required JS & CSS
57
+ add_action('admin_print_scripts', array($this, 'printScripts'));
58
+ add_action('admin_print_styles', array($this, 'printStyles'));
59
+ add_action('admin_head', array($this, 'adminHead'));
60
+
61
+ //manager Admin Menu
62
+ if (aam_Core_API::isNetworkPanel()) {
63
+ add_action('network_admin_menu', array($this, 'adminMenu'), 999);
64
+ } else {
65
+ add_action('admin_menu', array($this, 'adminMenu'), 999);
66
+ }
67
+ //manager AAM Ajax Requests
68
+ add_action('wp_ajax_aam_security', array($this, 'ajax'));
69
+ }
70
+
71
+ add_filter('wp_login_errors', array($this, 'loginFailure'), 10, 2);
72
+ add_action('wp_login', array($this, 'login'), 10, 2);
73
+
74
+ //add_filter('authenticate', array($this, 'authenticate'), 999, 3);
75
+ }
76
+
77
+ /**
78
+ *
79
+ * @param type $username
80
+ * @param type $user
81
+ */
82
+ public function login($username, $user) {
83
+ $this->_cache = aam_Core_API::getBlogOption(
84
+ 'aam_security_login_cache', array()
85
+ );
86
+ $ip = aam_Core_Request::server('REMOTE_ADDR');
87
+ if ($this->hasIPCache($ip)) {
88
+ $data = $this->getIPCache($ip);
89
+ $data->attempts = 0; //reset counter
90
+ $this->addIPCache($ip, $data);
91
+ aam_Core_API::updateBlogOption(
92
+ 'aam_security_login_cache', $this->_cache
93
+ );
94
+ }
95
+ }
96
+
97
+ /**
98
+ *
99
+ * @return type
100
+ */
101
+ public function isGeoLookupOn() {
102
+ $geo_lookup = aam_Core_ConfigPress::getParam(
103
+ 'security.login.geo_lookup', 'false'
104
+ );
105
+
106
+ return ($geo_lookup == 'true' ? true : false);
107
+ }
108
+
109
+ /**
110
+ *
111
+ * @return type
112
+ */
113
+ public function isLoginLockoutOn() {
114
+ $login_lock = aam_Core_ConfigPress::getParam(
115
+ 'security.login.lockout', 'false'
116
+ );
117
+
118
+ return ($login_lock == 'true' ? true : false);
119
+ }
120
+
121
+ /**
122
+ *
123
+ * @param type $errors
124
+ * @param type $redirect_to
125
+ */
126
+ public function loginFailure($errors, $redirect_to) {
127
+ $this->_cache = aam_Core_API::getBlogOption(
128
+ 'aam_security_login_cache', array()
129
+ );
130
+ $this->_cacheLimit = aam_Core_ConfigPress::getParam(
131
+ 'security.login.cache_limit', 1000
132
+ );
133
+ if ($this->isGeoLookupOn()) {
134
+ $this->_stats = aam_Core_API::getBlogOption(
135
+ 'aam_security_login_stats', array()
136
+ );
137
+ $info = $this->retrieveGeoData();
138
+ if (!is_null($info)) {
139
+ if (!isset($this->_stats[$info->countryCode])) {
140
+ $this->_stats[$info->countryCode] = array(
141
+ 'failed' => 0
142
+ );
143
+ }
144
+ $this->_stats[$info->countryCode]['failed']++;
145
+ aam_Core_API::updateBlogOption(
146
+ 'aam_security_login_stats', $this->_stats
147
+ );
148
+ }
149
+ }
150
+ if ($this->isLoginLockoutOn()) {
151
+ $this->loginLockout();
152
+ }
153
+ aam_Core_API::updateBlogOption(
154
+ 'aam_security_login_cache', $this->_cache
155
+ );
156
+
157
+ return $errors;
158
+ }
159
+
160
+ /**
161
+ *
162
+ */
163
+ protected function loginLockout() {
164
+ $ip = aam_Core_Request::server('REMOTE_ADDR');
165
+ if ($this->hasIPCache($ip)) {
166
+ $info = $this->getIPCache($ip);
167
+ } else {
168
+ $info = new stdClass;
169
+ }
170
+
171
+ if (!isset($info->attempts)) {
172
+ $info->attempts = 1;
173
+ } else {
174
+ $info->attempts++;
175
+ }
176
+ $threshold = aam_Core_ConfigPress::getParam(
177
+ 'security.login.attempts', 10
178
+ );
179
+ if ($info->attempts >= $threshold) {
180
+ $action = aam_Core_ConfigPress::getParam(
181
+ 'security.login.attempt_failure', 'slowdown'
182
+ );
183
+ switch ($action) {
184
+ case 'slowdown':
185
+ $time = aam_Core_ConfigPress::getParam(
186
+ 'security.login.slowdown_time', '5'
187
+ );
188
+ sleep(intval($time));
189
+ break;
190
+
191
+ case 'die':
192
+ wp_die(aam_Core_ConfigPress::getParam(
193
+ 'security.login.die_message', 'You are not allowed to login'
194
+ ));
195
+ break;
196
+
197
+ default:
198
+ break;
199
+ }
200
+ }
201
+ }
202
+
203
+ /**
204
+ *
205
+ * @return null
206
+ */
207
+ protected function retrieveGeoData() {
208
+ $ip = aam_Core_Request::server('REMOTE_ADDR');
209
+ if ($this->hasIPCache($ip)) {
210
+ $location = $this->getIPCache($ip);
211
+ } else {
212
+ $service = aam_Core_ConfigPress::getParam(
213
+ 'security.login.geoip.service', 'FreeGeoIP'
214
+ );
215
+ $filename = dirname(__FILE__) . '/geoip/' . strtolower($service) . '.php';
216
+
217
+ if (file_exists($filename)) {
218
+ require_once($filename);
219
+ $location = call_user_func("{$service}::query", $ip);
220
+ $this->addIPCache($ip, $location);
221
+ } else {
222
+ $location = null;
223
+ }
224
+ }
225
+
226
+ return $location;
227
+ }
228
+
229
+ /**
230
+ *
231
+ * @param type $ip
232
+ * @return type
233
+ */
234
+ protected function hasIPCache($ip) {
235
+ return (isset($this->_cache[$ip]) ? true : false);
236
+ }
237
+
238
+ /**
239
+ *
240
+ * @param type $ip
241
+ * @return type
242
+ */
243
+ protected function getIPCache($ip) {
244
+ return ($this->hasIPCache($ip) ? $this->_cache[$ip] : null);
245
+ }
246
+
247
+ /**
248
+ *
249
+ * @param type $ip
250
+ * @param type $data
251
+ */
252
+ protected function addIPCache($ip, $data) {
253
+ if (!is_null($data)) {
254
+ if ((count($this->_cache) >= $this->_cacheLimit) && !isset($this->_cache[$ip])) {
255
+ array_shift($this->_cache);
256
+ }
257
+ $this->_cache[$ip] = $data;
258
+ }
259
+ }
260
+
261
+ /**
262
+ * Print necessary styles
263
+ *
264
+ * @return void
265
+ *
266
+ * @access public
267
+ */
268
+ public function printStyles() {
269
+ if ($this->isSecurityScreen()) {
270
+ wp_enqueue_style('dashboard');
271
+ wp_enqueue_style('global');
272
+ wp_enqueue_style('wp-admin');
273
+ wp_enqueue_style('aam-ui-style', AAM_MEDIA_URL . 'css/jquery-ui.css');
274
+ wp_enqueue_style('aam-common-style', AAM_MEDIA_URL . 'css/common.css');
275
+ wp_enqueue_style('aam-security-style', AAM_SECURITY_BASE_URL . '/stylesheet/security.css');
276
+ if ($this->isGeoLookupOn()) {
277
+ wp_enqueue_style('aam-datatable', AAM_MEDIA_URL . 'css/jquery.dt.css');
278
+ wp_enqueue_style('aam-country-flags', AAM_SECURITY_BASE_URL . '/stylesheet/flags32.css');
279
+ }
280
+ }
281
+ }
282
+
283
+ /**
284
+ * Print necessary scripts
285
+ *
286
+ * @return void
287
+ *
288
+ * @access public
289
+ */
290
+ public function printScripts() {
291
+ if ($this->isSecurityScreen()) {
292
+ wp_enqueue_script('postbox');
293
+ wp_enqueue_script('dashboard');
294
+ if ($this->isGeoLookupOn()) {
295
+ wp_enqueue_script('aam-datatable', AAM_MEDIA_URL . 'js/jquery.dt.js');
296
+ wp_enqueue_script('google-jsapi', 'https://www.google.com/jsapi');
297
+ }
298
+ wp_enqueue_script('aam-security', AAM_SECURITY_BASE_URL . '/javascript/security.js');
299
+ $localization = array(
300
+ 'nonce' => wp_create_nonce('aam_ajax'),
301
+ 'ajaxurl' => admin_url('admin-ajax.php'),
302
+ );
303
+ wp_localize_script('aam-security', 'aamLocal', $localization);
304
+ }
305
+ }
306
+
307
+ /**
308
+ *
309
+ */
310
+ public function adminHead() {
311
+ if ($this->isSecurityScreen() && $this->isGeoLookupOn()) {
312
+ echo '<script type="text/javascript">';
313
+ echo file_get_contents(__DIR__ . '/javascript/loader.js');
314
+ echo '</script>';
315
+ }
316
+ }
317
+
318
+ /**
319
+ *
320
+ * @return type
321
+ */
322
+ public function isSecurityScreen() {
323
+ return (aam_Core_Request::get('page') == 'aam-security' ? true : false);
324
+ }
325
+
326
+ /**
327
+ * Register Admin Menu
328
+ *
329
+ * @return void
330
+ *
331
+ * @access public
332
+ */
333
+ public function adminMenu() {
334
+ //register submenus
335
+ add_submenu_page(
336
+ 'aam', __('Security', 'aam'), __('Security', 'aam'), aam_Core_ConfigPress::getParam(
337
+ 'aam.page.security.capability', 'administrator'
338
+ ), 'aam-security', array($this, 'content')
339
+ );
340
+ }
341
+
342
+ /**
343
+ *
344
+ */
345
+ public function content() {
346
+ require_once(dirname(__FILE__) . '/security.php');
347
+ $security = new aam_View_Security();
348
+ echo $security->run();
349
+ }
350
+
351
+ public function ajax() {
352
+ check_ajax_referer('aam_ajax');
353
+
354
+ //clean buffer to make sure that nothing messing around with system
355
+ while (@ob_end_clean());
356
+
357
+ //process ajax request
358
+ try {
359
+ require_once(dirname(__FILE__) . '/security.php');
360
+ $model = new aam_View_Security();
361
+ echo $model->processAjax();
362
+ } catch (Exception $e) {
363
+ echo '-1';
364
+ }
365
+ die();
366
+ }
367
+
368
+ /**
369
+ *
370
+ * @param type $user
371
+ * @param type $username
372
+ * @param type $password
373
+ * @return type
374
+ */
375
+ public function authenticate($user, $username, $password) {
376
+ if (!is_wp_error($user)) {
377
+ $login_history = get_user_meta($user->ID, 'aam_login_history', true);
378
+ $ip = aam_Core_Request::server('REMOTE_ADDR');
379
+ }
380
+
381
+ return $user;
382
+ }
383
+
384
+ }
extension/AAM_Secure/geoip/freegeoip.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ======================================================================
4
+ * LICENSE: This file is subject to the terms and conditions defined in *
5
+ * file 'license.txt', which is part of this source code package. *
6
+ * ======================================================================
7
+ */
8
+
9
+ require_once(dirname(__FILE__) . '/geoip.php');
10
+
11
+ class FreeGeoIP extends GeoIP {
12
+
13
+ public static function query($ip) {
14
+ $response = aam_Core_API::cURL('http://freegeoip.net/xml/' . $ip, false, true);
15
+ if ($response['status'] == 'success') {
16
+ $data = simplexml_load_string($response['content']);
17
+ $geodata = (object) array(
18
+ 'countryCode' => (string) $data->CountryCode,
19
+ 'countryName' => (string) $data->CountryName,
20
+ 'region' => (string) $data->RegionCode,
21
+ 'city' => (string) $data->City,
22
+ 'zip' => (string) $data->ZipCode
23
+ );
24
+ } else {
25
+ $geodata = null;
26
+ }
27
+
28
+ return $geodata;
29
+ }
30
+
31
+ }
extension/AAM_Secure/geoip/geoip.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ======================================================================
4
+ * LICENSE: This file is subject to the terms and conditions defined in *
5
+ * file 'license.txt', which is part of this source code package. *
6
+ * ======================================================================
7
+ */
8
+
9
+ abstract class GeoIP {
10
+
11
+ public static function query($ip) {
12
+
13
+ }
14
+
15
+ }
extension/AAM_Secure/index.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * ======================================================================
5
+ * LICENSE: This file is subject to the terms and conditions defined in *
6
+ * file 'license.txt', which is part of this source code package. *
7
+ * ======================================================================
8
+ */
9
+
10
+ $dirname = basename(dirname(__FILE__));
11
+ define('AAM_SECURITY_BASE_URL', AAM_BASE_URL . 'extension/' . $dirname);
12
+
13
+
14
+ //load the Extension Controller
15
+ require_once dirname(__FILE__) . '/extension.php';
16
+
17
+ return new AAM_Secure($this->getParent());
extension/AAM_Secure/javascript/loader.js ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * ======================================================================
3
+ * LICENSE: This file is subject to the terms and conditions defined in *
4
+ * file 'license.txt', which is part of this source code package. *
5
+ * ======================================================================
6
+ */
7
+
8
+ google.load('visualization', '1', {'packages': ['geochart']});
9
+ google.setOnLoadCallback(drawRegionsMap);
10
+
11
+ function drawRegionsMap() {
12
+ jQuery.ajax(aamLocal.ajaxurl, {
13
+ type: 'POST',
14
+ dataType: 'json',
15
+ data: {
16
+ action: 'aam_security',
17
+ sub_action: 'map_data',
18
+ _ajax_nonce: aamLocal.nonce
19
+ },
20
+ success: function(response) {
21
+ var list = new Array();
22
+ list.push(['Country', 'Failed Attempts']);
23
+ for (var i in response.list) {
24
+ list.push(response.list[i]);
25
+ }
26
+ var data = google.visualization.arrayToDataTable(list);
27
+
28
+ var options = {
29
+ colorAxis: {colors: ['#4374e0', '#e7711c']} // orange to blue
30
+ };
31
+ var chart = new google.visualization.GeoChart(
32
+ document.getElementById('geo_map')
33
+ );
34
+ chart.draw(data, options);
35
+ },
36
+ failure: function() {
37
+
38
+ }
39
+ });
40
+
41
+ }
extension/AAM_Secure/javascript/security.js ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * ======================================================================
3
+ * LICENSE: This file is subject to the terms and conditions defined in *
4
+ * file 'license.txt', which is part of this source code package. *
5
+ * ======================================================================
6
+ */
7
+
8
+ function AAMSecurity() {
9
+
10
+ }
11
+
12
+ AAMSecurity.prototype.init = function() {
13
+ var _this = this;
14
+
15
+ if (jQuery('#country_list').length) {
16
+ jQuery('#country_list').dataTable({
17
+ sDom: "t",
18
+ bAutoWidth: false,
19
+ bSort: false,
20
+ aoColumnDefs: [
21
+ {
22
+ sClass: 'center',
23
+ aTargets: [1]
24
+ }
25
+ ]
26
+ });
27
+ }
28
+
29
+ jQuery('.aam-icon', '.large-icons-row').each(function(){
30
+ jQuery(this).bind('click', function(){
31
+ _this.switchMode(jQuery(this).attr('mode'));
32
+ });
33
+ });
34
+ jQuery('#setting_trigger_inline').bind('click', function(event){
35
+ event.preventDefault();
36
+ _this.switchMode('settings');
37
+ });
38
+ };
39
+
40
+ AAMSecurity.prototype.switchMode = function(mode) {
41
+ jQuery('.mode-container').hide();
42
+ jQuery('#' + mode + '_mode').show();
43
+ };
44
+
45
+ jQuery(document).ready(function() {
46
+ var security = new AAMSecurity();
47
+ security.init();
48
+ });
extension/AAM_Secure/security.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * ======================================================================
5
+ * LICENSE: This file is subject to the terms and conditions defined in *
6
+ * file 'license.txt', which is part of this source code package. *
7
+ * ======================================================================
8
+ */
9
+
10
+ /**
11
+ *
12
+ * @package AAM
13
+ * @author Vasyl Martyniuk <support@wpaam.com>
14
+ * @copyright Copyright C 2013 Vasyl Martyniuk
15
+ * @license GNU General Public License {@link http://www.gnu.org/licenses/}
16
+ */
17
+ class aam_View_Security extends aam_View_Abstract {
18
+
19
+ /**
20
+ * Run the Manager
21
+ *
22
+ * @return string
23
+ *
24
+ * @access public
25
+ */
26
+ public function run() {
27
+ return $this->loadTemplate(dirname(__FILE__) . '/view/security.phtml');
28
+ }
29
+
30
+ /**
31
+ *
32
+ * @return type
33
+ */
34
+ public function processAjax() {
35
+ switch (aam_Core_Request::post('sub_action')) {
36
+ case 'map_data':
37
+ $response = $this->getMapData();
38
+ break;
39
+
40
+ default:
41
+ $response = json_encode(array('status' => 'failure'));
42
+ break;
43
+ }
44
+
45
+ return $response;
46
+ }
47
+
48
+ protected function getMapData() {
49
+ $stats = aam_Core_API::getBlogOption(
50
+ 'aam_security_login_stats', array()
51
+ );
52
+ $list = array();
53
+ foreach($stats as $country => $data){
54
+ $list[] = array($country, $data['failed']);
55
+ }
56
+ return json_encode(
57
+ array('list' => $list)
58
+ );
59
+ }
60
+
61
+ /**
62
+ *
63
+ * @return type
64
+ */
65
+ public function isGeoLookupOn() {
66
+ $geo_lookup = aam_Core_ConfigPress::getParam(
67
+ 'security.login.geo_lookup', 'false'
68
+ );
69
+
70
+ return ($geo_lookup == 'true' ? true : false);
71
+ }
72
+
73
+ /**
74
+ *
75
+ * @return type
76
+ */
77
+ public function isLoginLockoutOn() {
78
+ $login_lock = aam_Core_ConfigPress::getParam(
79
+ 'security.login.lockout', 'false'
80
+ );
81
+
82
+ return ($login_lock == 'true' ? true : false);
83
+ }
84
+
85
+ }
extension/AAM_Secure/stylesheet/flags32.css ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .flag{
2
+ display:block;
3
+ height:32px;
4
+ min-width:32px;
5
+ vertical-align: middle;
6
+ line-height:32px;
7
+ background:url(images/flags32.png) no-repeat 0 center;
8
+ padding-left: 36px;
9
+ }
10
+ ._African_Union{background-position:0 -32px;}
11
+ ._Arab_League{background-position:0 -64px;}
12
+ ._ASEAN{background-position:0 -96px;}
13
+ ._CARICOM{background-position:0 -128px;}
14
+ ._CIS{background-position:0 -160px;}
15
+ ._Commonwealth{background-position:0 -192px;}
16
+ ._England{background-position:0 -224px;}
17
+ ._European_Union, .eu{background-position:0 -256px;}
18
+ ._Islamic_Conference{background-position:0 -288px;}
19
+ ._Kosovo{background-position:0 -320px;}
20
+ ._NATO{background-position:0 -352px;}
21
+ ._Northern_Cyprus{background-position:0 -384px;}
22
+ ._Northern_Ireland{background-position:0 -416px;}
23
+ ._Olimpic_Movement{background-position:0 -448px;}
24
+ ._OPEC{background-position:0 -480px;}
25
+ ._Red_Cross{background-position:0 -512px;}
26
+ ._Scotland{background-position:0 -544px;}
27
+ ._Somaliland{background-position:0 -576px;}
28
+ ._Tibet{background-position:0 -608px;}
29
+ ._United_Nations{background-position:0 -640px;}
30
+ ._Wales{background-position:0 -672px;}
31
+ .ad{background-position:0 -704px;}
32
+ .ae{background-position:0 -736px;}
33
+ .af{background-position:0 -768px;}
34
+ .ag{background-position:0 -800px;}
35
+ .ai{background-position:0 -832px;}
36
+ .al{background-position:0 -864px;}
37
+ .am{background-position:0 -896px;}
38
+ .ao{background-position:0 -928px;}
39
+ .aq{background-position:0 -960px;}
40
+ .ar{background-position:0 -992px;}
41
+ .as{background-position:0 -1024px;}
42
+ .at{background-position:0 -1056px;}
43
+ .au{background-position:0 -1088px;}
44
+ .aw{background-position:0 -1120px;}
45
+ .ax{background-position:0 -1152px;}
46
+ .az{background-position:0 -1184px;}
47
+ .ba{background-position:0 -1216px;}
48
+ .bb{background-position:0 -1248px;}
49
+ .bd{background-position:0 -1280px;}
50
+ .be{background-position:0 -1312px;}
51
+ .bf{background-position:0 -1344px;}
52
+ .bg{background-position:0 -1376px;}
53
+ .bh{background-position:0 -1408px;}
54
+ .bi{background-position:0 -1440px;}
55
+ .bj{background-position:0 -1472px;}
56
+ .bm{background-position:0 -1504px;}
57
+ .bn{background-position:0 -1536px;}
58
+ .bo{background-position:0 -1568px;}
59
+ .br{background-position:0 -1600px;}
60
+ .bs{background-position:0 -1632px;}
61
+ .bt{background-position:0 -1664px;}
62
+ .bw{background-position:0 -1696px;}
63
+ .by{background-position:0 -1728px;}
64
+ .bz{background-position:0 -1760px;}
65
+ .ca{background-position:0 -1792px;}
66
+ .cd{background-position:0 -1824px;}
67
+ .cf{background-position:0 -1856px;}
68
+ .cg{background-position:0 -1888px;}
69
+ .ch{background-position:0 -1920px;}
70
+ .ci{background-position:0 -1952px;}
71
+ .ck{background-position:0 -1984px;}
72
+ .cl{background-position:0 -2016px;}
73
+ .cm{background-position:0 -2048px;}
74
+ .cn{background-position:0 -2080px;}
75
+ .co{background-position:0 -2112px;}
76
+ .cr{background-position:0 -2144px;}
77
+ .cu{background-position:0 -2176px;}
78
+ .cv{background-position:0 -2208px;}
79
+ .cy{background-position:0 -2240px;}
80
+ .cz{background-position:0 -2272px;}
81
+ .de{background-position:0 -2304px;}
82
+ .dj{background-position:0 -2336px;}
83
+ .dk{background-position:0 -2368px;}
84
+ .dm{background-position:0 -2400px;}
85
+ .do{background-position:0 -2432px;}
86
+ .dz{background-position:0 -2464px;}
87
+ .ec{background-position:0 -2496px;}
88
+ .ee{background-position:0 -2528px;}
89
+ .eg{background-position:0 -2560px;}
90
+ .eh{background-position:0 -2592px;}
91
+ .er{background-position:0 -2624px;}
92
+ .es{background-position:0 -2656px;}
93
+ .et{background-position:0 -2688px;}
94
+ .fi{background-position:0 -2720px;}
95
+ .fj{background-position:0 -2752px;}
96
+ .fm{background-position:0 -2784px;}
97
+ .fo{background-position:0 -2816px;}
98
+ .fr{background-position:0 -2848px;}
99
+ .bl, .cp, .mf, .yt{background-position:0 -2848px;}
100
+ .ga{background-position:0 -2880px;}
101
+ .gb{background-position:0 -2912px;}
102
+ .sh{background-position:0 -2912px;}
103
+ .gd{background-position:0 -2944px;}
104
+ .ge{background-position:0 -2976px;}
105
+ .gg{background-position:0 -3008px;}
106
+ .gh{background-position:0 -3040px;}
107
+ .gi{background-position:0 -3072px;}
108
+ .gl{background-position:0 -3104px;}
109
+ .gm{background-position:0 -3136px;}
110
+ .gn{background-position:0 -3168px;}
111
+ .gp{background-position:0 -3200px;}
112
+ .gq{background-position:0 -3232px;}
113
+ .gr{background-position:0 -3264px;}
114
+ .gt{background-position:0 -3296px;}
115
+ .gu{background-position:0 -3328px;}
116
+ .gw{background-position:0 -3360px;}
117
+ .gy{background-position:0 -3392px;}
118
+ .hk{background-position:0 -3424px;}
119
+ .hn{background-position:0 -3456px;}
120
+ .hr{background-position:0 -3488px;}
121
+ .ht{background-position:0 -3520px;}
122
+ .hu{background-position:0 -3552px;}
123
+ .id{background-position:0 -3584px;}
124
+ .mc{background-position:0 -3584px;}
125
+ .ie{background-position:0 -3616px;}
126
+ .il{background-position:0 -3648px;}
127
+ .im{background-position:0 -3680px;}
128
+ .in{background-position:0 -3712px;}
129
+ .iq{background-position:0 -3744px;}
130
+ .ir{background-position:0 -3776px;}
131
+ .is{background-position:0 -3808px;}
132
+ .it{background-position:0 -3840px;}
133
+ .je{background-position:0 -3872px;}
134
+ .jm{background-position:0 -3904px;}
135
+ .jo{background-position:0 -3936px;}
136
+ .jp{background-position:0 -3968px;}
137
+ .ke{background-position:0 -4000px;}
138
+ .kg{background-position:0 -4032px;}
139
+ .kh{background-position:0 -4064px;}
140
+ .ki{background-position:0 -4096px;}
141
+ .km{background-position:0 -4128px;}
142
+ .kn{background-position:0 -4160px;}
143
+ .kp{background-position:0 -4192px;}
144
+ .kr{background-position:0 -4224px;}
145
+ .kw{background-position:0 -4256px;}
146
+ .ky{background-position:0 -4288px;}
147
+ .kz{background-position:0 -4320px;}
148
+ .la{background-position:0 -4352px;}
149
+ .lb{background-position:0 -4384px;}
150
+ .lc{background-position:0 -4416px;}
151
+ .li{background-position:0 -4448px;}
152
+ .lk{background-position:0 -4480px;}
153
+ .lr{background-position:0 -4512px;}
154
+ .ls{background-position:0 -4544px;}
155
+ .lt{background-position:0 -4576px;}
156
+ .lu{background-position:0 -4608px;}
157
+ .lv{background-position:0 -4640px;}
158
+ .ly{background-position:0 -4672px;}
159
+ .ma{background-position:0 -4704px;}
160
+ .md{background-position:0 -4736px;}
161
+ .me{background-position:0 -4768px;}
162
+ .mg{background-position:0 -4800px;}
163
+ .mh{background-position:0 -4832px;}
164
+ .mk{background-position:0 -4864px;}
165
+ .ml{background-position:0 -4896px;}
166
+ .mm{background-position:0 -4928px;}
167
+ .mn{background-position:0 -4960px;}
168
+ .mo{background-position:0 -4992px;}
169
+ .mq{background-position:0 -5024px;}
170
+ .mr{background-position:0 -5056px;}
171
+ .ms{background-position:0 -5088px;}
172
+ .mt{background-position:0 -5120px;}
173
+ .mu{background-position:0 -5152px;}
174
+ .mv{background-position:0 -5184px;}
175
+ .mw{background-position:0 -5216px;}
176
+ .mx{background-position:0 -5248px;}
177
+ .my{background-position:0 -5280px;}
178
+ .mz{background-position:0 -5312px;}
179
+ .na{background-position:0 -5344px;}
180
+ .nc{background-position:0 -5376px;}
181
+ .ne{background-position:0 -5408px;}
182
+ .ng{background-position:0 -5440px;}
183
+ .ni{background-position:0 -5472px;}
184
+ .nl{background-position:0 -5504px;}
185
+ .bq{background-position:0 -5504px;}
186
+ .no{background-position:0 -5536px;}
187
+ .bv, .nq, .sj{background-position:0 -5536px;}
188
+ .np{background-position:0 -5568px;}
189
+ .nr{background-position:0 -5600px;}
190
+ .nz{background-position:0 -5632px;}
191
+ .om{background-position:0 -5664px;}
192
+ .pa{background-position:0 -5696px;}
193
+ .pe{background-position:0 -5728px;}
194
+ .pf{background-position:0 -5760px;}
195
+ .pg{background-position:0 -5792px;}
196
+ .ph{background-position:0 -5824px;}
197
+ .pk{background-position:0 -5856px;}
198
+ .pl{background-position:0 -5888px;}
199
+ .pr{background-position:0 -5920px;}
200
+ .ps{background-position:0 -5952px;}
201
+ .pt{background-position:0 -5984px;}
202
+ .pw{background-position:0 -6016px;}
203
+ .py{background-position:0 -6048px;}
204
+ .qa{background-position:0 -6080px;}
205
+ .re{background-position:0 -6112px;}
206
+ .ro{background-position:0 -6144px;}
207
+ .rs{background-position:0 -6176px;}
208
+ .ru{background-position:0 -6208px;}
209
+ .rw{background-position:0 -6240px;}
210
+ .sa{background-position:0 -6272px;}
211
+ .sb{background-position:0 -6304px;}
212
+ .sc{background-position:0 -6336px;}
213
+ .sd{background-position:0 -6368px;}
214
+ .se{background-position:0 -6400px;}
215
+ .sg{background-position:0 -6432px;}
216
+ .si{background-position:0 -6464px;}
217
+ .sk{background-position:0 -6496px;}
218
+ .sl{background-position:0 -6528px;}
219
+ .sm{background-position:0 -6560px;}
220
+ .sn{background-position:0 -6592px;}
221
+ .so{background-position:0 -6624px;}
222
+ .sr{background-position:0 -6656px;}
223
+ .st{background-position:0 -6688px;}
224
+ .sv{background-position:0 -6720px;}
225
+ .sy{background-position:0 -6752px;}
226
+ .sz{background-position:0 -6784px;}
227
+ .tc{background-position:0 -6816px;}
228
+ .td{background-position:0 -6848px;}
229
+ .tg{background-position:0 -6880px;}
230
+ .th{background-position:0 -6912px;}
231
+ .tj{background-position:0 -6944px;}
232
+ .tl{background-position:0 -6976px;}
233
+ .tm{background-position:0 -7008px;}
234
+ .tn{background-position:0 -7040px;}
235
+ .to{background-position:0 -7072px;}
236
+ .tr{background-position:0 -7104px;}
237
+ .tt{background-position:0 -7136px;}
238
+ .tv{background-position:0 -7168px;}
239
+ .tw{background-position:0 -7200px;}
240
+ .tz{background-position:0 -7232px;}
241
+ .ua{background-position:0 -7264px;}
242
+ .ug{background-position:0 -7296px;}
243
+ .us{background-position:0 -7328px;}
244
+ .uy{background-position:0 -7360px;}
245
+ .uz{background-position:0 -7392px;}
246
+ .va{background-position:0 -7424px;}
247
+ .vc{background-position:0 -7456px;}
248
+ .ve{background-position:0 -7488px;}
249
+ .vg{background-position:0 -7520px;}
250
+ .vi{background-position:0 -7552px;}
251
+ .vn{background-position:0 -7584px;}
252
+ .vu{background-position:0 -7616px;}
253
+ .ws{background-position:0 -7648px;}
254
+ .ye{background-position:0 -7680px;}
255
+ .za{background-position:0 -7712px;}
256
+ .zm{background-position:0 -7744px;}
257
+ .zw{background-position:0 -7776px;}
258
+ .sx{background-position:0 -7808px;}
259
+ .cw{background-position:0 -7840px;}
260
+ .ss{background-position:0 -7872px;}
extension/AAM_Secure/stylesheet/images/deny.png ADDED
Binary file
extension/AAM_Secure/stylesheet/images/flags32.png ADDED
Binary file
extension/AAM_Secure/stylesheet/images/large-iconset.png ADDED
Binary file
extension/AAM_Secure/stylesheet/images/restriction.png ADDED
Binary file
extension/AAM_Secure/stylesheet/security.css ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * ======================================================================
3
+ * LICENSE: This file is subject to the terms and conditions defined in *
4
+ * file 'license.txt', which is part of this source code package. *
5
+ * ======================================================================
6
+ */
7
+
8
+ #aam_form{
9
+ position: relative;
10
+ }
11
+
12
+ .clear{
13
+ line-height: 0;
14
+ font-size: 0;
15
+ padding: 0;
16
+ margin: 0;
17
+ clear: both;
18
+ }
19
+
20
+ .main-inside{
21
+ position: relative;
22
+ min-height: 200px;
23
+ }
24
+
25
+ .aam-main-loader{
26
+ position: absolute;
27
+ top: 0px;
28
+ left: 0px;
29
+ width: 100%;
30
+ height: 100%;
31
+ background: transparent url('images/main-loader.gif') no-repeat center;
32
+ }
33
+
34
+ .aam-icon-large span {
35
+ background-image: url('images/large-iconset.png');
36
+ }
37
+
38
+ .aam-icon-large-glob span{
39
+ background-position: 0 0;
40
+ }
41
+
42
+ .aam-icon-large-glob:hover span{
43
+ background-position: 0 -48px;
44
+ }
45
+
46
+ .aam-icon-large-settings span{
47
+ background-position: -48px 0;
48
+ }
49
+
50
+ .aam-icon-large-settings:hover span{
51
+ background-position: -48px -48px;
52
+ }
53
+
54
+
55
+ .restriction{
56
+ background: transparent url('images/restriction.png') no-repeat center;
57
+ }
58
+
59
+ .deny{
60
+ background: transparent url('images/deny.png') no-repeat center;
61
+ }
62
+
63
+ .center{
64
+ text-align: center;
65
+ }
66
+
67
+ .feature-off-notice{
68
+ width: 90%;
69
+ text-align: center;
70
+ padding: 10px 0;
71
+ font-size: 1.1em;
72
+ margin: 5px auto 0 auto;
73
+ border: 1px solid #FFAAAA;
74
+ }
75
+
76
+ .feature-off-notice a{
77
+ text-decoration: none;
78
+ color: #257DA6;
79
+ }
80
+
81
+ #settings_mode{
82
+ text-align: justify;
83
+ padding: 5px 15px;
84
+ }
extension/AAM_Secure/view/security.phtml ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ======================================================================
4
+ * LICENSE: This file is subject to the terms and conditions defined in *
5
+ * file 'license.txt', which is part of this source code package. *
6
+ * ======================================================================
7
+ */
8
+ ?>
9
+ <div class="wrap">
10
+ <div class="postbox-container" style="width:70%;">
11
+ <div class="metabox-holder">
12
+ <div class="meta-box-sortables">
13
+ <div class="postbox">
14
+ <div class="handlediv" title="<?php echo __('Click to toggle', 'aam'); ?>"></div>
15
+ <h3 class="hndle">
16
+ <?php echo __('AAM Security', 'aam'); ?>
17
+ </h3>
18
+ <div class="inside main-inside">
19
+ <div class="mode-container" id="map_mode">
20
+ <?php if ($this->isGeoLookupOn()) { ?>
21
+ <div id="geo_map" style="width: 100%; height: 500px;"></div>
22
+ <?php } else { ?>
23
+ <p class="feature-off-notice">
24
+ The Geo Lookup feature is off. Turn it on with ConfigPress.<br/>
25
+ For more information check <a href="#" id="setting_trigger_inline">Settings</a> tab.
26
+ </p>
27
+ <?php } ?>
28
+ </div>
29
+ <div class="mode-container" id="settings_mode" style="display: none;">
30
+ <p>
31
+ In current version of AAM Security you have to utilize ConfigPress to trigger
32
+ certain features. Please find out below the list of all possible ConfigPress
33
+ settings:
34
+ <pre style="background:#fff;color:#000">
35
+ <span style="color:#05a;font-weight: bold;">[security]</span>
36
+ <span style="color:#00b418">#Geo Lookup feature monitors the location of the user based on IP address.</span>
37
+ <span style="color:#00b418">#By default this feature is deactivated and can be activated by changing.</span>
38
+ <span style="color:#00b418">#the <b>false</b> to <b>true</b>.</span>
39
+ <span style="color:#0100b6;font-weight:700;">login.geo_lookup</span> = <span style="color:#d80800">"false"</span>
40
+ <span style="color:#00b418">#We are using FreeGeoIP.net webservice to retrieve the geo location based on</span>
41
+ <span style="color:#00b418">#IP address. Currently this is the only option but we will extend the list of</span>
42
+ <span style="color:#00b418">#possible options in future releases.</span>
43
+ <span style="color:#0100b6;font-weight:700">login.geoip.service</span> = <span style="color:#d80800">"FreeGeoIP"</span>
44
+ <span style="color:#00b418">#Login lockout feature control the admin login process. This prevent your</span>
45
+ <span style="color:#00b418">#website from being hacked by trying different password combinations.</span>
46
+ <span style="color:#0100b6;font-weight:700">login.lockout</span> = <span style="color:#d80800">"false"</span>
47
+ <span style="color:#00b418">#This setting defines how many attempts user has for entering correct password</span>
48
+ <span style="color:#00b418">#before the <b>attempt failure</b> procedure fires.</span>