Ordermonitor_Agent - Version 1.2.2

Version Notes

Security adjustments.

Download this release

Release Info

Developer Adam Levenson
Extension Ordermonitor_Agent
Version 1.2.2
Comparing to
See all releases


Code changes from version 1.2.0 to 1.2.2

app/code/community/Ordermonitor/Agent/Exception.php CHANGED
@@ -5,7 +5,7 @@
5
  * @category Ordermonitor
6
  * @package Ordermonitor_Agent
7
  * @author Digital Operative <codemaster@digitaloperative.com>
8
- * @copyright Copyright (C) 2015 Digital Operative
9
  * @license http://www.ordermonitor.com/license
10
  */
11
  class Ordermonitor_Agent_Exception extends Mage_Core_Exception
5
  * @category Ordermonitor
6
  * @package Ordermonitor_Agent
7
  * @author Digital Operative <codemaster@digitaloperative.com>
8
+ * @copyright Copyright (C) 2016 Digital Operative
9
  * @license http://www.ordermonitor.com/license
10
  */
11
  class Ordermonitor_Agent_Exception extends Mage_Core_Exception
app/code/community/Ordermonitor/Agent/Helper/Data.php CHANGED
@@ -5,7 +5,7 @@
5
  * @category Ordermonitor
6
  * @package Ordermonitor_Agent
7
  * @author Digital Operative <codemaster@digitaloperative.com>
8
- * @copyright Copyright (C) 2015 Digital Operative
9
  * @license http://www.ordermonitor.com/license
10
  */
11
  class Ordermonitor_Agent_Helper_Data extends Mage_Core_Helper_Abstract
5
  * @category Ordermonitor
6
  * @package Ordermonitor_Agent
7
  * @author Digital Operative <codemaster@digitaloperative.com>
8
+ * @copyright Copyright (C) 2016 Digital Operative
9
  * @license http://www.ordermonitor.com/license
10
  */
11
  class Ordermonitor_Agent_Helper_Data extends Mage_Core_Helper_Abstract
app/code/community/Ordermonitor/Agent/Model/Cron.php CHANGED
@@ -5,7 +5,7 @@
5
  * @category Ordermonitor
6
  * @package Ordermonitor_Agent
7
  * @author Digital Operative <codemaster@digitaloperative.com>
8
- * @copyright Copyright (C) 2015 Digital Operative
9
  * @license http://www.ordermonitor.com/license
10
  */
11
  class Ordermonitor_Agent_Model_Cron extends Mage_Core_Model_Abstract
5
  * @category Ordermonitor
6
  * @package Ordermonitor_Agent
7
  * @author Digital Operative <codemaster@digitaloperative.com>
8
+ * @copyright Copyright (C) 2016 Digital Operative
9
  * @license http://www.ordermonitor.com/license
10
  */
11
  class Ordermonitor_Agent_Model_Cron extends Mage_Core_Model_Abstract
app/code/community/Ordermonitor/Agent/Model/Inventory.php CHANGED
@@ -5,7 +5,7 @@
5
  * @category Ordermonitor
6
  * @package Ordermonitor_Agent
7
  * @author Digital Operative <codemaster@digitaloperative.com>
8
- * @copyright Copyright (C) 2015 Digital Operative
9
  * @license http://www.ordermonitor.com/license
10
  */
11
  class Ordermonitor_Agent_Model_Inventory extends Mage_Core_Model_Abstract
5
  * @category Ordermonitor
6
  * @package Ordermonitor_Agent
7
  * @author Digital Operative <codemaster@digitaloperative.com>
8
+ * @copyright Copyright (C) 2016 Digital Operative
9
  * @license http://www.ordermonitor.com/license
10
  */
11
  class Ordermonitor_Agent_Model_Inventory extends Mage_Core_Model_Abstract
app/code/community/Ordermonitor/Agent/Model/Monitor.php CHANGED
@@ -5,7 +5,7 @@
5
  * @category Ordermonitor
6
  * @package Ordermonitor_Agent
7
  * @author Digital Operative <codemaster@digitaloperative.com>
8
- * @copyright Copyright (C) 2015 Digital Operative
9
  * @license http://www.ordermonitor.com/license
10
  */
11
  class Ordermonitor_Agent_Model_Monitor extends Mage_Core_Model_Abstract
5
  * @category Ordermonitor
6
  * @package Ordermonitor_Agent
7
  * @author Digital Operative <codemaster@digitaloperative.com>
8
+ * @copyright Copyright (C) 2016 Digital Operative
9
  * @license http://www.ordermonitor.com/license
10
  */
11
  class Ordermonitor_Agent_Model_Monitor extends Mage_Core_Model_Abstract
app/code/community/Ordermonitor/Agent/Model/Secure.php DELETED
@@ -1,154 +0,0 @@
1
- <?php
2
- /**
3
- * Order Monitor
4
- *
5
- * @category Ordermonitor
6
- * @package Ordermonitor_Agent
7
- * @author Digital Operative <codemaster@digitaloperative.com>
8
- * @copyright Copyright (C) 2015 Digital Operative
9
- * @license http://www.ordermonitor.com/license
10
- */
11
- class Ordermonitor_Agent_Model_Secure extends Mage_Core_Model_Abstract
12
- {
13
-
14
- /**
15
- * Gets information about the security settings for Magento
16
- *
17
- * @return array security check data
18
- */
19
- public function getSecureInfo()
20
- {
21
- $results = array();
22
-
23
- /*
24
- admin/security/use_form_key 1
25
- admin/security/session_cookie_lifetime 3600
26
- admin/security/lockout_failures 6
27
- admin/security/lockout_threshold 30
28
- admin/security/password_lifetime 90
29
- admin/security/password_is_forced 1
30
- */
31
-
32
- $results['captchaEnabled'] = Mage::getStoreConfig('admin/captcha/enable');
33
- $results['adminHttps'] = Mage::getStoreConfig('web/secure/use_in_adminhtml');
34
-
35
- //CASE SENSATIVE - password is always case, used for username
36
- $results['loginCaseSensitive'] = Mage::getStoreConfig('admin/security/use_case_sensitive_login');
37
- $results['adminPathOk'] = $this->_checkAdminUrlPath();
38
- $results['localXmlSecured'] = $this->_checkLocalXmlPublic();
39
-
40
- $results['adminUsername'] = $this->_checkAdminUsernames();
41
-
42
- $passwordUsers = $this->_checkAdminPasswords();
43
-
44
- if (count($passwordUsers) > 0) {
45
- $results['passwordsOk'] = 0;
46
- } else {
47
- $results['passwordsOk'] = 1;
48
- }
49
-
50
- $results['badPasswords'] = array('numUsers' => count($passwordUsers), 'usernames' => $passwordUsers);
51
-
52
- return $results;
53
- }
54
-
55
-
56
- private function _checkAdminUrlPath()
57
- {
58
- $badPaths = array('admin');
59
- $adminUrlPath = Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName');
60
-
61
- if(Mage::getStoreConfig('admin/url/use_custom_path') === 1) {
62
- $adminUrlPath = Mage::getStoreConfig('admin/url/custom_path');
63
- }
64
-
65
- if (in_array($adminUrlPath, $badPaths)) {
66
- return 0;
67
- }
68
-
69
- return 1;
70
- }
71
-
72
-
73
- private function _checkAdminUsernames()
74
- {
75
- $badUsernames = array('admin');
76
-
77
- $admin = Mage::getModel("admin/user");
78
- $admins = $admin->getCollection()
79
- ->addFieldToFilter('username', array('in' => $badUsernames));
80
-
81
- $adminUsers = $admins->load()->toArray();
82
-
83
- return $adminUsers['totalRecords'];
84
- }
85
-
86
- private function _checkAdminPasswords()
87
- {
88
- $badPasswords = array(
89
- '123456789',
90
- '12345678',
91
- '1234567',
92
- '69696969',
93
- '123123123',
94
- 'password',
95
- 'trustno1',
96
- 'adminadmin',
97
- 'admin123',
98
- 'magento',
99
- 'abc1234',
100
- 'iloveyou',
101
- 'football',
102
- 'baseball',
103
- 'superman',
104
- 'letmein'
105
- );
106
-
107
- $badUsers = array();
108
-
109
- $admin = Mage::getModel("admin/user");
110
- $admins = $admin->getCollection()
111
- ->addFieldToFilter('is_active', array('eq' => 1));
112
-
113
- $adminUsers = $admins->load();
114
-
115
- foreach ($adminUsers as $user) {
116
- foreach ($badPasswords as $password) {
117
- if ($admin->authenticate($user->username, $password) == true) {
118
- $badUsers[] = $user->username;
119
- }
120
- }
121
- }
122
-
123
- return $badUsers;
124
- }
125
-
126
-
127
- private function _checkLocalXmlPublic()
128
- {
129
- $url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . 'app/etc/local.xml';
130
-
131
- $client = new Varien_Http_Client();
132
- $client->setUri($url)
133
- ->setMethod('GET')
134
- ->setConfig(
135
- array(
136
- 'maxredirects' => 1,
137
- 'timeout' => 15,
138
- ));
139
-
140
- try {
141
- $response = $client->request();
142
- $statusCode = $response->getStatus();
143
- } catch (Exception $e) {
144
- $statusCode = 0;
145
- }
146
-
147
- if ($statusCode === 403) {
148
- return 1;
149
- }
150
-
151
- return 0;
152
- }
153
-
154
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Ordermonitor/Agent/controllers/AgentController.php CHANGED
@@ -5,7 +5,7 @@
5
  * @category Ordermonitor
6
  * @package Ordermonitor_Agent
7
  * @author Digital Operative <codemaster@digitaloperative.com>
8
- * @copyright Copyright (C) 2015 Digital Operative
9
  * @license http://www.ordermonitor.com/license
10
  */
11
  class Ordermonitor_Agent_AgentController extends Mage_Core_Controller_Front_Action
@@ -56,7 +56,7 @@ class Ordermonitor_Agent_AgentController extends Mage_Core_Controller_Front_Acti
56
  $om = Mage::getModel('ordermonitor_agent/monitor');
57
 
58
  if ($om->storeIdsOk($storeIds) === false) {
59
- $results['error']['code'] = '1';
60
  $results['error']['message'] = 'Invalid store id(s).';
61
  } else {
62
  if ($this->_auth === true) {
@@ -145,17 +145,4 @@ class Ordermonitor_Agent_AgentController extends Mage_Core_Controller_Front_Acti
145
  $this->getResponse()->setHeader('Content-type', 'application/json');
146
  $this->getResponse()->setBody($json);
147
  }
148
-
149
- public function securityAction()
150
- {
151
- $om = Mage::getModel('ordermonitor_agent/secure');
152
- $results = $om->getSecureInfo();
153
-
154
- $json = json_encode($results);
155
-
156
- $this->getResponse()->setHeader('Content-type', 'application/json');
157
- $this->getResponse()->setBody($json);
158
-
159
- }
160
-
161
  }
5
  * @category Ordermonitor
6
  * @package Ordermonitor_Agent
7
  * @author Digital Operative <codemaster@digitaloperative.com>
8
+ * @copyright Copyright (C) 2016 Digital Operative
9
  * @license http://www.ordermonitor.com/license
10
  */
11
  class Ordermonitor_Agent_AgentController extends Mage_Core_Controller_Front_Action
56
  $om = Mage::getModel('ordermonitor_agent/monitor');
57
 
58
  if ($om->storeIdsOk($storeIds) === false) {
59
+ $results['error']['code'] = '2';
60
  $results['error']['message'] = 'Invalid store id(s).';
61
  } else {
62
  if ($this->_auth === true) {
145
  $this->getResponse()->setHeader('Content-type', 'application/json');
146
  $this->getResponse()->setBody($json);
147
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  }
app/code/community/Ordermonitor/Agent/etc/config.xml CHANGED
@@ -6,7 +6,7 @@
6
  * @category Ordermonitor
7
  * @package Ordermonitor_Agent
8
  * @author Digital Operative <codemaster@digitaloperative.com>
9
- * @copyright Copyright (C) 2015 Digital Operative
10
  * @license http://www.ordermonitor.com/license
11
  */
12
  -->
6
  * @category Ordermonitor
7
  * @package Ordermonitor_Agent
8
  * @author Digital Operative <codemaster@digitaloperative.com>
9
+ * @copyright Copyright (C) 2016 Digital Operative
10
  * @license http://www.ordermonitor.com/license
11
  */
12
  -->
app/code/community/Ordermonitor/Agent/etc/system.xml CHANGED
@@ -6,7 +6,7 @@
6
  * @category Ordermonitor
7
  * @package Ordermonitor_Agent
8
  * @author Digital Operative <codemaster@digitaloperative.com>
9
- * @copyright Copyright (C) 2015 Digital Operative
10
  * @license http://www.ordermonitor.com/license
11
  */
12
  -->
6
  * @category Ordermonitor
7
  * @package Ordermonitor_Agent
8
  * @author Digital Operative <codemaster@digitaloperative.com>
9
+ * @copyright Copyright (C) 2016 Digital Operative
10
  * @license http://www.ordermonitor.com/license
11
  */
12
  -->
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ordermonitor_Agent</name>
4
- <version>1.2.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.ordermonitor.com/license">Commercial</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Monitor what matters; orders. Get notifications if something goes awry. Trends and forecasting give you insight into how your store is performing.</summary>
10
  <description>The Order Monitor Agent collects and aggregates data for the Order Monitor service, enabling you to setup alerts based on order volume, aov, discounts and much more. Compare your metrics to yesterday and your average to see if your trending up or down. Forecasting allows to predict the sales for the day.</description>
11
- <notes>Updated to get status of cron jobs. Other minor updates and tweaks.</notes>
12
  <authors><author><name>Adam Levenson</name><user>adamdo</user><email>adam@digitaloperative.com</email></author></authors>
13
- <date>2016-02-09</date>
14
- <time>21:05:21</time>
15
- <contents><target name="mageetc"><dir name="modules"><file name="Ordermonitor_Agent.xml" hash="d801d81de66117f06637c0750e2a5931"/></dir></target><target name="magecommunity"><dir name="Ordermonitor"><dir name="Agent"><file name="Exception.php" hash="43ac0dea595b3d2134a76b55e70b1d5f"/><dir name="Helper"><file name="Data.php" hash="9275cefdbaeca0062868e257c391f7e7"/></dir><dir name="Model"><file name="Cron.php" hash="f5ed277ab930a44951ac3b78487d2317"/><file name="Inventory.php" hash="937d22c671add6ae30726e0bf38c9d54"/><file name="Monitor.php" hash="6acf1b9e5336aaeeab4cadcf6e322e16"/><file name="Secure.php" hash="eb3f5601eecf3585f58d8fff4414d680"/></dir><dir name="controllers"><file name="AgentController.php" hash="1ffcdba434dcac43e1309576a6fbbae4"/></dir><dir name="etc"><file name="config.xml" hash="31cb814911264eaa2513c85f18ef9b36"/><file name="system.xml" hash="544cf6e710b8d0cc50cd04bbf1faa202"/></dir><file name=".DS_Store" hash="816504a148fbbe790644c6c7427a6f81"/></dir><file name=".DS_Store" hash="60238f239932c73cc1be075fbd3e96ef"/></dir></target></contents>
16
  <compatible/>
17
- <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.5.0.0</min><max>1.9.2.3</max></package></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ordermonitor_Agent</name>
4
+ <version>1.2.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.ordermonitor.com/license">Commercial</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Monitor what matters; orders. Get notifications if something goes awry. Trends and forecasting give you insight into how your store is performing.</summary>
10
  <description>The Order Monitor Agent collects and aggregates data for the Order Monitor service, enabling you to setup alerts based on order volume, aov, discounts and much more. Compare your metrics to yesterday and your average to see if your trending up or down. Forecasting allows to predict the sales for the day.</description>
11
+ <notes>Security adjustments.</notes>
12
  <authors><author><name>Adam Levenson</name><user>adamdo</user><email>adam@digitaloperative.com</email></author></authors>
13
+ <date>2016-02-24</date>
14
+ <time>18:02:41</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Ordermonitor_Agent.xml" hash="d801d81de66117f06637c0750e2a5931"/></dir></target><target name="magecommunity"><dir name="Ordermonitor"><dir name="Agent"><file name="Exception.php" hash="8831bc1226e079c73176a27acd23a02b"/><dir name="Helper"><file name="Data.php" hash="cf9a837e4b1e6a2c40000ab3b795e5d8"/></dir><dir name="Model"><file name="Cron.php" hash="81f3ae712cb1200c01f9dc36d6d2f524"/><file name="Inventory.php" hash="3fec6496931d6d3f533c9760d1479e5f"/><file name="Monitor.php" hash="a035dadb0930ab49575ef54f9ebbc51a"/></dir><dir name="controllers"><file name="AgentController.php" hash="ab176186ce6818d8f020af488eea746a"/></dir><dir name="etc"><file name="config.xml" hash="382a97acd653be83c950a9803aeb6a41"/><file name="system.xml" hash="1984b77515766fedb9ce67c0e4b1cd35"/></dir><file name=".DS_Store" hash="816504a148fbbe790644c6c7427a6f81"/></dir><file name=".DS_Store" hash="60238f239932c73cc1be075fbd3e96ef"/></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.5.0.0</min><max>1.9.2.4</max></package></required></dependencies>
18
  </package>