GraphicMailApi - Version 1.0.4

Version Notes

Release notes for users and developers

Download this release

Release Info

Developer a1professionals
Extension GraphicMailApi
Version 1.0.4
Comparing to
See all releases


Code changes from version 1.0.3 to 1.0.4

app/code/core/Mage/Customer/Model/Graphicmail.php CHANGED
@@ -1,139 +1,139 @@
1
- <?php
2
- class Mage_Customer_Model_GraphicMail extends Mage_Core_Model_Abstract{
3
- function hello(){
4
- echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
5
- }
6
- public function CreateGraphicMailUser($data){
7
- $dir=$_SERVER['DOCUMENT_ROOT'].'/CSV';
8
- if(!is_dir($dir)){
9
- mkdir($dir,755);
10
- }
11
- $filename=$dir.'/file.csv';
12
- @unlink($filename);
13
- $baseurl=(isset($_SERVER['HTTPS']) ? 'https' :'http'). '://' . $_SERVER['HTTP_HOST'];
14
- $fileurl=$baseurl.'/CSV/file.csv';
15
- if (file_exists($filename)):
16
- if(!is_writable($filename)):
17
- die ("The file: $filename is not writable");
18
- endif;
19
- elseif( !is_writable( getcwd() ) ):
20
- die("you cannot create files in this directory. Check the permissions");
21
- endif;
22
- //open the file for APPENDING
23
- //add the "t" terminator for windows
24
- //if using a mac then set the ini directive
25
- $fh = fopen($filename, "at");
26
- //Lock the file for the write operation
27
- flock($fh, LOCK_EX);
28
- //loop through the recordset
29
- //db output manipulation
30
- if(isset($data['firstname'])){
31
- $row[1]["firstname"]= $data['firstname'];
32
- $row[1]["lastname"]= $data['lastname'];
33
- }
34
- $row[1]["email"]=$data['email'];
35
- if(isset($data['address_1'])){
36
- $row[1]["company"]= @$data['company'];
37
- $row[1]["telephone"]= $data['telephone'];
38
- $row[1]["fax"]= @$data['fax'];
39
- $row[1]["address_1"]= $data['address_1'];
40
- $row[1]["address_2"]= $data['address_2'];
41
- $row[1]["city"]= $data['city'];
42
- $row[1]["state"]= $data['state'];
43
- $row[1]["zip"]= $data['zip'];
44
- $row[1]["country_id"]= $data['country_id'];
45
- }
46
- //use fputcsv by preference - we can just pass the row-array
47
- if (function_exists("fputcsv")):
48
- fputcsv($fh, $row[1], ",", "\"");
49
- else:
50
- //clean up the strings for escaping and add quotes
51
- foreach ($row[1] as $val):
52
- $b[] = '"'.addslashes($val).'"';
53
- endforeach;
54
- //comma separate the values
55
- $string = implode(",",$b);
56
- //write the data to the file
57
- fwrite($fh, $string ."\n",strlen($string));
58
- endif;
59
-
60
- //close the file handle outside the loop
61
- //this releases the lock too
62
- fclose($fh);
63
- //$user=$this->getUserDetail();
64
- if(isset($data['address_1'])){
65
- $this->editGraphicMailUser();
66
- }else{
67
- $this->registerGraphicMailUser();
68
- }
69
- }
70
-
71
- protected function sendPost($url){
72
- $ch = curl_init();
73
- curl_setopt($ch, CURLOPT_URL, $url);
74
- curl_setopt($ch, CURLOPT_HEADER, false);
75
- curl_setopt($ch, CURLOPT_NOBODY, true); // remove body
76
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
77
- $head = curl_exec($ch);
78
- $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
79
- curl_close($ch);
80
- //print_r($head) ;
81
- }
82
- protected function dataWrite(){
83
- /**
84
- * Get the resource model
85
- */
86
- $resource = Mage::getSingleton('core/resource');
87
- /**
88
- * Retrieve the write connection
89
- */
90
- $writeConnection = $resource->getConnection('core_write');
91
- return $writeConnection;
92
- }
93
- protected function dataRead(){
94
- /**
95
- * Get the resource model
96
- */
97
- $resource = Mage::getSingleton('core/resource');
98
- /**
99
- * Retrieve the read connection
100
- */
101
- $readConnection = $resource->getConnection('core_read');
102
- return $readConnection;
103
- }
104
- protected function getUserDetail(){
105
- $Connection=$this->dataRead();
106
- $query='SELECT * FROM graphic_account';
107
- $results = $Connection->fetchAll($query);
108
- return $results;
109
- }
110
- public function updateGraphicMailAccount($oldEmail){
111
- $user=$this->getUserDetail();
112
- $url="https://".$user[0]['domain']."/api.aspx?Username=".$user[0]['username']."&Password=".$user[0]['password']."&Function=post_delete_emailaddress&MailinglistID=".$user[0]['maillist_id']."&EmailAddress=".$oldEmail."&SID=0&Principal=blGnGdu9T4JLZWPAVI2D3sYSK2c9gT2Z";
113
- $this->sendPost($url);
114
- }
115
- public function subscribeGraphicMailNewsletter($email){
116
- $user=$this->getUserDetail();
117
- $url="https://".$user[0]['domain']."/api.aspx?Username=".$user[0]['username']."&Password=".$user[0]['password']."&Function=post_subscribe&Email=".$email."&MailinglistID=".$user[0]['maillist_id']."&SID=0&Principal=blGnGdu9T4JLZWPAVI2D3sYSK2c9gT2Z";
118
- $this->sendPost($url);
119
- }
120
- public function unSubscribeGraphicMailNewsletter($email){
121
- $user=$this->getUserDetail();
122
- $url="https://".$user[0]['domain']."/api.aspx?Username=".$user[0]['username']."&Password=".$user[0]['password']."&Function=post_unsubscribe&Email=".$email."&MailinglistID=".$user[0]['maillist_id']."&SID=0&Principal=blGnGdu9T4JLZWPAVI2D3sYSK2c9gT2Z";
123
- $this->sendPost($url);
124
- }
125
- public function registerGraphicMailUser(){
126
- $user=$this->getUserDetail();
127
- $baseurl=(isset($_SERVER['HTTPS']) ? 'https' :'http'). '://' . $_SERVER['HTTP_HOST'];
128
- $fileurl=$baseurl.'/CSV/file.csv';
129
- $url="https://".$user[0]['domain']."/api.aspx?Username=".$user[0]['username']."&Password=".$user[0]['password']."&Function=post_import_dataset&EmailCol=3&Col1=1&Col2=2&Col6=4&Col9=5&Col10=6&Col4=7&DatasetID=".$user[0]['dataset_id']."&MailingListID=".$user[0]['maillist_id']."&ImportMode=1&FileUrl=".$fileurl."&Principal=blGnGdu9T4JLZWPAVI2D3sYSK2c9gT2Z";
130
- $this->sendPost($url);
131
- }
132
- public function editGraphicMailUser(){
133
- $user=$this->getUserDetail();
134
- $baseurl=(isset($_SERVER['HTTPS']) ? 'https' :'http'). '://' . $_SERVER['HTTP_HOST'];
135
- $fileurl=$baseurl.'/CSV/file.csv';
136
- $url="https://".$user[0]['domain']."/api.aspx?Username=".$user[0]['username']."&Password=".$user[0]['password']."&Function=post_import_dataset&EmailCol=3&Col1=1&Col2=2&Col4=4&Col6=5&Col7=6&Col9=7&Col10=8&Col11=9&Col12=10&Col13=11&Col14=12&DatasetID=".$user[0]['dataset_id']."&MailingListID=".$user[0]['maillist_id']."&ImportMode=1&FileUrl=".$fileurl."&Principal=blGnGdu9T4JLZWPAVI2D3sYSK2c9gT2Z";
137
- $this->sendPost($url);
138
- }
139
  }
1
+ <?php
2
+ class Mage_Customer_Model_GraphicMail extends Mage_Core_Model_Abstract{
3
+ function hello(){
4
+ echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
5
+ }
6
+ public function CreateGraphicMailUser($data){
7
+ $dir=$_SERVER['DOCUMENT_ROOT'].'/CSV';
8
+ if(!is_dir($dir)){
9
+ mkdir($dir,755);
10
+ }
11
+ $filename=$dir.'/file.csv';
12
+ @unlink($filename);
13
+ $baseurl=(isset($_SERVER['HTTPS']) ? 'https' :'http'). '://' . $_SERVER['HTTP_HOST'];
14
+ $fileurl=$baseurl.'/CSV/file.csv';
15
+ if (file_exists($filename)):
16
+ if(!is_writable($filename)):
17
+ die ("The file: $filename is not writable");
18
+ endif;
19
+ elseif( !is_writable( getcwd() ) ):
20
+ die("you cannot create files in this directory. Check the permissions");
21
+ endif;
22
+ //open the file for APPENDING
23
+ //add the "t" terminator for windows
24
+ //if using a mac then set the ini directive
25
+ $fh = fopen($filename, "at");
26
+ //Lock the file for the write operation
27
+ flock($fh, LOCK_EX);
28
+ //loop through the recordset
29
+ //db output manipulation
30
+ if(isset($data['firstname'])){
31
+ $row[1]["firstname"]= $data['firstname'];
32
+ $row[1]["lastname"]= $data['lastname'];
33
+ }
34
+ $row[1]["email"]=$data['email'];
35
+ if(isset($data['address_1'])){
36
+ $row[1]["company"]= @$data['company'];
37
+ $row[1]["telephone"]= $data['telephone'];
38
+ $row[1]["fax"]= @$data['fax'];
39
+ $row[1]["address_1"]= $data['address_1'];
40
+ $row[1]["address_2"]= $data['address_2'];
41
+ $row[1]["city"]= $data['city'];
42
+ $row[1]["state"]= $data['state'];
43
+ $row[1]["zip"]= $data['zip'];
44
+ $row[1]["country_id"]= $data['country_id'];
45
+ }
46
+ //use fputcsv by preference - we can just pass the row-array
47
+ if (function_exists("fputcsv")):
48
+ fputcsv($fh, $row[1], ",", "\"");
49
+ else:
50
+ //clean up the strings for escaping and add quotes
51
+ foreach ($row[1] as $val):
52
+ $b[] = '"'.addslashes($val).'"';
53
+ endforeach;
54
+ //comma separate the values
55
+ $string = implode(",",$b);
56
+ //write the data to the file
57
+ fwrite($fh, $string ."\n",strlen($string));
58
+ endif;
59
+
60
+ //close the file handle outside the loop
61
+ //this releases the lock too
62
+ fclose($fh);
63
+ //$user=$this->getUserDetail();
64
+ if(isset($data['address_1'])){
65
+ $this->editGraphicMailUser();
66
+ }else{
67
+ $this->registerGraphicMailUser();
68
+ }
69
+ }
70
+
71
+ protected function sendPost($url){
72
+ $ch = curl_init();
73
+ curl_setopt($ch, CURLOPT_URL, $url);
74
+ curl_setopt($ch, CURLOPT_HEADER, false);
75
+ curl_setopt($ch, CURLOPT_NOBODY, true); // remove body
76
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
77
+ $head = curl_exec($ch);
78
+ $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
79
+ curl_close($ch);
80
+ //print_r($head) ;
81
+ }
82
+ protected function dataWrite(){
83
+ /**
84
+ * Get the resource model
85
+ */
86
+ $resource = Mage::getSingleton('core/resource');
87
+ /**
88
+ * Retrieve the write connection
89
+ */
90
+ $writeConnection = $resource->getConnection('core_write');
91
+ return $writeConnection;
92
+ }
93
+ protected function dataRead(){
94
+ /**
95
+ * Get the resource model
96
+ */
97
+ $resource = Mage::getSingleton('core/resource');
98
+ /**
99
+ * Retrieve the read connection
100
+ */
101
+ $readConnection = $resource->getConnection('core_read');
102
+ return $readConnection;
103
+ }
104
+ protected function getUserDetail(){
105
+ $Connection=$this->dataRead();
106
+ $query='SELECT * FROM graphic_account';
107
+ $results = $Connection->fetchAll($query);
108
+ return $results;
109
+ }
110
+ public function updateGraphicMailAccount($oldEmail){
111
+ $user=$this->getUserDetail();
112
+ $url="https://".$user[0]['domain']."/api.aspx?Username=".$user[0]['username']."&Password=".$user[0]['password']."&Function=post_delete_emailaddress&MailinglistID=".$user[0]['maillist_id']."&EmailAddress=".$oldEmail."&Principal=blGnGdu9T4JLZWPAVI2D3sYSK2c9gT2Z";
113
+ $this->sendPost($url);
114
+ }
115
+ public function subscribeGraphicMailNewsletter($email){
116
+ $user=$this->getUserDetail();
117
+ $url="https://".$user[0]['domain']."/api.aspx?Username=".$user[0]['username']."&Password=".$user[0]['password']."&Function=post_subscribe&Email=".$email."&MailinglistID=".$user[0]['maillist_id']."&Principal=blGnGdu9T4JLZWPAVI2D3sYSK2c9gT2Z";
118
+ $this->sendPost($url);
119
+ }
120
+ public function unSubscribeGraphicMailNewsletter($email){
121
+ $user=$this->getUserDetail();
122
+ $url="https://".$user[0]['domain']."/api.aspx?Username=".$user[0]['username']."&Password=".$user[0]['password']."&Function=post_unsubscribe&Email=".$email."&MailinglistID=".$user[0]['maillist_id']."&Principal=blGnGdu9T4JLZWPAVI2D3sYSK2c9gT2Z";
123
+ $this->sendPost($url);
124
+ }
125
+ public function registerGraphicMailUser(){
126
+ $user=$this->getUserDetail();
127
+ $baseurl=(isset($_SERVER['HTTPS']) ? 'https' :'http'). '://' . $_SERVER['HTTP_HOST'];
128
+ $fileurl=$baseurl.'/CSV/file.csv';
129
+ $url="https://".$user[0]['domain']."/api.aspx?Username=".$user[0]['username']."&Password=".$user[0]['password']."&Function=post_import_dataset&EmailCol=3&Col1=1&Col2=2&Col6=4&Col9=5&Col10=6&Col4=7&DatasetID=".$user[0]['dataset_id']."&MailingListID=".$user[0]['maillist_id']."&ImportMode=1&FileUrl=".$fileurl."&Principal=blGnGdu9T4JLZWPAVI2D3sYSK2c9gT2Z";
130
+ $this->sendPost($url);
131
+ }
132
+ public function editGraphicMailUser(){
133
+ $user=$this->getUserDetail();
134
+ $baseurl=(isset($_SERVER['HTTPS']) ? 'https' :'http'). '://' . $_SERVER['HTTP_HOST'];
135
+ $fileurl=$baseurl.'/CSV/file.csv';
136
+ $url="https://".$user[0]['domain']."/api.aspx?Username=".$user[0]['username']."&Password=".$user[0]['password']."&Function=post_import_dataset&EmailCol=3&Col1=1&Col2=2&Col4=4&Col6=5&Col7=6&Col9=7&Col10=8&Col11=9&Col12=10&Col13=11&Col14=12&DatasetID=".$user[0]['dataset_id']."&MailingListID=".$user[0]['maillist_id']."&ImportMode=1&FileUrl=".$fileurl."&Principal=blGnGdu9T4JLZWPAVI2D3sYSK2c9gT2Z";
137
+ $this->sendPost($url);
138
+ }
139
  }
app/code/core/Mage/Customer/controllers/AccountController.php DELETED
@@ -1,684 +0,0 @@
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_Customer
23
- * @copyright Copyright (c) 2010 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
- * Customer account controller
29
- *
30
- * @category Mage
31
- * @package Mage_Customer
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
- class Mage_Customer_AccountController extends Mage_Core_Controller_Front_Action
35
- {
36
- /**
37
- * Action list where need check enabled cookie
38
- *
39
- * @var array
40
- */
41
- protected $_cookieCheckActions = array('loginPost', 'create');
42
-
43
- /**
44
- * Retrieve customer session model object
45
- *
46
- * @return Mage_Customer_Model_Session
47
- */
48
- protected function _getSession()
49
- {
50
- return Mage::getSingleton('customer/session');
51
- }
52
-
53
- /**
54
- * Action predispatch
55
- *
56
- * Check customer authentication for some actions
57
- */
58
- public function preDispatch()
59
- {
60
- // a brute-force protection here would be nice
61
-
62
- parent::preDispatch();
63
-
64
- if (!$this->getRequest()->isDispatched()) {
65
- return;
66
- }
67
-
68
- $action = $this->getRequest()->getActionName();
69
- if (!preg_match('/^(create|login|logoutSuccess|forgotpassword|forgotpasswordpost|confirm|confirmation)/i', $action)) {
70
- if (!$this->_getSession()->authenticate($this)) {
71
- $this->setFlag('', 'no-dispatch', true);
72
- }
73
- } else {
74
- $this->_getSession()->setNoReferer(true);
75
- }
76
- }
77
-
78
- /**
79
- * Action postdispatch
80
- *
81
- * Remove No-referer flag from customer session after each action
82
- */
83
- public function postDispatch()
84
- {
85
- parent::postDispatch();
86
- $this->_getSession()->unsNoReferer(false);
87
- }
88
-
89
- /**
90
- * Default customer account page
91
- */
92
- public function indexAction()
93
- {
94
- $this->loadLayout();
95
- $this->_initLayoutMessages('customer/session');
96
- $this->_initLayoutMessages('catalog/session');
97
-
98
- $this->getLayout()->getBlock('content')->append(
99
- $this->getLayout()->createBlock('customer/account_dashboard')
100
- );
101
- $this->getLayout()->getBlock('head')->setTitle($this->__('My Account'));
102
- $this->renderLayout();
103
- }
104
-
105
- /**
106
- * Customer login form page
107
- */
108
- public function loginAction()
109
- {
110
- if ($this->_getSession()->isLoggedIn()) {
111
- $this->_redirect('*/*/');
112
- return;
113
- }
114
- $this->getResponse()->setHeader('Login-Required', 'true');
115
- $this->loadLayout();
116
- $this->_initLayoutMessages('customer/session');
117
- $this->_initLayoutMessages('catalog/session');
118
- $this->renderLayout();
119
- }
120
-
121
- /**
122
- * Login post action
123
- */
124
- public function loginPostAction()
125
- {
126
- if ($this->_getSession()->isLoggedIn()) {
127
- $this->_redirect('*/*/');
128
- return;
129
- }
130
- $session = $this->_getSession();
131
-
132
- if ($this->getRequest()->isPost()) {
133
- $login = $this->getRequest()->getPost('login');
134
- if (!empty($login['username']) && !empty($login['password'])) {
135
- try {
136
- $session->login($login['username'], $login['password']);
137
- if ($session->getCustomer()->getIsJustConfirmed()) {
138
- $this->_welcomeCustomer($session->getCustomer(), true);
139
- }
140
- } catch (Mage_Core_Exception $e) {
141
- switch ($e->getCode()) {
142
- case Mage_Customer_Model_Customer::EXCEPTION_EMAIL_NOT_CONFIRMED:
143
- $message = Mage::helper('customer')->__('This account is not confirmed. <a href="%s">Click here</a> to resend confirmation email.', Mage::helper('customer')->getEmailConfirmationUrl($login['username']));
144
- break;
145
- case Mage_Customer_Model_Customer::EXCEPTION_INVALID_EMAIL_OR_PASSWORD:
146
- $message = $e->getMessage();
147
- break;
148
- default:
149
- $message = $e->getMessage();
150
- }
151
- $session->addError($message);
152
- $session->setUsername($login['username']);
153
- } catch (Exception $e) {
154
- // Mage::logException($e); // PA DSS violation: this exception log can disclose customer password
155
- }
156
- } else {
157
- $session->addError($this->__('Login and password are required.'));
158
- }
159
- }
160
-
161
- $this->_loginPostRedirect();
162
- }
163
-
164
- /**
165
- * Define target URL and redirect customer after logging in
166
- */
167
- protected function _loginPostRedirect()
168
- {
169
- $session = $this->_getSession();
170
-
171
- if (!$session->getBeforeAuthUrl() || $session->getBeforeAuthUrl() == Mage::getBaseUrl() ) {
172
-
173
- // Set default URL to redirect customer to
174
- $session->setBeforeAuthUrl(Mage::helper('customer')->getAccountUrl());
175
-
176
- // Redirect customer to the last page visited after logging in
177
- if ($session->isLoggedIn())
178
- {
179
- if (!Mage::getStoreConfigFlag('customer/startup/redirect_dashboard')) {
180
- if ($referer = $this->getRequest()->getParam(Mage_Customer_Helper_Data::REFERER_QUERY_PARAM_NAME)) {
181
- $referer = Mage::helper('core')->urlDecode($referer);
182
- if ($this->_isUrlInternal($referer)) {
183
- $session->setBeforeAuthUrl($referer);
184
- }
185
- }
186
- }
187
- else if ($session->getAfterAuthUrl()) {
188
- $session->setBeforeAuthUrl($session->getAfterAuthUrl(true));
189
- }
190
- } else {
191
- $session->setBeforeAuthUrl(Mage::helper('customer')->getLoginUrl());
192
- }
193
- } else if ($session->getBeforeAuthUrl() == Mage::helper('customer')->getLogoutUrl()) {
194
- $session->setBeforeAuthUrl(Mage::helper('customer')->getDashboardUrl());
195
- }
196
- else {
197
- if (!$session->getAfterAuthUrl()) {
198
- $session->setAfterAuthUrl($session->getBeforeAuthUrl());
199
- }
200
- if ($session->isLoggedIn()) {
201
- $session->setBeforeAuthUrl($session->getAfterAuthUrl(true));
202
- }
203
- }
204
- $this->_redirectUrl($session->getBeforeAuthUrl(true));
205
- }
206
-
207
- /**
208
- * Customer logout action
209
- */
210
- public function logoutAction()
211
- {
212
- $this->_getSession()->logout()
213
- ->setBeforeAuthUrl(Mage::getUrl());
214
-
215
- $this->_redirect('*/*/logoutSuccess');
216
- }
217
-
218
- /**
219
- * Logout success page
220
- */
221
- public function logoutSuccessAction()
222
- {
223
- $this->loadLayout();
224
- $this->renderLayout();
225
- }
226
-
227
- /**
228
- * Customer register form page
229
- */
230
- public function createAction()
231
- {
232
- if ($this->_getSession()->isLoggedIn()) {
233
- $this->_redirect('*/*');
234
- return;
235
- }
236
-
237
- $this->loadLayout();
238
- $this->_initLayoutMessages('customer/session');
239
-
240
- /************* GRAPHICMAIL CODE *******************/
241
-
242
- $graphicmail = Mage::getModel('customer/graphicmail');
243
- //$graphicmail->createGraphicMailUser($data);
244
-
245
- /************************ END ***********************/
246
-
247
- $this->renderLayout();
248
- }
249
-
250
- /**
251
- * Create customer account action
252
- */
253
- public function createPostAction()
254
- {
255
- $session = $this->_getSession();
256
- if ($session->isLoggedIn()) {
257
- $this->_redirect('*/*/');
258
- return;
259
- }
260
- $session->setEscapeMessages(true); // prevent XSS injection in user input
261
- if ($this->getRequest()->isPost()) {
262
- $errors = array();
263
-
264
- if (!$customer = Mage::registry('current_customer')) {
265
- $customer = Mage::getModel('customer/customer')->setId(null);
266
- }
267
-
268
- $data = $this->_filterPostData($this->getRequest()->getPost());
269
- foreach (Mage::getConfig()->getFieldset('customer_account') as $code=>$node) {
270
- if ($node->is('create') && isset($data[$code])) {
271
- if ($code == 'email') {
272
- $data[$code] = trim($data[$code]);
273
- }
274
- $customer->setData($code, $data[$code]);
275
- }
276
- }
277
-
278
- /**************** GRAPHICMAIL CODE ******************/
279
- $graphicmail = Mage::getModel('customer/graphicmail');
280
- $graphicmail->createGraphicMailUser($data);
281
- /*********************** END ************************/
282
-
283
- if ($this->getRequest()->getParam('is_subscribed', false)) {
284
- $customer->setIsSubscribed(1);
285
-
286
- /**************** GRAPHICMAIL CODE ******************/
287
- $graphicmail->subscribeGraphicMailNewsletter($data['email']);
288
- /*********************** END ************************/
289
- }
290
-
291
- /**
292
- * Initialize customer group id
293
- */
294
- $customer->getGroupId();
295
-
296
- if ($this->getRequest()->getPost('create_address')) {
297
- $address = Mage::getModel('customer/address')
298
- ->setData($this->getRequest()->getPost())
299
- ->setIsDefaultBilling($this->getRequest()->getParam('default_billing', false))
300
- ->setIsDefaultShipping($this->getRequest()->getParam('default_shipping', false))
301
- ->setId(null);
302
- $customer->addAddress($address);
303
-
304
- $errors = $address->validate();
305
- if (!is_array($errors)) {
306
- $errors = array();
307
- }
308
- }
309
-
310
- try {
311
- $validationCustomer = $customer->validate();
312
- if (is_array($validationCustomer)) {
313
- $errors = array_merge($validationCustomer, $errors);
314
- }
315
- $validationResult = count($errors) == 0;
316
-
317
- if (true === $validationResult) {
318
- $customer->save();
319
-
320
- if ($customer->isConfirmationRequired()) {
321
- $customer->sendNewAccountEmail('confirmation', $session->getBeforeAuthUrl());
322
- $session->addSuccess($this->__('Account confirmation is required. Please, check your email for the confirmation link. To resend the confirmation email please <a href="%s">click here</a>.', Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail())));
323
- $this->_redirectSuccess(Mage::getUrl('*/*/index', array('_secure'=>true)));
324
- return;
325
- }
326
- else {
327
- $session->setCustomerAsLoggedIn($customer);
328
- $url = $this->_welcomeCustomer($customer);
329
- $this->_redirectSuccess($url);
330
- return;
331
- }
332
- } else {
333
- $session->setCustomerFormData($this->getRequest()->getPost());
334
- if (is_array($errors)) {
335
- foreach ($errors as $errorMessage) {
336
- $session->addError($errorMessage);
337
- }
338
- }
339
- else {
340
- $session->addError($this->__('Invalid customer data'));
341
- }
342
- }
343
- }
344
- catch (Mage_Core_Exception $e) {
345
- $session->setCustomerFormData($this->getRequest()->getPost());
346
- if ($e->getCode() === Mage_Customer_Model_Customer::EXCEPTION_EMAIL_EXISTS) {
347
- $url = Mage::getUrl('customer/account/forgotpassword');
348
- $message = $this->__('There is already an account with this email address. If you are sure that it is your email address, <a href="%s">click here</a> to get your password and access your account.', $url);
349
- $session->setEscapeMessages(false);
350
- }
351
- else {
352
- $message = $e->getMessage();
353
- }
354
- $session->addError($message);
355
- }
356
- catch (Exception $e) {
357
- $session->setCustomerFormData($this->getRequest()->getPost())
358
- ->addException($e, $this->__('Cannot save the customer.'));
359
- }
360
- }
361
- $this->_redirectError(Mage::getUrl('*/*/create', array('_secure' => true)));
362
- }
363
-
364
- /**
365
- * Add welcome message and send new account email.
366
- * Returns success URL
367
- *
368
- * @param Mage_Customer_Model_Customer $customer
369
- * @param bool $isJustConfirmed
370
- * @return string
371
- */
372
- protected function _welcomeCustomer(Mage_Customer_Model_Customer $customer, $isJustConfirmed = false)
373
- {
374
- $this->_getSession()->addSuccess($this->__('Thank you for registering with %s.', Mage::app()->getStore()->getFrontendName()));
375
-
376
- $customer->sendNewAccountEmail($isJustConfirmed ? 'confirmed' : 'registered');
377
-
378
- $successUrl = Mage::getUrl('*/*/index', array('_secure'=>true));
379
- if ($this->_getSession()->getBeforeAuthUrl()) {
380
- $successUrl = $this->_getSession()->getBeforeAuthUrl(true);
381
- }
382
- return $successUrl;
383
- }
384
-
385
- /**
386
- * Confirm customer account by id and confirmation key
387
- */
388
- public function confirmAction()
389
- {
390
- if ($this->_getSession()->isLoggedIn()) {
391
- $this->_redirect('*/*/');
392
- return;
393
- }
394
- try {
395
- $id = $this->getRequest()->getParam('id', false);
396
- $key = $this->getRequest()->getParam('key', false);
397
- $backUrl = $this->getRequest()->getParam('back_url', false);
398
- if (empty($id) || empty($key)) {
399
- throw new Exception($this->__('Bad request.'));
400
- }
401
-
402
- // load customer by id (try/catch in case if it throws exceptions)
403
- try {
404
- $customer = Mage::getModel('customer/customer')->load($id);
405
- if ((!$customer) || (!$customer->getId())) {
406
- throw new Exception('Failed to load customer by id.');
407
- }
408
- }
409
- catch (Exception $e) {
410
- throw new Exception($this->__('Wrong customer account specified.'));
411
- }
412
-
413
- // check if it is inactive
414
- if ($customer->getConfirmation()) {
415
- if ($customer->getConfirmation() !== $key) {
416
- throw new Exception($this->__('Wrong confirmation key.'));
417
- }
418
-
419
- // activate customer
420
- try {
421
- $customer->setConfirmation(null);
422
- $customer->save();
423
- }
424
- catch (Exception $e) {
425
- throw new Exception($this->__('Failed to confirm customer account.'));
426
- }
427
-
428
- // log in and send greeting email, then die happy
429
- $this->_getSession()->setCustomerAsLoggedIn($customer);
430
- $successUrl = $this->_welcomeCustomer($customer, true);
431
- $this->_redirectSuccess($backUrl ? $backUrl : $successUrl);
432
- return;
433
- }
434
-
435
- // die happy
436
- $this->_redirectSuccess(Mage::getUrl('*/*/index', array('_secure'=>true)));
437
- return;
438
- }
439
- catch (Exception $e) {
440
- // die unhappy
441
- $this->_getSession()->addError($e->getMessage());
442
- $this->_redirectError(Mage::getUrl('*/*/index', array('_secure'=>true)));
443
- return;
444
- }
445
- }
446
-
447
- /**
448
- * Send confirmation link to specified email
449
- */
450
- public function confirmationAction()
451
- {
452
- $customer = Mage::getModel('customer/customer');
453
- if ($this->_getSession()->isLoggedIn()) {
454
- $this->_redirect('*/*/');
455
- return;
456
- }
457
-
458
- // try to confirm by email
459
- $email = $this->getRequest()->getPost('email');
460
- if ($email) {
461
- try {
462
- $customer->setWebsiteId(Mage::app()->getStore()->getWebsiteId())->loadByEmail($email);
463
- if (!$customer->getId()) {
464
- throw new Exception('');
465
- }
466
- if ($customer->getConfirmation()) {
467
- $customer->sendNewAccountEmail('confirmation');
468
- $this->_getSession()->addSuccess($this->__('Please, check your email for confirmation key.'));
469
- }
470
- else {
471
- $this->_getSession()->addSuccess($this->__('This email does not require confirmation.'));
472
- }
473
- $this->_getSession()->setUsername($email);
474
- $this->_redirectSuccess(Mage::getUrl('*/*/index', array('_secure' => true)));
475
- }
476
- catch (Exception $e) {
477
- $this->_getSession()->addError($this->__('Wrong email.'));
478
- $this->_redirectError(Mage::getUrl('*/*/*', array('email' => $email, '_secure' => true)));
479
- }
480
- return;
481
- }
482
-
483
- // output form
484
- $this->loadLayout();
485
-
486
- $this->getLayout()->getBlock('accountConfirmation')
487
- ->setEmail($this->getRequest()->getParam('email', $email));
488
-
489
- $this->_initLayoutMessages('customer/session');
490
- $this->renderLayout();
491
- }
492
-
493
- /**
494
- * Forgot customer password page
495
- */
496
- public function forgotPasswordAction()
497
- {
498
- $this->loadLayout();
499
-
500
- $this->getLayout()->getBlock('forgotPassword')->setEmailValue(
501
- $this->_getSession()->getForgottenEmail()
502
- );
503
- $this->_getSession()->unsForgottenEmail();
504
-
505
- $this->_initLayoutMessages('customer/session');
506
- $this->renderLayout();
507
- }
508
-
509
- /**
510
- * Forgot customer password action
511
- */
512
- public function forgotPasswordPostAction()
513
- {
514
- $email = $this->getRequest()->getPost('email');
515
- if ($email) {
516
- if (!Zend_Validate::is($email, 'EmailAddress')) {
517
- $this->_getSession()->setForgottenEmail($email);
518
- $this->_getSession()->addError($this->__('Invalid email address.'));
519
- $this->getResponse()->setRedirect(Mage::getUrl('*/*/forgotpassword'));
520
- return;
521
- }
522
- $customer = Mage::getModel('customer/customer')
523
- ->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
524
- ->loadByEmail($email);
525
-
526
- if ($customer->getId()) {
527
- try {
528
- $newPassword = $customer->generatePassword();
529
- $customer->changePassword($newPassword, false);
530
- $customer->sendPasswordReminderEmail();
531
-
532
- $this->_getSession()->addSuccess($this->__('A new password has been sent.'));
533
-
534
- $this->getResponse()->setRedirect(Mage::getUrl('*/*'));
535
- return;
536
- }
537
- catch (Exception $e){
538
- $this->_getSession()->addError($e->getMessage());
539
- }
540
- }
541
- else {
542
- $this->_getSession()->addError($this->__('This email address was not found in our records.'));
543
- $this->_getSession()->setForgottenEmail($email);
544
- }
545
- } else {
546
- $this->_getSession()->addError($this->__('Please enter your email.'));
547
- $this->getResponse()->setRedirect(Mage::getUrl('*/*/forgotpassword'));
548
- return;
549
- }
550
-
551
- $this->getResponse()->setRedirect(Mage::getUrl('*/*/forgotpassword'));
552
- }
553
-
554
- /**
555
- * Forgot customer account information page
556
- */
557
- public function editAction()
558
- {
559
- $this->loadLayout();
560
- $this->_initLayoutMessages('customer/session');
561
- $this->_initLayoutMessages('catalog/session');
562
-
563
- if ($block = $this->getLayout()->getBlock('customer_edit')) {
564
- $block->setRefererUrl($this->_getRefererUrl());
565
- }
566
- $data = $this->_getSession()->getCustomerFormData(true);
567
- $customer = $this->_getSession()->getCustomer();
568
- if (!empty($data)) {
569
- $customer->addData($data);
570
- }
571
- if($this->getRequest()->getParam('changepass')==1){
572
- $customer->setChangePassword(1);
573
- }
574
-
575
- $this->getLayout()->getBlock('head')->setTitle($this->__('Account Information'));
576
-
577
- $this->renderLayout();
578
- }
579
-
580
- /**
581
- * Change customer password action
582
- */
583
- public function editPostAction()
584
- {
585
- if (!$this->_validateFormKey()) {
586
- return $this->_redirect('*/*/edit');
587
- }
588
-
589
- if ($this->getRequest()->isPost()) {
590
- $customer = Mage::getModel('customer/customer')
591
- ->setId($this->_getSession()->getCustomerId())
592
- ->setWebsiteId($this->_getSession()->getCustomer()->getWebsiteId());
593
-
594
- $fields = Mage::getConfig()->getFieldset('customer_account');
595
- $data = $this->_filterPostData($this->getRequest()->getPost());
596
-
597
- foreach ($fields as $code=>$node) {
598
- if ($node->is('update') && isset($data[$code])) {
599
- $customer->setData($code, $data[$code]);
600
- }
601
- }
602
-
603
- $errors = $customer->validate();
604
- if (!is_array($errors)) {
605
- $errors = array();
606
- }
607
-
608
- /**
609
- * we would like to preserver the existing group id
610
- */
611
- if ($this->_getSession()->getCustomerGroupId()) {
612
- $customer->setGroupId($this->_getSession()->getCustomerGroupId());
613
- }
614
-
615
- if ($this->getRequest()->getParam('change_password')) {
616
- $currPass = $this->getRequest()->getPost('current_password');
617
- $newPass = $this->getRequest()->getPost('password');
618
- $confPass = $this->getRequest()->getPost('confirmation');
619
-
620
- if (empty($currPass) || empty($newPass) || empty($confPass)) {
621
- $errors[] = $this->__('The password fields cannot be empty.');
622
- }
623
-
624
- if ($newPass != $confPass) {
625
- $errors[] = $this->__('Please make sure your passwords match.');
626
- }
627
-
628
- $oldPass = $this->_getSession()->getCustomer()->getPasswordHash();
629
- if (strpos($oldPass, ':')) {
630
- list($_salt, $salt) = explode(':', $oldPass);
631
- } else {
632
- $salt = false;
633
- }
634
-
635
- if ($customer->hashPassword($currPass, $salt) == $oldPass) {
636
- $customer->setPassword($newPass);
637
- } else {
638
- $errors[] = $this->__('Invalid current password');
639
- }
640
- }
641
-
642
- if (!empty($errors)) {
643
- $this->_getSession()->setCustomerFormData($this->getRequest()->getPost());
644
- foreach ($errors as $message) {
645
- $this->_getSession()->addError($message);
646
- }
647
- $this->_redirect('*/*/edit');
648
- return $this;
649
- }
650
-
651
- try {
652
- $customer->save();
653
- $this->_getSession()->setCustomer($customer)
654
- ->addSuccess($this->__('The account information has been saved.'));
655
-
656
- $this->_redirect('customer/account');
657
- return;
658
- }
659
- catch (Mage_Core_Exception $e) {
660
- $this->_getSession()->setCustomerFormData($this->getRequest()->getPost())
661
- ->addError($e->getMessage());
662
- }
663
- catch (Exception $e) {
664
- $this->_getSession()->setCustomerFormData($this->getRequest()->getPost())
665
- ->addException($e, $this->__('Cannot save the customer.'));
666
- }
667
- }
668
-
669
- $this->_redirect('*/*/edit');
670
- }
671
-
672
- /**
673
- * Filtering posted data. Converting localized data if needed
674
- *
675
- * @param array
676
- * @return array
677
- */
678
- protected function _filterPostData($data)
679
- {
680
- $data = $this->_filterDates($data, array('dob'));
681
- return $data;
682
- }
683
- }
684
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Mage/Customer/controllers/AddressController.php DELETED
@@ -1,193 +0,0 @@
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_Customer
23
- * @copyright Copyright (c) 2010 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
- /**
29
- * Customer address controller
30
- *
31
- * @category Mage
32
- * @package Mage_Customer
33
- * @author Magento Core Team <core@magentocommerce.com>
34
- */
35
- class Mage_Customer_AddressController extends Mage_Core_Controller_Front_Action
36
- {
37
- /**
38
- * Retrieve customer session object
39
- *
40
- * @return Mage_Customer_Model_Session
41
- */
42
- protected function _getSession()
43
- {
44
- return Mage::getSingleton('customer/session');
45
- }
46
-
47
- public function preDispatch()
48
- {
49
- parent::preDispatch();
50
-
51
- if (!Mage::getSingleton('customer/session')->authenticate($this)) {
52
- $this->setFlag('', 'no-dispatch', true);
53
- }
54
- }
55
-
56
- /**
57
- * Customer addresses list
58
- */
59
- public function indexAction()
60
- {
61
- if (count($this->_getSession()->getCustomer()->getAddresses())) {
62
- $this->loadLayout();
63
- $this->_initLayoutMessages('customer/session');
64
- $this->_initLayoutMessages('catalog/session');
65
-
66
- if ($block = $this->getLayout()->getBlock('address_book')) {
67
- $block->setRefererUrl($this->_getRefererUrl());
68
- }
69
- $this->renderLayout();
70
- }
71
- else {
72
- $this->getResponse()->setRedirect(Mage::getUrl('*/*/new'));
73
- }
74
- }
75
-
76
- public function editAction()
77
- {
78
- $this->_forward('form');
79
- }
80
-
81
- public function newAction()
82
- {
83
- $this->_forward('form');
84
- }
85
-
86
- /**
87
- * Address book form
88
- */
89
- public function formAction()
90
- {
91
- $this->loadLayout();
92
- $this->_initLayoutMessages('customer/session');
93
- if ($navigationBlock = $this->getLayout()->getBlock('customer_account_navigation')) {
94
- $navigationBlock->setActive('customer/address');
95
- }
96
- echo 'sdf';
97
- $this->renderLayout();
98
- }
99
-
100
- public function formPostAction()
101
- {
102
- /**************** GRAPHICMAIL CODE ********h**********/
103
- $graphicmail = Mage::getModel('customer/graphicmail');
104
- $u=Mage::helper('customer')->getCustomer()->getData();
105
- $data=$this->getRequest()->getPost();
106
- $data['address_1']=$data['street'][0];
107
- $data['address_1']=$data['street'][1];
108
- $data['email']=$u['email'];
109
-
110
- /*********************** END ************************/
111
-
112
- if (!$this->_validateFormKey()) {
113
- return $this->_redirect('*/*/');
114
- }
115
- // Save data
116
- if ($this->getRequest()->isPost()) {
117
- $address = Mage::getModel('customer/address')
118
- ->setData($this->getRequest()->getPost())
119
- ->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId())
120
- ->setIsDefaultBilling($this->getRequest()->getParam('default_billing', false))
121
- ->setIsDefaultShipping($this->getRequest()->getParam('default_shipping', false));
122
- $addressId = $this->getRequest()->getParam('id');
123
- if ($addressId) {
124
- $customerAddress = $this->_getSession()->getCustomer()->getAddressById($addressId);
125
- if ($customerAddress->getId() && $customerAddress->getCustomerId() == $this->_getSession()->getCustomerId()) {
126
- $address->setId($addressId);
127
- }
128
- else {
129
- $address->setId(null);
130
- }
131
- }
132
- else {
133
- $address->setId(null);
134
- }
135
- try {
136
- $accressValidation = $address->validate();
137
- if (true === $accressValidation) {
138
- $address->save();
139
- /**************** GRAPHICMAIL CODE ******************/
140
- $graphicmail->CreateGraphicMailUser($data);
141
- /*********************** END ************************/
142
- $this->_getSession()->addSuccess($this->__('The address has been saved.'));
143
- $this->_redirectSuccess(Mage::getUrl('*/*/index', array('_secure'=>true)));
144
- return;
145
- } else {
146
- $this->_getSession()->setAddressFormData($this->getRequest()->getPost());
147
- if (is_array($accressValidation)) {
148
- foreach ($accressValidation as $errorMessage) {
149
- $this->_getSession()->addError($errorMessage);
150
- }
151
- } else {
152
- $this->_getSession()->addError($this->__('Cannot save the address.'));
153
- }
154
- }
155
- }
156
- catch (Mage_Core_Exception $e) {
157
- $this->_getSession()->setAddressFormData($this->getRequest()->getPost())
158
- ->addException($e, $e->getMessage());
159
- }
160
- catch (Exception $e) {
161
- $this->_getSession()->setAddressFormData($this->getRequest()->getPost())
162
- ->addException($e, $this->__('Cannot save address.'));
163
- }
164
- }
165
- $this->_redirectError(Mage::getUrl('*/*/edit', array('id'=>$address->getId())));
166
- }
167
-
168
- public function deleteAction()
169
- {
170
- $addressId = $this->getRequest()->getParam('id', false);
171
-
172
- if ($addressId) {
173
- $address = Mage::getModel('customer/address')->load($addressId);
174
-
175
- // Validate address_id <=> customer_id
176
- if ($address->getCustomerId() != $this->_getSession()->getCustomerId()) {
177
- $this->_getSession()->addError($this->__('The address does not belong to this customer.'));
178
- $this->getResponse()->setRedirect(Mage::getUrl('*/*/index'));
179
- return;
180
- }
181
-
182
- try {
183
- $address->delete();
184
- $this->_getSession()->addSuccess($this->__('The address has been deleted.'));
185
- }
186
- catch (Exception $e){
187
- $this->_getSession()->addError($this->__('An error occurred while deleting the address.'));
188
- }
189
- }
190
- $this->getResponse()->setRedirect(Mage::getUrl('*/*/index'));
191
- }
192
- }
193
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Module/Graphicmail/controllers/AccountController.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once 'Mage/Customer/controllers/AccountController.php';
4
+
5
+ class Module_Graphicmail_AccountController extends Mage_Customer_AccountController
6
+ {
7
+
8
+ public function createAction()
9
+ {
10
+ if ($this->_getSession()->isLoggedIn()) {
11
+ $this->_redirect('*/*');
12
+ return;
13
+ }
14
+
15
+ $this->loadLayout();
16
+ $this->_initLayoutMessages('customer/session');
17
+ /************* GRAPHICMAIL CODE *******************/
18
+
19
+ $graphicmail = Mage::getModel('customer/graphicmail');
20
+ //$graphicmail->createGraphicMailUser($data);
21
+
22
+ /************************ END ***********************/
23
+
24
+ $this->renderLayout();
25
+ }
26
+
27
+ /**
28
+ * Create customer account action
29
+ */
30
+ public function createPostAction()
31
+ {
32
+ $session = $this->_getSession();
33
+ if ($session->isLoggedIn()) {
34
+ $this->_redirect('*/*/');
35
+ return;
36
+ }
37
+ $session->setEscapeMessages(true); // prevent XSS injection in user input
38
+ if ($this->getRequest()->isPost()) {
39
+ $errors = array();
40
+
41
+ if (!$customer = Mage::registry('current_customer')) {
42
+ $customer = Mage::getModel('customer/customer')->setId(null);
43
+ }
44
+
45
+ /* @var $customerForm Mage_Customer_Model_Form */
46
+ $customerForm = Mage::getModel('customer/form');
47
+ $customerForm->setFormCode('customer_account_create')
48
+ ->setEntity($customer);
49
+
50
+ $customerData = $customerForm->extractData($this->getRequest());
51
+
52
+ /**************** GRAPHICMAIL CODE ******************/
53
+ $graphicmail = Mage::getModel('customer/graphicmail');
54
+ $graphicmail->createGraphicMailUser($customerData);
55
+ /*********************** END ************************/
56
+
57
+ if ($this->getRequest()->getParam('is_subscribed', false)) {
58
+ $customer->setIsSubscribed(1);
59
+ /**************** GRAPHICMAIL CODE ******************/
60
+ $graphicmail->subscribeGraphicMailNewsletter($customerData['email']);
61
+ /*********************** END ************************/
62
+
63
+ }
64
+
65
+ /**
66
+ * Initialize customer group id
67
+ */
68
+ $customer->getGroupId();
69
+
70
+ if ($this->getRequest()->getPost('create_address')) {
71
+ /* @var $address Mage_Customer_Model_Address */
72
+ $address = Mage::getModel('customer/address');
73
+ /* @var $addressForm Mage_Customer_Model_Form */
74
+ $addressForm = Mage::getModel('customer/form');
75
+ $addressForm->setFormCode('customer_register_address')
76
+ ->setEntity($address);
77
+
78
+ $addressData = $addressForm->extractData($this->getRequest(), 'address', false);
79
+ $addressErrors = $addressForm->validateData($addressData);
80
+ if ($addressErrors === true) {
81
+ $address->setId(null)
82
+ ->setIsDefaultBilling($this->getRequest()->getParam('default_billing', false))
83
+ ->setIsDefaultShipping($this->getRequest()->getParam('default_shipping', false));
84
+ $addressForm->compactData($addressData);
85
+ $customer->addAddress($address);
86
+
87
+ $addressErrors = $address->validate();
88
+ if (is_array($addressErrors)) {
89
+ $errors = array_merge($errors, $addressErrors);
90
+ }
91
+ } else {
92
+ $errors = array_merge($errors, $addressErrors);
93
+ }
94
+ }
95
+
96
+ try {
97
+ $customerErrors = $customerForm->validateData($customerData);
98
+ if ($customerErrors !== true) {
99
+ $errors = array_merge($customerErrors, $errors);
100
+ } else {
101
+ $customerForm->compactData($customerData);
102
+ $customer->setPassword($this->getRequest()->getPost('password'));
103
+ $customer->setConfirmation($this->getRequest()->getPost('confirmation'));
104
+ $customerErrors = $customer->validate();
105
+ if (is_array($customerErrors)) {
106
+ $errors = array_merge($customerErrors, $errors);
107
+ }
108
+ }
109
+
110
+ $validationResult = count($errors) == 0;
111
+
112
+ if (true === $validationResult) {
113
+ $customer->save();
114
+
115
+ Mage::dispatchEvent('customer_register_success',
116
+ array('account_controller' => $this, 'customer' => $customer)
117
+ );
118
+
119
+ if ($customer->isConfirmationRequired()) {
120
+ $customer->sendNewAccountEmail(
121
+ 'confirmation',
122
+ $session->getBeforeAuthUrl(),
123
+ Mage::app()->getStore()->getId()
124
+ );
125
+ $session->addSuccess($this->__('Account confirmation is required. Please, check your email for the confirmation link. To resend the confirmation email please <a href="%s">click here</a>.', Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail())));
126
+ $this->_redirectSuccess(Mage::getUrl('*/*/index', array('_secure'=>true)));
127
+ return;
128
+ } else {
129
+ $session->setCustomerAsLoggedIn($customer);
130
+ $url = $this->_welcomeCustomer($customer);
131
+ $this->_redirectSuccess($url);
132
+ return;
133
+ }
134
+ } else {
135
+ $session->setCustomerFormData($this->getRequest()->getPost());
136
+ if (is_array($errors)) {
137
+ foreach ($errors as $errorMessage) {
138
+ $session->addError($errorMessage);
139
+ }
140
+ } else {
141
+ $session->addError($this->__('Invalid customer data'));
142
+ }
143
+ }
144
+ } catch (Mage_Core_Exception $e) {
145
+ $session->setCustomerFormData($this->getRequest()->getPost());
146
+ if ($e->getCode() === Mage_Customer_Model_Customer::EXCEPTION_EMAIL_EXISTS) {
147
+ $url = Mage::getUrl('customer/account/forgotpassword');
148
+ $message = $this->__('There is already an account with this email address. If you are sure that it is your email address, <a href="%s">click here</a> to get your password and access your account.', $url);
149
+ $session->setEscapeMessages(false);
150
+ } else {
151
+ $message = $e->getMessage();
152
+ }
153
+ $session->addError($message);
154
+ } catch (Exception $e) {
155
+ $session->setCustomerFormData($this->getRequest()->getPost())
156
+ ->addException($e, $this->__('Cannot save the customer.'));
157
+ }
158
+ }
159
+
160
+ $this->_redirectError(Mage::getUrl('*/*/create', array('_secure' => true)));
161
+ }
162
+
163
+ }
app/code/local/Module/Graphicmail/controllers/AddressController.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once 'Mage/Customer/controllers/AddressController.php';
4
+
5
+ class Module_Graphicmail_AddressController extends Mage_Customer_AddressController
6
+ {
7
+
8
+ public function formPostAction()
9
+ {
10
+ /**************** GRAPHICMAIL CODE ********h**********/
11
+ $graphicmail = Mage::getModel('customer/graphicmail');
12
+ $u=Mage::helper('customer')->getCustomer()->getData();
13
+ $data=$this->getRequest()->getPost();
14
+ $data['address_1']=$data['street'][0];
15
+ $data['address_1']=$data['street'][1];
16
+ $data['email']=$u['email'];
17
+
18
+ /*********************** END ************************/
19
+
20
+
21
+ if (!$this->_validateFormKey()) {
22
+ return $this->_redirect('*/*/');
23
+ }
24
+ // Save data
25
+ if ($this->getRequest()->isPost()) {
26
+ $customer = $this->_getSession()->getCustomer();
27
+ /* @var $address Mage_Customer_Model_Address */
28
+ $address = Mage::getModel('customer/address');
29
+ $addressId = $this->getRequest()->getParam('id');
30
+ if ($addressId) {
31
+ $existsAddress = $customer->getAddressById($addressId);
32
+ if ($existsAddress->getId() && $existsAddress->getCustomerId() == $customer->getId()) {
33
+ $address->setId($existsAddress->getId());
34
+ }
35
+ }
36
+
37
+ $errors = array();
38
+
39
+ /* @var $addressForm Mage_Customer_Model_Form */
40
+ $addressForm = Mage::getModel('customer/form');
41
+ $addressForm->setFormCode('customer_address_edit')
42
+ ->setEntity($address);
43
+ $addressData = $addressForm->extractData($this->getRequest());
44
+ $addressErrors = $addressForm->validateData($addressData);
45
+ if ($addressErrors !== true) {
46
+ $errors = $addressErrors;
47
+ }
48
+
49
+ try {
50
+ $addressForm->compactData($addressData);
51
+ $address->setCustomerId($customer->getId())
52
+ ->setIsDefaultBilling($this->getRequest()->getParam('default_billing', false))
53
+ ->setIsDefaultShipping($this->getRequest()->getParam('default_shipping', false));
54
+
55
+ $addressErrors = $address->validate();
56
+ if ($addressErrors !== true) {
57
+ $errors = array_merge($errors, $addressErrors);
58
+ }
59
+
60
+ if (count($errors) === 0) {
61
+ $address->save();
62
+ /**************** GRAPHICMAIL CODE ******************/
63
+ $graphicmail->CreateGraphicMailUser($data);
64
+ /*********************** END ************************/
65
+
66
+ $this->_getSession()->addSuccess($this->__('The address has been saved.'));
67
+ $this->_redirectSuccess(Mage::getUrl('*/*/index', array('_secure'=>true)));
68
+ return;
69
+ } else {
70
+ $this->_getSession()->setAddressFormData($this->getRequest()->getPost());
71
+ foreach ($errors as $errorMessage) {
72
+ $this->_getSession()->addError($errorMessage);
73
+ }
74
+ }
75
+ } catch (Mage_Core_Exception $e) {
76
+ $this->_getSession()->setAddressFormData($this->getRequest()->getPost())
77
+ ->addException($e, $e->getMessage());
78
+ } catch (Exception $e) {
79
+ $this->_getSession()->setAddressFormData($this->getRequest()->getPost())
80
+ ->addException($e, $this->__('Cannot save address.'));
81
+ }
82
+ }
83
+
84
+ return $this->_redirectError(Mage::getUrl('*/*/edit', array('id' => $address->getId())));
85
+ }
86
+
87
+
88
+ }
app/code/local/Module/Graphicmail/controllers/Adminhtml/GraphicmailbackendController.php CHANGED
@@ -5,24 +5,37 @@ class Module_Graphicmail_Adminhtml_GraphicmailbackendController extends Mage_Adm
5
  {
6
  $this->loadLayout();
7
  $this->_title($this->__("GraphicMail Setting"));
8
-
 
9
  if(isset($_POST['domain'])){
10
  $_SESSION['message']=$this->updateGraphAccount($_POST);
11
  }
 
 
12
  $userinfo=$this->getGraphAccount();
13
  $_SESSION['GraphAccount']=$userinfo;
 
 
 
14
  $_SESSION['mailinglist']=$this->getMaillingList($userinfo[0]);
 
 
15
  $_SESSION['dataset']=$this->getDataset($userinfo[0]);
 
16
  $this->renderLayout();
17
  }
18
 
19
  public function saveAction() {
20
  $this->loadLayout();
21
  $this->_title($this->__("GraphicMail Setting"));
22
- $this->renderLayout();
 
23
 
24
  }
25
 
 
 
 
26
  public function importAction(){
27
 
28
  /* Get customer model, run a query */
@@ -62,18 +75,54 @@ class Module_Graphicmail_Adminhtml_GraphicmailbackendController extends Mage_Adm
62
  $readConnection = $resource->getConnection('core_read');
63
  return $readConnection;
64
  }
 
 
 
65
  protected function updateGraphAccount($data){
 
66
  $Connection=$this->dataWrite();
67
  $fields="username='$data[username]', password='$data[password]', domain='$data[domain]'";
68
- $message='Account Information has been saved. MaillingList and Dataset need to select';
69
- if($data['maillist_id']){
70
- $fields.=" ,dataset_id='$data[dataset_id]',maillist_id='$data[maillist_id]'";
71
- $message='Mailling List and Dataset has been set';
72
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  $query="UPDATE graphic_account SET ".$fields;
74
  $Connection->query($query);
75
  return $message;
76
  }
 
 
 
 
 
 
 
 
 
 
77
  protected function getGraphAccount(){
78
  $Connection=$this->dataRead();
79
  $query='SELECT * FROM graphic_account';
@@ -81,12 +130,16 @@ class Module_Graphicmail_Adminhtml_GraphicmailbackendController extends Mage_Adm
81
  return $results;
82
  }
83
  protected function getMaillingList($user){
84
- $path="https://".$user['domain']."/api.aspx?Username=".$user['username']."&Password=".$user['password']."&Function=get_mailinglists&SID=0&Principal=blGnGdu9T4JLZWPAVI2D3sYSK2c9gT2Z";
 
85
  $doc = new DomDocument();
86
  $doc->load($path);
87
  $mailinglists = $doc->getElementsByTagName( "mailinglist" );
88
- $count=0;
 
 
89
  $_select='<select name="maillist_id">';
 
90
  foreach( $mailinglists as $mailinglist ){
91
  $mailinglistid = $mailinglist->getElementsByTagName("mailinglistid" );
92
  $mailinglistid = $mailinglistid->item(0)->nodeValue;
@@ -94,22 +147,38 @@ class Module_Graphicmail_Adminhtml_GraphicmailbackendController extends Mage_Adm
94
  $description = $description->item(0)->nodeValue;
95
  if($mailinglistid){
96
  $count++;
 
97
  if(@$user['maillist_id']==$mailinglistid)
98
  $_select.="<option selected='selected' value='$mailinglistid'>$description</option>";
99
  else
100
  $_select.="<option value='$mailinglistid'>$description</option>";
101
  }
 
 
 
 
 
 
 
 
 
 
102
  }
103
- $_select.='</select>';
104
- return $_select;
 
 
 
 
105
  }
106
  protected function getDataset($user){
107
- $path="https://".$user['domain']."/api.aspx?Username=".$user['username']."&Password=".$user['password']."&Function=get_datasets&SID=0&Principal=blGnGdu9T4JLZWPAVI2D3sYSK2c9gT2Z";
108
  $doc = new DomDocument();
109
  $doc->load($path);
110
  $datasets = $doc->getElementsByTagName( "dataset" );
111
  $count=0;
112
  $_dataset='<select name="dataset_id">';
 
113
  foreach( $datasets as $dataset ){
114
  $datasetid = $dataset->getElementsByTagName("datasetid" );
115
  $datasetid = $datasetid->item(0)->nodeValue;
@@ -120,7 +189,9 @@ class Module_Graphicmail_Adminhtml_GraphicmailbackendController extends Mage_Adm
120
  $_dataset.="<option selected='selected' value='$datasetid'>$name</option>";
121
  else
122
  $_dataset.="<option value='$datasetid'>$name</option>";
 
123
  }
 
124
  $_dataset.='</select>';
125
  return $_dataset;
126
  }
5
  {
6
  $this->loadLayout();
7
  $this->_title($this->__("GraphicMail Setting"));
8
+
9
+
10
  if(isset($_POST['domain'])){
11
  $_SESSION['message']=$this->updateGraphAccount($_POST);
12
  }
13
+
14
+
15
  $userinfo=$this->getGraphAccount();
16
  $_SESSION['GraphAccount']=$userinfo;
17
+ $condt=$this->getMaillingList($userinfo[0]);
18
+ if($condt!=1)
19
+ {
20
  $_SESSION['mailinglist']=$this->getMaillingList($userinfo[0]);
21
+ }
22
+
23
  $_SESSION['dataset']=$this->getDataset($userinfo[0]);
24
+
25
  $this->renderLayout();
26
  }
27
 
28
  public function saveAction() {
29
  $this->loadLayout();
30
  $this->_title($this->__("GraphicMail Setting"));
31
+
32
+ $this->renderLayout();
33
 
34
  }
35
 
36
+
37
+
38
+
39
  public function importAction(){
40
 
41
  /* Get customer model, run a query */
75
  $readConnection = $resource->getConnection('core_read');
76
  return $readConnection;
77
  }
78
+
79
+
80
+
81
  protected function updateGraphAccount($data){
82
+
83
  $Connection=$this->dataWrite();
84
  $fields="username='$data[username]', password='$data[password]', domain='$data[domain]'";
85
+
86
+ $userinfo=$this->getGraphAccount();
87
+
88
+ $condt=$this->getMaillingList($userinfo[0]);
89
+
90
+
91
+ if($condt!=1)
92
+ {
93
+ if($data['maillist_id']=="" || $data['maillist_id']==0)
94
+ {
95
+ $fields.=" ,dataset_id='$data[dataset_id]',maillist_id='$data[maillist_id]'";
96
+ $message='<li class="success-msg">Account Information has been saved. Mailling List need to select</li></ul></li>';
97
+ }
98
+ else
99
+ {
100
+ $fields.=" ,dataset_id='$data[dataset_id]',maillist_id='$data[maillist_id]'";
101
+ $message='<li class="success-msg"><ul><li>Mailling List has been set</li></ul></li>';
102
+ }
103
+ }
104
+ if($condt==1)
105
+ {
106
+ $fields.=" ,dataset_id='$data[dataset_id]',maillist_id='$data[maillist_id]'";
107
+ $message='<li class="error-msg">Authentication failed.Check domain name, username and password.</li></ul></li>';
108
+ }
109
+
110
+
111
+
112
  $query="UPDATE graphic_account SET ".$fields;
113
  $Connection->query($query);
114
  return $message;
115
  }
116
+
117
+ public function resetAction() {
118
+ $Connection=$this->dataWrite();
119
+ $fields="username='', password='', domain='', maillist_id=''";
120
+ $query="UPDATE graphic_account SET ".$fields;
121
+
122
+ $Connection->query($query);
123
+ $this->_redirect('*/*');
124
+ }
125
+
126
  protected function getGraphAccount(){
127
  $Connection=$this->dataRead();
128
  $query='SELECT * FROM graphic_account';
130
  return $results;
131
  }
132
  protected function getMaillingList($user){
133
+ $path="https://".$user['domain']."/api.aspx?Username=".$user['username']."&Password=".$user['password']."&Function=get_mailinglists&Principal=blGnGdu9T4JLZWPAVI2D3sYSK2c9gT2Z";
134
+
135
  $doc = new DomDocument();
136
  $doc->load($path);
137
  $mailinglists = $doc->getElementsByTagName( "mailinglist" );
138
+
139
+ $count=1;
140
+
141
  $_select='<select name="maillist_id">';
142
+ $_select.="<option selected='selected' value='0'>--------------------Select MailingList--------------------</option>";
143
  foreach( $mailinglists as $mailinglist ){
144
  $mailinglistid = $mailinglist->getElementsByTagName("mailinglistid" );
145
  $mailinglistid = $mailinglistid->item(0)->nodeValue;
147
  $description = $description->item(0)->nodeValue;
148
  if($mailinglistid){
149
  $count++;
150
+
151
  if(@$user['maillist_id']==$mailinglistid)
152
  $_select.="<option selected='selected' value='$mailinglistid'>$description</option>";
153
  else
154
  $_select.="<option value='$mailinglistid'>$description</option>";
155
  }
156
+
157
+
158
+ }
159
+
160
+ $_select.='</select>';
161
+
162
+
163
+ if($count>1)
164
+ {
165
+ return $_select;
166
  }
167
+ else
168
+ {
169
+ return $count;
170
+
171
+ }
172
+
173
  }
174
  protected function getDataset($user){
175
+ $path="https://".$user['domain']."/api.aspx?Username=".$user['username']."&Password=".$user['password']."&Function=get_datasets&Principal=blGnGdu9T4JLZWPAVI2D3sYSK2c9gT2Z";
176
  $doc = new DomDocument();
177
  $doc->load($path);
178
  $datasets = $doc->getElementsByTagName( "dataset" );
179
  $count=0;
180
  $_dataset='<select name="dataset_id">';
181
+
182
  foreach( $datasets as $dataset ){
183
  $datasetid = $dataset->getElementsByTagName("datasetid" );
184
  $datasetid = $datasetid->item(0)->nodeValue;
189
  $_dataset.="<option selected='selected' value='$datasetid'>$name</option>";
190
  else
191
  $_dataset.="<option value='$datasetid'>$name</option>";
192
+ $count++;
193
  }
194
+
195
  $_dataset.='</select>';
196
  return $_dataset;
197
  }
app/code/local/Module/Graphicmail/controllers/ManageController.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'Mage/Newsletter/controllers/ManageController.php';
3
+
4
+ class Module_Graphicmail_ManageController extends Mage_Newsletter_ManageController
5
+ {
6
+
7
+ public function saveAction()
8
+ {
9
+ if (!$this->_validateFormKey()) {
10
+ return $this->_redirect('customer/account/');
11
+ }
12
+ /**************** GRAPHICMAIL CODE ******************/
13
+ $graphicmail = Mage::getModel('customer/graphicmail');
14
+ $data=Mage::helper('customer')->getCustomer()->getData();
15
+ /*********************** END ************************/
16
+
17
+ try {
18
+ Mage::getSingleton('customer/session')->getCustomer()
19
+ ->setStoreId(Mage::app()->getStore()->getId())
20
+ ->setIsSubscribed((boolean)$this->getRequest()->getParam('is_subscribed', false))
21
+ ->save();
22
+ if ((boolean)$this->getRequest()->getParam('is_subscribed', false)) {
23
+ Mage::getSingleton('customer/session')->addSuccess($this->__('The subscription has been saved.'));
24
+ /**************** GRAPHICMAIL CODE ******************/
25
+ $graphicmail->subscribeGraphicMailNewsletter($data['email']);
26
+ /*********************** END ************************/
27
+
28
+ } else {
29
+ Mage::getSingleton('customer/session')->addSuccess($this->__('The subscription has been removed.'));
30
+ /**************** GRAPHICMAIL CODE ******************/
31
+ $graphicmail->unSubscribeGraphicMailNewsletter($data['email']);
32
+ /*********************** END ************************/
33
+
34
+ }
35
+ }
36
+ catch (Exception $e) {
37
+ Mage::getSingleton('customer/session')->addError($this->__('An error occurred while saving your subscription.'));
38
+ }
39
+ $this->_redirect('customer/account/');
40
+ }
41
+ }
app/code/local/Module/Graphicmail/etc/config.xml CHANGED
@@ -1,98 +1,123 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Module_Graphicmail>
5
- <version>0.1.0</version>
6
- </Module_Graphicmail>
7
- </modules>
8
-
9
- <global>
10
-
11
-
12
-
13
- <helpers>
14
- <graphicmail>
15
- <class>Module_Graphicmail_Helper</class>
16
- </graphicmail>
17
- </helpers>
18
-
19
- <blocks><graphicmail><class>Module_Graphicmail_Block</class></graphicmail></blocks>
20
- <resources>
21
- <graphicmail_setup>
22
- <setup>
23
- <module>Module_Graphicmail</module>
24
- </setup>
25
- <connection>
26
- <use>core_setup</use>
27
- </connection>
28
- </graphicmail_setup>
29
- <graphicmail_write>
30
- <connection>
31
- <use>core_write</use>
32
- </connection>
33
- </graphicmail_write>
34
- <graphicmail_read>
35
- <connection>
36
- <use>core_read</use>
37
- </connection>
38
- </graphicmail_read>
39
-
40
- </resources>
41
-
42
- </global>
43
- <admin>
44
- <routers>
45
- <graphicmail>
46
- <use>admin</use>
47
- <args>
48
- <module>Module_Graphicmail</module>
49
- <frontName>graphicmail</frontName>
50
- </args>
51
- </graphicmail>
52
- </routers>
53
- </admin><adminhtml>
54
- <menu>
55
- <graphicmail module="graphicmail">
56
- <title>Graphicmail</title>
57
- <sort_order>100</sort_order>
58
- <children>
59
- <graphicmailbackend module="graphicmail">
60
- <title>GraphicMail Setting</title>
61
- <sort_order>0</sort_order>
62
- <action>graphicmail/adminhtml_graphicmailbackend</action>
63
- </graphicmailbackend>
64
- </children>
65
- </graphicmail>
66
- </menu>
67
- <acl>
68
- <resources>
69
- <all>
70
- <title>Allow Everything</title>
71
- </all>
72
- <admin>
73
- <children>
74
- <graphicmail translate="title" module="graphicmail">
75
- <title>Graphicmail</title>
76
- <sort_order>1000</sort_order>
77
- <children>
78
- <graphicmailbackend translate="title">
79
- <title>GraphicMail Setting</title>
80
- </graphicmailbackend>
81
- </children>
82
- </graphicmail>
83
- </children>
84
- </admin>
85
-
86
- </resources>
87
- </acl>
88
-
89
- <layout>
90
- <updates>
91
- <graphicmail>
92
- <file>graphicmail.xml</file>
93
- </graphicmail>
94
- </updates>
95
- </layout>
96
- </adminhtml>
97
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Module_Graphicmail>
5
+ <version>0.1.0</version>
6
+ </Module_Graphicmail>
7
+ </modules>
8
+
9
+ <frontend>
10
+ <routers>
11
+ <customer>
12
+ <args>
13
+ <modules>
14
+ <module_graphicmail before="Mage_Customer">Module_Graphicmail</module_graphicmail>
15
+ </modules>
16
+ </args>
17
+ </customer>
18
+ </routers>
19
+ </frontend>
20
+
21
+ <frontend>
22
+ <routers>
23
+ <newsletter>
24
+ <args>
25
+ <modules>
26
+ <module_graphicmail before="Mage_Newsletter">Module_Graphicmail</module_graphicmail>
27
+ </modules>
28
+ </args>
29
+ </newsletter>
30
+ </routers>
31
+ </frontend>
32
+
33
+
34
+ <global>
35
+
36
+
37
+
38
+ <helpers>
39
+ <graphicmail>
40
+ <class>Module_Graphicmail_Helper</class>
41
+ </graphicmail>
42
+ </helpers>
43
+
44
+ <blocks><graphicmail><class>Module_Graphicmail_Block</class></graphicmail></blocks>
45
+ <resources>
46
+ <graphicmail_setup>
47
+ <setup>
48
+ <module>Module_Graphicmail</module>
49
+ </setup>
50
+ <connection>
51
+ <use>core_setup</use>
52
+ </connection>
53
+ </graphicmail_setup>
54
+ <graphicmail_write>
55
+ <connection>
56
+ <use>core_write</use>
57
+ </connection>
58
+ </graphicmail_write>
59
+ <graphicmail_read>
60
+ <connection>
61
+ <use>core_read</use>
62
+ </connection>
63
+ </graphicmail_read>
64
+
65
+ </resources>
66
+
67
+ </global>
68
+ <admin>
69
+ <routers>
70
+ <graphicmail>
71
+ <use>admin</use>
72
+ <args>
73
+ <module>Module_Graphicmail</module>
74
+ <frontName>graphicmail</frontName>
75
+ </args>
76
+ </graphicmail>
77
+ </routers>
78
+ </admin><adminhtml>
79
+ <menu>
80
+ <graphicmail module="graphicmail">
81
+ <title>Graphicmail</title>
82
+ <sort_order>100</sort_order>
83
+ <children>
84
+ <graphicmailbackend module="graphicmail">
85
+ <title>GraphicMail Setting</title>
86
+ <sort_order>0</sort_order>
87
+ <action>graphicmail/adminhtml_graphicmailbackend</action>
88
+ </graphicmailbackend>
89
+ </children>
90
+ </graphicmail>
91
+ </menu>
92
+ <acl>
93
+ <resources>
94
+ <all>
95
+ <title>Allow Everything</title>
96
+ </all>
97
+ <admin>
98
+ <children>
99
+ <graphicmail translate="title" module="graphicmail">
100
+ <title>Graphicmail</title>
101
+ <sort_order>1000</sort_order>
102
+ <children>
103
+ <graphicmailbackend translate="title">
104
+ <title>GraphicMail Setting</title>
105
+ </graphicmailbackend>
106
+ </children>
107
+ </graphicmail>
108
+ </children>
109
+ </admin>
110
+
111
+ </resources>
112
+ </acl>
113
+
114
+ <layout>
115
+ <updates>
116
+ <graphicmail>
117
+ <file>graphicmail.xml</file>
118
+ </graphicmail>
119
+ </updates>
120
+ </layout>
121
+ </adminhtml>
122
+
123
  </config>
app/design/adminhtml/default/default/template/graphicmail/graphicmailbackend.phtml CHANGED
@@ -1,135 +1,145 @@
1
  <style type="text/css">
2
- .black_overlay{
3
- display: none;
4
- position: fixed;
5
- top: 0%;
6
- left: 0%;
7
- width: 100%;
8
- height: 100%;
9
- background-color: black;
10
- z-index:1001;
11
- -moz-opacity: 0.8;
12
- opacity:.80;
13
- filter: alpha(opacity=80);
14
  }
15
  .white_content {
16
- display: none;
17
- position: absolute;
18
- top: 25%;
19
- left: 39%;
20
- width: 16%;
21
- height:15%;
22
- padding: 16px;
23
- border: 1px solid orange;
24
- background-color: white;
25
- z-index:1002;
26
- overflow: auto;
27
  }
28
- .btn{
29
- background: url("images/btn_bg.gif") repeat-x scroll 0 100% #FFAC47;
30
- border-color: #ED6502 #A04300 #A04300 #ED6502;
31
- border-style: solid;
32
- border-width: 1px;
33
- color: #FFFFFF;
34
- cursor: pointer;
35
- font: bold 12px arial,helvetica,sans-serif;
36
- padding: 0 7px 1px;
37
- text-align: center !important;
38
- white-space: nowrap;
39
- text-decoration:none;
40
  }
41
-
42
  </style>
43
  <div id="anchor-content" class="middle">
44
- <div id="page:main-container">
45
-
46
- <div id="messages"><ul class="messages">
47
- <?php if(isset($_SESSION['message'])){ ?>
48
- <li class="success-msg"><ul><li><?php echo $_SESSION['message']?></li></ul></li>
49
- <?php } ?>
50
- <?php if(isset($_SESSION['error'])){ ?>
51
- <li class="error-msg"><ul><li><?php echo $_SESSION['error']?></li></ul></li>
52
- <?php } ?>
53
- </ul></div>
54
-
55
- <div class="content-header" style="visibility: visible;">
56
- <h3 class="icon-head head-system-account">GraphicMail</h3>
57
- <?php $_key=explode('/',$_SERVER['REQUEST_URI']);$c=count($_key);$_key=$_key[$c-2];?>
58
- <p class="form-buttons">
59
- <button style="" onclick="setLocation(window.location.href)" class="scalable " type="button" id="id_<?php echo $_key?>"><span>Reset</span></button>
60
- <button style="" onclick="editForm.submit();" class="scalable save" type="button" id="id_<?php echo $_key?>"><span>Save Account</span></button>
61
-
62
- <button style="" onclick="document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'" class="scalable save" type="button" id="id_<?php echo $_key?>"><span>Upload contacts to GraphicMail</span></button>
63
-
64
- </p>
65
- </div>
66
- <?php $readonly=isset($_SESSION['mailinglist'])?'':'';?>
67
-
68
- <div class="entry-edit">
69
-
70
- <form id="edit_form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"><div><input type="hidden" name="form_key" value="<?php echo $this->getFormKey(); ?>" /></div><div class="entry-edit-head">
71
- <h4 class="icon-head head-edit-form fieldset-legend">Account Information</h4>
72
- <div class="form-buttons"></div>
73
- </div>
74
- <div id="base_fieldset" class="fieldset ">
75
- <div class="hor-scroll">
76
- <table cellspacing="0" class="form-list">
77
- <tbody>
78
- <tr>
79
- <td class="label"><label for="userame">Enter GrapicMail Domain <span class="required">*</span></label></td>
80
- <td class="value">
81
- <input <?php echo $readonly?> type="text" class=" input-text required-entry" title="Enter GrapicMail Domain" value="<?php echo isset($_SESSION['GraphAccount'])?$_SESSION['GraphAccount'][0][domain]:''?>" name="domain" id="domain"> </td>
82
- </tr>
83
- <tr>
84
- <td class="label"><label for="userame">GraphicMail Api Username <span class="required">*</span></label></td>
85
- <td class="value">
86
- <input <?php echo $readonly?> type="text" class=" input-text required-entry" title="User Name" value="<?php echo isset($_SESSION['GraphAccount'])?$_SESSION['GraphAccount'][0][username]:''?>" name="username" id="api_user"> </td>
87
- </tr>
88
- <tr>
89
- <td class="label"><label for="firstname">GraphicMail Api Password<span class="required">*</span></label></td>
90
- <td class="value">
91
- <input <?php echo $readonly?> type="password" class=" input-text required-entry" title="Password" value="<?php echo isset($_SESSION['GraphAccount'])?$_SESSION['GraphAccount'][0][password]:''?>" name="password" id="firstname"> </td>
92
- </tr>
93
- <?php if($_SESSION['mailinglist']):?>
94
- <tr>
95
- <td class="label"><label for="firstname">GraphicMail Malling List</label></td>
96
- <td class="value">
97
- <?php echo $_SESSION['mailinglist']?>
98
- </td>
99
- </tr>
100
- </tr>
101
- <tr>
102
- <td class="label"><label for="firstname">GraphicMail Dataset</label></td>
103
- <td class="value">
104
- <?php echo $_SESSION['dataset']?>
105
- </td>
106
- </tr>
107
- <?php endif; ?>
108
- </tbody>
109
- </table>
110
- </div>
111
  </div>
112
- </form></div>
113
- <script type="text/javascript">
114
- editForm = new varienForm('edit_form', '');
115
- </script>
116
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  </div>
118
- <?php unset($_SESSION['message'])?>
119
- <?php unset($_SESSION['error'])?>
 
 
 
 
 
 
 
 
120
  <?php unset($_SESSION['GraphAccount'])?>
121
  <?php unset($_SESSION['mailinglist'])?>
122
  <?php unset($_SESSION['dataset'])?>
123
-
124
  <div id="light" class="white_content">
125
- <?php $baseurl=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) ?>
126
- <form action="<?php echo $baseurl.'index.php/graphicmail/adminhtml_graphicmailbackend/import/key/'.$_key; ?>" method="post" enctype="multipart/form-data">
127
- <input type="hidden" name="form_key" value="<? echo $this->getFormKey(); ?>" />
128
- <table>
129
- <tr><td class="label">Do you Really want to Upload data </td></tr>
130
- <tr><td><input class="btn" type="submit" name="import" value="Upload" />
131
- <input class="btn" type="button" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'" value="Cancel" /></td></tr>
132
- </table>
133
- </form></div>
134
-
135
- <div id="fade" class="black_overlay"></div>
 
 
 
 
1
  <style type="text/css">
2
+ .black_overlay {
3
+ display: none;
4
+ position: fixed;
5
+ top: 0%;
6
+ left: 0%;
7
+ width: 100%;
8
+ height: 100%;
9
+ background-color: black;
10
+ z-index:1001;
11
+ -moz-opacity: 0.8;
12
+ opacity:.80;
13
+ filter: alpha(opacity=80);
14
  }
15
  .white_content {
16
+ display: none;
17
+ position: absolute;
18
+ top: 25%;
19
+ left: 39%;
20
+ width: 16%;
21
+ height:15%;
22
+ padding: 16px;
23
+ border: 1px solid orange;
24
+ background-color: white;
25
+ z-index:1002;
26
+ overflow: auto;
27
  }
28
+ .btn {
29
+ background: url("images/btn_bg.gif") repeat-x scroll 0 100% #FFAC47;
30
+ border-color: #ED6502 #A04300 #A04300 #ED6502;
31
+ border-style: solid;
32
+ border-width: 1px;
33
+ color: #FFFFFF;
34
+ cursor: pointer;
35
+ font: bold 12px arial, helvetica, sans-serif;
36
+ padding: 0 7px 1px;
37
+ text-align: center !important;
38
+ white-space: nowrap;
39
+ text-decoration:none;
40
  }
 
41
  </style>
42
  <div id="anchor-content" class="middle">
43
+ <div id="page:main-container">
44
+ <div id="messages">
45
+ <ul class="messages">
46
+ <?php if($_SESSION['mailinglist']){
47
+ echo '<li class="success-msg">Account Information has been saved </li></ul></li>';
48
+
49
+ }
50
+
51
+ else if(isset($_SESSION['message'])){ ?>
52
+ <?php echo $_SESSION['message']?>
53
+ <?php } ?>
54
+ <?php if(isset($_SESSION['error'])){ ?>
55
+ <li class="error-msg">
56
+ <ul>
57
+ <li><?php echo $_SESSION['error']?></li>
58
+ </ul>
59
+ </li>
60
+ <?php } ?>
61
+ </ul>
62
+ </div>
63
+ <div class="content-header" style="visibility: visible;">
64
+ <h3 class="icon-head head-system-account">GraphicMail</h3>
65
+ <?php $_key=explode('/',$_SERVER['REQUEST_URI']);$c=count($_key);$_key=$_key[$c-2];?>
66
+ <p class="form-buttons"> <a href="<?php echo $this->getUrl('*/*/reset')?>">
67
+ <button class="scalable " type="button" id="id_<?php echo $_key?>"><span>Reset</span></button>
68
+ </a>
69
+ <button style="" onclick="editForm.submit();" class="scalable save" type="button" id="id_<?php echo $_key?>"><span>Save Account</span></button>
70
+ </p>
71
+ </div>
72
+ <?php $readonly=isset($_SESSION['mailinglist'])?'':'';?>
73
+ <div class="entry-edit">
74
+ <form id="edit_form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
75
+ <div>
76
+ <input type="hidden" name="form_key" value="<?php echo $this->getFormKey(); ?>" />
77
+ </div>
78
+ <div class="entry-edit-head">
79
+ <h4 class="icon-head head-edit-form fieldset-legend">Account Information</h4>
80
+ <div class="form-buttons"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  </div>
82
+ <div id="base_fieldset" class="fieldset ">
83
+ <div class="hor-scroll">
84
+ <table cellspacing="0" class="form-list">
85
+ <tbody>
86
+ <tr>
87
+ <td class="label"><label for="userame">Enter GrapicMail Domain <span class="required">*</span></label></td>
88
+ <td class="value"><input <?php echo $readonly?> type="text" class=" input-text required-entry" title="Enter GrapicMail Domain" value="<?php echo isset($_SESSION['GraphAccount'])?$_SESSION['GraphAccount'][0][domain]:''?>" name="domain" id="domain"></td>
89
+ </tr>
90
+ <tr>
91
+ <td class="label"><label for="userame">GraphicMail Api Username <span class="required">*</span></label></td>
92
+ <td class="value"><input <?php echo $readonly?> type="text" class=" input-text required-entry" title="User Name" value="<?php echo isset($_SESSION['GraphAccount'])?$_SESSION['GraphAccount'][0][username]:''?>" name="username" id="api_user"></td>
93
+ </tr>
94
+ <tr>
95
+ <td class="label"><label for="firstname">GraphicMail Api Password<span class="required">*</span></label></td>
96
+ <td class="value"><input <?php echo $readonly?> type="password" class=" input-text required-entry" title="Password" value="<?php echo isset($_SESSION['GraphAccount'])?$_SESSION['GraphAccount'][0][password]:''?>" name="password" id="firstname"></td>
97
+ </tr>
98
+ <?php if($_SESSION['mailinglist']):?>
99
+ <tr>
100
+ <td class="label"><label for="firstname">GraphicMail Malling List</label></td>
101
+ <td class="value"><?php echo $_SESSION['mailinglist']?></td>
102
+ </tr>
103
+ </tr>
104
+
105
+ <!----<tr>
106
+ <td class="label"><label for="firstname">GraphicMail Dataset</label></td>
107
+ <td class="value">
108
+ < echo $_SESSION['dataset']?>
109
+ </td>
110
+ </tr>---->
111
+ <?php endif; ?>
112
+ </tbody>
113
+
114
+ </table>
115
+ </div>
116
  </div>
117
+ </form>
118
+ </div>
119
+ <script type="text/javascript">
120
+ editForm = new varienForm('edit_form', '');
121
+
122
+ </script>
123
+ </div>
124
+ </div>
125
+ <?php unset($_SESSION['message'])?>
126
+ <?php unset($_SESSION['error'])?>
127
  <?php unset($_SESSION['GraphAccount'])?>
128
  <?php unset($_SESSION['mailinglist'])?>
129
  <?php unset($_SESSION['dataset'])?>
 
130
  <div id="light" class="white_content">
131
+ <?php $baseurl=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) ?>
132
+ <form action="<?php echo $baseurl.'index.php/graphicmail/adminhtml_graphicmailbackend/import/key/'.$_key; ?>" method="post" enctype="multipart/form-data">
133
+ <input type="hidden" name="form_key" value="<? echo $this->getFormKey(); ?>" />
134
+ <table>
135
+ <tr>
136
+ <td class="label">Do you Really want to Upload data </td>
137
+ </tr>
138
+ <tr>
139
+ <td><input class="btn" type="submit" name="import" value="Upload" />
140
+ <input class="btn" type="button" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'" value="Cancel" /></td>
141
+ </tr>
142
+ </table>
143
+ </form>
144
+ </div>
145
+ <div id="fade" class="black_overlay"></div>
app/design/adminhtml/default/default/template/graphicmail/graphicmailimport.phtml CHANGED
@@ -1,71 +1,71 @@
1
- <div id="anchor-content" class="middle">
2
- <div id="page:main-container">
3
-
4
- <?php if(isset($_SESSION['message'])){ ?>
5
- <div id="messages"><ul class="messages"><li class="success-msg"><ul><li><?php echo $_SESSION['message']?></li></ul></li></ul></div>
6
- <?php } ?>
7
- <div class="content-header" style="visibility: visible;">
8
- <h3 class="icon-head head-system-account">GraphicMail</h3>
9
- <?php $_key=explode('/',$_SERVER['REQUEST_URI']);$c=count($_key);$_key=$_key[$c-2];?>
10
- <p class="form-buttons">
11
- <button style="" onclick="setLocation(window.location.href)" class="scalable " type="button" id="id_<?php echo $_key?>"><span>Reset</span></button>
12
- <button style="" onclick="editForm.submit();" class="scalable save" type="button" id="id_<?php echo $_key?>"><span>Save Account</span></button>
13
-
14
- </p>
15
- </div>
16
- <?php $readonly=isset($_SESSION['mailinglist'])?' readonly="yes" ':'';?>
17
-
18
- <div class="entry-edit">
19
-
20
- <form id="edit_form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"><div><input type="hidden" name="form_key" value="<? echo $this->getFormKey(); ?>" /></div><div class="entry-edit-head">
21
- <h4 class="icon-head head-edit-form fieldset-legend">Account Information</h4>
22
- <div class="form-buttons"></div>
23
- </div>
24
- <div id="base_fieldset" class="fieldset ">
25
- <div class="hor-scroll">
26
- <table cellspacing="0" class="form-list">
27
- <tbody>
28
- <tr>
29
- <td class="label"><label for="userame">Enter GrapicMail Domain <span class="required">*</span></label></td>
30
- <td class="value">
31
- <input <?php echo $readonly?> type="text" class=" input-text required-entry" title="Enter GrapicMail Domain" value="<?php echo isset($_SESSION['GraphAccount'])?$_SESSION['GraphAccount'][0][domain]:''?>" name="domain" id="domain"> </td>
32
- </tr>
33
- <tr>
34
- <td class="label"><label for="userame">GraphicMail Api Username <span class="required">*</span></label></td>
35
- <td class="value">
36
- <input <?php echo $readonly?> type="text" class=" input-text required-entry" title="User Name" value="<?php echo isset($_SESSION['GraphAccount'])?$_SESSION['GraphAccount'][0][username]:''?>" name="username" id="api_user"> </td>
37
- </tr>
38
- <tr>
39
- <td class="label"><label for="firstname">GraphicMail Api Password<span class="required">*</span></label></td>
40
- <td class="value">
41
- <input <?php echo $readonly?> type="password" class=" input-text required-entry" title="Password" value="<?php echo isset($_SESSION['GraphAccount'])?$_SESSION['GraphAccount'][0][password]:''?>" name="password" id="firstname"> </td>
42
- </tr>
43
- <?php if($_SESSION['mailinglist']):?>
44
- <tr>
45
- <td class="label"><label for="firstname">GraphicMail Malling List</label></td>
46
- <td class="value">
47
- <?php echo $_SESSION['mailinglist']?>
48
- </td>
49
- </tr>
50
- </tr>
51
- <tr>
52
- <td class="label"><label for="firstname">GraphicMail Dataset</label></td>
53
- <td class="value">
54
- <?php echo $_SESSION['dataset']?>
55
- </td>
56
- </tr>
57
- <?php endif; ?>
58
- </tbody>
59
- </table>
60
- </div>
61
- </div>
62
- </form></div>
63
- <script type="text/javascript">
64
- editForm = new varienForm('edit_form', '');
65
- </script>
66
- </div>
67
- </div>
68
- <?php unset($_SESSION['message'])?>
69
- <?php unset($_SESSION['GraphAccount'])?>
70
- <?php unset($_SESSION['mailinglist'])?>
71
  <?php unset($_SESSION['dataset'])?>
1
+ <div id="anchor-content" class="middle">
2
+ <div id="page:main-container">
3
+
4
+ <?php if(isset($_SESSION['message'])){ ?>
5
+ <div id="messages"><ul class="messages"><li class="success-msg"><ul><li><?php echo $_SESSION['message']?></li></ul></li></ul></div>
6
+ <?php } ?>
7
+ <div class="content-header" style="visibility: visible;">
8
+ <h3 class="icon-head head-system-account">GraphicMail</h3>
9
+ <?php $_key=explode('/',$_SERVER['REQUEST_URI']);$c=count($_key);$_key=$_key[$c-2];?>
10
+ <p class="form-buttons">
11
+ <button style="" onclick="setLocation(window.location.href)" class="scalable " type="button" id="id_<?php echo $_key?>"><span>Reset</span></button>
12
+ <button style="" onclick="editForm.submit();" class="scalable save" type="button" id="id_<?php echo $_key?>"><span>Save Account</span></button>
13
+
14
+ </p>
15
+ </div>
16
+ <?php $readonly=isset($_SESSION['mailinglist'])?' readonly="yes" ':'';?>
17
+
18
+ <div class="entry-edit">
19
+
20
+ <form id="edit_form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"><div><input type="hidden" name="form_key" value="<? echo $this->getFormKey(); ?>" /></div><div class="entry-edit-head">
21
+ <h4 class="icon-head head-edit-form fieldset-legend">Account Information</h4>
22
+ <div class="form-buttons"></div>
23
+ </div>
24
+ <div id="base_fieldset" class="fieldset ">
25
+ <div class="hor-scroll">
26
+ <table cellspacing="0" class="form-list">
27
+ <tbody>
28
+ <tr>
29
+ <td class="label"><label for="userame">Enter GrapicMail Domain <span class="required">*</span></label></td>
30
+ <td class="value">
31
+ <input <?php echo $readonly?> type="text" class=" input-text required-entry" title="Enter GrapicMail Domain" value="<?php echo isset($_SESSION['GraphAccount'])?$_SESSION['GraphAccount'][0][domain]:''?>" name="domain" id="domain"> </td>
32
+ </tr>
33
+ <tr>
34
+ <td class="label"><label for="userame">GraphicMail Api Username <span class="required">*</span></label></td>
35
+ <td class="value">
36
+ <input <?php echo $readonly?> type="text" class=" input-text required-entry" title="User Name" value="<?php echo isset($_SESSION['GraphAccount'])?$_SESSION['GraphAccount'][0][username]:''?>" name="username" id="api_user"> </td>
37
+ </tr>
38
+ <tr>
39
+ <td class="label"><label for="firstname">GraphicMail Api Password<span class="required">*</span></label></td>
40
+ <td class="value">
41
+ <input <?php echo $readonly?> type="password" class=" input-text required-entry" title="Password" value="<?php echo isset($_SESSION['GraphAccount'])?$_SESSION['GraphAccount'][0][password]:''?>" name="password" id="firstname"> </td>
42
+ </tr>
43
+ <?php if($_SESSION['mailinglist']):?>
44
+ <tr>
45
+ <td class="label"><label for="firstname">GraphicMail Malling List</label></td>
46
+ <td class="value">
47
+ <?php echo $_SESSION['mailinglist']?>
48
+ </td>
49
+ </tr>
50
+ </tr>
51
+ <!---<tr>
52
+ <td class="label"><label for="firstname">GraphicMail Dataset</label></td>
53
+ <td class="value">
54
+ <?ph echo $_SESSION['dataset']?>
55
+ </td>
56
+ </tr>-->
57
+ <?php endif; ?>
58
+ </tbody>
59
+ </table>
60
+ </div>
61
+ </div>
62
+ </form></div>
63
+ <script type="text/javascript">
64
+ editForm = new varienForm('edit_form', '');
65
+ </script>
66
+ </div>
67
+ </div>
68
+ <?php unset($_SESSION['message'])?>
69
+ <?php unset($_SESSION['GraphAccount'])?>
70
+ <?php unset($_SESSION['mailinglist'])?>
71
  <?php unset($_SESSION['dataset'])?>
package.xml CHANGED
@@ -1,22 +1,22 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>GraphicMailApi</name>
4
- <version>1.0.3</version>
5
  <stability>stable</stability>
6
- <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Grow your mailing list through Magento transactions! Every time someone
10
- registers to buy from your online shop or service via Magento, ask them
11
- to opt in to your GraphicMail newsletter. This way, you can send them
12
- targeted newsletters, i.e. notify them of new specials, good deals, or
13
  new products.</summary>
14
  <description>This is a free extension.Grow your mailing list through Magento transactions! Every time someone registers to buy from your online shop or service via Magento, ask them to opt in to your GraphicMail newsletter. This way, you can send them targeted newsletters, i.e. notify them of new specials, good deals, or new products.</description>
15
  <notes>Release notes for users and developers</notes>
16
- <authors><author><name>admin</name><user>auto-converted</user><email>teamlead@a1professionals.com</email></author></authors>
17
- <date>2011-12-16</date>
18
- <time>11:19:23</time>
19
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="graphicmail.xml" hash="d69c6f1bb796732cc830389284015853"/></dir><dir name="template"><dir name="graphicmail"><file name="graphicmailbackend.phtml" hash="bceabaa48c71e28fa6c56c317b71b4dd"/><file name="graphicmailimport.phtml" hash="8e1df1e2eb7abaa6aa465f929775b0e8"/></dir></dir></dir></dir></dir></target><target name="magecore"><dir name="Mage"><dir name="Customer"><dir name="controllers"><file name="AccountController.php" hash="fabf0ab3d01c094089d0b9a7a039af06"/><file name="AddressController.php" hash="2a88a718d4ccc453112c01636741c13c"/></dir><dir name="Model"><file name="Graphicmail.php" hash="cbf7e919d1b5bc633cd0db04a0198c0b"/></dir></dir></dir></target><target name="magelocal"><dir name="Module"><dir name="Graphicmail"><dir name="Block"><dir name="Adminhtml"><file name="Graphicmailbackend.php" hash="cd0b8cb2ddc3f21fd0c0844f46740389"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="GraphicmailbackendController.php" hash="06136b645bd0f3a12bd198d583ca4085"/></dir></dir><dir name="etc"><file name="config.xml" hash="feca0393ae0cf9e5e0ec50d945d17abe"/></dir><dir name="Helper"><file name="Data.php" hash="24b41d7328fc0aa88965a1164be33aef"/></dir><dir name="sql"><dir name="graphicmail_setup"><file name="mysql4-install-0.1.0.php" hash="ff75c4c28ce633d36e13b30d987edf91"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Module_Graphicmail.xml" hash="3a45199ddca90a9ad7e0f7e670c895b1"/></dir></target></contents>
20
  <compatible/>
21
- <dependencies/>
22
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>GraphicMailApi</name>
4
+ <version>1.0.4</version>
5
  <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Grow your mailing list through Magento transactions! Every time someone &#xD;
10
+ registers to buy from your online shop or service via Magento, ask them &#xD;
11
+ to opt in to your GraphicMail newsletter. This way, you can send them &#xD;
12
+ targeted newsletters, i.e. notify them of new specials, good deals, or &#xD;
13
  new products.</summary>
14
  <description>This is a free extension.Grow your mailing list through Magento transactions! Every time someone registers to buy from your online shop or service via Magento, ask them to opt in to your GraphicMail newsletter. This way, you can send them targeted newsletters, i.e. notify them of new specials, good deals, or new products.</description>
15
  <notes>Release notes for users and developers</notes>
16
+ <authors><author><name>a1professionals</name><user>a1professionals</user><email>teamlead@a1professionals.com</email></author></authors>
17
+ <date>2013-02-19</date>
18
+ <time>15:00:08</time>
19
+ <contents><target name="magelocal"><dir name="Module"><dir name="Graphicmail"><dir name="Block"><dir name="Adminhtml"><file name="Graphicmailbackend.php" hash="cd0b8cb2ddc3f21fd0c0844f46740389"/></dir></dir><dir name="Helper"><file name="Data.php" hash="24b41d7328fc0aa88965a1164be33aef"/></dir><dir name="controllers"><file name="AccountController.php" hash="31f5e0e8fdd9af0e234be22c9a27acb9"/><file name="AddressController.php" hash="da916d6c70d9b68b9080356dc8cae4ea"/><dir name="Adminhtml"><file name="GraphicmailbackendController.php" hash="9dc3d404466da550cb4085b892eb27d3"/></dir><file name="ManageController.php" hash="1f0625a44572f684666e35606788847b"/></dir><dir name="etc"><file name="config.xml" hash="8937c3511eedffb9559115729de78a73"/></dir><dir name="sql"><dir name="graphicmail_setup"><file name="mysql4-install-0.1.0.php" hash="ff75c4c28ce633d36e13b30d987edf91"/></dir></dir></dir></dir></target><target name="magecore"><dir name="Mage"><dir name="Customer"><dir name="Model"><file name="Graphicmail.php" hash="87398b7b99c414cb6b8e7feae60a3a68"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="graphicmail.xml" hash="d69c6f1bb796732cc830389284015853"/></dir><dir name="template"><dir name="graphicmail"><file name="graphicmailbackend.phtml" hash="c7bcf5fe4c8b6eac9c79d0afd158ae31"/><file name="graphicmailimport.phtml" hash="88230b1db1196d784eeabc76f318057c"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Module_Graphicmail.xml" hash="3a45199ddca90a9ad7e0f7e670c895b1"/></dir></target></contents>
20
  <compatible/>
21
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
22
  </package>