MaxTraffic_Exit_Offers - Version 2.0.0

Version Notes

Version 2.0.0 - Stable release.

Download this release

Release Info

Developer Krisjanis Cers
Extension MaxTraffic_Exit_Offers
Version 2.0.0
Comparing to
See all releases


Code changes from version 1.0.3 to 2.0.0

app/code/community/Maxtraffic/WidgetTraffic/Block/Welcome.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Maxtraffic_WidgetTraffic_Block_welcome extends Mage_Core_Block_Template
4
+ {
5
+ public function maxtrafficGetWelcome()
6
+ {
7
+ var_dump('expressionssssssssssssssssssssssssssss');
8
+ }
9
+ }
app/code/community/Maxtraffic/WidgetTraffic/controllers/Adminhtml/TrafficController.php CHANGED
@@ -4,85 +4,312 @@ class Maxtraffic_WidgetTraffic_Adminhtml_TrafficController extends Mage_Adminhtm
4
  {
5
  public function indexAction()
6
  {
 
 
 
 
 
 
 
 
 
 
7
 
8
- $storeId = Mage::app()->getStore()->getStoreId();
 
 
9
 
10
- $domain = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
11
- $websiteUrl = substr_compare($domain, '/index.php/', 0, 11) ? substr($domain, 0, -11) : $domain;
 
 
12
 
13
- $connection = Mage::getSingleton('core/resource');
14
- $readConnection = $connection->getConnection('core_read');
15
- $maxtrafficSites = $readConnection->fetchAll("SELECT * FROM maxtraffic");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
- if(empty($maxtrafficSites))
18
  {
19
- $user = Mage::getSingleton('admin/session');
20
- $userFirstName = $user->getUser()->getFirstname();
21
- $email = $user->getUser()->getEmail();
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
- $url = 'http://e.maxtraffic.com/magento/response?&store='.$websiteUrl.'&email='.$email.'&name='.$userFirstName;
24
- $response = json_decode(file_get_contents($url));
 
 
25
 
26
- if($response->ok)
27
- {
28
- $writeConnection = $connection->getConnection('core_write');
29
- $writeConnection->insert('maxtraffic', array('maxtraffic_website_id' => $response->data->website_id, 'maxtraffic_token' => $response->data->user_token));
30
 
31
- $template = "\n<!-- MaxTraffic script -->\n<script type='text/javascript'>\n(function() {\nvar k = document.createElement('script');\nk.type = 'text/javascript';\nk.async = true;\nk.src = '//e.maxtraffic.com/serve/public/index.php?id=".$response->data->website_id."&d=".$response->data->website_name."';\n var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(k, s);\n})();\n</script>\n<!-- End of MaxTraffic script -->";
 
 
32
 
33
- $headerScripts = $readConnection->fetchAll("SELECT * FROM core_config_data WHERE path = 'design/head/includes'");
 
 
 
 
 
34
 
35
- if(empty($headerScripts))
36
- {
37
- $writeConnection->insert('core_config_data', array('scope' => 'default', 'value' => $template, 'path' => 'design/head/includes', 'scope_id' => '0'));
38
- }
39
- else
40
- {
41
- foreach ($headerScripts as $header)
42
- {
43
- $script = $header['value'] .' '. $template;
44
 
45
- $updateQue = 'UPDATE core_config_data SET value = "'.$script.'" WHERE config_id = '.$header['config_id'];
46
- $writeConnection->query($updateQue);
47
- }
48
- }
49
 
50
- $redirect = 'login';
51
- }
52
- else
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  {
54
- $redirect = 'invalid';
 
 
 
55
  }
56
  }
57
- else
 
 
 
 
 
 
 
58
  {
59
- $redirect = 'login';
60
  }
61
 
62
- Mage::app()->getResponse()->setRedirect(Mage::helper('adminhtml')->getUrl("adminhtml/traffic/".$redirect))->sendResponse();
 
 
 
 
 
 
 
 
63
  }
64
 
65
- public function loginAction()
66
  {
67
- $connection = Mage::getSingleton('core/resource');
68
- $readConnection = $connection->getConnection('core_read');
69
- $maxtrafficSites = $readConnection->fetchAll("SELECT * FROM maxtraffic");
 
 
 
 
 
 
 
 
 
 
70
 
71
- $maxtrafficToken = empty($maxtrafficSites) ? null : $maxtrafficSites[0]['maxtraffic_token'];
72
- $maxtrafficWebsiteId = empty($maxtrafficSites) ? null : $maxtrafficSites[0]['maxtraffic_website_id'];
 
 
 
 
 
73
 
74
- $url = 'http://e.maxtraffic.com/magento/auth?token='.$maxtrafficToken.'&website='.$maxtrafficWebsiteId;
 
 
 
 
 
 
75
 
76
- header("Location: ".$url);
77
  }
78
 
79
- public function invalidAction()
80
  {
81
- $this->loadLayout();
82
-
83
- $block = $this->getLayout()->createBlock('core/text', 'invalid-message')->setText('<h1>Unable to connect with MaxTraffic</h1><p>Invalid e-mail</p>');
84
- $this->_addContent($block);
85
-
86
- $this->renderLayout();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
 
88
  }
4
  {
5
  public function indexAction()
6
  {
7
+ // Check if maxtraffic table exists
8
+ if(!$this->maxtTrafficRecordsExists() || $this->maxtTrafficEmptyUserLogin() || !$this->maxtTrafficCheckData()->ok)
9
+ {
10
+ // If table or record doesn't exist, show welcome page with menu
11
+ return $this->maxtTrafficWelcome();
12
+ }
13
+
14
+ // If table record exist
15
+ return $this->maxtTrafficGetRedirect();
16
+ }
17
 
18
+ public function maxtTrafficWelcome()
19
+ {
20
+ $post = Mage::app()->getRequest()->getParams();
21
 
22
+ if(!empty($post['email']) && !empty($post['password']))
23
+ {
24
+ $email = filter_var($post['email'], FILTER_SANITIZE_SPECIAL_CHARS);
25
+ $password = filter_var($post['password'], FILTER_SANITIZE_SPECIAL_CHARS);
26
 
27
+ $storeUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
28
+ $domain = substr_compare($storeUrl, '/index.php/', 0, 11) ? substr($storeUrl, 0, -11) : $storeUrl;
29
+
30
+ return $this->maxtTrafficPostLogin($email, $password, $domain);
31
+ }
32
+
33
+ // Show layout
34
+ $this->loadLayout();
35
+ $block = $this->getLayout()
36
+ ->createBlock('core/text', 'maxtraffic-section')
37
+ ->setText('<div id="maxtraffic-content"><h1>Loading</p></div>');
38
+ $this->_addContent($block);
39
+ $this->renderLayout();
40
+
41
+ //
42
+ include Mage::getModuleDir('controllers', 'Maxtraffic_WidgetTraffic').'/Adminhtml/welcome.php';
43
+ }
44
+
45
+ public function maxtTrafficGetRedirect()
46
+ {
47
+ $this->loadLayout();
48
+ $block = $this->getLayout()
49
+ ->createBlock('core/text', 'maxtraffic-section')
50
+ ->setText('<div id="maxtraffic-content"><h1>Loading</p></div>');
51
+ $this->_addContent($block);
52
+ $this->renderLayout();
53
+
54
+ include Mage::getModuleDir('controllers', 'Maxtraffic_WidgetTraffic').'/Adminhtml/redirect.php';
55
+ }
56
+
57
+ public function maxtTrafficPostLogin($email, $password, $domain)
58
+ {
59
+ $data = array(
60
+ 'email' => $email,
61
+ 'password' => $password,
62
+ 'domain' => $domain
63
+ );
64
+
65
+ $data = implode(';', $data);
66
+ $salt = "MaxTraffic Pop-Up Plugin";
67
+ $crypted_data = trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $salt, $data, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
68
+
69
+ $url = 'http://e.maxtraffic.local/magento/login-response?data='. $crypted_data;
70
+ $response = json_decode(file_get_contents($url));
71
+
72
+ if(!$response->ok)
73
+ {
74
+ $_SESSION['message'] = 'Invalid login data!';
75
+
76
+ $this->loadLayout();
77
+ $block = $this->getLayout()
78
+ ->createBlock('core/text', 'maxtraffic-section')
79
+ ->setText('<div id="maxtraffic-content"><h1>Loading</p></div>');
80
+ $this->_addContent($block);
81
+ $this->renderLayout();
82
+ include Mage::getModuleDir('controllers', 'Maxtraffic_WidgetTraffic').'/Adminhtml/welcome.php';
83
+
84
+ return;
85
+ }
86
+
87
+ $user = $response->user_id;
88
+ $website = $response->website;
89
+ $token = $response->magento_token;
90
+ $tracking_code = $response->tracking_code;
91
+
92
+ if($this->maxtTrafficRecordsExists() || $this->maxtTrafficEmptyUserLogin())
93
+ {
94
+ // Insert data in table
95
+ $this->maxtTrafficInsertData($user, $website, $token, $tracking_code);
96
+ }
97
+
98
+ Mage::app()->getResponse()->setRedirect(Mage::helper('adminhtml')->getUrl("adminhtml/traffic/"))->sendResponse();
99
+
100
+ }
101
+
102
+ public function registerAction()
103
+ {
104
+ $post = Mage::app()->getRequest()->getParams();
105
 
106
+ if(empty($post['email']) && empty($post['domain']))
107
  {
108
+ $storeUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
109
+ $domain = substr_compare($storeUrl, '/index.php/', 0, 11) ? substr($storeUrl, 0, -11) : $storeUrl;
110
+
111
+ $this->loadLayout();
112
+ $block = $this->getLayout()
113
+ ->createBlock('core/text', 'maxtraffic-section')
114
+ ->setText('<div id="maxtraffic-content"><h1>Loading</p></div>');
115
+ $this->_addContent($block);
116
+ $this->renderLayout();
117
+
118
+ include Mage::getModuleDir('controllers', 'Maxtraffic_WidgetTraffic').'/Adminhtml/register.php';
119
+
120
+ return;
121
+ }
122
+
123
+ // Get email and domain, make url
124
 
125
+ $name = filter_var($post['name'], FILTER_SANITIZE_SPECIAL_CHARS);
126
+ $surname = filter_var($post['surname'], FILTER_SANITIZE_SPECIAL_CHARS);
127
+ $email = filter_var($post['email'], FILTER_SANITIZE_SPECIAL_CHARS);
128
+ $domain = filter_var($post['domain'], FILTER_SANITIZE_SPECIAL_CHARS);
129
 
130
+ // Validate input
131
+ $validator = $this->maxtTrafficInputValidator($email, $domain);
 
 
132
 
133
+ if(!$validator)
134
+ {
135
+ $_SESSION['message'] = 'Invalid E-mail or Website!';
136
 
137
+ $this->loadLayout();
138
+ $block = $this->getLayout()
139
+ ->createBlock('core/text', 'maxtraffic-section')
140
+ ->setText('<div id="maxtraffic-content"><h1>Loading</p></div>');
141
+ $this->_addContent($block);
142
+ $this->renderLayout();
143
 
144
+ include Mage::getModuleDir('controllers', 'Maxtraffic_WidgetTraffic').'/Adminhtml/register.php';
 
 
 
 
 
 
 
 
145
 
146
+ return;
147
+ }
148
+
149
+ $url = 'http://e.maxtraffic.local/magento/register?email='. $email .'&domain='. $domain .'&name='. $name .'&surname='. $surname;
150
 
151
+ $response = json_decode(file_get_contents($url));
152
+
153
+ // Check if valid response
154
+ if(!$response->ok)
155
+ {
156
+ $_SESSION['message'] = 'Invalid E-mail or already registred!';
157
+
158
+ $this->loadLayout();
159
+ $block = $this->getLayout()
160
+ ->createBlock('core/text', 'maxtraffic-section')
161
+ ->setText('<div id="maxtraffic-content"><h1>Loading</p></div>');
162
+ $this->_addContent($block);
163
+ $this->renderLayout();
164
+
165
+ include Mage::getModuleDir('controllers', 'Maxtraffic_WidgetTraffic').'/Adminhtml/register.php';
166
+
167
+ return;
168
+ }
169
+
170
+ $user = $response->user_id;
171
+ $website = $response->website;
172
+ $token = $response->magento_token;
173
+ $tracking_code = $response->tracking_code;
174
+
175
+ // Insert data in table
176
+ $this->maxtTrafficInsertData($user, $website, $token, $tracking_code);
177
+
178
+ Mage::app()->getResponse()->setRedirect(Mage::helper('adminhtml')->getUrl("adminhtml/traffic/"))->sendResponse();
179
+ }
180
+
181
+ public function maxtTrafficRecordsExists()
182
+ {
183
+ $connection = Mage::getSingleton('core/resource');
184
+ $readConnection = $connection->getConnection('core_read');
185
+ $records = count($readConnection->fetchAll("SELECT * FROM maxtraffic")) > 0 ? true : false;
186
+
187
+ return $records;
188
+ }
189
+
190
+ public function maxtTrafficEmptyUserLogin()
191
+ {
192
+ $row = $this->maxtTrafficData();
193
+
194
+ return empty($row['maxtraffic_user']) || empty($row['maxtraffic_website']) ? true : false;
195
+ }
196
+
197
+ public function maxtTrafficdata()
198
+ {
199
+ $connection = Mage::getSingleton('core/resource');
200
+ $readConnection = $connection->getConnection('core_read');
201
+ $query = $readConnection->fetchAll("SELECT * FROM maxtraffic");
202
+
203
+ return $query[0];
204
+ }
205
+
206
+ public function maxtTrafficInsertData($user, $website, $token, $trackingCode)
207
+ {
208
+ $connection = Mage::getSingleton('core/resource');
209
+ $writeConnection = $connection->getConnection('core_write');
210
+ $writeConnection->insert('maxtraffic', array('maxtraffic_user' => $user,'maxtraffic_website' => $website, 'maxtraffic_token' => $token));
211
+
212
+ $readConnection = $connection->getConnection('core_read');
213
+ $footerScripts = $readConnection->fetchAll("SELECT * FROM core_config_data WHERE path = 'design/footer/absolute_footer'");
214
+
215
+ if(empty($footerScripts))
216
+ {
217
+ $writeConnection->insert('core_config_data', array('scope' => 'default', 'value' => '<!-- MaxTraffic -->'.$trackingCode.'<!-- MaxTraffic -->', 'path' => 'design/footer/absolute_footer', 'scope_id' => '0'));
218
+ }
219
+ else
220
+ {
221
+ foreach ($footerScripts as $footer)
222
  {
223
+ $script = $footer['value'] .' <!-- MaxTraffic -->'. str_replace('"', "'", $trackingCode).'<!-- MaxTraffic -->';
224
+
225
+ $updateQue = 'UPDATE core_config_data SET value = "'.$script.'" WHERE config_id = '.$footer['config_id'];
226
+ $writeConnection->query($updateQue);
227
  }
228
  }
229
+ }
230
+
231
+ public function maxtTrafficCheckData()
232
+ {
233
+ $response = new StdClass;
234
+ $response->ok = false;
235
+
236
+ if(!$this->maxtTrafficRecordsExists())
237
  {
238
+ return $response;
239
  }
240
 
241
+ $query = $this->maxtTrafficData();
242
+
243
+ $url = 'http://e.maxtraffic.local/magento/login-check?user='. $query['maxtraffic_user'] .'&website='. $query['maxtraffic_website'] .'&token='. $query['maxtraffic_token'];
244
+
245
+ $data = json_decode(file_get_contents($url));
246
+
247
+ $response = $data->ok ? $data : $response;
248
+
249
+ return $response;
250
  }
251
 
252
+ public function maxtTrafficInputValidator($email, $domain)
253
  {
254
+ $emailNecesary = array('@', '.');
255
+ $websiteBanned = array('@', '~', '°', '!', '|', '"');
256
+ $websiteNecesary = array('.');
257
+
258
+ $result = true;
259
+
260
+ foreach($emailNecesary as $value)
261
+ {
262
+ if($result && !strpos($email, $value))
263
+ {
264
+ $result = false;
265
+ }
266
+ }
267
 
268
+ foreach($websiteBanned as $value)
269
+ {
270
+ if($result && strpos($domain, $value))
271
+ {
272
+ $result = false;
273
+ }
274
+ }
275
 
276
+ foreach($websiteNecesary as $value)
277
+ {
278
+ if($result && !strpos($domain, $value))
279
+ {
280
+ $result = false;
281
+ }
282
+ }
283
 
284
+ return $result;
285
  }
286
 
287
+ public function logoutAction()
288
  {
289
+ if ($this->maxtTrafficRecordsExists())
290
+ {
291
+ $connection = Mage::getSingleton('core/resource');
292
+ $writeConnection = $connection->getConnection('core_write');
293
+ $updateQue = 'TRUNCATE TABLE maxtraffic';
294
+ $writeConnection->query($updateQue);
295
+
296
+ $readConnection = $connection->getConnection('core_read');
297
+ $footerScripts = $readConnection->fetchAll("SELECT * FROM core_config_data WHERE path = 'design/footer/absolute_footer'");
298
+
299
+ if(!empty($footerScripts))
300
+ {
301
+ foreach ($footerScripts as $footer)
302
+ {
303
+ $explodedScript = explode('<!-- MaxTraffic -->', $footer['value']);
304
+ $removedScript = str_replace(array($explodedScript[1], '<!-- MaxTraffic -->'), '', $footer['value']);
305
+
306
+ $updateQue = 'UPDATE core_config_data SET value = "'.$removedScript.'" WHERE config_id = '.$footer['config_id'];
307
+ $writeConnection->query($updateQue);
308
+ }
309
+ }
310
+ }
311
+
312
+ Mage::app()->getResponse()->setRedirect(Mage::helper('adminhtml')->getUrl("adminhtml/traffic/"))->sendResponse();
313
  }
314
+
315
  }
app/code/community/Maxtraffic/WidgetTraffic/controllers/Adminhtml/redirect.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="maxtraffic-old-content">
2
+ <div class="maxtraffic-wrap" style="max-width:1000px;margin:20px auto;" hidden>
3
+ <h1 style="text-align:center;">MaxTraffic Exit Offers</h1>
4
+
5
+ <?php
6
+ $check = $this->maxtTrafficCheckData();
7
+ if($check->ok)
8
+ {
9
+ $query = $this->maxtTrafficData();
10
+ ?>
11
+ <div style="max-width:1000px;text-align:center;margin:0 auto;">
12
+ <div style="width:50%;box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.1);border-radius: 5px;background: rgba(255, 255, 255, 0.65);padding: 10px 20px 10px 20px;margin:40px auto;">
13
+ <br>
14
+ <p>
15
+ You are logged in as <b><?php echo $check->email; ?></b> (<a href="<?php echo Mage::helper('adminhtml')->getUrl("adminhtml/traffic/logout"); ?>" style="color:#F77B08;">Logout</a>) and we have placed MaxTraffic tracking code for <b><?php echo $check->domain; ?></b> in the source of your site.
16
+ </p>
17
+ <p>
18
+ Go to MaxTraffic to set up and manage your campaigns.
19
+ </p>
20
+ <a href="//e.maxtraffic.local/magento/login?user=<?php echo $query['maxtraffic_user'] .'&website='. $query['maxtraffic_website'] .'&token='. $query['maxtraffic_token'] ?>" target="_blank" class="button button-primary" style="padding:7px;border-radius:5px;color: #fff;background-color: #F77B08;border-color: #de6f07;text-shadow:none;box-shadow:0 1px 0 #C75800;-webkit-box-shadow:0 1px 0 #C75800;background-image:none;text-decoration:none;">Go to MaxTraffic</a>
21
+ </div>
22
+ </div>
23
+ <?php
24
+ }
25
+ else
26
+ {
27
+ $connection = Mage::getSingleton('core/resource');
28
+ $writeConnection = $connection->getConnection('core_write');
29
+ $updateQue = 'TRUNCATE TABLE maxtraffic';
30
+ $writeConnection->query($updateQue);
31
+
32
+ Mage::app()->getResponse()->setRedirect(Mage::helper('adminhtml')->getUrl("adminhtml/traffic/"))->sendResponse();
33
+ }
34
+ ?>
35
+ </div>
36
+ </div>
37
+
38
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
39
+ <script type="text/javascript">
40
+ var $m = jQuery.noConflict();
41
+ $m(document).ready(function()
42
+ {
43
+ var content = $m('.maxtraffic-wrap').html();
44
+ $m('#maxtraffic-old-content').remove();
45
+ $m('#maxtraffic-content').html(content);
46
+ });
47
+ </script>
app/code/community/Maxtraffic/WidgetTraffic/controllers/Adminhtml/register.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="maxtraffic-old-content">
2
+ <div class="maxtraffic-wrap" style="max-width:1000px;margin:20px auto;" hidden>
3
+ <div style="max-width:1000px;margin:0 auto;">
4
+ <h1 style="text-align:center;">MaxTraffic Exit Offers</h1>
5
+
6
+ <?php
7
+ if(isset($_SESSION['message']))
8
+ {
9
+ ?>
10
+ <div style="padding: 15px;margin-bottom: 20px;border: 1px solid transparent;border-radius: 4px;background-color: #f2dede;border-color: #ebccd1;color: #a94442;">
11
+ <b>
12
+ <?php
13
+ echo $_SESSION['message'];
14
+
15
+ unset($_SESSION['message']);
16
+ ?>
17
+ </b>
18
+ </div>
19
+ <?php
20
+ }
21
+ ?>
22
+
23
+ <div style="width:100%;text-align:center;">
24
+ <div style="width:40%;box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.1);border-radius: 5px;background: rgba(255, 255, 255, 0.65);padding: 10px 20px 10px 20px;margin:40px auto;">
25
+ <br>
26
+ <form action="<?php echo Mage::helper('adminhtml')->getUrl("adminhtml/traffic/register"); ?>">
27
+ <p>
28
+ <label for="name"><b>Your name</b></label>
29
+ <input type="text" name="name" style="float:right;font-size:13px;">
30
+ </p>
31
+ <p>
32
+ <label for="surname"><b>Your surname</b></label>
33
+ <input type="text" name="surname" style="float:right;font-size:13px;">
34
+ </p>
35
+ <p>
36
+ <label for="email"><b>E-mail</b></label>
37
+ <input type="text" name="email" style="float:right;font-size:13px;">
38
+ </p>
39
+ <p>
40
+ <label for="domain"><b>Website</b></label>
41
+ <input type="text" name="domain" autocomplete="off" style="float:right;font-size:13px;" value="<?php echo $domain ?>">
42
+ </p>
43
+ <p>
44
+ <br>
45
+ <br>
46
+ <input type="submit" value="Create My Account" class="button button-primary" style="cursor:pointer;padding:7px;color: #fff;background-color: #F77B08;border:none;text-shadow:none;box-shadow:0 1px 0 #C75800;-webkit-box-shadow:0 1px 0 #C75800;background-image:none;border-radius:5px;">
47
+ </p>
48
+ </form>
49
+ </div>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ </div>
54
+
55
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
56
+ <script type="text/javascript">
57
+ var $m = jQuery.noConflict();
58
+ $m(document).ready(function()
59
+ {
60
+ var content = $m('.maxtraffic-wrap').html();
61
+ $m('#maxtraffic-old-content').remove();
62
+ $m('#maxtraffic-content').html(content);
63
+ });
64
+ </script>
app/code/community/Maxtraffic/WidgetTraffic/controllers/Adminhtml/welcome.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="maxtraffic-old-content">
2
+ <div class="maxtraffic-wrap" style="max-width:1000px;margin:20px auto;" hidden>
3
+ <div style="max-width:1000px;margin:0 auto;">
4
+ <h1 style="text-align:center;">MaxTraffic Exit Offers</h1>
5
+
6
+ <h2 style="text-align:center;">Thank you for installing our plugin!</h2>
7
+ <div style="width:100%;text-align:center;">
8
+ <p>If you are new to MaxTraffic then use the form to your left and create a new account. After registration go to our platform and create your first campaign. New users can use our platform 14 days for free and then decide if they want to continue with paid subscription.</p>
9
+ <p>If you already have an account with us, log in with form on your right. We will automatically place our tracking code on your site and you will be able to show ads to your leaving visitors.</p>
10
+ </div>
11
+
12
+ <?php
13
+ if(isset($_SESSION['message']))
14
+ {
15
+ ?>
16
+ <div style="padding: 15px;margin-bottom: 20px;border: 1px solid transparent;border-radius: 4px;background-color: #f2dede;border-color: #ebccd1;color: #a94442;">
17
+ <b>
18
+ <?php
19
+ echo $_SESSION['message'];
20
+
21
+ unset($_SESSION['message']);
22
+ ?>
23
+ </b>
24
+ </div>
25
+ <?php
26
+ }
27
+ ?>
28
+
29
+ <div style="width:100%;text-align:center;display:-webkit-flex;display:flex;height:inherit;">
30
+ <div style="width:50%;-webkit-flex: 1;-ms-flex: 1;flex: 1;box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.1);border-radius: 5px;background: rgba(255, 255, 255, 0.65);padding: 10px 20px 10px 20px;margin:40px 20px;">
31
+ <h2>I am a new user</h2>
32
+ <p>
33
+ <a href="<?php echo Mage::helper('adminhtml')->getUrl("adminhtml/traffic/register"); ?>" class="button button-primary" style="padding:7px;border-radius:5px;color: #fff;background-color: #F77B08;border-color: #de6f07;text-shadow:none; margin-top:50px;box-shadow:0 1px 0 #C75800;-webkit-box-shadow:0 1px 0 #C75800;background-image:none;text-decoration:none;">Create new account</a>
34
+ </p>
35
+ </div>
36
+ <div style="width:50%;-webkit-flex: 1;-ms-flex: 1;flex: 1;box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.1);border-radius: 5px;background: rgba(255, 255, 255, 0.65);padding: 10px 20px 10px 20px;margin:40px 20px;">
37
+ <p>
38
+ <h2>I already have an account with MaxTraffic</h2>
39
+ <br>
40
+ <form action="<?php echo Mage::helper('adminhtml')->getUrl("adminhtml/traffic"); ?>">
41
+ <p>
42
+ <label for="email"><b>E-mail</b></label>
43
+ <input type="text" name="email" style="float:right;" value="">
44
+ </p>
45
+ <p>
46
+ <label for="password"><b>Password</b></label>
47
+ <input type="password" name="password" autocomplete="off" style="float:right;" value="">
48
+ </p>
49
+ <p>
50
+ <br>
51
+ <input type="submit" value="Login" class="button button-primary" style="cursor:pointer;padding:7px;color: #fff; border:none;background-color:#F77B08;text-shadow:none;box-shadow:0 1px 0 #C75800;-webkit-box-shadow:0 1px 0 #C75800;background-image:none;border-radius:5px;">
52
+ </p>
53
+ </form>
54
+ </p>
55
+ </div>
56
+ </div>
57
+ </div>
58
+ </div>
59
+ </div>
60
+
61
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
62
+ <script type="text/javascript">
63
+ var $m = jQuery.noConflict();
64
+ $m(document).ready(function()
65
+ {
66
+ var content = $m('.maxtraffic-wrap').html();
67
+ $m('#maxtraffic-old-content').remove();
68
+ $m('#maxtraffic-content').html(content);
69
+ });
70
+ </script>
app/code/community/Maxtraffic/WidgetTraffic/etc/adminhtml.xml CHANGED
@@ -19,11 +19,11 @@
19
  </index>
20
  <children>
21
  <login translate="title">
22
- <title>login</title>
23
  <sort_order>2</sort_order>
24
  </login>
25
  <invalid translate="title">
26
- <title>invalid</title>
27
  <sort_order>3</sort_order>
28
  </invalid>
29
  </children>
19
  </index>
20
  <children>
21
  <login translate="title">
22
+ <title>Register</title>
23
  <sort_order>2</sort_order>
24
  </login>
25
  <invalid translate="title">
26
+ <title>Logout</title>
27
  <sort_order>3</sort_order>
28
  </invalid>
29
  </children>
app/code/community/Maxtraffic/WidgetTraffic/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Maxtraffic_WidgetTraffic>
5
- <version>1.0.0</version>
6
  </Maxtraffic_WidgetTraffic>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Maxtraffic_WidgetTraffic>
5
+ <version>2.0.0</version>
6
  </Maxtraffic_WidgetTraffic>
7
  </modules>
8
  <global>
app/code/community/Maxtraffic/WidgetTraffic/sql/widgettraffic_setup/{install-1.0.0.php → install-2.0.0.php} RENAMED
@@ -8,7 +8,10 @@ $table = $installer->getConnection()->newTable($installer->getTable('maxtraffic'
8
  'primary' => true,
9
  'identity' => true,
10
  ), 'ID')
11
- ->addColumn('maxtraffic_website_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
 
 
 
12
  'nullable' => false,
13
  ), 'Maxtraffic Website ID')
14
  ->addColumn('maxtraffic_token', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
8
  'primary' => true,
9
  'identity' => true,
10
  ), 'ID')
11
+ ->addColumn('maxtraffic_user', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
12
+ 'nullable' => false,
13
+ ), 'Maxtraffic Website ID')
14
+ ->addColumn('maxtraffic_website', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
15
  'nullable' => false,
16
  ), 'Maxtraffic Website ID')
17
  ->addColumn('maxtraffic_token', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>MaxTraffic_Exit_Offers</name>
4
- <version>1.0.3</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -19,11 +19,11 @@ Supported releases:&#xD;
19
  -1.9&#xD;
20
  -1.9.1&#xD;
21
  -1.9.2</description>
22
- <notes>Version 1.0.3 - Stable release.</notes>
23
  <authors><author><name>Krisjanis Cers</name><user>MaxTraffic</user><email>krisjanis@maxtraffic.eu</email></author></authors>
24
- <date>2015-10-08</date>
25
- <time>14:01:34</time>
26
- <contents><target name="magecommunity"><dir name="Maxtraffic"><dir name="WidgetTraffic"><dir name="Helper"><file name="Data.php" hash="210b54a4ab109fb00f328f9c1ad20583"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="TrafficController.php" hash="05a5580660e85d5a3b37345d44ed009e"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="88fe9458526d5e199fece28775de7a9d"/><file name="config.xml" hash="40b15804219ba63655fc3ab8a5514e9f"/></dir><dir name="sql"><dir name="widgettraffic_setup"><file name="install-1.0.0.php" hash="53ad4da5ee4cff5937fd8aa7888b3f50"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Maxtraffic_WidgetTraffic.xml" hash="670e08b71fa3707e49eac1bae76ea728"/></dir></target></contents>
27
  <compatible/>
28
- <dependencies><required><php><min>5.2.0</min><max>5.6.0</max></php></required></dependencies>
29
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>MaxTraffic_Exit_Offers</name>
4
+ <version>2.0.0</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
19
  -1.9&#xD;
20
  -1.9.1&#xD;
21
  -1.9.2</description>
22
+ <notes>Version 2.0.0 - Stable release.</notes>
23
  <authors><author><name>Krisjanis Cers</name><user>MaxTraffic</user><email>krisjanis@maxtraffic.eu</email></author></authors>
24
+ <date>2016-05-10</date>
25
+ <time>13:38:31</time>
26
+ <contents><target name="magecommunity"><dir name="Maxtraffic"><dir name="WidgetTraffic"><dir name="Block"><file name="Welcome.php" hash="5a4004e5b4b9b632b16c3ba6be576438"/></dir><dir name="Helper"><file name="Data.php" hash="210b54a4ab109fb00f328f9c1ad20583"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="TrafficController.php" hash="d40a0bfb4f8e267c0d7669036dc70948"/><file name="redirect.php" hash="756adb596d6dc3401014853ccae46a2e"/><file name="register.php" hash="2b0233d9c6680d4b2c093adb6cf56782"/><file name="welcome.php" hash="436fed3dd2a150bf4637b777456e8915"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="b522698621b3c0083d66622e605d1ad2"/><file name="config.xml" hash="3a4741b647fe65a8041b653b6b87dec1"/></dir><dir name="sql"><dir name="widgettraffic_setup"><file name="install-2.0.0.php" hash="2203bda4e1dbea79f1eaac0beeb43722"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Maxtraffic_WidgetTraffic.xml" hash="670e08b71fa3707e49eac1bae76ea728"/></dir></target></contents>
27
  <compatible/>
28
+ <dependencies><required><php><min>5.2.0</min><max>7.0.6</max></php></required></dependencies>
29
  </package>