ProvidedOnTheProfilePage - Version 2.3.3.1

Version Notes

Minor Bug Fixes

Download this release

Release Info

Developer Karl Lillrud
Extension ProvidedOnTheProfilePage
Version 2.3.3.1
Comparing to
See all releases


Version 2.3.3.1

Files changed (86) hide show
  1. Readme.txt +10 -0
  2. app/code/community/Button/Pricelizer/controllers/IndexController.php +214 -0
  3. app/code/community/Button/Pricelizer/etc/config.xml +19 -0
  4. app/code/community/Email/Template/controllers/Adminhtml/CustomController.php +53 -0
  5. app/code/community/Email/Template/etc/adminhtml.xml +54 -0
  6. app/code/community/Email/Template/etc/config.xml +27 -0
  7. app/code/community/Greenacorn/Greenmodule/Helper/Data.php +139 -0
  8. app/code/community/Greenacorn/Greenmodule/Helper/checkcart.php +14 -0
  9. app/code/community/Greenacorn/Greenmodule/Model/Observer.php +4 -0
  10. app/code/community/Greenacorn/Greenmodule/controllers/AjaxController.php +20 -0
  11. app/code/community/Greenacorn/Greenmodule/controllers/FrontController.php +503 -0
  12. app/code/community/Greenacorn/Greenmodule/controllers/FrontmoduleController.php +13 -0
  13. app/code/community/Greenacorn/Greenmodule/controllers/IndexController.php +63 -0
  14. app/code/community/Greenacorn/Greenmodule/controllers/LicensceController.php +39 -0
  15. app/code/community/Greenacorn/Greenmodule/controllers/OnepageController.php +730 -0
  16. app/code/community/Greenacorn/Greenmodule/etc/adminhtml.xml +25 -0
  17. app/code/community/Greenacorn/Greenmodule/etc/config.xml +93 -0
  18. app/code/community/Greenacorn/Greenmodule/sql/greenmodule_setup/magento.sql~ +84 -0
  19. app/code/community/Greenacorn/Greenmodule/sql/greenmodule_setup/mysql4-install-0.1.0.php +124 -0
  20. app/code/community/Greenacorn/Greenmodule/sql/greenmodule_setup/mysql4-upgrade-0.1.0-0.1.1.php +32 -0
  21. app/code/community/Greenacorn/Greenmodule/sql/mysql4-install-0.1.0.php +132 -0
  22. app/code/community/Priceliz/Statistics/Helper/Data.php +7 -0
  23. app/code/community/Priceliz/Statistics/Model/Observer.php +0 -0
  24. app/code/community/Priceliz/Statistics/controllers/FrontController.php +205 -0
  25. app/code/community/Priceliz/Statistics/controllers/FrontsalesController.php +205 -0
  26. app/code/community/Priceliz/Statistics/controllers/IndexController.php +74 -0
  27. app/code/community/Priceliz/Statistics/etc/adminhtml.xml +38 -0
  28. app/code/community/Priceliz/Statistics/etc/config.xml +33 -0
  29. app/design/adminhtml/default/default/template/Abandoncart/abandoncart - keyur.phtml +1558 -0
  30. app/design/adminhtml/default/default/template/Abandoncart/abandoncart.phtml +1558 -0
  31. app/design/adminhtml/default/default/template/Abandoncart/email_content.phtml +1 -0
  32. app/design/adminhtml/default/default/template/Abandoncart/email_template.phtml +237 -0
  33. app/design/adminhtml/default/default/template/Abandoncart/email_template_old.phtml +210 -0
  34. app/design/adminhtml/default/default/template/Abandoncart/extension_setting.php +103 -0
  35. app/design/adminhtml/default/default/template/Abandoncart/extensionsetting.phtml +725 -0
  36. app/design/adminhtml/default/default/template/Abandoncart/gear-01.png +0 -0
  37. app/design/adminhtml/default/default/template/Abandoncart/gear-02.png +0 -0
  38. app/design/adminhtml/default/default/template/Abandoncart/gear-03.png +0 -0
  39. app/design/adminhtml/default/default/template/Abandoncart/index.php +1 -0
  40. app/design/adminhtml/default/default/template/Abandoncart/license_key.php +252 -0
  41. app/design/adminhtml/default/default/template/Abandoncart/package_setting.php +211 -0
  42. app/design/adminhtml/default/default/template/Abandoncart/pricelizer_logo.png +0 -0
  43. app/design/adminhtml/default/default/template/Abandoncart/social_media.php +15 -0
  44. app/design/adminhtml/default/default/template/Abandoncart/socialmedia.php +31 -0
  45. app/design/adminhtml/default/default/template/Abandoncart/subscribe.php +24 -0
  46. app/design/adminhtml/default/default/template/Abandoncart/unsubscribe.php +41 -0
  47. app/design/adminhtml/default/default/template/Abandoncart/userformupdate.php +42 -0
  48. app/design/adminhtml/default/default/template/custom_email_template/customtab.phtml +95 -0
  49. app/design/adminhtml/default/default/template/custom_email_template/email_content.php +54 -0
  50. app/design/adminhtml/default/default/template/custom_email_template/purchase_reminder.phtml +94 -0
  51. app/design/adminhtml/default/default/template/custom_email_template/template_setting.phtml +94 -0
  52. app/design/adminhtml/default/default/template/custom_email_template/test.php +5 -0
  53. app/design/adminhtml/default/default/template/pricelizerstatistics/non_resgistered_statistics.phtml +234 -0
  54. app/design/adminhtml/default/default/template/pricelizerstatistics/pricelizerstatistics.phtml +336 -0
  55. app/design/adminhtml/default/default/template/pricelizerstatistics/statistics_layergrapgh.phtml +193 -0
  56. app/design/adminhtml/default/default/template/pricelizerstatistics/statisticsview.phtml +252 -0
  57. app/design/frontend/base/default/layout/Greenacorn_Greenmodule.xml +10 -0
  58. app/design/frontend/base/default/template/Abandoncart/facebook.jpeg.png +0 -0
  59. app/design/frontend/base/default/template/Abandoncart/google.jpeg.png +0 -0
  60. app/design/frontend/base/default/template/Abandoncart/index.phtml +52 -0
  61. app/design/frontend/base/default/template/Abandoncart/linked.jpeg.png +0 -0
  62. app/design/frontend/base/default/template/Abandoncart/loginwithsocialmedia.phtml +150 -0
  63. app/design/frontend/base/default/template/page/html/head/head.phtml +47 -0
  64. app/design/frontend/rwd/default/template/catalog/product/productlist/list.phtml +253 -0
  65. app/design/frontend/rwd/default/template/catalog/product/view/cart/addtocart.phtml +109 -0
  66. app/etc/modules/Button_Pricelizer.xml +9 -0
  67. app/etc/modules/Email_Template.xml +9 -0
  68. app/etc/modules/Greencorn_Greenmodule.xml +9 -0
  69. app/etc/modules/Priceliz_Statistics.xml +9 -0
  70. checkcart.php +14 -0
  71. email_content.php +53 -0
  72. extension_setting.php +103 -0
  73. license_key.php +253 -0
  74. package.xml +18 -0
  75. skin/adminhtml/default/default/images/gear-01.png +0 -0
  76. skin/adminhtml/default/default/images/gear-02.png +0 -0
  77. skin/adminhtml/default/default/images/gear-03.png +0 -0
  78. skin/adminhtml/default/default/images/powered-by-pricelizer.png +0 -0
  79. skin/adminhtml/default/default/images/powered-by-pricelizer.pngold +0 -0
  80. smtp/class.phpmailer.php +3690 -0
  81. smtp/class.smtp.php +1152 -0
  82. social_media.php +15 -0
  83. socialmedia.php +31 -0
  84. subscribe.php +24 -0
  85. unsubscribe.php +41 -0
  86. userformupdate.php +41 -0
Readme.txt ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ Readme
2
+
3
+ Revalizer.com Abandoned cart solution for Magento
4
+
5
+ The package contains the extenssion that is to be installed in your Magento environment to manage and decrease the problem with abandoned carts.
6
+
7
+ The latest manual and documentation can be found online after you login to your account at Revalizer.com
8
+
9
+ For support contact us directly at support@revalizer.com or by phone at 00467 33133 600
10
+
app/code/community/Button/Pricelizer/controllers/IndexController.php ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class RestRequest
4
+ {
5
+ protected $url;
6
+ protected $verb;
7
+ protected $requestBody;
8
+ protected $requestLength;
9
+ protected $username;
10
+ protected $password;
11
+ protected $acceptType;
12
+ public $responseBody;
13
+ protected $responseInfo;
14
+ protected $contentType;
15
+
16
+ public function __construct ($url = null, $verb = 'GET', $requestBody = null)
17
+ {
18
+ $this->url = $url;
19
+ $this->verb = $verb;
20
+ $this->requestBody = $requestBody;
21
+ $this->requestLength = 0;
22
+ $this->username = null;
23
+ $this->password = null;
24
+ $this->acceptType = 'application/json';
25
+ $this->contentType = 'application/x-www-form-urlencoded';
26
+ $this->responseBody = null;
27
+ $this->responseInfo = null;
28
+
29
+ if ($this->requestBody !== null)
30
+ {
31
+ $this->buildPostBody();
32
+ }
33
+ }
34
+
35
+ public function flush ()
36
+ {
37
+ $this->requestBody = null;
38
+ $this->requestLength = 0;
39
+ $this->verb = 'GET';
40
+ $this->responseBody = null;
41
+ $this->responseInfo = null;
42
+ }
43
+
44
+ public function execute ()
45
+ {
46
+ $ch = curl_init();
47
+ $this->setAuth($ch);
48
+
49
+ try
50
+ {
51
+ switch (strtoupper($this->verb))
52
+ {
53
+ case 'GET':
54
+ $this->executeGet($ch);
55
+ break;
56
+ case 'POST':
57
+ $this->executePost($ch);
58
+ break;
59
+ case 'PUT':
60
+ $this->executePut($ch);
61
+ break;
62
+ case 'DELETE':
63
+ $this->executeDelete($ch);
64
+ break;
65
+ default:
66
+ throw new InvalidArgumentException('Current verb (' . $this->verb . ') is an invalid REST verb.');
67
+ }
68
+ }
69
+ catch (InvalidArgumentException $e)
70
+ {
71
+ curl_close($ch);
72
+ throw $e;
73
+ }
74
+ catch (Exception $e)
75
+ {
76
+ curl_close($ch);
77
+ throw $e;
78
+ }
79
+ }
80
+
81
+ public function buildPostBody ($data = null)
82
+ {
83
+ $data = ($data !== null) ? $data : $this->requestBody;
84
+
85
+ if (!is_array($data))
86
+ {
87
+ throw new InvalidArgumentException('Invalid data input for postBody. Array expected');
88
+ }
89
+
90
+ $data = http_build_query($data, '', '&');
91
+ $this->requestBody = $data;
92
+ }
93
+
94
+ protected function executeGet ($ch)
95
+ {
96
+ $this->doExecute($ch);
97
+ }
98
+
99
+ protected function executePost ($ch)
100
+ {
101
+ if (!is_string($this->requestBody))
102
+ {
103
+ $this->buildPostBody();
104
+ }
105
+
106
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $this->requestBody);
107
+ curl_setopt($ch, CURLOPT_POST, 1);
108
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: application/x-www-form-urlencoded"));
109
+
110
+ $this->doExecute($ch);
111
+ }
112
+
113
+ protected function executePut ($ch)
114
+ {
115
+ if (!is_string($this->requestBody))
116
+ {
117
+ $this->buildPostBody();
118
+ }
119
+
120
+ $this->requestLength = strlen($this->requestBody);
121
+
122
+ $fh = fopen('php://temp', 'rw+');
123
+ fwrite($fh, $this->requestBody);
124
+ rewind($fh);
125
+
126
+ curl_setopt($ch, CURLOPT_INFILE, $fh);
127
+ curl_setopt($ch, CURLOPT_INFILESIZE, $this->requestLength);
128
+ curl_setopt($ch, CURLOPT_PUT, true);
129
+
130
+ $this->doExecute($ch);
131
+
132
+ fclose($fh);
133
+ }
134
+
135
+ protected function executeDelete ($ch)
136
+ {
137
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
138
+
139
+ $this->doExecute($ch);
140
+ }
141
+
142
+ protected function doExecute (&$curlHandle)
143
+ {
144
+ $this->setCurlOpts($curlHandle);
145
+ $this->responseBody = curl_exec($curlHandle);
146
+ $this->responseInfo = curl_getinfo($curlHandle);
147
+
148
+ curl_close($curlHandle);
149
+ }
150
+
151
+ protected function setCurlOpts (&$curlHandle)
152
+ {
153
+ curl_setopt($curlHandle, CURLOPT_TIMEOUT, 10);
154
+ curl_setopt($curlHandle, CURLOPT_URL, $this->url);
155
+ curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
156
+ curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array ('Accept: ' . $this->acceptType));
157
+ curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array ('Content-Type: ' . $this->contentType));
158
+
159
+ //curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, false);
160
+ }
161
+
162
+ protected function setAuth (&$curlHandle)
163
+ {
164
+ if ($this->username !== null && $this->password !== null)
165
+ {
166
+ curl_setopt($curlHandle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
167
+ curl_setopt($curlHandle, CURLOPT_USERPWD, $this->username . ':' . $this->password);
168
+ }
169
+ }
170
+ }
171
+
172
+
173
+ class Button_Pricelizer_IndexController extends Mage_Core_Controller_Front_Action
174
+ {
175
+ public function indexAction()
176
+ {
177
+
178
+ $customer_email = $_POST['link_email'];
179
+
180
+ $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
181
+ $productid = $_POST['link_productid'];
182
+ $model = Mage::getModel('catalog/product');
183
+ $_product = $model->load($productid);
184
+ $_product->getShortDescription();
185
+ $_product->getDescription();
186
+ $productname = $_product->getName();
187
+ $productprice = $_product->getPrice();
188
+ $_product->getSpecialPrice();
189
+ $producturl=$_product->getProductUrl();
190
+ $img_url =$_product->getImageUrl();
191
+ $_product->getSmallImageUrl();
192
+ $_product->getThumbnailUrl();
193
+
194
+ $prod_arr[] = array('prod_name'=>$productname,'prod_price'=>$productprice,'prod_currency'=>$currency_code,'prod_url'=>$producturl,'prod_img_url'=> $img_url);
195
+ $url1 ="www.pricelizer.com/users/AbandonedCart/";
196
+ $another_arra = array('email'=>$customer_email,'plugin_user'=>'watchlist','cart_product' => $prod_arr);
197
+ //echo '<pre>';print_r($another_arra);
198
+ $request = new RestRequest($url1,'POST',$another_arra);
199
+ $request->execute();
200
+ $req=json_decode($request->responseBody,true);
201
+ if($req['success']=='1')
202
+ {
203
+ echo json_encode(array('message'=>$req['msg']));
204
+
205
+ }
206
+ elseif($req['success']=='0')
207
+ {
208
+ echo json_encode(array('message'=>$req['msg']));
209
+
210
+ }
211
+
212
+
213
+ }
214
+ }
app/code/community/Button/Pricelizer/etc/config.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Button_Pricelizer>
5
+ <version>0.1.0</version> <!-- Version number of your module -->
6
+ </Button_Pricelizer>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <pricelizer>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Button_Pricelizer</module>
14
+ <frontName>pricelizer</frontName>
15
+ </args>
16
+ </pricelizer>
17
+ </routers>
18
+ </frontend>
19
+ </config>
app/code/community/Email/Template/controllers/Adminhtml/CustomController.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Email_Template_Adminhtml_CustomController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ public function indexAction()
6
+ {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('email_template')
9
+ ->_title($this->__('Abandoned Email Template'));
10
+
11
+ $this->_addContent($block);
12
+ $this->_addContent($this->getLayout()->createBlock('adminhtml/template')
13
+ ->setTemplate('custom_email_template/customtab.phtml'));
14
+
15
+ $this->renderLayout();
16
+ }
17
+
18
+ public function templateSettingAction()
19
+ {
20
+
21
+ $this->loadLayout()
22
+ ->_setActiveMenu('email_template')
23
+ ->_title($this->__('Catched user Email Template '));
24
+
25
+ // my stuff
26
+ $this->_addContent($block);
27
+ $this->_addContent($this->getLayout()->createBlock('adminhtml/template')
28
+ ->setTemplate('custom_email_template/template_setting.phtml'));
29
+
30
+ $this->renderLayout();
31
+
32
+
33
+ }
34
+
35
+
36
+ public function purchaseReminderAction()
37
+ {
38
+
39
+ $this->loadLayout()
40
+ ->_setActiveMenu('email_template')
41
+ ->_title($this->__('Purchase Reminder Email Template'));
42
+
43
+ // my stuff
44
+ $this->_addContent($block);
45
+ $this->_addContent($this->getLayout()->createBlock('adminhtml/template')
46
+ ->setTemplate('custom_email_template/purchase_reminder.phtml'));
47
+
48
+ $this->renderLayout();
49
+
50
+
51
+ }
52
+
53
+ }
app/code/community/Email/Template/etc/adminhtml.xml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <menu>
4
+ <email_template module="email_template" translate="title">
5
+ <title>Abandoned Carts Email Template</title>
6
+ <sort_order>100</sort_order>
7
+ <children>
8
+ <index module="email_template" translate="title">
9
+ <title>Email Template</title>
10
+ <sort_order>1</sort_order>
11
+ <action>adminhtml/custom</action>
12
+ </index>
13
+ <catched module="email_template" translate="title">
14
+ <title>Caught user Email Template</title>
15
+ <sort_order>2</sort_order>
16
+ <action>adminhtml/custom/templateSetting</action>
17
+ </catched>
18
+
19
+ <purchase module="email_template" translate="title">
20
+ <title>Purchase Reminder Email template</title>
21
+ <sort_order>3</sort_order>
22
+ <action>adminhtml/custom/purchaseReminder</action>
23
+ </purchase>
24
+ </children>
25
+
26
+ </email_template>
27
+ </menu>
28
+ <acl>
29
+ <resources>
30
+ <admin>
31
+ <children>
32
+ <email_template translate="title" module="email_template">
33
+ <title>My Controller</title>
34
+ <sort_order>-100</sort_order>
35
+ <children>
36
+ <index translate="title">
37
+ <title>Email Template</title>
38
+ <sort_order>1</sort_order>
39
+ </index>
40
+ <list translate="title">
41
+ <title>Template Setting</title>
42
+ <sort_order>2</sort_order>
43
+ </list>
44
+ </children>
45
+ </email_template>
46
+ </children>
47
+ </admin>
48
+ </resources>
49
+ </acl>
50
+
51
+
52
+
53
+
54
+ </config>
app/code/community/Email/Template/etc/config.xml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Email_Template>
5
+ <version>1.0.0</version>
6
+ </Email_Template>
7
+ </modules>
8
+ <global>
9
+ <helpers>
10
+ <email_template>
11
+ <!-- Helper definition needed by Magento -->
12
+ <class>Mage_Core_Helper</class>
13
+ </email_template>
14
+ </helpers>
15
+ </global>
16
+ <admin>
17
+ <routers>
18
+ <adminhtml>
19
+ <args>
20
+ <modules>
21
+ <foo_bar before="Mage_Adminhtml">Email_Template_Adminhtml</foo_bar>
22
+ </modules>
23
+ </args>
24
+ </adminhtml>
25
+ </routers>
26
+ </admin>
27
+ </config>
app/code/community/Greenacorn/Greenmodule/Helper/Data.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php ob_start();
2
+ class Greenacorn_Greenmodule_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ function abandon_cart()
5
+ {
6
+ $base1_url = Mage::getBaseUrl();
7
+ ?>
8
+
9
+ <?php
10
+ $cart_qty = (int) Mage::getModel('checkout/cart')->getQuote()->getItemsQty();
11
+ if($cart_qty!=0)
12
+ {
13
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read') ;
14
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
15
+ $result = $read_data->fetchAll("select * from abandoned_extensionsetting");
16
+ if($result['0']['status']=='on')
17
+ {
18
+ $sessionCustomer = Mage::getSingleton("customer/session");
19
+ if(!$sessionCustomer->isLoggedIn()) {
20
+
21
+
22
+
23
+ $read4 = Mage::getSingleton('core/resource')->getConnection('core_read') ;
24
+ $write4 = Mage::getSingleton('core/resource')->getConnection('core_write');
25
+ $result5 = $read4->fetchAll("SELECT * FROM log_url_info where url_id ='14'");
26
+ //print_r($result5);
27
+ $base_url = $result5['0']['url'];
28
+ $cart_qty = (int) Mage::getModel('checkout/cart')->getQuote()->getItemsQty();
29
+ $modules = Mage::getConfig()->getNode('modules')->children();
30
+ $modulesArray = (array)$modules;
31
+ $resource = Mage::getSingleton('core/resource');
32
+ $readConnection = $resource->getConnection('core_read');
33
+ $query = 'SELECT * FROM ' . $resource->getTableName('Abandon_cart_licensekey');
34
+ $results = $readConnection->fetchAll($query);
35
+ $packagename = $results['0']['package_name'];
36
+ if($packagename=="LARGE"||$packagename=="MEDIUM"||$packagename=="Pro"||$packagename=="XXL"||$packagename=="Flex")
37
+ {
38
+ if(isset($modulesArray['Greenacorn_Greenmodule']))
39
+
40
+ {
41
+
42
+ if($cart_qty!=0) {
43
+
44
+ } else { echo ' ';}
45
+ }
46
+ else
47
+ {
48
+ echo 'Module does not exist';
49
+ }
50
+
51
+ ?>
52
+
53
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
54
+
55
+ <script>
56
+
57
+ var isOk = false;
58
+ var isFirst = false;
59
+ window.onload=function(){
60
+ window.onbeforeunload = function(e) {
61
+ isOk=true;
62
+ if(!isFirst)
63
+ return 'You have product(s) in your cart that will be deleted if you leave this site. Do you want us to alert you if the price drop on any of the products in your cart?Click stay on the page to let us guide you!?';
64
+
65
+ else
66
+ return false;
67
+ };
68
+
69
+ };
70
+ jQuery( document ).ready(function() {
71
+ jQuery("body").click(function() {
72
+ window.onbeforeunload = null;
73
+ });
74
+ jQuery( "button" )
75
+ .on("mouseenter", function() {
76
+ window.onbeforeunload = null;
77
+ });
78
+ });
79
+
80
+ setInterval(function () {
81
+ if(isOk==true)
82
+ {
83
+ isOk=false;
84
+ isFirst= true;
85
+ window.onbeforeunload = null;
86
+ var cart = <?php echo $cart_qty; ?>;
87
+
88
+ jQuery.ajax({
89
+ url:"/checkcart.php",
90
+ type:'POST',
91
+ data:'cart='+cart,
92
+ success:function(results)
93
+ {
94
+ if(results != 'no')
95
+ {
96
+ window.location.href='<?php echo $base1_url; ?>abandon/frontmodule/autoLogin';
97
+
98
+ }
99
+ }
100
+ });
101
+ }
102
+ },1000);
103
+ </script>
104
+
105
+ <?php
106
+ }
107
+ }
108
+
109
+
110
+ }
111
+
112
+ }
113
+
114
+
115
+ }//------------End funcion--------------------------//
116
+
117
+ function dbconnection()
118
+ {
119
+
120
+ //-------------------------------DB Connection------------------------------------------------//
121
+ $config = Mage::getConfig()->getResourceConnectionConfig("default_setup");
122
+ $_host = $config->host;
123
+ $_uname = $config->username;
124
+ $_pass = $config->password;
125
+ $_dbname = $config->dbname;
126
+ $_host; ///likewise
127
+ $db_handle = mysql_connect($_host , $_uname, $_pass);
128
+ $db_found = mysql_select_db($_dbname, $db_handle);
129
+ //-------------------------------End DB Connection------------------------------------------------//
130
+
131
+ }
132
+
133
+ function find_mage()
134
+ {
135
+ echo $url = Mage::getBaseDir('app').'/Mage.php';
136
+
137
+ }
138
+ }//------------End main helper class--------------------------//
139
+ ob_end_flush();?>
app/code/community/Greenacorn/Greenmodule/Helper/checkcart.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $cart = $_POST['cart'];
3
+
4
+ if($cart !=0)
5
+ {
6
+ $val = 'yes';
7
+ }
8
+ else
9
+ {
10
+ $val ='no';
11
+ }
12
+
13
+ echo $val;
14
+ ?>
app/code/community/Greenacorn/Greenmodule/Model/Observer.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+
3
+
4
+ ?>
app/code/community/Greenacorn/Greenmodule/controllers/AjaxController.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Greenacorn_Greenmodule_AjaxController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function callAjaxAction()
5
+ {
6
+ $this->loadLayout()
7
+ ->_setActiveMenu('green_menu')
8
+ ->_title($this->__('Call Ajax'));
9
+
10
+ // my stuff
11
+ $this->_addContent($block);
12
+ $this->_addContent($this->getLayout()->createBlock('adminhtml/template')
13
+ ->setTemplate('Abandoncart/extension_setting.php'));
14
+
15
+ $this->renderLayout();
16
+
17
+ }
18
+
19
+ }
20
+ ?>
app/code/community/Greenacorn/Greenmodule/controllers/FrontController.php ADDED
@@ -0,0 +1,503 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //-------------------------------DB Connection------------------------------------------------//
3
+ $config = Mage::getConfig()->getResourceConnectionConfig("default_setup");
4
+ $_host = $config->host;
5
+ $_uname = $config->username;
6
+ $_pass = $config->password;
7
+ $_dbname = $config->dbname;
8
+ $_host; ///likewise
9
+ $db_handle = mysql_connect($_host , $_uname, $_pass);
10
+ $db_found = mysql_select_db($_dbname, $db_handle);
11
+ $smtp = Mage::getBaseDir().'/smtp/newsmtp/classes/class.phpmailer.php';
12
+ include($smtp);
13
+ //-------------------------------End DB Connection------------------------------------------------//
14
+
15
+ class RestRequest
16
+ {
17
+ protected $url;
18
+ protected $verb;
19
+ protected $requestBody;
20
+ protected $requestLength;
21
+ protected $username;
22
+ protected $password;
23
+ protected $acceptType;
24
+ public $responseBody;
25
+ protected $responseInfo;
26
+ protected $contentType;
27
+
28
+ public function __construct ($url = null, $verb = 'GET', $requestBody = null)
29
+ {
30
+ $this->url = $url;
31
+ $this->verb = $verb;
32
+ $this->requestBody = $requestBody;
33
+ $this->requestLength = 0;
34
+ $this->username = null;
35
+ $this->password = null;
36
+ $this->acceptType = 'application/json';
37
+ $this->contentType = 'application/x-www-form-urlencoded';
38
+ $this->responseBody = null;
39
+ $this->responseInfo = null;
40
+
41
+ if ($this->requestBody !== null)
42
+ {
43
+ $this->buildPostBody();
44
+ }
45
+ }
46
+
47
+ public function flush ()
48
+ {
49
+ $this->requestBody = null;
50
+ $this->requestLength = 0;
51
+ $this->verb = 'GET';
52
+ $this->responseBody = null;
53
+ $this->responseInfo = null;
54
+ }
55
+
56
+ public function execute ()
57
+ {
58
+ $ch = curl_init();
59
+ $this->setAuth($ch);
60
+
61
+ try
62
+ {
63
+ switch (strtoupper($this->verb))
64
+ {
65
+ case 'GET':
66
+ $this->executeGet($ch);
67
+ break;
68
+ case 'POST':
69
+ $this->executePost($ch);
70
+ break;
71
+ case 'PUT':
72
+ $this->executePut($ch);
73
+ break;
74
+ case 'DELETE':
75
+ $this->executeDelete($ch);
76
+ break;
77
+ default:
78
+ throw new InvalidArgumentException('Current verb (' . $this->verb . ') is an invalid REST verb.');
79
+ }
80
+ }
81
+ catch (InvalidArgumentException $e)
82
+ {
83
+ curl_close($ch);
84
+ throw $e;
85
+ }
86
+ catch (Exception $e)
87
+ {
88
+ curl_close($ch);
89
+ throw $e;
90
+ }
91
+ }
92
+
93
+ public function buildPostBody ($data = null)
94
+ {
95
+ $data = ($data !== null) ? $data : $this->requestBody;
96
+
97
+ if (!is_array($data))
98
+ {
99
+ throw new InvalidArgumentException('Invalid data input for postBody. Array expected');
100
+ }
101
+
102
+ $data = http_build_query($data, '', '&');
103
+ $this->requestBody = $data;
104
+ }
105
+
106
+ protected function executeGet ($ch)
107
+ {
108
+ $this->doExecute($ch);
109
+ }
110
+
111
+ protected function executePost ($ch)
112
+ {
113
+ if (!is_string($this->requestBody))
114
+ {
115
+ $this->buildPostBody();
116
+ }
117
+
118
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $this->requestBody);
119
+ curl_setopt($ch, CURLOPT_POST, 1);
120
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: application/x-www-form-urlencoded"));
121
+
122
+ $this->doExecute($ch);
123
+ }
124
+
125
+ protected function executePut ($ch)
126
+ {
127
+ if (!is_string($this->requestBody))
128
+ {
129
+ $this->buildPostBody();
130
+ }
131
+
132
+ $this->requestLength = strlen($this->requestBody);
133
+
134
+ $fh = fopen('php://temp', 'rw+');
135
+ fwrite($fh, $this->requestBody);
136
+ rewind($fh);
137
+
138
+ curl_setopt($ch, CURLOPT_INFILE, $fh);
139
+ curl_setopt($ch, CURLOPT_INFILESIZE, $this->requestLength);
140
+ curl_setopt($ch, CURLOPT_PUT, true);
141
+
142
+ $this->doExecute($ch);
143
+
144
+ fclose($fh);
145
+ }
146
+
147
+ protected function executeDelete ($ch)
148
+ {
149
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
150
+
151
+ $this->doExecute($ch);
152
+ }
153
+
154
+ protected function doExecute (&$curlHandle)
155
+ {
156
+ $this->setCurlOpts($curlHandle);
157
+ $this->responseBody = curl_exec($curlHandle);
158
+ $this->responseInfo = curl_getinfo($curlHandle);
159
+
160
+ curl_close($curlHandle);
161
+ }
162
+
163
+ protected function setCurlOpts (&$curlHandle)
164
+ {
165
+ curl_setopt($curlHandle, CURLOPT_TIMEOUT, 10);
166
+ curl_setopt($curlHandle, CURLOPT_URL, $this->url);
167
+ curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
168
+ curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array ('Accept: ' . $this->acceptType));
169
+ curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array ('Content-Type: ' . $this->contentType));
170
+
171
+ //curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, false);
172
+ }
173
+
174
+ protected function setAuth (&$curlHandle)
175
+ {
176
+ if ($this->username !== null && $this->password !== null)
177
+ {
178
+ curl_setopt($curlHandle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
179
+ curl_setopt($curlHandle, CURLOPT_USERPWD, $this->username . ':' . $this->password);
180
+ }
181
+ }
182
+ }
183
+
184
+ class Greenacorn_Greenmodule_FrontController extends Mage_Core_Controller_Front_Action
185
+ {
186
+ public function maildataAction()
187
+ {
188
+ //-------------------------------DB Connection------------------------------------------------//
189
+ $config = Mage::getConfig()->getResourceConnectionConfig("default_setup");
190
+ $_host = $config->host;
191
+ $_uname = $config->username;
192
+ $_pass = $config->password;
193
+ $_dbname = $config->dbname;
194
+ $_host; ///likewise
195
+ $db_handle = mysql_connect($_host , $_uname, $_pass);
196
+ $db_found = mysql_select_db($_dbname, $db_handle);
197
+ //-------------------------------End DB Connection------------------------------------------------//
198
+ Mage::getBaseUrl();
199
+ $read1 = Mage::getSingleton('core/resource')->getConnection('core_read') ;
200
+ $write1 = Mage::getSingleton('core/resource')->getConnection('core_write');
201
+
202
+ $config = Mage::getConfig()->getResourceConnectionConfig("default_setup");
203
+ $_host = $config->host;
204
+ $_uname = $config->username;
205
+ $_pass = $config->password;
206
+ $_dbname = $config->dbname;
207
+ $_host; ///likewise
208
+ $db_handle = mysql_connect($_host , $_uname, $_pass);
209
+ $db_found = mysql_select_db($_dbname, $db_handle);
210
+
211
+ $url ="http://www.pricelizer.com/users/AbandonedCart/";
212
+ $select_query = mysql_query('select sales_flat_quote.created_at,sales_flat_quote.items_qty,sales_flat_quote.entity_id,
213
+ sales_flat_quote.base_currency_code,sales_flat_quote.grand_total,sales_flat_quote.customer_email,sales_flat_quote.customer_firstname
214
+ ,sales_flat_quote_item.name ,sales_flat_quote_item.quote_id,sales_flat_quote_item.product_id,sales_flat_quote_item.price from sales_flat_quote_item INNER JOIN sales_flat_quote ON sales_flat_quote.entity_id = sales_flat_quote_item.quote_id where sales_flat_quote.entity_id ="'.$_GET['entity_id'].'" AND sales_flat_quote_item.quote_id ="'.$_GET['entity_id'].'" ');
215
+
216
+ $i=0;
217
+ $abandon_arr = array();
218
+ while($row = mysql_fetch_array($select_query))
219
+ {
220
+
221
+
222
+ if($i==0)
223
+ {
224
+ $abandon_arr['email']=$row['customer_email'];
225
+ }
226
+
227
+
228
+ $log_url ="SELECT * FROM log_url_info where url_id ='14'";
229
+
230
+ $log_exc = mysql_query($log_url);
231
+ $exc = mysql_fetch_row($log_exc);
232
+ $exc['1'];
233
+ $get_url_query = "SELECT DISTINCT value from catalog_product_entity_varchar where attribute_id ='85' AND entity_id ='".$row['product_id']."'";
234
+ $exe_get = mysql_query($get_url_query);
235
+ $pr_url = mysql_fetch_row($exe_get);
236
+
237
+ $exc['1'].'media/catalog/product'.$pr_url['0'];
238
+ $get_url_query1 = "SELECT DISTINCT value from catalog_product_entity_varchar where attribute_id ='98' AND entity_id ='".$row['product_id']."'";
239
+ $exe_get1 = mysql_query($get_url_query1);
240
+ $pr_url1= mysql_fetch_row($exe_get1);
241
+
242
+ //print_r($pr_url1);
243
+ echo '<br>';
244
+ $exc['1'].'index.php/'.$pr_url1['0'];
245
+ $_GET['item_id'];
246
+
247
+ $explode_item_id = explode(',',$_GET['item_id']);
248
+
249
+ foreach($explode_item_id as $items_id)
250
+ {
251
+ $select_abandon = "select * from Abandon_added_product where added_user_id ='".$_GET['customer_id']."' AND added_prod_id='".$items_id."'";
252
+ $exc_abandon = mysql_query($select_abandon);
253
+ $fetch_abandon_cart = mysql_fetch_array($exc_abandon);
254
+
255
+ if(mysql_num_rows($exc_abandon)>0)
256
+ {
257
+
258
+ $update_abandon = "update Abandon_added_product set abandon_email_status ='0' where added_prod_id='".$items_id."'";
259
+ $exc_update = mysql_query($update_abandon);
260
+ }
261
+ else
262
+ {
263
+
264
+ $insert_abandon = "insert into Abandon_added_product (added_user_id,added_prod_id,added_entity_id,abandon_email_status ) values ('".$_GET['customer_id']."','".$items_id."','".$_GET['entity_id']."','0')";
265
+ $exc_insert_abandon = mysql_query($insert_abandon);
266
+
267
+ }
268
+
269
+ }
270
+
271
+ $prod_arr[] = array('prod_name'=>$row['name'],'prod_price'=>$row['price'],'prod_currency'=>$row['base_currency_code'],'prod_url'=>$exc['1'].'index.php/'.$pr_url1['0'],'prod_img_url'=>$exc['1'].'media/catalog/product'.$pr_url['0']);
272
+
273
+ $i++;
274
+
275
+ }
276
+
277
+ $abandon_arr['plugin_user']='abandoned';
278
+ $abandon_arr['liscence_key']='';
279
+
280
+ $abandon_arr['cart_product']=$prod_arr;
281
+ $decode_data = $abandon_arr;
282
+ $request = new RestRequest($url,'POST',$decode_data);
283
+ $request->execute();
284
+ $req=json_decode($request->responseBody,true);
285
+ echo '<input type="hidden" id="red_url" value="'.$req["url"].'">';
286
+ if($req['success']=='1')
287
+ {
288
+ ?>
289
+ <script>
290
+ var val_data = document.getElementById("red_url").value;
291
+ window.location = val_data;
292
+ </script>
293
+ <?php
294
+ }
295
+ elseif($req['success']=='0')
296
+ {
297
+ ?>
298
+ <script>
299
+ alert('<?php echo $req['msg']; ?>');
300
+ </script>
301
+ <?php
302
+ }
303
+ }
304
+
305
+
306
+
307
+
308
+ public function guestuserAction()
309
+ {
310
+ $CartSession = Mage::getSingleton('checkout/session');
311
+ $cart_product=array();
312
+
313
+ foreach($CartSession->getQuote()->getAllItems() as $key=>$item)
314
+ {
315
+
316
+ $product_id = $item->getProductId();
317
+ $product_name = $item->getName();
318
+ $cart_product[$key]['prod_name'] =$product_name;
319
+ $productExPrice = $item->getPrice(); // price excluding tax
320
+ $cart_product[$key]['prod_price'] = $productExPrice;
321
+ $productIncPrice = $item->getPriceInclTax(); // price excluding tax
322
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
323
+ $productMediaConfig = Mage::getModel('catalog/product_media_config');
324
+ $cart_product[$key]['prod_img_url'] =$productMediaConfig->getMediaUrl($product->getthumbnail());
325
+
326
+ $my_product_url = $product->getProductUrl($item->getProductId());
327
+ $cart_product[$key]['prod_url'] = $my_product_url;
328
+ $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
329
+ $cart_product[$key]['prod_currency'] = $currency_code;
330
+ $item_name .= $product_name;
331
+ $item_url .= $my_product_url;
332
+ $img_url .= $productMediaConfig->getMediaUrl($product->getthumbnail());
333
+ $pr_name[] = $product_name;
334
+ }
335
+ $item_name_pr = implode('<br>',$pr_name);
336
+ $logo_src = Mage::getDesign()->getSkinUrl('images/',array('_area'=>'frontend/rwd'));
337
+ $remove_base = $logo_src.'logo.gif';
338
+ $logo_url_data = str_replace('/base','',$remove_base);
339
+ $logo_url = '<img src="'.$logo_url_data.'">';
340
+ $site_url = Mage::getBaseUrl();
341
+ Mage::app()->getStore()->getName();
342
+ $email = $_GET['user_email'];
343
+ $mail = new PHPMailer; // call the class
344
+ $mail->IsSMTP();
345
+ $mail->SMTPSecure = "";
346
+ //$mail->SMTPDebug = 2;
347
+ $mail->Host = 'ssl://smtpout.asia.secureserver.net'; // platinum.waxspace.com Hostname of the mail server
348
+ $mail->Port = '465'; //Port of the SMTP like to be 25, 80, 465 or 587
349
+ $mail->SMTPAuth = true; //Whether to use SMTP authentication
350
+ $mail->Username = 'bugs@webenturetech.com';
351
+ $mail->Password = 'bugs@123'; //Password for SMTP authentication
352
+ //$mail->AddReplyTo("admin@quiconnaitunbon.com.com", "Admin"); //reply-to address
353
+ $mail->SetFrom("karl.lillrud@maneer.se"); //From address of the mail
354
+ //$mail->SMTPSecure = "tls";
355
+ // put your while loop here like below,
356
+
357
+ //sending link
358
+ $link = "".$base_url."greenmodule/front/maildata/".'?entity_id='.$_GET['entity_id'].'&customer_id='.$_GET['customer_id'].'&item_id='.$_GET['item_id'];
359
+ $cur_date = date("l d F ");
360
+ $customer_id =$_GET['customer_id']; // set this to the ID of the customer.
361
+ $customer_data = Mage::getModel('customer/customer')->load($customer_id);
362
+ $customer_name = $customer_data['firstname'];
363
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read') ;
364
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
365
+ $abandon_days = $read->fetchall("select * from abandon_cart");
366
+ $alert_days = $abandon_days['0']['day'];
367
+ $getemaildata = $read->fetchall("select * from abandon_email_template");
368
+ $firstname = "FIRSTNAME";
369
+ $site_url = "PRODUCTNAME";
370
+ $xdays = "XDAYSFROMSETTINGS";
371
+ $unsubscribe_key = "UNSUBSCRIBE";
372
+ $date_data = "DATE";
373
+ $culogo = "CULOGO";
374
+ $unsubs_url_key = $base_url.'greenmodule/front/unsub/?unsubs='.$_GET['customer_id'];
375
+ $pstring = $getemaildata['1']['email_conetnt'];
376
+ $modifieddata = str_replace($firstname,$email,$pstring);
377
+ $modifieddata1 = str_replace($site_url,$item_name_pr,$modifieddata);
378
+ $modifieddata3 = str_replace($xdays,$alert_days,$modifieddata1);
379
+ $modified_data1 = str_replace($date_data,$cur_date,$modifieddata3);
380
+ $modified_logo = str_replace($culogo,$logo_url,$modified_data1);
381
+ $modifieddata4 = str_replace($unsubscribe_key,$unsubs_url_key,$modified_logo);
382
+ $facebook = "FACEBOOK";
383
+ $linkedin = "LINKEDIN";
384
+ $twitter = "TWITTER";
385
+ $google = "GOOGLE";
386
+ $simple_signup = '1CLICKSIGNUP';
387
+ $pricelizerlink = 'PRICELIZERLOGO';
388
+ $flink = "FLINK";
389
+ //$sitelogo = 'PRICELIZERLOGO';
390
+ //$facebook_key = "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/facebook.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
391
+ //$twitter_key = "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/tweet.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
392
+ //$linkedin_key = $message .= "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/linked.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
393
+ //$google_key = "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/google.jpeg.png' style='width:24px; height:24px; margin-right:0px;' ></a></td></tr>";
394
+ $signup_url = "<a href =".$link.">1-Click Signup</a>";
395
+ //$signup_url = "<button type='button' onclick = 'window.location.href=".$link."'>1-Click Sign Up</button>";
396
+ $pricelizer_link = "<a href ='http://www.pricelizer.com'><img src ='http://www.pricelizer.com/img/pricelizer_logo.png' style='width:175px; height:auto; margin-right:0px;' ></a>";
397
+ $flink_url = "<a style='color:#989898;margin-left:10px; text-decoration:none;' href='http://www.pricelizer.com'>Powered by Pricelizer</a>";
398
+ $modifieddata5 = str_replace($facebook,$facebook_key,$modifieddata4);
399
+ $modifieddata6 = str_replace($linkedin,$linkedin_key,$modifieddata5);
400
+ $modifieddata7 = str_replace($twitter,$twitter_key,$modifieddata6);
401
+ $signup_button = str_replace($google, $google_key,$modifieddata7);
402
+ $pricelizer_logo_link = str_replace($simple_signup,$signup_url,$signup_button);
403
+ $footer_link = str_replace($flink,$flink_url,$pricelizer_logo_link);
404
+ $modifieddata2 = str_replace($pricelizerlink,$pricelizer_link,$footer_link);
405
+ $mail->Subject = "Abandoned Cart Alert"; //Subject od your mail
406
+ $mail->AddAddress($email, "fghgfhgfh"); //To address who will receive this email
407
+
408
+ //$to = "ajay010791@gmail.com";
409
+ //$subject = "Abandon Cart Alert";
410
+ $headers = "From: Cart reminder";
411
+ $headers .= "Reply-To: ". ($to) . "\r\n";
412
+ $headers .= "CC: ajay.singh@webeneturetech.com";
413
+ $headers = "MIME-Version: 1.0" . PHP_EOL;
414
+ $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
415
+ $message = '<html><body>';
416
+ $message .= '<table rules="all" cellpadding="10" border="0" >';
417
+
418
+ $unsuburl = "<a href ='".$unsubs_url_key."'><span style='color:#999'>click here</span></a>";
419
+ $message .= "</body></html>";
420
+ $unsubs ="UNCLICK";
421
+ $entire_content = str_replace($unsubs,$unsuburl,$modifieddata2);
422
+ $message .= $entire_content;
423
+
424
+ $mail->MsgHTML($message); //Put your body of the message you can place html code here
425
+ $send = $mail->Send(); //Send the mails
426
+
427
+ if($send){
428
+ echo "send";
429
+ }
430
+
431
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read') ;
432
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
433
+ $result10 = $read_data->fetchAll("select * from Abandon_cart_licensekey");
434
+ $registered_user_email = $result10['0']['user_email'];
435
+ $registered_user_license_key = $result10['0']['license_key'];
436
+ //print_r($result10);
437
+
438
+ $prod_arr[] = array('prod_name'=>$product_name,'prod_price'=>$productExPrice,'prod_currency'=>$currency_code,'prod_url'=>$my_product_url,'prod_img_url'=>$productMediaConfig->getMediaUrl($product->getthumbnail()));
439
+
440
+ $url1 ="http://www.pricelizer.com/users/AbandonedCart/";
441
+ $prod_arr= array('email'=>$_GET['user_email'],'plugin_user'=>'catched','liscence_key'=>$registered_user_license_key,'user_id'=>$_GET['user_id'],'social'=>$_GET['social'],'cart_product'=>$prod_arr);
442
+ //echo '<pre>';print_r($prod_arr);
443
+ //die;
444
+ $request = new RestRequest($url1,'POST',$prod_arr);
445
+ //echo '<pre>';print_r($request);
446
+ $request->execute();
447
+ $config = Mage::getConfig()->getResourceConnectionConfig("default_setup");
448
+
449
+ $req=json_decode($request->responseBody,true);
450
+ echo '<pre>'; print_r($req);
451
+
452
+ echo '<input type="hidden" id="red_url1" value="'.$req["url"].'">';
453
+
454
+ if($req['success']=='1')
455
+ {
456
+ ?>
457
+ <script>
458
+ var val_data = document.getElementById("red_url1").value;
459
+ window.location = val_data;
460
+ </script>
461
+ <?php
462
+ }
463
+ elseif($req['success']=='0')
464
+ {
465
+ ?>
466
+ <script>
467
+ alert('<?php echo $req['msg']; ?>');
468
+ </script>
469
+ <?php
470
+ }
471
+
472
+ }
473
+
474
+ public function unsubAction()
475
+
476
+ {
477
+ $get_val = $_GET['unsubs'];
478
+
479
+ $update_abandon = "update Abandoned_email_subscription set subscribe_status ='no' where customer_id='".$get_val."'";
480
+ $exc_update = mysql_query($update_abandon);
481
+ if( $exc_update)
482
+ {
483
+ echo 'success';
484
+ ?>
485
+ <script>
486
+ alert('You have successfully Unsubscribed');
487
+ window.location.href = "http://magento.pricelizer.com";
488
+
489
+ </script>
490
+
491
+ <?php
492
+ }
493
+ else
494
+ {
495
+ echo 'failed';
496
+ }
497
+
498
+ }
499
+
500
+
501
+
502
+ }
503
+ ?>
app/code/community/Greenacorn/Greenmodule/controllers/FrontmoduleController.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Greenacorn_Greenmodule_FrontmoduleController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function autoLoginAction()
5
+ {
6
+ $templatePath = 'Abandoncart/loginwithsocialmedia.phtml';
7
+ echo $output = Mage::app()->getLayout()->createBlock("core/template")->setData('area','frontend')->setTemplate($templatePath)->toHtml();
8
+
9
+ }
10
+
11
+ }
12
+
13
+
app/code/community/Greenacorn/Greenmodule/controllers/IndexController.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Greenacorn_Greenmodule_IndexController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+
5
+
6
+ public function abandonedCartAction()
7
+
8
+ {
9
+
10
+ $this->loadLayout()
11
+ ->_setActiveMenu('green_menu')
12
+ ->_title($this->__('Abandoned Cart'));
13
+
14
+ // my stuff
15
+ $this->_addContent($block);
16
+ $this->_addContent($this->getLayout()->createBlock('adminhtml/template')
17
+ ->setTemplate('Abandoncart/abandoncart.phtml'));
18
+
19
+ $this->renderLayout();
20
+
21
+ }
22
+
23
+ public function extensionSettingAction()
24
+
25
+ {
26
+
27
+ $this->loadLayout()
28
+ ->_setActiveMenu('green_menu')
29
+ ->_title($this->__('Extension Setting'));
30
+
31
+ // my stuff
32
+ $this->_addContent($block);
33
+ $this->_addContent($this->getLayout()->createBlock('adminhtml/template')
34
+ ->setTemplate('Abandoncart/extensionsetting.phtml'));
35
+
36
+ $this->renderLayout();
37
+
38
+
39
+
40
+ }
41
+
42
+ public function emailTemplateAction()
43
+ {
44
+
45
+ $this->loadLayout()
46
+ ->_setActiveMenu('green_menu')
47
+ ->_title($this->__('Email Template'));
48
+
49
+ // my stuff
50
+ $this->_addContent($block);
51
+ $this->_addContent($this->getLayout()->createBlock('adminhtml/template')
52
+ ->setTemplate('Abandoncart/email_template.phtml'));
53
+
54
+ $this->renderLayout();
55
+
56
+
57
+ }
58
+
59
+
60
+ }
61
+
62
+
63
+
app/code/community/Greenacorn/Greenmodule/controllers/LicensceController.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Pricelizer_Module_LicensceController extends Mage_Core_Controller_Front_Action
3
+ {
4
+
5
+ public function licensceAction()
6
+ {
7
+ $config = Mage::getConfig()->getResourceConnectionConfig("default_setup");
8
+ $_host = $config->host;
9
+ $_uname = $config->username;
10
+ $_pass = $config->password;
11
+ $_dbname = $config->dbname;
12
+ echo $_host; ///likewise
13
+ $this->loadLayout();
14
+
15
+ echo $this->_addContent($block);
16
+ echo $this->_addContent($this->getLayout()->createBlock('adminhtml/template')
17
+ ->setTemplate('Abandoncart/abandoncart.phtml'));
18
+
19
+
20
+ $this->_setActiveMenu('green_menu')->renderLayout();
21
+
22
+ }
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+ }
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+ ?>
app/code/community/Greenacorn/Greenmodule/controllers/OnepageController.php ADDED
@@ -0,0 +1,730 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Checkout
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Onepage controller for checkout
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Checkout
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+
35
+ require_once(Mage::getModuleDir('controllers','Mage_Checkout').DS.'OnepageController.php');
36
+ class Greenacorn_Greenmodule_OnepageController extends Mage_Checkout_OnepageController
37
+ {
38
+ /**
39
+ * List of functions for section update
40
+ *
41
+ * @var array
42
+ */
43
+ protected $_sectionUpdateFunctions = array(
44
+ 'payment-method' => '_getPaymentMethodsHtml',
45
+ 'shipping-method' => '_getShippingMethodsHtml',
46
+ 'review' => '_getReviewHtml',
47
+ );
48
+
49
+ /**
50
+ * @var Mage_Sales_Model_Order
51
+ */
52
+ protected $_order;
53
+
54
+ /**
55
+ * Predispatch: should set layout area
56
+ *
57
+ * @return Mage_Checkout_OnepageController
58
+ */
59
+ public function preDispatch()
60
+ {
61
+ parent::preDispatch();
62
+ $this->_preDispatchValidateCustomer();
63
+
64
+ $checkoutSessionQuote = Mage::getSingleton('checkout/session')->getQuote();
65
+ if ($checkoutSessionQuote->getIsMultiShipping()) {
66
+ $checkoutSessionQuote->setIsMultiShipping(false);
67
+ $checkoutSessionQuote->removeAllAddresses();
68
+ }
69
+
70
+ if (!$this->_canShowForUnregisteredUsers()) {
71
+ $this->norouteAction();
72
+ $this->setFlag('',self::FLAG_NO_DISPATCH,true);
73
+ return;
74
+ }
75
+
76
+ return $this;
77
+ }
78
+
79
+ /**
80
+ * Send Ajax redirect response
81
+ *
82
+ * @return Mage_Checkout_OnepageController
83
+ */
84
+ protected function _ajaxRedirectResponse()
85
+ {
86
+ $this->getResponse()
87
+ ->setHeader('HTTP/1.1', '403 Session Expired')
88
+ ->setHeader('Login-Required', 'true')
89
+ ->sendResponse();
90
+ return $this;
91
+ }
92
+
93
+ /**
94
+ * Validate ajax request and redirect on failure
95
+ *
96
+ * @return bool
97
+ */
98
+ protected function _expireAjax()
99
+ {
100
+ if (!$this->getOnepage()->getQuote()->hasItems()
101
+ || $this->getOnepage()->getQuote()->getHasError()
102
+ || $this->getOnepage()->getQuote()->getIsMultiShipping()
103
+ ) {
104
+ $this->_ajaxRedirectResponse();
105
+ return true;
106
+ }
107
+ $action = $this->getRequest()->getActionName();
108
+ if (Mage::getSingleton('checkout/session')->getCartWasUpdated(true)
109
+ && !in_array($action, array('index', 'progress'))
110
+ ) {
111
+ $this->_ajaxRedirectResponse();
112
+ return true;
113
+ }
114
+ return false;
115
+ }
116
+
117
+ /**
118
+ * Get shipping method step html
119
+ *
120
+ * @return string
121
+ */
122
+ protected function _getShippingMethodsHtml()
123
+ {
124
+ $layout = $this->getLayout();
125
+ $update = $layout->getUpdate();
126
+ $update->load('checkout_onepage_shippingmethod');
127
+ $layout->generateXml();
128
+ $layout->generateBlocks();
129
+ $output = $layout->getOutput();
130
+ return $output;
131
+ }
132
+
133
+ /**
134
+ * Get payment method step html
135
+ *
136
+ * @return string
137
+ */
138
+ protected function _getPaymentMethodsHtml()
139
+ {
140
+ $layout = $this->getLayout();
141
+ $update = $layout->getUpdate();
142
+ $update->load('checkout_onepage_paymentmethod');
143
+ $layout->generateXml();
144
+ $layout->generateBlocks();
145
+ $output = $layout->getOutput();
146
+ return $output;
147
+ }
148
+
149
+ /**
150
+ * Return block content from the 'checkout_onepage_additional'
151
+ * This is the additional content for shipping method
152
+ *
153
+ * @return string
154
+ */
155
+ protected function _getAdditionalHtml()
156
+ {
157
+ $layout = $this->getLayout();
158
+ $update = $layout->getUpdate();
159
+ $update->load('checkout_onepage_additional');
160
+ $layout->generateXml();
161
+ $layout->generateBlocks();
162
+ $output = $layout->getOutput();
163
+ Mage::getSingleton('core/translate_inline')->processResponseBody($output);
164
+ return $output;
165
+ }
166
+
167
+ /**
168
+ * Get order review step html
169
+ *
170
+ * @return string
171
+ */
172
+ protected function _getReviewHtml()
173
+ {
174
+ return $this->getLayout()->getBlock('root')->toHtml();
175
+ }
176
+
177
+ /**
178
+ * Get one page checkout model
179
+ *
180
+ * @return Mage_Checkout_Model_Type_Onepage
181
+ */
182
+ public function getOnepage()
183
+ {
184
+ return Mage::getSingleton('checkout/type_onepage');
185
+ }
186
+
187
+ /**
188
+ * Checkout page
189
+ */
190
+ public function indexAction()
191
+ {
192
+ if (!Mage::helper('checkout')->canOnepageCheckout()) {
193
+ Mage::getSingleton('checkout/session')->addError($this->__('The onepage checkout is disabled.'));
194
+ $this->_redirect('checkout/cart');
195
+ return;
196
+ }
197
+ $quote = $this->getOnepage()->getQuote();
198
+ if (!$quote->hasItems() || $quote->getHasError()) {
199
+ $this->_redirect('checkout/cart');
200
+ return;
201
+ }
202
+ if (!$quote->validateMinimumAmount()) {
203
+ $error = Mage::getStoreConfig('sales/minimum_order/error_message') ?
204
+ Mage::getStoreConfig('sales/minimum_order/error_message') :
205
+ Mage::helper('checkout')->__('Subtotal must exceed minimum order amount');
206
+
207
+ Mage::getSingleton('checkout/session')->addError($error);
208
+ $this->_redirect('checkout/cart');
209
+ return;
210
+ }
211
+ Mage::getSingleton('checkout/session')->setCartWasUpdated(false);
212
+ Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::getUrl('*/*/*', array('_secure' => true)));
213
+ $this->getOnepage()->initCheckout();
214
+ $this->loadLayout();
215
+ $this->_initLayoutMessages('customer/session');
216
+ $this->getLayout()->getBlock('head')->setTitle($this->__('Checkout'));
217
+ $this->renderLayout();
218
+ }
219
+
220
+ /**
221
+ * Refreshes the previous step
222
+ * Loads the block corresponding to the current step and sets it
223
+ * in to the response body
224
+ *
225
+ * This function is called from the reloadProgessBlock
226
+ * function from the javascript
227
+ *
228
+ * @return string|null
229
+ */
230
+ public function progressAction()
231
+ {
232
+ // previous step should never be null. We always start with billing and go forward
233
+ $prevStep = $this->getRequest()->getParam('prevStep', false);
234
+
235
+ if ($this->_expireAjax() || !$prevStep) {
236
+ return null;
237
+ }
238
+
239
+ $layout = $this->getLayout();
240
+ $update = $layout->getUpdate();
241
+ /* Load the block belonging to the current step*/
242
+ $update->load('checkout_onepage_progress_' . $prevStep);
243
+ $layout->generateXml();
244
+ $layout->generateBlocks();
245
+ $output = $layout->getOutput();
246
+ $this->getResponse()->setBody($output);
247
+ return $output;
248
+ }
249
+
250
+ /**
251
+ * Shipping method action
252
+ */
253
+ public function shippingMethodAction()
254
+ {
255
+ if ($this->_expireAjax()) {
256
+ return;
257
+ }
258
+ $this->loadLayout(false);
259
+ $this->renderLayout();
260
+ }
261
+
262
+ /**
263
+ * Review page action
264
+ */
265
+ public function reviewAction()
266
+ {
267
+ if ($this->_expireAjax()) {
268
+ return;
269
+ }
270
+ $this->loadLayout(false);
271
+ $this->renderLayout();
272
+ }
273
+
274
+ /**
275
+ * Order success action
276
+ */
277
+ public function successAction()
278
+ {
279
+ $session = $this->getOnepage()->getCheckout();
280
+ if (!$session->getLastSuccessQuoteId()) {
281
+ $this->_redirect('checkout/cart');
282
+ return;
283
+ }
284
+
285
+ $lastQuoteId = $session->getLastQuoteId();
286
+ $lastOrderId = $session->getLastOrderId();
287
+ $lastRecurringProfiles = $session->getLastRecurringProfileIds();
288
+ if (!$lastQuoteId || (!$lastOrderId && empty($lastRecurringProfiles))) {
289
+ $this->_redirect('checkout/cart');
290
+ return;
291
+ }
292
+
293
+ // $session->clear();
294
+ $this->loadLayout();
295
+ $this->_initLayoutMessages('checkout/session');
296
+ Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($lastOrderId)));
297
+ $this->renderLayout();
298
+ $orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
299
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
300
+ $order->customer_email;echo '<br>';
301
+ $items = $order->getAllItems();
302
+ $dataArr = array();
303
+ $i=0;
304
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read') ;
305
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
306
+ $user_ip = $_SERVER['REMOTE_ADDR'];
307
+ foreach($items as $data)
308
+ {
309
+
310
+ //echo '<pre>';print_r($data);
311
+ $site_url = Mage::getBaseUrl();
312
+ $get_url = str_replace('index.php/','',$site_url);
313
+ $data['product_id'];
314
+ $get_url_query = $read_data->fetchall("SELECT DISTINCT value from catalog_product_entity_varchar where attribute_id ='85' AND entity_id ='".$data['product_id']."'");
315
+ $product_url = $read_data->fetchall( "SELECT DISTINCT value from catalog_product_entity_varchar where attribute_id ='98' AND entity_id ='".$data['product_id']."'");
316
+
317
+ $pro_url = $product_url['0']['value'];
318
+ $get_pro_url = $site_url.$pro_url;
319
+
320
+ $img_url = $get_url.'media/catalog/product'.$get_url_query['0']['value'];
321
+ $product_name[] =$data['name'];
322
+ $product_price[]=$data['price'];
323
+ echo $dataArr['orders'][$i]['product_name']=$data['name'];
324
+
325
+ echo $dataArr['orders'][$i]['product_price']=$data['price'];
326
+ echo $dataArr['orders'][$i]['created_at']=$data['created_at'];
327
+ echo $dataArr['orders'][$i]['pay_status']=$order->getStatus();
328
+ $dataArr['orders'][$i]['img_url'] = $img_url;
329
+ $dataArr['orders'][$i]['product_url'] = $get_pro_url;
330
+
331
+ $inser_user_ip = $write_data->insert("abandoned_user_ip",array("email_id" =>$order->customer_email, "user_ip" => $user_ip,"product_name"=>$data['name'],"Product_price"=>$data['price'],"pay_status"=>$order->getStatus(),"added_date"=>$data['created_at'])
332
+ );
333
+ print_r($inser_user_ip);
334
+
335
+ $i++;
336
+
337
+ }
338
+
339
+
340
+
341
+ $result10 = $read_data->fetchAll("select * from Abandon_cart_licensekey");
342
+ $outwards_status = $read_data->fetchAll("select * from abandoned_extensionsetting");
343
+ $license_key = $result10['0']['license_key'];
344
+ $dataArr['liscence_key'] = $license_key;
345
+ $dataArr['email'] = $order->customer_email;
346
+ $data = json_encode($dataArr);
347
+
348
+ $ch = curl_init();
349
+ $url ='http://staging.pricelizer.com/webService/getOrders';
350
+
351
+ //set the url, number of POST vars, POST data
352
+ curl_setopt($ch,CURLOPT_URL, $url);
353
+ curl_setopt($ch,CURLOPT_POST, count($data));
354
+ curl_setopt($ch,CURLOPT_POSTFIELDS, $data);
355
+
356
+ //execute post
357
+ if($outwards_status['6']['status']=='yes')
358
+ {
359
+ $result = curl_exec($ch);
360
+ //print_r($result);
361
+
362
+ //close connection
363
+ curl_close($ch);
364
+ //$session->clear();
365
+ }
366
+ }
367
+
368
+ /**
369
+ * Failure action
370
+ */
371
+ public function failureAction()
372
+ {
373
+ $lastQuoteId = $this->getOnepage()->getCheckout()->getLastQuoteId();
374
+ $lastOrderId = $this->getOnepage()->getCheckout()->getLastOrderId();
375
+
376
+ if (!$lastQuoteId || !$lastOrderId) {
377
+ $this->_redirect('checkout/cart');
378
+ return;
379
+ }
380
+
381
+ $this->loadLayout();
382
+ $this->renderLayout();
383
+ }
384
+
385
+
386
+ /**
387
+ * Get additional info action
388
+ */
389
+ public function getAdditionalAction()
390
+ {
391
+ $this->getResponse()->setBody($this->_getAdditionalHtml());
392
+ }
393
+
394
+ /**
395
+ * Address JSON
396
+ */
397
+ public function getAddressAction()
398
+ {
399
+ if ($this->_expireAjax()) {
400
+ return;
401
+ }
402
+ $addressId = $this->getRequest()->getParam('address', false);
403
+ if ($addressId) {
404
+ $address = $this->getOnepage()->getAddress($addressId);
405
+
406
+ if (Mage::getSingleton('customer/session')->getCustomer()->getId() == $address->getCustomerId()) {
407
+ $this->getResponse()->setHeader('Content-type', 'application/x-json');
408
+ $this->getResponse()->setBody($address->toJson());
409
+ } else {
410
+ $this->getResponse()->setHeader('HTTP/1.1','403 Forbidden');
411
+ }
412
+ }
413
+ }
414
+
415
+ /**
416
+ * Save checkout method
417
+ */
418
+ public function saveMethodAction()
419
+ {
420
+ if ($this->_expireAjax()) {
421
+ return;
422
+ }
423
+ if ($this->getRequest()->isPost()) {
424
+ $method = $this->getRequest()->getPost('method');
425
+ $result = $this->getOnepage()->saveCheckoutMethod($method);
426
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
427
+ }
428
+ }
429
+
430
+ /**
431
+ * Save checkout billing address
432
+ */
433
+ public function saveBillingAction()
434
+ {
435
+ if ($this->_expireAjax()) {
436
+ return;
437
+ }
438
+ if ($this->getRequest()->isPost()) {
439
+ $data = $this->getRequest()->getPost('billing', array());
440
+ $customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
441
+
442
+ if (isset($data['email'])) {
443
+ $data['email'] = trim($data['email']);
444
+ }
445
+ $result = $this->getOnepage()->saveBilling($data, $customerAddressId);
446
+
447
+ if (!isset($result['error'])) {
448
+ if ($this->getOnepage()->getQuote()->isVirtual()) {
449
+ $result['goto_section'] = 'payment';
450
+ $result['update_section'] = array(
451
+ 'name' => 'payment-method',
452
+ 'html' => $this->_getPaymentMethodsHtml()
453
+ );
454
+ } elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
455
+ $result['goto_section'] = 'shipping_method';
456
+ $result['update_section'] = array(
457
+ 'name' => 'shipping-method',
458
+ 'html' => $this->_getShippingMethodsHtml()
459
+ );
460
+
461
+ $result['allow_sections'] = array('shipping');
462
+ $result['duplicateBillingInfo'] = 'true';
463
+ } else {
464
+ $result['goto_section'] = 'shipping';
465
+ }
466
+ }
467
+
468
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
469
+ }
470
+ }
471
+
472
+ /**
473
+ * Shipping address save action
474
+ */
475
+ public function saveShippingAction()
476
+ {
477
+ if ($this->_expireAjax()) {
478
+ return;
479
+ }
480
+ if ($this->getRequest()->isPost()) {
481
+ $data = $this->getRequest()->getPost('shipping', array());
482
+ $customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
483
+ $result = $this->getOnepage()->saveShipping($data, $customerAddressId);
484
+
485
+ if (!isset($result['error'])) {
486
+ $result['goto_section'] = 'shipping_method';
487
+ $result['update_section'] = array(
488
+ 'name' => 'shipping-method',
489
+ 'html' => $this->_getShippingMethodsHtml()
490
+ );
491
+ }
492
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
493
+ }
494
+ }
495
+
496
+ /**
497
+ * Shipping method save action
498
+ */
499
+ public function saveShippingMethodAction()
500
+ {
501
+ if ($this->_expireAjax()) {
502
+ return;
503
+ }
504
+ if ($this->getRequest()->isPost()) {
505
+ $data = $this->getRequest()->getPost('shipping_method', '');
506
+ $result = $this->getOnepage()->saveShippingMethod($data);
507
+ // $result will contain error data if shipping method is empty
508
+ if (!$result) {
509
+ Mage::dispatchEvent(
510
+ 'checkout_controller_onepage_save_shipping_method',
511
+ array(
512
+ 'request' => $this->getRequest(),
513
+ 'quote' => $this->getOnepage()->getQuote()));
514
+ $this->getOnepage()->getQuote()->collectTotals();
515
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
516
+
517
+ $result['goto_section'] = 'payment';
518
+ $result['update_section'] = array(
519
+ 'name' => 'payment-method',
520
+ 'html' => $this->_getPaymentMethodsHtml()
521
+ );
522
+ }
523
+ $this->getOnepage()->getQuote()->collectTotals()->save();
524
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
525
+ }
526
+ }
527
+
528
+ /**
529
+ * Save payment ajax action
530
+ *
531
+ * Sets either redirect or a JSON response
532
+ */
533
+ public function savePaymentAction()
534
+ {
535
+ if ($this->_expireAjax()) {
536
+ return;
537
+ }
538
+ try {
539
+ if (!$this->getRequest()->isPost()) {
540
+ $this->_ajaxRedirectResponse();
541
+ return;
542
+ }
543
+
544
+ $data = $this->getRequest()->getPost('payment', array());
545
+ $result = $this->getOnepage()->savePayment($data);
546
+
547
+ // get section and redirect data
548
+ $redirectUrl = $this->getOnepage()->getQuote()->getPayment()->getCheckoutRedirectUrl();
549
+ if (empty($result['error']) && !$redirectUrl) {
550
+ $this->loadLayout('checkout_onepage_review');
551
+ $result['goto_section'] = 'review';
552
+ $result['update_section'] = array(
553
+ 'name' => 'review',
554
+ 'html' => $this->_getReviewHtml()
555
+ );
556
+ }
557
+ if ($redirectUrl) {
558
+ $result['redirect'] = $redirectUrl;
559
+ }
560
+ } catch (Mage_Payment_Exception $e) {
561
+ if ($e->getFields()) {
562
+ $result['fields'] = $e->getFields();
563
+ }
564
+ $result['error'] = $e->getMessage();
565
+ } catch (Mage_Core_Exception $e) {
566
+ $result['error'] = $e->getMessage();
567
+ } catch (Exception $e) {
568
+ Mage::logException($e);
569
+ $result['error'] = $this->__('Unable to set Payment Method.');
570
+ }
571
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
572
+ }
573
+
574
+ /**
575
+ * Get Order by quoteId
576
+ *
577
+ * @throws Mage_Payment_Model_Info_Exception
578
+ * @return Mage_Sales_Model_Order
579
+ */
580
+ protected function _getOrder()
581
+ {
582
+ if (is_null($this->_order)) {
583
+ $this->_order = Mage::getModel('sales/order')->load($this->getOnepage()->getQuote()->getId(), 'quote_id');
584
+ if (!$this->_order->getId()) {
585
+ throw new Mage_Payment_Model_Info_Exception(Mage::helper('core')->__("Can not create invoice. Order was not found."));
586
+ }
587
+ }
588
+ return $this->_order;
589
+ }
590
+
591
+ /**
592
+ * Create invoice
593
+ *
594
+ * @return Mage_Sales_Model_Order_Invoice
595
+ */
596
+ protected function _initInvoice()
597
+ {
598
+ $items = array();
599
+ foreach ($this->_getOrder()->getAllItems() as $item) {
600
+ $items[$item->getId()] = $item->getQtyOrdered();
601
+ }
602
+ /* @var $invoice Mage_Sales_Model_Service_Order */
603
+ $invoice = Mage::getModel('sales/service_order', $this->_getOrder())->prepareInvoice($items);
604
+ $invoice->setEmailSent(true)->register();
605
+
606
+ Mage::register('current_invoice', $invoice);
607
+ return $invoice;
608
+ }
609
+
610
+ /**
611
+ * Create order action
612
+ */
613
+ public function saveOrderAction()
614
+ {
615
+ if (!$this->_validateFormKey()) {
616
+ $this->_redirect('*/*');
617
+ return;
618
+ }
619
+
620
+ if ($this->_expireAjax()) {
621
+ return;
622
+ }
623
+
624
+ $result = array();
625
+ try {
626
+ $requiredAgreements = Mage::helper('checkout')->getRequiredAgreementIds();
627
+ if ($requiredAgreements) {
628
+ $postedAgreements = array_keys($this->getRequest()->getPost('agreement', array()));
629
+ $diff = array_diff($requiredAgreements, $postedAgreements);
630
+ if ($diff) {
631
+ $result['success'] = false;
632
+ $result['error'] = true;
633
+ $result['error_messages'] = $this->__('Please agree to all the terms and conditions before placing the order.');
634
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
635
+ return;
636
+ }
637
+ }
638
+
639
+ $data = $this->getRequest()->getPost('payment', array());
640
+ if ($data) {
641
+ $data['checks'] = Mage_Payment_Model_Method_Abstract::CHECK_USE_CHECKOUT
642
+ | Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_COUNTRY
643
+ | Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_CURRENCY
644
+ | Mage_Payment_Model_Method_Abstract::CHECK_ORDER_TOTAL_MIN_MAX
645
+ | Mage_Payment_Model_Method_Abstract::CHECK_ZERO_TOTAL;
646
+ $this->getOnepage()->getQuote()->getPayment()->importData($data);
647
+ }
648
+
649
+ $this->getOnepage()->saveOrder();
650
+
651
+ $redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl();
652
+ $result['success'] = true;
653
+ $result['error'] = false;
654
+ } catch (Mage_Payment_Model_Info_Exception $e) {
655
+ $message = $e->getMessage();
656
+ if (!empty($message)) {
657
+ $result['error_messages'] = $message;
658
+ }
659
+ $result['goto_section'] = 'payment';
660
+ $result['update_section'] = array(
661
+ 'name' => 'payment-method',
662
+ 'html' => $this->_getPaymentMethodsHtml()
663
+ );
664
+ } catch (Mage_Core_Exception $e) {
665
+ Mage::logException($e);
666
+ Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
667
+ $result['success'] = false;
668
+ $result['error'] = true;
669
+ $result['error_messages'] = $e->getMessage();
670
+
671
+ $gotoSection = $this->getOnepage()->getCheckout()->getGotoSection();
672
+ if ($gotoSection) {
673
+ $result['goto_section'] = $gotoSection;
674
+ $this->getOnepage()->getCheckout()->setGotoSection(null);
675
+ }
676
+ $updateSection = $this->getOnepage()->getCheckout()->getUpdateSection();
677
+ if ($updateSection) {
678
+ if (isset($this->_sectionUpdateFunctions[$updateSection])) {
679
+ $updateSectionFunction = $this->_sectionUpdateFunctions[$updateSection];
680
+ $result['update_section'] = array(
681
+ 'name' => $updateSection,
682
+ 'html' => $this->$updateSectionFunction()
683
+ );
684
+ }
685
+ $this->getOnepage()->getCheckout()->setUpdateSection(null);
686
+ }
687
+ } catch (Exception $e) {
688
+ Mage::logException($e);
689
+ Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
690
+ $result['success'] = false;
691
+ $result['error'] = true;
692
+ $result['error_messages'] = $this->__('There was an error processing your order. Please contact us or try again later.');
693
+ }
694
+ $this->getOnepage()->getQuote()->save();
695
+ /**
696
+ * when there is redirect to third party, we don't want to save order yet.
697
+ * we will save the order in return action.
698
+ */
699
+ if (isset($redirectUrl)) {
700
+ $result['redirect'] = $redirectUrl;
701
+ }
702
+
703
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
704
+ }
705
+
706
+ /**
707
+ * Filtering posted data. Converting localized data if needed
708
+ *
709
+ * @param array
710
+ * @return array
711
+ */
712
+ protected function _filterPostData($data)
713
+ {
714
+ $data = $this->_filterDates($data, array('dob'));
715
+ return $data;
716
+ }
717
+
718
+ /**
719
+ * Check can page show for unregistered users
720
+ *
721
+ * @return boolean
722
+ */
723
+ protected function _canShowForUnregisteredUsers()
724
+ {
725
+ return Mage::getSingleton('customer/session')->isLoggedIn()
726
+ || $this->getRequest()->getActionName() == 'index'
727
+ || Mage::helper('checkout')->isAllowedGuestCheckout($this->getOnepage()->getQuote())
728
+ || !Mage::helper('checkout')->isCustomerMustBeLogged();
729
+ }
730
+ }
app/code/community/Greenacorn/Greenmodule/etc/adminhtml.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <config>
3
+ <menu>
4
+ <green_menu translate="title" module="greenmodule">
5
+ <title>Abandoned carts</title>
6
+ <sort_order>100</sort_order>
7
+ <children>
8
+ <index module="greenmodule" translate="title">
9
+ <title>Abandoned carts</title>
10
+ <sort_order>1</sort_order>
11
+ <action>greenmodule/index/abandonedCart</action>
12
+ </index>
13
+ <list module="greenmodule" translate="title">
14
+ <title>Extension setting</title>
15
+ <sort_order>2</sort_order>
16
+ <action>greenmodule/index/extensionSetting</action>
17
+ </list>
18
+ </children>
19
+
20
+
21
+
22
+ </green_menu>
23
+ </menu>
24
+
25
+ </config>
app/code/community/Greenacorn/Greenmodule/etc/config.xml ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Greenacorn_Greenmodule>
5
+ <version>0.1.0</version>
6
+ </Greenacorn_Greenmodule>
7
+ </modules>
8
+ <global>
9
+ <models/>
10
+ <blocks/>
11
+ <resources>
12
+ <greenmodule_setup>
13
+ <setup>
14
+ <module>Greenacorn_Greenmodule</module>
15
+ </setup>
16
+ <connection>
17
+ <use>core_setup</use>
18
+ </connection>
19
+ </greenmodule_setup>
20
+ <greenmodule_write>
21
+ <connection>
22
+ <use>core_write</use>
23
+ </connection>
24
+ </greenmodule_write>
25
+ <greenmodule_read>
26
+ <connection>
27
+ <use>core_read</use>
28
+ </connection>
29
+ </greenmodule_read>
30
+ </resources>
31
+ <helpers>
32
+ <greenmodule>
33
+ <class>Greenacorn_Greenmodule_Helper</class>
34
+ </greenmodule>
35
+ </helpers>
36
+ </global>
37
+
38
+ <frontend>
39
+ <events>
40
+ <sales_order_place_after>
41
+ <observers>
42
+ <greenmodule_setup_sales_order_place_after>
43
+ <class>Greenacorn_Greenmodule_Model_Observer</class>
44
+ <method>salesOrderPlaceAfter</method>
45
+ </greenmodule_setup_sales_order_place_after>
46
+ </observers>
47
+ </sales_order_place_after>
48
+ </events>
49
+ <routers>
50
+ <checkout>
51
+ <args>
52
+ <modules>
53
+ <Greenacorn_Greenmodule before="Mage_Checkout">Greenacorn_Greenmodule</Greenacorn_Greenmodule>
54
+ </modules>
55
+ </args>
56
+ </checkout>
57
+ </routers>
58
+ </frontend>
59
+
60
+
61
+
62
+ <admin>
63
+ <acl>
64
+ <routers>
65
+ <greenacorn_greenmodule>
66
+ <use>admin</use>
67
+ <args>
68
+ <module>Greenacorn_Greenmodule</module>
69
+ <frontName>abandon</frontName>
70
+ </args>
71
+ <args>
72
+ <modules>
73
+ <foo_bar before="Mage_Adminhtml">Greenacorn_Greenmodule_Adminhtml</foo_bar>
74
+ </modules>
75
+ </args>
76
+
77
+ </greenacorn_greenmodule>
78
+ </routers>
79
+ </acl>
80
+ </admin>
81
+ <frontend>
82
+ <routers>
83
+ <greenmodule>
84
+ <use>standard</use>
85
+ <args>
86
+ <module>Greenacorn_Greenmodule</module>
87
+ <frontName>abandon</frontName>
88
+ </args>
89
+ </greenmodule>
90
+ </routers>
91
+
92
+ </frontend>
93
+ </config>
app/code/community/Greenacorn/Greenmodule/sql/greenmodule_setup/magento.sql~ ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- phpMyAdmin SQL Dump
2
+ -- version 4.0.3
3
+ -- http://www.phpmyadmin.net
4
+ --
5
+ -- Host: localhost
6
+ -- Generation Time: Sep 19, 2014 at 01:50 PM
7
+ -- Server version: 5.5.33-cll-lve
8
+ -- PHP Version: 5.4.21
9
+
10
+ SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
11
+ SET time_zone = "+00:00";
12
+
13
+
14
+ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
15
+ /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
16
+ /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
17
+ /*!40101 SET NAMES utf8 */;
18
+
19
+
20
+ -- --------------------------------------------------------
21
+
22
+ --
23
+ -- Table structure for table `Abandon_added_product`
24
+ --
25
+
26
+ CREATE TABLE IF NOT EXISTS `Abandon_added_product` (
27
+ `abandon_id` int(11) NOT NULL AUTO_INCREMENT,
28
+ `added_user_id` varchar(255) NOT NULL,
29
+ `added_prod_id` varchar(255) NOT NULL,
30
+ `added_entity_id` varchar(255) NOT NULL,
31
+ `abandon_email_status` tinyint(1) NOT NULL,
32
+ PRIMARY KEY (`abandon_id`)
33
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=11 ;
34
+
35
+ --
36
+ -- Dumping data for table `Abandon_added_product`
37
+ --
38
+
39
+ -- --------------------------------------------------------
40
+
41
+ --
42
+ -- Table structure for table `abandon_cart`
43
+ --
44
+
45
+ CREATE TABLE IF NOT EXISTS `abandon_cart` (
46
+ `id` int(11) NOT NULL AUTO_INCREMENT,
47
+ `abandon_status` tinyint(1) NOT NULL,
48
+ `day` tinyint(255) NOT NULL,
49
+ `date` datetime NOT NULL,
50
+ PRIMARY KEY (`id`)
51
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
52
+
53
+ --
54
+ -- Dumping data for table `abandon_cart`
55
+ --
56
+
57
+ INSERT INTO `abandon_cart` (`id`, `abandon_status`, `day`, `date`) VALUES
58
+ (1, 1, 5, '2014-09-19 06:40:50');
59
+
60
+ -- --------------------------------------------------------
61
+
62
+ --
63
+ -- Table structure for table `Abandon_social_media_login`
64
+ --
65
+
66
+ CREATE TABLE IF NOT EXISTS `Abandon_social_media_login` (
67
+ `social_id` int(11) NOT NULL AUTO_INCREMENT,
68
+ `provider` varchar(255) NOT NULL,
69
+ `social_api` varchar(255) NOT NULL,
70
+ `social_secret_key` varchar(255) NOT NULL,
71
+ PRIMARY KEY (`social_id`)
72
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
73
+
74
+ --
75
+ -- Dumping data for table `Abandon_social_media_login`
76
+ --
77
+
78
+ INSERT INTO `Abandon_social_media_login` (`social_id`, `provider`, `social_api`, `social_secret_key`) VALUES
79
+ (1, 'fb', '604048206379521', '6c81c6c5a038743cd0af8d8e9f4401ae'),
80
+ (2, 'google', '971328528189-rnrnfkhvj7qm4jvf1ug2be4ma2ot3tro.apps.googleusercontent.com', 'nyvMeWp-KXCzHJcWg1G49dPP'),
81
+ (3, 'linkedin', '75i0kf9y2r81qt', 'C0snmVI97FAO8oO0');
82
+
83
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Catalog Product Price Indexer Option Aggregate Index Table';
84
+
app/code/community/Greenacorn/Greenmodule/sql/greenmodule_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ $installer->run("
6
+ CREATE TABLE `Abandoned_email_subscription` (
7
+ `id` int(11) NOT NULL AUTO_INCREMENT,
8
+ `customer_id` int(11) NOT NULL,
9
+ `customer_name` varchar(255) NOT NULL,
10
+ `customer_email` varchar(255) NOT NULL,
11
+ `subscribe_status` varchar(255) NOT NULL,
12
+ PRIMARY KEY (`id`)
13
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
14
+ ");
15
+ $installer->run("
16
+ CREATE TABLE `abandoned_extensionsetting` (
17
+ `id` int(11) NOT NULL AUTO_INCREMENT,
18
+ `extension_name` varchar(255) NOT NULL,
19
+ `status` varchar(255) NOT NULL,
20
+ PRIMARY KEY (`id`)
21
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
22
+ ");
23
+ $installer->run("
24
+ INSERT INTO `abandoned_extensionsetting` (`id`, `extension_name`, `status`) VALUES
25
+ (1, 'catched_user', 'off'),
26
+ (2, '1_click_signup', 'on'),
27
+ (3, 'add_to_watchlist', 'on'),
28
+ (4, 'pricelizer_logo', 'yes'),
29
+ (5, 'link_footer', 'yes'),
30
+ (6, 'purchase_reminder', 'yes'),
31
+ (7, 'outwards_communication', 'no'),
32
+ (8, 'site_logo', 'yes'),
33
+ (9, 'abandoned_cart_reminder', 'yes'),
34
+ (10, 'invite_abandonedcar_user', 'on');
35
+
36
+ ");
37
+ $installer->run("
38
+ CREATE TABLE IF NOT EXISTS `abandoned_user_ip` (
39
+ `id` int(11) NOT NULL AUTO_INCREMENT,
40
+ `email_id` varchar(255) NOT NULL,
41
+ `user_ip` varchar(255) NOT NULL,
42
+ `product_name` varchar(255) NOT NULL,
43
+ `Product_price` varchar(255) NOT NULL,
44
+ `pay_status` varchar(255) NOT NULL,
45
+ `added_date` date NOT NULL,
46
+ PRIMARY KEY (`id`)
47
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
48
+ ");
49
+ $installer->run("
50
+ CREATE TABLE IF NOT EXISTS `Abandon_added_product` (
51
+ `abandon_id` int(11) NOT NULL AUTO_INCREMENT,
52
+ `added_user_id` varchar(255) NOT NULL,
53
+ `added_prod_id` varchar(255) NOT NULL,
54
+ `added_entity_id` varchar(255) NOT NULL,
55
+ `abandon_email_status` tinyint(1) NOT NULL,
56
+ PRIMARY KEY (`abandon_id`)
57
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=27 ;
58
+
59
+ ");
60
+ $installer->run("
61
+ CREATE TABLE IF NOT EXISTS `abandon_cart` (
62
+ `id` int(11) NOT NULL AUTO_INCREMENT,
63
+ `abandon_status` tinyint(1) NOT NULL,
64
+ `day` tinyint(255) NOT NULL,
65
+ `date` datetime NOT NULL,
66
+ PRIMARY KEY (`id`)
67
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
68
+
69
+ ");
70
+ $installer->run("
71
+ INSERT INTO `abandon_cart` (`id`, `abandon_status`, `day`, `date`) VALUES
72
+ (1, 0, 10, '2015-03-07 19:02:04');
73
+
74
+ ");
75
+ $installer->run("
76
+ CREATE TABLE IF NOT EXISTS `Abandon_cart_licensekey` (
77
+ `id` int(11) NOT NULL AUTO_INCREMENT,
78
+ `user_email` varchar(255) NOT NULL,
79
+ `license_key` varchar(255) NOT NULL,
80
+ `start_date` date NOT NULL,
81
+ `end_date` date NOT NULL,
82
+ `duration_type` varchar(255) NOT NULL,
83
+ `user_id` varchar(255) NOT NULL,
84
+ `package_name` varchar(255) NOT NULL,
85
+ `list_abandon_cart` varchar(255) NOT NULL,
86
+ `invitation_link` varchar(255) NOT NULL,
87
+ `user_details` varchar(255) NOT NULL,
88
+ PRIMARY KEY (`id`)
89
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
90
+ ");
91
+ $installer->run("
92
+ CREATE TABLE IF NOT EXISTS `Abandon_cart_users` (
93
+ `id` int(11) NOT NULL AUTO_INCREMENT,
94
+ `Abandoned_cart` varchar(255) NOT NULL,
95
+ `Catched_user` varchar(255) NOT NULL,
96
+ PRIMARY KEY (`id`)
97
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
98
+
99
+ "); $installer->run("
100
+ INSERT INTO `Abandon_cart_users` (`id`, `Abandoned_cart`, `Catched_user`) VALUES
101
+ (1, '0', '0');
102
+ ");
103
+
104
+ $installer->run("
105
+ CREATE TABLE IF NOT EXISTS `abandon_email_template` (
106
+ `id` int(11) NOT NULL AUTO_INCREMENT,
107
+ `email_conetnt` text NOT NULL,
108
+ `template_type` varchar(255) NOT NULL,
109
+ PRIMARY KEY (`id`)
110
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
111
+
112
+ ");
113
+ $installer->run("
114
+ CREATE TABLE IF NOT EXISTS `Abandon_social_media_login` (
115
+ `social_id` int(11) NOT NULL AUTO_INCREMENT,
116
+ `provider` varchar(255) NOT NULL,
117
+ `oauth_token` varchar(255) NOT NULL,
118
+ PRIMARY KEY (`social_id`)
119
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
120
+
121
+ ");
122
+
123
+ $installer->endSetup();
124
+ ?>
app/code/community/Greenacorn/Greenmodule/sql/greenmodule_setup/mysql4-upgrade-0.1.0-0.1.1.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ *
5
+ * @Udaan Technology (http://www.udaantechnologies.com/)
6
+ * @copyright Copyright (c) 2014 Udaan Technology
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+
10
+
11
+ $installer = $this;
12
+
13
+ $installer->startSetup();
14
+
15
+ Mage::helper('smtppro/mysql4_install')->prepareForDb();
16
+
17
+ Mage::helper('smtppro/mysql4_install')->attemptQuery($installer, "
18
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('Abandon_added_product')}` (
19
+ `abandon_id` int(11) NOT NULL AUTO_INCREMENT,
20
+ `added_user_id` varchar(255) NOT NULL,
21
+ `added_prod_id` varchar(255) NOT NULL,
22
+ `added_entity_id` varchar(255) NOT NULL,
23
+ `abandon_email_status` tinyint(1) NOT NULL,
24
+ PRIMARY KEY (`abandon_id`)
25
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=11 ;
26
+ ");
27
+
28
+
29
+
30
+ Mage::helper('smtppro/mysql4_install')->createInstallNotice("Abandon_added_product was installed successfully.", "SMTP Pro has been installed successfully. Go to the system configuration section of your Magento admin to configure SMTP Pro and get it up and running.");
31
+
32
+ $installer->endSetup();
app/code/community/Greenacorn/Greenmodule/sql/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ DebugBreak();
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $installer->run("
7
+ CREATE TABLE `Abandoned_email_subscription` (
8
+ `id` int(11) NOT NULL AUTO_INCREMENT,
9
+ `customer_id` int(11) NOT NULL,
10
+ `customer_name` varchar(255) NOT NULL,
11
+ `customer_email` varchar(255) NOT NULL,
12
+ `subscribe_status` varchar(255) NOT NULL,
13
+ PRIMARY KEY (`id`)
14
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
15
+ ");
16
+ $installer->run("
17
+ CREATE TABLE `abandoned_extensionsetting` (
18
+ `id` int(11) NOT NULL AUTO_INCREMENT,
19
+ `extension_name` varchar(255) NOT NULL,
20
+ `status` varchar(255) NOT NULL,
21
+ PRIMARY KEY (`id`)
22
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
23
+ ");
24
+ $installer->run("
25
+ INSERT INTO `abandoned_extensionsetting` (`id`, `extension_name`, `status`) VALUES
26
+ (1, 'catched_user', 'off'),
27
+ (2, '1_click_signup', 'on'),
28
+ (3, 'add_to_watchlist', 'on'),
29
+ (4, 'pricelizer_logo', 'yes'),
30
+ (5, 'link_footer', 'yes'),
31
+ (6, 'purchase_reminder', 'yes'),
32
+ (7, 'outwards_communication', 'no'),
33
+ (8, 'site_logo', 'yes'),
34
+ (9, 'abandoned_cart_reminder', 'yes'),
35
+ (10, 'invite_abandonedcar_user', 'on');
36
+
37
+ ");
38
+ $installer->run("
39
+ CREATE TABLE IF NOT EXISTS `abandoned_user_ip` (
40
+ `id` int(11) NOT NULL AUTO_INCREMENT,
41
+ `email_id` varchar(255) NOT NULL,
42
+ `user_ip` varchar(255) NOT NULL,
43
+ `product_name` varchar(255) NOT NULL,
44
+ `Product_price` varchar(255) NOT NULL,
45
+ `pay_status` varchar(255) NOT NULL,
46
+ `added_date` date NOT NULL,
47
+ PRIMARY KEY (`id`)
48
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
49
+ ");
50
+ $installer->run("
51
+ CREATE TABLE IF NOT EXISTS `Abandon_added_product` (
52
+ `abandon_id` int(11) NOT NULL AUTO_INCREMENT,
53
+ `added_user_id` varchar(255) NOT NULL,
54
+ `added_prod_id` varchar(255) NOT NULL,
55
+ `added_entity_id` varchar(255) NOT NULL,
56
+ `abandon_email_status` tinyint(1) NOT NULL,
57
+ PRIMARY KEY (`abandon_id`)
58
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=27 ;
59
+
60
+ ");
61
+ $installer->run("
62
+ CREATE TABLE IF NOT EXISTS `abandon_cart` (
63
+ `id` int(11) NOT NULL AUTO_INCREMENT,
64
+ `abandon_status` tinyint(1) NOT NULL,
65
+ `day` tinyint(255) NOT NULL,
66
+ `date` datetime NOT NULL,
67
+ PRIMARY KEY (`id`)
68
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
69
+
70
+ ");
71
+ $installer->run("
72
+ INSERT INTO `abandon_cart` (`id`, `abandon_status`, `day`, `date`) VALUES
73
+ (1, 0, 10, '2015-03-07 19:02:04');
74
+
75
+ ");
76
+ $installer->run("
77
+ CREATE TABLE IF NOT EXISTS `Abandon_cart_licensekey` (
78
+ `id` int(11) NOT NULL AUTO_INCREMENT,
79
+ `user_email` varchar(255) NOT NULL,
80
+ `license_key` varchar(255) NOT NULL,
81
+ `start_date` date NOT NULL,
82
+ `end_date` date NOT NULL,
83
+ `duration_type` varchar(255) NOT NULL,
84
+ `user_id` varchar(255) NOT NULL,
85
+ `package_name` varchar(255) NOT NULL,
86
+ `list_abandon_cart` varchar(255) NOT NULL,
87
+ `invitation_link` varchar(255) NOT NULL,
88
+ `user_details` varchar(255) NOT NULL,
89
+ PRIMARY KEY (`id`)
90
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
91
+ ");
92
+ $installer->run("
93
+ CREATE TABLE IF NOT EXISTS `Abandon_cart_users` (
94
+ `id` int(11) NOT NULL AUTO_INCREMENT,
95
+ `Abandoned_cart` varchar(255) NOT NULL,
96
+ `Catched_user` varchar(255) NOT NULL,
97
+ PRIMARY KEY (`id`)
98
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
99
+
100
+ "); $installer->run("
101
+ INSERT INTO `Abandon_cart_users` (`id`, `Abandoned_cart`, `Catched_user`) VALUES
102
+ (1, '0', '0');
103
+ ");
104
+
105
+ $installer->run("
106
+ CREATE TABLE IF NOT EXISTS `abandon_email_template` (
107
+ `id` int(11) NOT NULL AUTO_INCREMENT,
108
+ `email_conetnt` text NOT NULL,
109
+ `template_type` varchar(255) NOT NULL,
110
+ PRIMARY KEY (`id`)
111
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
112
+
113
+ ");
114
+ $installer->run("
115
+ CREATE TABLE IF NOT EXISTS `Abandon_social_media_login` (
116
+ `social_id` int(11) NOT NULL AUTO_INCREMENT,
117
+ `provider` varchar(255) NOT NULL,
118
+ `oauth_token` varchar(255) NOT NULL,
119
+ PRIMARY KEY (`social_id`)
120
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
121
+
122
+ ");
123
+ $installer->run("
124
+ INSERT INTO `abandon_email_template` (`id`, `email_conetnt`, `template_type`) VALUES
125
+ (1, '<style>\r\n .container-middle, .section-item{ margin: auto; }\r\n @media screen and (max-width:767px){\r\n .container { width: 100%; }\r\n .container-middle { padding: 0 15px; width: 100%; }\r\n .main-table{ width: 100%; }\r\n .main-table img{ width: 100%!important; }\r\n }\r\n @media screen and (max-width:320px){ \r\n .container-middle { padding: 0; width: 95%; }\r\n }\r\n</style>\r\n<div class='prmo-mail'>\r\n <table width='100%' cellspacing='0' cellpadding='0' border='0' class='main-table'>\r\n <tbody><tr><td height='30'></td></tr>\r\n <tr bgcolor='#43B74A'>\r\n <td width='100%' valign='top' bgcolor='#fff' align='center'>\r\n\r\n <!--------- top header ------------>\r\n <table width='600' cellspacing='0' cellpadding='0' border='0' align='center' class='container'>\r\n <tbody>\r\n <tr bgcolor='#43B74A' style='border-radius:5px 5px 0 0;'>\r\n <td>&nbsp;</td>\r\n </tr>\r\n <tr bgcolor='#43B74A'>\r\n <td height='5'></td>\r\n </tr>\r\n <tr bgcolor='#43B74A'>\r\n <td align='center'>\r\n <table width='560' cellspacing='0' cellpadding='0' border='0' align='center' style='margin:0 auto;' class='container-middle'>\r\n <tbody><tr>\r\n <td>\r\n <table cellspacing='0' cellpadding='0' border='0' align='left' class='top-header-left'>\r\n <tbody><tr>\r\n <td align='center'>\r\n <table cellspacing='0' cellpadding='0' border='0' class='date'>\r\n <tbody><tr>\r\n <td>\r\n <img width='13' editable='true' mc:edit='icon1' style='display: block;' src='http://promailthemes.com/campaigner/layout1/white/blue/img/icon-cal.png' alt='icon 1'>\r\n </td>\r\n <td>&nbsp;&nbsp;</td>\r\n <td mc:edit='date' style='color: #fefefe; font-size: 11px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;'>\r\n <singleline>\r\n DATE\r\n </singleline>\r\n </td>\r\n </tr>\r\n </tbody></table>\r\n </td>\r\n </tr>\r\n </tbody></table>\r\n\r\n <table cellspacing='0' cellpadding='0' border='0' align='left' class='top-header-right'>\r\n <tbody><tr><td width='30' height='20'></td></tr>\r\n </tbody></table>\r\n\r\n \r\n </td>\r\n </tr>\r\n </tbody></table>\r\n</td>\r\n</tr>\r\n\r\n<tr bgcolor='#43B74A'><td height='10'></td></tr>\r\n\r\n</tbody></table>\r\n\r\n<!---------- end top header ------------>\r\n\r\n\r\n<!---------- main content----------->\r\n<table width='600' cellspacing='0' cellpadding='0' border='0' bgcolor='ececec' align='center' class='container '>\r\n\r\n\r\n <!--------- Header ---------->\r\n <tbody><tr bgcolor='ececec'><td height='40'></td></tr>\r\n\r\n <tr>\r\n <td>\r\n <table width='560' cellspacing='0' cellpadding='0' border='0' align='center' class='container-middle'>\r\n <tbody><tr>\r\n <td>\r\n <table cellspacing='0' cellpadding='0' border='0' align='left' class='logo'>\r\n <tbody><tr>\r\n <td align='center'>\r\n CULOGO\r\n </td>\r\n </tr>\r\n </tbody></table> \r\n <table cellspacing='0' cellpadding='0' border='0' align='left' class='nav'>\r\n <tbody><tr>\r\n <td width='20' height='20'></td>\r\n </tr>\r\n </tbody></table>\r\n \r\n </td>\r\n </tr>\r\n </tbody></table>\r\n</td>\r\n</tr>\r\n\r\n<tr bgcolor='ececec'><td height='40'></td></tr>\r\n<!---------- end header --------->\r\n\r\n\r\n<!--------- main section ---------> \r\n<tr>\r\n <td>\r\n <table width='560' cellspacing='0' cellpadding='0' border='0' align='center' class='container-middle'>\r\n\r\n <tbody><tr><td align='center'><img width='560' height='auto' style='display: block;' src='http://promailthemes.com/campaigner/layout1/white/blue/img/top-rounded-bg.png' alt='' class='top-bottom-bg'></td></tr>\r\n\r\n <tr bgcolor='#ffffff'><td height='7'></td></tr>\r\n\r\n\r\n <tr bgcolor='#ffffff'><td height='20'></td></tr>\r\n\r\n <tr bgcolor='#ffffff'>\r\n <td>\r\n <table width='100%' cellspacing='0' cellpadding='0' border='0' align='center' style='padding:0 15px' class='mainContent'>\r\n <tbody><tr> \r\n <td mc:edit='title1' class='main-header' style='color: #484848; font-size: 16px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;'>\r\n <multiline>\r\n <p>Hi FIRSTNAME<br>\r\nGreat to see that you found some products you like at <a href='http://projects.udaantechnologies.com/magentodev'>www.projects.udaantechnologies.com</a></p>\r\n\r\n<p>We noticed that you left your cart for XDAYSFROMSETTINGS days .</p>\r\n\r\n<p>We offer a free service that automatically alerts you when the price drops on the products in your abandoned cart. </p>\r\n\r\n<p>Simply click here and it will all be automatically set-up</p>\r\n\r\n<p>1CLICKSIGNUP</p>\r\n\r\n\r\n<p>Best regards<br>\r\n<a target='_blank' href='http://projects.udaantechnologies.com/magentodev'>www.projects.udaantechnologies.com</a></p>\r\n\r\n </multiline>\r\n </td>\r\n </tr>\r\n \r\n</tbody></table>\r\n</td>\r\n</tr>\r\n\r\n<tr bgcolor='ffffff'><td height='25'></td></tr>\r\n\r\n<tr><td align='center'><img width='560' height='auto' style='display: block;' src='http://promailthemes.com/campaigner/layout1/white/blue/img/bottom-rounded-bg.png' alt='' class='top-bottom-bg'></td></tr> \r\n\r\n</tbody></table>\r\n</td>\r\n</tr><!--------- end main section --------->\r\n\r\n\r\n<tr><td height='35'></td></tr>\r\n\r\n\r\n\r\n\r\n\r\n<!---------- prefooter --------->\r\n\r\n<tr>\r\n <td>\r\n <table width='560' cellspacing='0' cellpadding='0' border='0' align='center' class='container-middle'>\r\n <tbody><tr>\r\n <td>\r\n <table cellspacing='0' cellpadding='0' border='0' align='left' class='logo'>\r\n <tbody><tr>\r\n <td align='center'>\r\n <span style='float:left;'>PRICELIZERLOGO </span><span style='color: #989898; margin-left: 10px; float:left; line-height:79px;'></span>\r\n </td>\r\n </tr>\r\n \r\n \r\n </tbody></table> \r\n <table cellspacing='0' cellpadding='0' border='0' align='left'>\r\n <tbody><tr>\r\n <td width='20' height='20'></td>\r\n </tr>\r\n </tbody></table>\r\n <table cellspacing='0' cellpadding='0' border='0' align='right' class='nav'>\r\n <tbody><tr><td height='10'></td></tr>\r\n <tr>\r\n <td align='center' mc:edit='socials' style='font-size: 13px; font-family: Helvetica, Arial, sans-serif;'>\r\n \r\n </td>\r\n </tr>\r\n </tbody></table>\r\n </td>\r\n </tr>\r\n </tbody></table>\r\n </td>\r\n</tr><!---------- end prefooter --------->\r\n\r\n<tr><td height='40'></td></tr>\r\n<tr>\r\n <td align='center' mc:edit='copy1' style='color: #939393; font-size: 11px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;' class='prefooter-header'>\r\n<multiline>\r\n You are currently signed up as: <span style='color: #2f90e2'>email@email.com</span> to unsubscribe UNCLICK\r\n</multiline>\r\n</td>\r\n</tr> \r\n\r\n<tr><td height='30'></td></tr>\r\n\r\n<tr>\r\n <td align='center' mc:edit='copy2' style='color: #939393; font-size: 11px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;' class='prefooter-subheader'>\r\n\r\n</td>\r\n</tr>\r\n\r\n<tr><td height='30'></td></tr>\r\n</tbody></table>\r\n<!------------ end main Content ----------------->\r\n\r\n\r\n<!---------- footer --------->\r\n<table width='600' cellspacing='0' cellpadding='0' border='0' align='center' class='container'>\r\n <tbody><tr bgcolor='#43B74A'><td height='14'></td></tr>\r\n <tr bgcolor='#43B74A'>\r\n <td align='center' mc:edit='copy3' style='color: #fff; font-size: 10px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;'>\r\n <multiline>\r\n &copy; 2015 SITENAME\r\n </multiline>\r\n </td>\r\n </tr>\r\n\r\n <tr bgcolor='#43B74A' style=''>\r\n <td>&nbsp;</td>\r\n </tr>\r\n </tbody></table>\r\n<!--------- end footer --------->\r\n</td>\r\n</tr>\r\n\r\n<tr><td height='30'></td></tr>\r\n\r\n</tbody></table>\r\n</div>\r\n', 'abandoned_cart_template'),
126
+ (2, '<style>\r\n .container-middle, .section-item{ margin: auto; }\r\n</style>\r\n<div class='prmo-mail'>\r\n <table width='100%' cellspacing='0' cellpadding='0' border='0'>\r\n <tbody><tr><td height='30'></td></tr>\r\n <tr bgcolor='#43B74A'>\r\n <td width='100%' valign='top' bgcolor='#4c4e4e' align='center'>\r\n\r\n <!--------- top header ------------>\r\n <table width='600' cellspacing='0' cellpadding='0' border='0' align='center' class='container'>\r\n <tbody>\r\n <tr bgcolor='#43B74A' style='border-radius:5px 5px 0 0;' >\r\n <td>&nbsp;</td>\r\n </tr>\r\n <tr bgcolor='#43B74A'>\r\n <td height='5'></td>\r\n </tr>\r\n <tr bgcolor='#43B74A'>\r\n <td align='center'>\r\n <table width='560' cellspacing='0' cellpadding='0' border='0' align='center' class='container-middle' style='margin:0 auto;' >\r\n <tbody><tr>\r\n <td>\r\n <table cellspacing='0' cellpadding='0' border='0' align='left' class='top-header-left'>\r\n <tbody><tr>\r\n <td align='center'>\r\n <table cellspacing='0' cellpadding='0' border='0' class='date'>\r\n <tbody><tr>\r\n <td>\r\n <img width='13' alt='icon 1' src='http://promailthemes.com/campaigner/layout1/white/blue/img/icon-cal.png' style='display: block;' mc:edit='icon1' editable='true'>\r\n </td>\r\n <td>&nbsp;&nbsp;</td>\r\n <td style='color: #fefefe; font-size: 11px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;' mc:edit='date'>\r\n <singleline>\r\n DATE\r\n </singleline>\r\n </td>\r\n </tr>\r\n </tbody></table>\r\n </td>\r\n </tr>\r\n </tbody></table>\r\n\r\n <table cellspacing='0' cellpadding='0' border='0' align='left' class='top-header-right'>\r\n <tbody><tr><td width='30' height='20'></td></tr>\r\n </tbody></table>\r\n\r\n \r\n </td>\r\n </tr>\r\n </tbody></table>\r\n</td>\r\n</tr>\r\n\r\n<tr bgcolor='#43B74A'><td height='10'></td></tr>\r\n\r\n</tbody></table>\r\n\r\n<!---------- end top header ------------>\r\n\r\n\r\n<!---------- main content----------->\r\n<table width='600' cellspacing='0' cellpadding='0' border='0' bgcolor='ececec' align='center' class='container'>\r\n\r\n\r\n <!--------- Header ---------->\r\n <tbody><tr bgcolor='ececec'><td height='40'></td></tr>\r\n\r\n <tr>\r\n <td>\r\n <table width='560' cellspacing='0' cellpadding='0' border='0' align='center' class='container-middle'>\r\n <tbody><tr>\r\n <td>\r\n <table cellspacing='0' cellpadding='0' border='0' align='left' class='logo'>\r\n <tbody><tr>\r\n <td align='center'>\r\n CULOGO\r\n </td>\r\n </tr>\r\n </tbody></table> \r\n <table cellspacing='0' cellpadding='0' border='0' align='left' class='nav'>\r\n <tbody><tr>\r\n <td width='20' height='20'></td>\r\n </tr>\r\n </tbody></table>\r\n \r\n </td>\r\n </tr>\r\n </tbody></table>\r\n</td>\r\n</tr>\r\n\r\n<tr bgcolor='ececec'><td height='40'></td></tr>\r\n<!---------- end header --------->\r\n\r\n\r\n<!--------- main section ---------> \r\n<tr>\r\n <td>\r\n <table width='560' cellspacing='0' cellpadding='0' border='0' align='center' class='container-middle'>\r\n\r\n <tbody><tr><td align='center'><img width='560' height='auto' class='top-bottom-bg' alt='' src='http://promailthemes.com/campaigner/layout1/white/blue/img/top-rounded-bg.png' style='display: block;'></td></tr>\r\n\r\n <tr bgcolor='ffffff'><td height='7'></td></tr>\r\n\r\n\r\n <tr bgcolor='ffffff'><td height='20'></td></tr>\r\n\r\n <tr bgcolor='ffffff'>\r\n <td>\r\n <table width='528' cellspacing='0' cellpadding='0' border='0' align='center' class='mainContent'>\r\n <tbody><tr> \r\n <td style='color: #484848; font-size: 16px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;' class='main-header' mc:edit='title1'>\r\n <multiline>\r\n <p>Hi FIRSTNAME<br />\r\nThank you for your shown interest in the products that you have put into Your cart at <a href='http://projects.udaantechnologies.com/magentodev'>www.projects.udaantechnologies.com</a> with the following products</p>\r\n<p>PRODUCTNAME</p>\r\n\r\n<p>Click the buy button to place an order or contact us for any questions you might have. </p>\r\n\r\n<p>We work with <a href='http://Pricelizer.com' target='_blank'>Pricelizer.com</a> that offers automatic price alerts when the products already chosen by you drop in price.</p>\r\n\r\n<p>Best regards<br />\r\n<a href='http://projects.udaantechnologies.com/magentodev' target='_blank'>www.projects.udaantechnologies.com</a></p>\r\n\r\n </multiline>\r\n </td>\r\n </tr>\r\n \r\n</tbody></table>\r\n</td>\r\n</tr>\r\n\r\n<tr bgcolor='ffffff'><td height='25'></td></tr>\r\n\r\n<tr><td align='center'><img width='560' height='auto' class='top-bottom-bg' alt='' src='http://promailthemes.com/campaigner/layout1/white/blue/img/bottom-rounded-bg.png' style='display: block;'></td></tr> \r\n\r\n</tbody></table>\r\n</td>\r\n</tr><!--------- end main section --------->\r\n\r\n\r\n<tr><td height='35'></td></tr>\r\n\r\n<!---------- prefooter --------->\r\n\r\n<tr>\r\n <td>\r\n <table width='560' cellspacing='0' cellpadding='0' border='0' align='center' class='container-middle'>\r\n <tbody><tr>\r\n <td>\r\n <table cellspacing='0' cellpadding='0' border='0' align='left' class='logo'>\r\n <tbody><tr>\r\n <td align='center'>\r\n <span style=''float:left;''>PRICELIZERLOGO </span><span style=''color: #989898; margin-left: 10px; float:left; line-height:79px;''></span>\r\n </td>\r\n </tr>\r\n </tbody></table> \r\n <table cellspacing='0' cellpadding='0' border='0' align='left'>\r\n <tbody><tr>\r\n <td width='20' height='20'></td>\r\n </tr>\r\n </tbody></table>\r\n <table cellspacing='0' cellpadding='0' border='0' align='right' class='nav'>\r\n <tbody><tr><td height='10'></td></tr>\r\n <tr>\r\n <td align='center' style='font-size: 13px; font-family: Helvetica, Arial, sans-serif;' mc:edit='socials'>\r\n \r\n </td>\r\n </tr>\r\n </tbody></table>\r\n </td>\r\n </tr>\r\n </tbody></table>\r\n </td>\r\n</tr><!---------- end prefooter --------->\r\n\r\n<tr><td height='40'></td></tr>\r\n<tr>\r\n <td align='center' class='prefooter-header' style='color: #939393; font-size: 11px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;' mc:edit='copy1'>\r\n</td>\r\n</tr> \r\n<tr>\r\n <td align='center' class='prefooter-header' style='color: #939393; font-size: 11px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;' mc:edit='copy1'>\r\n</td>\r\n</tr> \r\n\r\n<tr><td height='30'></td></tr>\r\n\r\n<tr>\r\n <td align='center' class='prefooter-subheader' style='color: #939393; font-size: 11px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;' mc:edit='copy2'>\r\n\r\n</td>\r\n</tr>\r\n\r\n<tr><td height='30'></td></tr>\r\n</tbody></table>\r\n<!------------ end main Content ----------------->\r\n\r\n\r\n<!---------- footer --------->\r\n<table width='600' cellspacing='0' cellpadding='0' border='0' class='container' align='center'>\r\n <tbody><tr bgcolor='#43B74A'><td height='14'></td></tr>\r\n <tr bgcolor='#43B74A'>\r\n <td align='center' style='color: #fff; font-size: 10px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;' mc:edit='copy3'>\r\n <multiline>\r\n &copy; 2015 SITENAME.\r\n </multiline>\r\n </td>\r\n </tr>\r\n\r\n <tr bgcolor='#43B74A' style='' >\r\n <td>&nbsp;</td>\r\n </tr>\r\n </tbody></table>\r\n<!--------- end footer --------->\r\n</td>\r\n</tr>\r\n\r\n<tr><td height='30'></td></tr>\r\n\r\n</tbody></table>\r\n</div>\r\n', 'catched_user_template'),
127
+ (3, '<style>\r\n .container-middle, .section-item{ margin: auto; }\r\n</style>\r\n<div class='prmo-mail'>\r\n <table width='100%' cellspacing='0' cellpadding='0' border='0'>\r\n <tbody><tr><td height='30'></td></tr>\r\n <tr bgcolor='#43B74A'>\r\n <td width='100%' valign='top' bgcolor='#4c4e4e' align='center'>\r\n\r\n <!--------- top header ------------>\r\n <table width='600' cellspacing='0' cellpadding='0' border='0' align='center' class='container'>\r\n <tbody>\r\n <tr bgcolor='#43B74A' style=''border-radius:5px 5px 0 0;'' >\r\n <td>&nbsp;</td>\r\n </tr>\r\n <tr bgcolor='#43B74A'>\r\n <td height='5'></td>\r\n </tr>\r\n <tr bgcolor='#43B74A'>\r\n <td align='center'>\r\n <table width='560' cellspacing='0' cellpadding='0' border='0' align='center' class='container-middle' style=''margin:0 auto;'' >\r\n <tbody><tr>\r\n <td>\r\n <table cellspacing='0' cellpadding='0' border='0' align='left' class='top-header-left'>\r\n <tbody><tr>\r\n <td align='center'>\r\n <table cellspacing='0' cellpadding='0' border='0' class='date'>\r\n <tbody><tr>\r\n <td>\r\n <img width='13' alt='icon 1' src='http://promailthemes.com/campaigner/layout1/white/blue/img/icon-cal.png' style='display: block;' mc:edit='icon1' editable='true'>\r\n </td>\r\n <td>&nbsp;&nbsp;</td>\r\n <td style='color: #fefefe; font-size: 11px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;' mc:edit='date'>\r\n <singleline>\r\n DATE\r\n </singleline>\r\n </td>\r\n </tr>\r\n </tbody></table>\r\n </td>\r\n </tr>\r\n </tbody></table>\r\n\r\n <table cellspacing='0' cellpadding='0' border='0' align='left' class='top-header-right'>\r\n <tbody><tr><td width='30' height='20'></td></tr>\r\n </tbody></table>\r\n\r\n \r\n </td>\r\n </tr>\r\n </tbody></table>\r\n</td>\r\n</tr>\r\n\r\n<tr bgcolor='#43B74A'><td height='10'></td></tr>\r\n\r\n</tbody></table>\r\n\r\n<!---------- end top header ------------>\r\n\r\n\r\n<!---------- main content----------->\r\n<table width='600' cellspacing='0' cellpadding='0' border='0' bgcolor='ececec' align='center' class='container'>\r\n\r\n\r\n <!--------- Header ---------->\r\n <tbody><tr bgcolor='ececec'><td height='40'></td></tr>\r\n\r\n <tr>\r\n <td>\r\n <table width='560' cellspacing='0' cellpadding='0' border='0' align='center' class='container-middle'>\r\n <tbody><tr>\r\n <td>\r\n <table cellspacing='0' cellpadding='0' border='0' align='left' class='logo'>\r\n <tbody><tr>\r\n <td align='center'>\r\n CULOGO\r\n </td>\r\n </tr>\r\n </tbody></table> \r\n <table cellspacing='0' cellpadding='0' border='0' align='left' class='nav'>\r\n <tbody><tr>\r\n <td width='20' height='20'></td>\r\n </tr>\r\n </tbody></table>\r\n \r\n </td>\r\n </tr>\r\n </tbody></table>\r\n</td>\r\n</tr>\r\n\r\n<tr bgcolor='ececec'><td height='40'></td></tr>\r\n<!---------- end header --------->\r\n\r\n\r\n<!--------- main section ---------> \r\n<tr>\r\n <td>\r\n <table width='560' cellspacing='0' cellpadding='0' border='0' align='center' class='container-middle'>\r\n\r\n <tbody><tr><td align='center'><img width='560' height='auto' class='top-bottom-bg' alt='' src='http://promailthemes.com/campaigner/layout1/white/blue/img/top-rounded-bg.png' style='display: block;'></td></tr>\r\n\r\n <tr bgcolor='#ffffff'><td height='7'></td></tr>\r\n\r\n\r\n <tr bgcolor='#ffffff'><td height='20'></td></tr>\r\n\r\n <tr bgcolor='#ffffff'>\r\n <td>\r\n <table width='100%' cellspacing='0' cellpadding='0' border='0' align='center' class='mainContent' style=''padding:0 15px'' >\r\n <tbody><tr> \r\n <td style='color: #484848; font-size: 16px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;' class='main-header' mc:edit='title1'>\r\n <multiline>\r\n <p>Hi FIRSTNAME<br />\r\nThank you for visiting <a href='http://projects.udaantechnologies.com/magentodev'>www.projects.udaantechnologies.com</a></p>\r\n\r\n<p>We are sorry that you left yesterday, and would like to offer you a service that we hope you will like: When the products you left in your cart drop in price, we can email you. </p>\r\n\r\n<p>Now you don''t have to think about when the products you liked drop in price. Just click here:</p>\r\n\r\n\r\n<p>1CLICKSIGNUP</p>\r\n\r\n<p>To monitor these products in your cart:</p>\r\n<p>PRODUCTLIST</p>\r\n\r\n<p>Best regards<br />\r\n\r\n<a href='http://projects.udaantechnologies.com/magentodev' target='_blank'>www.projects.udaantechnologies.com</a></p>\r\n\r\n </multiline>\r\n </td>\r\n </tr>\r\n \r\n</tbody></table>\r\n</td>\r\n</tr>\r\n\r\n<tr bgcolor='ffffff'><td height='25'></td></tr>\r\n\r\n<tr><td align='center'><img width='560' height='auto' class='top-bottom-bg' alt='' src='http://promailthemes.com/campaigner/layout1/white/blue/img/bottom-rounded-bg.png' style='display: block;'></td></tr> \r\n\r\n</tbody></table>\r\n</td>\r\n</tr><!--------- end main section --------->\r\n\r\n\r\n<tr><td height='35'></td></tr>\r\n\r\n\r\n\r\n\r\n\r\n<!---------- prefooter --------->\r\n\r\n<tr>\r\n <td>\r\n <table width='560' cellspacing='0' cellpadding='0' border='0' align='center' class='container-middle'>\r\n <tbody><tr>\r\n <td>\r\n <table cellspacing='0' cellpadding='0' border='0' align='left' class='logo'>\r\n <tbody><tr>\r\n <td align='center'>\r\n <span style=''float:left;''>PRICELIZERLOGO </span><span style=''color: #989898; margin-left: 10px; float:left; line-height:79px;''></span>\r\n </td>\r\n </tr>\r\n \r\n \r\n </tbody></table> \r\n <table cellspacing='0' cellpadding='0' border='0' align='left'>\r\n <tbody><tr>\r\n <td width='20' height='20'></td>\r\n </tr>\r\n </tbody></table>\r\n <table cellspacing='0' cellpadding='0' border='0' align='right' class='nav'>\r\n <tbody><tr><td height='10'></td></tr>\r\n <tr>\r\n <td align='center' style='font-size: 13px; font-family: Helvetica, Arial, sans-serif;' mc:edit='socials'>\r\n \r\n </td>\r\n </tr>\r\n </tbody></table>\r\n </td>\r\n </tr>\r\n </tbody></table>\r\n </td>\r\n</tr><!---------- end prefooter --------->\r\n\r\n<tr><td height='40'></td></tr>\r\n<tr>\r\n <td align='center' class='prefooter-header' style='color: #939393; font-size: 11px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;' mc:edit='copy1'>\r\n<multiline>\r\n You are currently signed up as: <span style='color: #2f90e2'>email@email.com</span> to unsubscribe UNCLICK\r\n</multiline>\r\n</td>\r\n</tr> \r\n\r\n<tr><td height='30'></td></tr>\r\n\r\n<tr>\r\n <td align='center' class='prefooter-subheader' style='color: #939393; font-size: 11px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;' mc:edit='copy2'>\r\n\r\n</td>\r\n</tr>\r\n\r\n<tr><td height='30'></td></tr>\r\n</tbody></table>\r\n<!------------ end main Content ----------------->\r\n\r\n\r\n<!---------- footer --------->\r\n<table width='600' cellspacing='0' cellpadding='0' border='0' class='container' align='center'>\r\n <tbody><tr bgcolor='#43B74A'><td height='14'></td></tr>\r\n <tr bgcolor='#43B74A'>\r\n <td align='center' style='color: #fff; font-size: 10px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;' mc:edit='copy3'>\r\n <multiline>\r\n &copy; 2015 SITENAME.\r\n </multiline>\r\n </td>\r\n </tr>\r\n\r\n <tr bgcolor='#43B74A' style='' >\r\n <td>&nbsp;</td>\r\n </tr>\r\n </tbody></table>\r\n<!--------- end footer --------->\r\n</td>\r\n</tr>\r\n\r\n<tr><td height='30'></td></tr>\r\n\r\n</tbody></table>\r\n</div>\r\n', 'reminder_template');
128
+
129
+ ");
130
+
131
+ $installer->endSetup();
132
+ ?>
app/code/community/Priceliz/Statistics/Helper/Data.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ class Priceliz_Statistics_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+
5
+
6
+ }
7
+ ?>
app/code/community/Priceliz/Statistics/Model/Observer.php ADDED
File without changes
app/code/community/Priceliz/Statistics/controllers/FrontController.php ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //-------------------------------DB Connection------------------------------------------------//
3
+ $config = Mage::getConfig()->getResourceConnectionConfig("default_setup");
4
+ $_host = $config->host;
5
+ $_uname = $config->username;
6
+ $_pass = $config->password;
7
+ $_dbname = $config->dbname;
8
+ $_host; ///likewise
9
+ $db_handle = mysql_connect($_host , $_uname, $_pass);
10
+ $db_found = mysql_select_db($_dbname, $db_handle);
11
+ //-------------------------------End DB Connection------------------------------------------------//
12
+
13
+ class RestRequest
14
+ {
15
+ protected $url;
16
+ protected $verb;
17
+ protected $requestBody;
18
+ protected $requestLength;
19
+ protected $username;
20
+ protected $password;
21
+ protected $acceptType;
22
+ public $responseBody;
23
+ protected $responseInfo;
24
+ protected $contentType;
25
+
26
+ public function __construct ($url = null, $verb = 'GET', $requestBody = null)
27
+ {
28
+ $this->url = $url;
29
+ $this->verb = $verb;
30
+ $this->requestBody = $requestBody;
31
+ $this->requestLength = 0;
32
+ $this->username = null;
33
+ $this->password = null;
34
+ $this->acceptType = 'application/json';
35
+ $this->contentType = 'application/x-www-form-urlencoded';
36
+ $this->responseBody = null;
37
+ $this->responseInfo = null;
38
+
39
+ if ($this->requestBody !== null)
40
+ {
41
+ $this->buildPostBody();
42
+ }
43
+ }
44
+
45
+ public function flush ()
46
+ {
47
+ $this->requestBody = null;
48
+ $this->requestLength = 0;
49
+ $this->verb = 'GET';
50
+ $this->responseBody = null;
51
+ $this->responseInfo = null;
52
+ }
53
+
54
+ public function execute ()
55
+ {
56
+ $ch = curl_init();
57
+ $this->setAuth($ch);
58
+
59
+ try
60
+ {
61
+ switch (strtoupper($this->verb))
62
+ {
63
+ case 'GET':
64
+ $this->executeGet($ch);
65
+ break;
66
+ case 'POST':
67
+ $this->executePost($ch);
68
+ break;
69
+ case 'PUT':
70
+ $this->executePut($ch);
71
+ break;
72
+ case 'DELETE':
73
+ $this->executeDelete($ch);
74
+ break;
75
+ default:
76
+ throw new InvalidArgumentException('Current verb (' . $this->verb . ') is an invalid REST verb.');
77
+ }
78
+ }
79
+ catch (InvalidArgumentException $e)
80
+ {
81
+ curl_close($ch);
82
+ throw $e;
83
+ }
84
+ catch (Exception $e)
85
+ {
86
+ curl_close($ch);
87
+ throw $e;
88
+ }
89
+ }
90
+
91
+ public function buildPostBody ($data = null)
92
+ {
93
+ $data = ($data !== null) ? $data : $this->requestBody;
94
+
95
+ if (!is_array($data))
96
+ {
97
+ throw new InvalidArgumentException('Invalid data input for postBody. Array expected');
98
+ }
99
+
100
+ $data = http_build_query($data, '', '&');
101
+ $this->requestBody = $data;
102
+ }
103
+
104
+ protected function executeGet ($ch)
105
+ {
106
+ $this->doExecute($ch);
107
+ }
108
+
109
+ protected function executePost ($ch)
110
+ {
111
+ if (!is_string($this->requestBody))
112
+ {
113
+ $this->buildPostBody();
114
+ }
115
+
116
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $this->requestBody);
117
+ curl_setopt($ch, CURLOPT_POST, 1);
118
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: application/x-www-form-urlencoded"));
119
+
120
+ $this->doExecute($ch);
121
+ }
122
+
123
+ protected function executePut ($ch)
124
+ {
125
+ if (!is_string($this->requestBody))
126
+ {
127
+ $this->buildPostBody();
128
+ }
129
+
130
+ $this->requestLength = strlen($this->requestBody);
131
+
132
+ $fh = fopen('php://temp', 'rw+');
133
+ fwrite($fh, $this->requestBody);
134
+ rewind($fh);
135
+
136
+ curl_setopt($ch, CURLOPT_INFILE, $fh);
137
+ curl_setopt($ch, CURLOPT_INFILESIZE, $this->requestLength);
138
+ curl_setopt($ch, CURLOPT_PUT, true);
139
+
140
+ $this->doExecute($ch);
141
+
142
+ fclose($fh);
143
+ }
144
+
145
+ protected function executeDelete ($ch)
146
+ {
147
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
148
+
149
+ $this->doExecute($ch);
150
+ }
151
+
152
+ protected function doExecute (&$curlHandle)
153
+ {
154
+ $this->setCurlOpts($curlHandle);
155
+ $this->responseBody = curl_exec($curlHandle);
156
+ $this->responseInfo = curl_getinfo($curlHandle);
157
+
158
+ curl_close($curlHandle);
159
+ }
160
+
161
+ protected function setCurlOpts (&$curlHandle)
162
+ {
163
+ curl_setopt($curlHandle, CURLOPT_TIMEOUT, 10);
164
+ curl_setopt($curlHandle, CURLOPT_URL, $this->url);
165
+ curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
166
+ curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array ('Accept: ' . $this->acceptType));
167
+ curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array ('Content-Type: ' . $this->contentType));
168
+
169
+ //curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, false);
170
+ }
171
+
172
+ protected function setAuth (&$curlHandle)
173
+ {
174
+ if ($this->username !== null && $this->password !== null)
175
+ {
176
+ curl_setopt($curlHandle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
177
+ curl_setopt($curlHandle, CURLOPT_USERPWD, $this->username . ':' . $this->password);
178
+ }
179
+ }
180
+ }
181
+
182
+ class Priceliz_Statistics_FrontController extends Mage_Core_Controller_Front_Action
183
+ {
184
+ public function salesAction()
185
+ {
186
+ echo $_GET['total_amount'];
187
+ $prod_arr = array('total_amount'=>$_GET['total_amount'],'liscence_key'=>$_GET['liscence_key']);
188
+ print_r($prod_arr);
189
+ $url ="http://staging.pricelizer.com/webService/setSales/";
190
+ $request = new RestRequest($url,'POST',$prod_arr);
191
+ echo '<pre>';print_r($request);
192
+ $request->execute();
193
+ $config = Mage::getConfig()->getResourceConnectionConfig("default_setup");
194
+
195
+ $req=json_decode($request->responseBody,true);
196
+ print_r($req);
197
+
198
+ }
199
+
200
+
201
+
202
+
203
+
204
+ }
205
+ ?>
app/code/community/Priceliz/Statistics/controllers/FrontsalesController.php ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //-------------------------------DB Connection------------------------------------------------//
3
+ $config = Mage::getConfig()->getResourceConnectionConfig("default_setup");
4
+ $_host = $config->host;
5
+ $_uname = $config->username;
6
+ $_pass = $config->password;
7
+ $_dbname = $config->dbname;
8
+ $_host; ///likewise
9
+ $db_handle = mysql_connect($_host , $_uname, $_pass);
10
+ $db_found = mysql_select_db($_dbname, $db_handle);
11
+ //-------------------------------End DB Connection------------------------------------------------//
12
+
13
+ class RestRequest
14
+ {
15
+ protected $url;
16
+ protected $verb;
17
+ protected $requestBody;
18
+ protected $requestLength;
19
+ protected $username;
20
+ protected $password;
21
+ protected $acceptType;
22
+ public $responseBody;
23
+ protected $responseInfo;
24
+ protected $contentType;
25
+
26
+ public function __construct ($url = null, $verb = 'GET', $requestBody = null)
27
+ {
28
+ $this->url = $url;
29
+ $this->verb = $verb;
30
+ $this->requestBody = $requestBody;
31
+ $this->requestLength = 0;
32
+ $this->username = null;
33
+ $this->password = null;
34
+ $this->acceptType = 'application/json';
35
+ $this->contentType = 'application/x-www-form-urlencoded';
36
+ $this->responseBody = null;
37
+ $this->responseInfo = null;
38
+
39
+ if ($this->requestBody !== null)
40
+ {
41
+ $this->buildPostBody();
42
+ }
43
+ }
44
+
45
+ public function flush ()
46
+ {
47
+ $this->requestBody = null;
48
+ $this->requestLength = 0;
49
+ $this->verb = 'GET';
50
+ $this->responseBody = null;
51
+ $this->responseInfo = null;
52
+ }
53
+
54
+ public function execute ()
55
+ {
56
+ $ch = curl_init();
57
+ $this->setAuth($ch);
58
+
59
+ try
60
+ {
61
+ switch (strtoupper($this->verb))
62
+ {
63
+ case 'GET':
64
+ $this->executeGet($ch);
65
+ break;
66
+ case 'POST':
67
+ $this->executePost($ch);
68
+ break;
69
+ case 'PUT':
70
+ $this->executePut($ch);
71
+ break;
72
+ case 'DELETE':
73
+ $this->executeDelete($ch);
74
+ break;
75
+ default:
76
+ throw new InvalidArgumentException('Current verb (' . $this->verb . ') is an invalid REST verb.');
77
+ }
78
+ }
79
+ catch (InvalidArgumentException $e)
80
+ {
81
+ curl_close($ch);
82
+ throw $e;
83
+ }
84
+ catch (Exception $e)
85
+ {
86
+ curl_close($ch);
87
+ throw $e;
88
+ }
89
+ }
90
+
91
+ public function buildPostBody ($data = null)
92
+ {
93
+ $data = ($data !== null) ? $data : $this->requestBody;
94
+
95
+ if (!is_array($data))
96
+ {
97
+ throw new InvalidArgumentException('Invalid data input for postBody. Array expected');
98
+ }
99
+
100
+ $data = http_build_query($data, '', '&');
101
+ $this->requestBody = $data;
102
+ }
103
+
104
+ protected function executeGet ($ch)
105
+ {
106
+ $this->doExecute($ch);
107
+ }
108
+
109
+ protected function executePost ($ch)
110
+ {
111
+ if (!is_string($this->requestBody))
112
+ {
113
+ $this->buildPostBody();
114
+ }
115
+
116
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $this->requestBody);
117
+ curl_setopt($ch, CURLOPT_POST, 1);
118
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: application/x-www-form-urlencoded"));
119
+
120
+ $this->doExecute($ch);
121
+ }
122
+
123
+ protected function executePut ($ch)
124
+ {
125
+ if (!is_string($this->requestBody))
126
+ {
127
+ $this->buildPostBody();
128
+ }
129
+
130
+ $this->requestLength = strlen($this->requestBody);
131
+
132
+ $fh = fopen('php://temp', 'rw+');
133
+ fwrite($fh, $this->requestBody);
134
+ rewind($fh);
135
+
136
+ curl_setopt($ch, CURLOPT_INFILE, $fh);
137
+ curl_setopt($ch, CURLOPT_INFILESIZE, $this->requestLength);
138
+ curl_setopt($ch, CURLOPT_PUT, true);
139
+
140
+ $this->doExecute($ch);
141
+
142
+ fclose($fh);
143
+ }
144
+
145
+ protected function executeDelete ($ch)
146
+ {
147
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
148
+
149
+ $this->doExecute($ch);
150
+ }
151
+
152
+ protected function doExecute (&$curlHandle)
153
+ {
154
+ $this->setCurlOpts($curlHandle);
155
+ $this->responseBody = curl_exec($curlHandle);
156
+ $this->responseInfo = curl_getinfo($curlHandle);
157
+
158
+ curl_close($curlHandle);
159
+ }
160
+
161
+ protected function setCurlOpts (&$curlHandle)
162
+ {
163
+ curl_setopt($curlHandle, CURLOPT_TIMEOUT, 10);
164
+ curl_setopt($curlHandle, CURLOPT_URL, $this->url);
165
+ curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
166
+ curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array ('Accept: ' . $this->acceptType));
167
+ curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array ('Content-Type: ' . $this->contentType));
168
+
169
+ //curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, false);
170
+ }
171
+
172
+ protected function setAuth (&$curlHandle)
173
+ {
174
+ if ($this->username !== null && $this->password !== null)
175
+ {
176
+ curl_setopt($curlHandle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
177
+ curl_setopt($curlHandle, CURLOPT_USERPWD, $this->username . ':' . $this->password);
178
+ }
179
+ }
180
+ }
181
+
182
+ class Priceliz_Statistics_FrontsalesController extends Mage_Core_Controller_Front_Action
183
+ {
184
+ public function frontsalesAction()
185
+ {
186
+ echo $_GET['total_amount'];
187
+ $prod_arr = array('total_amount'=>$_GET['total_amount'],'liscence_key'=>$_GET['liscence_key']);
188
+ print_r($prod_arr);
189
+ $url ="http://staging.pricelizer.com/webService/setSales/";
190
+ $request = new RestRequest($url,'POST',$prod_arr);
191
+ echo '<pre>';print_r($request);
192
+ $request->execute();
193
+ $config = Mage::getConfig()->getResourceConnectionConfig("default_setup");
194
+
195
+ $req=json_decode($request->responseBody,true);
196
+ print_r($req);
197
+
198
+ }
199
+
200
+
201
+
202
+
203
+
204
+ }
205
+ ?>
app/code/community/Priceliz/Statistics/controllers/IndexController.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Priceliz_Statistics_IndexController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+
7
+ $this->loadLayout();
8
+
9
+ $this->_addContent($block);
10
+ $this->_addContent($this->getLayout()->createBlock('adminhtml/template')
11
+ ->setTemplate('pricelizerstatistics/pricelizerstatistics.phtml'));
12
+
13
+ $this->_setActiveMenu('priceliz_statistics')->renderLayout();
14
+ }
15
+
16
+
17
+ public function statisticsAction()
18
+ {
19
+
20
+ $this->loadLayout()
21
+ ->_setActiveMenu('priceliz_statistics')
22
+ ->_title($this->__('Statistics View'));
23
+
24
+ // my stuff
25
+ $this->_addContent($block);
26
+ $this->_addContent($this->getLayout()->createBlock('adminhtml/template')
27
+ ->setTemplate('pricelizerstatistics/statisticsview.phtml'));
28
+
29
+ $this->renderLayout();
30
+
31
+
32
+ }
33
+
34
+
35
+ public function layerGrapghAction()
36
+ {
37
+
38
+ $this->loadLayout()
39
+ ->_setActiveMenu('priceliz_statistics')
40
+ ->_title($this->__('Statistics Layer Grapgh'));
41
+
42
+ // my stuff
43
+ $this->_addContent($block);
44
+ $this->_addContent($this->getLayout()->createBlock('adminhtml/template')
45
+ ->setTemplate('pricelizerstatistics/statistics_layergrapgh.phtml'));
46
+
47
+ $this->renderLayout();
48
+
49
+
50
+ }
51
+
52
+
53
+ public function nonRegAction()
54
+ {
55
+
56
+ $this->loadLayout()
57
+ ->_setActiveMenu('priceliz_statistics')
58
+ ->_title($this->__('Non Registered user statistics'));
59
+
60
+ // my stuff
61
+ $this->_addContent($block);
62
+ $this->_addContent($this->getLayout()->createBlock('adminhtml/template')
63
+ ->setTemplate('pricelizerstatistics/non_resgistered_statistics.phtml'));
64
+
65
+ $this->renderLayout();
66
+
67
+
68
+ }
69
+
70
+
71
+
72
+
73
+ }
74
+ ?>
app/code/community/Priceliz/Statistics/etc/adminhtml.xml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <config>
3
+ <menu>
4
+ <priceliz_statistics translate="title" module="statistics">
5
+ <title>Reports</title>
6
+ <sort_order>9999</sort_order>
7
+
8
+ <children>
9
+ <index module="statistics" translate="title">
10
+ <title>Reports</title>
11
+ <sort_order>1</sort_order>
12
+ <action>statistics/index/index</action>
13
+ </index>
14
+
15
+ <trackip module="statistics" translate="title">
16
+ <title>Non Registered user statistics</title>
17
+ <sort_order>2</sort_order>
18
+ <action>statistics/index/nonReg</action>
19
+ </trackip>
20
+
21
+ <list module="statistics" translate="title">
22
+ <title>Statistics</title>
23
+ <sort_order>3</sort_order>
24
+ <action>statistics/index/statistics</action>
25
+ </list>
26
+
27
+ <layer module="statistics" translate="title">
28
+ <title>Statistics layered graph</title>
29
+ <sort_order>4</sort_order>
30
+ <action>statistics/index/layerGrapgh</action>
31
+ </layer>
32
+ </children>
33
+
34
+
35
+ </priceliz_statistics>
36
+ </menu>
37
+ </config>
38
+
app/code/community/Priceliz/Statistics/etc/config.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <priceliz_statistics>
5
+ <version>1.0.0</version>
6
+ <depends>
7
+ <!-- no dependencies -->
8
+ </depends>
9
+ </priceliz_statistics>
10
+ </modules>
11
+ <global>
12
+ <models/>
13
+ <blocks/>
14
+ <resources/>
15
+ <extraconfig />
16
+ <helpers>
17
+ <statistics>
18
+ <class>Priceliz_Statistics_Helper</class>
19
+ </statistics>
20
+ </helpers>
21
+ </global>
22
+ <admin>
23
+ <routers>
24
+ <priceliz_statistics>
25
+ <use>admin</use>
26
+ <args>
27
+ <module>Priceliz_Statistics</module>
28
+ <frontName>statistics</frontName>
29
+ </args>
30
+ </priceliz_statistics>
31
+ </routers>
32
+ </admin>
33
+ </config>
app/design/adminhtml/default/default/template/Abandoncart/abandoncart - keyur.phtml ADDED
@@ -0,0 +1,1558 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+
27
+ ?>
28
+ <?php
29
+ /**
30
+ * @var $this Mage_Currencysymbol_Block_Adminhtml_System_Currencysymbol
31
+ */
32
+ ?>
33
+ <style>
34
+ .grid h1.title-name{font-size:14px; text-transform:capitalize; float:left;margin-right:10px;}
35
+ .invite_link{font-weight:bold; text-decoration:none;}
36
+ .invite_link:hover{font-weight:bold; text-decoration:underline;}
37
+ .purche-remind{ color: #337ab7; }
38
+ .purche-remind:hover{ color: #2e6da4; }
39
+ a.price_alert {
40
+ background: #EA7601;
41
+ color: #FFFFFF;
42
+ margin-bottom: 10px;
43
+ padding: 5px 10px;
44
+ text-align: right;
45
+ text-decoration: none; border-radius:5px;
46
+ }
47
+ a.price_alert:hover{color: #FFFFFF; background:orange;}
48
+ .email_send{color:#66a202;}
49
+ .email_not_send{color:#ff0000;}
50
+ table.data td{font-size:0.9em;}
51
+ .cont-mang{
52
+ width: 100%;
53
+ float: left;
54
+ }
55
+ a.for-hover:hover{ background:none repeat scroll 0 0 rgba(68, 161, 205, 0.6)!important; }
56
+ .data input[type="text"]{
57
+ width: 80%;
58
+ }
59
+ .grid {
60
+ float: left;
61
+ width: 100%;
62
+ }
63
+ .app-title-name{text-align:center; padding:10px; /*font-size:24px;*/ color:#eb5e00;}
64
+
65
+ .click-price{width:100%; height:30px; text-align:center;}
66
+
67
+ .setting-from{ width:250px; margin:0px auto; height:50px;}
68
+ .setting-from .man{ width:100px; float:left; font-size:14px;}
69
+ .setting-from .auto{ width:100px; float:left; font-size:14px;}
70
+ .form_content {
71
+ border: 1px solid #EB5E00;
72
+ box-shadow: 0 0 3px #DDDDDD;
73
+ padding: 30px;
74
+ text-align: center;
75
+
76
+
77
+ }
78
+ .form_content input {
79
+ height: 40px;
80
+ margin-bottom: 10px;
81
+ width: 100%;
82
+
83
+ }
84
+ .form_content button {
85
+ padding:10px;
86
+ }
87
+ .align_center{
88
+ margin:0 auto;
89
+ width:30%;
90
+ margin-top:90px;
91
+ text-align:center;
92
+
93
+ }
94
+ .align_center h2{
95
+ color:#EB5E00;
96
+ }
97
+ .setting-from .man {
98
+ float: left;
99
+ font-size: 14px;
100
+ width: 100%;
101
+ }
102
+ .setting-from .auto {
103
+ float: left;
104
+ font-size: 14px;
105
+ font-weight: bold;
106
+ margin-top: 4px;
107
+ width: auto;
108
+ margin-left:76px;
109
+ }
110
+ .setting-from {
111
+ height: 50px;
112
+ margin: 0 auto;
113
+ width: 330px;
114
+ }
115
+ .man > h3{
116
+ float: left;
117
+ margin-right: 10px;
118
+ }
119
+ .man .auto label{ margin-left: 5px; }
120
+ .btn_manage{
121
+ text-align:center;
122
+ }
123
+ .btn_manage select{
124
+ width:200px;
125
+ height:20px;
126
+ margin-bottom:5px;
127
+ }
128
+ .btn_align{
129
+ text-align:center;
130
+ }
131
+ #set_form{margin-top:5px;}
132
+ </style>
133
+ <style type="text/css">
134
+ .white_content {
135
+ background-color: #ffffff;
136
+ border: 5px solid ;
137
+ height: 50%;
138
+ left: 25%;
139
+ max-height: 500px;
140
+ overflow: auto;
141
+ padding: 13px 15px;
142
+ position: fixed;
143
+ top: 20%;
144
+ width: 50%;
145
+ z-index: 1008;
146
+ display:none;
147
+ }
148
+ .close-btn
149
+ {
150
+ font-size:20px;
151
+ float:right;
152
+ }
153
+
154
+
155
+ .pagination {
156
+ border-radius: 4px;
157
+ display: inline-block;
158
+ margin: 0px;
159
+ padding-left: 0;
160
+ }
161
+ .pagination > li {
162
+ display: inline;
163
+ }
164
+
165
+ .pagination > li:first-child > a, .pagination > li:first-child > span {
166
+ border-bottom-left-radius: 4px;
167
+ border-top-left-radius: 4px;
168
+ margin-left: 0;
169
+ }
170
+
171
+ .pagination > li, .pagination > li > span {
172
+ background-color: #fff;
173
+ border: 1px solid #ddd;
174
+ color: #428bca;
175
+ float: left;
176
+ line-height: 1.42857;
177
+ margin-left: -1px;
178
+ padding: 6px 12px;
179
+ position: relative;
180
+ text-decoration: none;
181
+ }
182
+
183
+
184
+
185
+ .page{
186
+ /*float:left;*/
187
+ background-color: transparent /*#fff*/;
188
+ border: none;
189
+ color: #000;
190
+ line-height: 1.42857;
191
+ margin-left: -1px;
192
+ padding: 6px 12px;
193
+ position: relative;
194
+ text-decoration: none;
195
+ text-align: center;
196
+ }
197
+ .centrick{width:275px; margin:0px auto;}
198
+ .centrick:after{clear:both;}
199
+ #img_link{height:150px;}
200
+ </style>
201
+
202
+ <?php
203
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read') ;
204
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
205
+ $logo_src = Mage::getDesign()->getSkinUrl('images/',array('_area'=>'frontend/rwd'));
206
+ $remove_base = $logo_src.'logo.gif';
207
+ $logo_url_data = str_replace('/base','',$remove_base);
208
+ $logo_url = $img_logo;
209
+ $store_url = Mage::getBaseUrl();
210
+ $site_name_mag = Mage::app()->getStore()->getFrontendName();
211
+ $site_name_magento = '<a href="'.$store_url.'" style="color:white">'.$site_name_mag.'</a>';
212
+ $this->getSkinUrl('images/powered-by-pricelizer.png',array('_secure'=>true));
213
+ $getResult = $read_data->fetchAll("select * from Abandon_cart_licensekey");
214
+ $lisc_key = $getResult['0']['license_key'];
215
+ $loginUrl = 'http://www.pricelizer.com/webService/getLogo?liscence_key='.$lisc_key.'';
216
+ $agent= 'Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)';
217
+ $ch = curl_init();
218
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
219
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
220
+ curl_setopt($ch, CURLOPT_URL,$loginUrl);
221
+ curl_setopt($ch, CURLOPT_USERAGENT, $agent);
222
+ $result=curl_exec($ch);
223
+ curl_close($ch);
224
+ $result=json_decode($result);
225
+ $customer_logo = $result->{'logo'}; // 12345
226
+ $img_logo = '<img src="'.$customer_logo.'">';
227
+
228
+
229
+ ?>
230
+
231
+ <?php
232
+
233
+ // Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
234
+ //echo $this->getSkinUrl('images/logo.gif', array('_secure'=>true));
235
+ $smtp = Mage::getBaseDir().'/smtp/class.phpmailer.php';
236
+ $smtp2 = Mage::getBaseDir().'/smtp/class.smtp.php';
237
+ include($smtp); ?>
238
+ <?php include($smtp2); ?>
239
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
240
+ <script> jQuery.noConflict(); </script>
241
+ <?php
242
+
243
+ $result10 = $read_data->fetchAll("select * from Abandon_cart_licensekey");
244
+ $footer_img = $read_data->fetchAll("select * from core_config_data");
245
+
246
+ $magento_footer_icon = $footer_img['101']['value'];
247
+ $logo_src = Mage::getDesign()->getSkinUrl('',array('_area'=>'frontend/rwd'));
248
+ $logo_url_data = str_replace('/base','',$magento_footer_icon);
249
+ //echo $pricelizer_link = '<img src="'.$logo_src.$logo_url_data.'">';
250
+
251
+
252
+ $registered_user_email = $result10['0']['user_email'];
253
+ $registered_user_license_key = $result10['0']['license_key'];
254
+ echo '<input type="hidden" id ="reg_user_email" value="'.$registered_user_email.'">';
255
+ echo '<input type="hidden" id ="reg_user_lkey" value="'.$registered_user_license_key.'">';
256
+ ?>
257
+ <input type="hidden" id ="mage_find" value="<?php echo Mage::helper("greenmodule")->find_mage(); ?>">
258
+ <?php
259
+ $read4 = Mage::getSingleton('core/resource')->getConnection('core_read') ;
260
+ $write4 = Mage::getSingleton('core/resource')->getConnection('core_write');
261
+ $result5 = $read4->fetchAll("SELECT * FROM log_url_info where url_id ='14'");
262
+ $result_data = $read4->fetchAll("select * from abandoned_extensionsetting");
263
+ //print_r($result_data);
264
+ $base_url = $result5['0']['url'];
265
+ if ($result_data['6']['status'] == 'yes')
266
+ {
267
+ ?>
268
+ <script>
269
+ jQuery(document).ready(function(){
270
+ jQuery(window).load(function() {
271
+ var reg_user_email = jQuery('#reg_user_email').val();
272
+ var reg_user_lkey = jQuery('#reg_user_lkey').val();
273
+ var mage_find = jQuery('#mage_find').val();
274
+ fromData = 'reg_user_email='+reg_user_email+'&reg_user_lkey='+reg_user_lkey+'&mage_find='+mage_find;
275
+ jQuery.ajax({
276
+ type: 'POST',
277
+ data:fromData,
278
+ url:"http://localhost/magento19/package_setting.php",
279
+ success:function(result){
280
+ var obj = jQuery.parseJSON(result);
281
+ var user_id =obj.data.user_id;
282
+ var package_type = obj.data.package_name;
283
+ jQuery("#user_id").val(user_id);
284
+ jQUery("#pack_name").val(package_type);
285
+
286
+ }
287
+ });
288
+
289
+
290
+
291
+
292
+ });
293
+ });
294
+ </script>
295
+ <?php } ?>
296
+ <input type="hidden" value ="" id="user_id" name ="reg_id">
297
+ <input type ="hidden" value ="" id ="pack_name" name ="pur_ext">
298
+ <div class="content-header">
299
+ <?php echo '<h3 class="icon-head head-report-shopcart-abandoned">Abandoned carts</h3>'; ?>
300
+ <table cellspacing="0">
301
+ <tr>
302
+ <!--<td style="width:50%;"><h3 class="icon-head head-system-currency"><?php echo $this->getHeader() ?></h3></td>
303
+ <td class="form-buttons"> -->
304
+ <?php
305
+ echo $this->getSaveButtonHtml();
306
+ ?>
307
+ </td>
308
+ </tr>
309
+ </table>
310
+ </div>
311
+
312
+ <?php
313
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read') ;
314
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
315
+ $result_data = $read_data->fetchAll("select * from Abandon_cart_licensekey");
316
+ //print_r($result_data);
317
+ $user_email = $result_data['0']['user_email'];
318
+ $license_key = $result_data['0']['license_key'];
319
+ $start_date = $result_data['0']['start_date'];
320
+ $end_date = $result_data['0']['end_date'];
321
+ $duration_type = $result_data['0']['duration_type'];
322
+ $packagename = $result_data['0']['package_name'];
323
+ $current_date = Mage::getModel('core/date')->date('Y-m-d');
324
+ $items = Mage::getModel('sales/order')->getCollection()
325
+ ->join(array('item' => 'sales/order_item'), 'main_table.entity_id = item.order_id')
326
+ ->addFieldToFilter('customer_id', $customerId);
327
+ if($license_key!="")
328
+ {
329
+
330
+ ?>
331
+
332
+ <?php $this->getCurrencySymbolsData();?>
333
+
334
+
335
+ <?php if($packagename=="LARGE"||$packagename=="MEDIUM"||$packagename=="Pro"||$packagename=="XXL"||$packagename=="Flex") { ?>
336
+
337
+
338
+
339
+
340
+ <!------------------------------------End total number of users------------------------->
341
+
342
+
343
+ <div class="click-price">
344
+ <a href ='./?user_email_all=true' class='price_alert'>Click to Invite all abandoned cart users to receive price alerts</a>
345
+ </div>
346
+ <?php } ?>
347
+
348
+ <?php
349
+ $read4 = Mage::getSingleton('core/resource')->getConnection('core_read') ;
350
+ $write4 = Mage::getSingleton('core/resource')->getConnection('core_write');
351
+ $result5 = $read4->fetchAll("SELECT * FROM log_url_info where url_id ='14'");
352
+ //print_r($result5);
353
+ $base_url = $result5['0']['url'];
354
+
355
+ ?>
356
+ <div id="mybox">
357
+
358
+ </div>
359
+
360
+
361
+
362
+ <script>
363
+ jQuery(document).ready(function(){
364
+ jQuery("#send_api").click(function(){
365
+ var fbapi = jQuery('#fbkey').val();
366
+ var mage_find = jQuery('#mage_find').val();
367
+ //alert(day);
368
+ //alert(status);
369
+ formData = '&fbkey='+fbapi+'&mage_find='+mage_find;
370
+ jQuery.ajax({
371
+ type: 'POST',
372
+ data:formData,
373
+ url:"<?php echo $base_url; ?>app/design/adminhtml/default/default/template/Abandoncart/socialmedia.php",dataType: "json",
374
+ success:function(result){
375
+ var Success = result
376
+ alert(url);
377
+ alert(Success.message);
378
+ }
379
+ });
380
+ });
381
+ });
382
+ </script>
383
+
384
+ <?php
385
+
386
+
387
+ //------------------------------------------------------------Scan all Abandon Cart Product---------------------------------------------//
388
+ $read1 = Mage::getSingleton('core/resource')->getConnection('core_read') ;
389
+ $write1 = Mage::getSingleton('core/resource')->getConnection('core_write');
390
+ $result1 = $read1->fetchAll("select * from abandon_cart where id ='1'");
391
+ //print_r($result1);
392
+ $status_abandon = $result1['0']['abandon_status'];
393
+ $status_day = $result1['0']['day'];
394
+ $status_date = $result1['0']['date'];
395
+ //echo $status_day;
396
+
397
+ // $rec_count = 1;
398
+ //$product1 = Mage::getModel('reports/quote_collection')->GetCollection();
399
+ $count_data = $read1->fetchAll('select count(customer_id) from sales_flat_quote');
400
+ //print_r($count_data);
401
+ // $rec_count = $product1->getSelect()->limit(20);
402
+ //echo 'sdf'.$rec_count;
403
+ //$rec_count = $product1->count();
404
+ $collection1 = Mage::getResourceModel('reports/quote_collection');
405
+ $collection1->prepareForAbandonedReport();
406
+
407
+ $rec_count = $collection1->count();
408
+ $emailArr=array();
409
+
410
+ //$page = $_GET{'page'} + 1;
411
+ if(!isset($_GET{'page'}) || $_GET{'page'} == 0)
412
+ {
413
+ $page =1;
414
+ }else
415
+ {
416
+ $page = $_GET{'page'};
417
+ }
418
+ $pageFrame = 3;
419
+ //echo 'pageno->'.$page;
420
+
421
+ $limit = $_GET['folder'];
422
+ $offset = $limit * ($page-1);
423
+ if($rec_count%2==0)
424
+ {
425
+ $total=$rec_count/$limit;
426
+ }
427
+ else
428
+ {
429
+ $total_odd=$rec_count/$limit;
430
+ $total=$total_odd +1 ;
431
+ }
432
+
433
+
434
+ $collection = Mage::getResourceModel('reports/quote_collection');
435
+ $collection->prepareForAbandonedReport();
436
+
437
+ $collection->getSelect()->limit($offset,$limit);
438
+
439
+ //$collection->reset();
440
+ $collection->getSelect()->limit($limit,$offset);
441
+ //$output = $collection->load()->toArray();
442
+
443
+ // echo $left_rec = $rec_count - ($page * $rec_limit);
444
+
445
+
446
+ $i=0;
447
+ foreach($collection->load()->toArray() as $key=>$user_detail)
448
+ {
449
+ $details=$user_detail;
450
+ foreach($user_detail as $key=>$user_email)
451
+ {
452
+
453
+ //echo $user_email['email'];
454
+ //$emailArr[$key] ['email']= $user_email['email'];
455
+ //$emailArr[$key] ['entity_id']= $user_email['entity_id'];
456
+ }
457
+
458
+ }
459
+
460
+ //echo '<pre>';print_r($details);
461
+
462
+
463
+ foreach ($details as $key=>$val)
464
+
465
+ {
466
+
467
+
468
+ $emailArr[$key] ['email']= $val['email'];
469
+ $emailArr[$key] ['entity_id']= $val['entity_id'];
470
+ $emailArr[$key] ['customer_id']= $val['customer_id'];
471
+ //echo '<h1 style="font-size:20px;">'. $val['customer_name'].'</h1>';
472
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read') ;
473
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
474
+ $result = $read->fetchAll("select * from sales_flat_quote_item where quote_id ='".$val['entity_id']."'");
475
+
476
+ echo '<div class="grid">';
477
+ echo '<h1 class="title-name">'. $val['customer_name'].'</h1>';
478
+ ?>
479
+ <a href = "javascript:void(0)" class="button" onclick = "document.getElementById('light_<?php echo $val["customer_id"]; ?>').style.display='block';">View details</a>
480
+ <?php $subscription_status = $read->fetchall("SELECT * FROM Abandoned_email_subscription where customer_id ='".$val['customer_id']."'");
481
+ ?>
482
+
483
+ <!--------------------------------Subscribe functionality------------------------------------------>
484
+
485
+ <input type="hidden" id="customer_name_<?php echo $val['customer_id']; ?>" value="<?php echo $val['customer_name']; ?>">
486
+ <input type="hidden" id="customer_email_<?php echo $val['customer_id']; ?>" value="<?php echo $val['email']; ?>">
487
+ <input type="hidden" id="customer_id_<?php echo $val['customer_id']; ?>" value="<?php echo $val['customer_id']; ?>">
488
+
489
+ <?php if($subscription_status['0']['subscribe_status'] ==""||$subscription_status['0']['subscribe_status'] =="yes"){ ?>
490
+ &nbsp;&nbsp;<button id ="unsub_<?php echo $val['customer_id']; ?>">Disable price alerts</button>
491
+ <script>
492
+ jQuery(document).ready(function(){
493
+ jQuery("#unsub_<?php echo $val['customer_id']; ?>").click(function(){
494
+ var customer_email = jQuery("#customer_email_<?php echo $val['customer_id']; ?>").val();
495
+ var customer_name = jQuery('#customer_name_<?php echo $val['customer_id']; ?>').val();
496
+ var customer_id = jQuery('#customer_id_<?php echo $val['customer_id']; ?>').val();
497
+ var mage_find = jQuery('#mage_find').val();
498
+ fromData = 'customer_email='+customer_email+'&customer_name='+customer_name+'&customer_id='+customer_id+'&mage_find='+mage_find;
499
+ jQuery.ajax({
500
+ type: 'POST',
501
+ data:fromData,
502
+ datatype:'json',
503
+ url:"http://localhost/magento19/unsubscribe.php",
504
+ success:function(result){
505
+ var Success = result;
506
+ alert(result);
507
+ location.reload();
508
+ // $('#img_link').src();
509
+ jQuery("#img_link").attr("src", result);
510
+
511
+ }
512
+ });
513
+ });
514
+ });
515
+ </script>
516
+
517
+ <!--------------------------------End Subscribe functionality------------------------------------------>
518
+
519
+
520
+ <?php } else { ?>
521
+
522
+ <!--------------------------------UnSubscribe functionality------------------------------------------>
523
+
524
+ &nbsp;&nbsp;<button id ="subs_<?php echo $val['customer_id']; ?>">Send customer price alert invitation</button>
525
+
526
+ <script>
527
+ jQuery(document).ready(function(){
528
+ jQuery("#subs_<?php echo $val['customer_id']; ?>").click(function(){
529
+ var customer_email = jQuery("#customer_email_<?php echo $val['customer_id']; ?>").val();
530
+ var customer_name = jQuery('#customer_name_<?php echo $val['customer_id']; ?>').val();
531
+ var customer_id = jQuery('#customer_id_<?php echo $val['customer_id']; ?>').val();
532
+ var mage_find = jQuery('#mage_find').val();
533
+ //alert(customer_email);
534
+ //alert(status);
535
+ fromData = 'customer_email='+customer_email+'&customer_name='+customer_name+'&customer_id='+customer_id+'&mage_find='+mage_find;
536
+ jQuery.ajax({
537
+ type: 'POST',
538
+ data:fromData,
539
+ datatype:'json',
540
+ url:"/subscribe.php",
541
+ success:function(result){
542
+ var Success = result;
543
+ alert(result);
544
+ location.reload();
545
+ // $('#img_link').src();
546
+ jQuery("#img_link").attr("src", result);
547
+
548
+ }
549
+ });
550
+ });
551
+ });
552
+ </script>
553
+
554
+ <?php } ?>
555
+
556
+ <!---------------------------EndUnSubscribe functionality------------------------------------------>
557
+
558
+ <div id="light_<?php echo $val['customer_id']; ?>" class="white_content">
559
+ <div class="col-full"><a href="javascript:void(0)" onclick="document.getElementById('light_<?php echo $val["customer_id"]; ?>').style.display='none';document.getElementById('fade').style.display='none'" class="close-btn">X</a></div>
560
+ <table>
561
+ <h1><?php echo $val['customer_name'];?></h1>
562
+ <tr><td>Customer Name</td><td><?php echo $val['customer_name'];?></td></tr>
563
+ <tr><td>Customer Id</td><td><?php echo $val['customer_id'];?></td></tr>
564
+ <tr><td>First Name</td><td><?php echo $val['customer_firstname'];?></td></tr>
565
+ <tr><td>Last Name</td><td><?php echo $val['customer_lastname'];?></td></tr>
566
+ <tr><td>Email</td><td><?php echo $val['email'];?></td></tr>
567
+ <tr><td>Gender</td><td><?php echo $val['customer_gender'];?></td></tr>
568
+ <tr><td>Customer Dob</td><td><?php echo $val['customer_dob'];?></td></tr>
569
+
570
+ </table>
571
+
572
+ </div>
573
+ <?php
574
+ echo '<div class="hor-scroll">';
575
+ echo '<table cellspacing="0" class="data" id="gridAbandoned_table">';
576
+ echo '<thead>';
577
+ echo '<tr class="headings">';
578
+ echo '<th class="no-link"><span class="nobr">User Name:</span></th>';
579
+ echo '<th class="no-link"><span class="nobr">Product Name:</span></th>';
580
+ echo '<th class="no-link"><span class="nobr">Quantity:</span></th>';
581
+ echo '<th class="no-link"><span class="nobr">SKU:</span></th>';
582
+ echo '<th class="no-link"><span class="nobr">Price</span></th>';
583
+ echo '<th class="no-link"><span class="nobr">Date</span></th>';
584
+ echo '<th class="no-link"><span class="nobr">Day</span></th>';
585
+ if($packagename=="LARGE"||$packagename=="MEDIUM"||$packagename=="Pro"||$packagename=="XXL"||$packagename=="Flex") {
586
+ echo '<th class="no-link"><span class="nobr">Email Status</span></th>';
587
+ }
588
+ echo '</tr>';
589
+ echo '</thead>';
590
+ echo '<tbody>';
591
+
592
+
593
+ $prod_arr = array();
594
+ $products=array();
595
+ $i=0;
596
+ foreach($result as $data_data)
597
+ {
598
+ $products[]= $data_data['product_id'];
599
+ //echo '<pre>';print_r($data_data);
600
+
601
+ echo '<tr class="even pointer">';
602
+ echo '<td>'.$val['firstname'].'</td>';
603
+ //echo 'test=>'.$val['entity_id'];
604
+ echo '<td>'.$data_data['name'].'</td>';
605
+ echo '<td>'.$data_data['qty'].'</td>';
606
+ echo '<td>'.$data_data['sku'].'</td>';
607
+ echo '<td>'.$data_data['price'].'</td>';
608
+ echo '<td>'.$data_data['created_at'].'</td>';
609
+
610
+ $date1=date_create($data_data['created_at']);
611
+ $date2=date_create($status_date);
612
+ $diff=date_diff($date1,$date2);
613
+ echo '<td>'.$diff->format("%a").'</td>'; ?>
614
+ <?php
615
+ $read2 = Mage::getSingleton('core/resource')->getConnection('core_read') ;
616
+ $write2 = Mage::getSingleton('core/resource')->getConnection('core_write');
617
+ $result2 = $read2->fetchAll("select abandon_email_status from Abandon_added_product where added_user_id ='".$val['customer_id']."' AND added_prod_id ='".$data_data['product_id']."' ");
618
+
619
+ if($packagename=="LARGE"||$packagename=="MEDIUM"||$packagename=="Pro"||$packagename=="XXL"||$packagename=="Flex")
620
+ {
621
+ if(!empty($result2))
622
+ {
623
+ foreach($result2 as $email_val)
624
+ {
625
+ //echo $abandon_email_status = $email_val['abandon_email_status'];
626
+ //$abandon_user_email[] = $abandon_email_status;
627
+ //echo '<br>';
628
+ if($email_val['abandon_email_status']=='0')
629
+ {
630
+ echo "<td><span class='email_send'>Email Sent</span></td>";
631
+ }else{
632
+ echo "<td><span class='email_not_send'>Not Sent</span></td>";
633
+ }
634
+
635
+ }
636
+ }else{
637
+ echo "<td><span class='email_not_send'>Not Sent</span></td>";
638
+
639
+ }
640
+ }
641
+ ?>
642
+
643
+
644
+ <?php
645
+ $noofday[]= $diff->format("%a");
646
+ $name[] = $data_data['name'];
647
+ $qty[] = $data_data['qty'];
648
+ $sku[] = $data_data['sku'];
649
+ $price[] = $data_data['price'];
650
+ $created_at[] = $data_data['created_at'];
651
+ $s1_name = serialize($name);
652
+ $s1_qty = serialize($qty);
653
+ $s1_sku = serialize($sku);
654
+ $s1_price = serialize($price);
655
+ $s1_created_at = serialize($created_at);
656
+
657
+ $cron_mail[] = $val['email'];
658
+ //echo $val['entity_id'];
659
+ //$entity_id[] = $val['entity_id'];
660
+
661
+ $val['customer_id'];
662
+ $val['entity_id'];
663
+ $prod_arr[$i] = array('customer_id'=>$val['customer_id'],'entity_id'=>$val['entity_id']);
664
+ $i++;
665
+ }
666
+ $emailArr[$key]['product_id']=implode(',',$products);
667
+ //echo $val['email'];
668
+
669
+ $abandon_arr = array();
670
+ $abandon_arr['email'] = $val['email'];
671
+ $abandon_arr['products'] = $prod_arr;
672
+ $abandonurl = urlencode(json_encode($abandon_arr));
673
+ $items=implode(",",$products);
674
+ echo '</tr>';
675
+ if($packagename=="LARGE"||$packagename=="MEDIUM"||$packagename=="Pro"||$packagename=="Flex")
676
+ {
677
+ echo '<tr>';
678
+ echo '<td colspan="8"><a href ="./?activate='.$val['email'].'&entity_id='. $val['entity_id'].'&customer_id='.$val['customer_id'].'&item_id='.$items.'" class="invite_link">';
679
+ ?>
680
+ <?php
681
+ $subscription_status = $read->fetchall("SELECT * FROM Abandoned_email_subscription where customer_id ='".$val['customer_id']."'");
682
+ $extension_setting = $read->fetchAll("select * from abandoned_extensionsetting");
683
+ if($extension_setting['9']['status']=='on')
684
+ {
685
+ if($subscription_status['0']['subscribe_status']!='no')
686
+ {
687
+
688
+
689
+ if($result2['0']['abandon_email_status'] == '0')
690
+
691
+ {
692
+ echo '<div class="email_send">Invite sent, click here will send the invite again</div>';
693
+
694
+ }
695
+ else
696
+
697
+ {
698
+ echo 'Invite user to auto-setup price alerts';
699
+ }
700
+
701
+
702
+ }
703
+
704
+
705
+ else
706
+
707
+ { echo '</a>';
708
+ echo 'The customer has chosen to NOT activate Pricelizer.';
709
+
710
+ }
711
+ }
712
+
713
+ echo '</a>';
714
+ if($extension_setting['5']['status']=='yes')
715
+ {
716
+ echo '&nbsp;&nbsp;<a href ="./?pur_reminder='.$val['email'].'&entity_id='. $val['entity_id'].'&customer_id='.$val['customer_id'].'&item_id='.$items.'" class="invite_link purche-remind">Purchase Reminder</a>';
717
+ }
718
+ ?>
719
+ </td>
720
+
721
+ <?php
722
+ echo '</tr>';
723
+ }
724
+ echo '</tbody>';
725
+ echo '</table>';
726
+ echo '</div>';
727
+ echo '</div>';
728
+
729
+ }
730
+
731
+ ?>
732
+
733
+ <?php $hostlink = 'www.'.$_SERVER['HTTP_HOST']; ?>
734
+ <!---------------------------------------------------------Pagination View------------------------------->
735
+
736
+ <?php $mainurl = Mage::getBaseUrl();
737
+ $modified_url_link = str_replace("/index.php/"," ",$mainurl);
738
+ $modified_url = '<a href="'.$modified_url.'">'.$hostlink.'</a>';
739
+
740
+ ?>
741
+
742
+ <!---------------------------------------------------------EndPagination View------------------------------->
743
+ <?php
744
+ echo '<div class="centrick">';
745
+
746
+ echo '<div class="page">Page'.$page.'</div>';
747
+ $html .= '<ol class="pagination">';
748
+ if(isset($page) && $page != 1){
749
+ $start = $page - 1;
750
+ $end = $start + $pageFrame;
751
+ }
752
+ /* if($end > $rec_count){
753
+ $start = $rec_count - ($pageFrame-1);
754
+ }else{
755
+ $rec_count = $end-1;
756
+ }
757
+ echo 'cc'.$rec_count.'cc';*/
758
+ for($i = $start; $i<=$total; $i++)
759
+ {
760
+ if($i >= 1){
761
+ if($page){
762
+ $html .= ($page == $i) ? '<li class="current">'. $i .'</li>' : '<li><a href="'.$url.'?page='.$i.'">'. $i .'</a></li>';
763
+ }else{
764
+ $html .= ($i == 1) ? '<li class="current">'. $i .'</li>' : '<li><a href="'.$url.'?page='.$i.'">'. $i .'</a></li>';
765
+ }
766
+ }
767
+
768
+ }
769
+
770
+ $html .= '</ol>';
771
+
772
+
773
+ ?>
774
+ <?php echo $html; ?>
775
+ <br>
776
+ <div style="clear:both;"></div>
777
+ <h3 class="app-title-name">Select customers per page</h2>
778
+ <select name ="dayinterval" id ="myselect" style ="margin:0px auto;display:block">
779
+ <option><?php if($_GET['folder']=="") { echo '10';} else { echo $_GET['folder']; } ?></option>
780
+ <option value ="10">10</option>
781
+ <option value ="25">25</option>
782
+ <option value ="50">50</option>
783
+ <option value ="100">100</option>
784
+ </select>
785
+ <script>
786
+ jQuery(document).ready(function(){
787
+ jQuery('#myselect').change(function () {
788
+ var data = jQuery('#myselect').val();
789
+ var newURLString = window.location.href +
790
+ "?folder=" + jQuery('#myselect').val();
791
+ window.location.href = newURLString;
792
+ });
793
+ });
794
+ </script>
795
+ <?php
796
+ echo '</div>';?>
797
+
798
+
799
+
800
+
801
+
802
+ <?php
803
+ //------------------------------------------------------------End Scan all Abandon Cart Product---------------------------------------------//
804
+
805
+ $base_url = Mage::getBaseUrl();
806
+ //--------------------------------------------------------Send user email------------------------------------------------------------//
807
+
808
+ $read1 = Mage::getSingleton('core/resource')->getConnection('core_read') ;
809
+ $write1 = Mage::getSingleton('core/resource')->getConnection('core_write');
810
+ $result1 = $read1->fetchAll("select * from abandon_cart where id ='1'");
811
+ //print_r($result1);
812
+ $status_abandon = $result1['0']['abandon_status'];
813
+ $status_day = $result1['0']['day'];
814
+ $status_date = $result1['0']['date'];
815
+
816
+ $log_url = $read1->fetchAll("SELECT * FROM log_url_info where url_id ='14'");
817
+ $base_site_url = $log_url['0']['url'];
818
+
819
+ //echo $status_day;
820
+ if($status_abandon == '0')
821
+ {
822
+
823
+ if(isset($_GET['activate']))
824
+ {
825
+
826
+
827
+ $result_data = $read1->fetchAll("select * from abandoned_extensionsetting");
828
+ //echo '<pre>';print_r($result_data);
829
+ $get_id = $_GET['d'];
830
+ $explode_name = explode('=',$_GET['d']);
831
+ $uname = $explode_name['1'];
832
+ $email = $_GET['activate'];
833
+ $mail = new PHPMailer; // call the class
834
+ $mail->IsSMTP();
835
+ $mail->SMTPSecure = "";
836
+ //$mail->SMTPDebug = 2;
837
+ $mail->Host = 'c4072.sgvps.net'; // platinum.waxspace.com Hostname of the mail server
838
+ $mail->Port = '587'; //Port of the SMTP like to be 25, 80, 465 or 587
839
+ $mail->SMTPAuth = true; //Whether to use SMTP authentication
840
+ $mail->Username = 'sara.johnsson@pricelizer.com';
841
+ $mail->Password = 'Tihwd100s'; //Password for SMTP authentication
842
+ //$mail->AddReplyTo("admin@quiconnaitunbon.com.com", "Admin"); //reply-to address
843
+ $mail->SetFrom("karl.lillrud@maneer.se"); //From address of the mail
844
+ //$mail->SMTPSecure = "tls";
845
+ $link = "".$base_url."abandon/front/maildata/".'?entity_id='.$_GET['entity_id'].'&customer_id='.$_GET['customer_id'].'&item_id='.$_GET['item_id'];
846
+ $cur_date = date("l d F ");
847
+ $customer_id =$_GET['customer_id']; // set this to the ID of the customer.
848
+ $customer_data = Mage::getModel('customer/customer')->load($customer_id);
849
+ $customer_name = $customer_data['firstname'];
850
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read') ;
851
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
852
+ $abandon_days = $read->fetchall("select * from abandon_cart");
853
+ $alert_days = $abandon_days['0']['day'];
854
+ $getemaildata = $read->fetchall("select * from abandon_email_template");
855
+ $firstname = "FIRSTNAME";
856
+ $site_url = "SITEURL";
857
+ $xdays = "XDAYSFROMSETTINGS";
858
+ $unsubscribe_key = "UNSUBSCRIBE";
859
+ $date_data = "DATE";
860
+ $culogo = "CULOGO";
861
+ $blank ="";
862
+
863
+ $unsubs_url_key = $base_url.'abandon/front/unsub/?unsubs='.$_GET['customer_id'];
864
+ $pstring = $getemaildata['0']['email_conetnt'];
865
+ $modifieddata = str_replace($firstname,$customer_name,$pstring);
866
+ $modifieddata1 = str_replace($site_url,$modified_url,$modifieddata);
867
+ $modifieddata3 = str_replace($xdays,$alert_days,$modifieddata1);
868
+ $modified_data1 = str_replace($date_data,$cur_date,$modifieddata3);
869
+ $modified_logo = str_replace($culogo,$img_logo,$modified_data1);
870
+ $modifieddata4 = str_replace($unsubscribe_key,$unsubs_url_key,$modified_logo);
871
+ $facebook = "FACEBOOK";
872
+ $linkedin = "LINKEDIN";
873
+ $twitter = "TWITTER";
874
+ $google = "GOOGLE";
875
+ $simple_signup = '1CLICKSIGNUP';
876
+ $sitename = 'SITENAME';
877
+ if($result_data['3']['status']=='yes')
878
+ $pricelizerlink = 'PRICELIZERLOGO';
879
+ else $blank;
880
+
881
+ //$sitelogo = 'PRICELIZERLOGO';
882
+ //$facebook_key = "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/facebook.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
883
+ //$twitter_key = "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/tweet.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
884
+ //$linkedin_key = $message .= "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/linked.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
885
+ //$google_key = "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/google.jpeg.png' style='width:24px; height:24px; margin-right:0px;' ></a></td></tr>";
886
+ $signup_url = "<a href =".$link." class='for-hover' style='color: #fff; background:#2f90e2; font-size:14px; padding:6px 14px; text-decoration:none; border:1px solid #fff; border-radius: 4px; box-shadow:3px 3px 3px #ccc; margin-bottom:10px; display:inline-block;'>1-Click Signup</a>";
887
+ //$signup_url = "<button type='button' onclick = 'window.location.href=".$link."'>1-Click Sign Up</button>";
888
+ $image_logo_footer = $this->getSkinUrl('images/powered-by-pricelizer.png',array('_secure'=>true));
889
+
890
+ if($result_data['4']['status']=='yes')
891
+ $url_data = 'http://www..pricelizer.com';
892
+ else $url_data="//404notfound";
893
+ $pricelizer_link = "<a href ='http://www.pricelizer.com/'><img src ='".$image_logo_footer."' alt='Powered by Pricelizer' ></a>";
894
+ $flink_url = "<a style='color:#989898;margin-left:10px; text-decoration:none;' href='http://staging.pricelizer.com'>Powered by Pricelizer</a>";
895
+ $modifieddata5 = str_replace($facebook,$facebook_key,$modifieddata4);
896
+ $modifieddata6 = str_replace($linkedin,$linkedin_key,$modifieddata5);
897
+ $modifieddata7 = str_replace($twitter,$twitter_key,$modifieddata6);
898
+ $signup_button = str_replace($google, $google_key,$modifieddata7);
899
+ $pricelizer_logo_link = str_replace($simple_signup,$signup_url,$signup_button);
900
+ $footer = str_replace($footer_link,$flink_url,$pricelizer_logo_link);
901
+ $modifieddata2 = str_replace($pricelizerlink,$pricelizer_link,$footer);
902
+ $mail->Subject = "Abandoned Cart Alert"; //Subject od your mail
903
+ $mail->AddAddress($email, "fghgfhgfh"); //To address who will receive this email
904
+
905
+ //$to = "ajay010791@gmail.com";
906
+ //$subject = "Abandon Cart Alert";
907
+ $headers = "From: Abandon Cart Alert";
908
+ $headers .= "Reply-To: ". ($to) . "\r\n";
909
+ $headers .= "CC: ajay.singh@webeneturetech.com";
910
+ $headers = "MIME-Version: 1.0" . PHP_EOL;
911
+ $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
912
+ $message = '<html><body>';
913
+ $message .= '<table rules="all" cellpadding="10" border="0" >';
914
+
915
+ $unsuburl = "<a href ='".$unsubs_url_key."'><span style='color:#999'>click here</span></a>";
916
+ $message .= "</body></html>";
917
+ $unsubs ="UNCLICK";
918
+ $entire_content_data = str_replace($unsubs,$unsuburl,$modifieddata2);
919
+ $entire_content = str_replace($sitename,$site_name_magento,$entire_content_data);
920
+ $message .= $entire_content;
921
+
922
+ $mail->MsgHTML($message); //Put your body of the message you can place html code here
923
+ $send = $mail->Send(); //Send the mails
924
+
925
+ if($send){
926
+ echo "send";
927
+ }
928
+
929
+ }
930
+ elseif(isset($_GET['pur_reminder']))
931
+ {
932
+
933
+ $result_data = $read1->fetchAll("select * from abandoned_extensionsetting");
934
+ //echo '<pre>';print_r($result_data);
935
+ $get_id = $_GET['d'];
936
+ $explode_name = explode('=',$_GET['d']);
937
+ $uname = $explode_name['1'];
938
+ $email = $_GET['pur_reminder'];
939
+ $mail = new PHPMailer; // call the class
940
+ $mail->IsSMTP();
941
+ $mail->SMTPSecure = "";
942
+ //$mail->SMTPDebug = 2;
943
+ $mail->Host = 'c4072.sgvps.net'; // platinum.waxspace.com Hostname of the mail server
944
+ $mail->Port = '587'; //Port of the SMTP like to be 25, 80, 465 or 587
945
+ $mail->SMTPAuth = true; //Whether to use SMTP authentication
946
+ $mail->Username = 'sara.johnsson@pricelizer.com';
947
+ $mail->Password = 'Tihwd100s'; //Password for SMTP authentication
948
+ //$mail->AddReplyTo("admin@quiconnaitunbon.com.com", "Admin"); //reply-to address
949
+ $mail->SetFrom("Contact@PriceLizer.com"); //From address of the mail
950
+ //$mail->SMTPSecure = "tls";
951
+ $link = "".$base_url."abandon/front/maildata/".'?entity_id='.$_GET['entity_id'].'&customer_id='.$_GET['customer_id'].'&item_id='.$_GET['item_id'];
952
+ $productId = $_GET['item_id'];
953
+ $explode_id = explode(',',$productId);
954
+
955
+ foreach($explode_id as $pr_idd)
956
+ {
957
+ $product = Mage::getModel('catalog/product')->load($pr_idd);
958
+ //echo '<pre>';print_r($product);
959
+ $prr_name = $product->name;
960
+ $productMediaConfig = Mage::getModel('catalog/product_media_config');
961
+ $smallImageUrl = $productMediaConfig->getMediaUrl($product->getSmallImage());
962
+ $prr_img ='<img src="'.$smallImageUrl.'" style="width:40px;height:60px; min-height:65px;">';
963
+ $prr_details_data .= '<li style="list-style:none; padding:0;">'.$prr_img.'<br>'.$prr_name.'<br></li>';
964
+
965
+ }
966
+ $prr_details = '<ul style="display:inline-block; padding:0; width:100%; ">'.$prr_details_data.'</ul>';
967
+ $cur_date = date("l d F ");
968
+ $customer_id =$_GET['customer_id']; // set this to the ID of the customer.
969
+ $customer_data = Mage::getModel('customer/customer')->load($customer_id);
970
+ $customer_name = $customer_data['firstname'];
971
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read') ;
972
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
973
+ $abandon_days = $read->fetchall("select * from abandon_cart");
974
+ $alert_days = $abandon_days['0']['day'];
975
+ $getemaildata = $read->fetchall("select * from abandon_email_template");
976
+ $firstname = "FIRSTNAME";
977
+ $site_url = "SITEURL";
978
+ $xdays = "XDAYSFROMSETTINGS";
979
+ $unsubscribe_key = "UNSUBSCRIBE";
980
+ $date_data = "DATE";
981
+ $culogo = "CULOGO";
982
+ $blank ="";
983
+ $unsubs_url_key = $base_url.'abandon/front/unsub/?unsubs='.$_GET['customer_id'];
984
+ $pstring = $getemaildata['2']['email_conetnt'];
985
+
986
+ $product_id =$_GET['item_id'];
987
+ $explode_id = explode(',',$product_id);
988
+ foreach($explode_id as $item_id_data)
989
+ {
990
+ $obj = Mage::getModel('catalog/product');
991
+ $_product = $obj->load($item_id_data);
992
+ $_product->getName();
993
+ $product_title[] = $_product->getName();
994
+ }
995
+ $product_key = "PRODUCTLIST";
996
+ $list_of_product .= implode('<br>',$product_title);
997
+ $product_search = str_replace($product_key,$prr_details,$pstring);
998
+ $modifieddata = str_replace($firstname,$customer_name,$product_search);
999
+ $modifieddata1 = str_replace($site_url,$modified_url,$modifieddata);
1000
+ $modifieddata3 = str_replace($xdays,$alert_days,$modifieddata1);
1001
+ $modified_data1 = str_replace($date_data,$cur_date,$modifieddata3);
1002
+ $modified_logo = str_replace($culogo,$img_logo,$modified_data1);
1003
+ $modifieddata4 = str_replace($unsubscribe_key,$unsubs_url_key,$modified_logo);
1004
+ $facebook = "FACEBOOK";
1005
+ $linkedin = "LINKEDIN";
1006
+ $twitter = "TWITTER";
1007
+ $google = "GOOGLE";
1008
+ $simple_signup = '1CLICKSIGNUP';
1009
+ if($result_data['3']['status']=='yes')
1010
+ $pricelizerlink = 'PRICELIZERLOGO';
1011
+ else $blank;
1012
+ if($result_data['4']['status']=='yes')
1013
+ $footer_link = "FLINK";
1014
+ else $blank;
1015
+ $sitename = 'SITENAME';
1016
+
1017
+ $signup_url = "<a href =".$link." class='for-hover' style='color: #fff; background:#2f90e2; font-size:14px; padding:6px 14px; text-decoration:none; border:1px solid #fff; border-radius: 4px; box-shadow:3px 3px 3px #ccc; margin-bottom:10px; display:inline-block;'>1-Click Signup</a>";
1018
+ //$signup_url = "<button type='button' onclick = 'window.location.href=".$link."'>1-Click Sign Up</button>";
1019
+ if($result_data['4']['status']=='yes')
1020
+ $url_data = 'http://staging.pricelizer.com';
1021
+ else $url_data="//404notfound";
1022
+ $image_logo_footer = $this->getSkinUrl('images/powered-by-pricelizer.png',array('_secure'=>true));
1023
+ $pricelizer_link = "<a href ='http://www.pricelizer.com/'><img src ='".$image_logo_footer."' alt='Powered by Pricelizer' ></a>";
1024
+ $flink_url = "<a style='color:#989898;margin-left:10px; text-decoration:none;' href='http://staging.pricelizer.com'>Powered by Pricelizer</a>";
1025
+ $modifieddata5 = str_replace($facebook,$facebook_key,$modifieddata4);
1026
+ $modifieddata6 = str_replace($linkedin,$linkedin_key,$modifieddata5);
1027
+ $modifieddata7 = str_replace($twitter,$twitter_key,$modifieddata6);
1028
+ $signup_button = str_replace($google, $google_key,$modifieddata7);
1029
+ $pricelizer_logo_link = str_replace($simple_signup,$signup_url,$signup_button);
1030
+ $footer = str_replace($footer_link,$flink_url,$pricelizer_logo_link);
1031
+ $modifieddata2 = str_replace($pricelizerlink,$pricelizer_link,$footer);
1032
+ $mail->Subject = "Abandoned Cart Alert"; //Subject od your mail
1033
+ $mail->AddAddress($email, "fghgfhgfh"); //To address who will receive this email
1034
+
1035
+ //$to = "ajay010791@gmail.com";
1036
+ //$subject = "Abandon Cart Alert";
1037
+ $headers = "From: Abandon Cart Alert";
1038
+ $headers .= "Reply-To: ". ($to) . "\r\n";
1039
+ $headers .= "CC: ajay.singh@webeneturetech.com";
1040
+ $headers = "MIME-Version: 1.0" . PHP_EOL;
1041
+ $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
1042
+ $message = '<html><body>';
1043
+ $message .= '<table rules="all" cellpadding="10" border="0" >';
1044
+
1045
+ $unsuburl = "<a href ='".$unsubs_url_key."'><span style='color:#999'>click here</span></a>";
1046
+ $message .= "</body></html>";
1047
+ $unsubs ="UNCLICK";
1048
+
1049
+ $entire_content_data = str_replace($unsubs,$unsuburl,$modifieddata2);
1050
+ $useremailkey = 'USEREMAIL';
1051
+ $get_user_email = str_replace($useremailkey,$email,$entire_content_data);
1052
+ $entire_content = str_replace($sitename,$site_name_magento,$get_user_email);
1053
+ $message .= $entire_content;
1054
+ $mail->MsgHTML($message);
1055
+ $send = $mail->Send();
1056
+
1057
+ if($send){
1058
+ echo "send";
1059
+ }
1060
+
1061
+ }
1062
+
1063
+
1064
+ }
1065
+
1066
+ elseif($status_abandon == '1')
1067
+ {
1068
+
1069
+ //echo $to = $_GET['d'];
1070
+ foreach($noofday as $valday){
1071
+ if($valday== $status_day){
1072
+ foreach($emailArr as $cron_user_email)
1073
+ {
1074
+
1075
+ $result_data = $read1->fetchAll("select * from abandoned_extensionsetting");
1076
+ //echo '<pre>';print_r($result_data);
1077
+ $get_id = $_GET['d'];
1078
+ $explode_name = explode('=',$_GET['d']);
1079
+ $uname = $explode_name['1'];
1080
+ $email = $cron_user_email['email'];
1081
+ #DebugBreak() ;
1082
+ $mail = new PHPMailer; // call the class
1083
+ $mail->IsSMTP();
1084
+ $mail->SMTPSecure = "";
1085
+ //$mail->SMTPDebug = 2;
1086
+ $mail->Host = 'ssl://smtp.gmail.com'; // platinum.waxspace.com Hostname of the mail server
1087
+ $mail->Port = '465'; //Port of the SMTP like to be 25, 80, 465 or 587
1088
+ $mail->SMTPAuth = true; //Whether to use SMTP authentication
1089
+ $mail->Username = 'keyurshah070@gmail.com';
1090
+ $mail->Password = 'keyur24892070'; //Password for SMTP authentication
1091
+ //$mail->AddReplyTo("admin@quiconnaitunbon.com.com", "Admin"); //reply-to address
1092
+ $mail->SetFrom("keyurshah070@gmail.com"); //From address of the mail
1093
+ //$mail->SMTPSecure = "tls";
1094
+ $link = "".$base_url."abandon/front/maildata/".'?entity_id='.$_GET['entity_id'].'&customer_id='.$cron_user_email['customer_id'].'&item_id='.$cron_user_email['product_id'];
1095
+ $cur_date = date("l d F ");
1096
+ $customer_id =$cron_user_email['customer_id']; // set this to the ID of the customer.
1097
+ $customer_data = Mage::getModel('customer/customer')->load($customer_id);
1098
+ $customer_name = $customer_data['firstname'];
1099
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read') ;
1100
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
1101
+ $abandon_days = $read->fetchall("select * from abandon_cart");
1102
+ $alert_days = $abandon_days['0']['day'];
1103
+ $getemaildata = $read->fetchall("select * from abandon_email_template");
1104
+ $firstname = "FIRSTNAME";
1105
+ $site_url = "SITEURL";
1106
+ $xdays = "XDAYSFROMSETTINGS";
1107
+ $unsubscribe_key = "UNSUBSCRIBE";
1108
+ $date_data = "DATE";
1109
+ $culogo = "CULOGO";
1110
+ $blank ="";
1111
+ $unsubs_url_key = $base_url.'abandon/front/unsub/?unsubs='.$_GET['customer_id'];
1112
+ $pstring = $getemaildata['2']['email_conetnt'];
1113
+
1114
+ $product_id =$cron_user_email['product_id'];
1115
+ $explode_id = explode(',',$product_id);
1116
+ foreach($explode_id as $item_id_data)
1117
+ {
1118
+ $obj = Mage::getModel('catalog/product');
1119
+ $_product = $obj->load($item_id_data);
1120
+ $_product->getName();
1121
+ $product_title[] = $_product->getName();
1122
+ }
1123
+ $product_key = "PRODUCTLIST";
1124
+ $list_of_product .= implode('<br>',$product_title);
1125
+ $product_search = str_replace($product_key,$list_of_product,$pstring);
1126
+ $modifieddata = str_replace($firstname,$customer_name,$product_search);
1127
+ $modifieddata1 = str_replace($site_url,$modified_url,$modifieddata);
1128
+ $modifieddata3 = str_replace($xdays,$alert_days,$modifieddata1);
1129
+ $modified_data1 = str_replace($date_data,$cur_date,$modifieddata3);
1130
+ $modified_logo = str_replace($culogo,$img_logo,$modified_data1);
1131
+ $modifieddata4 = str_replace($unsubscribe_key,$unsubs_url_key,$modified_logo);
1132
+
1133
+ $facebook = "FACEBOOK";
1134
+ $linkedin = "LINKEDIN";
1135
+ $twitter = "TWITTER";
1136
+ $google = "GOOGLE";
1137
+ $simple_signup = '1CLICKSIGNUP';
1138
+ if($result_data['3']['status']=='yes')
1139
+ $pricelizerlink = 'PRICELIZERLOGO';
1140
+ else $blank;
1141
+ if($result_data['4']['status']=='yes')
1142
+ $footer_link = "FLINK";
1143
+ else $blank;
1144
+ $sitename = 'SITENAME';
1145
+
1146
+
1147
+
1148
+ //$sitelogo = 'PRICELIZERLOGO';
1149
+ //$facebook_key = "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/facebook.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
1150
+ //$twitter_key = "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/tweet.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
1151
+ //$linkedin_key = $message .= "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/linked.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
1152
+ //$google_key = "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/google.jpeg.png' style='width:24px; height:24px; margin-right:0px;' ></a></td></tr>";
1153
+ $signup_url = "<a href =".$link." class='for-hover' style='color: #fff; background:#2f90e2; font-size:14px; padding:6px 14px; text-decoration:none; border:1px solid #fff; border-radius: 4px; box-shadow:3px 3px 3px #ccc; margin-bottom:10px; display:inline-block;'>1-Click Signup</a>";
1154
+ //$signup_url = "<button type='button' onclick = 'window.location.href=".$link."'>1-Click Sign Up</button>";
1155
+ if($result_data['4']['status']=='yes')
1156
+ $url_data = 'http://staging.pricelizer.com';
1157
+ else $url_data="//404notfound";
1158
+ $image_logo_footer = $this->getSkinUrl('images/powered-by-pricelizer.png',array('_secure'=>true));
1159
+ $pricelizer_link = "<a href ='http://www.pricelizer.com/'><img src ='".$image_logo_footer."' alt='Powered by Pricelizer' ></a>";
1160
+ $flink_url = "<a style='color:#989898;margin-left:10px; text-decoration:none;' href='http://staging.pricelizer.com'>Powered by Pricelizer</a>";
1161
+ $modifieddata5 = str_replace($facebook,$facebook_key,$modifieddata4);
1162
+ $modifieddata6 = str_replace($linkedin,$linkedin_key,$modifieddata5);
1163
+ $modifieddata7 = str_replace($twitter,$twitter_key,$modifieddata6);
1164
+ $signup_button = str_replace($google, $google_key,$modifieddata7);
1165
+ $pricelizer_logo_link = str_replace($simple_signup,$signup_url,$signup_button);
1166
+ $footer = str_replace($footer_link,$flink_url,$pricelizer_logo_link);
1167
+ $modifieddata2 = str_replace($pricelizerlink,$pricelizer_link,$footer);
1168
+ $mail->Subject = "Abandoned Cart Alert"; //Subject od your mail
1169
+ $mail->AddAddress($email, "fghgfhgfh"); //To address who will receive this email
1170
+
1171
+ //$to = "ajay010791@gmail.com";
1172
+ //$subject = "Abandon Cart Alert";
1173
+ $headers = "From: Abandon Cart Alert";
1174
+ $headers .= "Reply-To: ". ($to) . "\r\n";
1175
+ $headers .= "CC: ajay.singh@webeneturetech.com";
1176
+ $headers = "MIME-Version: 1.0" . PHP_EOL;
1177
+ $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
1178
+ $message = '<html><body>';
1179
+ $message .= '<table rules="all" cellpadding="10" border="0" >';
1180
+
1181
+ $unsuburl = "<a href ='".$unsubs_url_key."'><span style='color:#999'>click here</span></a>";
1182
+ $message .= "</body></html>";
1183
+ $unsubs ="UNCLICK";
1184
+
1185
+ $entire_content_data = str_replace($unsubs,$unsuburl,$modifieddata2);
1186
+ $entire_content = str_replace($sitename,$site_name_magento,$entire_content_data);
1187
+ $message .= $entire_content;
1188
+
1189
+ $mail->MsgHTML($message);
1190
+ $send = $mail->Send();
1191
+
1192
+ if($send){
1193
+ echo "send";
1194
+ }
1195
+ }
1196
+ }
1197
+ }
1198
+ }
1199
+ $status_abandon = $result1['0']['abandon_status'];
1200
+ //------------------------------------------EndSend user email-------------------------------------------//
1201
+ //---------------------------------------------------Form control commented by ajay singh------------------------------------------------//
1202
+ //echo $currUrl= $this->getUrl('').$_SERVER['REQUEST_URI'];
1203
+ echo '<br>';
1204
+ if($packagename=="LARGE"||$packagename=="MEDIUM"||$packagename=="Pro"||$packagename=="XXL"||$packagename=="Flex") {
1205
+ $date = date("Y-m-d H:i:s");
1206
+ echo '<h1 class="app-title-name setting_panel" style="font-size:18px">Send invitation to users with abandoned carts.</h1>';
1207
+
1208
+ ?>
1209
+
1210
+ <div class="setting-from">
1211
+ <div class="man">
1212
+
1213
+ <div class="auto">
1214
+ <input type="radio" name="status" <?php if($status_abandon == '1'){ echo 'checked'; } else
1215
+ { } ?> id = "auto" value="1"><label>Automatic&nbsp;</label>
1216
+ <input type="radio" name="status" <?php if($status_abandon == '0'){ echo 'checked'; } else
1217
+ { } ?> id="manual" value="0"><label>Manually</label></div></div>
1218
+
1219
+ <?php
1220
+ echo '<div id ="show_val" style="display:none;" class="btn_manage">';
1221
+ echo '<h3 style="text-align: center; white-space: nowrap; float: left; margin-left: -35%;">Define how many days a cart should be abandoned before you send the alert</h3>';
1222
+ echo '<select name="days" id="days">';
1223
+ echo '<option>Select days-</option>';
1224
+ echo '<option value="1">1 Day</option>';
1225
+ echo '<option value="5">5 Days</option>';
1226
+ echo '<option value="10">10 Days</option>';
1227
+ echo '<option value="15">15 Days</option>';
1228
+ echo '<option value="20">20 Days</option>';
1229
+ echo '<option value="25">25 Days</option>';
1230
+ echo '<option value="30">30 Days</option>';
1231
+
1232
+ echo '</select>';
1233
+ echo '</div>';
1234
+ echo '<div class="btn_align">';
1235
+ echo '<button name="set" id ="set_form" > Save settings </button>'.'<br>';
1236
+ echo '</div>';
1237
+
1238
+ //echo $days =$_POST['days'];
1239
+ //---------------------------------------------------Form control commented by ajay singh------------------------------------------------//
1240
+ ?>
1241
+ <?php } ?>
1242
+ </div>
1243
+
1244
+ <?php
1245
+ //---------------------------------------------------------------Send alert to all user---------------------------------------------------//
1246
+ if($_GET['user_email_all']=='true')
1247
+ {
1248
+ $subscription_status = $read->fetchall("SELECT customer_email FROM Abandoned_email_subscription where subscribe_status ='yes'");
1249
+
1250
+
1251
+ $result=array_intersect($subscription_status,$emailArr);
1252
+
1253
+
1254
+ foreach($emailArr as $cron_user_email)
1255
+ {
1256
+ //print_r($cron_user_email);
1257
+ //$prodId=explode(',',$cron_user_email['product_id']); //echo '<pre>';print_r($cron_user_email);
1258
+ $link = "".$base_url."abandon/front/maildata/".'?entity_id='.$cron_user_email['entity_id'].'&prod_id='.$cron_user_email['product_id'].'&customer_id='.$cron_user_email['customer_id'];
1259
+
1260
+ $customer_id =$cron_user_email['customer_id']; // set this to the ID of the customer.
1261
+ $customer_data = Mage::getModel('customer/customer')->load($customer_id);
1262
+ $customer_name = $customer_data['firstname'];
1263
+
1264
+ $email = $cron_user_email['email'];
1265
+ $mail = new PHPMailer; // call the class
1266
+ $mail->IsSMTP();
1267
+ $mail->SMTPSecure = "";
1268
+ //$mail->SMTPDebug = 2;
1269
+ $mail->Host = 'ssl://smtp.gmail.com'; // platinum.waxspace.com Hostname of the mail server
1270
+ $mail->Port = '465'; //Port of the SMTP like to be 25, 80, 465 or 587
1271
+ $mail->SMTPAuth = true; //Whether to use SMTP authentication
1272
+ $mail->Username = 'keyurshah070@gmail.com';
1273
+ $mail->Password = 'keyur24892070'; //Password for SMTP authentication
1274
+ //$mail->AddReplyTo("admin@quiconnaitunbon.com.com", "Admin"); //reply-to address
1275
+ $mail->SetFrom("keyurshah070@gmail.com"); //From address of the mail
1276
+ //$mail->SMTPSecure = "tls";
1277
+ // put your while loop here like below,
1278
+
1279
+ //sending link
1280
+
1281
+ $cur_date = date("l d F ");
1282
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read') ;
1283
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
1284
+ $abandon_days = $read->fetchall("select * from abandon_cart");
1285
+ $alert_days = $abandon_days['0']['day'];
1286
+ $getemaildata = $read->fetchall("select * from abandon_email_template");
1287
+ $firstname = "FIRSTNAME";
1288
+ $site_url = "SITEURL";
1289
+ $xdays = "XDAYSFROMSETTINGS";
1290
+ $unsubscribe_key = "UNSUBSCRIBE";
1291
+ $date_data = "DATE";
1292
+ $culogo = "CULOGO";
1293
+ $unsubs_url_key = $base_url.'abandon/front/unsub/?unsubs='.$cron_user_email['customer_id'];
1294
+ $pstring = $getemaildata['0']['email_conetnt'];
1295
+ $modifieddata = str_replace($firstname,$customer_name,$pstring);
1296
+ $modifieddata1 = str_replace($site_url,$modified_url,$modifieddata);
1297
+ $modifieddata3 = str_replace($xdays,$alert_days,$modifieddata1);
1298
+ $modified_data1 = str_replace($date_data,$cur_date,$modifieddata3);
1299
+ $modified_logo = str_replace($culogo,$img_logo,$modified_data1);
1300
+ $modifieddata4 = str_replace($unsubscribe_key,$unsubs_url_key,$modified_logo);
1301
+ $facebook = "FACEBOOK";
1302
+ $linkedin = "LINKEDIN";
1303
+ $twitter = "TWITTER";
1304
+ $google = "GOOGLE";
1305
+ $simple_signup = '1CLICKSIGNUP';
1306
+ $pricelizerlink = 'PRICELIZERLOGO';
1307
+ $footer_link ='FLINK';
1308
+ $sitename = 'SITENAME';
1309
+ //$sitelogo = 'PRICELIZERLOGO';
1310
+ //$facebook_key = "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/facebook.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
1311
+ //$twitter_key = "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/tweet.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
1312
+ //$linkedin_key = $message .= "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/linked.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
1313
+ //$google_key = "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/google.jpeg.png' style='width:24px; height:24px; margin-right:0px;' ></a></td></tr>";
1314
+ $signup_url = "<a href =".$link." class='for-hover' style='color: #fff; background:#2f90e2; font-size:14px; padding:6px 14px; text-decoration:none; border:1px solid #fff; border-radius: 4px; box-shadow:3px 3px 3px #ccc; margin-bottom:10px; display:inline-block;'>1-Click Signup</a>";
1315
+ //$signup_url = "<button type='button' onclick = 'window.location.href=".$link."'>1-Click Sign Up</button>";
1316
+ if($result_data['4']['status']=='yes')
1317
+ $url_data = 'http://www.pricelizer.com';
1318
+ else $url_data="//404notfound";
1319
+ $image_logo_footer = $this->getSkinUrl('images/powered-by-pricelizer.png',array('_secure'=>true));
1320
+ $pricelizer_link = "<a href ='http://www.pricelizer.com/'><img src ='".$image_logo_footer."' alt='Powered by Pricelizer'></a>";
1321
+ $flink_url = "<a style='color:#989898;margin-left:10px; text-decoration:none;' href='http://staging.pricelizer.com'>Powered by Pricelizer</a>";
1322
+ $modifieddata5 = str_replace($facebook,$facebook_key,$modifieddata4);
1323
+ $modifieddata6 = str_replace($linkedin,$linkedin_key,$modifieddata5);
1324
+ $modifieddata7 = str_replace($twitter,$twitter_key,$modifieddata6);
1325
+ $signup_button = str_replace($google, $google_key,$modifieddata7);
1326
+ $pricelizer_logo_link = str_replace($simple_signup,$signup_url,$signup_button);
1327
+ $footer = str_replace($footer_link,$flink_url,$pricelizer_logo_link);
1328
+ $modifieddata2 = str_replace($pricelizerlink,$pricelizer_link,$footer);
1329
+ $mail->Subject = "Abandoned Cart Alert"; //Subject od your mail
1330
+ $mail->AddAddress($email, "fghgfhgfh"); //To address who will receive this email
1331
+
1332
+ //$to = "ajay010791@gmail.com";
1333
+ //$subject = "Abandon Cart Alert";
1334
+ $headers = "From: Abandon Cart Alert";
1335
+ $headers .= "Reply-To: ". ($to) . "\r\n";
1336
+ $headers .= "CC: ajay.singh@webeneturetech.com";
1337
+ $headers = "MIME-Version: 1.0" . PHP_EOL;
1338
+ $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
1339
+ $message = '<html><body>';
1340
+ $message .= '<table rules="all" cellpadding="10" border="0" >';
1341
+
1342
+ $unsuburl = "<a href ='".$unsubs_url_key."'><span style='color:#999'>click here</span></a>";
1343
+ $message .= "</body></html>";
1344
+ $unsubs ="UNCLICK";
1345
+ $entire_content_data = str_replace($unsubs,$unsuburl,$modifieddata2);
1346
+ $entire_content = str_replace($sitename,$site_name_magento,$entire_content_data);
1347
+ $message .= $entire_content;
1348
+
1349
+ $mail->MsgHTML($message); //Put your body of the message you can place html code here
1350
+ $send = $mail->Send(); //Send the mails
1351
+
1352
+
1353
+
1354
+ }
1355
+
1356
+ }
1357
+ //---------------------------------------------------------------EndSend alert to all user---------------------------------------------------//
1358
+
1359
+ ?>
1360
+
1361
+ <?php
1362
+ $read4 = Mage::getSingleton('core/resource')->getConnection('core_read') ;
1363
+ $write4 = Mage::getSingleton('core/resource')->getConnection('core_write');
1364
+ $result5 = $read4->fetchAll("SELECT * FROM log_url_info where url_id ='14'");
1365
+ //print_r($result5);
1366
+ $base_url = $result5['0']['url'];
1367
+
1368
+ ?>
1369
+ <div id="mybox">
1370
+
1371
+ </div>
1372
+
1373
+ <script>
1374
+ jQuery(document).ready(function(){
1375
+ jQuery("#auto").click(function(){
1376
+ jQuery("#show_val").show();
1377
+ });
1378
+ jQuery("#manual").click(function(){
1379
+ jQuery("#show_val").hide();
1380
+ });
1381
+ });
1382
+ </script>
1383
+
1384
+ <script>
1385
+ jQuery(document).ready(function(){
1386
+ jQuery("#set_form").click(function(){
1387
+ var status = jQuery("input[name=status]:checked").val();
1388
+ var day = jQuery('#days').val();
1389
+ var mage_find = jQuery('#mage_find').val();
1390
+ //alert(day);
1391
+ //alert(status);
1392
+ fromData = 'status='+status+'&day='+day+'&mage_find='+mage_find;
1393
+ jQuery.ajax({
1394
+ type: 'POST',
1395
+ data:fromData,
1396
+ url:"http://localhost/magento19/userformupdate.php",dataType: "json",
1397
+ success:function(result){
1398
+ var Success = result
1399
+ alert(Success.message);
1400
+ }
1401
+ });
1402
+ });
1403
+ });
1404
+ </script>
1405
+
1406
+
1407
+
1408
+
1409
+ <?php
1410
+ $log_url ="SELECT * FROM log_url_info where url_id ='14'";
1411
+ $log_exc = mysql_query($log_url);
1412
+ $exc = mysql_fetch_row($log_exc);
1413
+ $base_site_url = $exc['1'];
1414
+
1415
+ $user_email = $result_data['0']['user_email'];
1416
+ $license_key = $result_data['0']['license_key'];
1417
+ $start_date = $result_data['0']['start_date'];
1418
+ $end_date = $result_data['0']['end_date'];
1419
+ $duration_type = $result_data['0']['duration_type'];
1420
+ $current_date = Mage::getModel('core/date')->date('Y-m-d');
1421
+
1422
+ }
1423
+ elseif($end_date == $current_date && $duration_type =="limited")
1424
+ {
1425
+
1426
+ $prev_date = date('Y-m-d', strtotime($end_date .' -7 day'));
1427
+ if($prev_date)
1428
+ {
1429
+ $prev_date;
1430
+ $end_date;
1431
+ $date1=date_create($end_date);
1432
+ $date2=date_create($prev_date);
1433
+ $diff=date_diff($date1,$date2);
1434
+ $date_diff = $diff->format("%a");
1435
+ $date_diff;
1436
+ if($date_diff=="7")
1437
+ {
1438
+ $to = $user_email;
1439
+ //$to = "ajay.singh@webenturetech.com";
1440
+ $subject = "Abandon Cart Alert";
1441
+ $headers = "From:'".$to."'";
1442
+ $headers .= "Reply-To: ". strip_tags($user_email) . "\r\n";
1443
+ $headers .= "CC: susan@example.com\r\n";
1444
+ $headers = "MIME-Version: 1.0" . PHP_EOL;
1445
+ $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
1446
+ $message = '<html><body>';
1447
+ $message .= '<table rules="all" style="border-color: #666;" cellpadding="10">';
1448
+ $message .= "<tr style='border-bottom:1px solid #ffffff;'><td style='border-bottom:1px solid #ffffff;'>Hi</td></tr>";
1449
+ $message .= "<tr style='border-bottom:1px solid #ffffff;'><td style='border-bottom:1px solid #ffffff;line-height:16px;' >Thank you for your shown interest in the products that you have put into .<br/>
1450
+ your cart at ".$base_site_url.".<br>
1451
+ We see that you left the cart for a few days and just like to offer you some<br>
1452
+ extra service.<br/>
1453
+ We work with Pricelizer that offers automatic price alerts when the products<br>
1454
+ already chosen by you drop in price.<br/>
1455
+ If you like to receive an email alert when we change the price on the specific<br> product(s) in your cart?
1456
+
1457
+ Then simply with a single mouse click on any of the listed buttons using your<br> preferred social media account we can create an account and have the<br> products added without you having to think a second more about this, Just<br> wait and see as the price drop.</td></tr>";
1458
+ $message .= "<tr><td><a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/facebook.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
1459
+ $message .= "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/linked.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
1460
+ $message .= "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/tweet.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
1461
+ $message .= "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/google.jpeg.png' style='width:24px; height:24px; margin-right:0px;' ></a></td></tr>";
1462
+ $message .= "<tr style='border:1px solid rgba(0,0,0,0);'><td>If you have any questions about the price monitoring service checkout www.pricelizer.com</td></tr>";
1463
+ $message .= "</table>";
1464
+ $message .= "</body></html>";
1465
+ mail($to,$subject,$message,$headers);
1466
+ if(mail)
1467
+ {
1468
+ echo 'mail has been send';
1469
+
1470
+ }
1471
+
1472
+ }
1473
+
1474
+ }
1475
+
1476
+
1477
+
1478
+ }
1479
+
1480
+ else
1481
+ {
1482
+ ?>
1483
+
1484
+ <?php
1485
+ $img_default = Mage::getDesign()->getSkinUrl('images/gear-01.png');
1486
+ echo'<div class="align_center">';
1487
+ echo '<img src="'.$img_default.'" id ="img_link">';
1488
+ echo'<h2>Please Provide liscence key</h2>';
1489
+ echo '<div class="form_content">';
1490
+ echo '<input type="text" name ="email" placeholder="Email" value="'.$user_email.'">'.'<br>';
1491
+ echo '<input type="text" name="licese_key" id="liscence_key" placeholder="License Key" value ="'.$license_key.'">'.'<br>';
1492
+ echo '<button name="set_licen" id="set_licen">GRAB LICENSE KEY</button>';
1493
+ echo '</div>';
1494
+ echo '</div>';
1495
+
1496
+ }
1497
+
1498
+ $img_success = Mage::getDesign()->getSkinUrl('images/gear-03.png');
1499
+ $img_bug = Mage::getDesign()->getSkinUrl('images/gear-02.png');
1500
+ $img_default = Mage::getDesign()->getSkinUrl('images/gear-01.png');
1501
+
1502
+
1503
+ ?>
1504
+ <input type="hidden" value="<?php echo $img_success; ?>" id="success">
1505
+ <input type="hidden" value="<?php echo $img_bug; ?>" id="bug">
1506
+ <input type="hidden" value="<?php echo $img_default; ?>" id="default">
1507
+ <?php
1508
+ $read4 = Mage::getSingleton('core/resource')->getConnection('core_read') ;
1509
+ $write4 = Mage::getSingleton('core/resource')->getConnection('core_write');
1510
+ $result5 = $read4->fetchAll("SELECT * FROM log_url_info where url_id ='14'");
1511
+ //print_r($result5);
1512
+ $base_url = $result5['0']['url'];
1513
+
1514
+ ?>
1515
+
1516
+ <script>
1517
+ jQuery(document).ready(function(){
1518
+ jQuery("#set_licen").click(function(){
1519
+ var email = jQuery("input[name=email]").val();
1520
+ var liscence_key = jQuery('#liscence_key').val();
1521
+ var mage_find = jQuery('#mage_find').val();
1522
+ var succ = jQuery("#success").val();
1523
+ var bug = jQuery("#bug").val();
1524
+ var deafult = jQuery("#default").val();
1525
+
1526
+ //alert(day);
1527
+ //alert(status);
1528
+ fromData = 'email='+email+'&liscence_key='+liscence_key+'&mage_find='+mage_find;
1529
+ jQuery.ajax({
1530
+ type: 'POST',
1531
+ data:fromData,
1532
+ datatype:'json',
1533
+ url:'<?php echo 'http://localhost/magento19/license_key.php'?>',
1534
+ success:function(result){
1535
+ var Success = result;
1536
+
1537
+ if(result==succ)
1538
+ {
1539
+ jQuery("#img_link").attr("src", result);
1540
+ location.reload();
1541
+ }
1542
+ else if(result==bug)
1543
+ {
1544
+
1545
+ jQuery("#img_link").attr("src", result);
1546
+ }
1547
+ else if(result == deafult)
1548
+ {
1549
+ jQuery("#img_link").attr("src", result);
1550
+
1551
+ }
1552
+
1553
+ }
1554
+ });
1555
+ });
1556
+ });
1557
+ </script>
1558
+
app/design/adminhtml/default/default/template/Abandoncart/abandoncart.phtml ADDED
@@ -0,0 +1,1558 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+
27
+ ?>
28
+ <?php
29
+ /**
30
+ * @var $this Mage_Currencysymbol_Block_Adminhtml_System_Currencysymbol
31
+ */
32
+ ?>
33
+ <style>
34
+ .grid h1.title-name{font-size:14px; text-transform:capitalize; float:left;margin-right:10px;}
35
+ .invite_link{font-weight:bold; text-decoration:none;}
36
+ .invite_link:hover{font-weight:bold; text-decoration:underline;}
37
+ .purche-remind{ color: #337ab7; }
38
+ .purche-remind:hover{ color: #2e6da4; }
39
+ a.price_alert {
40
+ background: #EA7601;
41
+ color: #FFFFFF;
42
+ margin-bottom: 10px;
43
+ padding: 5px 10px;
44
+ text-align: right;
45
+ text-decoration: none; border-radius:5px;
46
+ }
47
+ a.price_alert:hover{color: #FFFFFF; background:orange;}
48
+ .email_send{color:#66a202;}
49
+ .email_not_send{color:#ff0000;}
50
+ table.data td{font-size:0.9em;}
51
+ .cont-mang{
52
+ width: 100%;
53
+ float: left;
54
+ }
55
+ a.for-hover:hover{ background:none repeat scroll 0 0 rgba(68, 161, 205, 0.6)!important; }
56
+ .data input[type="text"]{
57
+ width: 80%;
58
+ }
59
+ .grid {
60
+ float: left;
61
+ width: 100%;
62
+ }
63
+ .app-title-name{text-align:center; padding:10px; /*font-size:24px;*/ color:#eb5e00;}
64
+
65
+ .click-price{width:100%; height:30px; text-align:center;}
66
+
67
+ .setting-from{ width:250px; margin:0px auto; height:50px;}
68
+ .setting-from .man{ width:100px; float:left; font-size:14px;}
69
+ .setting-from .auto{ width:100px; float:left; font-size:14px;}
70
+ .form_content {
71
+ border: 1px solid #EB5E00;
72
+ box-shadow: 0 0 3px #DDDDDD;
73
+ padding: 30px;
74
+ text-align: center;
75
+
76
+
77
+ }
78
+ .form_content input {
79
+ height: 40px;
80
+ margin-bottom: 10px;
81
+ width: 100%;
82
+
83
+ }
84
+ .form_content button {
85
+ padding:10px;
86
+ }
87
+ .align_center{
88
+ margin:0 auto;
89
+ width:30%;
90
+ margin-top:90px;
91
+ text-align:center;
92
+
93
+ }
94
+ .align_center h2{
95
+ color:#EB5E00;
96
+ }
97
+ .setting-from .man {
98
+ float: left;
99
+ font-size: 14px;
100
+ width: 100%;
101
+ }
102
+ .setting-from .auto {
103
+ float: left;
104
+ font-size: 14px;
105
+ font-weight: bold;
106
+ margin-top: 4px;
107
+ width: auto;
108
+ margin-left:76px;
109
+ }
110
+ .setting-from {
111
+ height: 50px;
112
+ margin: 0 auto;
113
+ width: 330px;
114
+ }
115
+ .man > h3{
116
+ float: left;
117
+ margin-right: 10px;
118
+ }
119
+ .man .auto label{ margin-left: 5px; }
120
+ .btn_manage{
121
+ text-align:center;
122
+ }
123
+ .btn_manage select{
124
+ width:200px;
125
+ height:20px;
126
+ margin-bottom:5px;
127
+ }
128
+ .btn_align{
129
+ text-align:center;
130
+ }
131
+ #set_form{margin-top:5px;}
132
+ </style>
133
+ <style type="text/css">
134
+ .white_content {
135
+ background-color: #ffffff;
136
+ border: 5px solid ;
137
+ height: 50%;
138
+ left: 25%;
139
+ max-height: 500px;
140
+ overflow: auto;
141
+ padding: 13px 15px;
142
+ position: fixed;
143
+ top: 20%;
144
+ width: 50%;
145
+ z-index: 1008;
146
+ display:none;
147
+ }
148
+ .close-btn
149
+ {
150
+ font-size:20px;
151
+ float:right;
152
+ }
153
+
154
+
155
+ .pagination {
156
+ border-radius: 4px;
157
+ display: inline-block;
158
+ margin: 0px;
159
+ padding-left: 0;
160
+ }
161
+ .pagination > li {
162
+ display: inline;
163
+ }
164
+
165
+ .pagination > li:first-child > a, .pagination > li:first-child > span {
166
+ border-bottom-left-radius: 4px;
167
+ border-top-left-radius: 4px;
168
+ margin-left: 0;
169
+ }
170
+
171
+ .pagination > li, .pagination > li > span {
172
+ background-color: #fff;
173
+ border: 1px solid #ddd;
174
+ color: #428bca;
175
+ float: left;
176
+ line-height: 1.42857;
177
+ margin-left: -1px;
178
+ padding: 6px 12px;
179
+ position: relative;
180
+ text-decoration: none;
181
+ }
182
+
183
+
184
+
185
+ .page{
186
+ /*float:left;*/
187
+ background-color: transparent /*#fff*/;
188
+ border: none;
189
+ color: #000;
190
+ line-height: 1.42857;
191
+ margin-left: -1px;
192
+ padding: 6px 12px;
193
+ position: relative;
194
+ text-decoration: none;
195
+ text-align: center;
196
+ }
197
+ .centrick{width:275px; margin:0px auto;}
198
+ .centrick:after{clear:both;}
199
+ #img_link{height:150px;}
200
+ </style>
201
+
202
+ <?php
203
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read') ;
204
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
205
+ $logo_src = Mage::getDesign()->getSkinUrl('images/',array('_area'=>'frontend/rwd'));
206
+ $remove_base = $logo_src.'logo.gif';
207
+ $logo_url_data = str_replace('/base','',$remove_base);
208
+ $logo_url = $img_logo;
209
+ $store_url = Mage::getBaseUrl();
210
+ $site_name_mag = Mage::app()->getStore()->getFrontendName();
211
+ $site_name_magento = '<a href="'.$store_url.'" style="color:white">'.$site_name_mag.'</a>';
212
+ $this->getSkinUrl('images/powered-by-pricelizer.png',array('_secure'=>true));
213
+ $getResult = $read_data->fetchAll("select * from Abandon_cart_licensekey");
214
+ $lisc_key = $getResult['0']['license_key'];
215
+ $loginUrl = 'http://www.pricelizer.com/webService/getLogo?liscence_key='.$lisc_key.'';
216
+ $agent= 'Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)';
217
+ $ch = curl_init();
218
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
219
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
220
+ curl_setopt($ch, CURLOPT_URL,$loginUrl);
221
+ curl_setopt($ch, CURLOPT_USERAGENT, $agent);
222
+ $result=curl_exec($ch);
223
+ curl_close($ch);
224
+ $result=json_decode($result);
225
+ $customer_logo = $result->{'logo'}; // 12345
226
+ $img_logo = '<img src="'.$customer_logo.'">';
227
+
228
+
229
+ ?>
230
+
231
+ <?php
232
+
233
+ // Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
234
+ //echo $this->getSkinUrl('images/logo.gif', array('_secure'=>true));
235
+ $smtp = Mage::getBaseDir().'/smtp/class.phpmailer.php';
236
+ $smtp2 = Mage::getBaseDir().'/smtp/class.smtp.php';
237
+ include($smtp); ?>
238
+ <?php include($smtp2); ?>
239
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
240
+ <script> jQuery.noConflict(); </script>
241
+ <?php
242
+
243
+ $result10 = $read_data->fetchAll("select * from Abandon_cart_licensekey");
244
+ $footer_img = $read_data->fetchAll("select * from core_config_data");
245
+
246
+ $magento_footer_icon = $footer_img['101']['value'];
247
+ $logo_src = Mage::getDesign()->getSkinUrl('',array('_area'=>'frontend/rwd'));
248
+ $logo_url_data = str_replace('/base','',$magento_footer_icon);
249
+ //echo $pricelizer_link = '<img src="'.$logo_src.$logo_url_data.'">';
250
+
251
+
252
+ $registered_user_email = $result10['0']['user_email'];
253
+ $registered_user_license_key = $result10['0']['license_key'];
254
+ echo '<input type="hidden" id ="reg_user_email" value="'.$registered_user_email.'">';
255
+ echo '<input type="hidden" id ="reg_user_lkey" value="'.$registered_user_license_key.'">';
256
+ ?>
257
+ <input type="hidden" id ="mage_find" value="<?php echo Mage::helper("greenmodule")->find_mage(); ?>">
258
+ <?php
259
+ $read4 = Mage::getSingleton('core/resource')->getConnection('core_read') ;
260
+ $write4 = Mage::getSingleton('core/resource')->getConnection('core_write');
261
+ $result5 = $read4->fetchAll("SELECT * FROM log_url_info where url_id ='14'");
262
+ $result_data = $read4->fetchAll("select * from abandoned_extensionsetting");
263
+ //print_r($result_data);
264
+ $base_url = $result5['0']['url'];
265
+ if ($result_data['6']['status'] == 'yes')
266
+ {
267
+ ?>
268
+ <script>
269
+ jQuery(document).ready(function(){
270
+ jQuery(window).load(function() {
271
+ var reg_user_email = jQuery('#reg_user_email').val();
272
+ var reg_user_lkey = jQuery('#reg_user_lkey').val();
273
+ var mage_find = jQuery('#mage_find').val();
274
+ fromData = 'reg_user_email='+reg_user_email+'&reg_user_lkey='+reg_user_lkey+'&mage_find='+mage_find;
275
+ jQuery.ajax({
276
+ type: 'POST',
277
+ data:fromData,
278
+ url:"http://localhost/magento19/package_setting.php",
279
+ success:function(result){
280
+ var obj = jQuery.parseJSON(result);
281
+ var user_id =obj.data.user_id;
282
+ var package_type = obj.data.package_name;
283
+ jQuery("#user_id").val(user_id);
284
+ jQUery("#pack_name").val(package_type);
285
+
286
+ }
287
+ });
288
+
289
+
290
+
291
+
292
+ });
293
+ });
294
+ </script>
295
+ <?php } ?>
296
+ <input type="hidden" value ="" id="user_id" name ="reg_id">
297
+ <input type ="hidden" value ="" id ="pack_name" name ="pur_ext">
298
+ <div class="content-header">
299
+ <?php echo '<h3 class="icon-head head-report-shopcart-abandoned">Abandoned carts</h3>'; ?>
300
+ <table cellspacing="0">
301
+ <tr>
302
+ <!--<td style="width:50%;"><h3 class="icon-head head-system-currency"><?php echo $this->getHeader() ?></h3></td>
303
+ <td class="form-buttons"> -->
304
+ <?php
305
+ echo $this->getSaveButtonHtml();
306
+ ?>
307
+ </td>
308
+ </tr>
309
+ </table>
310
+ </div>
311
+
312
+ <?php
313
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read') ;
314
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
315
+ $result_data = $read_data->fetchAll("select * from Abandon_cart_licensekey");
316
+ //print_r($result_data);
317
+ $user_email = $result_data['0']['user_email'];
318
+ $license_key = $result_data['0']['license_key'];
319
+ $start_date = $result_data['0']['start_date'];
320
+ $end_date = $result_data['0']['end_date'];
321
+ $duration_type = $result_data['0']['duration_type'];
322
+ $packagename = $result_data['0']['package_name'];
323
+ $current_date = Mage::getModel('core/date')->date('Y-m-d');
324
+ $items = Mage::getModel('sales/order')->getCollection()
325
+ ->join(array('item' => 'sales/order_item'), 'main_table.entity_id = item.order_id')
326
+ ->addFieldToFilter('customer_id', $customerId);
327
+ if($license_key!="")
328
+ {
329
+
330
+ ?>
331
+
332
+ <?php $this->getCurrencySymbolsData();?>
333
+
334
+
335
+ <?php if($packagename=="LARGE"||$packagename=="MEDIUM"||$packagename=="Pro"||$packagename=="XXL"||$packagename=="Flex") { ?>
336
+
337
+
338
+
339
+
340
+ <!------------------------------------End total number of users------------------------->
341
+
342
+
343
+ <div class="click-price">
344
+ <a href ='./?user_email_all=true' class='price_alert'>Click to Invite all abandoned cart users to receive price alerts</a>
345
+ </div>
346
+ <?php } ?>
347
+
348
+ <?php
349
+ $read4 = Mage::getSingleton('core/resource')->getConnection('core_read') ;
350
+ $write4 = Mage::getSingleton('core/resource')->getConnection('core_write');
351
+ $result5 = $read4->fetchAll("SELECT * FROM log_url_info where url_id ='14'");
352
+ //print_r($result5);
353
+ $base_url = $result5['0']['url'];
354
+
355
+ ?>
356
+ <div id="mybox">
357
+
358
+ </div>
359
+
360
+
361
+
362
+ <script>
363
+ jQuery(document).ready(function(){
364
+ jQuery("#send_api").click(function(){
365
+ var fbapi = jQuery('#fbkey').val();
366
+ var mage_find = jQuery('#mage_find').val();
367
+ //alert(day);
368
+ //alert(status);
369
+ formData = '&fbkey='+fbapi+'&mage_find='+mage_find;
370
+ jQuery.ajax({
371
+ type: 'POST',
372
+ data:formData,
373
+ url:"<?php echo $base_url; ?>app/design/adminhtml/default/default/template/Abandoncart/socialmedia.php",dataType: "json",
374
+ success:function(result){
375
+ var Success = result
376
+ alert(url);
377
+ alert(Success.message);
378
+ }
379
+ });
380
+ });
381
+ });
382
+ </script>
383
+
384
+ <?php
385
+
386
+
387
+ //------------------------------------------------------------Scan all Abandon Cart Product---------------------------------------------//
388
+ $read1 = Mage::getSingleton('core/resource')->getConnection('core_read') ;
389
+ $write1 = Mage::getSingleton('core/resource')->getConnection('core_write');
390
+ $result1 = $read1->fetchAll("select * from abandon_cart where id ='1'");
391
+ //print_r($result1);
392
+ $status_abandon = $result1['0']['abandon_status'];
393
+ $status_day = $result1['0']['day'];
394
+ $status_date = $result1['0']['date'];
395
+ //echo $status_day;
396
+
397
+ // $rec_count = 1;
398
+ //$product1 = Mage::getModel('reports/quote_collection')->GetCollection();
399
+ $count_data = $read1->fetchAll('select count(customer_id) from sales_flat_quote');
400
+ //print_r($count_data);
401
+ // $rec_count = $product1->getSelect()->limit(20);
402
+ //echo 'sdf'.$rec_count;
403
+ //$rec_count = $product1->count();
404
+ $collection1 = Mage::getResourceModel('reports/quote_collection');
405
+ $collection1->prepareForAbandonedReport();
406
+
407
+ $rec_count = $collection1->count();
408
+ $emailArr=array();
409
+
410
+ //$page = $_GET{'page'} + 1;
411
+ if(!isset($_GET{'page'}) || $_GET{'page'} == 0)
412
+ {
413
+ $page =1;
414
+ }else
415
+ {
416
+ $page = $_GET{'page'};
417
+ }
418
+ $pageFrame = 3;
419
+ //echo 'pageno->'.$page;
420
+
421
+ $limit = $_GET['folder'];
422
+ $offset = $limit * ($page-1);
423
+ if($rec_count%2==0)
424
+ {
425
+ $total=$rec_count/$limit;
426
+ }
427
+ else
428
+ {
429
+ $total_odd=$rec_count/$limit;
430
+ $total=$total_odd +1 ;
431
+ }
432
+
433
+
434
+ $collection = Mage::getResourceModel('reports/quote_collection');
435
+ $collection->prepareForAbandonedReport();
436
+
437
+ $collection->getSelect()->limit($offset,$limit);
438
+
439
+ //$collection->reset();
440
+ $collection->getSelect()->limit($limit,$offset);
441
+ //$output = $collection->load()->toArray();
442
+
443
+ // echo $left_rec = $rec_count - ($page * $rec_limit);
444
+
445
+
446
+ $i=0;
447
+ foreach($collection->load()->toArray() as $key=>$user_detail)
448
+ {
449
+ $details=$user_detail;
450
+ foreach($user_detail as $key=>$user_email)
451
+ {
452
+
453
+ //echo $user_email['email'];
454
+ //$emailArr[$key] ['email']= $user_email['email'];
455
+ //$emailArr[$key] ['entity_id']= $user_email['entity_id'];
456
+ }
457
+
458
+ }
459
+
460
+ //echo '<pre>';print_r($details);
461
+
462
+
463
+ foreach ($details as $key=>$val)
464
+
465
+ {
466
+
467
+
468
+ $emailArr[$key] ['email']= $val['email'];
469
+ $emailArr[$key] ['entity_id']= $val['entity_id'];
470
+ $emailArr[$key] ['customer_id']= $val['customer_id'];
471
+ //echo '<h1 style="font-size:20px;">'. $val['customer_name'].'</h1>';
472
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read') ;
473
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
474
+ $result = $read->fetchAll("select * from sales_flat_quote_item where quote_id ='".$val['entity_id']."'");
475
+
476
+ echo '<div class="grid">';
477
+ echo '<h1 class="title-name">'. $val['customer_name'].'</h1>';
478
+ ?>
479
+ <a href = "javascript:void(0)" class="button" onclick = "document.getElementById('light_<?php echo $val["customer_id"]; ?>').style.display='block';">View details</a>
480
+ <?php $subscription_status = $read->fetchall("SELECT * FROM Abandoned_email_subscription where customer_id ='".$val['customer_id']."'");
481
+ ?>
482
+
483
+ <!--------------------------------Subscribe functionality------------------------------------------>
484
+
485
+ <input type="hidden" id="customer_name_<?php echo $val['customer_id']; ?>" value="<?php echo $val['customer_name']; ?>">
486
+ <input type="hidden" id="customer_email_<?php echo $val['customer_id']; ?>" value="<?php echo $val['email']; ?>">
487
+ <input type="hidden" id="customer_id_<?php echo $val['customer_id']; ?>" value="<?php echo $val['customer_id']; ?>">
488
+
489
+ <?php if($subscription_status['0']['subscribe_status'] ==""||$subscription_status['0']['subscribe_status'] =="yes"){ ?>
490
+ &nbsp;&nbsp;<button id ="unsub_<?php echo $val['customer_id']; ?>">Disable price alerts</button>
491
+ <script>
492
+ jQuery(document).ready(function(){
493
+ jQuery("#unsub_<?php echo $val['customer_id']; ?>").click(function(){
494
+ var customer_email = jQuery("#customer_email_<?php echo $val['customer_id']; ?>").val();
495
+ var customer_name = jQuery('#customer_name_<?php echo $val['customer_id']; ?>').val();
496
+ var customer_id = jQuery('#customer_id_<?php echo $val['customer_id']; ?>').val();
497
+ var mage_find = jQuery('#mage_find').val();
498
+ fromData = 'customer_email='+customer_email+'&customer_name='+customer_name+'&customer_id='+customer_id+'&mage_find='+mage_find;
499
+ jQuery.ajax({
500
+ type: 'POST',
501
+ data:fromData,
502
+ datatype:'json',
503
+ url:"http://localhost/magento19/unsubscribe.php",
504
+ success:function(result){
505
+ var Success = result;
506
+ alert(result);
507
+ location.reload();
508
+ // $('#img_link').src();
509
+ jQuery("#img_link").attr("src", result);
510
+
511
+ }
512
+ });
513
+ });
514
+ });
515
+ </script>
516
+
517
+ <!--------------------------------End Subscribe functionality------------------------------------------>
518
+
519
+
520
+ <?php } else { ?>
521
+
522
+ <!--------------------------------UnSubscribe functionality------------------------------------------>
523
+
524
+ &nbsp;&nbsp;<button id ="subs_<?php echo $val['customer_id']; ?>">Send customer price alert invitation</button>
525
+
526
+ <script>
527
+ jQuery(document).ready(function(){
528
+ jQuery("#subs_<?php echo $val['customer_id']; ?>").click(function(){
529
+ var customer_email = jQuery("#customer_email_<?php echo $val['customer_id']; ?>").val();
530
+ var customer_name = jQuery('#customer_name_<?php echo $val['customer_id']; ?>').val();
531
+ var customer_id = jQuery('#customer_id_<?php echo $val['customer_id']; ?>').val();
532
+ var mage_find = jQuery('#mage_find').val();
533
+ //alert(customer_email);
534
+ //alert(status);
535
+ fromData = 'customer_email='+customer_email+'&customer_name='+customer_name+'&customer_id='+customer_id+'&mage_find='+mage_find;
536
+ jQuery.ajax({
537
+ type: 'POST',
538
+ data:fromData,
539
+ datatype:'json',
540
+ url:"/subscribe.php",
541
+ success:function(result){
542
+ var Success = result;
543
+ alert(result);
544
+ location.reload();
545
+ // $('#img_link').src();
546
+ jQuery("#img_link").attr("src", result);
547
+
548
+ }
549
+ });
550
+ });
551
+ });
552
+ </script>
553
+
554
+ <?php } ?>
555
+
556
+ <!---------------------------EndUnSubscribe functionality------------------------------------------>
557
+
558
+ <div id="light_<?php echo $val['customer_id']; ?>" class="white_content">
559
+ <div class="col-full"><a href="javascript:void(0)" onclick="document.getElementById('light_<?php echo $val["customer_id"]; ?>').style.display='none';document.getElementById('fade').style.display='none'" class="close-btn">X</a></div>
560
+ <table>
561
+ <h1><?php echo $val['customer_name'];?></h1>
562
+ <tr><td>Customer Name</td><td><?php echo $val['customer_name'];?></td></tr>
563
+ <tr><td>Customer Id</td><td><?php echo $val['customer_id'];?></td></tr>
564
+ <tr><td>First Name</td><td><?php echo $val['customer_firstname'];?></td></tr>
565
+ <tr><td>Last Name</td><td><?php echo $val['customer_lastname'];?></td></tr>
566
+ <tr><td>Email</td><td><?php echo $val['email'];?></td></tr>
567
+ <tr><td>Gender</td><td><?php echo $val['customer_gender'];?></td></tr>
568
+ <tr><td>Customer Dob</td><td><?php echo $val['customer_dob'];?></td></tr>
569
+
570
+ </table>
571
+
572
+ </div>
573
+ <?php
574
+ echo '<div class="hor-scroll">';
575
+ echo '<table cellspacing="0" class="data" id="gridAbandoned_table">';
576
+ echo '<thead>';
577
+ echo '<tr class="headings">';
578
+ echo '<th class="no-link"><span class="nobr">User Name:</span></th>';
579
+ echo '<th class="no-link"><span class="nobr">Product Name:</span></th>';
580
+ echo '<th class="no-link"><span class="nobr">Quantity:</span></th>';
581
+ echo '<th class="no-link"><span class="nobr">SKU:</span></th>';
582
+ echo '<th class="no-link"><span class="nobr">Price</span></th>';
583
+ echo '<th class="no-link"><span class="nobr">Date</span></th>';
584
+ echo '<th class="no-link"><span class="nobr">Day</span></th>';
585
+ if($packagename=="LARGE"||$packagename=="MEDIUM"||$packagename=="Pro"||$packagename=="XXL"||$packagename=="Flex") {
586
+ echo '<th class="no-link"><span class="nobr">Email Status</span></th>';
587
+ }
588
+ echo '</tr>';
589
+ echo '</thead>';
590
+ echo '<tbody>';
591
+
592
+
593
+ $prod_arr = array();
594
+ $products=array();
595
+ $i=0;
596
+ foreach($result as $data_data)
597
+ {
598
+ $products[]= $data_data['product_id'];
599
+ //echo '<pre>';print_r($data_data);
600
+
601
+ echo '<tr class="even pointer">';
602
+ echo '<td>'.$val['firstname'].'</td>';
603
+ //echo 'test=>'.$val['entity_id'];
604
+ echo '<td>'.$data_data['name'].'</td>';
605
+ echo '<td>'.$data_data['qty'].'</td>';
606
+ echo '<td>'.$data_data['sku'].'</td>';
607
+ echo '<td>'.$data_data['price'].'</td>';
608
+ echo '<td>'.$data_data['created_at'].'</td>';
609
+
610
+ $date1=date_create($data_data['created_at']);
611
+ $date2=date_create($status_date);
612
+ $diff=date_diff($date1,$date2);
613
+ echo '<td>'.$diff->format("%a").'</td>'; ?>
614
+ <?php
615
+ $read2 = Mage::getSingleton('core/resource')->getConnection('core_read') ;
616
+ $write2 = Mage::getSingleton('core/resource')->getConnection('core_write');
617
+ $result2 = $read2->fetchAll("select abandon_email_status from Abandon_added_product where added_user_id ='".$val['customer_id']."' AND added_prod_id ='".$data_data['product_id']."' ");
618
+
619
+ if($packagename=="LARGE"||$packagename=="MEDIUM"||$packagename=="Pro"||$packagename=="XXL"||$packagename=="Flex")
620
+ {
621
+ if(!empty($result2))
622
+ {
623
+ foreach($result2 as $email_val)
624
+ {
625
+ //echo $abandon_email_status = $email_val['abandon_email_status'];
626
+ //$abandon_user_email[] = $abandon_email_status;
627
+ //echo '<br>';
628
+ if($email_val['abandon_email_status']=='0')
629
+ {
630
+ echo "<td><span class='email_send'>Email Sent</span></td>";
631
+ }else{
632
+ echo "<td><span class='email_not_send'>Not Sent</span></td>";
633
+ }
634
+
635
+ }
636
+ }else{
637
+ echo "<td><span class='email_not_send'>Not Sent</span></td>";
638
+
639
+ }
640
+ }
641
+ ?>
642
+
643
+
644
+ <?php
645
+ $noofday[]= $diff->format("%a");
646
+ $name[] = $data_data['name'];
647
+ $qty[] = $data_data['qty'];
648
+ $sku[] = $data_data['sku'];
649
+ $price[] = $data_data['price'];
650
+ $created_at[] = $data_data['created_at'];
651
+ $s1_name = serialize($name);
652
+ $s1_qty = serialize($qty);
653
+ $s1_sku = serialize($sku);
654
+ $s1_price = serialize($price);
655
+ $s1_created_at = serialize($created_at);
656
+
657
+ $cron_mail[] = $val['email'];
658
+ //echo $val['entity_id'];
659
+ //$entity_id[] = $val['entity_id'];
660
+
661
+ $val['customer_id'];
662
+ $val['entity_id'];
663
+ $prod_arr[$i] = array('customer_id'=>$val['customer_id'],'entity_id'=>$val['entity_id']);
664
+ $i++;
665
+ }
666
+ $emailArr[$key]['product_id']=implode(',',$products);
667
+ //echo $val['email'];
668
+
669
+ $abandon_arr = array();
670
+ $abandon_arr['email'] = $val['email'];
671
+ $abandon_arr['products'] = $prod_arr;
672
+ $abandonurl = urlencode(json_encode($abandon_arr));
673
+ $items=implode(",",$products);
674
+ echo '</tr>';
675
+ if($packagename=="LARGE"||$packagename=="MEDIUM"||$packagename=="Pro"||$packagename=="Flex")
676
+ {
677
+ echo '<tr>';
678
+ echo '<td colspan="8"><a href ="./?activate='.$val['email'].'&entity_id='. $val['entity_id'].'&customer_id='.$val['customer_id'].'&item_id='.$items.'" class="invite_link">';
679
+ ?>
680
+ <?php
681
+ $subscription_status = $read->fetchall("SELECT * FROM Abandoned_email_subscription where customer_id ='".$val['customer_id']."'");
682
+ $extension_setting = $read->fetchAll("select * from abandoned_extensionsetting");
683
+ if($extension_setting['9']['status']=='on')
684
+ {
685
+ if($subscription_status['0']['subscribe_status']!='no')
686
+ {
687
+
688
+
689
+ if($result2['0']['abandon_email_status'] == '0')
690
+
691
+ {
692
+ echo '<div class="email_send">Invite sent, click here will send the invite again</div>';
693
+
694
+ }
695
+ else
696
+
697
+ {
698
+ echo 'Invite user to auto-setup price alerts';
699
+ }
700
+
701
+
702
+ }
703
+
704
+
705
+ else
706
+
707
+ { echo '</a>';
708
+ echo 'The customer has chosen to NOT activate Pricelizer.';
709
+
710
+ }
711
+ }
712
+
713
+ echo '</a>';
714
+ if($extension_setting['5']['status']=='yes')
715
+ {
716
+ echo '&nbsp;&nbsp;<a href ="./?pur_reminder='.$val['email'].'&entity_id='. $val['entity_id'].'&customer_id='.$val['customer_id'].'&item_id='.$items.'" class="invite_link purche-remind">Purchase Reminder</a>';
717
+ }
718
+ ?>
719
+ </td>
720
+
721
+ <?php
722
+ echo '</tr>';
723
+ }
724
+ echo '</tbody>';
725
+ echo '</table>';
726
+ echo '</div>';
727
+ echo '</div>';
728
+
729
+ }
730
+
731
+ ?>
732
+
733
+ <?php $hostlink = 'www.'.$_SERVER['HTTP_HOST']; ?>
734
+ <!---------------------------------------------------------Pagination View------------------------------->
735
+
736
+ <?php $mainurl = Mage::getBaseUrl();
737
+ $modified_url_link = str_replace("/index.php/"," ",$mainurl);
738
+ $modified_url = '<a href="'.$modified_url.'">'.$hostlink.'</a>';
739
+
740
+ ?>
741
+
742
+ <!---------------------------------------------------------EndPagination View------------------------------->
743
+ <?php
744
+ echo '<div class="centrick">';
745
+
746
+ echo '<div class="page">Page'.$page.'</div>';
747
+ $html .= '<ol class="pagination">';
748
+ if(isset($page) && $page != 1){
749
+ $start = $page - 1;
750
+ $end = $start + $pageFrame;
751
+ }
752
+ /* if($end > $rec_count){
753
+ $start = $rec_count - ($pageFrame-1);
754
+ }else{
755
+ $rec_count = $end-1;
756
+ }
757
+ echo 'cc'.$rec_count.'cc';*/
758
+ for($i = $start; $i<=$total; $i++)
759
+ {
760
+ if($i >= 1){
761
+ if($page){
762
+ $html .= ($page == $i) ? '<li class="current">'. $i .'</li>' : '<li><a href="'.$url.'?page='.$i.'">'. $i .'</a></li>';
763
+ }else{
764
+ $html .= ($i == 1) ? '<li class="current">'. $i .'</li>' : '<li><a href="'.$url.'?page='.$i.'">'. $i .'</a></li>';
765
+ }
766
+ }
767
+
768
+ }
769
+
770
+ $html .= '</ol>';
771
+
772
+
773
+ ?>
774
+ <?php echo $html; ?>
775
+ <br>
776
+ <div style="clear:both;"></div>
777
+ <h3 class="app-title-name">Select customers per page</h2>
778
+ <select name ="dayinterval" id ="myselect" style ="margin:0px auto;display:block">
779
+ <option><?php if($_GET['folder']=="") { echo '10';} else { echo $_GET['folder']; } ?></option>
780
+ <option value ="10">10</option>
781
+ <option value ="25">25</option>
782
+ <option value ="50">50</option>
783
+ <option value ="100">100</option>
784
+ </select>
785
+ <script>
786
+ jQuery(document).ready(function(){
787
+ jQuery('#myselect').change(function () {
788
+ var data = jQuery('#myselect').val();
789
+ var newURLString = window.location.href +
790
+ "?folder=" + jQuery('#myselect').val();
791
+ window.location.href = newURLString;
792
+ });
793
+ });
794
+ </script>
795
+ <?php
796
+ echo '</div>';?>
797
+
798
+
799
+
800
+
801
+
802
+ <?php
803
+ //------------------------------------------------------------End Scan all Abandon Cart Product---------------------------------------------//
804
+
805
+ $base_url = Mage::getBaseUrl();
806
+ //--------------------------------------------------------Send user email------------------------------------------------------------//
807
+
808
+ $read1 = Mage::getSingleton('core/resource')->getConnection('core_read') ;
809
+ $write1 = Mage::getSingleton('core/resource')->getConnection('core_write');
810
+ $result1 = $read1->fetchAll("select * from abandon_cart where id ='1'");
811
+ //print_r($result1);
812
+ $status_abandon = $result1['0']['abandon_status'];
813
+ $status_day = $result1['0']['day'];
814
+ $status_date = $result1['0']['date'];
815
+
816
+ $log_url = $read1->fetchAll("SELECT * FROM log_url_info where url_id ='14'");
817
+ $base_site_url = $log_url['0']['url'];
818
+
819
+ //echo $status_day;
820
+ if($status_abandon == '0')
821
+ {
822
+
823
+ if(isset($_GET['activate']))
824
+ {
825
+
826
+
827
+ $result_data = $read1->fetchAll("select * from abandoned_extensionsetting");
828
+ //echo '<pre>';print_r($result_data);
829
+ $get_id = $_GET['d'];
830
+ $explode_name = explode('=',$_GET['d']);
831
+ $uname = $explode_name['1'];
832
+ $email = $_GET['activate'];
833
+ $mail = new PHPMailer; // call the class
834
+ $mail->IsSMTP();
835
+ $mail->SMTPSecure = "";
836
+ //$mail->SMTPDebug = 2;
837
+ $mail->Host = 'c4072.sgvps.net'; // platinum.waxspace.com Hostname of the mail server
838
+ $mail->Port = '587'; //Port of the SMTP like to be 25, 80, 465 or 587
839
+ $mail->SMTPAuth = true; //Whether to use SMTP authentication
840
+ $mail->Username = 'sara.johnsson@pricelizer.com';
841
+ $mail->Password = 'Tihwd100s'; //Password for SMTP authentication
842
+ //$mail->AddReplyTo("admin@quiconnaitunbon.com.com", "Admin"); //reply-to address
843
+ $mail->SetFrom("karl.lillrud@maneer.se"); //From address of the mail
844
+ //$mail->SMTPSecure = "tls";
845
+ $link = "".$base_url."abandon/front/maildata/".'?entity_id='.$_GET['entity_id'].'&customer_id='.$_GET['customer_id'].'&item_id='.$_GET['item_id'];
846
+ $cur_date = date("l d F ");
847
+ $customer_id =$_GET['customer_id']; // set this to the ID of the customer.
848
+ $customer_data = Mage::getModel('customer/customer')->load($customer_id);
849
+ $customer_name = $customer_data['firstname'];
850
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read') ;
851
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
852
+ $abandon_days = $read->fetchall("select * from abandon_cart");
853
+ $alert_days = $abandon_days['0']['day'];
854
+ $getemaildata = $read->fetchall("select * from abandon_email_template");
855
+ $firstname = "FIRSTNAME";
856
+ $site_url = "SITEURL";
857
+ $xdays = "XDAYSFROMSETTINGS";
858
+ $unsubscribe_key = "UNSUBSCRIBE";
859
+ $date_data = "DATE";
860
+ $culogo = "CULOGO";
861
+ $blank ="";
862
+
863
+ $unsubs_url_key = $base_url.'abandon/front/unsub/?unsubs='.$_GET['customer_id'];
864
+ $pstring = $getemaildata['0']['email_conetnt'];
865
+ $modifieddata = str_replace($firstname,$customer_name,$pstring);
866
+ $modifieddata1 = str_replace($site_url,$modified_url,$modifieddata);
867
+ $modifieddata3 = str_replace($xdays,$alert_days,$modifieddata1);
868
+ $modified_data1 = str_replace($date_data,$cur_date,$modifieddata3);
869
+ $modified_logo = str_replace($culogo,$img_logo,$modified_data1);
870
+ $modifieddata4 = str_replace($unsubscribe_key,$unsubs_url_key,$modified_logo);
871
+ $facebook = "FACEBOOK";
872
+ $linkedin = "LINKEDIN";
873
+ $twitter = "TWITTER";
874
+ $google = "GOOGLE";
875
+ $simple_signup = '1CLICKSIGNUP';
876
+ $sitename = 'SITENAME';
877
+ if($result_data['3']['status']=='yes')
878
+ $pricelizerlink = 'PRICELIZERLOGO';
879
+ else $blank;
880
+
881
+ //$sitelogo = 'PRICELIZERLOGO';
882
+ //$facebook_key = "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/facebook.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
883
+ //$twitter_key = "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/tweet.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
884
+ //$linkedin_key = $message .= "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/linked.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
885
+ //$google_key = "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/google.jpeg.png' style='width:24px; height:24px; margin-right:0px;' ></a></td></tr>";
886
+ $signup_url = "<a href =".$link." class='for-hover' style='color: #fff; background:#2f90e2; font-size:14px; padding:6px 14px; text-decoration:none; border:1px solid #fff; border-radius: 4px; box-shadow:3px 3px 3px #ccc; margin-bottom:10px; display:inline-block;'>1-Click Signup</a>";
887
+ //$signup_url = "<button type='button' onclick = 'window.location.href=".$link."'>1-Click Sign Up</button>";
888
+ $image_logo_footer = $this->getSkinUrl('images/powered-by-pricelizer.png',array('_secure'=>true));
889
+
890
+ if($result_data['4']['status']=='yes')
891
+ $url_data = 'http://www..pricelizer.com';
892
+ else $url_data="//404notfound";
893
+ $pricelizer_link = "<a href ='http://www.pricelizer.com/'><img src ='".$image_logo_footer."' alt='Powered by Pricelizer' ></a>";
894
+ $flink_url = "<a style='color:#989898;margin-left:10px; text-decoration:none;' href='http://staging.pricelizer.com'>Powered by Pricelizer</a>";
895
+ $modifieddata5 = str_replace($facebook,$facebook_key,$modifieddata4);
896
+ $modifieddata6 = str_replace($linkedin,$linkedin_key,$modifieddata5);
897
+ $modifieddata7 = str_replace($twitter,$twitter_key,$modifieddata6);
898
+ $signup_button = str_replace($google, $google_key,$modifieddata7);
899
+ $pricelizer_logo_link = str_replace($simple_signup,$signup_url,$signup_button);
900
+ $footer = str_replace($footer_link,$flink_url,$pricelizer_logo_link);
901
+ $modifieddata2 = str_replace($pricelizerlink,$pricelizer_link,$footer);
902
+ $mail->Subject = "Abandoned Cart Alert"; //Subject od your mail
903
+ $mail->AddAddress($email, "fghgfhgfh"); //To address who will receive this email
904
+
905
+ //$to = "ajay010791@gmail.com";
906
+ //$subject = "Abandon Cart Alert";
907
+ $headers = "From: Abandon Cart Alert";
908
+ $headers .= "Reply-To: ". ($to) . "\r\n";
909
+ $headers .= "CC: ajay.singh@webeneturetech.com";
910
+ $headers = "MIME-Version: 1.0" . PHP_EOL;
911
+ $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
912
+ $message = '<html><body>';
913
+ $message .= '<table rules="all" cellpadding="10" border="0" >';
914
+
915
+ $unsuburl = "<a href ='".$unsubs_url_key."'><span style='color:#999'>click here</span></a>";
916
+ $message .= "</body></html>";
917
+ $unsubs ="UNCLICK";
918
+ $entire_content_data = str_replace($unsubs,$unsuburl,$modifieddata2);
919
+ $entire_content = str_replace($sitename,$site_name_magento,$entire_content_data);
920
+ $message .= $entire_content;
921
+
922
+ $mail->MsgHTML($message); //Put your body of the message you can place html code here
923
+ $send = $mail->Send(); //Send the mails
924
+
925
+ if($send){
926
+ echo "send";
927
+ }
928
+
929
+ }
930
+ elseif(isset($_GET['pur_reminder']))
931
+ {
932
+
933
+ $result_data = $read1->fetchAll("select * from abandoned_extensionsetting");
934
+ //echo '<pre>';print_r($result_data);
935
+ $get_id = $_GET['d'];
936
+ $explode_name = explode('=',$_GET['d']);
937
+ $uname = $explode_name['1'];
938
+ $email = $_GET['pur_reminder'];
939
+ $mail = new PHPMailer; // call the class
940
+ $mail->IsSMTP();
941
+ $mail->SMTPSecure = "";
942
+ //$mail->SMTPDebug = 2;
943
+ $mail->Host = 'c4072.sgvps.net'; // platinum.waxspace.com Hostname of the mail server
944
+ $mail->Port = '587'; //Port of the SMTP like to be 25, 80, 465 or 587
945
+ $mail->SMTPAuth = true; //Whether to use SMTP authentication
946
+ $mail->Username = 'sara.johnsson@pricelizer.com';
947
+ $mail->Password = 'Tihwd100s'; //Password for SMTP authentication
948
+ //$mail->AddReplyTo("admin@quiconnaitunbon.com.com", "Admin"); //reply-to address
949
+ $mail->SetFrom("Contact@PriceLizer.com"); //From address of the mail
950
+ //$mail->SMTPSecure = "tls";
951
+ $link = "".$base_url."abandon/front/maildata/".'?entity_id='.$_GET['entity_id'].'&customer_id='.$_GET['customer_id'].'&item_id='.$_GET['item_id'];
952
+ $productId = $_GET['item_id'];
953
+ $explode_id = explode(',',$productId);
954
+
955
+ foreach($explode_id as $pr_idd)
956
+ {
957
+ $product = Mage::getModel('catalog/product')->load($pr_idd);
958
+ //echo '<pre>';print_r($product);
959
+ $prr_name = $product->name;
960
+ $productMediaConfig = Mage::getModel('catalog/product_media_config');
961
+ $smallImageUrl = $productMediaConfig->getMediaUrl($product->getSmallImage());
962
+ $prr_img ='<img src="'.$smallImageUrl.'" style="width:40px;height:60px; min-height:65px;">';
963
+ $prr_details_data .= '<li style="list-style:none; padding:0;">'.$prr_img.'<br>'.$prr_name.'<br></li>';
964
+
965
+ }
966
+ $prr_details = '<ul style="display:inline-block; padding:0; width:100%; ">'.$prr_details_data.'</ul>';
967
+ $cur_date = date("l d F ");
968
+ $customer_id =$_GET['customer_id']; // set this to the ID of the customer.
969
+ $customer_data = Mage::getModel('customer/customer')->load($customer_id);
970
+ $customer_name = $customer_data['firstname'];
971
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read') ;
972
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
973
+ $abandon_days = $read->fetchall("select * from abandon_cart");
974
+ $alert_days = $abandon_days['0']['day'];
975
+ $getemaildata = $read->fetchall("select * from abandon_email_template");
976
+ $firstname = "FIRSTNAME";
977
+ $site_url = "SITEURL";
978
+ $xdays = "XDAYSFROMSETTINGS";
979
+ $unsubscribe_key = "UNSUBSCRIBE";
980
+ $date_data = "DATE";
981
+ $culogo = "CULOGO";
982
+ $blank ="";
983
+ $unsubs_url_key = $base_url.'abandon/front/unsub/?unsubs='.$_GET['customer_id'];
984
+ $pstring = $getemaildata['2']['email_conetnt'];
985
+
986
+ $product_id =$_GET['item_id'];
987
+ $explode_id = explode(',',$product_id);
988
+ foreach($explode_id as $item_id_data)
989
+ {
990
+ $obj = Mage::getModel('catalog/product');
991
+ $_product = $obj->load($item_id_data);
992
+ $_product->getName();
993
+ $product_title[] = $_product->getName();
994
+ }
995
+ $product_key = "PRODUCTLIST";
996
+ $list_of_product .= implode('<br>',$product_title);
997
+ $product_search = str_replace($product_key,$prr_details,$pstring);
998
+ $modifieddata = str_replace($firstname,$customer_name,$product_search);
999
+ $modifieddata1 = str_replace($site_url,$modified_url,$modifieddata);
1000
+ $modifieddata3 = str_replace($xdays,$alert_days,$modifieddata1);
1001
+ $modified_data1 = str_replace($date_data,$cur_date,$modifieddata3);
1002
+ $modified_logo = str_replace($culogo,$img_logo,$modified_data1);
1003
+ $modifieddata4 = str_replace($unsubscribe_key,$unsubs_url_key,$modified_logo);
1004
+ $facebook = "FACEBOOK";
1005
+ $linkedin = "LINKEDIN";
1006
+ $twitter = "TWITTER";
1007
+ $google = "GOOGLE";
1008
+ $simple_signup = '1CLICKSIGNUP';
1009
+ if($result_data['3']['status']=='yes')
1010
+ $pricelizerlink = 'PRICELIZERLOGO';
1011
+ else $blank;
1012
+ if($result_data['4']['status']=='yes')
1013
+ $footer_link = "FLINK";
1014
+ else $blank;
1015
+ $sitename = 'SITENAME';
1016
+
1017
+ $signup_url = "<a href =".$link." class='for-hover' style='color: #fff; background:#2f90e2; font-size:14px; padding:6px 14px; text-decoration:none; border:1px solid #fff; border-radius: 4px; box-shadow:3px 3px 3px #ccc; margin-bottom:10px; display:inline-block;'>1-Click Signup</a>";
1018
+ //$signup_url = "<button type='button' onclick = 'window.location.href=".$link."'>1-Click Sign Up</button>";
1019
+ if($result_data['4']['status']=='yes')
1020
+ $url_data = 'http://staging.pricelizer.com';
1021
+ else $url_data="//404notfound";
1022
+ $image_logo_footer = $this->getSkinUrl('images/powered-by-pricelizer.png',array('_secure'=>true));
1023
+ $pricelizer_link = "<a href ='http://www.pricelizer.com/'><img src ='".$image_logo_footer."' alt='Powered by Pricelizer' ></a>";
1024
+ $flink_url = "<a style='color:#989898;margin-left:10px; text-decoration:none;' href='http://staging.pricelizer.com'>Powered by Pricelizer</a>";
1025
+ $modifieddata5 = str_replace($facebook,$facebook_key,$modifieddata4);
1026
+ $modifieddata6 = str_replace($linkedin,$linkedin_key,$modifieddata5);
1027
+ $modifieddata7 = str_replace($twitter,$twitter_key,$modifieddata6);
1028
+ $signup_button = str_replace($google, $google_key,$modifieddata7);
1029
+ $pricelizer_logo_link = str_replace($simple_signup,$signup_url,$signup_button);
1030
+ $footer = str_replace($footer_link,$flink_url,$pricelizer_logo_link);
1031
+ $modifieddata2 = str_replace($pricelizerlink,$pricelizer_link,$footer);
1032
+ $mail->Subject = "Abandoned Cart Alert"; //Subject od your mail
1033
+ $mail->AddAddress($email, "fghgfhgfh"); //To address who will receive this email
1034
+
1035
+ //$to = "ajay010791@gmail.com";
1036
+ //$subject = "Abandon Cart Alert";
1037
+ $headers = "From: Abandon Cart Alert";
1038
+ $headers .= "Reply-To: ". ($to) . "\r\n";
1039
+ $headers .= "CC: ajay.singh@webeneturetech.com";
1040
+ $headers = "MIME-Version: 1.0" . PHP_EOL;
1041
+ $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
1042
+ $message = '<html><body>';
1043
+ $message .= '<table rules="all" cellpadding="10" border="0" >';
1044
+
1045
+ $unsuburl = "<a href ='".$unsubs_url_key."'><span style='color:#999'>click here</span></a>";
1046
+ $message .= "</body></html>";
1047
+ $unsubs ="UNCLICK";
1048
+
1049
+ $entire_content_data = str_replace($unsubs,$unsuburl,$modifieddata2);
1050
+ $useremailkey = 'USEREMAIL';
1051
+ $get_user_email = str_replace($useremailkey,$email,$entire_content_data);
1052
+ $entire_content = str_replace($sitename,$site_name_magento,$get_user_email);
1053
+ $message .= $entire_content;
1054
+ $mail->MsgHTML($message);
1055
+ $send = $mail->Send();
1056
+
1057
+ if($send){
1058
+ echo "send";
1059
+ }
1060
+
1061
+ }
1062
+
1063
+
1064
+ }
1065
+
1066
+ elseif($status_abandon == '1')
1067
+ {
1068
+
1069
+ //echo $to = $_GET['d'];
1070
+ foreach($noofday as $valday){
1071
+ if($valday== $status_day){
1072
+ foreach($emailArr as $cron_user_email)
1073
+ {
1074
+
1075
+ $result_data = $read1->fetchAll("select * from abandoned_extensionsetting");
1076
+ //echo '<pre>';print_r($result_data);
1077
+ $get_id = $_GET['d'];
1078
+ $explode_name = explode('=',$_GET['d']);
1079
+ $uname = $explode_name['1'];
1080
+ $email = $cron_user_email['email'];
1081
+ #DebugBreak() ;
1082
+ $mail = new PHPMailer; // call the class
1083
+ $mail->IsSMTP();
1084
+ $mail->SMTPSecure = "";
1085
+ //$mail->SMTPDebug = 2;
1086
+ $mail->Host = 'c4072.sgvps.net'; // platinum.waxspace.com Hostname of the mail server
1087
+ $mail->Port = '587'; //Port of the SMTP like to be 25, 80, 465 or 587
1088
+ $mail->SMTPAuth = true; //Whether to use SMTP authentication
1089
+ $mail->Username = 'sara.johnsson@pricelizer.com';
1090
+ $mail->Password = 'Tihwd100s'; //Password for SMTP authentication
1091
+ //$mail->AddReplyTo("admin@quiconnaitunbon.com.com", "Admin"); //reply-to address
1092
+ $mail->SetFrom("sara.johnsson@pricelizer.com"); //From address of the mail
1093
+ //$mail->SMTPSecure = "tls";
1094
+ $link = "".$base_url."abandon/front/maildata/".'?entity_id='.$_GET['entity_id'].'&customer_id='.$cron_user_email['customer_id'].'&item_id='.$cron_user_email['product_id'];
1095
+ $cur_date = date("l d F ");
1096
+ $customer_id =$cron_user_email['customer_id']; // set this to the ID of the customer.
1097
+ $customer_data = Mage::getModel('customer/customer')->load($customer_id);
1098
+ $customer_name = $customer_data['firstname'];
1099
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read') ;
1100
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
1101
+ $abandon_days = $read->fetchall("select * from abandon_cart");
1102
+ $alert_days = $abandon_days['0']['day'];
1103
+ $getemaildata = $read->fetchall("select * from abandon_email_template");
1104
+ $firstname = "FIRSTNAME";
1105
+ $site_url = "SITEURL";
1106
+ $xdays = "XDAYSFROMSETTINGS";
1107
+ $unsubscribe_key = "UNSUBSCRIBE";
1108
+ $date_data = "DATE";
1109
+ $culogo = "CULOGO";
1110
+ $blank ="";
1111
+ $unsubs_url_key = $base_url.'abandon/front/unsub/?unsubs='.$_GET['customer_id'];
1112
+ $pstring = $getemaildata['2']['email_conetnt'];
1113
+
1114
+ $product_id =$cron_user_email['product_id'];
1115
+ $explode_id = explode(',',$product_id);
1116
+ foreach($explode_id as $item_id_data)
1117
+ {
1118
+ $obj = Mage::getModel('catalog/product');
1119
+ $_product = $obj->load($item_id_data);
1120
+ $_product->getName();
1121
+ $product_title[] = $_product->getName();
1122
+ }
1123
+ $product_key = "PRODUCTLIST";
1124
+ $list_of_product .= implode('<br>',$product_title);
1125
+ $product_search = str_replace($product_key,$list_of_product,$pstring);
1126
+ $modifieddata = str_replace($firstname,$customer_name,$product_search);
1127
+ $modifieddata1 = str_replace($site_url,$modified_url,$modifieddata);
1128
+ $modifieddata3 = str_replace($xdays,$alert_days,$modifieddata1);
1129
+ $modified_data1 = str_replace($date_data,$cur_date,$modifieddata3);
1130
+ $modified_logo = str_replace($culogo,$img_logo,$modified_data1);
1131
+ $modifieddata4 = str_replace($unsubscribe_key,$unsubs_url_key,$modified_logo);
1132
+
1133
+ $facebook = "FACEBOOK";
1134
+ $linkedin = "LINKEDIN";
1135
+ $twitter = "TWITTER";
1136
+ $google = "GOOGLE";
1137
+ $simple_signup = '1CLICKSIGNUP';
1138
+ if($result_data['3']['status']=='yes')
1139
+ $pricelizerlink = 'PRICELIZERLOGO';
1140
+ else $blank;
1141
+ if($result_data['4']['status']=='yes')
1142
+ $footer_link = "FLINK";
1143
+ else $blank;
1144
+ $sitename = 'SITENAME';
1145
+
1146
+
1147
+
1148
+ //$sitelogo = 'PRICELIZERLOGO';
1149
+ //$facebook_key = "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/facebook.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
1150
+ //$twitter_key = "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/tweet.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
1151
+ //$linkedin_key = $message .= "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/linked.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
1152
+ //$google_key = "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/google.jpeg.png' style='width:24px; height:24px; margin-right:0px;' ></a></td></tr>";
1153
+ $signup_url = "<a href =".$link." class='for-hover' style='color: #fff; background:#2f90e2; font-size:14px; padding:6px 14px; text-decoration:none; border:1px solid #fff; border-radius: 4px; box-shadow:3px 3px 3px #ccc; margin-bottom:10px; display:inline-block;'>1-Click Signup</a>";
1154
+ //$signup_url = "<button type='button' onclick = 'window.location.href=".$link."'>1-Click Sign Up</button>";
1155
+ if($result_data['4']['status']=='yes')
1156
+ $url_data = 'http://staging.pricelizer.com';
1157
+ else $url_data="//404notfound";
1158
+ $image_logo_footer = $this->getSkinUrl('images/powered-by-pricelizer.png',array('_secure'=>true));
1159
+ $pricelizer_link = "<a href ='http://www.pricelizer.com/'><img src ='".$image_logo_footer."' alt='Powered by Pricelizer' ></a>";
1160
+ $flink_url = "<a style='color:#989898;margin-left:10px; text-decoration:none;' href='http://staging.pricelizer.com'>Powered by Pricelizer</a>";
1161
+ $modifieddata5 = str_replace($facebook,$facebook_key,$modifieddata4);
1162
+ $modifieddata6 = str_replace($linkedin,$linkedin_key,$modifieddata5);
1163
+ $modifieddata7 = str_replace($twitter,$twitter_key,$modifieddata6);
1164
+ $signup_button = str_replace($google, $google_key,$modifieddata7);
1165
+ $pricelizer_logo_link = str_replace($simple_signup,$signup_url,$signup_button);
1166
+ $footer = str_replace($footer_link,$flink_url,$pricelizer_logo_link);
1167
+ $modifieddata2 = str_replace($pricelizerlink,$pricelizer_link,$footer);
1168
+ $mail->Subject = "Abandoned Cart Alert"; //Subject od your mail
1169
+ $mail->AddAddress($email, "fghgfhgfh"); //To address who will receive this email
1170
+
1171
+ //$to = "ajay010791@gmail.com";
1172
+ //$subject = "Abandon Cart Alert";
1173
+ $headers = "From: Abandon Cart Alert";
1174
+ $headers .= "Reply-To: ". ($to) . "\r\n";
1175
+ $headers .= "CC: ajay.singh@webeneturetech.com";
1176
+ $headers = "MIME-Version: 1.0" . PHP_EOL;
1177
+ $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
1178
+ $message = '<html><body>';
1179
+ $message .= '<table rules="all" cellpadding="10" border="0" >';
1180
+
1181
+ $unsuburl = "<a href ='".$unsubs_url_key."'><span style='color:#999'>click here</span></a>";
1182
+ $message .= "</body></html>";
1183
+ $unsubs ="UNCLICK";
1184
+
1185
+ $entire_content_data = str_replace($unsubs,$unsuburl,$modifieddata2);
1186
+ $entire_content = str_replace($sitename,$site_name_magento,$entire_content_data);
1187
+ $message .= $entire_content;
1188
+
1189
+ $mail->MsgHTML($message);
1190
+ $send = $mail->Send();
1191
+
1192
+ if($send){
1193
+ echo "send";
1194
+ }
1195
+ }
1196
+ }
1197
+ }
1198
+ }
1199
+ $status_abandon = $result1['0']['abandon_status'];
1200
+ //------------------------------------------EndSend user email-------------------------------------------//
1201
+ //---------------------------------------------------Form control commented by ajay singh------------------------------------------------//
1202
+ //echo $currUrl= $this->getUrl('').$_SERVER['REQUEST_URI'];
1203
+ echo '<br>';
1204
+ if($packagename=="LARGE"||$packagename=="MEDIUM"||$packagename=="Pro"||$packagename=="XXL"||$packagename=="Flex") {
1205
+ $date = date("Y-m-d H:i:s");
1206
+ echo '<h1 class="app-title-name setting_panel" style="font-size:18px">Send invitation to users with abandoned carts.</h1>';
1207
+
1208
+ ?>
1209
+
1210
+ <div class="setting-from">
1211
+ <div class="man">
1212
+
1213
+ <div class="auto">
1214
+ <input type="radio" name="status" <?php if($status_abandon == '1'){ echo 'checked'; } else
1215
+ { } ?> id = "auto" value="1"><label>Automatic&nbsp;</label>
1216
+ <input type="radio" name="status" <?php if($status_abandon == '0'){ echo 'checked'; } else
1217
+ { } ?> id="manual" value="0"><label>Manually</label></div></div>
1218
+
1219
+ <?php
1220
+ echo '<div id ="show_val" style="display:none;" class="btn_manage">';
1221
+ echo '<h3 style="text-align: center; white-space: nowrap; float: left; margin-left: -35%;">Define how many days a cart should be abandoned before you send the alert</h3>';
1222
+ echo '<select name="days" id="days">';
1223
+ echo '<option>Select days-</option>';
1224
+ echo '<option value="1">1 Day</option>';
1225
+ echo '<option value="5">5 Days</option>';
1226
+ echo '<option value="10">10 Days</option>';
1227
+ echo '<option value="15">15 Days</option>';
1228
+ echo '<option value="20">20 Days</option>';
1229
+ echo '<option value="25">25 Days</option>';
1230
+ echo '<option value="30">30 Days</option>';
1231
+
1232
+ echo '</select>';
1233
+ echo '</div>';
1234
+ echo '<div class="btn_align">';
1235
+ echo '<button name="set" id ="set_form" > Save settings </button>'.'<br>';
1236
+ echo '</div>';
1237
+
1238
+ //echo $days =$_POST['days'];
1239
+ //---------------------------------------------------Form control commented by ajay singh------------------------------------------------//
1240
+ ?>
1241
+ <?php } ?>
1242
+ </div>
1243
+
1244
+ <?php
1245
+ //---------------------------------------------------------------Send alert to all user---------------------------------------------------//
1246
+ if($_GET['user_email_all']=='true')
1247
+ {
1248
+ $subscription_status = $read->fetchall("SELECT customer_email FROM Abandoned_email_subscription where subscribe_status ='yes'");
1249
+
1250
+
1251
+ $result=array_intersect($subscription_status,$emailArr);
1252
+
1253
+
1254
+ foreach($emailArr as $cron_user_email)
1255
+ {
1256
+ //print_r($cron_user_email);
1257
+ //$prodId=explode(',',$cron_user_email['product_id']); //echo '<pre>';print_r($cron_user_email);
1258
+ $link = "".$base_url."abandon/front/maildata/".'?entity_id='.$cron_user_email['entity_id'].'&prod_id='.$cron_user_email['product_id'].'&customer_id='.$cron_user_email['customer_id'];
1259
+
1260
+ $customer_id =$cron_user_email['customer_id']; // set this to the ID of the customer.
1261
+ $customer_data = Mage::getModel('customer/customer')->load($customer_id);
1262
+ $customer_name = $customer_data['firstname'];
1263
+
1264
+ $email = $cron_user_email['email'];
1265
+ $mail = new PHPMailer; // call the class
1266
+ $mail->IsSMTP();
1267
+ $mail->SMTPSecure = "";
1268
+ //$mail->SMTPDebug = 2;
1269
+ $mail->Host = 'c4072.sgvps.net'; // platinum.waxspace.com Hostname of the mail server
1270
+ $mail->Port = '465'; //Port of the SMTP like to be 25, 80, 465 or 587
1271
+ $mail->SMTPAuth = true; //Whether to use SMTP authentication
1272
+ $mail->Username = 'sara.johnsson@pricelizer.com';
1273
+ $mail->Password = 'Tihwd100s'; //Password for SMTP authentication
1274
+ //$mail->AddReplyTo("admin@quiconnaitunbon.com.com", "Admin"); //reply-to address
1275
+ $mail->SetFrom("sara.johnsson@pricelizer.com"); //From address of the mail
1276
+ //$mail->SMTPSecure = "tls";
1277
+ // put your while loop here like below,
1278
+
1279
+ //sending link
1280
+
1281
+ $cur_date = date("l d F ");
1282
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read') ;
1283
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
1284
+ $abandon_days = $read->fetchall("select * from abandon_cart");
1285
+ $alert_days = $abandon_days['0']['day'];
1286
+ $getemaildata = $read->fetchall("select * from abandon_email_template");
1287
+ $firstname = "FIRSTNAME";
1288
+ $site_url = "SITEURL";
1289
+ $xdays = "XDAYSFROMSETTINGS";
1290
+ $unsubscribe_key = "UNSUBSCRIBE";
1291
+ $date_data = "DATE";
1292
+ $culogo = "CULOGO";
1293
+ $unsubs_url_key = $base_url.'abandon/front/unsub/?unsubs='.$cron_user_email['customer_id'];
1294
+ $pstring = $getemaildata['0']['email_conetnt'];
1295
+ $modifieddata = str_replace($firstname,$customer_name,$pstring);
1296
+ $modifieddata1 = str_replace($site_url,$modified_url,$modifieddata);
1297
+ $modifieddata3 = str_replace($xdays,$alert_days,$modifieddata1);
1298
+ $modified_data1 = str_replace($date_data,$cur_date,$modifieddata3);
1299
+ $modified_logo = str_replace($culogo,$img_logo,$modified_data1);
1300
+ $modifieddata4 = str_replace($unsubscribe_key,$unsubs_url_key,$modified_logo);
1301
+ $facebook = "FACEBOOK";
1302
+ $linkedin = "LINKEDIN";
1303
+ $twitter = "TWITTER";
1304
+ $google = "GOOGLE";
1305
+ $simple_signup = '1CLICKSIGNUP';
1306
+ $pricelizerlink = 'PRICELIZERLOGO';
1307
+ $footer_link ='FLINK';
1308
+ $sitename = 'SITENAME';
1309
+ //$sitelogo = 'PRICELIZERLOGO';
1310
+ //$facebook_key = "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/facebook.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
1311
+ //$twitter_key = "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/tweet.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
1312
+ //$linkedin_key = $message .= "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/linked.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
1313
+ //$google_key = "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/google.jpeg.png' style='width:24px; height:24px; margin-right:0px;' ></a></td></tr>";
1314
+ $signup_url = "<a href =".$link." class='for-hover' style='color: #fff; background:#2f90e2; font-size:14px; padding:6px 14px; text-decoration:none; border:1px solid #fff; border-radius: 4px; box-shadow:3px 3px 3px #ccc; margin-bottom:10px; display:inline-block;'>1-Click Signup</a>";
1315
+ //$signup_url = "<button type='button' onclick = 'window.location.href=".$link."'>1-Click Sign Up</button>";
1316
+ if($result_data['4']['status']=='yes')
1317
+ $url_data = 'http://www.pricelizer.com';
1318
+ else $url_data="//404notfound";
1319
+ $image_logo_footer = $this->getSkinUrl('images/powered-by-pricelizer.png',array('_secure'=>true));
1320
+ $pricelizer_link = "<a href ='http://www.pricelizer.com/'><img src ='".$image_logo_footer."' alt='Powered by Pricelizer'></a>";
1321
+ $flink_url = "<a style='color:#989898;margin-left:10px; text-decoration:none;' href='http://staging.pricelizer.com'>Powered by Pricelizer</a>";
1322
+ $modifieddata5 = str_replace($facebook,$facebook_key,$modifieddata4);
1323
+ $modifieddata6 = str_replace($linkedin,$linkedin_key,$modifieddata5);
1324
+ $modifieddata7 = str_replace($twitter,$twitter_key,$modifieddata6);
1325
+ $signup_button = str_replace($google, $google_key,$modifieddata7);
1326
+ $pricelizer_logo_link = str_replace($simple_signup,$signup_url,$signup_button);
1327
+ $footer = str_replace($footer_link,$flink_url,$pricelizer_logo_link);
1328
+ $modifieddata2 = str_replace($pricelizerlink,$pricelizer_link,$footer);
1329
+ $mail->Subject = "Abandoned Cart Alert"; //Subject od your mail
1330
+ $mail->AddAddress($email, "fghgfhgfh"); //To address who will receive this email
1331
+
1332
+ //$to = "ajay010791@gmail.com";
1333
+ //$subject = "Abandon Cart Alert";
1334
+ $headers = "From: Abandon Cart Alert";
1335
+ $headers .= "Reply-To: ". ($to) . "\r\n";
1336
+ $headers .= "CC: ajay.singh@webeneturetech.com";
1337
+ $headers = "MIME-Version: 1.0" . PHP_EOL;
1338
+ $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
1339
+ $message = '<html><body>';
1340
+ $message .= '<table rules="all" cellpadding="10" border="0" >';
1341
+
1342
+ $unsuburl = "<a href ='".$unsubs_url_key."'><span style='color:#999'>click here</span></a>";
1343
+ $message .= "</body></html>";
1344
+ $unsubs ="UNCLICK";
1345
+ $entire_content_data = str_replace($unsubs,$unsuburl,$modifieddata2);
1346
+ $entire_content = str_replace($sitename,$site_name_magento,$entire_content_data);
1347
+ $message .= $entire_content;
1348
+
1349
+ $mail->MsgHTML($message); //Put your body of the message you can place html code here
1350
+ $send = $mail->Send(); //Send the mails
1351
+
1352
+
1353
+
1354
+ }
1355
+
1356
+ }
1357
+ //---------------------------------------------------------------EndSend alert to all user---------------------------------------------------//
1358
+
1359
+ ?>
1360
+
1361
+ <?php
1362
+ $read4 = Mage::getSingleton('core/resource')->getConnection('core_read') ;
1363
+ $write4 = Mage::getSingleton('core/resource')->getConnection('core_write');
1364
+ $result5 = $read4->fetchAll("SELECT * FROM log_url_info where url_id ='14'");
1365
+ //print_r($result5);
1366
+ $base_url = $result5['0']['url'];
1367
+
1368
+ ?>
1369
+ <div id="mybox">
1370
+
1371
+ </div>
1372
+
1373
+ <script>
1374
+ jQuery(document).ready(function(){
1375
+ jQuery("#auto").click(function(){
1376
+ jQuery("#show_val").show();
1377
+ });
1378
+ jQuery("#manual").click(function(){
1379
+ jQuery("#show_val").hide();
1380
+ });
1381
+ });
1382
+ </script>
1383
+
1384
+ <script>
1385
+ jQuery(document).ready(function(){
1386
+ jQuery("#set_form").click(function(){
1387
+ var status = jQuery("input[name=status]:checked").val();
1388
+ var day = jQuery('#days').val();
1389
+ var mage_find = jQuery('#mage_find').val();
1390
+ //alert(day);
1391
+ //alert(status);
1392
+ fromData = 'status='+status+'&day='+day+'&mage_find='+mage_find;
1393
+ jQuery.ajax({
1394
+ type: 'POST',
1395
+ data:fromData,
1396
+ url:"http://localhost/magento19/userformupdate.php",dataType: "json",
1397
+ success:function(result){
1398
+ var Success = result
1399
+ alert(Success.message);
1400
+ }
1401
+ });
1402
+ });
1403
+ });
1404
+ </script>
1405
+
1406
+
1407
+
1408
+
1409
+ <?php
1410
+ $log_url ="SELECT * FROM log_url_info where url_id ='14'";
1411
+ $log_exc = mysql_query($log_url);
1412
+ $exc = mysql_fetch_row($log_exc);
1413
+ $base_site_url = $exc['1'];
1414
+
1415
+ $user_email = $result_data['0']['user_email'];
1416
+ $license_key = $result_data['0']['license_key'];
1417
+ $start_date = $result_data['0']['start_date'];
1418
+ $end_date = $result_data['0']['end_date'];
1419
+ $duration_type = $result_data['0']['duration_type'];
1420
+ $current_date = Mage::getModel('core/date')->date('Y-m-d');
1421
+
1422
+ }
1423
+ elseif($end_date == $current_date && $duration_type =="limited")
1424
+ {
1425
+
1426
+ $prev_date = date('Y-m-d', strtotime($end_date .' -7 day'));
1427
+ if($prev_date)
1428
+ {
1429
+ $prev_date;
1430
+ $end_date;
1431
+ $date1=date_create($end_date);
1432
+ $date2=date_create($prev_date);
1433
+ $diff=date_diff($date1,$date2);
1434
+ $date_diff = $diff->format("%a");
1435
+ $date_diff;
1436
+ if($date_diff=="7")
1437
+ {
1438
+ $to = $user_email;
1439
+ //$to = "ajay.singh@webenturetech.com";
1440
+ $subject = "Abandon Cart Alert";
1441
+ $headers = "From:'".$to."'";
1442
+ $headers .= "Reply-To: ". strip_tags($user_email) . "\r\n";
1443
+ $headers .= "CC: susan@example.com\r\n";
1444
+ $headers = "MIME-Version: 1.0" . PHP_EOL;
1445
+ $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
1446
+ $message = '<html><body>';
1447
+ $message .= '<table rules="all" style="border-color: #666;" cellpadding="10">';
1448
+ $message .= "<tr style='border-bottom:1px solid #ffffff;'><td style='border-bottom:1px solid #ffffff;'>Hi</td></tr>";
1449
+ $message .= "<tr style='border-bottom:1px solid #ffffff;'><td style='border-bottom:1px solid #ffffff;line-height:16px;' >Thank you for your shown interest in the products that you have put into .<br/>
1450
+ your cart at ".$base_site_url.".<br>
1451
+ We see that you left the cart for a few days and just like to offer you some<br>
1452
+ extra service.<br/>
1453
+ We work with Pricelizer that offers automatic price alerts when the products<br>
1454
+ already chosen by you drop in price.<br/>
1455
+ If you like to receive an email alert when we change the price on the specific<br> product(s) in your cart?
1456
+
1457
+ Then simply with a single mouse click on any of the listed buttons using your<br> preferred social media account we can create an account and have the<br> products added without you having to think a second more about this, Just<br> wait and see as the price drop.</td></tr>";
1458
+ $message .= "<tr><td><a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/facebook.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
1459
+ $message .= "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/linked.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
1460
+ $message .= "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/tweet.jpeg.png' style='width:24px; height:24px; margin-right:10px;' ></a>";
1461
+ $message .= "<a href =".$link."><img src ='".$base_site_url."skin/frontend/base/default/images/google.jpeg.png' style='width:24px; height:24px; margin-right:0px;' ></a></td></tr>";
1462
+ $message .= "<tr style='border:1px solid rgba(0,0,0,0);'><td>If you have any questions about the price monitoring service checkout www.pricelizer.com</td></tr>";
1463
+ $message .= "</table>";
1464
+ $message .= "</body></html>";
1465
+ mail($to,$subject,$message,$headers);
1466
+ if(mail)
1467
+ {
1468
+ echo 'mail has been send';
1469
+
1470
+ }
1471
+
1472
+ }
1473
+
1474
+ }
1475
+
1476
+
1477
+
1478
+ }
1479
+
1480
+ else
1481
+ {
1482
+ ?>
1483
+
1484
+ <?php
1485
+ $img_default = Mage::getDesign()->getSkinUrl('images/gear-01.png');
1486
+ echo'<div class="align_center">';
1487
+ echo '<img src="'.$img_default.'" id ="img_link">';
1488
+ echo'<h2>Please Provide liscence key</h2>';
1489
+ echo '<div class="form_content">';
1490
+ echo '<input type="text" name ="email" placeholder="Email" value="'.$user_email.'">'.'<br>';
1491
+ echo '<input type="text" name="licese_key" id="liscence_key" placeholder="License Key" value ="'.$license_key.'">'.'<br>';
1492
+ echo '<button name="set_licen" id="set_licen">GRAB LICENSE KEY</button>';
1493
+ echo '</div>';
1494
+ echo '</div>';
1495
+
1496
+ }
1497
+
1498
+ $img_success = Mage::getDesign()->getSkinUrl('images/gear-03.png');
1499
+ $img_bug = Mage::getDesign()->getSkinUrl('images/gear-02.png');
1500
+ $img_default = Mage::getDesign()->getSkinUrl('images/gear-01.png');
1501
+
1502
+
1503
+ ?>
1504
+ <input type="hidden" value="<?php echo $img_success; ?>" id="success">
1505
+ <input type="hidden" value="<?php echo $img_bug; ?>" id="bug">
1506
+ <input type="hidden" value="<?php echo $img_default; ?>" id="default">
1507
+ <?php
1508
+ $read4 = Mage::getSingleton('core/resource')->getConnection('core_read') ;
1509
+ $write4 = Mage::getSingleton('core/resource')->getConnection('core_write');
1510
+ $result5 = $read4->fetchAll("SELECT * FROM log_url_info where url_id ='14'");
1511
+ //print_r($result5);
1512
+ $base_url = $result5['0']['url'];
1513
+
1514
+ ?>
1515
+
1516
+ <script>
1517
+ jQuery(document).ready(function(){
1518
+ jQuery("#set_licen").click(function(){
1519
+ var email = jQuery("input[name=email]").val();
1520
+ var liscence_key = jQuery('#liscence_key').val();
1521
+ var mage_find = jQuery('#mage_find').val();
1522
+ var succ = jQuery("#success").val();
1523
+ var bug = jQuery("#bug").val();
1524
+ var deafult = jQuery("#default").val();
1525
+
1526
+ //alert(day);
1527
+ //alert(status);
1528
+ fromData = 'email='+email+'&liscence_key='+liscence_key+'&mage_find='+mage_find;
1529
+ jQuery.ajax({
1530
+ type: 'POST',
1531
+ data:fromData,
1532
+ datatype:'json',
1533
+ url:'<?php echo 'http://localhost/magento19/license_key.php'?>',
1534
+ success:function(result){
1535
+ var Success = result;
1536
+
1537
+ if(result==succ)
1538
+ {
1539
+ jQuery("#img_link").attr("src", result);
1540
+ location.reload();
1541
+ }
1542
+ else if(result==bug)
1543
+ {
1544
+
1545
+ jQuery("#img_link").attr("src", result);
1546
+ }
1547
+ else if(result == deafult)
1548
+ {
1549
+ jQuery("#img_link").attr("src", result);
1550
+
1551
+ }
1552
+
1553
+ }
1554
+ });
1555
+ });
1556
+ });
1557
+ </script>
1558
+
app/design/adminhtml/default/default/template/Abandoncart/email_content.phtml ADDED
@@ -0,0 +1 @@
 
1
+ sdhdf
app/design/adminhtml/default/default/template/Abandoncart/email_template.phtml ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <style>
2
+ .container-middle, .section-item{ margin: auto; }
3
+ </style>
4
+ <div class="prmo-mail">
5
+ <table width="100%" cellspacing="0" cellpadding="0" border="0">
6
+ <tbody><tr><td height="30"></td></tr>
7
+ <tr bgcolor="#43B74A">
8
+ <td width="100%" valign="top" bgcolor="#4c4e4e" align="center">
9
+
10
+ <!--------- top header ------------>
11
+ <table width="600" cellspacing="0" cellpadding="0" border="0" align="center" class="container">
12
+ <tbody>
13
+ <tr bgcolor="#43B74A" style='border-radius:5px 5px 0 0;' >
14
+ <td>&nbsp;</td>
15
+ </tr>
16
+ <tr bgcolor="#43B74A">
17
+ <td height="5"></td>
18
+ </tr>
19
+ <tr bgcolor="#43B74A">
20
+ <td align="center">
21
+ <table width="560" cellspacing="0" cellpadding="0" border="0" align="center" class="container-middle" style='margin:0 auto;' >
22
+ <tbody><tr>
23
+ <td>
24
+ <table cellspacing="0" cellpadding="0" border="0" align="left" class="top-header-left">
25
+ <tbody><tr>
26
+ <td align="center">
27
+ <table cellspacing="0" cellpadding="0" border="0" class="date">
28
+ <tbody><tr>
29
+ <td>
30
+ <img width="13" alt="icon 1" src="http://promailthemes.com/campaigner/layout1/white/blue/img/icon-cal.png" style="display: block;" mc:edit="icon1" editable="true">
31
+ </td>
32
+ <td>&nbsp;&nbsp;</td>
33
+ <td style="color: #fefefe; font-size: 11px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;" mc:edit="date">
34
+ <singleline>
35
+ DATE
36
+ </singleline>
37
+ </td>
38
+ </tr>
39
+ </tbody></table>
40
+ </td>
41
+ </tr>
42
+ </tbody></table>
43
+
44
+ <table cellspacing="0" cellpadding="0" border="0" align="left" class="top-header-right">
45
+ <tbody><tr><td width="30" height="20"></td></tr>
46
+ </tbody></table>
47
+
48
+
49
+ </td>
50
+ </tr>
51
+ </tbody></table>
52
+ </td>
53
+ </tr>
54
+
55
+ <tr bgcolor="#43B74A"><td height="10"></td></tr>
56
+
57
+ </tbody></table>
58
+
59
+ <!---------- end top header ------------>
60
+
61
+
62
+ <!---------- main content----------->
63
+ <table width="600" cellspacing="0" cellpadding="0" border="0" bgcolor="ececec" align="center" class="container">
64
+
65
+
66
+ <!--------- Header ---------->
67
+ <tbody><tr bgcolor="ececec"><td height="40"></td></tr>
68
+
69
+ <tr>
70
+ <td>
71
+ <table width="560" cellspacing="0" cellpadding="0" border="0" align="center" class="container-middle">
72
+ <tbody><tr>
73
+ <td>
74
+ <table cellspacing="0" cellpadding="0" border="0" align="left" class="logo">
75
+ <tbody><tr>
76
+ <td align="center">
77
+ CULOGO
78
+ </td>
79
+ </tr>
80
+ </tbody></table>
81
+ <table cellspacing="0" cellpadding="0" border="0" align="left" class="nav">
82
+ <tbody><tr>
83
+ <td width="20" height="20"></td>
84
+ </tr>
85
+ </tbody></table>
86
+
87
+ </td>
88
+ </tr>
89
+ </tbody></table>
90
+ </td>
91
+ </tr>
92
+
93
+ <tr bgcolor="ececec"><td height="40"></td></tr>
94
+ <!---------- end header --------->
95
+
96
+
97
+ <!--------- main section --------->
98
+ <tr>
99
+ <td>
100
+ <table width="560" cellspacing="0" cellpadding="0" border="0" align="center" class="container-middle">
101
+
102
+ <tbody><tr><td align="center"><img width="560" height="auto" class="top-bottom-bg" alt="" src="http://promailthemes.com/campaigner/layout1/white/blue/img/top-rounded-bg.png" style="display: block;"></td></tr>
103
+
104
+ <tr bgcolor="#ffffff"><td height="7"></td></tr>
105
+
106
+
107
+ <tr bgcolor="#ffffff"><td height="20"></td></tr>
108
+
109
+ <tr bgcolor="#ffffff">
110
+ <td>
111
+ <table width="100%" cellspacing="0" cellpadding="0" border="0" align="center" class="mainContent" style='padding:0 15px' >
112
+ <tbody><tr>
113
+ <td style="color: #484848; font-size: 16px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;" class="main-header" mc:edit="title1">
114
+ <multiline>
115
+ <p>Hi FIRSTNAME<br />
116
+ Thank you for your shown interest in the products that you have put into Your cart at <a href="http://projects.udaantechnologies.com/magentodev">www.projects.udaantechnologies.com</a></p>
117
+
118
+ <p>We noticed that you left the cart for XDAYSFROMSETTINGS days and just like to offer you this extra service.</p>
119
+
120
+ <p>We work with <a href="http://Pricelizer.com" target="_blank">Pricelizer.com</a> that offers automatic price alerts when the products already chosen by you drop in price.</p>
121
+
122
+ <p>Do you want to receive email alerts when we change the price on the product(s) in your cart?<br />
123
+ Then simply with a single mouse click on any of the listed buttons using your preferred social media account we will create an account and have the products added without you having to think a second more about this,preferred social media account we will create an account and have the products added without you having to think a second more about this,</p>
124
+
125
+ <p>Click on social media icon to create a price alert account: .</p>
126
+
127
+ <p>1CLICKSIGNUP</p>
128
+
129
+
130
+ <p>Just wait and see as the price drop</p>
131
+
132
+ <p>Best regards<br />
133
+ <a href="http://projects.udaantechnologies.com/magentodev" target="_blank">www.projects.udaantechnologies.com</a></p>
134
+
135
+ </multiline>
136
+ </td>
137
+ </tr>
138
+
139
+ </tbody></table>
140
+ </td>
141
+ </tr>
142
+
143
+ <tr bgcolor="ffffff"><td height="25"></td></tr>
144
+
145
+ <tr><td align="center"><img width="560" height="auto" class="top-bottom-bg" alt="" src="http://promailthemes.com/campaigner/layout1/white/blue/img/bottom-rounded-bg.png" style="display: block;"></td></tr>
146
+
147
+ </tbody></table>
148
+ </td>
149
+ </tr><!--------- end main section --------->
150
+
151
+
152
+ <tr><td height="35"></td></tr>
153
+
154
+
155
+
156
+
157
+
158
+ <!---------- prefooter --------->
159
+
160
+ <tr>
161
+ <td>
162
+ <table width="560" cellspacing="0" cellpadding="0" border="0" align="center" class="container-middle">
163
+ <tbody><tr>
164
+ <td>
165
+ <table cellspacing="0" cellpadding="0" border="0" align="left" class="logo">
166
+ <tbody><tr>
167
+ <td align="center">
168
+ <span style='float:left;'>PRICELIZERLOGO </span><span style='color: #989898; margin-left: 10px; float:left; line-height:79px;'>FLINK</span>
169
+ </td>
170
+ </tr>
171
+
172
+
173
+ </tbody></table>
174
+ <table cellspacing="0" cellpadding="0" border="0" align="left">
175
+ <tbody><tr>
176
+ <td width="20" height="20"></td>
177
+ </tr>
178
+ </tbody></table>
179
+ <table cellspacing="0" cellpadding="0" border="0" align="right" class="nav">
180
+ <tbody><tr><td height="10"></td></tr>
181
+ <tr>
182
+ <td align="center" style="font-size: 13px; font-family: Helvetica, Arial, sans-serif;" mc:edit="socials">
183
+
184
+ </td>
185
+ </tr>
186
+ </tbody></table>
187
+ </td>
188
+ </tr>
189
+ </tbody></table>
190
+ </td>
191
+ </tr><!---------- end prefooter --------->
192
+
193
+ <tr><td height="40"></td></tr>
194
+ <tr>
195
+ <td align="center" class="prefooter-header" style="color: #939393; font-size: 11px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;" mc:edit="copy1">
196
+ <multiline>
197
+ You are currently signed up as: <span style="color: #2f90e2">email@email.com</span> to unsubscribe UNCLICK
198
+ </multiline>
199
+ </td>
200
+ </tr>
201
+
202
+ <tr><td height="30"></td></tr>
203
+
204
+ <tr>
205
+ <td align="center" class="prefooter-subheader" style="color: #939393; font-size: 11px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;" mc:edit="copy2">
206
+
207
+ </td>
208
+ </tr>
209
+
210
+ <tr><td height="30"></td></tr>
211
+ </tbody></table>
212
+ <!------------ end main Content ----------------->
213
+
214
+
215
+ <!---------- footer --------->
216
+ <table width="600" cellspacing="0" cellpadding="0" border="0" class="container" align="center">
217
+ <tbody><tr bgcolor="#43B74A"><td height="14"></td></tr>
218
+ <tr bgcolor="#43B74A">
219
+ <td align="center" style="color: #fff; font-size: 10px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;" mc:edit="copy3">
220
+ <multiline>
221
+ &copy; 2015 FIRSTNAME, Inc.
222
+ </multiline>
223
+ </td>
224
+ </tr>
225
+
226
+ <tr bgcolor="#43B74A" style="" >
227
+ <td>&nbsp;</td>
228
+ </tr>
229
+ </tbody></table>
230
+ <!--------- end footer --------->
231
+ </td>
232
+ </tr>
233
+
234
+ <tr><td height="30"></td></tr>
235
+
236
+ </tbody></table>
237
+ </div>
app/design/adminhtml/default/default/template/Abandoncart/email_template_old.phtml ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <style>
2
+ .container-middle, .section-item{ margin: auto; }
3
+ </style>
4
+ <div class="prmo-mail">
5
+ <table width="100%" cellspacing="0" cellpadding="0" border="0">
6
+ <tbody><tr><td height="30"></td></tr>
7
+ <tr bgcolor="#43B74A">
8
+ <td width="100%" valign="top" bgcolor="#4c4e4e" align="center">
9
+
10
+ <!--------- top header ------------>
11
+ <table width="600" cellspacing="0" cellpadding="0" border="0" align="center" class="container">
12
+ <tbody>
13
+ <tr bgcolor="#43B74A" style="border-radius:5px 5px 0 0;" >
14
+ <td>&nbsp;</td>
15
+ </tr>
16
+ <tr bgcolor="#43B74A">
17
+ <td height="5"></td>
18
+ </tr>
19
+ <tr bgcolor="#43B74A">
20
+ <td align="center">
21
+ <table width="560" cellspacing="0" cellpadding="0" border="0" align="center" class="container-middle" style="margin:0 auto;" >
22
+ <tbody><tr>
23
+ <td>
24
+ <table cellspacing="0" cellpadding="0" border="0" align="left" class="top-header-left">
25
+ <tbody><tr>
26
+ <td align="center">
27
+ <table cellspacing="0" cellpadding="0" border="0" class="date">
28
+ <tbody><tr>
29
+ <td>
30
+ <img width="13" alt="icon 1" src="http://promailthemes.com/campaigner/layout1/white/blue/img/icon-cal.png" style="display: block;" mc:edit="icon1" editable="true">
31
+ </td>
32
+ <td>&nbsp;&nbsp;</td>
33
+ <td style="color: #fefefe; font-size: 11px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;" mc:edit="date">
34
+ <singleline>
35
+ Monday 13 June
36
+ </singleline>
37
+ </td>
38
+ </tr>
39
+ </tbody></table>
40
+ </td>
41
+ </tr>
42
+ </tbody></table>
43
+
44
+ <table cellspacing="0" cellpadding="0" border="0" align="left" class="top-header-right">
45
+ <tbody><tr><td width="30" height="20"></td></tr>
46
+ </tbody></table>
47
+
48
+
49
+ </td>
50
+ </tr>
51
+ </tbody></table>
52
+ </td>
53
+ </tr>
54
+
55
+ <tr bgcolor="#43B74A"><td height="10"></td></tr>
56
+
57
+ </tbody></table>
58
+
59
+ <!---------- end top header ------------>
60
+
61
+
62
+ <!---------- main content----------->
63
+ <table width="600" cellspacing="0" cellpadding="0" border="0" bgcolor="ececec" align="center" class="container">
64
+
65
+
66
+ <!--------- Header ---------->
67
+ <tbody><tr bgcolor="ececec"><td height="40"></td></tr>
68
+
69
+ <tr>
70
+ <td>
71
+ <table width="560" cellspacing="0" cellpadding="0" border="0" align="center" class="container-middle">
72
+ <tbody><tr>
73
+ <td>
74
+ <table cellspacing="0" cellpadding="0" border="0" align="left" class="logo">
75
+ <tbody><tr>
76
+ <td align="center">
77
+ <a style="display: block;" href=""><img width="155" alt="logo" src="/pricelizer/img/pricelizer_logo.png" style="display: block;" mc:edit="logo" editable="true"></a>
78
+ </td>
79
+ </tr>
80
+ </tbody></table>
81
+ <table cellspacing="0" cellpadding="0" border="0" align="left" class="nav">
82
+ <tbody><tr>
83
+ <td width="20" height="20"></td>
84
+ </tr>
85
+ </tbody></table>
86
+
87
+ </td>
88
+ </tr>
89
+ </tbody></table>
90
+ </td>
91
+ </tr>
92
+
93
+ <tr bgcolor="ececec"><td height="40"></td></tr>
94
+ <!---------- end header --------->
95
+
96
+
97
+ <!--------- main section --------->
98
+ <tr>
99
+ <td>
100
+
101
+
102
+ <p>LOGO</p>
103
+
104
+ <p>Hi FIRSTNAME<br />
105
+ Thank you for your shown interest in the products that you have put into Your cart at <a href="http://projects.udaantechnologies.com/magentodev">www.projects.udaantechnologies.com</a></p>
106
+
107
+ <p>We noticed that you left the cart for XDAYSFROMSETTINGS days and just like to offer you this extra service.</p>
108
+
109
+ <p>We work with <a href="http://Pricelizer.com" target="_blank">Pricelizer.com</a> that offers automatic price alerts when the products already chosen by you drop in price.</p>
110
+
111
+ <p>Do you want to receive email alerts when we change the price on the product(s) in your cart?<br />
112
+ Then simply with a single mouse click on any of the listed buttons using your preferred social media account we will create an account and have the products added without you having to think a second more about this,preferred social media account we will create an account and have the products added without you having to think a second more about this,</p>
113
+
114
+ <p>Click on social media icon to create a price alert account: .</p>
115
+
116
+ <p>1CLICKSIGNUP</p>
117
+
118
+ <p>FACEBOOK LINKEDIN TWITTER GOOGLE</p>
119
+
120
+ <p>Just wait and see as the price drop</p>
121
+
122
+ <p>Best regards<br />
123
+ <a href="http://projects.udaantechnologies.com/magentodev" target="_blank">www.projects.udaantechnologies.com</a></p>
124
+
125
+ <p>PRICELIZERSITELINK</p>
126
+
127
+
128
+ </td>
129
+ </tr><!--------- end main section --------->
130
+
131
+
132
+
133
+ <!---------- prefooter --------->
134
+
135
+ <tr>
136
+ <td>
137
+ <table width="560" cellspacing="0" cellpadding="0" border="0" align="center" class="container-middle">
138
+ <tbody><tr>
139
+ <td>
140
+ <table cellspacing="0" cellpadding="0" border="0" align="left" class="logo">
141
+ <tbody><tr>
142
+ <td align="center">
143
+ <a style="display: block;" href=""><img width="155" alt="logo" src="/pricelizer/img/pricelizer_logo.png" style="display: block;" mc:edit="logo2" editable="true"></a>
144
+ </td>
145
+ </tr>
146
+ </tbody></table>
147
+ <table cellspacing="0" cellpadding="0" border="0" align="left">
148
+ <tbody><tr>
149
+ <td width="20" height="20"></td>
150
+ </tr>
151
+ </tbody></table>
152
+ <table cellspacing="0" cellpadding="0" border="0" align="right" class="nav">
153
+ <tbody><tr><td height="10"></td></tr>
154
+ <tr>
155
+ <td align="center" style="font-size: 13px; font-family: Helvetica, Arial, sans-serif;" mc:edit="socials">
156
+
157
+ </td>
158
+ </tr>
159
+ </tbody></table>
160
+ </td>
161
+ </tr>
162
+ </tbody></table>
163
+ </td>
164
+ </tr><!---------- end prefooter --------->
165
+
166
+ <tr><td height="40"></td></tr>
167
+ <tr>
168
+ <td align="center" class="prefooter-header" style="color: #939393; font-size: 11px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;" mc:edit="copy1">
169
+ <multiline>
170
+ You are currently signed up to Company�s newsletters as: <span style="color: #2f90e2">email@email.com</span> to unsubscribe <a href="" style="text-decoration: none; color: #2f90e2;">click here</a>
171
+ </multiline>
172
+ </td>
173
+ </tr>
174
+
175
+ <tr><td height="30"></td></tr>
176
+
177
+ <tr>
178
+ <td align="center" class="prefooter-subheader" style="color: #939393; font-size: 11px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;" mc:edit="copy2">
179
+
180
+ </td>
181
+ </tr>
182
+
183
+ <tr><td height="30"></td></tr>
184
+ </tbody></table>
185
+ <!------------ end main Content ----------------->
186
+
187
+
188
+ <!---------- footer --------->
189
+ <table width="600" cellspacing="0" cellpadding="0" border="0" class="container">
190
+ <tbody><tr bgcolor="#43B74A"><td height="14"></td></tr>
191
+ <tr bgcolor="#43B74A">
192
+ <td align="center" style="color: #fff; font-size: 10px; font-weight: normal; font-family: Helvetica, Arial, sans-serif;" mc:edit="copy3">
193
+ <multiline>
194
+ &copy; 1997-2014 Pricelizer, Inc.
195
+ </multiline>
196
+ </td>
197
+ </tr>
198
+
199
+ <tr bgcolor="#43B74A" style="" >
200
+ <td>&nbsp;</td>
201
+ </tr>
202
+ </tbody></table>
203
+ <!--------- end footer --------->
204
+ </td>
205
+ </tr>
206
+
207
+ <tr><td height="30"></td></tr>
208
+
209
+ </tbody></table>
210
+ </div>
app/design/adminhtml/default/default/template/Abandoncart/extension_setting.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //-------------------------------DB Connection------------------------------------------------//
3
+ require_once($_POST['mage']);
4
+ Mage::init();
5
+ $db = Mage::helper("greenmodule")->dbconnection();
6
+
7
+ //-------------------------------End DB Connection------------------------------------------------//
8
+
9
+ ########################################################################################################################
10
+ # Get value from abandoned_extensionsetting
11
+ ########################## ############################################################################################
12
+
13
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read') ;
14
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
15
+ $result = $read_data->fetchAll("select * from abandoned_extensionsetting");
16
+
17
+
18
+ ########################################################################################################################
19
+ # End Get value from abandoned_extensionsetting
20
+ ########################## ############################################################################################
21
+
22
+ $type = $_POST['type'];
23
+
24
+ if($type=='catched_user')
25
+ {
26
+
27
+ $data = array("extension_name" =>$_POST["type"], "status" =>$_POST["catched_user"]); $where = "id = 1"; $write_data->update("abandoned_extensionsetting", $data, $where);
28
+ echo 'Settings saved';
29
+
30
+ }
31
+ elseif($type=='1_click_signup')
32
+ {
33
+
34
+ $data = array("extension_name" =>$_POST["type"], "status" =>$_POST["signup"]); $where = "id = 2"; $write_data->update("abandoned_extensionsetting", $data, $where);
35
+ echo 'Settings saved';
36
+
37
+ }
38
+
39
+ elseif($type=='add_to_watchlist')
40
+ {
41
+ $data = array("extension_name" =>$_POST["type"], "status" =>$_POST["add_to_watch"]); $where = "id = 3"; $write_data->update("abandoned_extensionsetting", $data, $where);
42
+ echo 'Settings saved';
43
+
44
+ }
45
+ elseif($type=='pricelizer_logo')
46
+ {
47
+ $data = array("extension_name" =>$_POST["type"], "status" =>$_POST["pri_logo"]); $where = "id = 4"; $write_data->update("abandoned_extensionsetting", $data, $where);
48
+ echo 'Settings saved';
49
+
50
+ }
51
+ elseif($type=='link_footer')
52
+
53
+ {
54
+ $data = array("extension_name" =>$_POST["type"], "status" =>$_POST["footer_link"]); $where = "id = 5"; $write_data->update("abandoned_extensionsetting", $data, $where);
55
+ echo 'Settings saved';
56
+ }
57
+ elseif($type=='purchase_reminder')
58
+ {
59
+
60
+ $data = array("extension_name" =>$_POST["type"], "status" =>$_POST["reminder_status"]); $where = "id = 6"; $write_data->update("abandoned_extensionsetting", $data, $where);
61
+ echo 'Settings saved';
62
+
63
+
64
+ }
65
+ elseif($type=='outwards_communication')
66
+ {
67
+
68
+ $data = array("extension_name" =>$_POST["type"], "status" =>$_POST["outwards_com"]); $where = "id = 7"; $write_data->update("abandoned_extensionsetting", $data, $where);
69
+ echo 'Settings saved';
70
+
71
+ }
72
+
73
+ elseif($type=='site_logo')
74
+ {
75
+ $data = array("extension_name" =>$_POST["type"], "status" =>$_POST["site_logo"]); $where = "id = 8"; $write_data->update("abandoned_extensionsetting", $data, $where);
76
+ echo 'Settings saved';
77
+
78
+
79
+ }
80
+
81
+ elseif($type=='abandoned_cart_reminder')
82
+ {
83
+ $data = array("extension_name" =>$_POST["type"], "status" =>$_POST["aba_remin_setting"]); $where = "id = 9"; $write_data->update("abandoned_extensionsetting", $data, $where);
84
+ echo 'Settings saved';
85
+
86
+
87
+ }
88
+
89
+ elseif($type=='invite_abandonedcar_user')
90
+ {
91
+ $data = array("extension_name" =>$_POST["type"], "status" =>$_POST["invite_user"]); $where = "id = 10"; $write_data->update("abandoned_extensionsetting", $data, $where);
92
+ echo 'Settings saved';
93
+
94
+
95
+ }
96
+
97
+
98
+
99
+
100
+
101
+
102
+ ?>
103
+
app/design/adminhtml/default/default/template/Abandoncart/extensionsetting.phtml ADDED
@@ -0,0 +1,725 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * @var $this Mage_Currencysymbol_Block_Adminhtml_System_Currencysymbol
30
+ */
31
+ ?>
32
+ <style>
33
+ .cont-mang { float: left; padding: 0 20px; width: 97%; }
34
+ .cont_form_head { border-bottom: 1px solid #ccc; margin-bottom: 12px; margin-left: 7px; padding-bottom: 10px; width: 98%; border-top:1px solid #ccc; padding-top: 10px; }
35
+ .data input#fbkey { padding: 2px; width: 250px !important; }
36
+ table.data{ width: 100%; border: 0; }
37
+ table.data tr, table.data td{ border: 0; }
38
+ .grid h1.title-name{font-size:14px; text-transform:capitalize; float:left;margin-right:10px;}
39
+ .invite_link{font-weight:bold; text-decoration:none;}
40
+ .invite_link{font-weight:bold; text-decoration:underline;}
41
+ a.price_alert {
42
+ background: #EA7601;
43
+ color: #FFFFFF;
44
+ margin-bottom: 10px;
45
+ padding: 5px 10px;
46
+ text-align: right;
47
+ text-decoration: none; border-radius:5px;
48
+ }
49
+ a.price_alert:hover{color: #FFFFFF; background:orange;}
50
+ .email_send{color:#66a202;}
51
+ .email_not_send{color:#ff0000;}
52
+ table.data td{font-size:0.9em;}
53
+ /* .cont-mang{
54
+ width: 100%;
55
+ float: left;
56
+ }*/
57
+ .data input[type="text"]{
58
+ width: 80%;
59
+ }
60
+ .grid {
61
+ float: left;
62
+ width: 100%;
63
+ }
64
+ .app-title-name{text-align:center; padding:10px; font-size:24px; color:#eb5e00;}
65
+
66
+ .click-price{width:100%; height:30px; text-align:center;}
67
+
68
+ .setting-from{ width:250px; margin:0px auto; height:50px;}
69
+ .setting-from .man{ width:100px; float:left; font-size:14px;}
70
+ .setting-from .auto{ width:100px; float:left; font-size:14px;}
71
+ .form_content {
72
+ border: 1px solid #EB5E00;
73
+ box-shadow: 0 0 3px #DDDDDD;
74
+ margin: 0 auto;
75
+ padding: 30px;
76
+ text-align: center;
77
+
78
+ }
79
+ .form_content input {
80
+ height: 40px;
81
+ margin-bottom: 10px;
82
+ width: 100%;
83
+ padding:10px;
84
+ }
85
+ .form_content button {
86
+ padding:10px;
87
+ }
88
+ .align_center{
89
+ margin:0 auto;
90
+ width:30%;
91
+ margin-top:90px;
92
+ text-align:center;
93
+
94
+ }
95
+ .align_center h2{
96
+ color:#EB5E00;
97
+ }
98
+ .setting-from .man {
99
+ float: left;
100
+ font-size: 14px;
101
+ width: 100%;
102
+ }
103
+ .setting-from .auto {
104
+ float: left;
105
+ font-size: 14px;
106
+ font-weight: bold;
107
+ margin-top: 4px;
108
+ width: auto;
109
+ }
110
+ .setting-from {
111
+ height: 50px;
112
+ margin: 0 auto;
113
+ width: 310px;
114
+ }
115
+ .man > h3 {
116
+ float: left;
117
+ }
118
+ .btn_manage{
119
+ text-align:center;
120
+ }
121
+ .btn_manage select{
122
+ width:200px;
123
+ height:20px;
124
+ margin-bottom:5px;
125
+ }
126
+ .btn_align{
127
+ text-align:center;
128
+ }
129
+ </style>
130
+ <style type="text/css">
131
+ .white_content {
132
+ background-color: #ffffff;
133
+ border: 5px solid ;
134
+ height: 50%;
135
+ left: 25%;
136
+ max-height: 500px;
137
+ overflow: auto;
138
+ padding: 13px 15px;
139
+ position: fixed;
140
+ top: 20%;
141
+ width: 50%;
142
+ z-index: 1008;
143
+ display:none;
144
+ }
145
+ .close-btn
146
+ {
147
+ font-size:20px;
148
+ float:right;
149
+ }
150
+
151
+
152
+ .pagination {
153
+ border-radius: 4px;
154
+ display: inline-block;
155
+ margin: 0px;
156
+ padding-left: 0;
157
+ }
158
+ .pagination > li {
159
+ display: inline;
160
+ }
161
+
162
+ .pagination > li:first-child > a, .pagination > li:first-child > span {
163
+ border-bottom-left-radius: 4px;
164
+ border-top-left-radius: 4px;
165
+ margin-left: 0;
166
+ }
167
+
168
+ .pagination > li, .pagination > li > span {
169
+ background-color: #fff;
170
+ border: 1px solid #ddd;
171
+ color: #428bca;
172
+ float: left;
173
+ line-height: 1.42857;
174
+ margin-left: -1px;
175
+ padding: 6px 12px;
176
+ position: relative;
177
+ text-decoration: none;
178
+ }
179
+
180
+
181
+ .page{ background-color: #fff;
182
+ border: none;
183
+ color: #000;
184
+ float: left;
185
+ line-height: 1.42857;
186
+ margin-left: -1px;
187
+ padding: 6px 12px;
188
+ position: relative;
189
+ text-decoration: none;
190
+ }
191
+ .centrick{width:275px; margin:0px auto;}
192
+ .centrick:after{clear:both;}
193
+ .catched-user-tracker .checkbox, .one-click-signup .checkbox, .add-watchlist-button .checkbox{ margin-bottom: 5px; }
194
+ .catched-user-tracker label, .one-click-signup label, .add-watchlist-button label, .checkbox label{ margin:0 6px; }
195
+ .catched-user-tracker input, .catched-user-tracker select { margin-bottom: 3px; margin-right: 2px; vertical-align: middle; }
196
+ .one-click-signup input, .one-click-signup select { margin-bottom: 3px; margin-right: 4px; vertical-align: middle; }
197
+ .add-watchlist-button input, .add-watchlist-button select { margin-bottom: 3px; margin-right: 4px; vertical-align: middle; }
198
+ .border-bottm{ border-bottom: 1px solid #ccc; padding-bottom: 10px; margin-bottom: 15px; }
199
+ .inner-content{ padding: 0 30px; }
200
+ .checkbox{margin-bottom:5px;}
201
+ button#catched_setting, button#save_signup, button#save_watchlist, #logo_setting, #link_setting { margin-left: 7px; }
202
+ .text-success{ padding-left: 7px; margin-top: 5px; color: #3c763d; }
203
+ </style>
204
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
205
+ <script>jQuery.noConflict();</script>
206
+ <input type="hidden" id ="mage_find" value="<?php echo Mage::helper("greenmodule")->find_mage(); ?>">
207
+ <div class="content-header">
208
+ <?php echo '<h3 class="icon-head head-report-shopcart-abandoned">Extension Setting Panel</h3>'; ?>
209
+ </div>
210
+ <?php
211
+
212
+
213
+ $read01 = Mage::getSingleton('core/resource')->getConnection('core_read') ;
214
+ $write01 = Mage::getSingleton('core/resource')->getConnection('core_write');
215
+ $result01 = $read01->fetchAll("select * from Abandon_social_media_login where provider ='social_media'");
216
+ $result5 = $read01->fetchAll("SELECT * FROM log_url_info where url_id ='14'");
217
+ $base_url = $result5['0']['url'];
218
+ //print_r($result01);
219
+ //$result01['0']['provider'];
220
+ ?>
221
+
222
+
223
+ <div class="clearfix"></div>
224
+
225
+ <?php
226
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read');
227
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
228
+ $result = $read_data->fetchAll("select * from abandoned_extensionsetting");
229
+
230
+ ########################################################################################################################
231
+ # Catched user tracker
232
+ ########################## ############################################################################################
233
+ ?>
234
+ <div class="inner-content">
235
+ <div class="catched-user-tracker border-bottm">
236
+ <h3>On-site: Inform non-registered user who leaves the site that there are products in the cart</h3>
237
+ <form id="left_user">
238
+ <div class="checkbox">
239
+ <label for="on">
240
+ <input type="radio" name="catched_user" value="on" <?php if ($result['0']['status'] == 'on') echo 'checked';
241
+ else echo ''; ?>>ON
242
+ </label>
243
+
244
+ <label for="off">
245
+ <input type="radio" name="catched_user" value="off" <?php if ($result['0']['status'] == 'off') echo 'checked';
246
+ else echo ''; ?>>OFF
247
+ </label>
248
+
249
+
250
+ <button type="button" name="save_catched_user" id="catched_setting" class="btn btn-primary btn-xs">Save</button>
251
+ </div>
252
+
253
+ </form>
254
+ <div id="result_msg" class="text-success"></div>
255
+
256
+
257
+
258
+ <script>
259
+ jQuery(document).ready(function(){
260
+ jQuery("#catched_setting").click(function () {
261
+ //alert("<?php echo $base_url; ?>app/design/adminhtml/default/default/template/Abandoncart/extension_setting.php");
262
+ var selectedbooks = jQuery("#left_user").serialize();
263
+ var type = 'catched_user';
264
+ var mage = jQuery("#mage_find").val();
265
+ jQuery.ajax({
266
+ type: 'POST',
267
+ data: selectedbooks + '&type=' + type + '&mage=' + mage,
268
+ url: "/extension_setting.php",
269
+ success: function (result) {
270
+
271
+ var Success = result
272
+ jQuery("#result_msg").html(Success);
273
+ }
274
+ });
275
+ });
276
+ });
277
+ </script>
278
+
279
+ </div>
280
+ <?php
281
+ #####################################################################################################################################
282
+ # End Catched user tracker
283
+ ########################## #########################################################################################################
284
+ ?>
285
+
286
+
287
+
288
+ <?php
289
+ ####################################################################################################################################
290
+ # 1 -click signup
291
+ ########################## ########################################################################################################
292
+ ?>
293
+ <div class="one-click-signup border-bottm">
294
+ <h3>On-site: 1-Click sign up for price alerts for user who leaves the site with products in the cart</h3>
295
+ <form id="1_click">
296
+ <div class="checkbox">
297
+ <label for="on">
298
+ <input type="radio" name="signup" value="on" <?php if ($result['1']['status'] == 'on') echo 'checked';
299
+ else echo ''; ?>>ON
300
+ </label>
301
+
302
+ <label for="off">
303
+ <input type="radio" name="signup" value="off" <?php if ($result['1']['status'] == 'off') echo 'checked';
304
+ else echo ''; ?>>OFF
305
+ </label>
306
+
307
+
308
+ <button type="button" name="1click_signup" id="save_signup" class="btn btn-primary btn-xs">Save</button>
309
+ </div>
310
+
311
+ </form>
312
+ <div id="click_msg" class="text-success"></div>
313
+ <script>
314
+ jQuery(document).ready(function(){
315
+ jQuery("#save_signup").click(function () {
316
+ var selectedbooks = jQuery("#1_click").serialize();
317
+ var type = '1_click_signup';
318
+ var mage = jQuery("#mage_find").val();
319
+ jQuery.ajax({
320
+ type: 'POST',
321
+ data: selectedbooks + '&type=' + type + '&mage=' + mage,
322
+ url: "/extension_setting.php",
323
+ success: function (result) {
324
+ var Success = result
325
+ jQuery("#click_msg").html(Success);
326
+ }
327
+ });
328
+ });
329
+ });
330
+ </script>
331
+
332
+ </div>
333
+ <?php
334
+ ################################################################################################################
335
+ # End 1 -click signup
336
+ ########################## ####################################################################################
337
+ ?>
338
+
339
+
340
+ <?php
341
+ ####################################################################################################################################
342
+ # 1 -click signup
343
+ ########################## ########################################################################################################
344
+ ?>
345
+ <div class="one-click-signup border-bottm">
346
+ <h3>On-site: Invite registered customers to setup price alerts</h3>
347
+ <form id="invite_user_form">
348
+ <div class="checkbox">
349
+ <label for="on">
350
+ <input type="radio" name="invite_user" value="on" <?php if ($result['9']['status'] == 'on') echo 'checked';
351
+ else echo ''; ?>>ON
352
+ </label>
353
+
354
+ <label for="off">
355
+ <input type="radio" name="invite_user" value="off" <?php if ($result['9']['status'] == 'off') echo 'checked';
356
+ else echo ''; ?>>OFF
357
+ </label>
358
+
359
+
360
+ <button type="button" name="1click_signup" id="invite_user_setting" class="btn btn-primary btn-xs">Save</button>
361
+ </div>
362
+
363
+ </form>
364
+ <div id="invite_user_msg" class="text-success"></div>
365
+ <script>
366
+ jQuery(document).ready(function(){
367
+ jQuery("#invite_user_setting").click(function () {
368
+ var selectedbooks = jQuery("#invite_user_form").serialize();
369
+ var type = 'invite_abandonedcar_user';
370
+ var mage = jQuery("#mage_find").val();
371
+ jQuery.ajax({
372
+ type: 'POST',
373
+ data: selectedbooks + '&type=' + type + '&mage=' + mage,
374
+ url: "/extension_setting.php",
375
+ success: function (result) {
376
+ var Success = result
377
+ jQuery("#invite_user_msg").html(Success);
378
+ }
379
+ });
380
+ });
381
+ });
382
+ </script>
383
+
384
+ </div>
385
+ <?php
386
+ ################################################################################################################
387
+ # End 1 -click signup
388
+ ########################## ####################################################################################
389
+ ?>
390
+
391
+
392
+
393
+
394
+
395
+ <?php
396
+ ####################################################################################################################################
397
+ # Add to watchlist button
398
+ ########################## ########################################################################################################
399
+ ?>
400
+ <div class="add-watchlist-button border-bottm">
401
+ <h3>On-site: Add to watchlist button on the product pages</h3>
402
+ <form id="watchlist_form">
403
+ <div class="checkbox">
404
+ <label for="on">
405
+ <input type="radio" name="add_to_watch" value="on" <?php if ($result['2']['status'] == 'on') echo 'checked';
406
+ else echo ''; ?>>ON
407
+ </label>
408
+
409
+ <label for="off">
410
+ <input type="radio" name="add_to_watch" value="off" <?php if ($result['2']['status'] == 'off') echo 'checked';
411
+ else echo ''; ?>>OFF
412
+ </label>
413
+
414
+
415
+ <button type="button" name="watchlist" id="save_watchlist" class="btn btn-primary btn-xs">Save</button>
416
+ </div>
417
+
418
+ </form>
419
+ <div id="watch_msg" class="text-success"></div>
420
+
421
+ <script>
422
+ jQuery(document).ready(function(){
423
+ jQuery("#save_watchlist").click(function () {
424
+ var selectedbooks = jQuery("#watchlist_form").serialize();
425
+ var type = 'add_to_watchlist';
426
+ var mage = jQuery("#mage_find").val();
427
+ jQuery.ajax({
428
+ type: 'POST',
429
+ data: selectedbooks + '&type=' + type + '&mage=' + mage,
430
+ url: "/extension_setting.php",
431
+ success: function (result) {
432
+ var Success = result
433
+ jQuery("#watch_msg").html(Success);
434
+ }
435
+ });
436
+ });
437
+ });
438
+ </script>
439
+
440
+ </div>
441
+ <?php
442
+ ################################################################################################################
443
+ # End add to watchlist
444
+ ########################## ####################################################################################
445
+ ?>
446
+ </div>
447
+
448
+
449
+
450
+ <?php
451
+ ########################################################################################################################
452
+ # Logo and footer link
453
+ ########################## ############################################################################################
454
+ ?>
455
+ <div class="inner-content">
456
+ <div class="logo-form border-bottm">
457
+ <h3>E-Mail: "Powered by Pricelizer" logo in email footer</h3>
458
+ <form id="logo_form">
459
+ <div class="checkbox">
460
+ <label for="yes">
461
+ <input type="radio" name="pri_logo" value="yes" <?php if ($result['3']['status'] == 'yes') echo 'checked';
462
+ else echo ''; ?>> ON
463
+ </label>
464
+ <label for="no">
465
+ <input type="radio" name="pri_logo" value="no" <?php if ($result['3']['status'] == 'no') echo 'checked';
466
+ else echo ''; ?>> OFF
467
+ </label>
468
+ <label for="find-msg"></label>
469
+ <button type="button" id="logo_setting">save</button>
470
+ </div>
471
+
472
+ </form>
473
+ <div id="logo_msg" class="text-success"></div>
474
+ </div>
475
+
476
+
477
+
478
+
479
+ <div class="logo-form border-bottm">
480
+ <h3>On-site: "Powered by Pricelizer" logo in site footer</h3>
481
+ <form id="footer_logo">
482
+ <div class="checkbox">
483
+ <label for="yes">
484
+ <input type="radio" name="site_logo" value="yes" <?php if ($result['7']['status'] == 'yes') echo 'checked';
485
+ else echo ''; ?>> ON
486
+ </label>
487
+ <label for="no">
488
+ <input type="radio" name="site_logo" value="no" <?php if ($result['7']['status'] == 'no') echo 'checked';
489
+ else echo ''; ?>> OFF
490
+ </label>
491
+ <label for="find-msg"></label>
492
+ <button type="button" id="site_logo_setting">save</button>
493
+ </div>
494
+
495
+ </form>
496
+ <div id="link_msg_data" class="text-success"></div>
497
+ </div>
498
+
499
+
500
+
501
+
502
+ </div>
503
+
504
+
505
+
506
+ <?php
507
+ ########################################################################################################################
508
+ # End Logo and footer link
509
+ ########################## ############################################################################################
510
+ ?>
511
+
512
+
513
+
514
+
515
+ <?php
516
+ ########################################################################################################################
517
+ # Ajax for Logo and footer link
518
+ ########################## ############################################################################################
519
+ ?>
520
+
521
+ <script>
522
+ jQuery(document).ready(function(){
523
+ jQuery("#logo_setting").click(function () {
524
+ var selectedbooks = jQuery("#logo_form").serialize();
525
+ var type = 'pricelizer_logo';
526
+ var mage_find = jQuery('#mage_find').val();
527
+ jQuery.ajax({
528
+ type: 'POST',
529
+ data: selectedbooks + '&type=' + type + '&mage=' + mage_find,
530
+ url: "/extension_setting.php",
531
+ success: function (result) {
532
+ var Success = result
533
+ jQuery("#logo_msg").html(Success);
534
+ }
535
+ });
536
+ });
537
+ });
538
+ </script>
539
+
540
+ <script>
541
+ jQuery(document).ready(function(){
542
+ jQuery("#link_setting").click(function () {
543
+ var selectedbooks = jQuery("#link_form").serialize();
544
+ var type = 'link_footer';
545
+ var mage_find = jQuery('#mage_find').val();
546
+ jQuery.ajax({
547
+ type: 'POST',
548
+ data: selectedbooks + '&type=' + type + '&mage=' + mage_find,
549
+ url: "/extension_setting.php",
550
+ success: function (result) {
551
+ var Success = result
552
+ jQuery("#link_msg").html(Success);
553
+ }
554
+ });
555
+ });
556
+ });
557
+ </script>
558
+
559
+
560
+
561
+
562
+ <script>
563
+ jQuery(document).ready(function(){
564
+ jQuery("#site_logo_setting").click(function () {
565
+ var selectedbooks = jQuery("#footer_logo").serialize();
566
+ var type = 'site_logo';
567
+ var mage_find = jQuery('#mage_find').val();
568
+ //alert(selectedbooks);
569
+
570
+ jQuery.ajax({
571
+ type: 'POST',
572
+ data: selectedbooks + '&type=' + type + '&mage=' + mage_find,
573
+ url: "/extension_setting.php",
574
+ success: function (result) {
575
+ var Success = result
576
+ jQuery("#link_msg_data").html(Success);
577
+ }
578
+ });
579
+ });
580
+ });
581
+ </script>
582
+
583
+
584
+
585
+ <?php
586
+ ########################################################################################################################
587
+ # End Ajax for Logo and footer link and email
588
+ ########################## ############################################################################################
589
+ ?>
590
+
591
+
592
+ <?php
593
+ ########################################################################################################################
594
+ # Section for purchase reminder/invitation email/outward communication
595
+ ########################## ############################################################################################
596
+ ?>
597
+ <div class="inner-content">
598
+ <div class="logo-form border-bottm">
599
+ <h3>E-Mail: Remind registered user who left the site that there are products in the cart</h3>
600
+ <form id="pur_reminder">
601
+ <div class="checkbox">
602
+ <label for="yes">
603
+ <input type="radio" name="reminder_status" value="yes" <?php if ($result['5']['status'] == 'yes') echo 'checked';
604
+ else echo ''; ?>> ON
605
+ </label>
606
+ <label for="no">
607
+ <input type="radio" name="reminder_status" value="no" <?php if ($result['5']['status'] == 'no') echo 'checked';
608
+ else echo ''; ?>> OFF
609
+ </label>
610
+ <label for="find-msg"></label>
611
+ <button type="button" id="reminder_setting">save</button>
612
+ </div>
613
+
614
+ </form>
615
+ <div id="reminder_status_msg" class="text-success"></div>
616
+ </div>
617
+
618
+ <!-- Instent Massenger -->
619
+ <div class="ins-msg border-bottm">
620
+ <h3>Server communications: Disable communication with Pricelizer servers (This will limit your functionality dramatically and require you to use the subscription package with fixed pricing)</h3>
621
+ <form id="outcom">
622
+ <div class="checkbox">
623
+ <label for="yes">
624
+ <input type="radio" name="outwards_com" value="yes" <?php if ($result['6']['status'] == 'yes') echo 'checked';
625
+ else echo ''; ?>> ON
626
+ </label>
627
+ <label for="no">
628
+ <input type="radio" name="outwards_com" value="no" <?php if ($result['6']['status'] == 'no') echo 'checked';
629
+ else echo ''; ?>> OFF
630
+ </label>
631
+ <label for="find-msg"></label>
632
+ <button type="button" id="outwards_setting">save</button>
633
+ </div>
634
+
635
+ </form>
636
+ <div id="outwards_com_msg" class="text-success"></div>
637
+ </div>
638
+
639
+
640
+ <h3>Abandoned cart reminder (similar to the Catch user function but without the pricelizer registration, a button to get back to the cart and finalize the order and a list of the products in the cart.)</h3>
641
+ <form id="aban_reminder">
642
+ <div class="checkbox">
643
+ <label for="yes">
644
+ <input type="radio" name="aba_remin_setting" value="yes" <?php if ($result['8']['status'] == 'yes') echo 'checked';
645
+ else echo ''; ?>> ON
646
+ </label>
647
+ <label for="no">
648
+ <input type="radio" name="aba_remin_setting" value="no" <?php if ($result['8']['status'] == 'no') echo 'checked';
649
+ else echo ''; ?>> OFF
650
+ </label>
651
+ <label for="find-msg"></label>
652
+ <button type="button" id="abandoned_reminder_setting">save</button>
653
+ </div>
654
+
655
+ </form>
656
+ <div id="abandoned_reminder_msg" class="text-success"></div>
657
+ </div>
658
+ </div>
659
+
660
+
661
+
662
+
663
+
664
+ <script>
665
+ jQuery(document).ready(function(){
666
+ jQuery("#abandoned_reminder_setting").click(function () {
667
+ var selectedbooks = jQuery("#aban_reminder").serialize();
668
+ //alert(selectedbooks);
669
+ var type = 'abandoned_cart_reminder';
670
+ var mage_find = jQuery('#mage_find').val();
671
+ jQuery.ajax({
672
+ type: 'POST',
673
+ data: selectedbooks + '&type=' + type + '&mage=' + mage_find,
674
+ url: "/extension_setting.php",
675
+ success: function (result) {
676
+ var Success = result
677
+ jQuery("#abandoned_reminder_msg").html(Success);
678
+ }
679
+ });
680
+ });
681
+ });
682
+ </script>
683
+
684
+
685
+
686
+
687
+ <script>
688
+ jQuery(document).ready(function(){
689
+ jQuery("#reminder_setting").click(function () {
690
+ var selectedbooks = jQuery("#pur_reminder").serialize();
691
+ var type = 'purchase_reminder';
692
+ var mage_find = jQuery('#mage_find').val();
693
+ jQuery.ajax({
694
+ type: 'POST',
695
+ data: selectedbooks + '&type=' + type + '&mage=' + mage_find,
696
+ url: "/extension_setting.php",
697
+ success: function (result) {
698
+ var Success = result
699
+ jQuery("#reminder_status_msg").html(Success);
700
+ }
701
+ });
702
+ });
703
+ });
704
+ </script>
705
+
706
+
707
+ <script>
708
+ jQuery(document).ready(function(){
709
+ jQuery("#outwards_setting").click(function () {
710
+ var selectedbooks = jQuery("#outcom").serialize();
711
+ var type = 'outwards_communication';
712
+ var mage_find = jQuery('#mage_find').val();
713
+ jQuery.ajax({
714
+ type: 'POST',
715
+ data: selectedbooks + '&type=' + type + '&mage=' + mage_find,
716
+ url: "/extension_setting.php",
717
+ success: function (result) {
718
+ var Success = result
719
+ jQuery("#outwards_com_msg").html(Success);
720
+ }
721
+ });
722
+ });
723
+ });
724
+ </script>
725
+
app/design/adminhtml/default/default/template/Abandoncart/gear-01.png ADDED
Binary file
app/design/adminhtml/default/default/template/Abandoncart/gear-02.png ADDED
Binary file
app/design/adminhtml/default/default/template/Abandoncart/gear-03.png ADDED
Binary file
app/design/adminhtml/default/default/template/Abandoncart/index.php ADDED
@@ -0,0 +1 @@
 
1
+ zzzzxzxz
app/design/adminhtml/default/default/template/Abandoncart/license_key.php ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ ini_set('display_errors', 1);
3
+ class RestRequest
4
+ {
5
+ protected $url;
6
+ protected $verb;
7
+ protected $requestBody;
8
+ protected $requestLength;
9
+ protected $username;
10
+ protected $password;
11
+ protected $acceptType;
12
+ public $responseBody;
13
+ protected $responseInfo;
14
+ protected $contentType;
15
+
16
+ public function __construct ($url = null, $verb = 'GET', $requestBody = null)
17
+ {
18
+ $this->url = $url;
19
+ $this->verb = $verb;
20
+ $this->requestBody = $requestBody;
21
+ $this->requestLength = 0;
22
+ $this->username = null;
23
+ $this->password = null;
24
+ $this->acceptType = 'application/json';
25
+ $this->contentType = 'application/x-www-form-urlencoded';
26
+ $this->responseBody = null;
27
+ $this->responseInfo = null;
28
+
29
+ if ($this->requestBody !== null)
30
+ {
31
+ $this->buildPostBody();
32
+ }
33
+ }
34
+
35
+ public function flush ()
36
+ {
37
+ $this->requestBody = null;
38
+ $this->requestLength = 0;
39
+ $this->verb = 'GET';
40
+ $this->responseBody = null;
41
+ $this->responseInfo = null;
42
+ }
43
+
44
+ public function execute ()
45
+ {
46
+ $ch = curl_init();
47
+ $this->setAuth($ch);
48
+
49
+ try
50
+ {
51
+ switch (strtoupper($this->verb))
52
+ {
53
+ case 'GET':
54
+ $this->executeGet($ch);
55
+ break;
56
+ case 'POST':
57
+ $this->executePost($ch);
58
+ break;
59
+ case 'PUT':
60
+ $this->executePut($ch);
61
+ break;
62
+ case 'DELETE':
63
+ $this->executeDelete($ch);
64
+ break;
65
+ default:
66
+ throw new InvalidArgumentException('Current verb (' . $this->verb . ') is an invalid REST verb.');
67
+ }
68
+ }
69
+ catch (InvalidArgumentException $e)
70
+ {
71
+ curl_close($ch);
72
+ throw $e;
73
+ }
74
+ catch (Exception $e)
75
+ {
76
+ curl_close($ch);
77
+ throw $e;
78
+ }
79
+ }
80
+
81
+ public function buildPostBody ($data = null)
82
+ {
83
+ $data = ($data !== null) ? $data : $this->requestBody;
84
+
85
+ if (!is_array($data))
86
+ {
87
+ throw new InvalidArgumentException('Invalid data input for postBody. Array expected');
88
+ }
89
+
90
+ $data = http_build_query($data, '', '&');
91
+ $this->requestBody = $data;
92
+ }
93
+
94
+ protected function executeGet ($ch)
95
+ {
96
+ $this->doExecute($ch);
97
+ }
98
+
99
+ protected function executePost ($ch)
100
+ {
101
+ if (!is_string($this->requestBody))
102
+ {
103
+ $this->buildPostBody();
104
+ }
105
+
106
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $this->requestBody);
107
+ curl_setopt($ch, CURLOPT_POST, 1);
108
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: application/x-www-form-urlencoded"));
109
+
110
+ $this->doExecute($ch);
111
+ }
112
+
113
+ protected function executePut ($ch)
114
+ {
115
+ if (!is_string($this->requestBody))
116
+ {
117
+ $this->buildPostBody();
118
+ }
119
+
120
+ $this->requestLength = strlen($this->requestBody);
121
+
122
+ $fh = fopen('php://temp', 'rw+');
123
+ fwrite($fh, $this->requestBody);
124
+ rewind($fh);
125
+
126
+ curl_setopt($ch, CURLOPT_INFILE, $fh);
127
+ curl_setopt($ch, CURLOPT_INFILESIZE, $this->requestLength);
128
+ curl_setopt($ch, CURLOPT_PUT, true);
129
+
130
+ $this->doExecute($ch);
131
+
132
+ fclose($fh);
133
+ }
134
+
135
+ protected function executeDelete ($ch)
136
+ {
137
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
138
+
139
+ $this->doExecute($ch);
140
+ }
141
+
142
+ protected function doExecute (&$curlHandle)
143
+ {
144
+ $this->setCurlOpts($curlHandle);
145
+ $this->responseBody = curl_exec($curlHandle);
146
+ $this->responseInfo = curl_getinfo($curlHandle);
147
+
148
+ curl_close($curlHandle);
149
+ }
150
+
151
+ protected function setCurlOpts (&$curlHandle)
152
+ {
153
+ curl_setopt($curlHandle, CURLOPT_TIMEOUT, 10);
154
+ curl_setopt($curlHandle, CURLOPT_URL, $this->url);
155
+ curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
156
+ curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array ('Accept: ' . $this->acceptType));
157
+ curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array ('Content-Type: ' . $this->contentType));
158
+
159
+ curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, false);
160
+ curl_getinfo($curlHandle);
161
+ }
162
+
163
+ protected function setAuth (&$curlHandle)
164
+ {
165
+ if ($this->username !== null && $this->password !== null)
166
+ {
167
+ curl_setopt($curlHandle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
168
+ curl_setopt($curlHandle, CURLOPT_USERPWD, $this->username . ':' . $this->password);
169
+ }
170
+ }
171
+ }
172
+
173
+ $data = array('email'=>$_POST['email'],'liscence_key'=>$_POST['liscence_key']);
174
+ $url = "http://pricelizer.com/users/corporateLicence";
175
+ //echo $_POST['mage_find'];
176
+ $request = new RestRequest($url,'POST',$data);
177
+ $request->execute();
178
+ //print_r($request);
179
+
180
+ //-------------------------------DB Connection------------------------------------------------//
181
+ require_once($_POST['mage_find']);
182
+ Mage::init();
183
+ $db = Mage::helper("greenmodule")->dbconnection();
184
+ //-------------------------------End DB Connection------------------------------------------------//
185
+ //echo json_encode(array('email_id'=> $request));
186
+ $req=json_decode($request->responseBody,true);
187
+ $req_encode = json_encode(array('data'=> $request));
188
+ //print_r($req_encode);
189
+ //print_r($req);
190
+
191
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read') ;
192
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
193
+ $result10 = $read_data->fetchAll("select * from Abandon_cart_licensekey");
194
+ $useremail = $result10['0']['user_email'];
195
+ if($useremail == "")
196
+ {
197
+
198
+ if($req['success']=='1')
199
+ {
200
+
201
+ $insert = "insert into Abandon_cart_licensekey (user_email,license_key,start_date,end_date,duration_type,user_id,package_name,list_abandon_cart,invitation_link,user_details) values('".$_POST['email']."','".$_POST['liscence_key']."','".$req['start_date']."','".$req['end_date']."','".$req['duration_type']."','".$req['user_id']."','".$req['package_name']."','".$req['list_abandon_cart']."','".$req['invitation_link']."','".$req['user_details']."')";
202
+ $insert_exc = mysql_query($insert);
203
+
204
+ if($insert_exc)
205
+ {
206
+ $img_success = Mage::getDesign()->getSkinUrl('images/gear-03.png');
207
+ echo str_replace("frontend/base","adminhtml/default",$img_success);
208
+
209
+ }
210
+ elseif($req['success']=='0')
211
+ {
212
+ $img_success = Mage::getDesign()->getSkinUrl('images/gear-02.png');
213
+ echo str_replace("frontend/base","adminhtml/default",$img_success);
214
+
215
+ }
216
+ else
217
+ {
218
+ $img_success = Mage::getDesign()->getSkinUrl('images/gear-01.png');
219
+ echo str_replace("frontend/base","adminhtml/default",$img_success);
220
+
221
+ }
222
+
223
+ }
224
+
225
+
226
+ }
227
+
228
+ else
229
+
230
+ {
231
+ $update = "update Abandon_cart_licensekey set user_email='".$_POST['email']."',license_key='".$_POST['liscence_key']."',start_date='".$req['start_date']."',end_date='".$req['end_date']."',duration_type='".$req['duration_type']."',package_name='".$req['package_name']."',list_abandon_cart='".$req['list_abandon_cart']."',invitation_link='".$req['invitation_link']."',user_details='".$req['user_details']."' where user_id='".$req['user_id']."'";
232
+ $ex_update = mysql_query($update);
233
+
234
+
235
+ if($req['success']=='1')
236
+ {
237
+ $img_success = Mage::getDesign()->getSkinUrl('images/gear-03.png');
238
+ echo str_replace("frontend/base","adminhtml/default",$img_success);
239
+
240
+ }
241
+ else
242
+ {
243
+ $img_success = Mage::getDesign()->getSkinUrl('images/gear-02.png');
244
+ echo str_replace("frontend/base","adminhtml/default",$img_success);
245
+
246
+
247
+ }
248
+
249
+ }
250
+
251
+
252
+ ?>
app/design/adminhtml/default/default/template/Abandoncart/package_setting.php ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ ini_set('display_errors', 1);
3
+ class RestRequest
4
+ {
5
+ protected $url;
6
+ protected $verb;
7
+ protected $requestBody;
8
+ protected $requestLength;
9
+ protected $username;
10
+ protected $password;
11
+ protected $acceptType;
12
+ public $responseBody;
13
+ protected $responseInfo;
14
+ protected $contentType;
15
+
16
+ public function __construct ($url = null, $verb = 'GET', $requestBody = null)
17
+ {
18
+ $this->url = $url;
19
+ $this->verb = $verb;
20
+ $this->requestBody = $requestBody;
21
+ $this->requestLength = 0;
22
+ $this->username = null;
23
+ $this->password = null;
24
+ $this->acceptType = 'application/json';
25
+ $this->contentType = 'application/x-www-form-urlencoded';
26
+ $this->responseBody = null;
27
+ $this->responseInfo = null;
28
+
29
+ if ($this->requestBody !== null)
30
+ {
31
+ $this->buildPostBody();
32
+ }
33
+ }
34
+
35
+ public function flush ()
36
+ {
37
+ $this->requestBody = null;
38
+ $this->requestLength = 0;
39
+ $this->verb = 'GET';
40
+ $this->responseBody = null;
41
+ $this->responseInfo = null;
42
+ }
43
+
44
+ public function execute ()
45
+ {
46
+ $ch = curl_init();
47
+ $this->setAuth($ch);
48
+
49
+ try
50
+ {
51
+ switch (strtoupper($this->verb))
52
+ {
53
+ case 'GET':
54
+ $this->executeGet($ch);
55
+ break;
56
+ case 'POST':
57
+ $this->executePost($ch);
58
+ break;
59
+ case 'PUT':
60
+ $this->executePut($ch);
61
+ break;
62
+ case 'DELETE':
63
+ $this->executeDelete($ch);
64
+ break;
65
+ default:
66
+ throw new InvalidArgumentException('Current verb (' . $this->verb . ') is an invalid REST verb.');
67
+ }
68
+ }
69
+ catch (InvalidArgumentException $e)
70
+ {
71
+ curl_close($ch);
72
+ throw $e;
73
+ }
74
+ catch (Exception $e)
75
+ {
76
+ curl_close($ch);
77
+ throw $e;
78
+ }
79
+ }
80
+
81
+ public function buildPostBody ($data = null)
82
+ {
83
+ $data = ($data !== null) ? $data : $this->requestBody;
84
+
85
+ if (!is_array($data))
86
+ {
87
+ throw new InvalidArgumentException('Invalid data input for postBody. Array expected');
88
+ }
89
+
90
+ $data = http_build_query($data, '', '&');
91
+ $this->requestBody = $data;
92
+ }
93
+
94
+ protected function executeGet ($ch)
95
+ {
96
+ $this->doExecute($ch);
97
+ }
98
+
99
+ protected function executePost ($ch)
100
+ {
101
+ if (!is_string($this->requestBody))
102
+ {
103
+ $this->buildPostBody();
104
+ }
105
+
106
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $this->requestBody);
107
+ curl_setopt($ch, CURLOPT_POST, 1);
108
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: application/x-www-form-urlencoded"));
109
+
110
+ $this->doExecute($ch);
111
+ }
112
+
113
+ protected function executePut ($ch)
114
+ {
115
+ if (!is_string($this->requestBody))
116
+ {
117
+ $this->buildPostBody();
118
+ }
119
+
120
+ $this->requestLength = strlen($this->requestBody);
121
+
122
+ $fh = fopen('php://temp', 'rw+');
123
+ fwrite($fh, $this->requestBody);
124
+ rewind($fh);
125
+
126
+ curl_setopt($ch, CURLOPT_INFILE, $fh);
127
+ curl_setopt($ch, CURLOPT_INFILESIZE, $this->requestLength);
128
+ curl_setopt($ch, CURLOPT_PUT, true);
129
+
130
+ $this->doExecute($ch);
131
+
132
+ fclose($fh);
133
+ }
134
+
135
+ protected function executeDelete ($ch)
136
+ {
137
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
138
+
139
+ $this->doExecute($ch);
140
+ }
141
+
142
+ protected function doExecute (&$curlHandle)
143
+ {
144
+ $this->setCurlOpts($curlHandle);
145
+ $this->responseBody = curl_exec($curlHandle);
146
+ $this->responseInfo = curl_getinfo($curlHandle);
147
+
148
+ curl_close($curlHandle);
149
+ }
150
+
151
+ protected function setCurlOpts (&$curlHandle)
152
+ {
153
+ curl_setopt($curlHandle, CURLOPT_TIMEOUT, 10);
154
+ curl_setopt($curlHandle, CURLOPT_URL, $this->url);
155
+ curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
156
+ curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array ('Accept: ' . $this->acceptType));
157
+ curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array ('Content-Type: ' . $this->contentType));
158
+
159
+ curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, false);
160
+ curl_getinfo($curlHandle);
161
+ }
162
+
163
+ protected function setAuth (&$curlHandle)
164
+ {
165
+ if ($this->username !== null && $this->password !== null)
166
+ {
167
+ curl_setopt($curlHandle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
168
+ curl_setopt($curlHandle, CURLOPT_USERPWD, $this->username . ':' . $this->password);
169
+ }
170
+ }
171
+ }
172
+
173
+ $data = array('email'=>$_POST['reg_user_email'],'liscence_key'=>$_POST['reg_user_lkey']);
174
+ $url = "http://www.pricelizer.com/users/corporateLicence/";
175
+ $request = new RestRequest($url,'POST',$data);
176
+ $request->execute();
177
+ //-------------------------------DB Connection------------------------------------------------//
178
+ require_once($_POST['mage_find']);
179
+ Mage::init();
180
+ $db = Mage::helper("greenmodule")->dbconnection();
181
+ //-------------------------------End DB Connection------------------------------------------------//
182
+ //print_r($request);
183
+ $req=json_decode($request->responseBody,true);
184
+ print_r($req);
185
+ echo json_encode(array('data'=>$req));
186
+ if($req['success']=='1')
187
+ {
188
+ $update = "update Abandon_cart_licensekey set user_email='".$_POST['reg_user_email']."',license_key='".$_POST['reg_user_lkey']."',start_date='".$req['start_date']."',end_date='".$req['end_date']."',duration_type='".$req['duration_type']."',package_name='".$req['package_name']."',list_abandon_cart='".$req['list_abandon_cart']."',invitation_link='".$req['invitation_link']."',user_details='".$req['user_details']."' where user_id='".$req['user_id']."'";
189
+ $ex_update = mysql_query($update);
190
+ }
191
+
192
+ $req['abandoned_user_count'];
193
+ $req['catched_user_count'];
194
+ $read4 = Mage::getSingleton('core/resource')->getConnection('core_read') ;
195
+ $write4 = Mage::getSingleton('core/resource')->getConnection('core_write');
196
+ $select =$read4->fetchall("select * from Abandon_cart_users ");
197
+
198
+ if(empty($select))
199
+ {
200
+ $insert = "insert into Abandon_cart_users (Abandoned_cart,Catched_user) values ('".$req['abandoned_user_count']."','".$req['catched_user_count']."')";
201
+ $insert_exc = mysql_query($insert);
202
+ }
203
+ else
204
+ {
205
+ $update_users_count = "update Abandon_cart_users set Abandoned_cart ='".$req['abandoned_user_count']."', Catched_user ='".$req['catched_user_count']."' where id='1'";
206
+ $update_users_exc = mysql_query($update_users_count);
207
+ }
208
+
209
+
210
+
211
+ ?>
app/design/adminhtml/default/default/template/Abandoncart/pricelizer_logo.png ADDED
Binary file
app/design/adminhtml/default/default/template/Abandoncart/social_media.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+ ?>
app/design/adminhtml/default/default/template/Abandoncart/socialmedia.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //-------------------------------DB Connection------------------------------------------------//
3
+ require_once($_POST['mage_find']);
4
+ Mage::init();
5
+ $db = Mage::helper("greenmodule")->dbconnection();
6
+ //-------------------------------End DB Connection------------------------------------------------//
7
+
8
+ $fbapi = $_POST['fbkey'];
9
+ $_POST['mage_find'];
10
+
11
+ $read4 = Mage::getSingleton('core/resource')->getConnection('core_read') ;
12
+ $write4 = Mage::getSingleton('core/resource')->getConnection('core_write');
13
+ $result5 = $read4->fetchAll("SELECT * FROM Abandon_social_media_login");
14
+
15
+ echo $base_url = $result5['0']['social_id'];
16
+ if($base_url=="")
17
+ {
18
+
19
+ echo $insert_abandon = 'insert into Abandon_social_media_login (provider,oauth_token) values("social_media","'.$fbapi.'") ';
20
+ $update_exc = mysql_query($insert_abandon);
21
+ echo 'Successfully updated';
22
+ }
23
+ else
24
+ {
25
+ echo $insert_abandon = 'update Abandon_social_media_login set oauth_token = "'.$fbapi.'" where social_id="1"';
26
+ $update_exc = mysql_query($insert_abandon);
27
+ echo 'Successfully updated';
28
+
29
+ }
30
+
31
+ ?>
app/design/adminhtml/default/default/template/Abandoncart/subscribe.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once($_POST['mage_find']);
3
+ Mage::init();
4
+ $db = Mage::helper("greenmodule")->dbconnection();
5
+ //-------------------------------End DB Connection------------------------------------------------//
6
+ //echo json_encode(array('email_id'=> $request));
7
+ $req=json_decode($request->responseBody,true);
8
+ $req_encode = json_encode(array('data'=> $request));
9
+ //print_r($req_encode);
10
+ //print_r($req);
11
+
12
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read') ;
13
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
14
+ $subscription_status = $read_data->fetchall("SELECT * FROM Abandoned_email_subscription where customer_id ='".$_POST['customer_id']."'");
15
+ if($subscription_status['0']['customer_id']==$_POST['customer_id'])
16
+
17
+ {
18
+ $sql = "update Abandoned_email_subscription set subscribe_status ='yes' where customer_id ='".$_POST['customer_id']."'";
19
+ $exc_sql = mysql_query($sql);
20
+ print_r('You have subscibed for email alert notification');
21
+
22
+ }
23
+
24
+ ?>
app/design/adminhtml/default/default/template/Abandoncart/unsubscribe.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once($_POST['mage_find']);
3
+ Mage::init();
4
+ $db = Mage::helper("greenmodule")->dbconnection();
5
+ //-------------------------------End DB Connection------------------------------------------------//
6
+ //echo json_encode(array('email_id'=> $request));
7
+ $req=json_decode($request->responseBody,true);
8
+ $req_encode = json_encode(array('data'=> $request));
9
+ //print_r($req_encode);
10
+ //print_r($req);
11
+
12
+
13
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read') ;
14
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
15
+ $subscription_status = $read_data->fetchall("SELECT * FROM Abandoned_email_subscription where customer_id ='".$_POST['customer_id']."'");
16
+
17
+ if(empty($subscription_status))
18
+ {
19
+ $sql = "insert into Abandoned_email_subscription (customer_id,customer_name,customer_email,subscribe_status) values('".$_POST['customer_id']."','".$_POST['customer_name']."','".$_POST['customer_email']."','no')";
20
+ $exc_sql = mysql_query($sql);
21
+ print_r('You have unsubscibed for email alert notification');
22
+
23
+ }
24
+ elseif($subscription_status['0']['subscribe_status']=="no")
25
+ {
26
+ $sql = "update Abandoned_email_subscription set subscribe_status ='yes' where customer_id ='".$_POST['customer_id']."'";
27
+ $exc_sql = mysql_query($sql);
28
+ print_r('You have subscibed for email alert notification');
29
+
30
+ }
31
+ elseif($subscription_status['0']['subscribe_status']=="yes")
32
+ {$sql = "update Abandoned_email_subscription set subscribe_status ='no' where customer_id ='".$_POST['customer_id']."'";
33
+ $exc_sql = mysql_query($sql);
34
+ print_r('You have unsubscibed for email alert notification');
35
+
36
+ }
37
+
38
+
39
+
40
+
41
+ ?>
app/design/adminhtml/default/default/template/Abandoncart/userformupdate.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //-------------------------------DB Connection------------------------------------------------//
3
+
4
+ require_once($_POST['mage_find']);
5
+ Mage::init();
6
+ $db = Mage::helper("greenmodule")->dbconnection();
7
+
8
+
9
+ //-------------------------------End DB Connection------------------------------------------------//
10
+ $abandon_cart = "select * from abandon_cart where id ='1'";
11
+ $exc_cart = mysql_query($abandon_cart);
12
+ $fetch_data = mysql_fetch_row($exc_cart);
13
+ //print_r($fetch_data);
14
+ $status_abandon = $fetch_data['1'];
15
+ $status_day = $fetch_data['2'];
16
+
17
+
18
+
19
+ $status = $_POST['status'];
20
+ $days =$_POST['day'];
21
+ $date = date("Y-m-d H:i:s");
22
+
23
+
24
+ if($status == '0')
25
+ {
26
+
27
+ $data_update = "update abandon_cart set abandon_status ='".$status."'";
28
+ $update_exc = mysql_query($data_update);
29
+ $msg = 'Sucessfully';
30
+ echo json_encode(array('message'=>$msg));
31
+ }
32
+ elseif($status == '1')
33
+ {
34
+
35
+ $data_update = "update abandon_cart set abandon_status ='".$status."',day = '".$days."',date ='".$date."'";
36
+ $update_exc = mysql_query($data_update);
37
+ $msg = 'Sucessfully';
38
+ echo json_encode(array('message'=>$msg));
39
+
40
+ }
41
+
42
+ ?>
app/design/adminhtml/default/default/template/custom_email_template/customtab.phtml ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+ <head>
3
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
4
+ <script>jQuery.noConflict();</script>
5
+ <script src="//cdn.ckeditor.com/4.4.7/full/ckeditor.js"></script>
6
+
7
+ <style type="text/css">
8
+ .save-btn{ padding: 6px 20px 6px; margin-top: 15px; }
9
+ .logo-form{ margin-top: 15px; }
10
+ .logo-form /*, .footer-link-sec*/{ border-bottom: 1px solid #ccc; padding-bottom: 10px; margin-bottom: 15px; }
11
+ .logo-form .checkbox, .footer-link-sec .checkbox{ margin-bottom: 5px; }
12
+ .logo-form label, .footer-link-sec label{ margin: 0 6px; }
13
+ #link_setting, #logo_setting{ margin-left: 7px; }
14
+
15
+
16
+ </style>
17
+
18
+ </head>
19
+ <body>
20
+ <?php echo '<h3>Abandoned Cars Email Template</h3>'; ?>
21
+ <?php
22
+ $config = Mage::getConfig()->getResourceConnectionConfig("default_setup");
23
+ $_host = $config->host;
24
+ $_uname = $config->username;
25
+ $_pass = $config->password;
26
+ $_dbname = $config->dbname;
27
+ $_host; ///likewise
28
+ $read4 = Mage::getSingleton('core/resource')->getConnection('core_read');
29
+ $write4 = Mage::getSingleton('core/resource')->getConnection('core_write');
30
+ $result5 = $read4->fetchAll("SELECT * FROM log_url_info where url_id ='14'");
31
+ //print_r($result5);
32
+ $base_url = $result5['0']['url'];
33
+
34
+ $sql_select = $read4->fetchall("select * from abandon_email_template");
35
+ //print_r($sql_select);
36
+ ?>
37
+ <?php
38
+ ########################################################################################################################
39
+ # Email Template Editor
40
+ ########################## ############################################################################################
41
+ ?>
42
+ <style>
43
+ .container-middle, .section-item{ margin: auto; }
44
+ </style>
45
+ <textarea id="editor1" class="ckeditor" name="editor1"><?php echo $sql_select['0']['email_conetnt']; ?></textarea>
46
+ <button id="save" class="save-btn">Save</button>
47
+ <input type="hidden" id ="mage_find" value="<?php echo Mage::helper("greenmodule")->find_mage(); ?>">
48
+ <?php
49
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read');
50
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
51
+ $result = $read_data->fetchAll("select * from abandoned_extensionsetting");
52
+ ?>
53
+
54
+ <?php
55
+ ########################################################################################################################
56
+ # End Email Template Editor
57
+ ########################## ############################################################################################
58
+ ?>
59
+
60
+
61
+ <?php
62
+ ########################################################################################################################
63
+ # Ajax for email
64
+ ########################## ############################################################################################
65
+ ?>
66
+ <script>
67
+ jQuery(document).ready(function(){
68
+ jQuery("#save").click(function () {
69
+ var editor1 = CKEDITOR.instances['editor1'].getData();
70
+ var mage_find = jQuery('#mage_find').val();
71
+ var type = "invitation_email";
72
+ //console.log(editor1); return false;
73
+ //alert(status);
74
+ formData = '&editor1=' + editor1 + '&mage_find=' + mage_find+'&type='+type;
75
+ jQuery.ajax({
76
+ type: 'POST',
77
+ data: formData,
78
+ url: "/email_content.php",
79
+ success: function (result) {
80
+ var Success = result
81
+ alert(Success);
82
+ //alert(Success.message);
83
+ }
84
+ });
85
+ });
86
+ });
87
+ </script>
88
+
89
+ <?php Mage::getRoot() ?>
90
+
91
+ <?php
92
+ ########################################################################################################################
93
+ # End Ajax for Logo and footer link and email
94
+ ########################## ############################################################################################
95
+ ?>
app/design/adminhtml/default/default/template/custom_email_template/email_content.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once($_POST['mage_find']);
3
+ Mage::init();
4
+ $db = Mage::helper("greenmodule")->dbconnection();
5
+ //-------------------------------End DB Connection------------------------------------------------//
6
+ //echo json_encode(array('email_id'=> $request));
7
+ $req=json_decode($request->responseBody,true);
8
+ $req_encode = json_encode(array('data'=> $request));
9
+ //print_r($req_encode);
10
+ //print_r($req);
11
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read') ;
12
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
13
+
14
+ $sql_select = $read_data->fetchall("select * from abandon_email_template");
15
+ $type = $_POST['type'];
16
+
17
+ if($type=='invitation_email')
18
+ {
19
+ if(empty($sql_select))
20
+ {
21
+ $sql_insert = "insert into abandon_email_template (email_conetnt) values('".$_POST['editor1']."')";
22
+ $exc_sql = mysql_query($sql_insert);
23
+ print_r("updated");
24
+ }
25
+ else
26
+ {
27
+ $sql_insert = "update abandon_email_template set email_conetnt = '".$_POST['editor1']."' where template_type='abandoned_cart_template'";
28
+ $exc_sql = mysql_query($sql_insert);
29
+ print_r("Successfully updated");
30
+ }
31
+ }
32
+ elseif($type=='catched_user')
33
+
34
+ {
35
+ echo 'catcheduser';
36
+
37
+ $sql_insert = "update abandon_email_template set email_conetnt = '".$_POST['editor1']."' where template_type='catched_user_template'";
38
+ $exc_sql = mysql_query($sql_insert);
39
+ print_r("Successfully updated");
40
+
41
+ }
42
+
43
+ elseif($type=='purchase_reminder')
44
+ {
45
+
46
+
47
+ $sql_insert = "update abandon_email_template set email_conetnt = '".$_POST['editor1']."' where template_type='reminder_template'";
48
+ $exc_sql = mysql_query($sql_insert);
49
+ print_r("Successfully updated");
50
+
51
+ }
52
+
53
+
54
+ ?>
app/design/adminhtml/default/default/template/custom_email_template/purchase_reminder.phtml ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+ <head>
3
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
4
+ <script>jQuery.noConflict();</script>
5
+ <script src="//cdn.ckeditor.com/4.4.7/full/ckeditor.js"></script>
6
+ <script type="text/javascript">
7
+ window.onload = function ()
8
+
9
+ {
10
+ CKEDITOR.replace('editor1');
11
+ };
12
+ </script>
13
+ <style type="text/css">
14
+ .save-btn{ padding: 6px 20px 6px; margin-top: 15px; }
15
+ .logo-form{ margin-top: 15px; }
16
+ .logo-form /*, .footer-link-sec*/{ border-bottom: 1px solid #ccc; padding-bottom: 10px; margin-bottom: 15px; }
17
+ .logo-form .checkbox, .footer-link-sec .checkbox{ margin-bottom: 5px; }
18
+ .logo-form label, .footer-link-sec label{ margin: 0 6px; }
19
+ #link_setting, #logo_setting{ margin-left: 7px; }
20
+ </style>
21
+ </head>
22
+ <body>
23
+ <?php echo '<h3>Purchase Reminder Email Template </h3>'; ?>
24
+ <?php
25
+ $config = Mage::getConfig()->getResourceConnectionConfig("default_setup");
26
+ $_host = $config->host;
27
+ $_uname = $config->username;
28
+ $_pass = $config->password;
29
+ $_dbname = $config->dbname;
30
+ $_host; ///likewise
31
+ $read4 = Mage::getSingleton('core/resource')->getConnection('core_read');
32
+ $write4 = Mage::getSingleton('core/resource')->getConnection('core_write');
33
+ $result5 = $read4->fetchAll("SELECT * FROM log_url_info where url_id ='14'");
34
+ //print_r($result5);
35
+ $base_url = $result5['0']['url'];
36
+
37
+ $sql_select = $read4->fetchall("select * from abandon_email_template");
38
+ //print_r($sql_select);
39
+ ?>
40
+ <?php
41
+ ########################################################################################################################
42
+ # Email Template Editor
43
+ ########################## ############################################################################################
44
+ ?>
45
+
46
+ <textarea id="editor1" name="editor1"><?php echo $sql_select['2']['email_conetnt']; ?></textarea>
47
+ <button id="save" class="save-btn">Save</button>
48
+ <input type="hidden" id ="mage_find" value="<?php echo Mage::helper("greenmodule")->find_mage(); ?>">
49
+ <?php
50
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read');
51
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
52
+ $result = $read_data->fetchAll("select * from abandoned_extensionsetting");
53
+ ?>
54
+
55
+ <?php
56
+ ########################################################################################################################
57
+ # End Email Template Editor
58
+ ########################## ############################################################################################
59
+ ?>
60
+
61
+
62
+ <?php
63
+ ########################################################################################################################
64
+ # Ajax for email
65
+ ########################## ############################################################################################
66
+ ?>
67
+ <script>
68
+ jQuery(document).ready(function(){
69
+ jQuery("#save").click(function () {
70
+ var editor1 = CKEDITOR.instances['editor1'].getData();
71
+ var mage_find = jQuery('#mage_find').val();
72
+ var type = 'purchase_reminder';
73
+ //console.log(editor1); return false;
74
+ //alert(status);
75
+ formData = '&editor1=' + editor1 + '&mage_find=' + mage_find+'&type='+type;
76
+ jQuery.ajax({
77
+ type: 'POST',
78
+ data: formData,
79
+ url: "/email_content.php",
80
+ success: function (result) {
81
+ var Success = result
82
+ alert(Success);
83
+ //alert(Success.message);
84
+ }
85
+ });
86
+ });
87
+ });
88
+ </script>
89
+
90
+ <?php
91
+ ########################################################################################################################
92
+ # End Ajax for Logo and footer link and email
93
+ ########################## ############################################################################################
94
+ ?>
app/design/adminhtml/default/default/template/custom_email_template/template_setting.phtml ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+ <head>
3
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
4
+ <script>jQuery.noConflict();</script>
5
+ <script src="//cdn.ckeditor.com/4.4.7/full/ckeditor.js"></script>
6
+ <script type="text/javascript">
7
+ window.onload = function ()
8
+
9
+ {
10
+ CKEDITOR.replace('editor1');
11
+ };
12
+ </script>
13
+ <style type="text/css">
14
+ .save-btn{ padding: 6px 20px 6px; margin-top: 15px; }
15
+ .logo-form{ margin-top: 15px; }
16
+ .logo-form /*, .footer-link-sec*/{ border-bottom: 1px solid #ccc; padding-bottom: 10px; margin-bottom: 15px; }
17
+ .logo-form .checkbox, .footer-link-sec .checkbox{ margin-bottom: 5px; }
18
+ .logo-form label, .footer-link-sec label{ margin: 0 6px; }
19
+ #link_setting, #logo_setting{ margin-left: 7px; }
20
+ </style>
21
+ </head>
22
+ <body>
23
+ <?php echo '<h3>Catched user Email Template</h3>'; ?>
24
+ <?php
25
+ $config = Mage::getConfig()->getResourceConnectionConfig("default_setup");
26
+ $_host = $config->host;
27
+ $_uname = $config->username;
28
+ $_pass = $config->password;
29
+ $_dbname = $config->dbname;
30
+ $_host; ///likewise
31
+ $read4 = Mage::getSingleton('core/resource')->getConnection('core_read');
32
+ $write4 = Mage::getSingleton('core/resource')->getConnection('core_write');
33
+ $result5 = $read4->fetchAll("SELECT * FROM log_url_info where url_id ='14'");
34
+ //print_r($result5);
35
+ $base_url = $result5['0']['url'];
36
+
37
+ $sql_select = $read4->fetchall("select * from abandon_email_template");
38
+ //print_r($sql_select);
39
+ ?>
40
+ <?php
41
+ ########################################################################################################################
42
+ # Email Template Editor
43
+ ########################## ############################################################################################
44
+ ?>
45
+
46
+ <textarea id="editor1" name="editor1"><?php echo $sql_select['1']['email_conetnt']; ?></textarea>
47
+ <button id="save" class="save-btn">Save</button>
48
+ <input type="hidden" id ="mage_find" value="<?php echo Mage::helper("greenmodule")->find_mage(); ?>">
49
+ <?php
50
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read');
51
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
52
+ $result = $read_data->fetchAll("select * from abandoned_extensionsetting");
53
+ ?>
54
+
55
+ <?php
56
+ ########################################################################################################################
57
+ # End Email Template Editor
58
+ ########################## ############################################################################################
59
+ ?>
60
+
61
+
62
+ <?php
63
+ ########################################################################################################################
64
+ # Ajax for email
65
+ ########################## ############################################################################################
66
+ ?>
67
+ <script>
68
+ jQuery(document).ready(function(){
69
+ jQuery("#save").click(function () {
70
+ var editor1 = CKEDITOR.instances['editor1'].getData();
71
+ var mage_find = jQuery('#mage_find').val();
72
+ var type = 'catched_user';
73
+ //console.log(editor1); return false;
74
+ //alert(status);
75
+ formData = '&editor1=' + editor1 + '&mage_find=' + mage_find+'&type='+type;
76
+ jQuery.ajax({
77
+ type: 'POST',
78
+ data: formData,
79
+ url: "/email_content.php",
80
+ success: function (result) {
81
+ var Success = result
82
+ alert(Success);
83
+ //alert(Success.message);
84
+ }
85
+ });
86
+ });
87
+ });
88
+ </script>
89
+
90
+ <?php
91
+ ########################################################################################################################
92
+ # End Ajax for Logo and footer link and email
93
+ ########################## ############################################################################################
94
+ ?>
app/design/adminhtml/default/default/template/custom_email_template/test.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ echo '<pre>';print_r($_POST);
3
+
4
+
5
+ ?>
app/design/adminhtml/default/default/template/pricelizerstatistics/non_resgistered_statistics.phtml ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <style>
2
+ .cont-mang {
3
+ float: left;
4
+ padding: 0 20px;
5
+ width: 97%;
6
+ }
7
+ table.data{ width: 100%; }
8
+ .grid h1.title-name{font-size:14px; text-transform:capitalize; float:left;margin-right:10px;}
9
+ .invite_link{font-weight:bold; text-decoration:none;}
10
+ .invite_link{font-weight:bold; text-decoration:underline;}
11
+ a.price_alert {
12
+ background: #EA7601;
13
+ color: #FFFFFF;
14
+ margin-bottom: 10px;
15
+ padding: 5px 10px;
16
+ text-align: right;
17
+ text-decoration: none; border-radius:5px;
18
+ }
19
+ a.price_alert:hover{color: #FFFFFF; background:orange;}
20
+ .email_send{color:#66a202;}
21
+ .email_not_send{color:#ff0000;}
22
+ table.data td{font-size:0.9em;}
23
+ /* .cont-mang{
24
+ width: 100%;
25
+ float: left;
26
+ }*/
27
+ .data input[type="text"]{
28
+ width: 80%;
29
+ }
30
+ .grid {
31
+ float: left;
32
+ width: 100%;
33
+ }
34
+ .app-title-name{text-align:center; padding:10px; font-size:24px; color:#eb5e00;}
35
+
36
+ .click-price{width:100%; height:30px; text-align:center;}
37
+
38
+ .setting-from{ width:250px; margin:0px auto; height:50px;}
39
+ .setting-from .man{ width:100px; float:left; font-size:14px;}
40
+ .setting-from .auto{ width:100px; float:left; font-size:14px;}
41
+ .form_content {
42
+ border: 1px solid #EB5E00;
43
+ box-shadow: 0 0 3px #DDDDDD;
44
+ margin: 0 auto;
45
+ padding: 30px;
46
+ text-align: center;
47
+
48
+ }
49
+ .form_content input {
50
+ height: 40px;
51
+ margin-bottom: 10px;
52
+ width: 100%;
53
+ padding:10px;
54
+ }
55
+ .form_content button {
56
+ padding:10px;
57
+ }
58
+ .align_center{
59
+ margin:0 auto;
60
+ width:30%;
61
+ margin-top:90px;
62
+ text-align:center;
63
+
64
+ }
65
+ .align_center h2{
66
+ color:#EB5E00;
67
+ }
68
+ .setting-from .man {
69
+ float: left;
70
+ font-size: 14px;
71
+ width: 100%;
72
+ }
73
+ .setting-from .auto {
74
+ float: left;
75
+ font-size: 14px;
76
+ font-weight: bold;
77
+ margin-top: 4px;
78
+ width: auto;
79
+ }
80
+ .setting-from {
81
+ height: 50px;
82
+ margin: 0 auto;
83
+ width: 310px;
84
+ }
85
+ .man > h3 {
86
+ float: left;
87
+ }
88
+ .btn_manage{
89
+ text-align:center;
90
+ }
91
+ .btn_manage select{
92
+ width:200px;
93
+ height:20px;
94
+ margin-bottom:5px;
95
+ }
96
+ .btn_align{
97
+ text-align:center;
98
+ }
99
+ </style>
100
+ <style type="text/css">
101
+ .white_content {
102
+ background-color: #ffffff;
103
+ border: 5px solid ;
104
+ height: 50%;
105
+ left: 25%;
106
+ max-height: 500px;
107
+ overflow: auto;
108
+ padding: 13px 15px;
109
+ position: fixed;
110
+ top: 20%;
111
+ width: 50%;
112
+ z-index: 1008;
113
+ display:none;
114
+ }
115
+ .close-btn
116
+ {
117
+ font-size:20px;
118
+ float:right;
119
+ }
120
+
121
+
122
+ .pagination {
123
+ border-radius: 4px;
124
+ display: inline-block;
125
+ margin: 0px;
126
+ padding-left: 0;
127
+ }
128
+ .pagination > li {
129
+ display: inline;
130
+ }
131
+
132
+ .pagination > li:first-child > a, .pagination > li:first-child > span {
133
+ border-bottom-left-radius: 4px;
134
+ border-top-left-radius: 4px;
135
+ margin-left: 0;
136
+ }
137
+
138
+ .pagination > li, .pagination > li > span {
139
+ background-color: #fff;
140
+ border: 1px solid #ddd;
141
+ color: #428bca;
142
+ float: left;
143
+ line-height: 1.42857;
144
+ margin-left: -1px;
145
+ padding: 6px 12px;
146
+ position: relative;
147
+ text-decoration: none;
148
+ }
149
+
150
+
151
+ .page{ background-color: #fff;
152
+ border: none;
153
+ color: #000;
154
+ float: left;
155
+ line-height: 1.42857;
156
+ margin-left: -1px;
157
+ padding: 6px 12px;
158
+ position: relative;
159
+ text-decoration: none;
160
+ }
161
+ .centrick{width:275px; margin:0px auto;}
162
+ .centrick:after{clear:both;}
163
+ .catched-user-tracker .checkbox, .one-click-signup .checkbox, .add-watchlist-button .checkbox{ margin-bottom: 5px; }
164
+ .catched-user-tracker label, .one-click-signup label, .add-watchlist-button label, .checkbox label{ margin:0 6px; }
165
+ .catched-user-tracker input, .catched-user-tracker select { margin-bottom: 3px; margin-right: 2px; vertical-align: middle; }
166
+ .one-click-signup input, .one-click-signup select { margin-bottom: 3px; margin-right: 4px; vertical-align: middle; }
167
+ .add-watchlist-button input, .add-watchlist-button select { margin-bottom: 3px; margin-right: 4px; vertical-align: middle; }
168
+ .border-bottm{ border-bottom: 1px solid #ccc; padding-bottom: 10px; margin-bottom: 15px; }
169
+ .inner-content{ padding: 0 30px; }
170
+ .checkbox{margin-bottom:5px;}
171
+ button#catched_setting, button#save_signup, button#save_watchlist, #logo_setting, #link_setting { margin-left: 7px; }
172
+ .text-success{ padding-left: 7px; margin-top: 5px; color: #3c763d; }
173
+ </style>
174
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
175
+ <script>jQuery.noConflict();</script>
176
+ <?php
177
+ echo '<div class="content-header">
178
+ <h3 class="icon-head head-report-shopcart-abandoned">Non registered user statistics</h3>
179
+ </div>';
180
+ require_once 'app/Mage.php';
181
+
182
+ /*
183
+ * Initialize Magento. Older versions may require Mage::app() instead.
184
+ */
185
+ ?>
186
+
187
+ <!------------------- Total Number of users------------------------------------------>
188
+ <?php
189
+
190
+ $read_user = Mage::getSingleton('core/resource')->getConnection('core_read') ;
191
+ $write_user = Mage::getSingleton('core/resource')->getConnection('core_write');
192
+ $result_user_count = $read_user->fetchAll("SELECT * FROM Abandon_cart_users");
193
+ $result_user_count['0']['Abandoned_cart'];
194
+ $result_user_count['0']['Catched_user'];
195
+ $trace_user_ip = $read_user->fetchAll("SELECT * FROM abandoned_user_ip WHERE pay_status='pending'");
196
+ foreach($trace_user_ip as $uip)
197
+ {
198
+ //echo '<pre>';print_r($uip);
199
+
200
+
201
+
202
+
203
+ //echo '<pre>';print_r($order);
204
+ echo '<div class="grid"><div class="hor-scroll"><table border="1px solid">';
205
+
206
+ echo '<tr class="headings"><td colspan="11">'.$strip_date.'</td></tr>';
207
+ echo '<tr class="headings"><th>Product Name</th><th>Price</th><th>Pay status</th><th>Customer Email</th><th>Customer IP</th><th>Added date</th></tr>';
208
+ foreach($trace_user_ip as $uip){
209
+ //echo '<pre>';print_r($item);
210
+
211
+ echo '<td>'.$uip['product_name'].'</td>';
212
+ echo '<td>'.$uip['Product_price'].'</td>';
213
+ echo '<td>'.$uip['pay_status'].'</td>';
214
+ echo '<td>'.$uip['email_id'].'</td>';
215
+
216
+ echo '<td>'.$uip['user_ip'].'</td>';
217
+ echo '<td>'.$uip['added_date'].'</td></tr>';
218
+
219
+
220
+ }
221
+
222
+ echo '<tr></tr>';
223
+ echo '</table></div></div>';
224
+
225
+
226
+
227
+ }
228
+
229
+
230
+
231
+
232
+
233
+
234
+ ?>
app/design/adminhtml/default/default/template/pricelizerstatistics/pricelizerstatistics.phtml ADDED
@@ -0,0 +1,336 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <style>
2
+ .cont-mang {
3
+ float: left;
4
+ padding: 0 20px;
5
+ width: 97%;
6
+ }
7
+ table.data{ width: 100%; }
8
+ .grid h1.title-name{font-size:14px; text-transform:capitalize; float:left;margin-right:10px;}
9
+ .invite_link{font-weight:bold; text-decoration:none;}
10
+ .invite_link{font-weight:bold; text-decoration:underline;}
11
+ a.price_alert {
12
+ background: #EA7601;
13
+ color: #FFFFFF;
14
+ margin-bottom: 10px;
15
+ padding: 5px 10px;
16
+ text-align: right;
17
+ text-decoration: none; border-radius:5px;
18
+ }
19
+ a.price_alert:hover{color: #FFFFFF; background:orange;}
20
+ .email_send{color:#66a202;}
21
+ .email_not_send{color:#ff0000;}
22
+ table.data td{font-size:0.9em;}
23
+ /* .cont-mang{
24
+ width: 100%;
25
+ float: left;
26
+ }*/
27
+ .data input[type="text"]{
28
+ width: 80%;
29
+ }
30
+ .grid {
31
+ float: left;
32
+ width: 100%;
33
+ }
34
+ .app-title-name{text-align:center; padding:10px; font-size:24px; color:#eb5e00;}
35
+
36
+ .click-price{width:100%; height:30px; text-align:center;}
37
+
38
+ .setting-from{ width:250px; margin:0px auto; height:50px;}
39
+ .setting-from .man{ width:100px; float:left; font-size:14px;}
40
+ .setting-from .auto{ width:100px; float:left; font-size:14px;}
41
+ .form_content {
42
+ border: 1px solid #EB5E00;
43
+ box-shadow: 0 0 3px #DDDDDD;
44
+ margin: 0 auto;
45
+ padding: 30px;
46
+ text-align: center;
47
+
48
+ }
49
+ .form_content input {
50
+ height: 40px;
51
+ margin-bottom: 10px;
52
+ width: 100%;
53
+ padding:10px;
54
+ }
55
+ .form_content button {
56
+ padding:10px;
57
+ }
58
+ .align_center{
59
+ margin:0 auto;
60
+ width:30%;
61
+ margin-top:90px;
62
+ text-align:center;
63
+
64
+ }
65
+ .align_center h2{
66
+ color:#EB5E00;
67
+ }
68
+ .setting-from .man {
69
+ float: left;
70
+ font-size: 14px;
71
+ width: 100%;
72
+ }
73
+ .setting-from .auto {
74
+ float: left;
75
+ font-size: 14px;
76
+ font-weight: bold;
77
+ margin-top: 4px;
78
+ width: auto;
79
+ }
80
+ .setting-from {
81
+ height: 50px;
82
+ margin: 0 auto;
83
+ width: 310px;
84
+ }
85
+ .man > h3 {
86
+ float: left;
87
+ }
88
+ .btn_manage{
89
+ text-align:center;
90
+ }
91
+ .btn_manage select{
92
+ width:200px;
93
+ height:20px;
94
+ margin-bottom:5px;
95
+ }
96
+ .btn_align{
97
+ text-align:center;
98
+ }
99
+ </style>
100
+ <style type="text/css">
101
+ .white_content {
102
+ background-color: #ffffff;
103
+ border: 5px solid ;
104
+ height: 50%;
105
+ left: 25%;
106
+ max-height: 500px;
107
+ overflow: auto;
108
+ padding: 13px 15px;
109
+ position: fixed;
110
+ top: 20%;
111
+ width: 50%;
112
+ z-index: 1008;
113
+ display:none;
114
+ }
115
+ .close-btn
116
+ {
117
+ font-size:20px;
118
+ float:right;
119
+ }
120
+
121
+
122
+ .pagination {
123
+ border-radius: 4px;
124
+ display: inline-block;
125
+ margin: 0px;
126
+ padding-left: 0;
127
+ }
128
+ .pagination > li {
129
+ display: inline;
130
+ }
131
+
132
+ .pagination > li:first-child > a, .pagination > li:first-child > span {
133
+ border-bottom-left-radius: 4px;
134
+ border-top-left-radius: 4px;
135
+ margin-left: 0;
136
+ }
137
+
138
+ .pagination > li, .pagination > li > span {
139
+ background-color: #fff;
140
+ border: 1px solid #ddd;
141
+ color: #428bca;
142
+ float: left;
143
+ line-height: 1.42857;
144
+ margin-left: -1px;
145
+ padding: 6px 12px;
146
+ position: relative;
147
+ text-decoration: none;
148
+ }
149
+
150
+
151
+ .page{ background-color: #fff;
152
+ border: none;
153
+ color: #000;
154
+ float: left;
155
+ line-height: 1.42857;
156
+ margin-left: -1px;
157
+ padding: 6px 12px;
158
+ position: relative;
159
+ text-decoration: none;
160
+ }
161
+ .centrick{width:275px; margin:0px auto;}
162
+ .centrick:after{clear:both;}
163
+ .catched-user-tracker .checkbox, .one-click-signup .checkbox, .add-watchlist-button .checkbox{ margin-bottom: 5px; }
164
+ .catched-user-tracker label, .one-click-signup label, .add-watchlist-button label, .checkbox label{ margin:0 6px; }
165
+ .catched-user-tracker input, .catched-user-tracker select { margin-bottom: 3px; margin-right: 2px; vertical-align: middle; }
166
+ .one-click-signup input, .one-click-signup select { margin-bottom: 3px; margin-right: 4px; vertical-align: middle; }
167
+ .add-watchlist-button input, .add-watchlist-button select { margin-bottom: 3px; margin-right: 4px; vertical-align: middle; }
168
+ .border-bottm{ border-bottom: 1px solid #ccc; padding-bottom: 10px; margin-bottom: 15px; }
169
+ .inner-content{ padding: 0 30px; }
170
+ .checkbox{margin-bottom:5px;}
171
+ button#catched_setting, button#save_signup, button#save_watc $orders_data = Mage::getModel('sales/order')->getCollection()
172
+ ->addAttributeToFilter('created_at', array('from'=>$strip_date, 'to'=>$newDate))
173
+ ->addAttributeToFilter('status', array('status','pending'));
174
+ echo '<pre>';print_r($orders_data);hlist, #logo_setting, #link_setting { margin-left: 7px; }
175
+ .text-success{ padding-left: 7px; margin-top: 5px; color: #3c763d; }
176
+ </style>
177
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
178
+ <script>jQuery.noConflict();</script>
179
+ <?php
180
+ echo '<div class="content-header">
181
+ <h3 class="icon-head head-report-shopcart-abandoned">Generated Sales</h3>
182
+ </div>';
183
+ require_once 'app/Mage.php';
184
+
185
+ /*
186
+ * Initialize Magento. Older versions may require Mage::app() instead.
187
+ */
188
+ ?>
189
+
190
+ <!------------------- Total Number of users------------------------------------------>
191
+ <?php
192
+
193
+ $read_user = Mage::getSingleton('core/resource')->getConnection('core_read') ;
194
+ $write_user = Mage::getSingleton('core/resource')->getConnection('core_write');
195
+ $result_user_count = $read_user->fetchAll("SELECT * FROM Abandon_cart_users");
196
+ $result_user_count['0']['Abandoned_cart'];
197
+ $result_user_count['0']['Catched_user'];
198
+
199
+ ?>
200
+
201
+ <table style="margin: 0 auto 30px;width: 400px;">
202
+ <tr><td><h3 class="app-title-name">Enrolled users</h3></td></tr>
203
+ <tr><td>Registered users with abandoned carts:</td><td><?php echo $result_user_count['0']['Abandoned_cart']; ?></td></tr>
204
+ <tr><td>Non-registered users that abandoned their cart:</td><td><?php echo $result_user_count['0']['Catched_user']; ?></td></tr>
205
+
206
+ </table>
207
+
208
+ <?php
209
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read');
210
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
211
+ $result = $read_data->fetchAll("select * from abandoned_extensionsetting");
212
+ Mage::app();
213
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read') ;
214
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
215
+ $result10 = $read_data->fetchAll("select * from Abandon_cart_licensekey");
216
+ $registered_user_email = $result10['0']['user_email'];
217
+ $registered_user_license_key = $result10['0']['license_key'];
218
+
219
+ $orders = Mage::getResourceModel('sales/order_collection');
220
+ //echo '<pre>';print_r($orders);
221
+ $dataArr = array();
222
+ foreach($orders as $order){
223
+ //echo '<pre>';print_r($order);
224
+ $date=strtotime($order->created_at); // if today :2013-05-23
225
+ $newDate = date('Y-m-d',strtotime('+30 days',$date));
226
+
227
+ $createDate = new DateTime($order->created_at);
228
+ $strip_date = $createDate->format('Y-m-d');
229
+ $created_date[] = $strip_date;
230
+
231
+
232
+ $orderTotals = Mage::getModel('sales/order')->getCollection()
233
+ ->addAttributeToFilter('status', 'pending')
234
+ ->addAttributeToFilter('created_at', array('from'=>$strip_date,'to'=>$newDate))
235
+ ->addAttributeToSelect('grand_total')
236
+ ->getColumnValues('grand_total');
237
+
238
+ $totalSum = array_sum($orderTotals);
239
+ //print_r($totalSum);
240
+ $totalSum = Mage::helper('core')->currency($totalSum, true, false);
241
+ $vowels = array("$", ",");
242
+ $onlyconsonants = str_replace($vowels, "",$totalSum);
243
+ $grandtotal_data[] = $onlyconsonants;
244
+ $grandtotal = $grandtotal_data['0'];
245
+ $base_url = Mage::getBaseUrl();
246
+ $redirect_url = $base_url.'statistics/front/sales/?total_amount='.$grandtotal.'&liscence_key='.$registered_user_license_key;
247
+ $current_date = date('Y-m-d');
248
+
249
+ ?>
250
+ <?php if($result['6']['status']== 'yes') { if($newDate==$current_date) { ?>
251
+ <script>
252
+ jQuery(document).ready(function(){
253
+ jQuery.ajax({
254
+ type: 'POST',
255
+ //data:fromData,
256
+ url:"<?php echo $redirect_url; ?>",
257
+ success:function(result){
258
+
259
+ }
260
+ });
261
+
262
+ });
263
+ </script>
264
+
265
+ <?php } }
266
+
267
+
268
+
269
+ //echo '<pre>';print_r($order);
270
+ echo '<div class="grid"><div class="hor-scroll"><table border="1px solid">';
271
+
272
+ echo '<tr class="headings"><td colspan="11">'.$strip_date.'</td></tr>';
273
+ echo '<tr class="headings"><th>SKU</th><th>Product Name</th><th>Price</th><th>Oredered date</th><th>Product status</th><th>Product Quantity</th><th>Currency</th><th>Subtotal</th><th>Payment verified</th><th>User name</th><th>User Email</th></tr>';
274
+ $items = $order->getAllVisibleItems();
275
+ //$dataArr = array();
276
+
277
+ $i=0;
278
+ foreach($items as $item){
279
+
280
+
281
+ echo '<tr class="even pointer"><td >'.$item->getSku().'</td>';
282
+ echo '<td>'.$item->getName().'</td>';
283
+ echo '<td>'.$item->getPrice().'</td>';
284
+ echo '<td>'.$strip_date.'</td>';
285
+ echo '<td>'.$item->getStatus().'</td>';
286
+
287
+ echo '<td>'.$item->qty_ordered.'</td>';
288
+ echo '<td>'.$order->base_currency_code.'</td>';
289
+ echo '<td>'.$item->getRowTotalInclTax().'</td>';
290
+ echo '<td>'.$order->status.'</td>';
291
+ echo '<td>'.$order->customer_firstname.'</td>';
292
+ echo '<td>'.$order->customer_email.'</td></tr>';
293
+
294
+
295
+
296
+ $dataOrd[$i]['name'] = $item->getName();
297
+ //$dataArr['orders']['product_name']['product_price'] = $item->getPrice();
298
+
299
+ $dataOrd[$i]['price'] = $item->getPrice();
300
+
301
+
302
+
303
+
304
+ //$dataArr['liscence_key'] = $registered_user_license_key;
305
+
306
+ }
307
+
308
+ //echo '<pre>';
309
+ //print_r($dataOrd);
310
+
311
+ $dataArr['liscence_key'] = $registered_user_license_key;
312
+ $dataArr['total'] = $grandtotal;
313
+
314
+ echo '<tr class="even pointer"><td>Shipping amount</td><td>'.$order->shipping_amount.'</td><td>Grand Total</td><td colspan="8">'.$order->grand_total.'</td></tr>';
315
+ echo '<tr></tr>';
316
+ echo '</table></div></div>';
317
+
318
+
319
+ /* Get the collection */
320
+
321
+
322
+ }
323
+ $json_array = array('orders'=>$dataOrd,'liscence_key'=>$dataArr['liscence_key'],'total_amount'=>$dataArr['total']);
324
+ $data = json_encode($json_array);
325
+ $data;
326
+ $ch = curl_init();
327
+ $url ='http://www.pricelizer.com/webService/setSales/';
328
+
329
+ //set the url, number of POST vars, POST data
330
+ curl_setopt($ch,CURLOPT_URL, $url);
331
+ curl_setopt($ch,CURLOPT_POST, count($data));
332
+ curl_setopt($ch,CURLOPT_POSTFIELDS, $data);
333
+ //$result = curl_exec($ch);
334
+ curl_close($ch);
335
+
336
+ ?>
app/design/adminhtml/default/default/template/pricelizerstatistics/statistics_layergrapgh.phtml ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
2
+ <script>jQuery.noConflict();</script>
3
+ <script src="http://code.highcharts.com/highcharts.js"></script>
4
+ <script src="http://code.highcharts.com/modules/exporting.js"></script>
5
+
6
+
7
+ <?php
8
+ $loginUrl = 'http://staging.pricelizer.com/webService/getData/?liscence_key=1bbda9778bd4d706d24822f0efa49a44';
9
+ $agent= 'Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)';
10
+
11
+ $ch = curl_init();
12
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
13
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
14
+ curl_setopt($ch, CURLOPT_URL,$loginUrl);
15
+ curl_setopt($ch, CURLOPT_USERAGENT, $agent);
16
+ $result=curl_exec($ch);
17
+ curl_close($ch);
18
+ $result=json_decode($result);
19
+ $catcher_user = $result->{'catchedUser'}; // 12345
20
+ $abandonedUser = $result->{'abandonedUser'}; // 12345
21
+
22
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read');
23
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
24
+
25
+ //*************************************************Count placedorder************************************************************************//
26
+ $order_count = $read_data->fetchAll('SELECT SUM(qty_ordered) AS s, DATE_FORMAT(created_at, "%M") AS m
27
+ FROM sales_flat_order_item
28
+ GROUP BY DATE_FORMAT(created_at, "%Y-%m")');
29
+ //*************************************************end placed order******************************************************************//
30
+ //print_r($order_count);
31
+
32
+ //*************************************************Count abandoned cart************************************************************************//
33
+ $abandone_cart_count = $read_data->fetchAll('SELECT SUM( items_qty ) AS s, DATE_FORMAT( created_at, "%M" ) AS m ,DATE_FORMAT( created_at, "%Y") as y
34
+ FROM sales_flat_quote WHERE is_active=1 AND customer_id IS NOT NULL
35
+ GROUP BY DATE_FORMAT( created_at, "%Y-%m" ) ');
36
+
37
+ //*************************************************EndCount abandoned cart******************************************************************//
38
+
39
+ //print_r($abandone_cart_count);
40
+ $feb_data = $abandone_cart_count['3']['s'];
41
+ $march_data = $abandone_cart_count['4']['s'];
42
+
43
+ foreach($order_count as $key)
44
+ {
45
+ //echo '<pre>';print_r($key);
46
+ $ordered_product[]= $key['s'];
47
+
48
+ }
49
+
50
+ $ordered_product;
51
+
52
+ $imp_order=implode(',',$ordered_product);
53
+ //print_r($imp_order);
54
+
55
+ //print_r($_SERVER["REMOTE_ADDR"]);
56
+
57
+
58
+ ?>
59
+ <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
60
+ <?php
61
+ //------------------------------------------------------------Scan all Abandon Cart Product---------------------------------------------//
62
+
63
+ $collection = Mage::getResourceModel('reports/quote_collection');
64
+ $collection->prepareForAbandonedReport();
65
+ //echo '<pre>';print_r($collection); die;
66
+ $collection->getSelect()->limit($offset,$limit);
67
+
68
+ $output = $collection->load()->toArray();
69
+ $i=0;
70
+ foreach($collection->load()->toArray() as $key=>$user_detail)
71
+ {
72
+ $details=$user_detail;
73
+ }
74
+
75
+ foreach ($details as $val)
76
+ {
77
+
78
+ $count[] = $val['items_qty'];
79
+
80
+
81
+ $model = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('name')->addAttributeToFilter('entity_id',$val['entity_id'])
82
+ ->getFirstItem();
83
+ foreach($model as $prod_sku)
84
+ {
85
+ }
86
+ }
87
+ $total_abandon_cart = array_sum($count);
88
+ //echo "Abandoned cart = " . $total_abandon_cart. "\n";
89
+ echo '<br>';
90
+
91
+
92
+ //------------------------------------------------------------End Scan all Abandon Cart Product---------------------------------------------//
93
+
94
+
95
+ //------------------------------------------------------------Scantotal number of placed order---------------------------------------------//
96
+
97
+ $orders = Mage::getResourceModel('sales/order_collection');
98
+ $sum =0;
99
+ foreach($orders as $order){
100
+ //echo '<pre>';print_r($order);
101
+ $date=strtotime($order->created_at); // if today :2013-05-23
102
+ $newDate = date('Y-m-d',strtotime('+30 days',$date));
103
+ $createDate = new DateTime($order->created_at);
104
+ $strip_date = $createDate->format('Y-m-d');
105
+ $created_date[] = $strip_date;
106
+
107
+ $items = $order->getAllVisibleItems();
108
+ foreach($items as $item){
109
+ //echo '<pre>';print_r($item);
110
+ $count = (array)$item->qty_ordered;
111
+
112
+ $total_order[] = $count;
113
+ // echo $item->qty_ordered;
114
+
115
+ }
116
+
117
+ $sum =$sum + $order->total_item_count;
118
+ $order_count[] = (array)$order->total_item_count;
119
+
120
+ }
121
+
122
+ //echo "Ordered Product = " . $sum . "\n";
123
+
124
+ //--------------------------------------------------------EndScantotal number of placed order---------------------------------------------//
125
+
126
+ $total = $total_abandon_cart+$sum;
127
+ $data_content = 100/$total;
128
+ $percentage_of_placedorder = $sum*$data_content;
129
+ $percentage_of_abandonedcart = $total_abandon_cart*$data_content;
130
+ echo '<ul class="box-percent">';
131
+ echo '<li class="box-max"><span>Extenssion installation date: 4 September 2014</span></li>';
132
+ echo '<li class="box-min"><span>&nbsp;</span>'. ceil($percentage_of_placedorder).'% placed orders</li>';
133
+ echo '<li class="box-max"><span>&nbsp;</span>'. ceil($percentage_of_abandonedcart).'% abandoned carts</li>';
134
+
135
+ echo '</ul>';
136
+
137
+ ?>
138
+
139
+ <script>
140
+ jQuery(function () {
141
+ jQuery('#container').highcharts({
142
+ title: {
143
+ text: '',
144
+ x: -20 //center
145
+ },
146
+ subtitle: {
147
+ text: '',
148
+ x: -20
149
+ },
150
+ xAxis: {
151
+ categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
152
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
153
+ },
154
+ yAxis: {
155
+ title: {
156
+ text: ''
157
+ },
158
+ plotLines: [{
159
+ value: 0,
160
+ width: 1,
161
+ color: '#808080'
162
+ }]
163
+ },
164
+ tooltip: {
165
+ valueSuffix: ''
166
+ },
167
+ legend: {
168
+ layout: 'vertical',
169
+ align: 'right',
170
+ verticalAlign: 'middle',
171
+ borderWidth: 0
172
+ },
173
+ series: [{
174
+ name: 'Abandoned Carts',
175
+ data: [00, <?php echo $feb_data; ?>, <?php echo $march_data; ?>, 00, 00, 00, 00, 00, 00, 00, 00, 00]
176
+ }, {
177
+ name: 'Placed Order',
178
+ data: [<?php print_r($imp_order); ?>]
179
+ }, {
180
+ name: 'Registered Users(Invited by email)',
181
+ data: [ <?php echo $abandonedUser; ?>, 00, 00, 00, 00, 00, 00, 00,00,00, 00, 00]
182
+ }, {
183
+ name: 'Registered Users(Catched the leaving users)',
184
+ data: [<?php echo $catcher_user; ?>, 00, 00, 00, 00, 00, 00, 00, 00,00,00, 00]
185
+ },
186
+ ]
187
+
188
+
189
+ });
190
+ });
191
+
192
+
193
+ </script>
app/design/adminhtml/default/default/template/pricelizerstatistics/statisticsview.phtml ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * @var $this Mage_Currencysymbol_Block_Adminhtml_System_Currencysymbol
30
+ */
31
+ ?>
32
+ <link href="<?php echo $this->getSkinUrl(); ?>css/nv.d3.css" rel="stylesheet" type="text/css">
33
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.2/d3.min.js" charset="utf-8"></script>
34
+
35
+ <style>
36
+ text {
37
+ fill: #fff !important;
38
+ font-size: 12px !important;
39
+ text-shadow: 1px 1px #000;
40
+ font: 12px sans-serif;
41
+ }
42
+ svg {
43
+ display: block;
44
+ float: left;
45
+ height: 300px;
46
+ width: 300px;
47
+ }
48
+ html, body {
49
+ margin: 0px;
50
+ padding: 0px;
51
+ height: 100%;
52
+ width: 100%;
53
+ }
54
+ .box-percent {
55
+ float: right;
56
+ margin: 90px 0 0;
57
+ max-width: 350px;
58
+ padding: 0;
59
+ }
60
+ .box-percent li {
61
+ float: left;
62
+ font-size: 16px;
63
+ font-weight: bold;
64
+ margin: 10px 0;
65
+ width: 100%;
66
+ }
67
+ .box-min span {
68
+ background: none repeat scroll 0 0 #1f77b4;
69
+ border: 1px solid;
70
+ border-radius: 50%;
71
+ display: block;
72
+ float: left;
73
+ height: 20px;
74
+ margin-right: 10px;
75
+ width: 20px;
76
+ }
77
+ .box-max span {
78
+ background: #AEC7E8;
79
+ border: 1px solid;
80
+ border-radius: 50%;
81
+ display: block;
82
+ float: left;
83
+ height: 20px;
84
+ margin-right: 10px;
85
+ width: 20px;
86
+ }
87
+ .percent-circle-value {
88
+ float: left;
89
+ position: relative;
90
+ width: 300px;
91
+ }
92
+ .middle-content {
93
+ color: #1f77b4;
94
+ font-weight: bold;
95
+ left: 27%;
96
+ line-height: 26px;
97
+ position: absolute;
98
+ text-align: center;
99
+ top: 40%;
100
+ }
101
+ .cont-mid {
102
+ font-size: 16px;
103
+ }
104
+ .middle-content span {
105
+ display: block;
106
+ }
107
+ .mid-cont-head {
108
+ font-size: 50px;
109
+ margin-bottom: 8px;
110
+ }
111
+ .chart-container {
112
+ margin: 0 auto;
113
+ max-width: 700px;
114
+ }
115
+ </style>
116
+
117
+ <div class="content-header">
118
+ <table cellspacing="0">
119
+ <tr>
120
+ <td style="width:50%;"><h3 class="icon-head head-system-currency"><?php echo $this->getHeader() ?>Statistics</h3></td>
121
+ <td class="form-buttons">
122
+ <?php
123
+ echo $this->getSaveButtonHtml();
124
+ ?>
125
+ </td>
126
+ </tr>
127
+ </table>
128
+ </div>
129
+ <div class="chart-container">
130
+ <?php $this->getCurrencySymbolsData();?>
131
+ <?php
132
+ //------------------------------------------------------------Scan all Abandon Cart Product---------------------------------------------//
133
+
134
+ $collection = Mage::getResourceModel('reports/quote_collection');
135
+ $collection->prepareForAbandonedReport();
136
+ $collection->getSelect()->limit($offset,$limit);
137
+ $output = $collection->load()->toArray();
138
+ $i=0;
139
+ foreach($collection->load()->toArray() as $key=>$user_detail)
140
+ {
141
+ $details=$user_detail;
142
+ }
143
+
144
+ foreach ($details as $val)
145
+ {
146
+
147
+ $count[] = $val['items_qty'];
148
+
149
+
150
+ $model = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('name')->addAttributeToFilter('entity_id',$val['entity_id'])
151
+ ->getFirstItem();
152
+ foreach($model as $prod_sku)
153
+ {
154
+ }
155
+ }
156
+ $total_abandon_cart = array_sum($count);
157
+ //echo "Abandoned cart = " . $total_abandon_cart. "\n";
158
+ echo '<br>';
159
+
160
+
161
+ //------------------------------------------------------------End Scan all Abandon Cart Product---------------------------------------------//
162
+
163
+
164
+ //------------------------------------------------------------Scantotal number of placed order---------------------------------------------//
165
+
166
+ $orders = Mage::getResourceModel('sales/order_collection');
167
+ $sum =0;
168
+ foreach($orders as $order){
169
+ //echo '<pre>';print_r($order);
170
+ $date=strtotime($order->created_at); // if today :2013-05-23
171
+ $newDate = date('Y-m-d',strtotime('+30 days',$date));
172
+ $createDate = new DateTime($order->created_at);
173
+ $strip_date = $createDate->format('Y-m-d');
174
+ $created_date[] = $strip_date;
175
+
176
+ $items = $order->getAllVisibleItems();
177
+ foreach($items as $item){
178
+ //echo '<pre>';print_r($item);
179
+ $count = (array)$item->qty_ordered;
180
+
181
+ $total_order[] = $count;
182
+ // echo $item->qty_ordered;
183
+
184
+ }
185
+
186
+ $sum =$sum + $order->total_item_count;
187
+ $order_count[] = (array)$order->total_item_count;
188
+
189
+ }
190
+
191
+ //echo "Ordered Product = " . $sum . "\n";
192
+
193
+ //--------------------------------------------------------EndScantotal number of placed order---------------------------------------------//
194
+
195
+ $total = $total_abandon_cart+$sum;
196
+ $data_content = 100/$total;
197
+ $percentage_of_placedorder = $sum*$data_content;
198
+ $percentage_of_abandonedcart = $total_abandon_cart*$data_content;
199
+ echo '<ul class="box-percent">';
200
+ echo '<li class="box-min"><span>&nbsp;</span>'.
201
+ ceil($percentage_of_placedorder).'% placed orders</li>';
202
+ echo '<li class="box-max"><span>&nbsp;</span>'. ceil($percentage_of_abandonedcart).'% abandoned carts</li>';
203
+ echo '</ul>';
204
+
205
+ ?>
206
+
207
+ <script type="text/javascript" src="<?php echo $this->getSkinUrl(); ?>js/nv.d3.js"></script>
208
+ <script type="text/javascript" src="<?php echo $this->getSkinUrl(); ?>js/stream_layers.js"></script>
209
+ <div class="percent-circle-value">
210
+ <svg id="test2"></svg>
211
+ <span class="middle-content"><span class="mid-cont-head"><?php $percentage_of_abandonedcart ; echo $ceiled = ceil($percentage_of_abandonedcart); ?>%</span>
212
+ <?php
213
+ echo '<span class="cont-mid"> Abandoned carts</span>';
214
+
215
+ ?></span>
216
+ </div>
217
+ <script>
218
+ var testdata = [
219
+ {key: "One", y: <?php echo $percentage_of_placedorder; ?>},
220
+ {key: "Two", y: <?php echo $percentage_of_abandonedcart; ?>},
221
+
222
+ ];
223
+
224
+ var width = 300;
225
+ var height = 300;
226
+ nv.addGraph(function() {
227
+ var chart = nv.models.pie()
228
+ .x(function(d) { return d.key })
229
+ .y(function(d) { return d.y })
230
+ .width(width)
231
+ .height(height)
232
+ .labelType("percent")
233
+ .showLabels(true)
234
+ .donut(true)
235
+ .donutRatio(0.60)
236
+ .growOnHover(true);
237
+
238
+
239
+
240
+ d3.select("#test2")
241
+ .datum([testdata])
242
+ .transition().duration(1200)
243
+ .attr('width', width)
244
+ .attr('height', height)
245
+ .call(chart);
246
+
247
+ return chart;
248
+
249
+ });
250
+ </script>
251
+
252
+ </div>
app/design/frontend/base/default/layout/Greenacorn_Greenmodule.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <layout version="0.1.0">
4
+ <checkout_cart_index>
5
+ <reference name="before_body_end">
6
+ <block type="Abandoncart_cart/event_checkout_cart_index" name="Abandoncart_cart_event_checkout_cart_index" template="Abandoncart/cart/event/checkout/cart/index.phtml" />
7
+ </reference>
8
+ </checkout_cart_index>
9
+ </layout>
10
+
app/design/frontend/base/default/template/Abandoncart/facebook.jpeg.png ADDED
Binary file
app/design/frontend/base/default/template/Abandoncart/google.jpeg.png ADDED
Binary file
app/design/frontend/base/default/template/Abandoncart/index.phtml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $cart_qty = (int) Mage::getModel('checkout/cart')->getQuote()->getItemsQty();
2
+ $modules = Mage::getConfig()->getNode('modules')->children();
3
+ $modulesArray = (array)$modules;
4
+ if(isset($modulesArray['Greenacorn_Greenmodule']))
5
+
6
+ { echo 'Abandon Cart Module exist'.'<br>';
7
+
8
+
9
+ if($cart_qty!=0)
10
+ {
11
+ ?>
12
+
13
+ <script>
14
+ var isOk = false;
15
+ var isFirst = false;
16
+ window.onload=function(){
17
+ window.onbeforeunload = function(e) {
18
+ isOk=true;
19
+ if(!isFirst)
20
+ return 'Hi, you have added some products to your cart. Do you want us to alert you when the price drop on these specific products?';
21
+ else
22
+ return false;
23
+ }
24
+
25
+ }
26
+ // on body click isOk=false;
27
+
28
+ window.onfocus = function () {
29
+ if(isOk==true)
30
+ {
31
+ isOk=false;
32
+ isFirst= true;
33
+ window.onbeforeunload = null;
34
+ window.location='http://projects.udaantechnologies.com/magentodev/index.php/greenmodule/frontmodule/autoLogin';
35
+ }
36
+ };
37
+ </script>
38
+
39
+ <?php
40
+
41
+ }
42
+ else
43
+ {
44
+ echo 'Cart Empty';
45
+
46
+ }
47
+ }
48
+ else
49
+ {
50
+ echo 'Module does not exist';
51
+ }
52
+ ?>
app/design/frontend/base/default/template/Abandoncart/linked.jpeg.png ADDED
Binary file
app/design/frontend/base/default/template/Abandoncart/loginwithsocialmedia.phtml ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * @var $this Mage_Currencysymbol_Block_Adminhtml_System_Currencysymbol
30
+ */
31
+ ?>
32
+
33
+
34
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
35
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
36
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
37
+ <script>jQuery.noConflict();</script>
38
+ <title>Social Media Login</title>
39
+
40
+ <style>
41
+ .social-box {
42
+ width: 100%;
43
+ }
44
+
45
+ .social-box img{
46
+ margin:0 5px;
47
+ max-width:100%;
48
+ cursor:pointer;
49
+ }
50
+ .mid_sec{
51
+ max-width:350px;
52
+ margin:10% auto;
53
+ padding:40px;
54
+ border:1px solid #d5d5d5;
55
+ border-radius:5px;
56
+ text-align:center;
57
+ box-shadow:0 0 2px rgba(0,0,0,.5);
58
+ background:#eee;
59
+ }
60
+ .logo{
61
+ width:60%;
62
+ }
63
+ .btn-margh{
64
+ margin: 10px 0;
65
+ }
66
+ .modal-dialog{
67
+ margin-top: 100px;
68
+ }
69
+ .margin-top{
70
+ margin-top:10px;
71
+ margin-bottom:10px;
72
+ }
73
+ </style>
74
+
75
+
76
+ <?php $cart_url = Mage::helper('checkout/cart')->getCartUrl(); ?>
77
+ <script>
78
+ jQuery(document).ready(function(){
79
+ jQuery("#back_cart").click(function(){
80
+ var url = "<?php echo $cart_url; ?>";
81
+ window.location.assign(url);
82
+ });
83
+ });
84
+ </script>
85
+ <?php echo $this->getHeader(); ?>
86
+ <div class="mid_sec">
87
+ <img src="<?php echo $this->getSkinUrl('images/logo-1.png');?>" class="logo">
88
+ <h2>Activate your price alerts.</h2>
89
+ <p>Simply submit your email address or click on the social media buttons to activate price alerts on the product(s) in your cart using Pricelizer.</p>
90
+ <?php
91
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read');
92
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
93
+ $result = $read_data->fetchAll("select * from abandoned_extensionsetting");
94
+ if($result['1']['status'] == 'on') { ?>
95
+
96
+ <input type="text" name="email" id="left_user_email" class="form-control" placeholder="Email">
97
+
98
+ <button type="button" class="btn btn-primary margin-top" id="signup">1-Click Signup</button>
99
+ <?php } else {?>
100
+ <button type="button" class="btn btn-primary margin-top" id="back_cart">Go back to your cart</button>
101
+ <?php } ?>
102
+ <div class="clearboth"></div>
103
+
104
+ <!--<div class="social-box">
105
+ <img src ="<?php echo $this->getSkinUrl('images/facebook.jpeg.png'); ?>" class="fb_login" >
106
+ <img src ="<?php echo $this->getSkinUrl('images/linked.jpeg.png'); ?>" class="lkin_login" >
107
+ <img src ="<?php echo $this->getSkinUrl('images/google.jpeg.png'); ?>" class="gp_login" >
108
+
109
+ </div>-->
110
+
111
+ </div>
112
+
113
+
114
+ <?php
115
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read') ;
116
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
117
+ $result = $read_data->fetchAll("select * from abandoned_extensionsetting");
118
+
119
+ if($result['1']['status']=='on')
120
+ {
121
+
122
+ ?>
123
+
124
+ <script>
125
+ jQuery(document).ready(function(){
126
+ jQuery("#signup").click(function(){
127
+ var left_user_email = jQuery('#left_user_email').val();
128
+ //alert(left_user_email);
129
+
130
+ url='http://magento.pricelizer.com/index.php/abandon/front/guestuser/?user_email='+left_user_email;
131
+ //url:"http://projects.udaantechnologies.com/magentodev/index.php/greenmodule/front/guestuser",
132
+ window.location.replace(url);
133
+
134
+ });
135
+ });
136
+ </script>
137
+ <?php } else { ?>
138
+
139
+
140
+ <script>
141
+ jQuery(document).ready(function(){
142
+ jQuery("#signup").click(function(){
143
+ alert('This action disabled from the admin .To use it please contact site owner!');
144
+
145
+ });
146
+ });
147
+ </script>
148
+
149
+ <?php } ?>
150
+
app/design/frontend/base/default/template/page/html/head/head.phtml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <meta http-equiv="Content-Type" content="<?php echo $this->getContentType() ?>" />
28
+ <title><?php echo $this->getTitle() ?></title>
29
+ <meta name="description" content="<?php echo htmlspecialchars($this->getDescription()) ?>" />
30
+ <meta name="keywords" content="<?php echo htmlspecialchars($this->getKeywords()) ?>" />
31
+ <meta name="robots" content="<?php echo htmlspecialchars($this->getRobots()) ?>" />
32
+ <link rel="icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
33
+ <link rel="shortcut icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
34
+ <!--[if lt IE 7]>
35
+ <script type="text/javascript">
36
+ //<![CDATA[
37
+ var BLANK_URL = '<?php echo $this->helper('core/js')->getJsUrl('blank.html') ?>';
38
+ var BLANK_IMG = '<?php echo $this->helper('core/js')->getJsUrl('spacer.gif') ?>';
39
+ //]]>
40
+ </script>
41
+ <![endif]-->
42
+ <?php echo $this->getCssJsHtml() ?>
43
+ <?php echo $this->getChildHtml() ?>
44
+ <?php echo $this->helper('core/js')->getTranslatorScript() ?>
45
+ <?php echo $this->getIncludes() ?>
46
+
47
+ <?php echo Mage::helper("greenmodule")->abandon_cart(); ?>
app/design/frontend/rwd/default/template/catalog/product/productlist/list.phtml ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package rwd_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Product list template
30
+ *
31
+ * @see Mage_Catalog_Block_Product_List
32
+ */
33
+ /* @var $this Mage_Catalog_Block_Product_List */
34
+ ?>
35
+ <?php
36
+ $_productCollection=$this->getLoadedProductCollection();
37
+ $_helper = $this->helper('catalog/output');
38
+ ?>
39
+ <?php if(!$_productCollection->count()): ?>
40
+ <p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
41
+ <?php else: ?>
42
+ <div class="category-products">
43
+ <?php echo $this->getToolbarHtml() ?>
44
+ <?php // List mode ?>
45
+ <?php if($this->getMode()!='grid'): ?>
46
+ <?php $_iterator = 0; ?>
47
+ <ol class="products-list" id="products-list">
48
+ <?php foreach ($_productCollection as $_product): ?>
49
+ <li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
50
+ <?php // Product Image ?>
51
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
52
+ <?php /* Based on the native RWD styling, product images are displayed at a max of ~400px wide when viewed on a
53
+ one column page layout with four product columns from a 1280px viewport. For bandwidth reasons,
54
+ we are going to serve a 300px image, as it will look fine at 400px and most of the times, the image
55
+ will be displayed at a smaller size (eg, if two column are being used or viewport is smaller than 1280px).
56
+ This $_imgSize value could even be decreased further, based on the page layout
57
+ (one column, two column, three column) and number of product columns. */ ?>
58
+ <?php $_imgSize = 300; ?>
59
+ <img id="product-collection-image-<?php echo $_product->getId(); ?>"
60
+ src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->keepFrame(false)->resize($_imgSize); ?>"
61
+ alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
62
+ </a>
63
+ <?php // Product description ?>
64
+ <div class="product-shop">
65
+ <div class="f-fix">
66
+ <div class="product-primary">
67
+ <?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
68
+ <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>
69
+ <?php if($_product->getRatingSummary()): ?>
70
+ <?php echo $this->getReviewsSummaryHtml($_product) ?>
71
+ <?php endif; ?>
72
+
73
+ <?php
74
+ $_nameAfterChildren = $this->getChild('name.after')->getSortedChildren();
75
+ foreach($_nameAfterChildren as $_nameAfterChildName):
76
+ $_nameAfterChild = $this->getChild('name.after')->getChild($_nameAfterChildName);
77
+ $_nameAfterChild->setProduct($_product);
78
+ ?>
79
+ <?php echo $_nameAfterChild->toHtml(); ?>
80
+ <?php endforeach; ?>
81
+ </div>
82
+ <div class="product-secondary">
83
+ <?php echo $this->getPriceHtml($_product, true) ?>
84
+ </div>
85
+ <div class="product-secondary">
86
+ <?php if($_product->isSaleable() && !$_product->canConfigure()): ?>
87
+ <p class="action"><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
88
+ <?php elseif($_product->isSaleable()): ?>
89
+ <p class="action"><a title="<?php echo $this->__('View Details') ?>" class="button" href="<?php echo $_product->getProductUrl() ?>"><?php echo $this->__('View Details') ?></a></p>
90
+ <?php else: ?>
91
+ <p class="action availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
92
+ <?php endif; ?>
93
+ <ul class="add-to-links">
94
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
95
+ <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
96
+ <?php endif; ?>
97
+ <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
98
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
99
+ <?php endif; ?>
100
+ </ul>
101
+ </div>
102
+ <div class="desc std">
103
+ <?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
104
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
105
+ </div>
106
+ </div>
107
+ </div>
108
+ </li>
109
+ <?php endforeach; ?>
110
+ </ol>
111
+ <script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
112
+
113
+ <?php else: ?>
114
+
115
+ <?php // Grid Mode ?>
116
+
117
+ <?php $_collectionSize = $_productCollection->count() ?>
118
+ <?php $_columnCount = $this->getColumnCount(); ?>
119
+ <ul class="products-grid products-grid--max-<?php echo $_columnCount; ?>-col">
120
+ <?php $i=0; foreach ($_productCollection as $_product): ?>
121
+ <?php /*if ($i++%$_columnCount==0): ?>
122
+ <?php endif*/ ?>
123
+ <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
124
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
125
+ <?php $_imgSize = 210; ?>
126
+ <img id="product-collection-image-<?php echo $_product->getId(); ?>"
127
+ src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($_imgSize); ?>"
128
+ alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
129
+ </a>
130
+ <div class="product-info">
131
+ <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
132
+
133
+ <?php
134
+ $_nameAfterChildren = $this->getChild('name.after')->getSortedChildren();
135
+ foreach($_nameAfterChildren as $_nameAfterChildName):
136
+ $_nameAfterChild = $this->getChild('name.after')->getChild($_nameAfterChildName);
137
+ $_nameAfterChild->setProduct($_product);
138
+ ?>
139
+ <?php echo $_nameAfterChild->toHtml(); ?>
140
+ <?php endforeach; ?>
141
+
142
+ <?php echo $this->getPriceHtml($_product, true) ?>
143
+ <?php if($_product->getRatingSummary()): ?>
144
+ <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
145
+ <?php endif; ?>
146
+ <div class="actions">
147
+
148
+ <?php if($_product->isSaleable() && !$_product->canConfigure()): ?>
149
+ <button style="margin-bottom:5px;" type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
150
+ <?php if(Mage::getSingleton('customer/session')->isLoggedIn())
151
+ {
152
+
153
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
154
+ $email = $customer->getEmail();// for email address
155
+ $firstname = $customer->getFirstname();// For first name
156
+ $lastnam= $customer->getLastname();// For last name
157
+ $customer_id = $customer->getId();
158
+ $product_id = $_product->getId();
159
+ $entity_id = $customer->getEntityId();
160
+ //echo Mage::getBaseUrl();
161
+ $site_url = Mage::getBaseUrl();
162
+ $link = "". $site_url."pricelizer/".'?entity_id='.$entity_id.'&customer_email='.$email.'&item_id='.$product_id;
163
+ echo '<input type="hidden" id="link_value" value="'.$link.'">';
164
+ echo '<input type="hidden" id="link_entity" value="'.$entity_id.'">';
165
+ echo '<input type="hidden" id="link_email" value="'.$email.'">';
166
+ echo '<input type="hidden" id="link_productid" value="'.$product_id.'">';
167
+
168
+ ?>
169
+ <?php $resource = Mage::getSingleton('core/resource');
170
+ $readConnection = $resource->getConnection('core_read');
171
+ $query = 'SELECT * FROM ' . $resource->getTableName('Abandon_cart_licensekey');
172
+ $results = $readConnection->fetchAll($query);
173
+ $packagename = $results['0']['package_name'];
174
+ if($packagename=="LARGE"||$packagename=="MEDIUM"||$packagename=="Pro"||$packagename=="XXL")
175
+ {
176
+
177
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read') ;
178
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
179
+ $result_data = $read_data->fetchAll("select * from abandoned_extensionsetting");
180
+ $show_true = $result_data['2']['status'];
181
+ if($show_true=='on')
182
+ {
183
+ ?>
184
+ <button type="button" title="<?php echo $this->__('Add to Watchlist') ?>" class="button btn-cart" id ="<?php echo $product_id; ?>"><span><span><?php echo $this->__('Add to Watchlist') ?></span></span></button>
185
+ <?php } }?>
186
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
187
+ <script>
188
+ $("#<?php echo $product_id; ?>").click(function(){
189
+ var link_entity = $("#link_entity").val();
190
+ var link_email = $('#link_email').val();
191
+ var link_productid = $('#link_productid').val();
192
+ // alert(link_entity);
193
+ // alert(link_email);
194
+ // alert(link_productid);
195
+ //alert(status);
196
+ fromData = 'link_entity='+link_entity+'&link_email='+link_email+'&link_productid='+link_productid;
197
+ $.ajax({
198
+ type: 'POST',
199
+ data:fromData,
200
+ url:"<?php echo $site_url; ?>pricelizer",dataType: "json",
201
+ success:function(result){
202
+ var Success = result
203
+ alert(Success.message);
204
+ }
205
+ });
206
+ });
207
+ </script>
208
+
209
+
210
+
211
+ <?php } ?>
212
+
213
+
214
+
215
+ <?php elseif($_product->isSaleable()): ?>
216
+ <a title="<?php echo $this->__('View Details') ?>" class="button" href="<?php echo $_product->getProductUrl() ?>"><?php echo $this->__('View Details') ?></a>
217
+ <?php else: ?>
218
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
219
+ <?php endif; ?>
220
+ <ul class="add-to-links">
221
+
222
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
223
+ <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
224
+ <?php endif;?>
225
+ <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
226
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
227
+ <?php endif; ?>
228
+ </ul>
229
+ </div>
230
+ </div>
231
+ </li>
232
+ <?php /*if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
233
+ <?php endif*/ ?>
234
+ <?php endforeach ?>
235
+ </ul>
236
+ <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
237
+ <?php endif; ?>
238
+
239
+ <div class="toolbar-bottom">
240
+ <?php echo $this->getToolbarHtml() ?>
241
+ </div>
242
+ </div>
243
+ <?php endif; ?>
244
+
245
+ <?php
246
+ //set product collection on after blocks
247
+ $_afterChildren = $this->getChild('after')->getSortedChildren();
248
+ foreach($_afterChildren as $_afterChildName):
249
+ $_afterChild = $this->getChild('after')->getChild($_afterChildName);
250
+ $_afterChild->setProductCollection($_productCollection);
251
+ ?>
252
+ <?php echo $_afterChild->toHtml(); ?>
253
+ <?php endforeach; ?>
app/design/frontend/rwd/default/template/catalog/product/view/cart/addtocart.phtml ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package rwd_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php $_product = $this->getProduct(); ?>
28
+
29
+ <?php $buttonTitle = $this->__('Add to Cart'); ?>
30
+ <?php if($_product->isSaleable()): ?>
31
+ <div class="add-to-cart">
32
+ <?php if(!$_product->isGrouped()): ?>
33
+ <div class="qty-wrapper">
34
+ <label for="qty"><?php echo $this->__('Qty:') ?></label>
35
+ <input type="text" pattern="\d*" name="qty" id="qty" maxlength="12" value="<?php echo max($this->getProductDefaultQty() * 1, 1) ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
36
+ </div>
37
+ <?php endif; ?>
38
+ <div class="add-to-cart-buttons">
39
+ <button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>
40
+ <?php echo $this->getChildHtml('', true, true) ?>
41
+ </div>
42
+ <?php if(Mage::getSingleton('customer/session')->isLoggedIn())
43
+ {
44
+
45
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
46
+ $email = $customer->getEmail();// for email address
47
+ $firstname = $customer->getFirstname();// For first name
48
+ $lastnam= $customer->getLastname();// For last name
49
+ $customer_id = $customer->getId();
50
+ $product_id = $_product->getId();
51
+ $entity_id = $customer->getEntityId();
52
+ //echo Mage::getBaseUrl();
53
+ $site_url = Mage::getBaseUrl();
54
+ $link = "". $site_url."pricelizer/".'?entity_id='.$entity_id.'&customer_email='.$email.'&item_id='.$product_id;
55
+ echo '<input type="hidden" id="link_value" value="'.$link.'">';
56
+ echo '<input type="hidden" id="link_entity" value="'.$entity_id.'">';
57
+ echo '<input type="hidden" id="link_email" value="'.$email.'">';
58
+ echo '<input type="hidden" id="link_productid" value="'.$product_id.'">';
59
+
60
+ ?>
61
+
62
+
63
+ <?php $resource = Mage::getSingleton('core/resource');
64
+ $readConnection = $resource->getConnection('core_read');
65
+ $query = 'SELECT * FROM ' . $resource->getTableName('Abandon_cart_licensekey');
66
+ $results = $readConnection->fetchAll($query);
67
+ $packagename = $results['0']['package_name'];
68
+ if($packagename=="LARGE"||$packagename=="MEDIUM"||$packagename=="Pro"||$packagename=="XXL")
69
+ {
70
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read') ;
71
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
72
+ $result_data = $read_data->fetchAll("select * from abandoned_extensionsetting");
73
+ $show_true = $result_data['2']['status'];
74
+ if($show_true=='on') {
75
+ ?>
76
+ <div class="add-to-cart-buttons">
77
+ <button type="button" title="<?php echo 'Add to Watchlist'; ?>" class="button btn-cart" id="<?php echo $product_id; ?>"><span><span><?php echo 'Add to Watchlist'; ?></span></span></button>
78
+ <?php echo $this->getChildHtml('', true, true) ?>
79
+ </div>
80
+ <?php } } ?>
81
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
82
+ <script>
83
+ $("#<?php echo $product_id; ?>").click(function(){
84
+ var link_entity = $("#link_entity").val();
85
+ var link_email = $('#link_email').val();
86
+ var link_productid = $('#link_productid').val();
87
+ // alert(link_entity);
88
+ // alert(link_email);
89
+ // alert(link_productid);
90
+ //alert(status);
91
+ fromData = 'link_entity='+link_entity+'&link_email='+link_email+'&link_productid='+link_productid;
92
+ $.ajax({
93
+ type: 'POST',
94
+ data:fromData,
95
+ url:"<?php echo $site_url; ?>pricelizer",dataType: "json",
96
+ success:function(result){
97
+ var Success = result
98
+ alert(Success.message);
99
+ }
100
+ });
101
+ });
102
+ </script>
103
+
104
+
105
+
106
+ <?php } ?>
107
+
108
+ </div>
109
+ <?php endif; ?>
app/etc/modules/Button_Pricelizer.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Button_Pricelizer>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Button_Pricelizer>
8
+ </modules>
9
+ </config>
app/etc/modules/Email_Template.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Email_Template>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Email_Template>
8
+ </modules>
9
+ </config>
app/etc/modules/Greencorn_Greenmodule.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Greenacorn_Greenmodule>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Greenacorn_Greenmodule>
8
+ </modules>
9
+ </config>
app/etc/modules/Priceliz_Statistics.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Priceliz_Statistics>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Priceliz_Statistics>
8
+ </modules>
9
+ </config>
checkcart.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $cart = $_POST['cart'];
3
+
4
+ if($cart !=0)
5
+ {
6
+ $val = 'yes';
7
+ }
8
+ else
9
+ {
10
+ $val ='no';
11
+ }
12
+
13
+ echo $val;
14
+ ?>
email_content.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once($_POST['mage_find']);
3
+ Mage::init();
4
+ $db = Mage::helper("greenmodule")->dbconnection();
5
+ //-------------------------------End DB Connection------------------------------------------------//
6
+ //echo json_encode(array('email_id'=> $request));
7
+ $req=json_decode($request->responseBody,true);
8
+ $req_encode = json_encode(array('data'=> $request));
9
+ //print_r($req_encode);
10
+ //print_r($req);
11
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read') ;
12
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
13
+
14
+ $sql_select = $read_data->fetchall("select * from abandon_email_template");
15
+ $type = $_POST['type'];
16
+
17
+ if($type=='invitation_email')
18
+ {
19
+ if(empty($sql_select))
20
+ {
21
+ $sql_insert = "insert into abandon_email_template (email_conetnt) values('".$_POST['editor1']."')";
22
+ $exc_sql = mysql_query($sql_insert);
23
+ print_r("updated");
24
+ }
25
+ else
26
+ {
27
+ $sql_insert = "update abandon_email_template set email_conetnt = '".$_POST['editor1']."' where template_type='abandoned_cart_template'";
28
+ $exc_sql = mysql_query($sql_insert);
29
+ print_r("Successfully updated");
30
+ }
31
+ }
32
+ elseif($type=='catched_user')
33
+
34
+ {
35
+ echo 'catcheduser';
36
+
37
+ $sql_insert = "update abandon_email_template set email_conetnt = '".$_POST['editor1']."' where template_type='catched_user_template'";
38
+ $exc_sql = mysql_query($sql_insert);
39
+ print_r("Successfully updated");
40
+
41
+ }
42
+
43
+ elseif($type=='purchase_reminder')
44
+ {
45
+
46
+ $sql_insert = "update abandon_email_template set email_conetnt = '".$_POST['editor1']."' where template_type='reminder_template'";
47
+ $exc_sql = mysql_query($sql_insert);
48
+ print_r("Successfully updated");
49
+
50
+ }
51
+
52
+
53
+ ?>
extension_setting.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //-------------------------------DB Connection------------------------------------------------//
3
+ require_once($_POST['mage']);
4
+ Mage::init();
5
+ $db = Mage::helper("greenmodule")->dbconnection();
6
+
7
+ //-------------------------------End DB Connection------------------------------------------------//
8
+
9
+ ########################################################################################################################
10
+ # Get value from abandoned_extensionsetting
11
+ ########################## ############################################################################################
12
+
13
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read') ;
14
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
15
+ $result = $read_data->fetchAll("select * from abandoned_extensionsetting");
16
+
17
+
18
+ ########################################################################################################################
19
+ # End Get value from abandoned_extensionsetting
20
+ ########################## ############################################################################################
21
+
22
+ $type = $_POST['type'];
23
+
24
+ if($type=='catched_user')
25
+ {
26
+
27
+ $data = array("extension_name" =>$_POST["type"], "status" =>$_POST["catched_user"]); $where = "id = 1"; $write_data->update("abandoned_extensionsetting", $data, $where);
28
+ echo 'Settings saved';
29
+
30
+ }
31
+ elseif($type=='1_click_signup')
32
+ {
33
+
34
+ $data = array("extension_name" =>$_POST["type"], "status" =>$_POST["signup"]); $where = "id = 2"; $write_data->update("abandoned_extensionsetting", $data, $where);
35
+ echo 'Settings saved';
36
+
37
+ }
38
+
39
+ elseif($type=='add_to_watchlist')
40
+ {
41
+ $data = array("extension_name" =>$_POST["type"], "status" =>$_POST["add_to_watch"]); $where = "id = 3"; $write_data->update("abandoned_extensionsetting", $data, $where);
42
+ echo 'Settings saved';
43
+
44
+ }
45
+ elseif($type=='pricelizer_logo')
46
+ {
47
+ $data = array("extension_name" =>$_POST["type"], "status" =>$_POST["pri_logo"]); $where = "id = 4"; $write_data->update("abandoned_extensionsetting", $data, $where);
48
+ echo 'Settings saved';
49
+
50
+ }
51
+ elseif($type=='link_footer')
52
+
53
+ {
54
+ $data = array("extension_name" =>$_POST["type"], "status" =>$_POST["footer_link"]); $where = "id = 5"; $write_data->update("abandoned_extensionsetting", $data, $where);
55
+ echo 'Settings saved';
56
+ }
57
+ elseif($type=='purchase_reminder')
58
+ {
59
+
60
+ $data = array("extension_name" =>$_POST["type"], "status" =>$_POST["reminder_status"]); $where = "id = 6"; $write_data->update("abandoned_extensionsetting", $data, $where);
61
+ echo 'Settings saved';
62
+
63
+
64
+ }
65
+ elseif($type=='outwards_communication')
66
+ {
67
+
68
+ $data = array("extension_name" =>$_POST["type"], "status" =>$_POST["outwards_com"]); $where = "id = 7"; $write_data->update("abandoned_extensionsetting", $data, $where);
69
+ echo 'Settings saved';
70
+
71
+ }
72
+
73
+ elseif($type=='site_logo')
74
+ {
75
+ $data = array("extension_name" =>$_POST["type"], "status" =>$_POST["site_logo"]); $where = "id = 8"; $write_data->update("abandoned_extensionsetting", $data, $where);
76
+ echo 'Settings saved';
77
+
78
+
79
+ }
80
+
81
+ elseif($type=='abandoned_cart_reminder')
82
+ {
83
+ $data = array("extension_name" =>$_POST["type"], "status" =>$_POST["aba_remin_setting"]); $where = "id = 9"; $write_data->update("abandoned_extensionsetting", $data, $where);
84
+ echo 'Settings saved';
85
+
86
+
87
+ }
88
+
89
+ elseif($type=='invite_abandonedcar_user')
90
+ {
91
+ $data = array("extension_name" =>$_POST["type"], "status" =>$_POST["invite_user"]); $where = "id = 10"; $write_data->update("abandoned_extensionsetting", $data, $where);
92
+ echo 'Settings saved';
93
+
94
+
95
+ }
96
+
97
+
98
+
99
+
100
+
101
+
102
+ ?>
103
+
license_key.php ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ ini_set('display_errors', 1);
3
+ class RestRequest
4
+ {
5
+ protected $url;
6
+ protected $verb;
7
+ protected $requestBody;
8
+ protected $requestLength;
9
+ protected $username;
10
+ protected $password;
11
+ protected $acceptType;
12
+ public $responseBody;
13
+ protected $responseInfo;
14
+ protected $contentType;
15
+
16
+ public function __construct ($url = null, $verb = 'GET', $requestBody = null)
17
+ {
18
+ $this->url = $url;
19
+ $this->verb = $verb;
20
+ $this->requestBody = $requestBody;
21
+ $this->requestLength = 0;
22
+ $this->username = null;
23
+ $this->password = null;
24
+ $this->acceptType = 'application/json';
25
+ $this->contentType = 'application/x-www-form-urlencoded';
26
+ $this->responseBody = null;
27
+ $this->responseInfo = null;
28
+
29
+ if ($this->requestBody !== null)
30
+ {
31
+ $this->buildPostBody();
32
+ }
33
+ }
34
+
35
+ public function flush ()
36
+ {
37
+ $this->requestBody = null;
38
+ $this->requestLength = 0;
39
+ $this->verb = 'GET';
40
+ $this->responseBody = null;
41
+ $this->responseInfo = null;
42
+ }
43
+
44
+ public function execute ()
45
+ {
46
+ $ch = curl_init();
47
+ $this->setAuth($ch);
48
+
49
+ try
50
+ {
51
+ switch (strtoupper($this->verb))
52
+ {
53
+ case 'GET':
54
+ $this->executeGet($ch);
55
+ break;
56
+ case 'POST':
57
+ $this->executePost($ch);
58
+ break;
59
+ case 'PUT':
60
+ $this->executePut($ch);
61
+ break;
62
+ case 'DELETE':
63
+ $this->executeDelete($ch);
64
+ break;
65
+ default:
66
+ throw new InvalidArgumentException('Current verb (' . $this->verb . ') is an invalid REST verb.');
67
+ }
68
+ }
69
+ catch (InvalidArgumentException $e)
70
+ {
71
+ curl_close($ch);
72
+ throw $e;
73
+ }
74
+ catch (Exception $e)
75
+ {
76
+ curl_close($ch);
77
+ throw $e;
78
+ }
79
+ }
80
+
81
+ public function buildPostBody ($data = null)
82
+ {
83
+ $data = ($data !== null) ? $data : $this->requestBody;
84
+
85
+ if (!is_array($data))
86
+ {
87
+ throw new InvalidArgumentException('Invalid data input for postBody. Array expected');
88
+ }
89
+
90
+ $data = http_build_query($data, '', '&');
91
+ $this->requestBody = $data;
92
+ }
93
+
94
+ protected function executeGet ($ch)
95
+ {
96
+ $this->doExecute($ch);
97
+ }
98
+
99
+ protected function executePost ($ch)
100
+ {
101
+ if (!is_string($this->requestBody))
102
+ {
103
+ $this->buildPostBody();
104
+ }
105
+
106
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $this->requestBody);
107
+ curl_setopt($ch, CURLOPT_POST, 1);
108
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: application/x-www-form-urlencoded"));
109
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
110
+ $this->doExecute($ch);
111
+ }
112
+
113
+ protected function executePut ($ch)
114
+ {
115
+ if (!is_string($this->requestBody))
116
+ {
117
+ $this->buildPostBody();
118
+ }
119
+
120
+ $this->requestLength = strlen($this->requestBody);
121
+
122
+ $fh = fopen('php://temp', 'rw+');
123
+ fwrite($fh, $this->requestBody);
124
+ rewind($fh);
125
+
126
+ curl_setopt($ch, CURLOPT_INFILE, $fh);
127
+ curl_setopt($ch, CURLOPT_INFILESIZE, $this->requestLength);
128
+ curl_setopt($ch, CURLOPT_PUT, true);
129
+
130
+ $this->doExecute($ch);
131
+
132
+ fclose($fh);
133
+ }
134
+
135
+ protected function executeDelete ($ch)
136
+ {
137
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
138
+
139
+ $this->doExecute($ch);
140
+ }
141
+
142
+ protected function doExecute (&$curlHandle)
143
+ {
144
+ $this->setCurlOpts($curlHandle);
145
+ $this->responseBody = curl_exec($curlHandle);
146
+ $this->responseInfo = curl_getinfo($curlHandle);
147
+
148
+ curl_close($curlHandle);
149
+ }
150
+
151
+ protected function setCurlOpts (&$curlHandle)
152
+ {
153
+ curl_setopt($curlHandle, CURLOPT_TIMEOUT, 10);
154
+ curl_setopt($curlHandle, CURLOPT_URL, $this->url);
155
+ curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
156
+ curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array ('Accept: ' . $this->acceptType));
157
+ curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array ('Content-Type: ' . $this->contentType));
158
+
159
+ curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, false);
160
+ curl_getinfo($curlHandle);
161
+ }
162
+
163
+ protected function setAuth (&$curlHandle)
164
+ {
165
+ if ($this->username !== null && $this->password !== null)
166
+ {
167
+ curl_setopt($curlHandle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
168
+ curl_setopt($curlHandle, CURLOPT_USERPWD, $this->username . ':' . $this->password);
169
+ }
170
+ }
171
+ }
172
+
173
+ $data = array('email'=>$_POST['email'],'liscence_key'=>$_POST['liscence_key']);
174
+ $url = "http://www.pricelizer.com/users/corporateLicence";
175
+ //echo $_POST['mage_find'];
176
+ $request = new RestRequest($url,'POST',$data);
177
+ //print_r($request);
178
+ $request->execute();
179
+ //print_r($request);
180
+
181
+ //-------------------------------DB Connection------------------------------------------------//
182
+ require_once($_POST['mage_find']);
183
+ Mage::init();
184
+ $db = Mage::helper("greenmodule")->dbconnection();
185
+ //-------------------------------End DB Connection------------------------------------------------//
186
+ //echo json_encode(array('email_id'=> $request));
187
+ $req=json_decode($request->responseBody,true);
188
+ $req_encode = json_encode(array('data'=> $request));
189
+ //print_r($req_encode);
190
+ //print_r($req);
191
+
192
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read') ;
193
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
194
+ $result10 = $read_data->fetchAll("select * from Abandon_cart_licensekey");
195
+ $useremail = $result10['0']['user_email'];
196
+ if($useremail == "")
197
+ {
198
+
199
+ if($req['success']=='1')
200
+ {
201
+
202
+ $insert = "insert into Abandon_cart_licensekey (user_email,license_key,start_date,end_date,duration_type,user_id,package_name,list_abandon_cart,invitation_link,user_details) values('".$_POST['email']."','".$_POST['liscence_key']."','".$req['start_date']."','".$req['end_date']."','".$req['duration_type']."','".$req['user_id']."','".$req['package_name']."','".$req['list_abandon_cart']."','".$req['invitation_link']."','".$req['user_details']."')";
203
+ $insert_exc = mysql_query($insert);
204
+
205
+ if($insert_exc)
206
+ {
207
+ $img_success = Mage::getDesign()->getSkinUrl('images/gear-03.png');
208
+ echo str_replace("frontend/base","adminhtml/default",$img_success);
209
+
210
+ }
211
+ elseif($req['success']=='0')
212
+ {
213
+ $img_success = Mage::getDesign()->getSkinUrl('images/gear-02.png');
214
+ echo str_replace("frontend/base","adminhtml/default",$img_success);
215
+
216
+ }
217
+ else
218
+ {
219
+ $img_success = Mage::getDesign()->getSkinUrl('images/gear-01.png');
220
+ echo str_replace("frontend/base","adminhtml/default",$img_success);
221
+
222
+ }
223
+
224
+ }
225
+
226
+
227
+ }
228
+
229
+ else
230
+
231
+ {
232
+ $update = "update Abandon_cart_licensekey set user_email='".$_POST['email']."',license_key='".$_POST['liscence_key']."',start_date='".$req['start_date']."',end_date='".$req['end_date']."',duration_type='".$req['duration_type']."',package_name='".$req['package_name']."',list_abandon_cart='".$req['list_abandon_cart']."',invitation_link='".$req['invitation_link']."',user_details='".$req['user_details']."' where user_id='".$req['user_id']."'";
233
+ $ex_update = mysql_query($update);
234
+
235
+
236
+ if($req['success']=='1')
237
+ {
238
+ $img_success = Mage::getDesign()->getSkinUrl('images/gear-03.png');
239
+ echo str_replace("frontend/base","adminhtml/default",$img_success);
240
+
241
+ }
242
+ else
243
+ {
244
+ $img_success = Mage::getDesign()->getSkinUrl('images/gear-02.png');
245
+ echo str_replace("frontend/base","adminhtml/default",$img_success);
246
+
247
+
248
+ }
249
+
250
+ }
251
+
252
+
253
+ ?>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>ProvidedOnTheProfilePage</name>
4
+ <version>2.3.3.1</version>
5
+ <stability>stable</stability>
6
+ <license>http://opensource.org/licenses/osl-3.0.php</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>RevalizerNoMoreAbandonedCarts</summary>
10
+ <description>RevalizerNoMoreAbandonedCarts</description>
11
+ <notes>Minor Bug Fixes</notes>
12
+ <authors><author><name>Karl Lillrud</name><user>Pricelizer</user><email>contact@revalizer.com</email></author></authors>
13
+ <date>2015-07-31</date>
14
+ <time>20:36:13</time>
15
+ <contents><target name="mage"><dir name="."><file name="checkcart.php" hash="93cb99fd29c879c769d3661c5bfe9cf1"/><file name="email_content.php" hash="bbe150b72b32012a3935fe5b966b6c4b"/><file name="extension_setting.php" hash="e8d7053fdf8d08fe2ccb6ebb6f733903"/><file name="license_key.php" hash="d22df371a12ffca304058069ee9d58fc"/><file name="social_media.php" hash="2d635a244de5a170051ee3b4c639ac1b"/><file name="socialmedia.php" hash="53ce6dd442870c55a1df042e50d2a56e"/><file name="subscribe.php" hash="49eb93db71e09346194a46e5f1b7acea"/><file name="unsubscribe.php" hash="a90585cec1c29a7714cebdf04d84d1a4"/><file name="userformupdate.php" hash="7fc4959f9f8c92cc616c9d27306c80df"/><file name="Readme.txt" hash="144cf3e82c418fa298bb17a888a1fa0e"/></dir><dir name="smtp"><file name="class.phpmailer.php" hash="8478e9afa002a4f95d653628a75feca9"/><file name="class.smtp.php" hash="f63d5fbf0ddf3a0eb944880c44cffaa3"/></dir></target><target name="mageetc"><dir name="modules"><file name="Button_Pricelizer.xml" hash="c5b5b47e7f924af40e202eacaf6789f1"/><file name="Email_Template.xml" hash="0d5900da9430eae4696f3f8c380daadb"/><file name="Greencorn_Greenmodule.xml" hash="94f77f249c1e02ca0486648cfcdbc248"/><file name="Priceliz_Statistics.xml" hash="d3d1ceaf161c374319db3632c0c4d771"/></dir></target><target name="magecommunity"><dir name="Button"><dir name="Pricelizer"><dir name="controllers"><file name="IndexController.php" hash="8dd1903f441f3065ad4a9c139d13eb87"/></dir><dir name="etc"><file name="config.xml" hash="d24fe0b07e7208905ac31af2479f1ef5"/></dir></dir></dir><dir name="Email"><dir name="Template"><dir name="controllers"><dir name="Adminhtml"><file name="CustomController.php" hash="d8297576e9c7febbaf48fb39da92846a"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="42512b79841c58f4017c635b8714202e"/><file name="config.xml" hash="2c7351f69018542e90d9dc9908483526"/></dir></dir></dir><dir name="Greenacorn"><dir name="Greenmodule"><dir name="Helper"><file name="Data.php" hash="0ece754f41fbee401cdc016bd11d25fc"/><file name="checkcart.php" hash="93cb99fd29c879c769d3661c5bfe9cf1"/></dir><dir name="Model"><file name="Observer.php" hash="87948fb4b8839fe517f2d9636d8676e7"/></dir><dir name="controllers"><file name="AjaxController.php" hash="42fcbb0bfa40c5ac552ed85da19821a6"/><file name="FrontController.php" hash="2bc7179d2de79d9ad7c16b1c6b86959e"/><file name="FrontmoduleController.php" hash="50274375117387436aaa64f2a132edfa"/><file name="IndexController.php" hash="6d10d97c45f80a138e2a369ba44719b6"/><file name="LicensceController.php" hash="eb0d5b80b9d172138c2a28fa15712c90"/><file name="OnepageController.php" hash="3aff6d166df807eef55414fae5e44f98"/></dir><dir name="etc"><file name="adminhtml.xml" hash="d74e3a08cf086ee91f252bb818774977"/><file name="config.xml" hash="b00834aedce9404cdd0d0bd4e89bafd8"/></dir><dir name="sql"><dir name="greenmodule_setup"><file name="magento.sql~" hash="553b10fe8ca739b3c776a281e062c556"/><file name="mysql4-install-0.1.0.php" hash="d8ca5c9db077ee69f1e022e8a6097097"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="59bb20f1bdcd8a65dc70ab7ccc885769"/></dir><file name="mysql4-install-0.1.0.php" hash="3125034d7973f776b83e4c30e5f6a57d"/></dir></dir></dir><dir name="Priceliz"><dir name="Statistics"><dir name="Helper"><file name="Data.php" hash="b2e693ee619b72a1d0a27f7971ca6efd"/></dir><dir name="Model"><file name="Observer.php" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><dir name="controllers"><file name="FrontController.php" hash="3c4cd75aee3e83aa172c18e09794df9a"/><file name="FrontsalesController.php" hash="b1a2c150a824d44ba21695907b646164"/><file name="IndexController.php" hash="578689ea9c0d263ab6eb977a5bc0229c"/></dir><dir name="etc"><file name="adminhtml.xml" hash="82801784fd956f3afb3aee7454ce8cfa"/><file name="config.xml" hash="8e41eb269eb33c8ec6ffe33291b48912"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="rwd"><dir name="default"><dir name="template"><dir name="catalog"><dir name="product"><dir name="view"><dir name="cart"><file name="addtocart.phtml" hash="ab64104b69d274ce4b778971c77f03c6"/></dir></dir><dir name="productlist"><file name="list.phtml" hash="c6952df61891fa20c050dedee2d4060f"/></dir></dir></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="page"><dir name="html"><dir name="head"><file name="head.phtml" hash="4a273c48857a5a2066a4e0b63ccda94d"/></dir></dir></dir><dir name="Abandoncart"><file name="facebook.jpeg.png" hash="8e0a42086f473038554887702174bee5"/><file name="google.jpeg.png" hash="f9bac362b1032da102cc0452ea6121ce"/><file name="index.phtml" hash="f0fd01876be5a012b17960ce2e234284"/><file name="linked.jpeg.png" hash="64b17a8f10bba3fbeb3e1eb11e353da1"/><file name="loginwithsocialmedia.phtml" hash="15e44c5189c16ee05e97ba6bcf42e1bc"/></dir></dir><dir name="layout"><file name="Greenacorn_Greenmodule.xml" hash="457bac3559727f4af5c1098ced319dad"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="Abandoncart"><file name="abandoncart - keyur.phtml" hash="b1f77bc72918b6f36d1105d192dba0a9"/><file name="abandoncart.phtml" hash="f2868352a27d633d43c6409a42124fe8"/><file name="email_content.phtml" hash="4bbbc00fd00fe5322f82ee99c0390cd2"/><file name="email_template.phtml" hash="f710121d016f719390a3ef881518f503"/><file name="email_template_old.phtml" hash="0d7b367d0fe09f12bc0dce18e684d343"/><file name="extension_setting.php" hash="e8d7053fdf8d08fe2ccb6ebb6f733903"/><file name="extensionsetting.phtml" hash="fae6ec5d7b49eb512284d3ed5873ca74"/><file name="gear-01.png" hash="ca7c309ad9f895b2f543c2b8f62fbfed"/><file name="gear-02.png" hash="9a537e85f64f041d3d1e982d139ce121"/><file name="gear-03.png" hash="b8f1f55664062fc718871b7dff685108"/><file name="index.php" hash="b0fff0190284709b09c651049a291f75"/><file name="license_key.php" hash="c2234f1aa9cb7131adb234761f2a9147"/><file name="package_setting.php" hash="c528818913b4843646e765a78a44d356"/><file name="pricelizer_logo.png" hash="dd2c676b51edf05ab4f215263f11a319"/><file name="social_media.php" hash="2d635a244de5a170051ee3b4c639ac1b"/><file name="socialmedia.php" hash="53ce6dd442870c55a1df042e50d2a56e"/><file name="subscribe.php" hash="49eb93db71e09346194a46e5f1b7acea"/><file name="unsubscribe.php" hash="a90585cec1c29a7714cebdf04d84d1a4"/><file name="userformupdate.php" hash="4d9080db5d0277cc3c91a103e8f4f5ca"/></dir><dir name="custom_email_template"><file name="customtab.phtml" hash="c9d069f5cfdfb8a2d30fe8e8261d8155"/><file name="email_content.php" hash="7490018f74aa68df83d75b07d417b9d9"/><file name="purchase_reminder.phtml" hash="188eb0a643a5d89a240b054ddddebf6a"/><file name="template_setting.phtml" hash="26d0db3c126e135e35552e57630a5bec"/><file name="test.php" hash="7509c5c9a4cda870ac4ed34d66952109"/></dir><dir name="pricelizerstatistics"><file name="non_resgistered_statistics.phtml" hash="9c4ffa40a4ff589e57a38f1ae6ad56bf"/><file name="pricelizerstatistics.phtml" hash="5d9606b0794e3529d9bdc54712f6d882"/><file name="statistics_layergrapgh.phtml" hash="53a267effe5795870ee0cda7c0989f2e"/><file name="statisticsview.phtml" hash="eda19cbf22e9faa39a2867a8a6392299"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><file name="gear-01.png" hash="d22b9569a4f76d07465c0f7b0b0c6dbc"/><file name="gear-02.png" hash="292e5daeede08255f246ab16c0fd4f02"/><file name="gear-03.png" hash="dd6a0e1518b8b56a23625d51c2b3a165"/><file name="powered-by-pricelizer.png" hash="9fe3f5358e18f2a21caee7343a635d83"/><file name="powered-by-pricelizer.pngold" hash="9fe3f5358e18f2a21caee7343a635d83"/></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/adminhtml/default/default/images/gear-01.png ADDED
Binary file
skin/adminhtml/default/default/images/gear-02.png ADDED
Binary file
skin/adminhtml/default/default/images/gear-03.png ADDED
Binary file
skin/adminhtml/default/default/images/powered-by-pricelizer.png ADDED
Binary file
skin/adminhtml/default/default/images/powered-by-pricelizer.pngold ADDED
Binary file
smtp/class.phpmailer.php ADDED
@@ -0,0 +1,3690 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHPMailer - PHP email creation and transport class.
4
+ * PHP Version 5
5
+ * @package PHPMailer
6
+ * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
7
+ * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
8
+ * @author Jim Jagielski (jimjag) <jimjag@gmail.com>
9
+ * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
10
+ * @author Brent R. Matzelle (original founder)
11
+ * @copyright 2012 - 2014 Marcus Bointon
12
+ * @copyright 2010 - 2012 Jim Jagielski
13
+ * @copyright 2004 - 2009 Andy Prevost
14
+ * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
15
+ * @note This program is distributed in the hope that it will be useful - WITHOUT
16
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
+ * FITNESS FOR A PARTICULAR PURPOSE.
18
+ */
19
+
20
+ /**
21
+ * PHPMailer - PHP email creation and transport class.
22
+ * @package PHPMailer
23
+ * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
24
+ * @author Jim Jagielski (jimjag) <jimjag@gmail.com>
25
+ * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
26
+ * @author Brent R. Matzelle (original founder)
27
+ */
28
+ class PHPMailer
29
+ {
30
+ /**
31
+ * The PHPMailer Version number.
32
+ * @type string
33
+ */
34
+ public $Version = '5.2.10';
35
+
36
+ /**
37
+ * Email priority.
38
+ * Options: null (default), 1 = High, 3 = Normal, 5 = low.
39
+ * When null, the header is not set at all.
40
+ * @type integer
41
+ */
42
+ public $Priority = null;
43
+
44
+ /**
45
+ * The character set of the message.
46
+ * @type string
47
+ */
48
+ public $CharSet = 'iso-8859-1';
49
+
50
+ /**
51
+ * The MIME Content-type of the message.
52
+ * @type string
53
+ */
54
+ public $ContentType = 'text/plain';
55
+
56
+ /**
57
+ * The message encoding.
58
+ * Options: "8bit", "7bit", "binary", "base64", and "quoted-printable".
59
+ * @type string
60
+ */
61
+ public $Encoding = '8bit';
62
+
63
+ /**
64
+ * Holds the most recent mailer error message.
65
+ * @type string
66
+ */
67
+ public $ErrorInfo = '';
68
+
69
+ /**
70
+ * The From email address for the message.
71
+ * @type string
72
+ */
73
+ public $From = 'root@localhost';
74
+
75
+ /**
76
+ * The From name of the message.
77
+ * @type string
78
+ */
79
+ public $FromName = 'Root User';
80
+
81
+ /**
82
+ * The Sender email (Return-Path) of the message.
83
+ * If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
84
+ * @type string
85
+ */
86
+ public $Sender = '';
87
+
88
+ /**
89
+ * The Return-Path of the message.
90
+ * If empty, it will be set to either From or Sender.
91
+ * @type string
92
+ * @deprecated Email senders should never set a return-path header;
93
+ * it's the receiver's job (RFC5321 section 4.4), so this no longer does anything.
94
+ * @link https://tools.ietf.org/html/rfc5321#section-4.4 RFC5321 reference
95
+ */
96
+ public $ReturnPath = '';
97
+
98
+ /**
99
+ * The Subject of the message.
100
+ * @type string
101
+ */
102
+ public $Subject = '';
103
+
104
+ /**
105
+ * An HTML or plain text message body.
106
+ * If HTML then call isHTML(true).
107
+ * @type string
108
+ */
109
+ public $Body = '';
110
+
111
+ /**
112
+ * The plain-text message body.
113
+ * This body can be read by mail clients that do not have HTML email
114
+ * capability such as mutt & Eudora.
115
+ * Clients that can read HTML will view the normal Body.
116
+ * @type string
117
+ */
118
+ public $AltBody = '';
119
+
120
+ /**
121
+ * An iCal message part body.
122
+ * Only supported in simple alt or alt_inline message types
123
+ * To generate iCal events, use the bundled extras/EasyPeasyICS.php class or iCalcreator
124
+ * @link http://sprain.ch/blog/downloads/php-class-easypeasyics-create-ical-files-with-php/
125
+ * @link http://kigkonsult.se/iCalcreator/
126
+ * @type string
127
+ */
128
+ public $Ical = '';
129
+
130
+ /**
131
+ * The complete compiled MIME message body.
132
+ * @access protected
133
+ * @type string
134
+ */
135
+ protected $MIMEBody = '';
136
+
137
+ /**
138
+ * The complete compiled MIME message headers.
139
+ * @type string
140
+ * @access protected
141
+ */
142
+ protected $MIMEHeader = '';
143
+
144
+ /**
145
+ * Extra headers that createHeader() doesn't fold in.
146
+ * @type string
147
+ * @access protected
148
+ */
149
+ protected $mailHeader = '';
150
+
151
+ /**
152
+ * Word-wrap the message body to this number of chars.
153
+ * Set to 0 to not wrap. A useful value here is 78, for RFC2822 section 2.1.1 compliance.
154
+ * @type integer
155
+ */
156
+ public $WordWrap = 0;
157
+
158
+ /**
159
+ * Which method to use to send mail.
160
+ * Options: "mail", "sendmail", or "smtp".
161
+ * @type string
162
+ */
163
+ public $Mailer = 'mail';
164
+
165
+ /**
166
+ * The path to the sendmail program.
167
+ * @type string
168
+ */
169
+ public $Sendmail = '/usr/sbin/sendmail';
170
+
171
+ /**
172
+ * Whether mail() uses a fully sendmail-compatible MTA.
173
+ * One which supports sendmail's "-oi -f" options.
174
+ * @type boolean
175
+ */
176
+ public $UseSendmailOptions = true;
177
+
178
+ /**
179
+ * Path to PHPMailer plugins.
180
+ * Useful if the SMTP class is not in the PHP include path.
181
+ * @type string
182
+ * @deprecated Should not be needed now there is an autoloader.
183
+ */
184
+ public $PluginDir = '';
185
+
186
+ /**
187
+ * The email address that a reading confirmation should be sent to.
188
+ * @type string
189
+ */
190
+ public $ConfirmReadingTo = '';
191
+
192
+ /**
193
+ * The hostname to use in Message-Id and Received headers
194
+ * and as default HELO string.
195
+ * If empty, the value returned
196
+ * by SERVER_NAME is used or 'localhost.localdomain'.
197
+ * @type string
198
+ */
199
+ public $Hostname = '';
200
+
201
+ /**
202
+ * An ID to be used in the Message-Id header.
203
+ * If empty, a unique id will be generated.
204
+ * @type string
205
+ */
206
+ public $MessageID = '';
207
+
208
+ /**
209
+ * The message Date to be used in the Date header.
210
+ * If empty, the current date will be added.
211
+ * @type string
212
+ */
213
+ public $MessageDate = '';
214
+
215
+ /**
216
+ * SMTP hosts.
217
+ * Either a single hostname or multiple semicolon-delimited hostnames.
218
+ * You can also specify a different port
219
+ * for each host by using this format: [hostname:port]
220
+ * (e.g. "smtp1.example.com:25;smtp2.example.com").
221
+ * You can also specify encryption type, for example:
222
+ * (e.g. "tls://smtp1.example.com:587;ssl://smtp2.example.com:465").
223
+ * Hosts will be tried in order.
224
+ * @type string
225
+ */
226
+ public $Host = 'localhost';
227
+
228
+ /**
229
+ * The default SMTP server port.
230
+ * @type integer
231
+ * @TODO Why is this needed when the SMTP class takes care of it?
232
+ */
233
+ public $Port = 25;
234
+
235
+ /**
236
+ * The SMTP HELO of the message.
237
+ * Default is $Hostname.
238
+ * @type string
239
+ * @see PHPMailer::$Hostname
240
+ */
241
+ public $Helo = '';
242
+
243
+ /**
244
+ * What kind of encryption to use on the SMTP connection.
245
+ * Options: '', 'ssl' or 'tls'
246
+ * @type string
247
+ */
248
+ public $SMTPSecure = '';
249
+
250
+ /**
251
+ * Whether to enable TLS encryption automatically if a server supports it,
252
+ * even if `SMTPSecure` is not set to 'tls'.
253
+ * Be aware that in PHP >= 5.6 this requires that the server's certificates are valid.
254
+ * @type boolean
255
+ */
256
+ public $SMTPAutoTLS = true;
257
+
258
+ /**
259
+ * Whether to use SMTP authentication.
260
+ * Uses the Username and Password properties.
261
+ * @type boolean
262
+ * @see PHPMailer::$Username
263
+ * @see PHPMailer::$Password
264
+ */
265
+ public $SMTPAuth = false;
266
+
267
+ /**
268
+ * Options array passed to stream_context_create when connecting via SMTP.
269
+ * @type array
270
+ */
271
+ public $SMTPOptions = array();
272
+
273
+ /**
274
+ * SMTP username.
275
+ * @type string
276
+ */
277
+ public $Username = '';
278
+
279
+ /**
280
+ * SMTP password.
281
+ * @type string
282
+ */
283
+ public $Password = '';
284
+
285
+ /**
286
+ * SMTP auth type.
287
+ * Options are LOGIN (default), PLAIN, NTLM, CRAM-MD5
288
+ * @type string
289
+ */
290
+ public $AuthType = '';
291
+
292
+ /**
293
+ * SMTP realm.
294
+ * Used for NTLM auth
295
+ * @type string
296
+ */
297
+ public $Realm = '';
298
+
299
+ /**
300
+ * SMTP workstation.
301
+ * Used for NTLM auth
302
+ * @type string
303
+ */
304
+ public $Workstation = '';
305
+
306
+ /**
307
+ * The SMTP server timeout in seconds.
308
+ * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
309
+ * @type integer
310
+ */
311
+ public $Timeout = 300;
312
+
313
+ /**
314
+ * SMTP class debug output mode.
315
+ * Debug output level.
316
+ * Options:
317
+ * * `0` No output
318
+ * * `1` Commands
319
+ * * `2` Data and commands
320
+ * * `3` As 2 plus connection status
321
+ * * `4` Low-level data output
322
+ * @type integer
323
+ * @see SMTP::$do_debug
324
+ */
325
+ public $SMTPDebug = 0;
326
+
327
+ /**
328
+ * How to handle debug output.
329
+ * Options:
330
+ * * `echo` Output plain-text as-is, appropriate for CLI
331
+ * * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output
332
+ * * `error_log` Output to error log as configured in php.ini
333
+ *
334
+ * Alternatively, you can provide a callable expecting two params: a message string and the debug level:
335
+ * <code>
336
+ * $mail->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
337
+ * </code>
338
+ * @type string|callable
339
+ * @see SMTP::$Debugoutput
340
+ */
341
+ public $Debugoutput = 'echo';
342
+
343
+ /**
344
+ * Whether to keep SMTP connection open after each message.
345
+ * If this is set to true then to close the connection
346
+ * requires an explicit call to smtpClose().
347
+ * @type boolean
348
+ */
349
+ public $SMTPKeepAlive = false;
350
+
351
+ /**
352
+ * Whether to split multiple to addresses into multiple messages
353
+ * or send them all in one message.
354
+ * @type boolean
355
+ */
356
+ public $SingleTo = false;
357
+
358
+ /**
359
+ * Storage for addresses when SingleTo is enabled.
360
+ * @type array
361
+ * @TODO This should really not be public
362
+ */
363
+ public $SingleToArray = array();
364
+
365
+ /**
366
+ * Whether to generate VERP addresses on send.
367
+ * Only applicable when sending via SMTP.
368
+ * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path
369
+ * @link http://www.postfix.org/VERP_README.html Postfix VERP info
370
+ * @type boolean
371
+ */
372
+ public $do_verp = false;
373
+
374
+ /**
375
+ * Whether to allow sending messages with an empty body.
376
+ * @type boolean
377
+ */
378
+ public $AllowEmpty = false;
379
+
380
+ /**
381
+ * The default line ending.
382
+ * @note The default remains "\n". We force CRLF where we know
383
+ * it must be used via self::CRLF.
384
+ * @type string
385
+ */
386
+ public $LE = "\n";
387
+
388
+ /**
389
+ * DKIM selector.
390
+ * @type string
391
+ */
392
+ public $DKIM_selector = '';
393
+
394
+ /**
395
+ * DKIM Identity.
396
+ * Usually the email address used as the source of the email
397
+ * @type string
398
+ */
399
+ public $DKIM_identity = '';
400
+
401
+ /**
402
+ * DKIM passphrase.
403
+ * Used if your key is encrypted.
404
+ * @type string
405
+ */
406
+ public $DKIM_passphrase = '';
407
+
408
+ /**
409
+ * DKIM signing domain name.
410
+ * @example 'example.com'
411
+ * @type string
412
+ */
413
+ public $DKIM_domain = '';
414
+
415
+ /**
416
+ * DKIM private key file path.
417
+ * @type string
418
+ */
419
+ public $DKIM_private = '';
420
+
421
+ /**
422
+ * Callback Action function name.
423
+ *
424
+ * The function that handles the result of the send email action.
425
+ * It is called out by send() for each email sent.
426
+ *
427
+ * Value can be any php callable: http://www.php.net/is_callable
428
+ *
429
+ * Parameters:
430
+ * boolean $result result of the send action
431
+ * string $to email address of the recipient
432
+ * string $cc cc email addresses
433
+ * string $bcc bcc email addresses
434
+ * string $subject the subject
435
+ * string $body the email body
436
+ * string $from email address of sender
437
+ * @type string
438
+ */
439
+ public $action_function = '';
440
+
441
+ /**
442
+ * What to put in the X-Mailer header.
443
+ * Options: An empty string for PHPMailer default, whitespace for none, or a string to use
444
+ * @type string
445
+ */
446
+ public $XMailer = '';
447
+
448
+ /**
449
+ * An instance of the SMTP sender class.
450
+ * @type SMTP
451
+ * @access protected
452
+ */
453
+ protected $smtp = null;
454
+
455
+ /**
456
+ * The array of 'to' addresses.
457
+ * @type array
458
+ * @access protected
459
+ */
460
+ protected $to = array();
461
+
462
+ /**
463
+ * The array of 'cc' addresses.
464
+ * @type array
465
+ * @access protected
466
+ */
467
+ protected $cc = array();
468
+
469
+ /**
470
+ * The array of 'bcc' addresses.
471
+ * @type array
472
+ * @access protected
473
+ */
474
+ protected $bcc = array();
475
+
476
+ /**
477
+ * The array of reply-to names and addresses.
478
+ * @type array
479
+ * @access protected
480
+ */
481
+ protected $ReplyTo = array();
482
+
483
+ /**
484
+ * An array of all kinds of addresses.
485
+ * Includes all of $to, $cc, $bcc
486
+ * @type array
487
+ * @access protected
488
+ */
489
+ protected $all_recipients = array();
490
+
491
+ /**
492
+ * The array of attachments.
493
+ * @type array
494
+ * @access protected
495
+ */
496
+ protected $attachment = array();
497
+
498
+ /**
499
+ * The array of custom headers.
500
+ * @type array
501
+ * @access protected
502
+ */
503
+ protected $CustomHeader = array();
504
+
505
+ /**
506
+ * The most recent Message-ID (including angular brackets).
507
+ * @type string
508
+ * @access protected
509
+ */
510
+ protected $lastMessageID = '';
511
+
512
+ /**
513
+ * The message's MIME type.
514
+ * @type string
515
+ * @access protected
516
+ */
517
+ protected $message_type = '';
518
+
519
+ /**
520
+ * The array of MIME boundary strings.
521
+ * @type array
522
+ * @access protected
523
+ */
524
+ protected $boundary = array();
525
+
526
+ /**
527
+ * The array of available languages.
528
+ * @type array
529
+ * @access protected
530
+ */
531
+ protected $language = array();
532
+
533
+ /**
534
+ * The number of errors encountered.
535
+ * @type integer
536
+ * @access protected
537
+ */
538
+ protected $error_count = 0;
539
+
540
+ /**
541
+ * The S/MIME certificate file path.
542
+ * @type string
543
+ * @access protected
544
+ */
545
+ protected $sign_cert_file = '';
546
+
547
+ /**
548
+ * The S/MIME key file path.
549
+ * @type string
550
+ * @access protected
551
+ */
552
+ protected $sign_key_file = '';
553
+
554
+ /**
555
+ * The optional S/MIME extra certificates ("CA Chain") file path.
556
+ * @type string
557
+ * @access protected
558
+ */
559
+ protected $sign_extracerts_file = '';
560
+
561
+ /**
562
+ * The S/MIME password for the key.
563
+ * Used only if the key is encrypted.
564
+ * @type string
565
+ * @access protected
566
+ */
567
+ protected $sign_key_pass = '';
568
+
569
+ /**
570
+ * Whether to throw exceptions for errors.
571
+ * @type boolean
572
+ * @access protected
573
+ */
574
+ protected $exceptions = false;
575
+
576
+ /**
577
+ * Unique ID used for message ID and boundaries.
578
+ * @type string
579
+ * @access protected
580
+ */
581
+ protected $uniqueid = '';
582
+
583
+ /**
584
+ * Error severity: message only, continue processing.
585
+ */
586
+ const STOP_MESSAGE = 0;
587
+
588
+ /**
589
+ * Error severity: message, likely ok to continue processing.
590
+ */
591
+ const STOP_CONTINUE = 1;
592
+
593
+ /**
594
+ * Error severity: message, plus full stop, critical error reached.
595
+ */
596
+ const STOP_CRITICAL = 2;
597
+
598
+ /**
599
+ * SMTP RFC standard line ending.
600
+ */
601
+ const CRLF = "\r\n";
602
+
603
+ /**
604
+ * The maximum line length allowed by RFC 2822 section 2.1.1
605
+ * @type integer
606
+ */
607
+ const MAX_LINE_LENGTH = 998;
608
+
609
+ /**
610
+ * Constructor.
611
+ * @param boolean $exceptions Should we throw external exceptions?
612
+ */
613
+ public function __construct($exceptions = false)
614
+ {
615
+ $this->exceptions = (boolean)$exceptions;
616
+ }
617
+
618
+ /**
619
+ * Destructor.
620
+ */
621
+ public function __destruct()
622
+ {
623
+ //Close any open SMTP connection nicely
624
+ if ($this->Mailer == 'smtp') {
625
+ $this->smtpClose();
626
+ }
627
+ }
628
+
629
+ /**
630
+ * Call mail() in a safe_mode-aware fashion.
631
+ * Also, unless sendmail_path points to sendmail (or something that
632
+ * claims to be sendmail), don't pass params (not a perfect fix,
633
+ * but it will do)
634
+ * @param string $to To
635
+ * @param string $subject Subject
636
+ * @param string $body Message Body
637
+ * @param string $header Additional Header(s)
638
+ * @param string $params Params
639
+ * @access private
640
+ * @return boolean
641
+ */
642
+ private function mailPassthru($to, $subject, $body, $header, $params)
643
+ {
644
+ //Check overloading of mail function to avoid double-encoding
645
+ if (ini_get('mbstring.func_overload') & 1) {
646
+ $subject = $this->secureHeader($subject);
647
+ } else {
648
+ $subject = $this->encodeHeader($this->secureHeader($subject));
649
+ }
650
+ if (ini_get('safe_mode') || !($this->UseSendmailOptions)) {
651
+ $result = @mail($to, $subject, $body, $header);
652
+ } else {
653
+ $result = @mail($to, $subject, $body, $header, $params);
654
+ }
655
+ return $result;
656
+ }
657
+
658
+ /**
659
+ * Output debugging info via user-defined method.
660
+ * Only generates output if SMTP debug output is enabled (@see SMTP::$do_debug).
661
+ * @see PHPMailer::$Debugoutput
662
+ * @see PHPMailer::$SMTPDebug
663
+ * @param string $str
664
+ */
665
+ protected function edebug($str)
666
+ {
667
+ if ($this->SMTPDebug <= 0) {
668
+ return;
669
+ }
670
+ //Avoid clash with built-in function names
671
+ if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) {
672
+ call_user_func($this->Debugoutput, $str, $this->SMTPDebug);
673
+ return;
674
+ }
675
+ switch ($this->Debugoutput) {
676
+ case 'error_log':
677
+ //Don't output, just log
678
+ error_log($str);
679
+ break;
680
+ case 'html':
681
+ //Cleans up output a bit for a better looking, HTML-safe output
682
+ echo htmlentities(
683
+ preg_replace('/[\r\n]+/', '', $str),
684
+ ENT_QUOTES,
685
+ 'UTF-8'
686
+ )
687
+ . "<br>\n";
688
+ break;
689
+ case 'echo':
690
+ default:
691
+ //Normalize line breaks
692
+ $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str);
693
+ echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
694
+ "\n",
695
+ "\n \t ",
696
+ trim($str)
697
+ ) . "\n";
698
+ }
699
+ }
700
+
701
+ /**
702
+ * Sets message type to HTML or plain.
703
+ * @param boolean $isHtml True for HTML mode.
704
+ * @return void
705
+ */
706
+ public function isHTML($isHtml = true)
707
+ {
708
+ if ($isHtml) {
709
+ $this->ContentType = 'text/html';
710
+ } else {
711
+ $this->ContentType = 'text/plain';
712
+ }
713
+ }
714
+
715
+ /**
716
+ * Send messages using SMTP.
717
+ * @return void
718
+ */
719
+ public function isSMTP()
720
+ {
721
+ $this->Mailer = 'smtp';
722
+ }
723
+
724
+ /**
725
+ * Send messages using PHP's mail() function.
726
+ * @return void
727
+ */
728
+ public function isMail()
729
+ {
730
+ $this->Mailer = 'mail';
731
+ }
732
+
733
+ /**
734
+ * Send messages using $Sendmail.
735
+ * @return void
736
+ */
737
+ public function isSendmail()
738
+ {
739
+ $ini_sendmail_path = ini_get('sendmail_path');
740
+
741
+ if (!stristr($ini_sendmail_path, 'sendmail')) {
742
+ $this->Sendmail = '/usr/sbin/sendmail';
743
+ } else {
744
+ $this->Sendmail = $ini_sendmail_path;
745
+ }
746
+ $this->Mailer = 'sendmail';
747
+ }
748
+
749
+ /**
750
+ * Send messages using qmail.
751
+ * @return void
752
+ */
753
+ public function isQmail()
754
+ {
755
+ $ini_sendmail_path = ini_get('sendmail_path');
756
+
757
+ if (!stristr($ini_sendmail_path, 'qmail')) {
758
+ $this->Sendmail = '/var/qmail/bin/qmail-inject';
759
+ } else {
760
+ $this->Sendmail = $ini_sendmail_path;
761
+ }
762
+ $this->Mailer = 'qmail';
763
+ }
764
+
765
+ /**
766
+ * Add a "To" address.
767
+ * @param string $address
768
+ * @param string $name
769
+ * @return boolean true on success, false if address already used
770
+ */
771
+ public function addAddress($address, $name = '')
772
+ {
773
+ return $this->addAnAddress('to', $address, $name);
774
+ }
775
+
776
+ /**
777
+ * Add a "CC" address.
778
+ * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer.
779
+ * @param string $address
780
+ * @param string $name
781
+ * @return boolean true on success, false if address already used
782
+ */
783
+ public function addCC($address, $name = '')
784
+ {
785
+ return $this->addAnAddress('cc', $address, $name);
786
+ }
787
+
788
+ /**
789
+ * Add a "BCC" address.
790
+ * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer.
791
+ * @param string $address
792
+ * @param string $name
793
+ * @return boolean true on success, false if address already used
794
+ */
795
+ public function addBCC($address, $name = '')
796
+ {
797
+ return $this->addAnAddress('bcc', $address, $name);
798
+ }
799
+
800
+ /**
801
+ * Add a "Reply-to" address.
802
+ * @param string $address
803
+ * @param string $name
804
+ * @return boolean
805
+ */
806
+ public function addReplyTo($address, $name = '')
807
+ {
808
+ return $this->addAnAddress('Reply-To', $address, $name);
809
+ }
810
+
811
+ /**
812
+ * Add an address to one of the recipient arrays.
813
+ * Addresses that have been added already return false, but do not throw exceptions
814
+ * @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo'
815
+ * @param string $address The email address to send to
816
+ * @param string $name
817
+ * @throws phpmailerException
818
+ * @return boolean true on success, false if address already used or invalid in some way
819
+ * @access protected
820
+ */
821
+ protected function addAnAddress($kind, $address, $name = '')
822
+ {
823
+ if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) {
824
+ $this->setError($this->lang('Invalid recipient array') . ': ' . $kind);
825
+ $this->edebug($this->lang('Invalid recipient array') . ': ' . $kind);
826
+ if ($this->exceptions) {
827
+ throw new phpmailerException('Invalid recipient array: ' . $kind);
828
+ }
829
+ return false;
830
+ }
831
+ $address = trim($address);
832
+ $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
833
+ if (!$this->validateAddress($address)) {
834
+ $this->setError($this->lang('invalid_address') . ': ' . $address);
835
+ $this->edebug($this->lang('invalid_address') . ': ' . $address);
836
+ if ($this->exceptions) {
837
+ throw new phpmailerException($this->lang('invalid_address') . ': ' . $address);
838
+ }
839
+ return false;
840
+ }
841
+ if ($kind != 'Reply-To') {
842
+ if (!isset($this->all_recipients[strtolower($address)])) {
843
+ array_push($this->$kind, array($address, $name));
844
+ $this->all_recipients[strtolower($address)] = true;
845
+ return true;
846
+ }
847
+ } else {
848
+ if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
849
+ $this->ReplyTo[strtolower($address)] = array($address, $name);
850
+ return true;
851
+ }
852
+ }
853
+ return false;
854
+ }
855
+
856
+ /**
857
+ * Parse and validate a string containing one or more RFC822-style comma-separated email addresses
858
+ * of the form "display name <address>" into an array of name/address pairs.
859
+ * Uses the imap_rfc822_parse_adrlist function if the IMAP extension is available.
860
+ * Note that quotes in the name part are removed.
861
+ * @param string $addrstr The address list string
862
+ * @param bool $useimap Whether to use the IMAP extension to parse the list
863
+ * @return array
864
+ * @link http://www.andrew.cmu.edu/user/agreen1/testing/mrbs/web/Mail/RFC822.php A more careful implementation
865
+ */
866
+ public function parseAddresses($addrstr, $useimap = true)
867
+ {
868
+ $addresses = array();
869
+ if ($useimap and function_exists('imap_rfc822_parse_adrlist')) {
870
+ //Use this built-in parser if it's available
871
+ $list = imap_rfc822_parse_adrlist($addrstr, '');
872
+ foreach ($list as $address) {
873
+ if ($address->host != '.SYNTAX-ERROR.') {
874
+ if ($this->validateAddress($address->mailbox . '@' . $address->host)) {
875
+ $addresses[] = array(
876
+ 'name' => (property_exists($address, 'personal') ? $address->personal : ''),
877
+ 'address' => $address->mailbox . '@' . $address->host
878
+ );
879
+ }
880
+ }
881
+ }
882
+ } else {
883
+ //Use this simpler parser
884
+ $list = explode(',', $addrstr);
885
+ foreach ($list as $address) {
886
+ $address = trim($address);
887
+ //Is there a separate name part?
888
+ if (strpos($address, '<') === false) {
889
+ //No separate name, just use the whole thing
890
+ if ($this->validateAddress($address)) {
891
+ $addresses[] = array(
892
+ 'name' => '',
893
+ 'address' => $address
894
+ );
895
+ }
896
+ } else {
897
+ list($name, $email) = explode('<', $address);
898
+ $email = trim(str_replace('>', '', $email));
899
+ if ($this->validateAddress($email)) {
900
+ $addresses[] = array(
901
+ 'name' => trim(str_replace(array('"', "'"), '', $name)),
902
+ 'address' => $email
903
+ );
904
+ }
905
+ }
906
+ }
907
+ }
908
+ return $addresses;
909
+ }
910
+
911
+ /**
912
+ * Set the From and FromName properties.
913
+ * @param string $address
914
+ * @param string $name
915
+ * @param boolean $auto Whether to also set the Sender address, defaults to true
916
+ * @throws phpmailerException
917
+ * @return boolean
918
+ */
919
+ public function setFrom($address, $name = '', $auto = true)
920
+ {
921
+ $address = trim($address);
922
+ $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
923
+ if (!$this->validateAddress($address)) {
924
+ $this->setError($this->lang('invalid_address') . ': ' . $address);
925
+ $this->edebug($this->lang('invalid_address') . ': ' . $address);
926
+ if ($this->exceptions) {
927
+ throw new phpmailerException($this->lang('invalid_address') . ': ' . $address);
928
+ }
929
+ return false;
930
+ }
931
+ $this->From = $address;
932
+ $this->FromName = $name;
933
+ if ($auto) {
934
+ if (empty($this->Sender)) {
935
+ $this->Sender = $address;
936
+ }
937
+ }
938
+ return true;
939
+ }
940
+
941
+ /**
942
+ * Return the Message-ID header of the last email.
943
+ * Technically this is the value from the last time the headers were created,
944
+ * but it's also the message ID of the last sent message except in
945
+ * pathological cases.
946
+ * @return string
947
+ */
948
+ public function getLastMessageID()
949
+ {
950
+ return $this->lastMessageID;
951
+ }
952
+
953
+ /**
954
+ * Check that a string looks like an email address.
955
+ * @param string $address The email address to check
956
+ * @param string $patternselect A selector for the validation pattern to use :
957
+ * * `auto` Pick strictest one automatically;
958
+ * * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14;
959
+ * * `pcre` Use old PCRE implementation;
960
+ * * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; same as pcre8 but does not allow 'dotless' domains;
961
+ * * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements.
962
+ * * `noregex` Don't use a regex: super fast, really dumb.
963
+ * @return boolean
964
+ * @static
965
+ * @access public
966
+ */
967
+ public static function validateAddress($address, $patternselect = 'auto')
968
+ {
969
+ if (!$patternselect or $patternselect == 'auto') {
970
+ //Check this constant first so it works when extension_loaded() is disabled by safe mode
971
+ //Constant was added in PHP 5.2.4
972
+ if (defined('PCRE_VERSION')) {
973
+ //This pattern can get stuck in a recursive loop in PCRE <= 8.0.2
974
+ if (version_compare(PCRE_VERSION, '8.0.3') >= 0) {
975
+ $patternselect = 'pcre8';
976
+ } else {
977
+ $patternselect = 'pcre';
978
+ }
979
+ } elseif (function_exists('extension_loaded') and extension_loaded('pcre')) {
980
+ //Fall back to older PCRE
981
+ $patternselect = 'pcre';
982
+ } else {
983
+ //Filter_var appeared in PHP 5.2.0 and does not require the PCRE extension
984
+ if (version_compare(PHP_VERSION, '5.2.0') >= 0) {
985
+ $patternselect = 'php';
986
+ } else {
987
+ $patternselect = 'noregex';
988
+ }
989
+ }
990
+ }
991
+ switch ($patternselect) {
992
+ case 'pcre8':
993
+ /**
994
+ * Uses the same RFC5322 regex on which FILTER_VALIDATE_EMAIL is based, but allows dotless domains.
995
+ * @link http://squiloople.com/2009/12/20/email-address-validation/
996
+ * @copyright 2009-2010 Michael Rushton
997
+ * Feel free to use and redistribute this code. But please keep this copyright notice.
998
+ */
999
+ return (boolean)preg_match(
1000
+ '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' .
1001
+ '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' .
1002
+ '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' .
1003
+ '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' .
1004
+ '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' .
1005
+ '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' .
1006
+ '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' .
1007
+ '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
1008
+ '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD',
1009
+ $address
1010
+ );
1011
+ case 'pcre':
1012
+ //An older regex that doesn't need a recent PCRE
1013
+ return (boolean)preg_match(
1014
+ '/^(?!(?>"?(?>\\\[ -~]|[^"])"?){255,})(?!(?>"?(?>\\\[ -~]|[^"])"?){65,}@)(?>' .
1015
+ '[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*")' .
1016
+ '(?>\.(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*"))*' .
1017
+ '@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\.(?![a-z0-9-]{64,})' .
1018
+ '(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:' .
1019
+ '[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?' .
1020
+ '::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:' .
1021
+ '[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?' .
1022
+ '::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
1023
+ '|[1-9]?[0-9])(?>\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\])$/isD',
1024
+ $address
1025
+ );
1026
+ case 'html5':
1027
+ /**
1028
+ * This is the pattern used in the HTML5 spec for validation of 'email' type form input elements.
1029
+ * @link http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email)
1030
+ */
1031
+ return (boolean)preg_match(
1032
+ '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' .
1033
+ '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD',
1034
+ $address
1035
+ );
1036
+ case 'noregex':
1037
+ //No PCRE! Do something _very_ approximate!
1038
+ //Check the address is 3 chars or longer and contains an @ that's not the first or last char
1039
+ return (strlen($address) >= 3
1040
+ and strpos($address, '@') >= 1
1041
+ and strpos($address, '@') != strlen($address) - 1);
1042
+ case 'php':
1043
+ default:
1044
+ return (boolean)filter_var($address, FILTER_VALIDATE_EMAIL);
1045
+ }
1046
+ }
1047
+
1048
+ /**
1049
+ * Create a message and send it.
1050
+ * Uses the sending method specified by $Mailer.
1051
+ * @throws phpmailerException
1052
+ * @return boolean false on error - See the ErrorInfo property for details of the error.
1053
+ */
1054
+ public function send()
1055
+ {
1056
+ try {
1057
+ if (!$this->preSend()) {
1058
+ return false;
1059
+ }
1060
+ return $this->postSend();
1061
+ } catch (phpmailerException $exc) {
1062
+ $this->mailHeader = '';
1063
+ $this->setError($exc->getMessage());
1064
+ if ($this->exceptions) {
1065
+ throw $exc;
1066
+ }
1067
+ return false;
1068
+ }
1069
+ }
1070
+
1071
+ /**
1072
+ * Prepare a message for sending.
1073
+ * @throws phpmailerException
1074
+ * @return boolean
1075
+ */
1076
+ public function preSend()
1077
+ {
1078
+ try {
1079
+ $this->mailHeader = '';
1080
+ if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
1081
+ throw new phpmailerException($this->lang('provide_address'), self::STOP_CRITICAL);
1082
+ }
1083
+
1084
+ // Set whether the message is multipart/alternative
1085
+ if (!empty($this->AltBody)) {
1086
+ $this->ContentType = 'multipart/alternative';
1087
+ }
1088
+
1089
+ $this->error_count = 0; // Reset errors
1090
+ $this->setMessageType();
1091
+ // Refuse to send an empty message unless we are specifically allowing it
1092
+ if (!$this->AllowEmpty and empty($this->Body)) {
1093
+ throw new phpmailerException($this->lang('empty_message'), self::STOP_CRITICAL);
1094
+ }
1095
+
1096
+ // Create body before headers in case body makes changes to headers (e.g. altering transfer encoding)
1097
+ $this->MIMEHeader = '';
1098
+ $this->MIMEBody = $this->createBody();
1099
+ // createBody may have added some headers, so retain them
1100
+ $tempheaders = $this->MIMEHeader;
1101
+ $this->MIMEHeader = $this->createHeader();
1102
+ $this->MIMEHeader .= $tempheaders;
1103
+
1104
+ // To capture the complete message when using mail(), create
1105
+ // an extra header list which createHeader() doesn't fold in
1106
+ if ($this->Mailer == 'mail') {
1107
+ if (count($this->to) > 0) {
1108
+ $this->mailHeader .= $this->addrAppend('To', $this->to);
1109
+ } else {
1110
+ $this->mailHeader .= $this->headerLine('To', 'undisclosed-recipients:;');
1111
+ }
1112
+ $this->mailHeader .= $this->headerLine(
1113
+ 'Subject',
1114
+ $this->encodeHeader($this->secureHeader(trim($this->Subject)))
1115
+ );
1116
+ }
1117
+
1118
+ // Sign with DKIM if enabled
1119
+ if (!empty($this->DKIM_domain)
1120
+ && !empty($this->DKIM_private)
1121
+ && !empty($this->DKIM_selector)
1122
+ && file_exists($this->DKIM_private)) {
1123
+ $header_dkim = $this->DKIM_Add(
1124
+ $this->MIMEHeader . $this->mailHeader,
1125
+ $this->encodeHeader($this->secureHeader($this->Subject)),
1126
+ $this->MIMEBody
1127
+ );
1128
+ $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . self::CRLF .
1129
+ str_replace("\r\n", "\n", $header_dkim) . self::CRLF;
1130
+ }
1131
+ return true;
1132
+ } catch (phpmailerException $exc) {
1133
+ $this->setError($exc->getMessage());
1134
+ if ($this->exceptions) {
1135
+ throw $exc;
1136
+ }
1137
+ return false;
1138
+ }
1139
+ }
1140
+
1141
+ /**
1142
+ * Actually send a message.
1143
+ * Send the email via the selected mechanism
1144
+ * @throws phpmailerException
1145
+ * @return boolean
1146
+ */
1147
+ public function postSend()
1148
+ {
1149
+ try {
1150
+ // Choose the mailer and send through it
1151
+ switch ($this->Mailer) {
1152
+ case 'sendmail':
1153
+ case 'qmail':
1154
+ return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody);
1155
+ case 'smtp':
1156
+ return $this->smtpSend($this->MIMEHeader, $this->MIMEBody);
1157
+ case 'mail':
1158
+ return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
1159
+ default:
1160
+ $sendMethod = $this->Mailer.'Send';
1161
+ if (method_exists($this, $sendMethod)) {
1162
+ return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody);
1163
+ }
1164
+
1165
+ return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
1166
+ }
1167
+ } catch (phpmailerException $exc) {
1168
+ $this->setError($exc->getMessage());
1169
+ $this->edebug($exc->getMessage());
1170
+ if ($this->exceptions) {
1171
+ throw $exc;
1172
+ }
1173
+ }
1174
+ return false;
1175
+ }
1176
+
1177
+ /**
1178
+ * Send mail using the $Sendmail program.
1179
+ * @param string $header The message headers
1180
+ * @param string $body The message body
1181
+ * @see PHPMailer::$Sendmail
1182
+ * @throws phpmailerException
1183
+ * @access protected
1184
+ * @return boolean
1185
+ */
1186
+ protected function sendmailSend($header, $body)
1187
+ {
1188
+ if ($this->Sender != '') {
1189
+ if ($this->Mailer == 'qmail') {
1190
+ $sendmail = sprintf('%s -f%s', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
1191
+ } else {
1192
+ $sendmail = sprintf('%s -oi -f%s -t', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
1193
+ }
1194
+ } else {
1195
+ if ($this->Mailer == 'qmail') {
1196
+ $sendmail = sprintf('%s', escapeshellcmd($this->Sendmail));
1197
+ } else {
1198
+ $sendmail = sprintf('%s -oi -t', escapeshellcmd($this->Sendmail));
1199
+ }
1200
+ }
1201
+ if ($this->SingleTo) {
1202
+ foreach ($this->SingleToArray as $toAddr) {
1203
+ if (!@$mail = popen($sendmail, 'w')) {
1204
+ throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
1205
+ }
1206
+ fputs($mail, 'To: ' . $toAddr . "\n");
1207
+ fputs($mail, $header);
1208
+ fputs($mail, $body);
1209
+ $result = pclose($mail);
1210
+ $this->doCallback(
1211
+ ($result == 0),
1212
+ array($toAddr),
1213
+ $this->cc,
1214
+ $this->bcc,
1215
+ $this->Subject,
1216
+ $body,
1217
+ $this->From
1218
+ );
1219
+ if ($result != 0) {
1220
+ throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
1221
+ }
1222
+ }
1223
+ } else {
1224
+ if (!@$mail = popen($sendmail, 'w')) {
1225
+ throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
1226
+ }
1227
+ fputs($mail, $header);
1228
+ fputs($mail, $body);
1229
+ $result = pclose($mail);
1230
+ $this->doCallback(($result == 0), $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From);
1231
+ if ($result != 0) {
1232
+ throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
1233
+ }
1234
+ }
1235
+ return true;
1236
+ }
1237
+
1238
+ /**
1239
+ * Send mail using the PHP mail() function.
1240
+ * @param string $header The message headers
1241
+ * @param string $body The message body
1242
+ * @link http://www.php.net/manual/en/book.mail.php
1243
+ * @throws phpmailerException
1244
+ * @access protected
1245
+ * @return boolean
1246
+ */
1247
+ protected function mailSend($header, $body)
1248
+ {
1249
+ $toArr = array();
1250
+ foreach ($this->to as $toaddr) {
1251
+ $toArr[] = $this->addrFormat($toaddr);
1252
+ }
1253
+ $to = implode(', ', $toArr);
1254
+
1255
+ if (empty($this->Sender)) {
1256
+ $params = ' ';
1257
+ } else {
1258
+ $params = sprintf('-f%s', $this->Sender);
1259
+ }
1260
+ if ($this->Sender != '' and !ini_get('safe_mode')) {
1261
+ $old_from = ini_get('sendmail_from');
1262
+ ini_set('sendmail_from', $this->Sender);
1263
+ }
1264
+ $result = false;
1265
+ if ($this->SingleTo && count($toArr) > 1) {
1266
+ foreach ($toArr as $toAddr) {
1267
+ $result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params);
1268
+ $this->doCallback($result, array($toAddr), $this->cc, $this->bcc, $this->Subject, $body, $this->From);
1269
+ }
1270
+ } else {
1271
+ $result = $this->mailPassthru($to, $this->Subject, $body, $header, $params);
1272
+ $this->doCallback($result, $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From);
1273
+ }
1274
+ if (isset($old_from)) {
1275
+ ini_set('sendmail_from', $old_from);
1276
+ }
1277
+ if (!$result) {
1278
+ throw new phpmailerException($this->lang('instantiate'), self::STOP_CRITICAL);
1279
+ }
1280
+ return true;
1281
+ }
1282
+
1283
+ /**
1284
+ * Get an instance to use for SMTP operations.
1285
+ * Override this function to load your own SMTP implementation
1286
+ * @return SMTP
1287
+ */
1288
+ public function getSMTPInstance()
1289
+ {
1290
+ if (!is_object($this->smtp)) {
1291
+ $this->smtp = new SMTP;
1292
+ }
1293
+ return $this->smtp;
1294
+ }
1295
+
1296
+ /**
1297
+ * Send mail via SMTP.
1298
+ * Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
1299
+ * Uses the PHPMailerSMTP class by default.
1300
+ * @see PHPMailer::getSMTPInstance() to use a different class.
1301
+ * @param string $header The message headers
1302
+ * @param string $body The message body
1303
+ * @throws phpmailerException
1304
+ * @uses SMTP
1305
+ * @access protected
1306
+ * @return boolean
1307
+ */
1308
+ protected function smtpSend($header, $body)
1309
+ {
1310
+ $bad_rcpt = array();
1311
+ if (!$this->smtpConnect($this->SMTPOptions)) {
1312
+ throw new phpmailerException($this->lang('smtp_connect_failed'), self::STOP_CRITICAL);
1313
+ }
1314
+ if ('' == $this->Sender) {
1315
+ $smtp_from = $this->From;
1316
+ } else {
1317
+ $smtp_from = $this->Sender;
1318
+ }
1319
+ if (!$this->smtp->mail($smtp_from)) {
1320
+ $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError()));
1321
+ throw new phpmailerException($this->ErrorInfo, self::STOP_CRITICAL);
1322
+ }
1323
+
1324
+ // Attempt to send to all recipients
1325
+ foreach (array($this->to, $this->cc, $this->bcc) as $togroup) {
1326
+ foreach ($togroup as $to) {
1327
+ if (!$this->smtp->recipient($to[0])) {
1328
+ $error = $this->smtp->getError();
1329
+ $bad_rcpt[] = array('to' => $to[0], 'error' => $error['detail']);
1330
+ $isSent = false;
1331
+ } else {
1332
+ $isSent = true;
1333
+ }
1334
+ $this->doCallback($isSent, array($to[0]), array(), array(), $this->Subject, $body, $this->From);
1335
+ }
1336
+ }
1337
+
1338
+ // Only send the DATA command if we have viable recipients
1339
+ if ((count($this->all_recipients) > count($bad_rcpt)) and !$this->smtp->data($header . $body)) {
1340
+ throw new phpmailerException($this->lang('data_not_accepted'), self::STOP_CRITICAL);
1341
+ }
1342
+ if ($this->SMTPKeepAlive) {
1343
+ $this->smtp->reset();
1344
+ } else {
1345
+ $this->smtp->quit();
1346
+ $this->smtp->close();
1347
+ }
1348
+ //Create error message for any bad addresses
1349
+ if (count($bad_rcpt) > 0) {
1350
+ $errstr = '';
1351
+ foreach ($bad_rcpt as $bad) {
1352
+ $errstr .= $bad['to'] . ': ' . $bad['error'];
1353
+ }
1354
+ throw new phpmailerException(
1355
+ $this->lang('recipients_failed') . $errstr,
1356
+ self::STOP_CONTINUE
1357
+ );
1358
+ }
1359
+ return true;
1360
+ }
1361
+
1362
+ /**
1363
+ * Initiate a connection to an SMTP server.
1364
+ * Returns false if the operation failed.
1365
+ * @param array $options An array of options compatible with stream_context_create()
1366
+ * @uses SMTP
1367
+ * @access public
1368
+ * @throws phpmailerException
1369
+ * @return boolean
1370
+ */
1371
+ public function smtpConnect($options = array())
1372
+ {
1373
+ if (is_null($this->smtp)) {
1374
+ $this->smtp = $this->getSMTPInstance();
1375
+ }
1376
+
1377
+ // Already connected?
1378
+ if ($this->smtp->connected()) {
1379
+ return true;
1380
+ }
1381
+
1382
+ $this->smtp->setTimeout($this->Timeout);
1383
+ $this->smtp->setDebugLevel($this->SMTPDebug);
1384
+ $this->smtp->setDebugOutput($this->Debugoutput);
1385
+ $this->smtp->setVerp($this->do_verp);
1386
+ $hosts = explode(';', $this->Host);
1387
+ $lastexception = null;
1388
+
1389
+ foreach ($hosts as $hostentry) {
1390
+ $hostinfo = array();
1391
+ if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) {
1392
+ // Not a valid host entry
1393
+ continue;
1394
+ }
1395
+ // $hostinfo[2]: optional ssl or tls prefix
1396
+ // $hostinfo[3]: the hostname
1397
+ // $hostinfo[4]: optional port number
1398
+ // The host string prefix can temporarily override the current setting for SMTPSecure
1399
+ // If it's not specified, the default value is used
1400
+ $prefix = '';
1401
+ $secure = $this->SMTPSecure;
1402
+ $tls = ($this->SMTPSecure == 'tls');
1403
+ if ('ssl' == $hostinfo[2] or ('' == $hostinfo[2] and 'ssl' == $this->SMTPSecure)) {
1404
+ $prefix = 'ssl://';
1405
+ $tls = false; // Can't have SSL and TLS at the same time
1406
+ $secure = 'ssl';
1407
+ } elseif ($hostinfo[2] == 'tls') {
1408
+ $tls = true;
1409
+ // tls doesn't use a prefix
1410
+ $secure = 'tls';
1411
+ }
1412
+ //Do we need the OpenSSL extension?
1413
+ $sslext = defined('OPENSSL_ALGO_SHA1');
1414
+ if ('tls' === $secure or 'ssl' === $secure) {
1415
+ //Check for an OpenSSL constant rather than using extension_loaded, which is sometimes disabled
1416
+ if (!$sslext) {
1417
+ throw new phpmailerException($this->lang('extension_missing').'openssl', self::STOP_CRITICAL);
1418
+ }
1419
+ }
1420
+ $host = $hostinfo[3];
1421
+ $port = $this->Port;
1422
+ $tport = (integer)$hostinfo[4];
1423
+ if ($tport > 0 and $tport < 65536) {
1424
+ $port = $tport;
1425
+ }
1426
+ if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) {
1427
+ try {
1428
+ if ($this->Helo) {
1429
+ $hello = $this->Helo;
1430
+ } else {
1431
+ $hello = $this->serverHostname();
1432
+ }
1433
+ $this->smtp->hello($hello);
1434
+ //Automatically enable TLS encryption if:
1435
+ // * it's not disabled
1436
+ // * we have openssl extension
1437
+ // * we are not already using SSL
1438
+ // * the server offers STARTTLS
1439
+ if ($this->SMTPAutoTLS and $sslext and $secure != 'ssl' and $this->smtp->getServerExt('STARTTLS')) {
1440
+ $tls = true;
1441
+ }
1442
+ if ($tls) {
1443
+ if (!$this->smtp->startTLS()) {
1444
+ throw new phpmailerException($this->lang('connect_host'));
1445
+ }
1446
+ // We must resend HELO after tls negotiation
1447
+ $this->smtp->hello($hello);
1448
+ }
1449
+ if ($this->SMTPAuth) {
1450
+ if (!$this->smtp->authenticate(
1451
+ $this->Username,
1452
+ $this->Password,
1453
+ $this->AuthType,
1454
+ $this->Realm,
1455
+ $this->Workstation
1456
+ )
1457
+ ) {
1458
+ throw new phpmailerException($this->lang('authenticate'));
1459
+ }
1460
+ }
1461
+ return true;
1462
+ } catch (phpmailerException $exc) {
1463
+ $lastexception = $exc;
1464
+ $this->edebug($exc->getMessage());
1465
+ // We must have connected, but then failed TLS or Auth, so close connection nicely
1466
+ $this->smtp->quit();
1467
+ }
1468
+ }
1469
+ }
1470
+ // If we get here, all connection attempts have failed, so close connection hard
1471
+ $this->smtp->close();
1472
+ // As we've caught all exceptions, just report whatever the last one was
1473
+ if ($this->exceptions and !is_null($lastexception)) {
1474
+ throw $lastexception;
1475
+ }
1476
+ return false;
1477
+ }
1478
+
1479
+ /**
1480
+ * Close the active SMTP session if one exists.
1481
+ * @return void
1482
+ */
1483
+ public function smtpClose()
1484
+ {
1485
+ if ($this->smtp !== null) {
1486
+ if ($this->smtp->connected()) {
1487
+ $this->smtp->quit();
1488
+ $this->smtp->close();
1489
+ }
1490
+ }
1491
+ }
1492
+
1493
+ /**
1494
+ * Set the language for error messages.
1495
+ * Returns false if it cannot load the language file.
1496
+ * The default language is English.
1497
+ * @param string $langcode ISO 639-1 2-character language code (e.g. French is "fr")
1498
+ * @param string $lang_path Path to the language file directory, with trailing separator (slash)
1499
+ * @return boolean
1500
+ * @access public
1501
+ */
1502
+ public function setLanguage($langcode = 'en', $lang_path = '')
1503
+ {
1504
+ // Define full set of translatable strings in English
1505
+ $PHPMAILER_LANG = array(
1506
+ 'authenticate' => 'SMTP Error: Could not authenticate.',
1507
+ 'connect_host' => 'SMTP Error: Could not connect to SMTP host.',
1508
+ 'data_not_accepted' => 'SMTP Error: data not accepted.',
1509
+ 'empty_message' => 'Message body empty',
1510
+ 'encoding' => 'Unknown encoding: ',
1511
+ 'execute' => 'Could not execute: ',
1512
+ 'file_access' => 'Could not access file: ',
1513
+ 'file_open' => 'File Error: Could not open file: ',
1514
+ 'from_failed' => 'The following From address failed: ',
1515
+ 'instantiate' => 'Could not instantiate mail function.',
1516
+ 'invalid_address' => 'Invalid address',
1517
+ 'mailer_not_supported' => ' mailer is not supported.',
1518
+ 'provide_address' => 'You must provide at least one recipient email address.',
1519
+ 'recipients_failed' => 'SMTP Error: The following recipients failed: ',
1520
+ 'signing' => 'Signing Error: ',
1521
+ 'smtp_connect_failed' => 'SMTP connect() failed.',
1522
+ 'smtp_error' => 'SMTP server error: ',
1523
+ 'variable_set' => 'Cannot set or reset variable: ',
1524
+ 'extension_missing' => 'Extension missing: '
1525
+ );
1526
+ if (empty($lang_path)) {
1527
+ // Calculate an absolute path so it can work if CWD is not here
1528
+ $lang_path = dirname(__FILE__). DIRECTORY_SEPARATOR . 'language'. DIRECTORY_SEPARATOR;
1529
+ }
1530
+ $foundlang = true;
1531
+ $lang_file = $lang_path . 'phpmailer.lang-' . $langcode . '.php';
1532
+ // There is no English translation file
1533
+ if ($langcode != 'en') {
1534
+ // Make sure language file path is readable
1535
+ if (!is_readable($lang_file)) {
1536
+ $foundlang = false;
1537
+ } else {
1538
+ // Overwrite language-specific strings.
1539
+ // This way we'll never have missing translation keys.
1540
+ $foundlang = include $lang_file;
1541
+ }
1542
+ }
1543
+ $this->language = $PHPMAILER_LANG;
1544
+ return (boolean)$foundlang; // Returns false if language not found
1545
+ }
1546
+
1547
+ /**
1548
+ * Get the array of strings for the current language.
1549
+ * @return array
1550
+ */
1551
+ public function getTranslations()
1552
+ {
1553
+ return $this->language;
1554
+ }
1555
+
1556
+ /**
1557
+ * Create recipient headers.
1558
+ * @access public
1559
+ * @param string $type
1560
+ * @param array $addr An array of recipient,
1561
+ * where each recipient is a 2-element indexed array with element 0 containing an address
1562
+ * and element 1 containing a name, like:
1563
+ * array(array('joe@example.com', 'Joe User'), array('zoe@example.com', 'Zoe User'))
1564
+ * @return string
1565
+ */
1566
+ public function addrAppend($type, $addr)
1567
+ {
1568
+ $addresses = array();
1569
+ foreach ($addr as $address) {
1570
+ $addresses[] = $this->addrFormat($address);
1571
+ }
1572
+ return $type . ': ' . implode(', ', $addresses) . $this->LE;
1573
+ }
1574
+
1575
+ /**
1576
+ * Format an address for use in a message header.
1577
+ * @access public
1578
+ * @param array $addr A 2-element indexed array, element 0 containing an address, element 1 containing a name
1579
+ * like array('joe@example.com', 'Joe User')
1580
+ * @return string
1581
+ */
1582
+ public function addrFormat($addr)
1583
+ {
1584
+ if (empty($addr[1])) { // No name provided
1585
+ return $this->secureHeader($addr[0]);
1586
+ } else {
1587
+ return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase') . ' <' . $this->secureHeader(
1588
+ $addr[0]
1589
+ ) . '>';
1590
+ }
1591
+ }
1592
+
1593
+ /**
1594
+ * Word-wrap message.
1595
+ * For use with mailers that do not automatically perform wrapping
1596
+ * and for quoted-printable encoded messages.
1597
+ * Original written by philippe.
1598
+ * @param string $message The message to wrap
1599
+ * @param integer $length The line length to wrap to
1600
+ * @param boolean $qp_mode Whether to run in Quoted-Printable mode
1601
+ * @access public
1602
+ * @return string
1603
+ */
1604
+ public function wrapText($message, $length, $qp_mode = false)
1605
+ {
1606
+ if ($qp_mode) {
1607
+ $soft_break = sprintf(' =%s', $this->LE);
1608
+ } else {
1609
+ $soft_break = $this->LE;
1610
+ }
1611
+ // If utf-8 encoding is used, we will need to make sure we don't
1612
+ // split multibyte characters when we wrap
1613
+ $is_utf8 = (strtolower($this->CharSet) == 'utf-8');
1614
+ $lelen = strlen($this->LE);
1615
+ $crlflen = strlen(self::CRLF);
1616
+
1617
+ $message = $this->fixEOL($message);
1618
+ //Remove a trailing line break
1619
+ if (substr($message, -$lelen) == $this->LE) {
1620
+ $message = substr($message, 0, -$lelen);
1621
+ }
1622
+
1623
+ //Split message into lines
1624
+ $lines = explode($this->LE, $message);
1625
+ //Message will be rebuilt in here
1626
+ $message = '';
1627
+ foreach ($lines as $line) {
1628
+ $words = explode(' ', $line);
1629
+ $buf = '';
1630
+ $firstword = true;
1631
+ foreach ($words as $word) {
1632
+ if ($qp_mode and (strlen($word) > $length)) {
1633
+ $space_left = $length - strlen($buf) - $crlflen;
1634
+ if (!$firstword) {
1635
+ if ($space_left > 20) {
1636
+ $len = $space_left;
1637
+ if ($is_utf8) {
1638
+ $len = $this->utf8CharBoundary($word, $len);
1639
+ } elseif (substr($word, $len - 1, 1) == '=') {
1640
+ $len--;
1641
+ } elseif (substr($word, $len - 2, 1) == '=') {
1642
+ $len -= 2;
1643
+ }
1644
+ $part = substr($word, 0, $len);
1645
+ $word = substr($word, $len);
1646
+ $buf .= ' ' . $part;
1647
+ $message .= $buf . sprintf('=%s', self::CRLF);
1648
+ } else {
1649
+ $message .= $buf . $soft_break;
1650
+ }
1651
+ $buf = '';
1652
+ }
1653
+ while (strlen($word) > 0) {
1654
+ if ($length <= 0) {
1655
+ break;
1656
+ }
1657
+ $len = $length;
1658
+ if ($is_utf8) {
1659
+ $len = $this->utf8CharBoundary($word, $len);
1660
+ } elseif (substr($word, $len - 1, 1) == '=') {
1661
+ $len--;
1662
+ } elseif (substr($word, $len - 2, 1) == '=') {
1663
+ $len -= 2;
1664
+ }
1665
+ $part = substr($word, 0, $len);
1666
+ $word = substr($word, $len);
1667
+
1668
+ if (strlen($word) > 0) {
1669
+ $message .= $part . sprintf('=%s', self::CRLF);
1670
+ } else {
1671
+ $buf = $part;
1672
+ }
1673
+ }
1674
+ } else {
1675
+ $buf_o = $buf;
1676
+ if (!$firstword) {
1677
+ $buf .= ' ';
1678
+ }
1679
+ $buf .= $word;
1680
+
1681
+ if (strlen($buf) > $length and $buf_o != '') {
1682
+ $message .= $buf_o . $soft_break;
1683
+ $buf = $word;
1684
+ }
1685
+ }
1686
+ $firstword = false;
1687
+ }
1688
+ $message .= $buf . self::CRLF;
1689
+ }
1690
+
1691
+ return $message;
1692
+ }
1693
+
1694
+ /**
1695
+ * Find the last character boundary prior to $maxLength in a utf-8
1696
+ * quoted-printable encoded string.
1697
+ * Original written by Colin Brown.
1698
+ * @access public
1699
+ * @param string $encodedText utf-8 QP text
1700
+ * @param integer $maxLength Find the last character boundary prior to this length
1701
+ * @return integer
1702
+ */
1703
+ public function utf8CharBoundary($encodedText, $maxLength)
1704
+ {
1705
+ $foundSplitPos = false;
1706
+ $lookBack = 3;
1707
+ while (!$foundSplitPos) {
1708
+ $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
1709
+ $encodedCharPos = strpos($lastChunk, '=');
1710
+ if (false !== $encodedCharPos) {
1711
+ // Found start of encoded character byte within $lookBack block.
1712
+ // Check the encoded byte value (the 2 chars after the '=')
1713
+ $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
1714
+ $dec = hexdec($hex);
1715
+ if ($dec < 128) {
1716
+ // Single byte character.
1717
+ // If the encoded char was found at pos 0, it will fit
1718
+ // otherwise reduce maxLength to start of the encoded char
1719
+ if ($encodedCharPos > 0) {
1720
+ $maxLength = $maxLength - ($lookBack - $encodedCharPos);
1721
+ }
1722
+ $foundSplitPos = true;
1723
+ } elseif ($dec >= 192) {
1724
+ // First byte of a multi byte character
1725
+ // Reduce maxLength to split at start of character
1726
+ $maxLength = $maxLength - ($lookBack - $encodedCharPos);
1727
+ $foundSplitPos = true;
1728
+ } elseif ($dec < 192) {
1729
+ // Middle byte of a multi byte character, look further back
1730
+ $lookBack += 3;
1731
+ }
1732
+ } else {
1733
+ // No encoded character found
1734
+ $foundSplitPos = true;
1735
+ }
1736
+ }
1737
+ return $maxLength;
1738
+ }
1739
+
1740
+ /**
1741
+ * Apply word wrapping to the message body.
1742
+ * Wraps the message body to the number of chars set in the WordWrap property.
1743
+ * You should only do this to plain-text bodies as wrapping HTML tags may break them.
1744
+ * This is called automatically by createBody(), so you don't need to call it yourself.
1745
+ * @access public
1746
+ * @return void
1747
+ */
1748
+ public function setWordWrap()
1749
+ {
1750
+ if ($this->WordWrap < 1) {
1751
+ return;
1752
+ }
1753
+
1754
+ switch ($this->message_type) {
1755
+ case 'alt':
1756
+ case 'alt_inline':
1757
+ case 'alt_attach':
1758
+ case 'alt_inline_attach':
1759
+ $this->AltBody = $this->wrapText($this->AltBody, $this->WordWrap);
1760
+ break;
1761
+ default:
1762
+ $this->Body = $this->wrapText($this->Body, $this->WordWrap);
1763
+ break;
1764
+ }
1765
+ }
1766
+
1767
+ /**
1768
+ * Assemble message headers.
1769
+ * @access public
1770
+ * @return string The assembled headers
1771
+ */
1772
+ public function createHeader()
1773
+ {
1774
+ $result = '';
1775
+
1776
+ if ($this->MessageDate == '') {
1777
+ $this->MessageDate = self::rfcDate();
1778
+ }
1779
+ $result .= $this->headerLine('Date', $this->MessageDate);
1780
+
1781
+
1782
+ // To be created automatically by mail()
1783
+ if ($this->SingleTo) {
1784
+ if ($this->Mailer != 'mail') {
1785
+ foreach ($this->to as $toaddr) {
1786
+ $this->SingleToArray[] = $this->addrFormat($toaddr);
1787
+ }
1788
+ }
1789
+ } else {
1790
+ if (count($this->to) > 0) {
1791
+ if ($this->Mailer != 'mail') {
1792
+ $result .= $this->addrAppend('To', $this->to);
1793
+ }
1794
+ } elseif (count($this->cc) == 0) {
1795
+ $result .= $this->headerLine('To', 'undisclosed-recipients:;');
1796
+ }
1797
+ }
1798
+
1799
+ $result .= $this->addrAppend('From', array(array(trim($this->From), $this->FromName)));
1800
+
1801
+ // sendmail and mail() extract Cc from the header before sending
1802
+ if (count($this->cc) > 0) {
1803
+ $result .= $this->addrAppend('Cc', $this->cc);
1804
+ }
1805
+
1806
+ // sendmail and mail() extract Bcc from the header before sending
1807
+ if ((
1808
+ $this->Mailer == 'sendmail' or $this->Mailer == 'qmail' or $this->Mailer == 'mail'
1809
+ )
1810
+ and count($this->bcc) > 0
1811
+ ) {
1812
+ $result .= $this->addrAppend('Bcc', $this->bcc);
1813
+ }
1814
+
1815
+ if (count($this->ReplyTo) > 0) {
1816
+ $result .= $this->addrAppend('Reply-To', $this->ReplyTo);
1817
+ }
1818
+
1819
+ // mail() sets the subject itself
1820
+ if ($this->Mailer != 'mail') {
1821
+ $result .= $this->headerLine('Subject', $this->encodeHeader($this->secureHeader($this->Subject)));
1822
+ }
1823
+
1824
+ if ($this->MessageID != '') {
1825
+ $this->lastMessageID = $this->MessageID;
1826
+ } else {
1827
+ $this->lastMessageID = sprintf('<%s@%s>', $this->uniqueid, $this->ServerHostname());
1828
+ }
1829
+ $result .= $this->headerLine('Message-ID', $this->lastMessageID);
1830
+ if (!is_null($this->Priority)) {
1831
+ $result .= $this->headerLine('X-Priority', $this->Priority);
1832
+ }
1833
+ if ($this->XMailer == '') {
1834
+ $result .= $this->headerLine(
1835
+ 'X-Mailer',
1836
+ 'PHPMailer ' . $this->Version . ' (https://github.com/PHPMailer/PHPMailer/)'
1837
+ );
1838
+ } else {
1839
+ $myXmailer = trim($this->XMailer);
1840
+ if ($myXmailer) {
1841
+ $result .= $this->headerLine('X-Mailer', $myXmailer);
1842
+ }
1843
+ }
1844
+
1845
+ if ($this->ConfirmReadingTo != '') {
1846
+ $result .= $this->headerLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
1847
+ }
1848
+
1849
+ // Add custom headers
1850
+ foreach ($this->CustomHeader as $header) {
1851
+ $result .= $this->headerLine(
1852
+ trim($header[0]),
1853
+ $this->encodeHeader(trim($header[1]))
1854
+ );
1855
+ }
1856
+ if (!$this->sign_key_file) {
1857
+ $result .= $this->headerLine('MIME-Version', '1.0');
1858
+ $result .= $this->getMailMIME();
1859
+ }
1860
+
1861
+ return $result;
1862
+ }
1863
+
1864
+ /**
1865
+ * Get the message MIME type headers.
1866
+ * @access public
1867
+ * @return string
1868
+ */
1869
+ public function getMailMIME()
1870
+ {
1871
+ $result = '';
1872
+ $ismultipart = true;
1873
+ switch ($this->message_type) {
1874
+ case 'inline':
1875
+ $result .= $this->headerLine('Content-Type', 'multipart/related;');
1876
+ $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
1877
+ break;
1878
+ case 'attach':
1879
+ case 'inline_attach':
1880
+ case 'alt_attach':
1881
+ case 'alt_inline_attach':
1882
+ $result .= $this->headerLine('Content-Type', 'multipart/mixed;');
1883
+ $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
1884
+ break;
1885
+ case 'alt':
1886
+ case 'alt_inline':
1887
+ $result .= $this->headerLine('Content-Type', 'multipart/alternative;');
1888
+ $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
1889
+ break;
1890
+ default:
1891
+ // Catches case 'plain': and case '':
1892
+ $result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet);
1893
+ $ismultipart = false;
1894
+ break;
1895
+ }
1896
+ // RFC1341 part 5 says 7bit is assumed if not specified
1897
+ if ($this->Encoding != '7bit') {
1898
+ // RFC 2045 section 6.4 says multipart MIME parts may only use 7bit, 8bit or binary CTE
1899
+ if ($ismultipart) {
1900
+ if ($this->Encoding == '8bit') {
1901
+ $result .= $this->headerLine('Content-Transfer-Encoding', '8bit');
1902
+ }
1903
+ // The only remaining alternatives are quoted-printable and base64, which are both 7bit compatible
1904
+ } else {
1905
+ $result .= $this->headerLine('Content-Transfer-Encoding', $this->Encoding);
1906
+ }
1907
+ }
1908
+
1909
+ if ($this->Mailer != 'mail') {
1910
+ $result .= $this->LE;
1911
+ }
1912
+
1913
+ return $result;
1914
+ }
1915
+
1916
+ /**
1917
+ * Returns the whole MIME message.
1918
+ * Includes complete headers and body.
1919
+ * Only valid post preSend().
1920
+ * @see PHPMailer::preSend()
1921
+ * @access public
1922
+ * @return string
1923
+ */
1924
+ public function getSentMIMEMessage()
1925
+ {
1926
+ return $this->MIMEHeader . $this->mailHeader . self::CRLF . $this->MIMEBody;
1927
+ }
1928
+
1929
+ /**
1930
+ * Assemble the message body.
1931
+ * Returns an empty string on failure.
1932
+ * @access public
1933
+ * @throws phpmailerException
1934
+ * @return string The assembled message body
1935
+ */
1936
+ public function createBody()
1937
+ {
1938
+ $body = '';
1939
+ //Create unique IDs and preset boundaries
1940
+ $this->uniqueid = md5(uniqid(time()));
1941
+ $this->boundary[1] = 'b1_' . $this->uniqueid;
1942
+ $this->boundary[2] = 'b2_' . $this->uniqueid;
1943
+ $this->boundary[3] = 'b3_' . $this->uniqueid;
1944
+
1945
+ if ($this->sign_key_file) {
1946
+ $body .= $this->getMailMIME() . $this->LE;
1947
+ }
1948
+
1949
+ $this->setWordWrap();
1950
+
1951
+ $bodyEncoding = $this->Encoding;
1952
+ $bodyCharSet = $this->CharSet;
1953
+ //Can we do a 7-bit downgrade?
1954
+ if ($bodyEncoding == '8bit' and !$this->has8bitChars($this->Body)) {
1955
+ $bodyEncoding = '7bit';
1956
+ $bodyCharSet = 'us-ascii';
1957
+ }
1958
+ //If lines are too long, and we're not already using an encoding that will shorten them,
1959
+ //change to quoted-printable transfer encoding
1960
+ if ('base64' != $this->Encoding and self::hasLineLongerThanMax($this->Body)) {
1961
+ $this->Encoding = 'quoted-printable';
1962
+ $bodyEncoding = 'quoted-printable';
1963
+ }
1964
+
1965
+ $altBodyEncoding = $this->Encoding;
1966
+ $altBodyCharSet = $this->CharSet;
1967
+ //Can we do a 7-bit downgrade?
1968
+ if ($altBodyEncoding == '8bit' and !$this->has8bitChars($this->AltBody)) {
1969
+ $altBodyEncoding = '7bit';
1970
+ $altBodyCharSet = 'us-ascii';
1971
+ }
1972
+ //If lines are too long, change to quoted-printable transfer encoding
1973
+ if (self::hasLineLongerThanMax($this->AltBody)) {
1974
+ $altBodyEncoding = 'quoted-printable';
1975
+ }
1976
+ //Use this as a preamble in all multipart message types
1977
+ $mimepre = "This is a multi-part message in MIME format." . $this->LE . $this->LE;
1978
+ switch ($this->message_type) {
1979
+ case 'inline':
1980
+ $body .= $mimepre;
1981
+ $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
1982
+ $body .= $this->encodeString($this->Body, $bodyEncoding);
1983
+ $body .= $this->LE . $this->LE;
1984
+ $body .= $this->attachAll('inline', $this->boundary[1]);
1985
+ break;
1986
+ case 'attach':
1987
+ $body .= $mimepre;
1988
+ $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
1989
+ $body .= $this->encodeString($this->Body, $bodyEncoding);
1990
+ $body .= $this->LE . $this->LE;
1991
+ $body .= $this->attachAll('attachment', $this->boundary[1]);
1992
+ break;
1993
+ case 'inline_attach':
1994
+ $body .= $mimepre;
1995
+ $body .= $this->textLine('--' . $this->boundary[1]);
1996
+ $body .= $this->headerLine('Content-Type', 'multipart/related;');
1997
+ $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
1998
+ $body .= $this->LE;
1999
+ $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding);
2000
+ $body .= $this->encodeString($this->Body, $bodyEncoding);
2001
+ $body .= $this->LE . $this->LE;
2002
+ $body .= $this->attachAll('inline', $this->boundary[2]);
2003
+ $body .= $this->LE;
2004
+ $body .= $this->attachAll('attachment', $this->boundary[1]);
2005
+ break;
2006
+ case 'alt':
2007
+ $body .= $mimepre;
2008
+ $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding);
2009
+ $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
2010
+ $body .= $this->LE . $this->LE;
2011
+ $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, 'text/html', $bodyEncoding);
2012
+ $body .= $this->encodeString($this->Body, $bodyEncoding);
2013
+ $body .= $this->LE . $this->LE;
2014
+ if (!empty($this->Ical)) {
2015
+ $body .= $this->getBoundary($this->boundary[1], '', 'text/calendar; method=REQUEST', '');
2016
+ $body .= $this->encodeString($this->Ical, $this->Encoding);
2017
+ $body .= $this->LE . $this->LE;
2018
+ }
2019
+ $body .= $this->endBoundary($this->boundary[1]);
2020
+ break;
2021
+ case 'alt_inline':
2022
+ $body .= $mimepre;
2023
+ $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding);
2024
+ $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
2025
+ $body .= $this->LE . $this->LE;
2026
+ $body .= $this->textLine('--' . $this->boundary[1]);
2027
+ $body .= $this->headerLine('Content-Type', 'multipart/related;');
2028
+ $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
2029
+ $body .= $this->LE;
2030
+ $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding);
2031
+ $body .= $this->encodeString($this->Body, $bodyEncoding);
2032
+ $body .= $this->LE . $this->LE;
2033
+ $body .= $this->attachAll('inline', $this->boundary[2]);
2034
+ $body .= $this->LE;
2035
+ $body .= $this->endBoundary($this->boundary[1]);
2036
+ break;
2037
+ case 'alt_attach':
2038
+ $body .= $mimepre;
2039
+ $body .= $this->textLine('--' . $this->boundary[1]);
2040
+ $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
2041
+ $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
2042
+ $body .= $this->LE;
2043
+ $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
2044
+ $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
2045
+ $body .= $this->LE . $this->LE;
2046
+ $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding);
2047
+ $body .= $this->encodeString($this->Body, $bodyEncoding);
2048
+ $body .= $this->LE . $this->LE;
2049
+ $body .= $this->endBoundary($this->boundary[2]);
2050
+ $body .= $this->LE;
2051
+ $body .= $this->attachAll('attachment', $this->boundary[1]);
2052
+ break;
2053
+ case 'alt_inline_attach':
2054
+ $body .= $mimepre;
2055
+ $body .= $this->textLine('--' . $this->boundary[1]);
2056
+ $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
2057
+ $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
2058
+ $body .= $this->LE;
2059
+ $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
2060
+ $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
2061
+ $body .= $this->LE . $this->LE;
2062
+ $body .= $this->textLine('--' . $this->boundary[2]);
2063
+ $body .= $this->headerLine('Content-Type', 'multipart/related;');
2064
+ $body .= $this->textLine("\tboundary=\"" . $this->boundary[3] . '"');
2065
+ $body .= $this->LE;
2066
+ $body .= $this->getBoundary($this->boundary[3], $bodyCharSet, 'text/html', $bodyEncoding);
2067
+ $body .= $this->encodeString($this->Body, $bodyEncoding);
2068
+ $body .= $this->LE . $this->LE;
2069
+ $body .= $this->attachAll('inline', $this->boundary[3]);
2070
+ $body .= $this->LE;
2071
+ $body .= $this->endBoundary($this->boundary[2]);
2072
+ $body .= $this->LE;
2073
+ $body .= $this->attachAll('attachment', $this->boundary[1]);
2074
+ break;
2075
+ default:
2076
+ // catch case 'plain' and case ''
2077
+ $body .= $this->encodeString($this->Body, $bodyEncoding);
2078
+ break;
2079
+ }
2080
+
2081
+ if ($this->isError()) {
2082
+ $body = '';
2083
+ } elseif ($this->sign_key_file) {
2084
+ try {
2085
+ if (!defined('PKCS7_TEXT')) {
2086
+ throw new phpmailerException($this->lang('extension_missing') . 'openssl');
2087
+ }
2088
+ // @TODO would be nice to use php://temp streams here, but need to wrap for PHP < 5.1
2089
+ $file = tempnam(sys_get_temp_dir(), 'mail');
2090
+ if (false === file_put_contents($file, $body)) {
2091
+ throw new phpmailerException($this->lang('signing') . ' Could not write temp file');
2092
+ }
2093
+ $signed = tempnam(sys_get_temp_dir(), 'signed');
2094
+ //Workaround for PHP bug https://bugs.php.net/bug.php?id=69197
2095
+ if (empty($this->sign_extracerts_file)) {
2096
+ $sign = @openssl_pkcs7_sign(
2097
+ $file,
2098
+ $signed,
2099
+ 'file://' . realpath($this->sign_cert_file),
2100
+ array('file://' . realpath($this->sign_key_file), $this->sign_key_pass),
2101
+ null
2102
+ );
2103
+ } else {
2104
+ $sign = @openssl_pkcs7_sign(
2105
+ $file,
2106
+ $signed,
2107
+ 'file://' . realpath($this->sign_cert_file),
2108
+ array('file://' . realpath($this->sign_key_file), $this->sign_key_pass),
2109
+ null,
2110
+ PKCS7_DETACHED,
2111
+ $this->sign_extracerts_file
2112
+ );
2113
+ }
2114
+ if ($sign) {
2115
+ @unlink($file);
2116
+ $body = file_get_contents($signed);
2117
+ @unlink($signed);
2118
+ //The message returned by openssl contains both headers and body, so need to split them up
2119
+ $parts = explode("\n\n", $body, 2);
2120
+ $this->MIMEHeader .= $parts[0] . $this->LE . $this->LE;
2121
+ $body = $parts[1];
2122
+ } else {
2123
+ @unlink($file);
2124
+ @unlink($signed);
2125
+ throw new phpmailerException($this->lang('signing') . openssl_error_string());
2126
+ }
2127
+ } catch (phpmailerException $exc) {
2128
+ $body = '';
2129
+ if ($this->exceptions) {
2130
+ throw $exc;
2131
+ }
2132
+ }
2133
+ }
2134
+ return $body;
2135
+ }
2136
+
2137
+ /**
2138
+ * Return the start of a message boundary.
2139
+ * @access protected
2140
+ * @param string $boundary
2141
+ * @param string $charSet
2142
+ * @param string $contentType
2143
+ * @param string $encoding
2144
+ * @return string
2145
+ */
2146
+ protected function getBoundary($boundary, $charSet, $contentType, $encoding)
2147
+ {
2148
+ $result = '';
2149
+ if ($charSet == '') {
2150
+ $charSet = $this->CharSet;
2151
+ }
2152
+ if ($contentType == '') {
2153
+ $contentType = $this->ContentType;
2154
+ }
2155
+ if ($encoding == '') {
2156
+ $encoding = $this->Encoding;
2157
+ }
2158
+ $result .= $this->textLine('--' . $boundary);
2159
+ $result .= sprintf('Content-Type: %s; charset=%s', $contentType, $charSet);
2160
+ $result .= $this->LE;
2161
+ // RFC1341 part 5 says 7bit is assumed if not specified
2162
+ if ($encoding != '7bit') {
2163
+ $result .= $this->headerLine('Content-Transfer-Encoding', $encoding);
2164
+ }
2165
+ $result .= $this->LE;
2166
+
2167
+ return $result;
2168
+ }
2169
+
2170
+ /**
2171
+ * Return the end of a message boundary.
2172
+ * @access protected
2173
+ * @param string $boundary
2174
+ * @return string
2175
+ */
2176
+ protected function endBoundary($boundary)
2177
+ {
2178
+ return $this->LE . '--' . $boundary . '--' . $this->LE;
2179
+ }
2180
+
2181
+ /**
2182
+ * Set the message type.
2183
+ * PHPMailer only supports some preset message types,
2184
+ * not arbitrary MIME structures.
2185
+ * @access protected
2186
+ * @return void
2187
+ */
2188
+ protected function setMessageType()
2189
+ {
2190
+ $type = array();
2191
+ if ($this->alternativeExists()) {
2192
+ $type[] = 'alt';
2193
+ }
2194
+ if ($this->inlineImageExists()) {
2195
+ $type[] = 'inline';
2196
+ }
2197
+ if ($this->attachmentExists()) {
2198
+ $type[] = 'attach';
2199
+ }
2200
+ $this->message_type = implode('_', $type);
2201
+ if ($this->message_type == '') {
2202
+ $this->message_type = 'plain';
2203
+ }
2204
+ }
2205
+
2206
+ /**
2207
+ * Format a header line.
2208
+ * @access public
2209
+ * @param string $name
2210
+ * @param string $value
2211
+ * @return string
2212
+ */
2213
+ public function headerLine($name, $value)
2214
+ {
2215
+ return $name . ': ' . $value . $this->LE;
2216
+ }
2217
+
2218
+ /**
2219
+ * Return a formatted mail line.
2220
+ * @access public
2221
+ * @param string $value
2222
+ * @return string
2223
+ */
2224
+ public function textLine($value)
2225
+ {
2226
+ return $value . $this->LE;
2227
+ }
2228
+
2229
+ /**
2230
+ * Add an attachment from a path on the filesystem.
2231
+ * Returns false if the file could not be found or read.
2232
+ * @param string $path Path to the attachment.
2233
+ * @param string $name Overrides the attachment name.
2234
+ * @param string $encoding File encoding (see $Encoding).
2235
+ * @param string $type File extension (MIME) type.
2236
+ * @param string $disposition Disposition to use
2237
+ * @throws phpmailerException
2238
+ * @return boolean
2239
+ */
2240
+ public function addAttachment($path, $name = '', $encoding = 'base64', $type = '', $disposition = 'attachment')
2241
+ {
2242
+ try {
2243
+ if (!@is_file($path)) {
2244
+ throw new phpmailerException($this->lang('file_access') . $path, self::STOP_CONTINUE);
2245
+ }
2246
+
2247
+ // If a MIME type is not specified, try to work it out from the file name
2248
+ if ($type == '') {
2249
+ $type = self::filenameToType($path);
2250
+ }
2251
+
2252
+ $filename = basename($path);
2253
+ if ($name == '') {
2254
+ $name = $filename;
2255
+ }
2256
+
2257
+ $this->attachment[] = array(
2258
+ 0 => $path,
2259
+ 1 => $filename,
2260
+ 2 => $name,
2261
+ 3 => $encoding,
2262
+ 4 => $type,
2263
+ 5 => false, // isStringAttachment
2264
+ 6 => $disposition,
2265
+ 7 => 0
2266
+ );
2267
+
2268
+ } catch (phpmailerException $exc) {
2269
+ $this->setError($exc->getMessage());
2270
+ $this->edebug($exc->getMessage());
2271
+ if ($this->exceptions) {
2272
+ throw $exc;
2273
+ }
2274
+ return false;
2275
+ }
2276
+ return true;
2277
+ }
2278
+
2279
+ /**
2280
+ * Return the array of attachments.
2281
+ * @return array
2282
+ */
2283
+ public function getAttachments()
2284
+ {
2285
+ return $this->attachment;
2286
+ }
2287
+
2288
+ /**
2289
+ * Attach all file, string, and binary attachments to the message.
2290
+ * Returns an empty string on failure.
2291
+ * @access protected
2292
+ * @param string $disposition_type
2293
+ * @param string $boundary
2294
+ * @return string
2295
+ */
2296
+ protected function attachAll($disposition_type, $boundary)
2297
+ {
2298
+ // Return text of body
2299
+ $mime = array();
2300
+ $cidUniq = array();
2301
+ $incl = array();
2302
+
2303
+ // Add all attachments
2304
+ foreach ($this->attachment as $attachment) {
2305
+ // Check if it is a valid disposition_filter
2306
+ if ($attachment[6] == $disposition_type) {
2307
+ // Check for string attachment
2308
+ $string = '';
2309
+ $path = '';
2310
+ $bString = $attachment[5];
2311
+ if ($bString) {
2312
+ $string = $attachment[0];
2313
+ } else {
2314
+ $path = $attachment[0];
2315
+ }
2316
+
2317
+ $inclhash = md5(serialize($attachment));
2318
+ if (in_array($inclhash, $incl)) {
2319
+ continue;
2320
+ }
2321
+ $incl[] = $inclhash;
2322
+ $name = $attachment[2];
2323
+ $encoding = $attachment[3];
2324
+ $type = $attachment[4];
2325
+ $disposition = $attachment[6];
2326
+ $cid = $attachment[7];
2327
+ if ($disposition == 'inline' && isset($cidUniq[$cid])) {
2328
+ continue;
2329
+ }
2330
+ $cidUniq[$cid] = true;
2331
+
2332
+ $mime[] = sprintf('--%s%s', $boundary, $this->LE);
2333
+ $mime[] = sprintf(
2334
+ 'Content-Type: %s; name="%s"%s',
2335
+ $type,
2336
+ $this->encodeHeader($this->secureHeader($name)),
2337
+ $this->LE
2338
+ );
2339
+ // RFC1341 part 5 says 7bit is assumed if not specified
2340
+ if ($encoding != '7bit') {
2341
+ $mime[] = sprintf('Content-Transfer-Encoding: %s%s', $encoding, $this->LE);
2342
+ }
2343
+
2344
+ if ($disposition == 'inline') {
2345
+ $mime[] = sprintf('Content-ID: <%s>%s', $cid, $this->LE);
2346
+ }
2347
+
2348
+ // If a filename contains any of these chars, it should be quoted,
2349
+ // but not otherwise: RFC2183 & RFC2045 5.1
2350
+ // Fixes a warning in IETF's msglint MIME checker
2351
+ // Allow for bypassing the Content-Disposition header totally
2352
+ if (!(empty($disposition))) {
2353
+ $encoded_name = $this->encodeHeader($this->secureHeader($name));
2354
+ if (preg_match('/[ \(\)<>@,;:\\"\/\[\]\?=]/', $encoded_name)) {
2355
+ $mime[] = sprintf(
2356
+ 'Content-Disposition: %s; filename="%s"%s',
2357
+ $disposition,
2358
+ $encoded_name,
2359
+ $this->LE . $this->LE
2360
+ );
2361
+ } else {
2362
+ $mime[] = sprintf(
2363
+ 'Content-Disposition: %s; filename=%s%s',
2364
+ $disposition,
2365
+ $encoded_name,
2366
+ $this->LE . $this->LE
2367
+ );
2368
+ }
2369
+ } else {
2370
+ $mime[] = $this->LE;
2371
+ }
2372
+
2373
+ // Encode as string attachment
2374
+ if ($bString) {
2375
+ $mime[] = $this->encodeString($string, $encoding);
2376
+ if ($this->isError()) {
2377
+ return '';
2378
+ }
2379
+ $mime[] = $this->LE . $this->LE;
2380
+ } else {
2381
+ $mime[] = $this->encodeFile($path, $encoding);
2382
+ if ($this->isError()) {
2383
+ return '';
2384
+ }
2385
+ $mime[] = $this->LE . $this->LE;
2386
+ }
2387
+ }
2388
+ }
2389
+
2390
+ $mime[] = sprintf('--%s--%s', $boundary, $this->LE);
2391
+
2392
+ return implode('', $mime);
2393
+ }
2394
+
2395
+ /**
2396
+ * Encode a file attachment in requested format.
2397
+ * Returns an empty string on failure.
2398
+ * @param string $path The full path to the file
2399
+ * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
2400
+ * @throws phpmailerException
2401
+ * @see EncodeFile(encodeFile
2402
+ * @access protected
2403
+ * @return string
2404
+ */
2405
+ protected function encodeFile($path, $encoding = 'base64')
2406
+ {
2407
+ try {
2408
+ if (!is_readable($path)) {
2409
+ throw new phpmailerException($this->lang('file_open') . $path, self::STOP_CONTINUE);
2410
+ }
2411
+ $magic_quotes = get_magic_quotes_runtime();
2412
+ if ($magic_quotes) {
2413
+ if (version_compare(PHP_VERSION, '5.3.0', '<')) {
2414
+ set_magic_quotes_runtime(false);
2415
+ } else {
2416
+ //Doesn't exist in PHP 5.4, but we don't need to check because
2417
+ //get_magic_quotes_runtime always returns false in 5.4+
2418
+ //so it will never get here
2419
+ ini_set('magic_quotes_runtime', false);
2420
+ }
2421
+ }
2422
+ $file_buffer = file_get_contents($path);
2423
+ $file_buffer = $this->encodeString($file_buffer, $encoding);
2424
+ if ($magic_quotes) {
2425
+ if (version_compare(PHP_VERSION, '5.3.0', '<')) {
2426
+ set_magic_quotes_runtime($magic_quotes);
2427
+ } else {
2428
+ ini_set('magic_quotes_runtime', $magic_quotes);
2429
+ }
2430
+ }
2431
+ return $file_buffer;
2432
+ } catch (Exception $exc) {
2433
+ $this->setError($exc->getMessage());
2434
+ return '';
2435
+ }
2436
+ }
2437
+
2438
+ /**
2439
+ * Encode a string in requested format.
2440
+ * Returns an empty string on failure.
2441
+ * @param string $str The text to encode
2442
+ * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
2443
+ * @access public
2444
+ * @return string
2445
+ */
2446
+ public function encodeString($str, $encoding = 'base64')
2447
+ {
2448
+ $encoded = '';
2449
+ switch (strtolower($encoding)) {
2450
+ case 'base64':
2451
+ $encoded = chunk_split(base64_encode($str), 76, $this->LE);
2452
+ break;
2453
+ case '7bit':
2454
+ case '8bit':
2455
+ $encoded = $this->fixEOL($str);
2456
+ // Make sure it ends with a line break
2457
+ if (substr($encoded, -(strlen($this->LE))) != $this->LE) {
2458
+ $encoded .= $this->LE;
2459
+ }
2460
+ break;
2461
+ case 'binary':
2462
+ $encoded = $str;
2463
+ break;
2464
+ case 'quoted-printable':
2465
+ $encoded = $this->encodeQP($str);
2466
+ break;
2467
+ default:
2468
+ $this->setError($this->lang('encoding') . $encoding);
2469
+ break;
2470
+ }
2471
+ return $encoded;
2472
+ }
2473
+
2474
+ /**
2475
+ * Encode a header string optimally.
2476
+ * Picks shortest of Q, B, quoted-printable or none.
2477
+ * @access public
2478
+ * @param string $str
2479
+ * @param string $position
2480
+ * @return string
2481
+ */
2482
+ public function encodeHeader($str, $position = 'text')
2483
+ {
2484
+ $matchcount = 0;
2485
+ switch (strtolower($position)) {
2486
+ case 'phrase':
2487
+ if (!preg_match('/[\200-\377]/', $str)) {
2488
+ // Can't use addslashes as we don't know the value of magic_quotes_sybase
2489
+ $encoded = addcslashes($str, "\0..\37\177\\\"");
2490
+ if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
2491
+ return ($encoded);
2492
+ } else {
2493
+ return ("\"$encoded\"");
2494
+ }
2495
+ }
2496
+ $matchcount = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
2497
+ break;
2498
+ /** @noinspection PhpMissingBreakStatementInspection */
2499
+ case 'comment':
2500
+ $matchcount = preg_match_all('/[()"]/', $str, $matches);
2501
+ // Intentional fall-through
2502
+ case 'text':
2503
+ default:
2504
+ $matchcount += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
2505
+ break;
2506
+ }
2507
+
2508
+ //There are no chars that need encoding
2509
+ if ($matchcount == 0) {
2510
+ return ($str);
2511
+ }
2512
+
2513
+ $maxlen = 75 - 7 - strlen($this->CharSet);
2514
+ // Try to select the encoding which should produce the shortest output
2515
+ if ($matchcount > strlen($str) / 3) {
2516
+ // More than a third of the content will need encoding, so B encoding will be most efficient
2517
+ $encoding = 'B';
2518
+ if (function_exists('mb_strlen') && $this->hasMultiBytes($str)) {
2519
+ // Use a custom function which correctly encodes and wraps long
2520
+ // multibyte strings without breaking lines within a character
2521
+ $encoded = $this->base64EncodeWrapMB($str, "\n");
2522
+ } else {
2523
+ $encoded = base64_encode($str);
2524
+ $maxlen -= $maxlen % 4;
2525
+ $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
2526
+ }
2527
+ } else {
2528
+ $encoding = 'Q';
2529
+ $encoded = $this->encodeQ($str, $position);
2530
+ $encoded = $this->wrapText($encoded, $maxlen, true);
2531
+ $encoded = str_replace('=' . self::CRLF, "\n", trim($encoded));
2532
+ }
2533
+
2534
+ $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
2535
+ $encoded = trim(str_replace("\n", $this->LE, $encoded));
2536
+
2537
+ return $encoded;
2538
+ }
2539
+
2540
+ /**
2541
+ * Check if a string contains multi-byte characters.
2542
+ * @access public
2543
+ * @param string $str multi-byte text to wrap encode
2544
+ * @return boolean
2545
+ */
2546
+ public function hasMultiBytes($str)
2547
+ {
2548
+ if (function_exists('mb_strlen')) {
2549
+ return (strlen($str) > mb_strlen($str, $this->CharSet));
2550
+ } else { // Assume no multibytes (we can't handle without mbstring functions anyway)
2551
+ return false;
2552
+ }
2553
+ }
2554
+
2555
+ /**
2556
+ * Does a string contain any 8-bit chars (in any charset)?
2557
+ * @param string $text
2558
+ * @return boolean
2559
+ */
2560
+ public function has8bitChars($text)
2561
+ {
2562
+ return (boolean)preg_match('/[\x80-\xFF]/', $text);
2563
+ }
2564
+
2565
+ /**
2566
+ * Encode and wrap long multibyte strings for mail headers
2567
+ * without breaking lines within a character.
2568
+ * Adapted from a function by paravoid
2569
+ * @link http://www.php.net/manual/en/function.mb-encode-mimeheader.php#60283
2570
+ * @access public
2571
+ * @param string $str multi-byte text to wrap encode
2572
+ * @param string $linebreak string to use as linefeed/end-of-line
2573
+ * @return string
2574
+ */
2575
+ public function base64EncodeWrapMB($str, $linebreak = null)
2576
+ {
2577
+ $start = '=?' . $this->CharSet . '?B?';
2578
+ $end = '?=';
2579
+ $encoded = '';
2580
+ if ($linebreak === null) {
2581
+ $linebreak = $this->LE;
2582
+ }
2583
+
2584
+ $mb_length = mb_strlen($str, $this->CharSet);
2585
+ // Each line must have length <= 75, including $start and $end
2586
+ $length = 75 - strlen($start) - strlen($end);
2587
+ // Average multi-byte ratio
2588
+ $ratio = $mb_length / strlen($str);
2589
+ // Base64 has a 4:3 ratio
2590
+ $avgLength = floor($length * $ratio * .75);
2591
+
2592
+ for ($i = 0; $i < $mb_length; $i += $offset) {
2593
+ $lookBack = 0;
2594
+ do {
2595
+ $offset = $avgLength - $lookBack;
2596
+ $chunk = mb_substr($str, $i, $offset, $this->CharSet);
2597
+ $chunk = base64_encode($chunk);
2598
+ $lookBack++;
2599
+ } while (strlen($chunk) > $length);
2600
+ $encoded .= $chunk . $linebreak;
2601
+ }
2602
+
2603
+ // Chomp the last linefeed
2604
+ $encoded = substr($encoded, 0, -strlen($linebreak));
2605
+ return $encoded;
2606
+ }
2607
+
2608
+ /**
2609
+ * Encode a string in quoted-printable format.
2610
+ * According to RFC2045 section 6.7.
2611
+ * @access public
2612
+ * @param string $string The text to encode
2613
+ * @param integer $line_max Number of chars allowed on a line before wrapping
2614
+ * @return string
2615
+ * @link http://www.php.net/manual/en/function.quoted-printable-decode.php#89417 Adapted from this comment
2616
+ */
2617
+ public function encodeQP($string, $line_max = 76)
2618
+ {
2619
+ // Use native function if it's available (>= PHP5.3)
2620
+ if (function_exists('quoted_printable_encode')) {
2621
+ return $this->fixEOL(quoted_printable_encode($string));
2622
+ }
2623
+ // Fall back to a pure PHP implementation
2624
+ $string = str_replace(
2625
+ array('%20', '%0D%0A.', '%0D%0A', '%'),
2626
+ array(' ', "\r\n=2E", "\r\n", '='),
2627
+ rawurlencode($string)
2628
+ );
2629
+ $string = preg_replace('/[^\r\n]{' . ($line_max - 3) . '}[^=\r\n]{2}/', "$0=\r\n", $string);
2630
+ return $this->fixEOL($string);
2631
+ }
2632
+
2633
+ /**
2634
+ * Backward compatibility wrapper for an old QP encoding function that was removed.
2635
+ * @see PHPMailer::encodeQP()
2636
+ * @access public
2637
+ * @param string $string
2638
+ * @param integer $line_max
2639
+ * @param boolean $space_conv
2640
+ * @return string
2641
+ * @deprecated Use encodeQP instead.
2642
+ */
2643
+ public function encodeQPphp(
2644
+ $string,
2645
+ $line_max = 76,
2646
+ /** @noinspection PhpUnusedParameterInspection */ $space_conv = false
2647
+ ) {
2648
+ return $this->encodeQP($string, $line_max);
2649
+ }
2650
+
2651
+ /**
2652
+ * Encode a string using Q encoding.
2653
+ * @link http://tools.ietf.org/html/rfc2047
2654
+ * @param string $str the text to encode
2655
+ * @param string $position Where the text is going to be used, see the RFC for what that means
2656
+ * @access public
2657
+ * @return string
2658
+ */
2659
+ public function encodeQ($str, $position = 'text')
2660
+ {
2661
+ // There should not be any EOL in the string
2662
+ $pattern = '';
2663
+ $encoded = str_replace(array("\r", "\n"), '', $str);
2664
+ switch (strtolower($position)) {
2665
+ case 'phrase':
2666
+ // RFC 2047 section 5.3
2667
+ $pattern = '^A-Za-z0-9!*+\/ -';
2668
+ break;
2669
+ /** @noinspection PhpMissingBreakStatementInspection */
2670
+ case 'comment':
2671
+ // RFC 2047 section 5.2
2672
+ $pattern = '\(\)"';
2673
+ // intentional fall-through
2674
+ // for this reason we build the $pattern without including delimiters and []
2675
+ case 'text':
2676
+ default:
2677
+ // RFC 2047 section 5.1
2678
+ // Replace every high ascii, control, =, ? and _ characters
2679
+ $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern;
2680
+ break;
2681
+ }
2682
+ $matches = array();
2683
+ if (preg_match_all("/[{$pattern}]/", $encoded, $matches)) {
2684
+ // If the string contains an '=', make sure it's the first thing we replace
2685
+ // so as to avoid double-encoding
2686
+ $eqkey = array_search('=', $matches[0]);
2687
+ if (false !== $eqkey) {
2688
+ unset($matches[0][$eqkey]);
2689
+ array_unshift($matches[0], '=');
2690
+ }
2691
+ foreach (array_unique($matches[0]) as $char) {
2692
+ $encoded = str_replace($char, '=' . sprintf('%02X', ord($char)), $encoded);
2693
+ }
2694
+ }
2695
+ // Replace every spaces to _ (more readable than =20)
2696
+ return str_replace(' ', '_', $encoded);
2697
+ }
2698
+
2699
+
2700
+ /**
2701
+ * Add a string or binary attachment (non-filesystem).
2702
+ * This method can be used to attach ascii or binary data,
2703
+ * such as a BLOB record from a database.
2704
+ * @param string $string String attachment data.
2705
+ * @param string $filename Name of the attachment.
2706
+ * @param string $encoding File encoding (see $Encoding).
2707
+ * @param string $type File extension (MIME) type.
2708
+ * @param string $disposition Disposition to use
2709
+ * @return void
2710
+ */
2711
+ public function addStringAttachment(
2712
+ $string,
2713
+ $filename,
2714
+ $encoding = 'base64',
2715
+ $type = '',
2716
+ $disposition = 'attachment'
2717
+ ) {
2718
+ // If a MIME type is not specified, try to work it out from the file name
2719
+ if ($type == '') {
2720
+ $type = self::filenameToType($filename);
2721
+ }
2722
+ // Append to $attachment array
2723
+ $this->attachment[] = array(
2724
+ 0 => $string,
2725
+ 1 => $filename,
2726
+ 2 => basename($filename),
2727
+ 3 => $encoding,
2728
+ 4 => $type,
2729
+ 5 => true, // isStringAttachment
2730
+ 6 => $disposition,
2731
+ 7 => 0
2732
+ );
2733
+ }
2734
+
2735
+ /**
2736
+ * Add an embedded (inline) attachment from a file.
2737
+ * This can include images, sounds, and just about any other document type.
2738
+ * These differ from 'regular' attachments in that they are intended to be
2739
+ * displayed inline with the message, not just attached for download.
2740
+ * This is used in HTML messages that embed the images
2741
+ * the HTML refers to using the $cid value.
2742
+ * @param string $path Path to the attachment.
2743
+ * @param string $cid Content ID of the attachment; Use this to reference
2744
+ * the content when using an embedded image in HTML.
2745
+ * @param string $name Overrides the attachment name.
2746
+ * @param string $encoding File encoding (see $Encoding).
2747
+ * @param string $type File MIME type.
2748
+ * @param string $disposition Disposition to use
2749
+ * @return boolean True on successfully adding an attachment
2750
+ */
2751
+ public function addEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline')
2752
+ {
2753
+ if (!@is_file($path)) {
2754
+ $this->setError($this->lang('file_access') . $path);
2755
+ return false;
2756
+ }
2757
+
2758
+ // If a MIME type is not specified, try to work it out from the file name
2759
+ if ($type == '') {
2760
+ $type = self::filenameToType($path);
2761
+ }
2762
+
2763
+ $filename = basename($path);
2764
+ if ($name == '') {
2765
+ $name = $filename;
2766
+ }
2767
+
2768
+ // Append to $attachment array
2769
+ $this->attachment[] = array(
2770
+ 0 => $path,
2771
+ 1 => $filename,
2772
+ 2 => $name,
2773
+ 3 => $encoding,
2774
+ 4 => $type,
2775
+ 5 => false, // isStringAttachment
2776
+ 6 => $disposition,
2777
+ 7 => $cid
2778
+ );
2779
+ return true;
2780
+ }
2781
+
2782
+ /**
2783
+ * Add an embedded stringified attachment.
2784
+ * This can include images, sounds, and just about any other document type.
2785
+ * Be sure to set the $type to an image type for images:
2786
+ * JPEG images use 'image/jpeg', GIF uses 'image/gif', PNG uses 'image/png'.
2787
+ * @param string $string The attachment binary data.
2788
+ * @param string $cid Content ID of the attachment; Use this to reference
2789
+ * the content when using an embedded image in HTML.
2790
+ * @param string $name
2791
+ * @param string $encoding File encoding (see $Encoding).
2792
+ * @param string $type MIME type.
2793
+ * @param string $disposition Disposition to use
2794
+ * @return boolean True on successfully adding an attachment
2795
+ */
2796
+ public function addStringEmbeddedImage(
2797
+ $string,
2798
+ $cid,
2799
+ $name = '',
2800
+ $encoding = 'base64',
2801
+ $type = '',
2802
+ $disposition = 'inline'
2803
+ ) {
2804
+ // If a MIME type is not specified, try to work it out from the name
2805
+ if ($type == '') {
2806
+ $type = self::filenameToType($name);
2807
+ }
2808
+
2809
+ // Append to $attachment array
2810
+ $this->attachment[] = array(
2811
+ 0 => $string,
2812
+ 1 => $name,
2813
+ 2 => $name,
2814
+ 3 => $encoding,
2815
+ 4 => $type,
2816
+ 5 => true, // isStringAttachment
2817
+ 6 => $disposition,
2818
+ 7 => $cid
2819
+ );
2820
+ return true;
2821
+ }
2822
+
2823
+ /**
2824
+ * Check if an inline attachment is present.
2825
+ * @access public
2826
+ * @return boolean
2827
+ */
2828
+ public function inlineImageExists()
2829
+ {
2830
+ foreach ($this->attachment as $attachment) {
2831
+ if ($attachment[6] == 'inline') {
2832
+ return true;
2833
+ }
2834
+ }
2835
+ return false;
2836
+ }
2837
+
2838
+ /**
2839
+ * Check if an attachment (non-inline) is present.
2840
+ * @return boolean
2841
+ */
2842
+ public function attachmentExists()
2843
+ {
2844
+ foreach ($this->attachment as $attachment) {
2845
+ if ($attachment[6] == 'attachment') {
2846
+ return true;
2847
+ }
2848
+ }
2849
+ return false;
2850
+ }
2851
+
2852
+ /**
2853
+ * Check if this message has an alternative body set.
2854
+ * @return boolean
2855
+ */
2856
+ public function alternativeExists()
2857
+ {
2858
+ return !empty($this->AltBody);
2859
+ }
2860
+
2861
+ /**
2862
+ * Clear all To recipients.
2863
+ * @return void
2864
+ */
2865
+ public function clearAddresses()
2866
+ {
2867
+ foreach ($this->to as $to) {
2868
+ unset($this->all_recipients[strtolower($to[0])]);
2869
+ }
2870
+ $this->to = array();
2871
+ }
2872
+
2873
+ /**
2874
+ * Clear all CC recipients.
2875
+ * @return void
2876
+ */
2877
+ public function clearCCs()
2878
+ {
2879
+ foreach ($this->cc as $cc) {
2880
+ unset($this->all_recipients[strtolower($cc[0])]);
2881
+ }
2882
+ $this->cc = array();
2883
+ }
2884
+
2885
+ /**
2886
+ * Clear all BCC recipients.
2887
+ * @return void
2888
+ */
2889
+ public function clearBCCs()
2890
+ {
2891
+ foreach ($this->bcc as $bcc) {
2892
+ unset($this->all_recipients[strtolower($bcc[0])]);
2893
+ }
2894
+ $this->bcc = array();
2895
+ }
2896
+
2897
+ /**
2898
+ * Clear all ReplyTo recipients.
2899
+ * @return void
2900
+ */
2901
+ public function clearReplyTos()
2902
+ {
2903
+ $this->ReplyTo = array();
2904
+ }
2905
+
2906
+ /**
2907
+ * Clear all recipient types.
2908
+ * @return void
2909
+ */
2910
+ public function clearAllRecipients()
2911
+ {
2912
+ $this->to = array();
2913
+ $this->cc = array();
2914
+ $this->bcc = array();
2915
+ $this->all_recipients = array();
2916
+ }
2917
+
2918
+ /**
2919
+ * Clear all filesystem, string, and binary attachments.
2920
+ * @return void
2921
+ */
2922
+ public function clearAttachments()
2923
+ {
2924
+ $this->attachment = array();
2925
+ }
2926
+
2927
+ /**
2928
+ * Clear all custom headers.
2929
+ * @return void
2930
+ */
2931
+ public function clearCustomHeaders()
2932
+ {
2933
+ $this->CustomHeader = array();
2934
+ }
2935
+
2936
+ /**
2937
+ * Add an error message to the error container.
2938
+ * @access protected
2939
+ * @param string $msg
2940
+ * @return void
2941
+ */
2942
+ protected function setError($msg)
2943
+ {
2944
+ $this->error_count++;
2945
+ if ($this->Mailer == 'smtp' and !is_null($this->smtp)) {
2946
+ $lasterror = $this->smtp->getError();
2947
+ if (!empty($lasterror['error'])) {
2948
+ $msg .= $this->lang('smtp_error') . $lasterror['error'];
2949
+ if (!empty($lasterror['detail'])) {
2950
+ $msg .= ' Detail: '. $lasterror['detail'];
2951
+ }
2952
+ if (!empty($lasterror['smtp_code'])) {
2953
+ $msg .= ' SMTP code: ' . $lasterror['smtp_code'];
2954
+ }
2955
+ if (!empty($lasterror['smtp_code_ex'])) {
2956
+ $msg .= ' Additional SMTP info: ' . $lasterror['smtp_code_ex'];
2957
+ }
2958
+ }
2959
+ }
2960
+ $this->ErrorInfo = $msg;
2961
+ }
2962
+
2963
+ /**
2964
+ * Return an RFC 822 formatted date.
2965
+ * @access public
2966
+ * @return string
2967
+ * @static
2968
+ */
2969
+ public static function rfcDate()
2970
+ {
2971
+ // Set the time zone to whatever the default is to avoid 500 errors
2972
+ // Will default to UTC if it's not set properly in php.ini
2973
+ date_default_timezone_set(@date_default_timezone_get());
2974
+ return date('D, j M Y H:i:s O');
2975
+ }
2976
+
2977
+ /**
2978
+ * Get the server hostname.
2979
+ * Returns 'localhost.localdomain' if unknown.
2980
+ * @access protected
2981
+ * @return string
2982
+ */
2983
+ protected function serverHostname()
2984
+ {
2985
+ $result = 'localhost.localdomain';
2986
+ if (!empty($this->Hostname)) {
2987
+ $result = $this->Hostname;
2988
+ } elseif (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER) and !empty($_SERVER['SERVER_NAME'])) {
2989
+ $result = $_SERVER['SERVER_NAME'];
2990
+ } elseif (function_exists('gethostname') && gethostname() !== false) {
2991
+ $result = gethostname();
2992
+ } elseif (php_uname('n') !== false) {
2993
+ $result = php_uname('n');
2994
+ }
2995
+ return $result;
2996
+ }
2997
+
2998
+ /**
2999
+ * Get an error message in the current language.
3000
+ * @access protected
3001
+ * @param string $key
3002
+ * @return string
3003
+ */
3004
+ protected function lang($key)
3005
+ {
3006
+ if (count($this->language) < 1) {
3007
+ $this->setLanguage('en'); // set the default language
3008
+ }
3009
+
3010
+ if (array_key_exists($key, $this->language)) {
3011
+ if ($key == 'smtp_connect_failed') {
3012
+ //Include a link to troubleshooting docs on SMTP connection failure
3013
+ //this is by far the biggest cause of support questions
3014
+ //but it's usually not PHPMailer's fault.
3015
+ return $this->language[$key] . ' https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting';
3016
+ }
3017
+ return $this->language[$key];
3018
+ } else {
3019
+ //Return the key as a fallback
3020
+ return $key;
3021
+ }
3022
+ }
3023
+
3024
+ /**
3025
+ * Check if an error occurred.
3026
+ * @access public
3027
+ * @return boolean True if an error did occur.
3028
+ */
3029
+ public function isError()
3030
+ {
3031
+ return ($this->error_count > 0);
3032
+ }
3033
+
3034
+ /**
3035
+ * Ensure consistent line endings in a string.
3036
+ * Changes every end of line from CRLF, CR or LF to $this->LE.
3037
+ * @access public
3038
+ * @param string $str String to fixEOL
3039
+ * @return string
3040
+ */
3041
+ public function fixEOL($str)
3042
+ {
3043
+ // Normalise to \n
3044
+ $nstr = str_replace(array("\r\n", "\r"), "\n", $str);
3045
+ // Now convert LE as needed
3046
+ if ($this->LE !== "\n") {
3047
+ $nstr = str_replace("\n", $this->LE, $nstr);
3048
+ }
3049
+ return $nstr;
3050
+ }
3051
+
3052
+ /**
3053
+ * Add a custom header.
3054
+ * $name value can be overloaded to contain
3055
+ * both header name and value (name:value)
3056
+ * @access public
3057
+ * @param string $name Custom header name
3058
+ * @param string $value Header value
3059
+ * @return void
3060
+ */
3061
+ public function addCustomHeader($name, $value = null)
3062
+ {
3063
+ if ($value === null) {
3064
+ // Value passed in as name:value
3065
+ $this->CustomHeader[] = explode(':', $name, 2);
3066
+ } else {
3067
+ $this->CustomHeader[] = array($name, $value);
3068
+ }
3069
+ }
3070
+
3071
+ /**
3072
+ * Returns all custom headers
3073
+ *
3074
+ * @return array
3075
+ */
3076
+ public function getCustomHeaders()
3077
+ {
3078
+ return $this->CustomHeader;
3079
+ }
3080
+
3081
+ /**
3082
+ * Create a message from an HTML string.
3083
+ * Automatically makes modifications for inline images and backgrounds
3084
+ * and creates a plain-text version by converting the HTML.
3085
+ * Overwrites any existing values in $this->Body and $this->AltBody
3086
+ * @access public
3087
+ * @param string $message HTML message string
3088
+ * @param string $basedir baseline directory for path
3089
+ * @param boolean|callable $advanced Whether to use the internal HTML to text converter
3090
+ * or your own custom converter @see html2text()
3091
+ * @return string $message
3092
+ */
3093
+ public function msgHTML($message, $basedir = '', $advanced = false)
3094
+ {
3095
+ preg_match_all('/(src|background)=["\'](.*)["\']/Ui', $message, $images);
3096
+ if (isset($images[2])) {
3097
+ foreach ($images[2] as $imgindex => $url) {
3098
+ // Convert data URIs into embedded images
3099
+ if (preg_match('#^data:(image[^;,]*)(;base64)?,#', $url, $match)) {
3100
+ $data = substr($url, strpos($url, ','));
3101
+ if ($match[2]) {
3102
+ $data = base64_decode($data);
3103
+ } else {
3104
+ $data = rawurldecode($data);
3105
+ }
3106
+ $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2
3107
+ if ($this->addStringEmbeddedImage($data, $cid, '', 'base64', $match[1])) {
3108
+ $message = str_replace(
3109
+ $images[0][$imgindex],
3110
+ $images[1][$imgindex] . '="cid:' . $cid . '"',
3111
+ $message
3112
+ );
3113
+ }
3114
+ } elseif (!preg_match('#^[A-z]+://#', $url)) {
3115
+ // Do not change urls for absolute images (thanks to corvuscorax)
3116
+ $filename = basename($url);
3117
+ $directory = dirname($url);
3118
+ if ($directory == '.') {
3119
+ $directory = '';
3120
+ }
3121
+ $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2
3122
+ if (strlen($basedir) > 1 && substr($basedir, -1) != '/') {
3123
+ $basedir .= '/';
3124
+ }
3125
+ if (strlen($directory) > 1 && substr($directory, -1) != '/') {
3126
+ $directory .= '/';
3127
+ }
3128
+ if ($this->addEmbeddedImage(
3129
+ $basedir . $directory . $filename,
3130
+ $cid,
3131
+ $filename,
3132
+ 'base64',
3133
+ self::_mime_types((string)self::mb_pathinfo($filename, PATHINFO_EXTENSION))
3134
+ )
3135
+ ) {
3136
+ $message = preg_replace(
3137
+ '/' . $images[1][$imgindex] . '=["\']' . preg_quote($url, '/') . '["\']/Ui',
3138
+ $images[1][$imgindex] . '="cid:' . $cid . '"',
3139
+ $message
3140
+ );
3141
+ }
3142
+ }
3143
+ }
3144
+ }
3145
+ $this->isHTML(true);
3146
+ // Convert all message body line breaks to CRLF, makes quoted-printable encoding work much better
3147
+ $this->Body = $this->normalizeBreaks($message);
3148
+ $this->AltBody = $this->normalizeBreaks($this->html2text($message, $advanced));
3149
+ if (empty($this->AltBody)) {
3150
+ $this->AltBody = 'To view this email message, open it in a program that understands HTML!' .
3151
+ self::CRLF . self::CRLF;
3152
+ }
3153
+ return $this->Body;
3154
+ }
3155
+
3156
+ /**
3157
+ * Convert an HTML string into plain text.
3158
+ * This is used by msgHTML().
3159
+ * Note - older versions of this function used a bundled advanced converter
3160
+ * which was been removed for license reasons in #232
3161
+ * Example usage:
3162
+ * <code>
3163
+ * // Use default conversion
3164
+ * $plain = $mail->html2text($html);
3165
+ * // Use your own custom converter
3166
+ * $plain = $mail->html2text($html, function($html) {
3167
+ * $converter = new MyHtml2text($html);
3168
+ * return $converter->get_text();
3169
+ * });
3170
+ * </code>
3171
+ * @param string $html The HTML text to convert
3172
+ * @param boolean|callable $advanced Any boolean value to use the internal converter,
3173
+ * or provide your own callable for custom conversion.
3174
+ * @return string
3175
+ */
3176
+ public function html2text($html, $advanced = false)
3177
+ {
3178
+ if (is_callable($advanced)) {
3179
+ return call_user_func($advanced, $html);
3180
+ }
3181
+ return html_entity_decode(
3182
+ trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/si', '', $html))),
3183
+ ENT_QUOTES,
3184
+ $this->CharSet
3185
+ );
3186
+ }
3187
+
3188
+ /**
3189
+ * Get the MIME type for a file extension.
3190
+ * @param string $ext File extension
3191
+ * @access public
3192
+ * @return string MIME type of file.
3193
+ * @static
3194
+ */
3195
+ public static function _mime_types($ext = '')
3196
+ {
3197
+ $mimes = array(
3198
+ 'xl' => 'application/excel',
3199
+ 'js' => 'application/javascript',
3200
+ 'hqx' => 'application/mac-binhex40',
3201
+ 'cpt' => 'application/mac-compactpro',
3202
+ 'bin' => 'application/macbinary',
3203
+ 'doc' => 'application/msword',
3204
+ 'word' => 'application/msword',
3205
+ 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3206
+ 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
3207
+ 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template',
3208
+ 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
3209
+ 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
3210
+ 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide',
3211
+ 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
3212
+ 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
3213
+ 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12',
3214
+ 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
3215
+ 'class' => 'application/octet-stream',
3216
+ 'dll' => 'application/octet-stream',
3217
+ 'dms' => 'application/octet-stream',
3218
+ 'exe' => 'application/octet-stream',
3219
+ 'lha' => 'application/octet-stream',
3220
+ 'lzh' => 'application/octet-stream',
3221
+ 'psd' => 'application/octet-stream',
3222
+ 'sea' => 'application/octet-stream',
3223
+ 'so' => 'application/octet-stream',
3224
+ 'oda' => 'application/oda',
3225
+ 'pdf' => 'application/pdf',
3226
+ 'ai' => 'application/postscript',
3227
+ 'eps' => 'application/postscript',
3228
+ 'ps' => 'application/postscript',
3229
+ 'smi' => 'application/smil',
3230
+ 'smil' => 'application/smil',
3231
+ 'mif' => 'application/vnd.mif',
3232
+ 'xls' => 'application/vnd.ms-excel',
3233
+ 'ppt' => 'application/vnd.ms-powerpoint',
3234
+ 'wbxml' => 'application/vnd.wap.wbxml',
3235
+ 'wmlc' => 'application/vnd.wap.wmlc',
3236
+ 'dcr' => 'application/x-director',
3237
+ 'dir' => 'application/x-director',
3238
+ 'dxr' => 'application/x-director',
3239
+ 'dvi' => 'application/x-dvi',
3240
+ 'gtar' => 'application/x-gtar',
3241
+ 'php3' => 'application/x-httpd-php',
3242
+ 'php4' => 'application/x-httpd-php',
3243
+ 'php' => 'application/x-httpd-php',
3244
+ 'phtml' => 'application/x-httpd-php',
3245
+ 'phps' => 'application/x-httpd-php-source',
3246
+ 'swf' => 'application/x-shockwave-flash',
3247
+ 'sit' => 'application/x-stuffit',
3248
+ 'tar' => 'application/x-tar',
3249
+ 'tgz' => 'application/x-tar',
3250
+ 'xht' => 'application/xhtml+xml',
3251
+ 'xhtml' => 'application/xhtml+xml',
3252
+ 'zip' => 'application/zip',
3253
+ 'mid' => 'audio/midi',
3254
+ 'midi' => 'audio/midi',
3255
+ 'mp2' => 'audio/mpeg',
3256
+ 'mp3' => 'audio/mpeg',
3257
+ 'mpga' => 'audio/mpeg',
3258
+ 'aif' => 'audio/x-aiff',
3259
+ 'aifc' => 'audio/x-aiff',
3260
+ 'aiff' => 'audio/x-aiff',
3261
+ 'ram' => 'audio/x-pn-realaudio',
3262
+ 'rm' => 'audio/x-pn-realaudio',
3263
+ 'rpm' => 'audio/x-pn-realaudio-plugin',
3264
+ 'ra' => 'audio/x-realaudio',
3265
+ 'wav' => 'audio/x-wav',
3266
+ 'bmp' => 'image/bmp',
3267
+ 'gif' => 'image/gif',
3268
+ 'jpeg' => 'image/jpeg',
3269
+ 'jpe' => 'image/jpeg',
3270
+ 'jpg' => 'image/jpeg',
3271
+ 'png' => 'image/png',
3272
+ 'tiff' => 'image/tiff',
3273
+ 'tif' => 'image/tiff',
3274
+ 'eml' => 'message/rfc822',
3275
+ 'css' => 'text/css',
3276
+ 'html' => 'text/html',
3277
+ 'htm' => 'text/html',
3278
+ 'shtml' => 'text/html',
3279
+ 'log' => 'text/plain',
3280
+ 'text' => 'text/plain',
3281
+ 'txt' => 'text/plain',
3282
+ 'rtx' => 'text/richtext',
3283
+ 'rtf' => 'text/rtf',
3284
+ 'vcf' => 'text/vcard',
3285
+ 'vcard' => 'text/vcard',
3286
+ 'xml' => 'text/xml',
3287
+ 'xsl' => 'text/xml',
3288
+ 'mpeg' => 'video/mpeg',
3289
+ 'mpe' => 'video/mpeg',
3290
+ 'mpg' => 'video/mpeg',
3291
+ 'mov' => 'video/quicktime',
3292
+ 'qt' => 'video/quicktime',
3293
+ 'rv' => 'video/vnd.rn-realvideo',
3294
+ 'avi' => 'video/x-msvideo',
3295
+ 'movie' => 'video/x-sgi-movie'
3296
+ );
3297
+ if (array_key_exists(strtolower($ext), $mimes)) {
3298
+ return $mimes[strtolower($ext)];
3299
+ }
3300
+ return 'application/octet-stream';
3301
+ }
3302
+
3303
+ /**
3304
+ * Map a file name to a MIME type.
3305
+ * Defaults to 'application/octet-stream', i.e.. arbitrary binary data.
3306
+ * @param string $filename A file name or full path, does not need to exist as a file
3307
+ * @return string
3308
+ * @static
3309
+ */
3310
+ public static function filenameToType($filename)
3311
+ {
3312
+ // In case the path is a URL, strip any query string before getting extension
3313
+ $qpos = strpos($filename, '?');
3314
+ if (false !== $qpos) {
3315
+ $filename = substr($filename, 0, $qpos);
3316
+ }
3317
+ $pathinfo = self::mb_pathinfo($filename);
3318
+ return self::_mime_types($pathinfo['extension']);
3319
+ }
3320
+
3321
+ /**
3322
+ * Multi-byte-safe pathinfo replacement.
3323
+ * Drop-in replacement for pathinfo(), but multibyte-safe, cross-platform-safe, old-version-safe.
3324
+ * Works similarly to the one in PHP >= 5.2.0
3325
+ * @link http://www.php.net/manual/en/function.pathinfo.php#107461
3326
+ * @param string $path A filename or path, does not need to exist as a file
3327
+ * @param integer|string $options Either a PATHINFO_* constant,
3328
+ * or a string name to return only the specified piece, allows 'filename' to work on PHP < 5.2
3329
+ * @return string|array
3330
+ * @static
3331
+ */
3332
+ public static function mb_pathinfo($path, $options = null)
3333
+ {
3334
+ $ret = array('dirname' => '', 'basename' => '', 'extension' => '', 'filename' => '');
3335
+ $pathinfo = array();
3336
+ if (preg_match('%^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$%im', $path, $pathinfo)) {
3337
+ if (array_key_exists(1, $pathinfo)) {
3338
+ $ret['dirname'] = $pathinfo[1];
3339
+ }
3340
+ if (array_key_exists(2, $pathinfo)) {
3341
+ $ret['basename'] = $pathinfo[2];
3342
+ }
3343
+ if (array_key_exists(5, $pathinfo)) {
3344
+ $ret['extension'] = $pathinfo[5];
3345
+ }
3346
+ if (array_key_exists(3, $pathinfo)) {
3347
+ $ret['filename'] = $pathinfo[3];
3348
+ }
3349
+ }
3350
+ switch ($options) {
3351
+ case PATHINFO_DIRNAME:
3352
+ case 'dirname':
3353
+ return $ret['dirname'];
3354
+ case PATHINFO_BASENAME:
3355
+ case 'basename':
3356
+ return $ret['basename'];
3357
+ case PATHINFO_EXTENSION:
3358
+ case 'extension':
3359
+ return $ret['extension'];
3360
+ case PATHINFO_FILENAME:
3361
+ case 'filename':
3362
+ return $ret['filename'];
3363
+ default:
3364
+ return $ret;
3365
+ }
3366
+ }
3367
+
3368
+ /**
3369
+ * Set or reset instance properties.
3370
+ * You should avoid this function - it's more verbose, less efficient, more error-prone and
3371
+ * harder to debug than setting properties directly.
3372
+ * Usage Example:
3373
+ * `$mail->set('SMTPSecure', 'tls');`
3374
+ * is the same as:
3375
+ * `$mail->SMTPSecure = 'tls';`
3376
+ * @access public
3377
+ * @param string $name The property name to set
3378
+ * @param mixed $value The value to set the property to
3379
+ * @return boolean
3380
+ * @TODO Should this not be using the __set() magic function?
3381
+ */
3382
+ public function set($name, $value = '')
3383
+ {
3384
+ if (property_exists($this, $name)) {
3385
+ $this->$name = $value;
3386
+ return true;
3387
+ } else {
3388
+ $this->setError($this->lang('variable_set') . $name);
3389
+ return false;
3390
+ }
3391
+ }
3392
+
3393
+ /**
3394
+ * Strip newlines to prevent header injection.
3395
+ * @access public
3396
+ * @param string $str
3397
+ * @return string
3398
+ */
3399
+ public function secureHeader($str)
3400
+ {
3401
+ return trim(str_replace(array("\r", "\n"), '', $str));
3402
+ }
3403
+
3404
+ /**
3405
+ * Normalize line breaks in a string.
3406
+ * Converts UNIX LF, Mac CR and Windows CRLF line breaks into a single line break format.
3407
+ * Defaults to CRLF (for message bodies) and preserves consecutive breaks.
3408
+ * @param string $text
3409
+ * @param string $breaktype What kind of line break to use, defaults to CRLF
3410
+ * @return string
3411
+ * @access public
3412
+ * @static
3413
+ */
3414
+ public static function normalizeBreaks($text, $breaktype = "\r\n")
3415
+ {
3416
+ return preg_replace('/(\r\n|\r|\n)/ms', $breaktype, $text);
3417
+ }
3418
+
3419
+
3420
+ /**
3421
+ * Set the public and private key files and password for S/MIME signing.
3422
+ * @access public
3423
+ * @param string $cert_filename
3424
+ * @param string $key_filename
3425
+ * @param string $key_pass Password for private key
3426
+ * @param string $extracerts_filename Optional path to chain certificate
3427
+ */
3428
+ public function sign($cert_filename, $key_filename, $key_pass, $extracerts_filename = '')
3429
+ {
3430
+ $this->sign_cert_file = $cert_filename;
3431
+ $this->sign_key_file = $key_filename;
3432
+ $this->sign_key_pass = $key_pass;
3433
+ $this->sign_extracerts_file = $extracerts_filename;
3434
+ }
3435
+
3436
+ /**
3437
+ * Quoted-Printable-encode a DKIM header.
3438
+ * @access public
3439
+ * @param string $txt
3440
+ * @return string
3441
+ */
3442
+ public function DKIM_QP($txt)
3443
+ {
3444
+ $line = '';
3445
+ for ($i = 0; $i < strlen($txt); $i++) {
3446
+ $ord = ord($txt[$i]);
3447
+ if (((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E))) {
3448
+ $line .= $txt[$i];
3449
+ } else {
3450
+ $line .= '=' . sprintf('%02X', $ord);
3451
+ }
3452
+ }
3453
+ return $line;
3454
+ }
3455
+
3456
+ /**
3457
+ * Generate a DKIM signature.
3458
+ * @access public
3459
+ * @param string $signHeader
3460
+ * @throws phpmailerException
3461
+ * @return string
3462
+ */
3463
+ public function DKIM_Sign($signHeader)
3464
+ {
3465
+ if (!defined('PKCS7_TEXT')) {
3466
+ if ($this->exceptions) {
3467
+ throw new phpmailerException($this->lang('extension_missing') . 'openssl');
3468
+ }
3469
+ return '';
3470
+ }
3471
+ $privKeyStr = file_get_contents($this->DKIM_private);
3472
+ if ($this->DKIM_passphrase != '') {
3473
+ $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
3474
+ } else {
3475
+ $privKey = $privKeyStr;
3476
+ }
3477
+ if (openssl_sign($signHeader, $signature, $privKey)) {
3478
+ return base64_encode($signature);
3479
+ }
3480
+ return '';
3481
+ }
3482
+
3483
+ /**
3484
+ * Generate a DKIM canonicalization header.
3485
+ * @access public
3486
+ * @param string $signHeader Header
3487
+ * @return string
3488
+ */
3489
+ public function DKIM_HeaderC($signHeader)
3490
+ {
3491
+ $signHeader = preg_replace('/\r\n\s+/', ' ', $signHeader);
3492
+ $lines = explode("\r\n", $signHeader);
3493
+ foreach ($lines as $key => $line) {
3494
+ list($heading, $value) = explode(':', $line, 2);
3495
+ $heading = strtolower($heading);
3496
+ $value = preg_replace('/\s+/', ' ', $value); // Compress useless spaces
3497
+ $lines[$key] = $heading . ':' . trim($value); // Don't forget to remove WSP around the value
3498
+ }
3499
+ $signHeader = implode("\r\n", $lines);
3500
+ return $signHeader;
3501
+ }
3502
+
3503
+ /**
3504
+ * Generate a DKIM canonicalization body.
3505
+ * @access public
3506
+ * @param string $body Message Body
3507
+ * @return string
3508
+ */
3509
+ public function DKIM_BodyC($body)
3510
+ {
3511
+ if ($body == '') {
3512
+ return "\r\n";
3513
+ }
3514
+ // stabilize line endings
3515
+ $body = str_replace("\r\n", "\n", $body);
3516
+ $body = str_replace("\n", "\r\n", $body);
3517
+ // END stabilize line endings
3518
+ while (substr($body, strlen($body) - 4, 4) == "\r\n\r\n") {
3519
+ $body = substr($body, 0, strlen($body) - 2);
3520
+ }
3521
+ return $body;
3522
+ }
3523
+
3524
+ /**
3525
+ * Create the DKIM header and body in a new message header.
3526
+ * @access public
3527
+ * @param string $headers_line Header lines
3528
+ * @param string $subject Subject
3529
+ * @param string $body Body
3530
+ * @return string
3531
+ */
3532
+ public function DKIM_Add($headers_line, $subject, $body)
3533
+ {
3534
+ $DKIMsignatureType = 'rsa-sha1'; // Signature & hash algorithms
3535
+ $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body
3536
+ $DKIMquery = 'dns/txt'; // Query method
3537
+ $DKIMtime = time(); // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone)
3538
+ $subject_header = "Subject: $subject";
3539
+ $headers = explode($this->LE, $headers_line);
3540
+ $from_header = '';
3541
+ $to_header = '';
3542
+ $current = '';
3543
+ foreach ($headers as $header) {
3544
+ if (strpos($header, 'From:') === 0) {
3545
+ $from_header = $header;
3546
+ $current = 'from_header';
3547
+ } elseif (strpos($header, 'To:') === 0) {
3548
+ $to_header = $header;
3549
+ $current = 'to_header';
3550
+ } else {
3551
+ if (!empty($$current) && strpos($header, ' =?') === 0) {
3552
+ $$current .= $header;
3553
+ } else {
3554
+ $current = '';
3555
+ }
3556
+ }
3557
+ }
3558
+ $from = str_replace('|', '=7C', $this->DKIM_QP($from_header));
3559
+ $to = str_replace('|', '=7C', $this->DKIM_QP($to_header));
3560
+ $subject = str_replace(
3561
+ '|',
3562
+ '=7C',
3563
+ $this->DKIM_QP($subject_header)
3564
+ ); // Copied header fields (dkim-quoted-printable)
3565
+ $body = $this->DKIM_BodyC($body);
3566
+ $DKIMlen = strlen($body); // Length of body
3567
+ $DKIMb64 = base64_encode(pack('H*', sha1($body))); // Base64 of packed binary SHA-1 hash of body
3568
+ if ('' == $this->DKIM_identity) {
3569
+ $ident = '';
3570
+ } else {
3571
+ $ident = ' i=' . $this->DKIM_identity . ';';
3572
+ }
3573
+ $dkimhdrs = 'DKIM-Signature: v=1; a=' .
3574
+ $DKIMsignatureType . '; q=' .
3575
+ $DKIMquery . '; l=' .
3576
+ $DKIMlen . '; s=' .
3577
+ $this->DKIM_selector .
3578
+ ";\r\n" .
3579
+ "\tt=" . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" .
3580
+ "\th=From:To:Subject;\r\n" .
3581
+ "\td=" . $this->DKIM_domain . ';' . $ident . "\r\n" .
3582
+ "\tz=$from\r\n" .
3583
+ "\t|$to\r\n" .
3584
+ "\t|$subject;\r\n" .
3585
+ "\tbh=" . $DKIMb64 . ";\r\n" .
3586
+ "\tb=";
3587
+ $toSign = $this->DKIM_HeaderC(
3588
+ $from_header . "\r\n" . $to_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs
3589
+ );
3590
+ $signed = $this->DKIM_Sign($toSign);
3591
+ return $dkimhdrs . $signed . "\r\n";
3592
+ }
3593
+
3594
+ /**
3595
+ * Detect if a string contains a line longer than the maximum line length allowed.
3596
+ * @param string $str
3597
+ * @return boolean
3598
+ * @static
3599
+ */
3600
+ public static function hasLineLongerThanMax($str)
3601
+ {
3602
+ //+2 to include CRLF line break for a 1000 total
3603
+ return (boolean)preg_match('/^(.{'.(self::MAX_LINE_LENGTH + 2).',})/m', $str);
3604
+ }
3605
+
3606
+ /**
3607
+ * Allows for public read access to 'to' property.
3608
+ * @access public
3609
+ * @return array
3610
+ */
3611
+ public function getToAddresses()
3612
+ {
3613
+ return $this->to;
3614
+ }
3615
+
3616
+ /**
3617
+ * Allows for public read access to 'cc' property.
3618
+ * @access public
3619
+ * @return array
3620
+ */
3621
+ public function getCcAddresses()
3622
+ {
3623
+ return $this->cc;
3624
+ }
3625
+
3626
+ /**
3627
+ * Allows for public read access to 'bcc' property.
3628
+ * @access public
3629
+ * @return array
3630
+ */
3631
+ public function getBccAddresses()
3632
+ {
3633
+ return $this->bcc;
3634
+ }
3635
+
3636
+ /**
3637
+ * Allows for public read access to 'ReplyTo' property.
3638
+ * @access public
3639
+ * @return array
3640
+ */
3641
+ public function getReplyToAddresses()
3642
+ {
3643
+ return $this->ReplyTo;
3644
+ }
3645
+
3646
+ /**
3647
+ * Allows for public read access to 'all_recipients' property.
3648
+ * @access public
3649
+ * @return array
3650
+ */
3651
+ public function getAllRecipientAddresses()
3652
+ {
3653
+ return $this->all_recipients;
3654
+ }
3655
+
3656
+ /**
3657
+ * Perform a callback.
3658
+ * @param boolean $isSent
3659
+ * @param array $to
3660
+ * @param array $cc
3661
+ * @param array $bcc
3662
+ * @param string $subject
3663
+ * @param string $body
3664
+ * @param string $from
3665
+ */
3666
+ protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from)
3667
+ {
3668
+ if (!empty($this->action_function) && is_callable($this->action_function)) {
3669
+ $params = array($isSent, $to, $cc, $bcc, $subject, $body, $from);
3670
+ call_user_func_array($this->action_function, $params);
3671
+ }
3672
+ }
3673
+ }
3674
+
3675
+ /**
3676
+ * PHPMailer exception handler
3677
+ * @package PHPMailer
3678
+ */
3679
+ class phpmailerException extends Exception
3680
+ {
3681
+ /**
3682
+ * Prettify error message output
3683
+ * @return string
3684
+ */
3685
+ public function errorMessage()
3686
+ {
3687
+ $errorMsg = '<strong>' . $this->getMessage() . "</strong><br />\n";
3688
+ return $errorMsg;
3689
+ }
3690
+ }
smtp/class.smtp.php ADDED
@@ -0,0 +1,1152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHPMailer RFC821 SMTP email transport class.
4
+ * PHP Version 5
5
+ * @package PHPMailer
6
+ * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
7
+ * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
8
+ * @author Jim Jagielski (jimjag) <jimjag@gmail.com>
9
+ * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
10
+ * @author Brent R. Matzelle (original founder)
11
+ * @copyright 2014 Marcus Bointon
12
+ * @copyright 2010 - 2012 Jim Jagielski
13
+ * @copyright 2004 - 2009 Andy Prevost
14
+ * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
15
+ * @note This program is distributed in the hope that it will be useful - WITHOUT
16
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
+ * FITNESS FOR A PARTICULAR PURPOSE.
18
+ */
19
+
20
+ /**
21
+ * PHPMailer RFC821 SMTP email transport class.
22
+ * Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server.
23
+ * @package PHPMailer
24
+ * @author Chris Ryan
25
+ * @author Marcus Bointon <phpmailer@synchromedia.co.uk>
26
+ */
27
+ class SMTP
28
+ {
29
+ /**
30
+ * The PHPMailer SMTP version number.
31
+ * @type string
32
+ */
33
+ const VERSION = '5.2.10';
34
+
35
+ /**
36
+ * SMTP line break constant.
37
+ * @type string
38
+ */
39
+ const CRLF = "\r\n";
40
+
41
+ /**
42
+ * The SMTP port to use if one is not specified.
43
+ * @type integer
44
+ */
45
+ const DEFAULT_SMTP_PORT = 25;
46
+
47
+ /**
48
+ * The maximum line length allowed by RFC 2822 section 2.1.1
49
+ * @type integer
50
+ */
51
+ const MAX_LINE_LENGTH = 998;
52
+
53
+ /**
54
+ * Debug level for no output
55
+ */
56
+ const DEBUG_OFF = 0;
57
+
58
+ /**
59
+ * Debug level to show client -> server messages
60
+ */
61
+ const DEBUG_CLIENT = 1;
62
+
63
+ /**
64
+ * Debug level to show client -> server and server -> client messages
65
+ */
66
+ const DEBUG_SERVER = 2;
67
+
68
+ /**
69
+ * Debug level to show connection status, client -> server and server -> client messages
70
+ */
71
+ const DEBUG_CONNECTION = 3;
72
+
73
+ /**
74
+ * Debug level to show all messages
75
+ */
76
+ const DEBUG_LOWLEVEL = 4;
77
+
78
+ /**
79
+ * The PHPMailer SMTP Version number.
80
+ * @type string
81
+ * @deprecated Use the `VERSION` constant instead
82
+ * @see SMTP::VERSION
83
+ */
84
+ public $Version = '5.2.10';
85
+
86
+ /**
87
+ * SMTP server port number.
88
+ * @type integer
89
+ * @deprecated This is only ever used as a default value, so use the `DEFAULT_SMTP_PORT` constant instead
90
+ * @see SMTP::DEFAULT_SMTP_PORT
91
+ */
92
+ public $SMTP_PORT = 25;
93
+
94
+ /**
95
+ * SMTP reply line ending.
96
+ * @type string
97
+ * @deprecated Use the `CRLF` constant instead
98
+ * @see SMTP::CRLF
99
+ */
100
+ public $CRLF = "\r\n";
101
+
102
+ /**
103
+ * Debug output level.
104
+ * Options:
105
+ * * self::DEBUG_OFF (`0`) No debug output, default
106
+ * * self::DEBUG_CLIENT (`1`) Client commands
107
+ * * self::DEBUG_SERVER (`2`) Client commands and server responses
108
+ * * self::DEBUG_CONNECTION (`3`) As DEBUG_SERVER plus connection status
109
+ * * self::DEBUG_LOWLEVEL (`4`) Low-level data output, all messages
110
+ * @type integer
111
+ */
112
+ public $do_debug = self::DEBUG_OFF;
113
+
114
+ /**
115
+ * How to handle debug output.
116
+ * Options:
117
+ * * `echo` Output plain-text as-is, appropriate for CLI
118
+ * * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output
119
+ * * `error_log` Output to error log as configured in php.ini
120
+ *
121
+ * Alternatively, you can provide a callable expecting two params: a message string and the debug level:
122
+ * <code>
123
+ * $smtp->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
124
+ * </code>
125
+ * @type string|callable
126
+ */
127
+ public $Debugoutput = 'echo';
128
+
129
+ /**
130
+ * Whether to use VERP.
131
+ * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path
132
+ * @link http://www.postfix.org/VERP_README.html Info on VERP
133
+ * @type boolean
134
+ */
135
+ public $do_verp = false;
136
+
137
+ /**
138
+ * The timeout value for connection, in seconds.
139
+ * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
140
+ * This needs to be quite high to function correctly with hosts using greetdelay as an anti-spam measure.
141
+ * @link http://tools.ietf.org/html/rfc2821#section-4.5.3.2
142
+ * @type integer
143
+ */
144
+ public $Timeout = 300;
145
+
146
+ /**
147
+ * How long to wait for commands to complete, in seconds.
148
+ * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
149
+ * @type integer
150
+ */
151
+ public $Timelimit = 300;
152
+
153
+ /**
154
+ * The socket for the server connection.
155
+ * @type resource
156
+ */
157
+ protected $smtp_conn;
158
+
159
+ /**
160
+ * Error information, if any, for the last SMTP command.
161
+ * @type array
162
+ */
163
+ protected $error = array(
164
+ 'error' => '',
165
+ 'detail' => '',
166
+ 'smtp_code' => '',
167
+ 'smtp_code_ex' => ''
168
+ );
169
+
170
+ /**
171
+ * The reply the server sent to us for HELO.
172
+ * If null, no HELO string has yet been received.
173
+ * @type string|null
174
+ */
175
+ protected $helo_rply = null;
176
+
177
+ /**
178
+ * The set of SMTP extensions sent in reply to EHLO command.
179
+ * Indexes of the array are extension names.
180
+ * Value at index 'HELO' or 'EHLO' (according to command that was sent)
181
+ * represents the server name. In case of HELO it is the only element of the array.
182
+ * Other values can be boolean TRUE or an array containing extension options.
183
+ * If null, no HELO/EHLO string has yet been received.
184
+ * @type array|null
185
+ */
186
+ protected $server_caps = null;
187
+
188
+ /**
189
+ * The most recent reply received from the server.
190
+ * @type string
191
+ */
192
+ protected $last_reply = '';
193
+
194
+ /**
195
+ * Output debugging info via a user-selected method.
196
+ * @see SMTP::$Debugoutput
197
+ * @see SMTP::$do_debug
198
+ * @param string $str Debug string to output
199
+ * @param integer $level The debug level of this message; see DEBUG_* constants
200
+ * @return void
201
+ */
202
+ protected function edebug($str, $level = 0)
203
+ {
204
+ if ($level > $this->do_debug) {
205
+ return;
206
+ }
207
+ //Avoid clash with built-in function names
208
+ if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) {
209
+ call_user_func($this->Debugoutput, $str, $this->do_debug);
210
+ return;
211
+ }
212
+ switch ($this->Debugoutput) {
213
+ case 'error_log':
214
+ //Don't output, just log
215
+ error_log($str);
216
+ break;
217
+ case 'html':
218
+ //Cleans up output a bit for a better looking, HTML-safe output
219
+ echo htmlentities(
220
+ preg_replace('/[\r\n]+/', '', $str),
221
+ ENT_QUOTES,
222
+ 'UTF-8'
223
+ )
224
+ . "<br>\n";
225
+ break;
226
+ case 'echo':
227
+ default:
228
+ //Normalize line breaks
229
+ $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str);
230
+ echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
231
+ "\n",
232
+ "\n \t ",
233
+ trim($str)
234
+ )."\n";
235
+ }
236
+ }
237
+
238
+ /**
239
+ * Connect to an SMTP server.
240
+ * @param string $host SMTP server IP or host name
241
+ * @param integer $port The port number to connect to
242
+ * @param integer $timeout How long to wait for the connection to open
243
+ * @param array $options An array of options for stream_context_create()
244
+ * @access public
245
+ * @return boolean
246
+ */
247
+ public function connect($host, $port = null, $timeout = 30, $options = array())
248
+ {
249
+ static $streamok;
250
+ //This is enabled by default since 5.0.0 but some providers disable it
251
+ //Check this once and cache the result
252
+ if (is_null($streamok)) {
253
+ $streamok = function_exists('stream_socket_client');
254
+ }
255
+ // Clear errors to avoid confusion
256
+ $this->setError('');
257
+ // Make sure we are __not__ connected
258
+ if ($this->connected()) {
259
+ // Already connected, generate error
260
+ $this->setError('Already connected to a server');
261
+ return false;
262
+ }
263
+ if (empty($port)) {
264
+ $port = self::DEFAULT_SMTP_PORT;
265
+ }
266
+ // Connect to the SMTP server
267
+ $this->edebug(
268
+ "Connection: opening to $host:$port, timeout=$timeout, options=".var_export($options, true),
269
+ self::DEBUG_CONNECTION
270
+ );
271
+ $errno = 0;
272
+ $errstr = '';
273
+ if ($streamok) {
274
+ $socket_context = stream_context_create($options);
275
+ //Suppress errors; connection failures are handled at a higher level
276
+ $this->smtp_conn = @stream_socket_client(
277
+ $host . ":" . $port,
278
+ $errno,
279
+ $errstr,
280
+ $timeout,
281
+ STREAM_CLIENT_CONNECT,
282
+ $socket_context
283
+ );
284
+ } else {
285
+ //Fall back to fsockopen which should work in more places, but is missing some features
286
+ $this->edebug(
287
+ "Connection: stream_socket_client not available, falling back to fsockopen",
288
+ self::DEBUG_CONNECTION
289
+ );
290
+ $this->smtp_conn = fsockopen(
291
+ $host,
292
+ $port,
293
+ $errno,
294
+ $errstr,
295
+ $timeout
296
+ );
297
+ }
298
+ // Verify we connected properly
299
+ if (!is_resource($this->smtp_conn)) {
300
+ $this->setError(
301
+ 'Failed to connect to server',
302
+ $errno,
303
+ $errstr
304
+ );
305
+ $this->edebug(
306
+ 'SMTP ERROR: ' . $this->error['error']
307
+ . ": $errstr ($errno)",
308
+ self::DEBUG_CLIENT
309
+ );
310
+ return false;
311
+ }
312
+ $this->edebug('Connection: opened', self::DEBUG_CONNECTION);
313
+ // SMTP server can take longer to respond, give longer timeout for first read
314
+ // Windows does not have support for this timeout function
315
+ if (substr(PHP_OS, 0, 3) != 'WIN') {
316
+ $max = ini_get('max_execution_time');
317
+ // Don't bother if unlimited
318
+ if ($max != 0 && $timeout > $max) {
319
+ @set_time_limit($timeout);
320
+ }
321
+ stream_set_timeout($this->smtp_conn, $timeout, 0);
322
+ }
323
+ // Get any announcement
324
+ $announce = $this->get_lines();
325
+ $this->edebug('SERVER -> CLIENT: ' . $announce, self::DEBUG_SERVER);
326
+ return true;
327
+ }
328
+
329
+ /**
330
+ * Initiate a TLS (encrypted) session.
331
+ * @access public
332
+ * @return boolean
333
+ */
334
+ public function startTLS()
335
+ {
336
+ if (!$this->sendCommand('STARTTLS', 'STARTTLS', 220)) {
337
+ return false;
338
+ }
339
+ // Begin encrypted connection
340
+ if (!stream_socket_enable_crypto(
341
+ $this->smtp_conn,
342
+ true,
343
+ STREAM_CRYPTO_METHOD_TLS_CLIENT
344
+ )) {
345
+ return false;
346
+ }
347
+ return true;
348
+ }
349
+
350
+ /**
351
+ * Perform SMTP authentication.
352
+ * Must be run after hello().
353
+ * @see hello()
354
+ * @param string $username The user name
355
+ * @param string $password The password
356
+ * @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5)
357
+ * @param string $realm The auth realm for NTLM
358
+ * @param string $workstation The auth workstation for NTLM
359
+ * @access public
360
+ * @return boolean True if successfully authenticated.
361
+ */
362
+ public function authenticate(
363
+ $username,
364
+ $password,
365
+ $authtype = null,
366
+ $realm = '',
367
+ $workstation = ''
368
+ ) {
369
+ if (!$this->server_caps) {
370
+ $this->setError('Authentication is not allowed before HELO/EHLO');
371
+ return false;
372
+ }
373
+
374
+ if (array_key_exists('EHLO', $this->server_caps)) {
375
+ // SMTP extensions are available. Let's try to find a proper authentication method
376
+
377
+ if (!array_key_exists('AUTH', $this->server_caps)) {
378
+ $this->setError('Authentication is not allowed at this stage');
379
+ // 'at this stage' means that auth may be allowed after the stage changes
380
+ // e.g. after STARTTLS
381
+ return false;
382
+ }
383
+
384
+ self::edebug('Auth method requested: ' . ($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL);
385
+ self::edebug(
386
+ 'Auth methods available on the server: ' . implode(',', $this->server_caps['AUTH']),
387
+ self::DEBUG_LOWLEVEL
388
+ );
389
+
390
+ if (empty($authtype)) {
391
+ foreach (array('LOGIN', 'CRAM-MD5', 'NTLM', 'PLAIN') as $method) {
392
+ if (in_array($method, $this->server_caps['AUTH'])) {
393
+ $authtype = $method;
394
+ break;
395
+ }
396
+ }
397
+ if (empty($authtype)) {
398
+ $this->setError('No supported authentication methods found');
399
+ return false;
400
+ }
401
+ self::edebug('Auth method selected: '.$authtype, self::DEBUG_LOWLEVEL);
402
+ }
403
+
404
+ if (!in_array($authtype, $this->server_caps['AUTH'])) {
405
+ $this->setError("The requested authentication method \"$authtype\" is not supported by the server");
406
+ return false;
407
+ }
408
+ } elseif (empty($authtype)) {
409
+ $authtype = 'LOGIN';
410
+ }
411
+ switch ($authtype) {
412
+ case 'PLAIN':
413
+ // Start authentication
414
+ if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) {
415
+ return false;
416
+ }
417
+ // Send encoded username and password
418
+ if (!$this->sendCommand(
419
+ 'User & Password',
420
+ base64_encode("\0" . $username . "\0" . $password),
421
+ 235
422
+ )
423
+ ) {
424
+ return false;
425
+ }
426
+ break;
427
+ case 'LOGIN':
428
+ // Start authentication
429
+ if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) {
430
+ return false;
431
+ }
432
+ if (!$this->sendCommand("Username", base64_encode($username), 334)) {
433
+ return false;
434
+ }
435
+ if (!$this->sendCommand("Password", base64_encode($password), 235)) {
436
+ return false;
437
+ }
438
+ break;
439
+ case 'NTLM':
440
+ /*
441
+ * ntlm_sasl_client.php
442
+ * Bundled with Permission
443
+ *
444
+ * How to telnet in windows:
445
+ * http://technet.microsoft.com/en-us/library/aa995718%28EXCHG.65%29.aspx
446
+ * PROTOCOL Docs http://curl.haxx.se/rfc/ntlm.html#ntlmSmtpAuthentication
447
+ */
448
+ require_once 'extras/ntlm_sasl_client.php';
449
+ $temp = new stdClass;
450
+ $ntlm_client = new ntlm_sasl_client_class;
451
+ //Check that functions are available
452
+ if (!$ntlm_client->Initialize($temp)) {
453
+ $this->setError($temp->error);
454
+ $this->edebug(
455
+ 'You need to enable some modules in your php.ini file: '
456
+ . $this->error['error'],
457
+ self::DEBUG_CLIENT
458
+ );
459
+ return false;
460
+ }
461
+ //msg1
462
+ $msg1 = $ntlm_client->TypeMsg1($realm, $workstation); //msg1
463
+
464
+ if (!$this->sendCommand(
465
+ 'AUTH NTLM',
466
+ 'AUTH NTLM ' . base64_encode($msg1),
467
+ 334
468
+ )
469
+ ) {
470
+ return false;
471
+ }
472
+ //Though 0 based, there is a white space after the 3 digit number
473
+ //msg2
474
+ $challenge = substr($this->last_reply, 3);
475
+ $challenge = base64_decode($challenge);
476
+ $ntlm_res = $ntlm_client->NTLMResponse(
477
+ substr($challenge, 24, 8),
478
+ $password
479
+ );
480
+ //msg3
481
+ $msg3 = $ntlm_client->TypeMsg3(
482
+ $ntlm_res,
483
+ $username,
484
+ $realm,
485
+ $workstation
486
+ );
487
+ // send encoded username
488
+ return $this->sendCommand('Username', base64_encode($msg3), 235);
489
+ case 'CRAM-MD5':
490
+ // Start authentication
491
+ if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) {
492
+ return false;
493
+ }
494
+ // Get the challenge
495
+ $challenge = base64_decode(substr($this->last_reply, 4));
496
+
497
+ // Build the response
498
+ $response = $username . ' ' . $this->hmac($challenge, $password);
499
+
500
+ // send encoded credentials
501
+ return $this->sendCommand('Username', base64_encode($response), 235);
502
+ default:
503
+ $this->setError("Authentication method \"$authtype\" is not supported");
504
+ return false;
505
+ }
506
+ return true;
507
+ }
508
+
509
+ /**
510
+ * Calculate an MD5 HMAC hash.
511
+ * Works like hash_hmac('md5', $data, $key)
512
+ * in case that function is not available
513
+ * @param string $data The data to hash
514
+ * @param string $key The key to hash with
515
+ * @access protected
516
+ * @return string
517
+ */
518
+ protected function hmac($data, $key)
519
+ {
520
+ if (function_exists('hash_hmac')) {
521
+ return hash_hmac('md5', $data, $key);
522
+ }
523
+
524
+ // The following borrowed from
525
+ // http://php.net/manual/en/function.mhash.php#27225
526
+
527
+ // RFC 2104 HMAC implementation for php.
528
+ // Creates an md5 HMAC.
529
+ // Eliminates the need to install mhash to compute a HMAC
530
+ // by Lance Rushing
531
+
532
+ $bytelen = 64; // byte length for md5
533
+ if (strlen($key) > $bytelen) {
534
+ $key = pack('H*', md5($key));
535
+ }
536
+ $key = str_pad($key, $bytelen, chr(0x00));
537
+ $ipad = str_pad('', $bytelen, chr(0x36));
538
+ $opad = str_pad('', $bytelen, chr(0x5c));
539
+ $k_ipad = $key ^ $ipad;
540
+ $k_opad = $key ^ $opad;
541
+
542
+ return md5($k_opad . pack('H*', md5($k_ipad . $data)));
543
+ }
544
+
545
+ /**
546
+ * Check connection state.
547
+ * @access public
548
+ * @return boolean True if connected.
549
+ */
550
+ public function connected()
551
+ {
552
+ if (is_resource($this->smtp_conn)) {
553
+ $sock_status = stream_get_meta_data($this->smtp_conn);
554
+ if ($sock_status['eof']) {
555
+ // The socket is valid but we are not connected
556
+ $this->edebug(
557
+ 'SMTP NOTICE: EOF caught while checking if connected',
558
+ self::DEBUG_CLIENT
559
+ );
560
+ $this->close();
561
+ return false;
562
+ }
563
+ return true; // everything looks good
564
+ }
565
+ return false;
566
+ }
567
+
568
+ /**
569
+ * Close the socket and clean up the state of the class.
570
+ * Don't use this function without first trying to use QUIT.
571
+ * @see quit()
572
+ * @access public
573
+ * @return void
574
+ */
575
+ public function close()
576
+ {
577
+ $this->setError('');
578
+ $this->server_caps = null;
579
+ $this->helo_rply = null;
580
+ if (is_resource($this->smtp_conn)) {
581
+ // close the connection and cleanup
582
+ fclose($this->smtp_conn);
583
+ $this->smtp_conn = null; //Makes for cleaner serialization
584
+ $this->edebug('Connection: closed', self::DEBUG_CONNECTION);
585
+ }
586
+ }
587
+
588
+ /**
589
+ * Send an SMTP DATA command.
590
+ * Issues a data command and sends the msg_data to the server,
591
+ * finializing the mail transaction. $msg_data is the message
592
+ * that is to be send with the headers. Each header needs to be
593
+ * on a single line followed by a <CRLF> with the message headers
594
+ * and the message body being separated by and additional <CRLF>.
595
+ * Implements rfc 821: DATA <CRLF>
596
+ * @param string $msg_data Message data to send
597
+ * @access public
598
+ * @return boolean
599
+ */
600
+ public function data($msg_data)
601
+ {
602
+ //This will use the standard timelimit
603
+ if (!$this->sendCommand('DATA', 'DATA', 354)) {
604
+ return false;
605
+ }
606
+
607
+ /* The server is ready to accept data!
608
+ * According to rfc821 we should not send more than 1000 characters on a single line (including the CRLF)
609
+ * so we will break the data up into lines by \r and/or \n then if needed we will break each of those into
610
+ * smaller lines to fit within the limit.
611
+ * We will also look for lines that start with a '.' and prepend an additional '.'.
612
+ * NOTE: this does not count towards line-length limit.
613
+ */
614
+
615
+ // Normalize line breaks before exploding
616
+ $lines = explode("\n", str_replace(array("\r\n", "\r"), "\n", $msg_data));
617
+
618
+ /* To distinguish between a complete RFC822 message and a plain message body, we check if the first field
619
+ * of the first line (':' separated) does not contain a space then it _should_ be a header and we will
620
+ * process all lines before a blank line as headers.
621
+ */
622
+
623
+ $field = substr($lines[0], 0, strpos($lines[0], ':'));
624
+ $in_headers = false;
625
+ if (!empty($field) && strpos($field, ' ') === false) {
626
+ $in_headers = true;
627
+ }
628
+
629
+ foreach ($lines as $line) {
630
+ $lines_out = array();
631
+ if ($in_headers and $line == '') {
632
+ $in_headers = false;
633
+ }
634
+ //Break this line up into several smaller lines if it's too long
635
+ //Micro-optimisation: isset($str[$len]) is faster than (strlen($str) > $len),
636
+ while (isset($line[self::MAX_LINE_LENGTH])) {
637
+ //Working backwards, try to find a space within the last MAX_LINE_LENGTH chars of the line to break on
638
+ //so as to avoid breaking in the middle of a word
639
+ $pos = strrpos(substr($line, 0, self::MAX_LINE_LENGTH), ' ');
640
+ //Deliberately matches both false and 0
641
+ if (!$pos) {
642
+ //No nice break found, add a hard break
643
+ $pos = self::MAX_LINE_LENGTH - 1;
644
+ $lines_out[] = substr($line, 0, $pos);
645
+ $line = substr($line, $pos);
646
+ } else {
647
+ //Break at the found point
648
+ $lines_out[] = substr($line, 0, $pos);
649
+ //Move along by the amount we dealt with
650
+ $line = substr($line, $pos + 1);
651
+ }
652
+ //If processing headers add a LWSP-char to the front of new line RFC822 section 3.1.1
653
+ if ($in_headers) {
654
+ $line = "\t" . $line;
655
+ }
656
+ }
657
+ $lines_out[] = $line;
658
+
659
+ //Send the lines to the server
660
+ foreach ($lines_out as $line_out) {
661
+ //RFC2821 section 4.5.2
662
+ if (!empty($line_out) and $line_out[0] == '.') {
663
+ $line_out = '.' . $line_out;
664
+ }
665
+ $this->client_send($line_out . self::CRLF);
666
+ }
667
+ }
668
+
669
+ //Message data has been sent, complete the command
670
+ //Increase timelimit for end of DATA command
671
+ $savetimelimit = $this->Timelimit;
672
+ $this->Timelimit = $this->Timelimit * 2;
673
+ $result = $this->sendCommand('DATA END', '.', 250);
674
+ //Restore timelimit
675
+ $this->Timelimit = $savetimelimit;
676
+ return $result;
677
+ }
678
+
679
+ /**
680
+ * Send an SMTP HELO or EHLO command.
681
+ * Used to identify the sending server to the receiving server.
682
+ * This makes sure that client and server are in a known state.
683
+ * Implements RFC 821: HELO <SP> <domain> <CRLF>
684
+ * and RFC 2821 EHLO.
685
+ * @param string $host The host name or IP to connect to
686
+ * @access public
687
+ * @return boolean
688
+ */
689
+ public function hello($host = '')
690
+ {
691
+ //Try extended hello first (RFC 2821)
692
+ return (boolean)($this->sendHello('EHLO', $host) or $this->sendHello('HELO', $host));
693
+ }
694
+
695
+ /**
696
+ * Send an SMTP HELO or EHLO command.
697
+ * Low-level implementation used by hello()
698
+ * @see hello()
699
+ * @param string $hello The HELO string
700
+ * @param string $host The hostname to say we are
701
+ * @access protected
702
+ * @return boolean
703
+ */
704
+ protected function sendHello($hello, $host)
705
+ {
706
+ $noerror = $this->sendCommand($hello, $hello . ' ' . $host, 250);
707
+ $this->helo_rply = $this->last_reply;
708
+ if ($noerror) {
709
+ $this->parseHelloFields($hello);
710
+ } else {
711
+ $this->server_caps = null;
712
+ }
713
+ return $noerror;
714
+ }
715
+
716
+ /**
717
+ * Parse a reply to HELO/EHLO command to discover server extensions.
718
+ * In case of HELO, the only parameter that can be discovered is a server name.
719
+ * @access protected
720
+ * @param string $type - 'HELO' or 'EHLO'
721
+ */
722
+ protected function parseHelloFields($type)
723
+ {
724
+ $this->server_caps = array();
725
+ $lines = explode("\n", $this->last_reply);
726
+ foreach ($lines as $n => $s) {
727
+ $s = trim(substr($s, 4));
728
+ if (!$s) {
729
+ continue;
730
+ }
731
+ $fields = explode(' ', $s);
732
+ if (!empty($fields)) {
733
+ if (!$n) {
734
+ $name = $type;
735
+ $fields = $fields[0];
736
+ } else {
737
+ $name = array_shift($fields);
738
+ if ($name == 'SIZE') {
739
+ $fields = ($fields) ? $fields[0] : 0;
740
+ }
741
+ }
742
+ $this->server_caps[$name] = ($fields ? $fields : true);
743
+ }
744
+ }
745
+ }
746
+
747
+ /**
748
+ * Send an SMTP MAIL command.
749
+ * Starts a mail transaction from the email address specified in
750
+ * $from. Returns true if successful or false otherwise. If True
751
+ * the mail transaction is started and then one or more recipient
752
+ * commands may be called followed by a data command.
753
+ * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
754
+ * @param string $from Source address of this message
755
+ * @access public
756
+ * @return boolean
757
+ */
758
+ public function mail($from)
759
+ {
760
+ $useVerp = ($this->do_verp ? ' XVERP' : '');
761
+ return $this->sendCommand(
762
+ 'MAIL FROM',
763
+ 'MAIL FROM:<' . $from . '>' . $useVerp,
764
+ 250
765
+ );
766
+ }
767
+
768
+ /**
769
+ * Send an SMTP QUIT command.
770
+ * Closes the socket if there is no error or the $close_on_error argument is true.
771
+ * Implements from rfc 821: QUIT <CRLF>
772
+ * @param boolean $close_on_error Should the connection close if an error occurs?
773
+ * @access public
774
+ * @return boolean
775
+ */
776
+ public function quit($close_on_error = true)
777
+ {
778
+ $noerror = $this->sendCommand('QUIT', 'QUIT', 221);
779
+ $err = $this->error; //Save any error
780
+ if ($noerror or $close_on_error) {
781
+ $this->close();
782
+ $this->error = $err; //Restore any error from the quit command
783
+ }
784
+ return $noerror;
785
+ }
786
+
787
+ /**
788
+ * Send an SMTP RCPT command.
789
+ * Sets the TO argument to $toaddr.
790
+ * Returns true if the recipient was accepted false if it was rejected.
791
+ * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
792
+ * @param string $toaddr The address the message is being sent to
793
+ * @access public
794
+ * @return boolean
795
+ */
796
+ public function recipient($toaddr)
797
+ {
798
+ return $this->sendCommand(
799
+ 'RCPT TO',
800
+ 'RCPT TO:<' . $toaddr . '>',
801
+ array(250, 251)
802
+ );
803
+ }
804
+
805
+ /**
806
+ * Send an SMTP RSET command.
807
+ * Abort any transaction that is currently in progress.
808
+ * Implements rfc 821: RSET <CRLF>
809
+ * @access public
810
+ * @return boolean True on success.
811
+ */
812
+ public function reset()
813
+ {
814
+ return $this->sendCommand('RSET', 'RSET', 250);
815
+ }
816
+
817
+ /**
818
+ * Send a command to an SMTP server and check its return code.
819
+ * @param string $command The command name - not sent to the server
820
+ * @param string $commandstring The actual command to send
821
+ * @param integer|array $expect One or more expected integer success codes
822
+ * @access protected
823
+ * @return boolean True on success.
824
+ */
825
+ protected function sendCommand($command, $commandstring, $expect)
826
+ {
827
+ if (!$this->connected()) {
828
+ $this->setError("Called $command without being connected");
829
+ return false;
830
+ }
831
+ $this->client_send($commandstring . self::CRLF);
832
+
833
+ $this->last_reply = $this->get_lines();
834
+ // Fetch SMTP code and possible error code explanation
835
+ $matches = array();
836
+ if (preg_match("/^([0-9]{3})[ -](?:([0-9]\\.[0-9]\\.[0-9]) )?/", $this->last_reply, $matches)) {
837
+ $code = $matches[1];
838
+ $code_ex = (count($matches) > 2 ? $matches[2] : null);
839
+ // Cut off error code from each response line
840
+ $detail = preg_replace(
841
+ "/{$code}[ -]".($code_ex ? str_replace('.', '\\.', $code_ex).' ' : '')."/m",
842
+ '',
843
+ $this->last_reply
844
+ );
845
+ } else {
846
+ // Fall back to simple parsing if regex fails
847
+ $code = substr($this->last_reply, 0, 3);
848
+ $code_ex = null;
849
+ $detail = substr($this->last_reply, 4);
850
+ }
851
+
852
+ $this->edebug('SERVER -> CLIENT: ' . $this->last_reply, self::DEBUG_SERVER);
853
+
854
+ if (!in_array($code, (array)$expect)) {
855
+ $this->setError(
856
+ "$command command failed",
857
+ $detail,
858
+ $code,
859
+ $code_ex
860
+ );
861
+ $this->edebug(
862
+ 'SMTP ERROR: ' . $this->error['error'] . ': ' . $this->last_reply,
863
+ self::DEBUG_CLIENT
864
+ );
865
+ return false;
866
+ }
867
+
868
+ $this->setError('');
869
+ return true;
870
+ }
871
+
872
+ /**
873
+ * Send an SMTP SAML command.
874
+ * Starts a mail transaction from the email address specified in $from.
875
+ * Returns true if successful or false otherwise. If True
876
+ * the mail transaction is started and then one or more recipient
877
+ * commands may be called followed by a data command. This command
878
+ * will send the message to the users terminal if they are logged
879
+ * in and send them an email.
880
+ * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
881
+ * @param string $from The address the message is from
882
+ * @access public
883
+ * @return boolean
884
+ */
885
+ public function sendAndMail($from)
886
+ {
887
+ return $this->sendCommand('SAML', "SAML FROM:$from", 250);
888
+ }
889
+
890
+ /**
891
+ * Send an SMTP VRFY command.
892
+ * @param string $name The name to verify
893
+ * @access public
894
+ * @return boolean
895
+ */
896
+ public function verify($name)
897
+ {
898
+ return $this->sendCommand('VRFY', "VRFY $name", array(250, 251));
899
+ }
900
+
901
+ /**
902
+ * Send an SMTP NOOP command.
903
+ * Used to keep keep-alives alive, doesn't actually do anything
904
+ * @access public
905
+ * @return boolean
906
+ */
907
+ public function noop()
908
+ {
909
+ return $this->sendCommand('NOOP', 'NOOP', 250);
910
+ }
911
+
912
+ /**
913
+ * Send an SMTP TURN command.
914
+ * This is an optional command for SMTP that this class does not support.
915
+ * This method is here to make the RFC821 Definition complete for this class
916
+ * and _may_ be implemented in future
917
+ * Implements from rfc 821: TURN <CRLF>
918
+ * @access public
919
+ * @return boolean
920
+ */
921
+ public function turn()
922
+ {
923
+ $this->setError('The SMTP TURN command is not implemented');
924
+ $this->edebug('SMTP NOTICE: ' . $this->error['error'], self::DEBUG_CLIENT);
925
+ return false;
926
+ }
927
+
928
+ /**
929
+ * Send raw data to the server.
930
+ * @param string $data The data to send
931
+ * @access public
932
+ * @return integer|boolean The number of bytes sent to the server or false on error
933
+ */
934
+ public function client_send($data)
935
+ {
936
+ $this->edebug("CLIENT -> SERVER: $data", self::DEBUG_CLIENT);
937
+ return fwrite($this->smtp_conn, $data);
938
+ }
939
+
940
+ /**
941
+ * Get the latest error.
942
+ * @access public
943
+ * @return array
944
+ */
945
+ public function getError()
946
+ {
947
+ return $this->error;
948
+ }
949
+
950
+ /**
951
+ * Get SMTP extensions available on the server
952
+ * @access public
953
+ * @return array|null
954
+ */
955
+ public function getServerExtList()
956
+ {
957
+ return $this->server_caps;
958
+ }
959
+
960
+ /**
961
+ * A multipurpose method
962
+ * The method works in three ways, dependent on argument value and current state
963
+ * 1. HELO/EHLO was not sent - returns null and set up $this->error
964
+ * 2. HELO was sent
965
+ * $name = 'HELO': returns server name
966
+ * $name = 'EHLO': returns boolean false
967
+ * $name = any string: returns null and set up $this->error
968
+ * 3. EHLO was sent
969
+ * $name = 'HELO'|'EHLO': returns server name
970
+ * $name = any string: if extension $name exists, returns boolean True
971
+ * or its options. Otherwise returns boolean False
972
+ * In other words, one can use this method to detect 3 conditions:
973
+ * - null returned: handshake was not or we don't know about ext (refer to $this->error)
974
+ * - false returned: the requested feature exactly not exists
975
+ * - positive value returned: the requested feature exists
976
+ * @param string $name Name of SMTP extension or 'HELO'|'EHLO'
977
+ * @return mixed
978
+ */
979
+ public function getServerExt($name)
980
+ {
981
+ if (!$this->server_caps) {
982
+ $this->setError('No HELO/EHLO was sent');
983
+ return null;
984
+ }
985
+
986
+ // the tight logic knot ;)
987
+ if (!array_key_exists($name, $this->server_caps)) {
988
+ if ($name == 'HELO') {
989
+ return $this->server_caps['EHLO'];
990
+ }
991
+ if ($name == 'EHLO' || array_key_exists('EHLO', $this->server_caps)) {
992
+ return false;
993
+ }
994
+ $this->setError('HELO handshake was used. Client knows nothing about server extensions');
995
+ return null;
996
+ }
997
+
998
+ return $this->server_caps[$name];
999
+ }
1000
+
1001
+ /**
1002
+ * Get the last reply from the server.
1003
+ * @access public
1004
+ * @return string
1005
+ */
1006
+ public function getLastReply()
1007
+ {
1008
+ return $this->last_reply;
1009
+ }
1010
+
1011
+ /**
1012
+ * Read the SMTP server's response.
1013
+ * Either before eof or socket timeout occurs on the operation.
1014
+ * With SMTP we can tell if we have more lines to read if the
1015
+ * 4th character is '-' symbol. If it is a space then we don't
1016
+ * need to read anything else.
1017
+ * @access protected
1018
+ * @return string
1019
+ */
1020
+ protected function get_lines()
1021
+ {
1022
+ // If the connection is bad, give up straight away
1023
+ if (!is_resource($this->smtp_conn)) {
1024
+ return '';
1025
+ }
1026
+ $data = '';
1027
+ $endtime = 0;
1028
+ stream_set_timeout($this->smtp_conn, $this->Timeout);
1029
+ if ($this->Timelimit > 0) {
1030
+ $endtime = time() + $this->Timelimit;
1031
+ }
1032
+ while (is_resource($this->smtp_conn) && !feof($this->smtp_conn)) {
1033
+ $str = @fgets($this->smtp_conn, 515);
1034
+ $this->edebug("SMTP -> get_lines(): \$data was \"$data\"", self::DEBUG_LOWLEVEL);
1035
+ $this->edebug("SMTP -> get_lines(): \$str is \"$str\"", self::DEBUG_LOWLEVEL);
1036
+ $data .= $str;
1037
+ $this->edebug("SMTP -> get_lines(): \$data is \"$data\"", self::DEBUG_LOWLEVEL);
1038
+ // If 4th character is a space, we are done reading, break the loop, micro-optimisation over strlen
1039
+ if ((isset($str[3]) and $str[3] == ' ')) {
1040
+ break;
1041
+ }
1042
+ // Timed-out? Log and break
1043
+ $info = stream_get_meta_data($this->smtp_conn);
1044
+ if ($info['timed_out']) {
1045
+ $this->edebug(
1046
+ 'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)',
1047
+ self::DEBUG_LOWLEVEL
1048
+ );
1049
+ break;
1050
+ }
1051
+ // Now check if reads took too long
1052
+ if ($endtime and time() > $endtime) {
1053
+ $this->edebug(
1054
+ 'SMTP -> get_lines(): timelimit reached ('.
1055
+ $this->Timelimit . ' sec)',
1056
+ self::DEBUG_LOWLEVEL
1057
+ );
1058
+ break;
1059
+ }
1060
+ }
1061
+ return $data;
1062
+ }
1063
+
1064
+ /**
1065
+ * Enable or disable VERP address generation.
1066
+ * @param boolean $enabled
1067
+ */
1068
+ public function setVerp($enabled = false)
1069
+ {
1070
+ $this->do_verp = $enabled;
1071
+ }
1072
+
1073
+ /**
1074
+ * Get VERP address generation mode.
1075
+ * @return boolean
1076
+ */
1077
+ public function getVerp()
1078
+ {
1079
+ return $this->do_verp;
1080
+ }
1081
+
1082
+ /**
1083
+ * Set error messages and codes.
1084
+ * @param string $message The error message
1085
+ * @param string $detail Further detail on the error
1086
+ * @param string $smtp_code An associated SMTP error code
1087
+ * @param string $smtp_code_ex Extended SMTP code
1088
+ */
1089
+ protected function setError($message, $detail = '', $smtp_code = '', $smtp_code_ex = '')
1090
+ {
1091
+ $this->error = array(
1092
+ 'error' => $message,
1093
+ 'detail' => $detail,
1094
+ 'smtp_code' => $smtp_code,
1095
+ 'smtp_code_ex' => $smtp_code_ex
1096
+ );
1097
+ }
1098
+
1099
+ /**
1100
+ * Set debug output method.
1101
+ * @param string|callable $method The name of the mechanism to use for debugging output, or a callable to handle it.
1102
+ */
1103
+ public function setDebugOutput($method = 'echo')
1104
+ {
1105
+ $this->Debugoutput = $method;
1106
+ }
1107
+
1108
+ /**
1109
+ * Get debug output method.
1110
+ * @return string
1111
+ */
1112
+ public function getDebugOutput()
1113
+ {
1114
+ return $this->Debugoutput;
1115
+ }
1116
+
1117
+ /**
1118
+ * Set debug output level.
1119
+ * @param integer $level
1120
+ */
1121
+ public function setDebugLevel($level = 0)
1122
+ {
1123
+ $this->do_debug = $level;
1124
+ }
1125
+
1126
+ /**
1127
+ * Get debug output level.
1128
+ * @return integer
1129
+ */
1130
+ public function getDebugLevel()
1131
+ {
1132
+ return $this->do_debug;
1133
+ }
1134
+
1135
+ /**
1136
+ * Set SMTP timeout.
1137
+ * @param integer $timeout
1138
+ */
1139
+ public function setTimeout($timeout = 0)
1140
+ {
1141
+ $this->Timeout = $timeout;
1142
+ }
1143
+
1144
+ /**
1145
+ * Get SMTP timeout.
1146
+ * @return integer
1147
+ */
1148
+ public function getTimeout()
1149
+ {
1150
+ return $this->Timeout;
1151
+ }
1152
+ }
social_media.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+ ?>
socialmedia.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //-------------------------------DB Connection------------------------------------------------//
3
+ require_once($_POST['mage_find']);
4
+ Mage::init();
5
+ $db = Mage::helper("greenmodule")->dbconnection();
6
+ //-------------------------------End DB Connection------------------------------------------------//
7
+
8
+ $fbapi = $_POST['fbkey'];
9
+ $_POST['mage_find'];
10
+
11
+ $read4 = Mage::getSingleton('core/resource')->getConnection('core_read') ;
12
+ $write4 = Mage::getSingleton('core/resource')->getConnection('core_write');
13
+ $result5 = $read4->fetchAll("SELECT * FROM Abandon_social_media_login");
14
+
15
+ echo $base_url = $result5['0']['social_id'];
16
+ if($base_url=="")
17
+ {
18
+
19
+ echo $insert_abandon = 'insert into Abandon_social_media_login (provider,oauth_token) values("social_media","'.$fbapi.'") ';
20
+ $update_exc = mysql_query($insert_abandon);
21
+ echo 'Successfully updated';
22
+ }
23
+ else
24
+ {
25
+ echo $insert_abandon = 'update Abandon_social_media_login set oauth_token = "'.$fbapi.'" where social_id="1"';
26
+ $update_exc = mysql_query($insert_abandon);
27
+ echo 'Successfully updated';
28
+
29
+ }
30
+
31
+ ?>
subscribe.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once($_POST['mage_find']);
3
+ Mage::init();
4
+ $db = Mage::helper("greenmodule")->dbconnection();
5
+ //-------------------------------End DB Connection------------------------------------------------//
6
+ //echo json_encode(array('email_id'=> $request));
7
+ $req=json_decode($request->responseBody,true);
8
+ $req_encode = json_encode(array('data'=> $request));
9
+ //print_r($req_encode);
10
+ //print_r($req);
11
+
12
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read') ;
13
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
14
+ $subscription_status = $read_data->fetchall("SELECT * FROM Abandoned_email_subscription where customer_id ='".$_POST['customer_id']."'");
15
+ if($subscription_status['0']['customer_id']==$_POST['customer_id'])
16
+
17
+ {
18
+ $sql = "update Abandoned_email_subscription set subscribe_status ='yes' where customer_id ='".$_POST['customer_id']."'";
19
+ $exc_sql = mysql_query($sql);
20
+ print_r('You have subscibed for email alert notification');
21
+
22
+ }
23
+
24
+ ?>
unsubscribe.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once($_POST['mage_find']);
3
+ Mage::init();
4
+ $db = Mage::helper("greenmodule")->dbconnection();
5
+ //-------------------------------End DB Connection------------------------------------------------//
6
+ //echo json_encode(array('email_id'=> $request));
7
+ $req=json_decode($request->responseBody,true);
8
+ $req_encode = json_encode(array('data'=> $request));
9
+ //print_r($req_encode);
10
+ //print_r($req);
11
+
12
+
13
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read') ;
14
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
15
+ $subscription_status = $read_data->fetchall("SELECT * FROM Abandoned_email_subscription where customer_id ='".$_POST['customer_id']."'");
16
+
17
+ if(empty($subscription_status))
18
+ {
19
+ $sql = "insert into Abandoned_email_subscription (customer_id,customer_name,customer_email,subscribe_status) values('".$_POST['customer_id']."','".$_POST['customer_name']."','".$_POST['customer_email']."','no')";
20
+ $exc_sql = mysql_query($sql);
21
+ print_r('You have unsubscibed for email alert notification');
22
+
23
+ }
24
+ elseif($subscription_status['0']['subscribe_status']=="no")
25
+ {
26
+ $sql = "update Abandoned_email_subscription set subscribe_status ='yes' where customer_id ='".$_POST['customer_id']."'";
27
+ $exc_sql = mysql_query($sql);
28
+ print_r('You have subscibed for email alert notification');
29
+
30
+ }
31
+ elseif($subscription_status['0']['subscribe_status']=="yes")
32
+ {$sql = "update Abandoned_email_subscription set subscribe_status ='no' where customer_id ='".$_POST['customer_id']."'";
33
+ $exc_sql = mysql_query($sql);
34
+ print_r('You have unsubscibed for email alert notification');
35
+
36
+ }
37
+
38
+
39
+
40
+
41
+ ?>
userformupdate.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //-------------------------------DB Connection------------------------------------------------//
3
+
4
+ require_once($_POST['mage_find']);
5
+ Mage::init();
6
+ $db = Mage::helper("greenmodule")->dbconnection();
7
+
8
+ //-------------------------------End DB Connection------------------------------------------------//
9
+ $abandon_cart = "select * from abandon_cart where id ='1'";
10
+ $exc_cart = mysql_query($abandon_cart);
11
+ $fetch_data = mysql_fetch_row($exc_cart);
12
+ //print_r($fetch_data);
13
+ $status_abandon = $fetch_data['1'];
14
+ $status_day = $fetch_data['2'];
15
+
16
+
17
+
18
+ $status = $_POST['status'];
19
+ $days =$_POST['day'];
20
+ $date = date("Y-m-d H:i:s");
21
+
22
+
23
+ if($status == '0')
24
+ {
25
+
26
+ $data_update = "update abandon_cart set abandon_status ='".$status."'";
27
+ $update_exc = mysql_query($data_update);
28
+ $msg = 'Sucessfully';
29
+ echo json_encode(array('message'=>$msg));
30
+ }
31
+ elseif($status == '1')
32
+ {
33
+
34
+ $data_update = "update abandon_cart set abandon_status ='".$status."',day = '".$days."',date ='".$date."'";
35
+ $update_exc = mysql_query($data_update);
36
+ $msg = 'Sucessfully';
37
+ echo json_encode(array('message'=>$msg));
38
+
39
+ }
40
+
41
+ ?>