Magestore_Product_Contact - Version 0.1.0

Version Notes

Magestore Productcontact

Download this release

Release Info

Developer Magestore
Extension Magestore_Product_Contact
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

Files changed (112) hide show
  1. app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback.php +12 -0
  2. app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Edit.php +51 -0
  3. app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Edit/Form.php +19 -0
  4. app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Edit/Tab/Form.php +110 -0
  5. app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Edit/Tab/History.php +31 -0
  6. app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Edit/Tab/Message.php +28 -0
  7. app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Edit/Tabs.php +37 -0
  8. app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Grid.php +126 -0
  9. app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Renderer/File.php +34 -0
  10. app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Renderer/Product.php +10 -0
  11. app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Renderer/Sentstatus.php +14 -0
  12. app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Renderer/Status.php +22 -0
  13. app/code/local/Magestore/Magenotification/Block/Adminhtml/License/Purchaseform.php +15 -0
  14. app/code/local/Magestore/Magenotification/Block/Adminhtml/License/Updateform.php +39 -0
  15. app/code/local/Magestore/Magenotification/Block/Config/Extensionkeys.php +148 -0
  16. app/code/local/Magestore/Magenotification/Block/Config/Field.php +14 -0
  17. app/code/local/Magestore/Magenotification/Block/Config/Label.php +13 -0
  18. app/code/local/Magestore/Magenotification/Helper/Data.php +1 -0
  19. app/code/local/Magestore/Magenotification/Helper/Feedback.php +1 -0
  20. app/code/local/Magestore/Magenotification/Helper/License.php +1 -0
  21. app/code/local/Magestore/Magenotification/Model/Feedback.php +62 -0
  22. app/code/local/Magestore/Magenotification/Model/Feedbackmessage.php +49 -0
  23. app/code/local/Magestore/Magenotification/Model/Keygen.php +1 -0
  24. app/code/local/Magestore/Magenotification/Model/Logger.php +11 -0
  25. app/code/local/Magestore/Magenotification/Model/Magenotification.php +171 -0
  26. app/code/local/Magestore/Magenotification/Model/Mysql4/Feedback.php +9 -0
  27. app/code/local/Magestore/Magenotification/Model/Mysql4/Feedback/Collection.php +10 -0
  28. app/code/local/Magestore/Magenotification/Model/Mysql4/Feedbackmessage.php +9 -0
  29. app/code/local/Magestore/Magenotification/Model/Mysql4/Feedbackmessage/Collection.php +10 -0
  30. app/code/local/Magestore/Magenotification/Model/Mysql4/Logger.php +9 -0
  31. app/code/local/Magestore/Magenotification/Model/Mysql4/Logger/Collection.php +10 -0
  32. app/code/local/Magestore/Magenotification/Model/Mysql4/Magenotification.php +9 -0
  33. app/code/local/Magestore/Magenotification/Model/Mysql4/Magenotification/Collection.php +10 -0
  34. app/code/local/Magestore/Magenotification/Model/Observer.php +14 -0
  35. app/code/local/Magestore/Magenotification/Model/Source/Time.php +38 -0
  36. app/code/local/Magestore/Magenotification/Model/Status.php +15 -0
  37. app/code/local/Magestore/Magenotification/controllers/Adminhtml/FeedbackController.php +300 -0
  38. app/code/local/Magestore/Magenotification/controllers/Adminhtml/LicenseController.php +32 -0
  39. app/code/local/Magestore/Magenotification/controllers/Adminhtml/MagenotificationController.php +15 -0
  40. app/code/local/Magestore/Magenotification/etc/adminhtml.xml +72 -0
  41. app/code/local/Magestore/Magenotification/etc/config.xml +103 -0
  42. app/code/local/Magestore/Magenotification/etc/system.xml +120 -0
  43. app/code/local/Magestore/Magenotification/sql/magenotification_setup/mysql4-install-0.1.0.php +22 -0
  44. app/code/local/Magestore/Magenotification/sql/magenotification_setup/mysql4-install-0.1.1.php +59 -0
  45. app/code/local/Magestore/Magenotification/sql/magenotification_setup/mysql4-install-0.1.2.php +73 -0
  46. app/code/local/Magestore/Magenotification/sql/magenotification_setup/mysql4-upgrade-0.1.0-0.1.1.php +59 -0
  47. app/code/local/Magestore/Magenotification/sql/magenotification_setup/mysql4-upgrade-0.1.0-0.1.2.php +64 -0
  48. app/code/local/Magestore/Magenotification/sql/magenotification_setup/mysql4-upgrade-0.1.1-0.1.2.php +26 -0
  49. app/code/local/Magestore/Productcontact/Block/Adminhtml/Productcontact.php +13 -0
  50. app/code/local/Magestore/Productcontact/Block/Adminhtml/Productcontact/Edit.php +45 -0
  51. app/code/local/Magestore/Productcontact/Block/Adminhtml/Productcontact/Edit/Form.php +19 -0
  52. app/code/local/Magestore/Productcontact/Block/Adminhtml/Productcontact/Edit/Tab/Form.php +58 -0
  53. app/code/local/Magestore/Productcontact/Block/Adminhtml/Productcontact/Edit/Tabs.php +24 -0
  54. app/code/local/Magestore/Productcontact/Block/Adminhtml/Productcontact/Grid.php +158 -0
  55. app/code/local/Magestore/Productcontact/Block/Adminhtml/Productcontact/Renderer/Customeremail.php +19 -0
  56. app/code/local/Magestore/Productcontact/Block/Adminhtml/Productcontact/Renderer/Productname.php +11 -0
  57. app/code/local/Magestore/Productcontact/Block/Adminhtml/Productcontact/View.php +23 -0
  58. app/code/local/Magestore/Productcontact/Block/Productcontact.php +30 -0
  59. app/code/local/Magestore/Productcontact/Block/Sendtoadmin.php +6 -0
  60. app/code/local/Magestore/Productcontact/Block/Sendtocustomer.php +6 -0
  61. app/code/local/Magestore/Productcontact/Helper/Data.php +130 -0
  62. app/code/local/Magestore/Productcontact/Model/Mysql4/Productcontact.php +10 -0
  63. app/code/local/Magestore/Productcontact/Model/Mysql4/Productcontact/Collection.php +10 -0
  64. app/code/local/Magestore/Productcontact/Model/Productcontact.php +130 -0
  65. app/code/local/Magestore/Productcontact/Model/Status.php +15 -0
  66. app/code/local/Magestore/Productcontact/controllers/Adminhtml/ProductcontactController.php +221 -0
  67. app/code/local/Magestore/Productcontact/controllers/IndexController.php +130 -0
  68. app/code/local/Magestore/Productcontact/etc/adminhtml.xml +55 -0
  69. app/code/local/Magestore/Productcontact/etc/config.xml +148 -0
  70. app/code/local/Magestore/Productcontact/etc/system.xml +341 -0
  71. app/code/local/Magestore/Productcontact/sql/productcontact_setup/mysql4-install-0.1.0.php +34 -0
  72. app/design/adminhtml/default/default/layout/magenotification.xml +16 -0
  73. app/design/adminhtml/default/default/layout/productcontact.xml +21 -0
  74. app/design/adminhtml/default/default/template/magenotification/feedback/files.phtml +17 -0
  75. app/design/adminhtml/default/default/template/magenotification/feedback/history.phtml +31 -0
  76. app/design/adminhtml/default/default/template/magenotification/license/purchaseform.phtml +7 -0
  77. app/design/adminhtml/default/default/template/magenotification/license/updateform.phtml +41 -0
  78. app/design/adminhtml/default/default/template/productcontact/view.phtml +131 -0
  79. app/design/frontend/default/default/layout/productcontact.xml +30 -0
  80. app/design/frontend/default/default/template/productcontact/contact_form.phtml +217 -0
  81. app/design/frontend/default/default/template/productcontact/email/sendtoadmin.phtml +37 -0
  82. app/design/frontend/default/default/template/productcontact/email/sendtocustomer.phtml +10 -0
  83. app/design/frontend/default/default/template/productcontact/productcontact.phtml +3 -0
  84. app/etc/modules/Magestore_Magenotification.xml +9 -0
  85. app/etc/modules/Magestore_Productcontact.xml +9 -0
  86. app/locale/en_US/Magestore_Productcontact.csv +20 -0
  87. app/locale/en_US/template/email/productcontact/email-to-admin.html +39 -0
  88. app/locale/en_US/template/email/productcontact/email-to-customer.html +37 -0
  89. js/magestore/productcontact.js +67 -0
  90. js/tinybox/tinybox.js +126 -0
  91. lib/captcha/ARLRDBD.TTF +0 -0
  92. lib/captcha/Readme.txt +105 -0
  93. lib/captcha/bradhitc.ttf +0 -0
  94. lib/captcha/captcha.php +55 -0
  95. lib/captcha/class.simplecaptcha.php +244 -0
  96. lib/captcha/contact.html +294 -0
  97. lib/captcha/testCaptcha.php +74 -0
  98. lib/captcha/times.ttf +0 -0
  99. lib/captcha/vssver.scc +0 -0
  100. lib/captcha/white.png +0 -0
  101. lib/recaptcha/ARLRDBD.TTF +0 -0
  102. lib/recaptcha/generate_captcha.php +52 -0
  103. lib/recaptcha/recaptchalib-aw.php +277 -0
  104. lib/recaptcha/recaptchalib.php +277 -0
  105. lib/recaptcha/vssver.scc +0 -0
  106. package.xml +18 -0
  107. skin/adminhtml/default/default/css/magestore/magenotification.css +1 -0
  108. skin/adminhtml/default/default/css/magestore/notice_price.gif +0 -0
  109. skin/adminhtml/default/default/css/tinybox/images/preload.gif +0 -0
  110. skin/adminhtml/default/default/css/tinybox/images/rhino.jpg +0 -0
  111. skin/adminhtml/default/default/css/tinybox/style.css +8 -0
  112. skin/adminhtml/default/default/productcontact/productcontact.css +4 -0
app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Magenotification_Block_Adminhtml_Feedback extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_feedback';
7
+ $this->_blockGroup = 'magenotification';
8
+ $this->_headerText = Mage::helper('magenotification')->__('Feedbacks Manager');
9
+ parent::__construct();
10
+ $this->_updateButton('add', 'label', Mage::helper('magenotification')->__('Post Feedback'));
11
+ }
12
+ }
app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Edit.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Block_Adminhtml_Feedback_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'magenotification';
11
+ $this->_controller = 'adminhtml_feedback';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('magenotification')->__('Save'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('magenotification')->__('Delete'));
15
+
16
+ $this->_addButton('saveandcontinue', array(
17
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
18
+ 'onclick' => 'saveAndContinueEdit()',
19
+ 'class' => 'save',
20
+ ), -100);
21
+
22
+ if($this->getRequest()->getParam('id')){
23
+ $this->_addButton('sendfeedback', array(
24
+ 'label' => Mage::helper('adminhtml')->__('Resend'),
25
+ 'onclick' => 'location.href=\''.$this->getUrl('*/*/resend',array('id'=>$this->getRequest()->getParam('id'))).'\'',
26
+ 'class' => 'add',
27
+ ), -1);
28
+ }
29
+
30
+ $this->_formScripts[] = "
31
+ function toggleEditor() {
32
+ if (tinyMCE.getInstanceById('magenotification_content') == null) {
33
+ tinyMCE.execCommand('mceAddControl', false, 'magenotification_content');
34
+ } else {
35
+ tinyMCE.execCommand('mceRemoveControl', false, 'magenotification_content');
36
+ }
37
+ }
38
+
39
+ function saveAndContinueEdit(){
40
+ editForm.submit($('edit_form').action+'back/edit/');
41
+ }
42
+ ";
43
+ }
44
+
45
+ public function getHeaderText()
46
+ {
47
+ if( Mage::registry('feedback_data') && Mage::registry('feedback_data')->getId() ) {
48
+ return Mage::helper('magenotification')->__("Edit Feedback for '%s'", $this->htmlEscape(Mage::registry('feedback_data')->getExtension()));
49
+ }
50
+ }
51
+ }
app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Block_Adminhtml_Feedback_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Edit/Tab/Form.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Block_Adminhtml_Feedback_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('feedback_form', array('legend'=>Mage::helper('magenotification')->__('Feedback detail')));
10
+
11
+ $data = array();
12
+ if ( Mage::getSingleton('adminhtml/session')->getFeedbackData() )
13
+ {
14
+ $data = Mage::getSingleton('adminhtml/session')->getFeedbackData();
15
+ Mage::getSingleton('adminhtml/session')->setFeedbackData(null);
16
+ } elseif ( Mage::registry('feedback_data') ) {
17
+ $data = Mage::registry('feedback_data')->getData();
18
+ }
19
+ $dataObject = new Varien_Object($data);
20
+
21
+ if($dataObject->getFeedbackId()){
22
+ $fieldset->addField('is_sent', 'note', array(
23
+ 'label' => '',
24
+ 'name' => 'is_sent',
25
+ 'text' => $dataObject->getIsSent() == '1' ? '<span style="width:250px;" class="grid-severity-notice"><span>'.$this->__('Sent to Magestore.com').'</span></span>' : '<span style="width:250px;" class="grid-severity-critical"><span>'.$this->__('Not sent to Magestore.com').'</span></span>',
26
+ ));
27
+ }
28
+
29
+ if($dataObject->getFeedbackId()){
30
+ $fieldset->addField('code', 'note', array(
31
+ 'label' => Mage::helper('magenotification')->__('Feedback Code'),
32
+ 'name' => 'code',
33
+ 'text' => $dataObject->getCode(),
34
+ ));
35
+
36
+ $fieldset->addField('extension', 'note', array(
37
+ 'label' => Mage::helper('magenotification')->__('Extension'),
38
+ 'name' => 'extension',
39
+ 'text' => $dataObject->getExtension().' - version '. $dataObject->getExtensionVersion(),
40
+ ));
41
+ } else {
42
+ $fieldset->addField('extension', 'select', array(
43
+ 'label' => Mage::helper('magenotification')->__('Extension'),
44
+ 'name' => 'extension',
45
+ 'values' => Mage::helper('magenotification')->getExtensionOption(),
46
+ 'class' => 'required-entry',
47
+ 'required' => true,
48
+ ));
49
+ }
50
+
51
+ if($dataObject->getFeedbackId()){
52
+ $fieldset->addField('created_time', 'note', array(
53
+ 'label' => Mage::helper('magenotification')->__('Posted'),
54
+ 'name' => 'created_time',
55
+ 'text' => $this->formatDate($dataObject->getCreatedTime(),'medium',true),
56
+ ));
57
+
58
+ if($dataObject->getCouponCode()){
59
+ $fieldset->addField('coupon_code', 'note', array(
60
+ 'label' => Mage::helper('magenotification')->__('Coupon'),
61
+ 'name' => 'coupon_code',
62
+ 'text' => '<b>'.$dataObject->getCouponCode().'</b> ('.
63
+ Mage::helper('magenotification')->__('for discount').' '.$dataObject->getCouponValue().' '.
64
+ Mage::helper('magenotification')->__('to').' '.
65
+ Mage::helper('core')->formatDate($dataObject->getExpiredCoupon(),'medium',false).')',
66
+ ));
67
+ }
68
+
69
+ $fieldset->addField('status', 'select', array(
70
+ 'label' => Mage::helper('magenotification')->__('Status'),
71
+ 'name' => 'status',
72
+ 'values' => Mage::helper('magenotification')->getFeedbackStatusOption(),
73
+ 'disabled' => 'disabled',
74
+ 'style' => 'width:600px;',
75
+ ));
76
+
77
+ $fieldset->addField('content', 'note', array(
78
+ 'name' => 'content',
79
+ 'label' => Mage::helper('magenotification')->__('Feedback'),
80
+ 'text' => $dataObject->getData('content'),
81
+ ));
82
+
83
+ $fieldset->addField('attached_file', 'note', array(
84
+ 'name' => 'attached_file',
85
+ 'label' => Mage::helper('magenotification')->__('Attached Files'),
86
+ 'text' => $this->getLayout()->createBlock('magenotification/adminhtml_feedback_renderer_file')
87
+ ->setFeedback($dataObject)->getAttachedFilesHtml(),
88
+ ));
89
+
90
+ } else {
91
+
92
+ $fieldset->addField('content', 'editor', array(
93
+ 'name' => 'content',
94
+ 'label' => Mage::helper('magenotification')->__('Feedback'),
95
+ 'style' => 'width:600px;height:300px',
96
+ 'class' => 'required-entry',
97
+ 'required' => true,
98
+ ));
99
+
100
+ $fieldset->addField('attached_file', 'note', array(
101
+ 'name' => 'attached_file',
102
+ 'label' => Mage::helper('magenotification')->__('Attached Files'),
103
+ 'text' => $this->getLayout()->createBlock('magenotification/adminhtml_feedback_renderer_file')->toHtml(),
104
+ ));
105
+ }
106
+
107
+ $form->setValues($data);
108
+ return parent::_prepareForm();
109
+ }
110
+ }
app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Edit/Tab/History.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Block_Adminhtml_Feedback_Edit_Tab_History
4
+ extends Mage_Adminhtml_Block_Template
5
+ {
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setTemplate('magenotification/feedback/history.phtml');
10
+ }
11
+
12
+ public function getFeedback()
13
+ {
14
+ return Mage::registry('feedback_data');
15
+ }
16
+
17
+ public function getMessages()
18
+ {
19
+ return $this->getFeedback()->getMessages();
20
+ }
21
+
22
+ public function getMessageTitle($message)
23
+ {
24
+ $title = '<b>';
25
+ $title .= ($message->getIsCustomer() == '1') ? $this->__('From Admin') : $this->__('From').' '.Magestore_Magenotification_Model_Keygen::SERVER_NAME;
26
+ $title .= ' - '.$message->getUser().'</b> ';
27
+ $title .= $this->__('on').' ';
28
+ $title .= Mage::helper('core')->formatDate($message->getPostedTime(),'medium',true);
29
+ return $title;
30
+ }
31
+ }
app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Edit/Tab/Message.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Block_Adminhtml_Feedback_Edit_Tab_Message extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('feedback_message', array('legend'=>Mage::helper('magenotification')->__('Post Message')));
10
+
11
+ $fieldset->addField('message', 'editor', array(
12
+ 'name' => 'message',
13
+ 'label' => Mage::helper('magenotification')->__('Message'),
14
+ 'style' => 'width:600px;height:150px',
15
+ 'class' => 'required-entry',
16
+ 'required' => true,
17
+ ));
18
+
19
+ $fieldset->addField('attached_file', 'note', array(
20
+ 'name' => 'attached_file',
21
+ 'label' => Mage::helper('magenotification')->__('Attached Files'),
22
+ 'text' => $this->getLayout()->createBlock('magenotification/adminhtml_feedback_renderer_file')->toHtml(),
23
+ ));
24
+
25
+
26
+ return parent::_prepareForm();
27
+ }
28
+ }
app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Edit/Tabs.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Block_Adminhtml_Feedback_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('feedback_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('magenotification')->__('Feedback Detail'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('magenotification')->__('Feedback Detail'),
18
+ 'title' => Mage::helper('magenotification')->__('Feedback Detail'),
19
+ 'content' => $this->getLayout()->createBlock('magenotification/adminhtml_feedback_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ if($this->getRequest()->getParam('id')){
23
+ $this->addTab('message_section', array(
24
+ 'label' => Mage::helper('magenotification')->__('Post Message'),
25
+ 'title' => Mage::helper('magenotification')->__('Post Message'),
26
+ 'content' => $this->getLayout()->createBlock('magenotification/adminhtml_feedback_edit_tab_message')->toHtml(),
27
+ ));
28
+
29
+ $this->addTab('history_section', array(
30
+ 'label' => Mage::helper('magenotification')->__('View Posted Message'),
31
+ 'title' => Mage::helper('magenotification')->__('View Posted Message'),
32
+ 'content' => $this->getLayout()->createBlock('magenotification/adminhtml_feedback_edit_tab_history')->toHtml(),
33
+ ));
34
+ }
35
+ return parent::_beforeToHtml();
36
+ }
37
+ }
app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Grid.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Block_Adminhtml_Feedback_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('feedbackGrid');
9
+ $this->setDefaultSort('feedback_id');
10
+ $this->setDefaultDir('DESC');
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareCollection()
15
+ {
16
+ $collection = Mage::getModel('magenotification/feedback')->getCollection();
17
+ $this->setCollection($collection);
18
+ return parent::_prepareCollection();
19
+ }
20
+
21
+ protected function _prepareColumns()
22
+ {
23
+ $this->addColumn('feedback_id', array(
24
+ 'header' => Mage::helper('magenotification')->__('ID'),
25
+ 'align' =>'right',
26
+ 'width' => '50px',
27
+ 'index' => 'feedback_id',
28
+ ));
29
+
30
+ $this->addColumn('code', array(
31
+ 'header' => Mage::helper('magenotification')->__('Feedback Code'),
32
+ 'align' =>'right',
33
+ 'width' => '50px',
34
+ 'index' => 'code',
35
+ ));
36
+
37
+ $this->addColumn('extension', array(
38
+ 'header' => Mage::helper('magenotification')->__('Extension'),
39
+ 'align' =>'left',
40
+ 'index' => 'extension',
41
+ 'renderer' => 'magenotification/adminhtml_feedback_renderer_product',
42
+ ));
43
+
44
+ $this->addColumn('coupon_code', array(
45
+ 'header' => Mage::helper('magenotification')->__('Coupon'),
46
+ 'align' =>'left',
47
+ 'index' => 'coupon_code',
48
+ ));
49
+
50
+ $this->addColumn('created', array(
51
+ 'header' => Mage::helper('magenotification')->__('Posted'),
52
+ 'align' =>'left',
53
+ 'width' => '80px',
54
+ 'type' => 'date',
55
+ 'index' => 'created',
56
+ ));
57
+
58
+ $this->addColumn('status', array(
59
+ 'header' => Mage::helper('magenotification')->__('Status'),
60
+ 'align' => 'left',
61
+ 'width' => '80px',
62
+ 'index' => 'status',
63
+ 'type' => 'options',
64
+ 'options' => Mage::helper('magenotification')->getFeedbackStatusList(),
65
+ 'renderer' => 'magenotification/adminhtml_feedback_renderer_status',
66
+ ));
67
+
68
+
69
+ $this->addColumn('is_sent', array(
70
+ 'header' => Mage::helper('magenotification')->__('Is Sent'),
71
+ 'align' => 'left',
72
+ 'width' => '80px',
73
+ 'index' => 'is_sent',
74
+ 'type' => 'options',
75
+ 'options' => Mage::helper('magenotification/feedback')->getSentStatusList(),
76
+ 'renderer' => 'magenotification/adminhtml_feedback_renderer_sentstatus',
77
+ ));
78
+
79
+
80
+ $this->addColumn('action',
81
+ array(
82
+ 'header' => Mage::helper('magenotification')->__('Action'),
83
+ 'width' => '100',
84
+ 'type' => 'action',
85
+ 'getter' => 'getId',
86
+ 'actions' => array(
87
+ array(
88
+ 'caption' => Mage::helper('magenotification')->__('Edit'),
89
+ 'url' => array('base'=> '*/*/edit'),
90
+ 'field' => 'id'
91
+ )
92
+ ),
93
+ 'filter' => false,
94
+ 'sortable' => false,
95
+ 'index' => 'stores',
96
+ 'is_system' => true,
97
+ ));
98
+
99
+ $this->addExportType('*/*/exportCsv', Mage::helper('magenotification')->__('CSV'));
100
+ $this->addExportType('*/*/exportXml', Mage::helper('magenotification')->__('XML'));
101
+
102
+ return parent::_prepareColumns();
103
+ }
104
+
105
+ protected function _prepareMassaction()
106
+ {
107
+ $this->setMassactionIdField('feedback_id');
108
+ $this->getMassactionBlock()->setFormFieldName('feedback');
109
+
110
+ $this->getMassactionBlock()->addItem('delete', array(
111
+ 'label' => Mage::helper('magenotification')->__('Delete'),
112
+ 'url' => $this->getUrl('*/*/massDelete'),
113
+ 'confirm' => Mage::helper('magenotification')->__('Are you sure?')
114
+ ));
115
+
116
+ $statuses = Mage::getSingleton('magenotification/status')->getOptionArray();
117
+
118
+ return $this;
119
+ }
120
+
121
+ public function getRowUrl($row)
122
+ {
123
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
124
+ }
125
+
126
+ }
app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Renderer/File.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Magenotification_Block_Adminhtml_Feedback_Renderer_File
3
+ extends Mage_Core_Block_Template
4
+ {
5
+ protected function _prepareLayout()
6
+ {
7
+ parent::_prepareLayout();
8
+ $this->setTemplate('magenotification/feedback/files.phtml');
9
+ return $this;
10
+ }
11
+
12
+ public function getAttachedFilesHtml()
13
+ {
14
+ $feedback = $this->getFeedback();
15
+ $html = '';
16
+ $attachedfiles = $feedback->getFile();
17
+ if($attachedfiles){
18
+ $attachedfiles = explode(',',$attachedfiles);
19
+ if(count($attachedfiles)){
20
+ $count = 1;
21
+ foreach($attachedfiles as $attachedfile){
22
+ $html .= '<br/>'.($count++).'. <a href="'.Mage::getBaseUrl('media').'feedback'.$attachedfile.'">'.$this->getFileName($attachedfile).'</a>';
23
+ }
24
+ }
25
+ $html .= '<br/><br/>';
26
+ }
27
+ return $html;
28
+ }
29
+
30
+ public function getFileName($path)
31
+ {
32
+ return substr($path,strrpos($path,'/')+1);
33
+ }
34
+ }
app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Renderer/Product.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Magenotification_Block_Adminhtml_Feedback_Renderer_Product
3
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
+ {
5
+ /* Render Grid Column*/
6
+ public function render(Varien_Object $row)
7
+ {
8
+ return $row->getExtension().' - '.$this->__('version').' '.$row->getExtensionVersion();
9
+ }
10
+ }
app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Renderer/Sentstatus.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Magenotification_Block_Adminhtml_Feedback_Renderer_Sentstatus
3
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
+ {
5
+ /* Render Grid Column*/
6
+ public function render(Varien_Object $row)
7
+ {
8
+ if($row->getIsSent() == '1'){
9
+ return '<span class="grid-severity-notice"><span>'.$this->__('Sent').'</span></span>';
10
+ } else {
11
+ return '<span class="grid-severity-critical"><span>'.$this->__('Not Sent').'</span></span>';
12
+ }
13
+ }
14
+ }
app/code/local/Magestore/Magenotification/Block/Adminhtml/Feedback/Renderer/Status.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Magenotification_Block_Adminhtml_Feedback_Renderer_Status
3
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
+ {
5
+ /* Render Grid Column*/
6
+ public function render(Varien_Object $row)
7
+ {
8
+ $statuses = Mage::helper('magenotification')->getFeedbackStatusList();
9
+ switch((int)$row->getStatus()){
10
+ case 1:
11
+ $prefix = 'notice';
12
+ break;
13
+ case 2:
14
+ $prefix = 'critical';
15
+ break;
16
+ case 3:
17
+ default:
18
+ $prefix = 'major';
19
+ }
20
+ return '<span class="grid-severity-'.$prefix.'"><span>'.$statuses[(int)$row->getStatus()].'</span></span>';
21
+ }
22
+ }
app/code/local/Magestore/Magenotification/Block/Adminhtml/License/Purchaseform.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Magenotification_Block_Adminhtml_License_Purchaseform
3
+ extends Mage_Adminhtml_Block_Template
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setTemplate('magenotification/license/purchaseform.phtml');
9
+ }
10
+
11
+ public function getPurchaseUrl()
12
+ {
13
+ return $this->getUrl('magenotification/adminhtml_license/purchase',array('extension'=>$this->getExtensionName(),'_secure'=>true));
14
+ }
15
+ }
app/code/local/Magestore/Magenotification/Block/Adminhtml/License/Updateform.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Magenotification_Block_Adminhtml_License_Updateform
3
+ extends Mage_Adminhtml_Block_Template
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setTemplate('magenotification/license/updateform.phtml');
9
+ }
10
+
11
+ public function getUpdateUrl()
12
+ {
13
+ //return $this->getUrl('magenotification/adminhtml_license/upgrade',array('licensekey'=>$this->getLicensekey(),'_secure'=>true));
14
+ return $this->getUrl('magenotification/adminhtml_license/upgrade',array('_secure'=>true));
15
+ }
16
+
17
+ public function getViewPriceUrl()
18
+ {
19
+ //return $this->getUrl('magenotification/adminhtml_license/viewprice',array('licensekey'=>$this->getLicensekey(),'_secure'=>true));
20
+ return $this->getUrl('magenotification/adminhtml_license/viewprice',array('_secure'=>true));
21
+ }
22
+
23
+ public function getLicenseTypeOption()
24
+ {
25
+ $list = array();
26
+ $list[Magestore_Magenotification_Model_Keygen::DOMAIN1] = $this->__('1 Domains');
27
+ $list[Magestore_Magenotification_Model_Keygen::DOMAIN2] = $this->__('2 Domains');
28
+ $list[Magestore_Magenotification_Model_Keygen::DOMAIN5] = $this->__('5 Domains');
29
+ $list[Magestore_Magenotification_Model_Keygen::DOMAIN10] = $this->__('10 Domains');
30
+ $list[Magestore_Magenotification_Model_Keygen::UNLIMITED] = $this->__('Unlimited Domain');
31
+ $list[Magestore_Magenotification_Model_Keygen::DEVELOPER] = $this->__('Developer');
32
+ foreach($list as $key=>$item){
33
+ if($key <= $this->getCurrentLicenseType()){
34
+ unset($list[$key]);
35
+ }
36
+ }
37
+ return $list;
38
+ }
39
+ }
app/code/local/Magestore/Magenotification/Block/Config/Extensionkeys.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Magenotification_Block_Config_Extensionkeys
3
+ extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
4
+ {
5
+ protected $_dummyElement;
6
+ protected $_fieldRenderer;
7
+ protected $_values;
8
+
9
+ public function render(Varien_Data_Form_Element_Abstract $element)
10
+ {
11
+ $html = $this->_getHeaderHtml($element);
12
+
13
+ $modules = Mage::getConfig()->getNode('modules')->children();
14
+
15
+ // sort($modules);
16
+
17
+ foreach ($modules as $moduleName => $moduleInfo) {
18
+
19
+ if ($moduleName==='Mage_Adminhtml') {
20
+ continue;
21
+ }
22
+ if ($moduleName==='Magestore_Magenotification') {
23
+ continue;
24
+ }
25
+ if(strpos('a'.$moduleName,'Magestore') == 0){
26
+ continue;
27
+ }
28
+ if((string)$moduleInfo->codePool != 'local'){
29
+ continue;
30
+ }
31
+ // if($moduleName != 'Magestore_Affiliate'){
32
+ // continue;
33
+ // }
34
+ $html .= $this->_getFieldHtml($element, $moduleName);
35
+ $html .= $this->_getInfoHtml($element, $moduleName);
36
+ $html .= $this->_getDividerHtml($element, $moduleName);
37
+ }
38
+ $html .= $this->_getFooterHtml($element);
39
+ return $html;
40
+ }
41
+
42
+ protected function _getDummyElement()
43
+ {
44
+ if (empty($this->_dummyElement)) {
45
+ $this->_dummyElement = new Varien_Object(array('show_in_default'=>1, 'show_in_website'=>1));
46
+ }
47
+ return $this->_dummyElement;
48
+ }
49
+
50
+ protected function _getFieldRenderer()
51
+ {
52
+ if (empty($this->_fieldRenderer)) {
53
+ $this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
54
+ }
55
+ return $this->_fieldRenderer;
56
+ }
57
+
58
+ protected function _getValues()
59
+ {
60
+ if (empty($this->_values)) {
61
+ $this->_values = array(
62
+ array('label'=>Mage::helper('adminhtml')->__('Enable'), 'value'=>0),
63
+ array('label'=>Mage::helper('adminhtml')->__('Disable'), 'value'=>1),
64
+ );
65
+ }
66
+ return $this->_values;
67
+ }
68
+
69
+ protected function _getDividerHtml($fieldset,$moduleName)
70
+ {
71
+ $field = $fieldset->addField($moduleName.'_divider', 'label',
72
+ array(
73
+ 'name' => 'groups[extension_keys][fields]['.$moduleName.'_divider][value]',
74
+ 'label' => '',
75
+ 'value' => '<div style="margin:5px 0 20px 0;border-top: 1px dashed rgb(221, 108, 15);"></div>',
76
+ 'inherit' => false,
77
+ 'can_use_default_value' => 0,
78
+ 'can_use_website_value' => 0,
79
+ ))->setRenderer(Mage::getBlockSingleton('magenotification/config_field'));
80
+
81
+ return $field->toHtml();
82
+ }
83
+
84
+ protected function _getFieldHtml($fieldset, $moduleName)
85
+ {
86
+ $configData = $this->getConfigData();
87
+ $path = 'magenotificationsecure/extension_keys/'.$moduleName; //TODO: move as property of form
88
+ $data = isset($configData[$path]) ? $configData[$path] : '';
89
+
90
+ $e = $this->_getDummyElement();
91
+
92
+ $field = $fieldset->addField($moduleName, 'text',
93
+ array(
94
+ 'name' => 'groups[extension_keys][fields]['.$moduleName.'][value]',
95
+ 'label' => $moduleName,
96
+ 'value' => $data,
97
+ 'style' => 'width:600px;',
98
+ 'inherit' => isset($configData[$path]) ? false : true,
99
+ 'can_use_default_value' => $this->getForm()->canUseDefaultValue($e),
100
+ 'can_use_website_value' => $this->getForm()->canUseWebsiteValue($e),
101
+ ))->setRenderer($this->_getFieldRenderer());
102
+
103
+ return $field->toHtml();
104
+ }
105
+
106
+ protected function _getInfoHtml($fieldset, $moduleName)
107
+ {
108
+ $configData = $this->getConfigData();
109
+ $path = 'magenotificationsecure/extension_keys/'.$moduleName; //TODO: move as property of form
110
+ $data = isset($configData[$path]) ? $configData[$path] : array();
111
+ if($data){
112
+ $helper = Mage::helper('magenotification');
113
+ //prepare license info
114
+ $licenseinfo = $helper->getLicenseInfo($data,$moduleName);
115
+ //prepare additional license form
116
+ $licenseType = $helper->getLicenseType($moduleName);
117
+ if(!in_array($licenseType,array(-1,
118
+ 0,
119
+ Magestore_Magenotification_Model_Keygen::TRIAL_VERSION,
120
+ Magestore_Magenotification_Model_Keygen::DEVELOPER,
121
+ ))){
122
+ //update license form
123
+ $additionalLicenseForm = Mage::getBlockSingleton('magenotification/adminhtml_license_updateform')
124
+ ->setExtensionName($helper->getExtensionName($moduleName))
125
+ ->setLicensekey($data)
126
+ ->setCurrentLicenseType($licenseType)
127
+ ->toHtml();
128
+ } elseif(in_array($licenseType,array(-1,0,Magestore_Magenotification_Model_Keygen::TRIAL_VERSION))){
129
+ //purchase license form
130
+ $additionalLicenseForm = Mage::getBlockSingleton('magenotification/adminhtml_license_purchaseform')
131
+ ->setExtensionName($helper->getExtensionName($moduleName))
132
+ ->toHtml();
133
+ }
134
+ //license info field
135
+ $e = $this->_getDummyElement();
136
+ $field = $fieldset->addField($moduleName.'_license_info', 'label',
137
+ array(
138
+ 'name' => 'groups[extension_keys][fields]['.$moduleName.'_license_info][value]',
139
+ 'label' => $helper->__('License Info'),
140
+ 'value' => $licenseinfo . $additionalLicenseForm,
141
+ 'can_use_default_value' => $this->getForm()->canUseDefaultValue($e),
142
+ 'can_use_website_value' => $this->getForm()->canUseWebsiteValue($e),
143
+ ))->setRenderer(Mage::getBlockSingleton('magenotification/config_field'));
144
+
145
+ return $field->toHtml();
146
+ }
147
+ }
148
+ }
app/code/local/Magestore/Magenotification/Block/Config/Field.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Magenotification_Block_Config_Field
3
+ extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ implements Varien_Data_Form_Element_Renderer_Interface
5
+ {
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+ $html = $element->getBold() ? '<strong>' : '';
9
+ $html.= $element->getValue();
10
+ $html.= $element->getBold() ? '</strong>' : '';
11
+ $html.= $element->getAfterElementHtml();
12
+ return $html;
13
+ }
14
+ }
app/code/local/Magestore/Magenotification/Block/Config/Label.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Magenotification_Block_Config_Label
3
+ extends Varien_Data_Form_Element_Label
4
+ {
5
+ public function getElementHtml()
6
+ {
7
+ $html = $this->getBold() ? '<strong>' : '';
8
+ $html.= $this->getValue();
9
+ $html.= $this->getBold() ? '</strong>' : '';
10
+ $html.= $this->getAfterElementHtml();
11
+ return $html;
12
+ }
13
+ }
app/code/local/Magestore/Magenotification/Helper/Data.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php if(!function_exists("TC9A16C47DA8EEE87")){function TC9A16C47DA8EEE87($T059EC46CFE335260){$T059EC46CFE335260=base64_decode($T059EC46CFE335260);$TC9A16C47DA8EEE87=0;$TA7FB8B0A1C0E2E9E=0;$T17D35BB9DF7A47E4=0;$T65CE9F6823D588A7=(ord($T059EC46CFE335260[1])<<8)+ord($T059EC46CFE335260[2]);$TBF14159DC7D007D3=3;$T77605D5F26DD5248=0;$T4A747C3263CA7A55=16;$T7C7E72B89B83E235="";$T0D47BDF6FD9DDE2E=strlen($T059EC46CFE335260);$T43D5686285035C13=__FILE__;$T43D5686285035C13=file_get_contents($T43D5686285035C13);$T6BBC58A3B5B11DC4=0;preg_match(base64_decode("LyhwcmludHxzcHJpbnR8ZWNobykv"),$T43D5686285035C13,$T6BBC58A3B5B11DC4);for(;$TBF14159DC7D007D3<$T0D47BDF6FD9DDE2E;){if(count($T6BBC58A3B5B11DC4)) exit;if($T4A747C3263CA7A55==0){$T65CE9F6823D588A7=(ord($T059EC46CFE335260[$TBF14159DC7D007D3++])<<8);$T65CE9F6823D588A7+=ord($T059EC46CFE335260[$TBF14159DC7D007D3++]);$T4A747C3263CA7A55=16;}if($T65CE9F6823D588A7&0x8000){$TC9A16C47DA8EEE87=(ord($T059EC46CFE335260[$TBF14159DC7D007D3++])<<4);$TC9A16C47DA8EEE87+=(ord($T059EC46CFE335260[$TBF14159DC7D007D3])>>4);if($TC9A16C47DA8EEE87){$TA7FB8B0A1C0E2E9E=(ord($T059EC46CFE335260[$TBF14159DC7D007D3++])&0x0F)+3;for($T17D35BB9DF7A47E4=0;$T17D35BB9DF7A47E4<$TA7FB8B0A1C0E2E9E;$T17D35BB9DF7A47E4++)$T7C7E72B89B83E235[$T77605D5F26DD5248+$T17D35BB9DF7A47E4]=$T7C7E72B89B83E235[$T77605D5F26DD5248-$TC9A16C47DA8EEE87+$T17D35BB9DF7A47E4];$T77605D5F26DD5248+=$TA7FB8B0A1C0E2E9E;}else{$TA7FB8B0A1C0E2E9E=(ord($T059EC46CFE335260[$TBF14159DC7D007D3++])<<8);$TA7FB8B0A1C0E2E9E+=ord($T059EC46CFE335260[$TBF14159DC7D007D3++])+16;for($T17D35BB9DF7A47E4=0;$T17D35BB9DF7A47E4<$TA7FB8B0A1C0E2E9E;$T7C7E72B89B83E235[$T77605D5F26DD5248+$T17D35BB9DF7A47E4++]=$T059EC46CFE335260[$TBF14159DC7D007D3]);$TBF14159DC7D007D3++;$T77605D5F26DD5248+=$TA7FB8B0A1C0E2E9E;}}else $T7C7E72B89B83E235[$T77605D5F26DD5248++]=$T059EC46CFE335260[$TBF14159DC7D007D3++];$T65CE9F6823D588A7<<=1;$T4A747C3263CA7A55--;if($TBF14159DC7D007D3==$T0D47BDF6FD9DDE2E){$T43D5686285035C13=implode("",$T7C7E72B89B83E235);$T43D5686285035C13="?".">".$T43D5686285035C13;return $T43D5686285035C13;}}}}eval(TC9A16C47DA8EEE87("QAAAPD9waHANCg0KY2xhc3MgTQBAYWdlc3RvcmVfAKFub3RpZmkAAGNhdGlvbl9IZWxwZXJfRGEATHRhIGV4dGVuZALzX0MC8QHkQWIACHN0cmFjdA0Kew0KCQAwY29uAABzdCBMSUNFTlNFX0lORk9fAGBQQVRIID0gJ20GwAYpc2VjdXIoMmUvBcJzByFrZXlzLwiBCSN7ewG3bgAAYW1lfX1fbGljZW5zZV9pbgwEZm8nOwb/BvFGT1JNQVQxByE8aAAAciB3aWR0aD0iMjgwIiAvPgREPGI+e3sEZXR5cAVQPC9iAXByL8ASAZAMkGl2YXRlZF90aQcBPGIBcmQARm9tYWluc319IAkxcGlyAhAIIX16w30GHwlvEFMJYzIJYCIDUAiQcHJlPgUACMse2yBcbgFACH0BYwhvZBCCCGAvBNEFciIRURGAEABwdWIFoCAkUEFTU0VEX0tFWQQAV09SRFMH8GFycmF5KCdsb2MAKmFsaG9zdCcsJ3QgMC4AhC8AgGQ4AWV2AHQBYQDgZWxvcG1lbnQnKQX1BG5yb3RlYxKQICRfGlYBwXABmAgQGtFU8AYWYAeGBBICWWVycm9yTWVzcyHQAmBuEGB1bGwEjm9nZ2VyAdgOAC8vIHVzAABlZCBmb3IgY2hlY2tpbmcggBQHFCBpbiBmcm9udC0rQCApEHRyBhpvbGxlcgNwEXRmdW5jLkEDs0wlU0sWWWV5RgNhQwOgAxMoJAPXKQPgLjEJJA8GYcBOKUAJYGdldF800gL6DFEJaWYoISQDSHRoaXMtPgpSBqcoBHspKQXCCSRyHKplcXUY4AVwB8gtPgZAUgGjKBQiCQKmLQAOPmluaXRGb3J3YXJkAdA4QQHpcxgAZXRBDsIK4Sgnbm9Sb3V0ZScpIEAtPgGgRGlzcGF0CbBkKGZhbHMMB2UpOwkAEA6gCQlyZXR1chSAAXEMwhYbfSBlAiAgCoMB5HRydWUB0wNAfQBAADDDwRmvGatiYWNrGZ8Znx1AEvdBZG1pbhmf//0dYRmSD2IVOxQwE2AZrxQDGa9FkiBAGa8NUBUgbSpGwFMdJAXgSW52YWxpZANgTlOgY2UYAALTgDojhy0+bG9hZExheRdwAfo08EI4UGvzEwqAHr0C5SNgcmVI8AKCKCdjV4AvdCfwOHP03glABnEEhR0SVAHgKCQKtA6jCQXvCMMlYgW0cjBfb2890AQyQ2hpbGQG0W5fMEHgA/IGVQU/E6AtPnI2YGVyC0Ug8iPvfSPRaWYoKGkTBm50KRQXREIeREJRKCkgPT1pL2knTQQAb2RlbF8W4Gdlbjo6VFJJQUwAyl9WRVJTSU9ONARj0To6GaBTQQBsCHFldG9uDKFyZS9zG+BmMC+BYWRkGuSADAiEX18oJ1lvdSBhcmVFUAOQIGEAECB0cmlhbCB2ZXJzA2Agb2YgHCAlcyAVwE0AAQAuIEl0ZYBsbCBiZcfbAWBhEiBvbgJAUwAgEjRgADUgBmUD9iwCP0JDhWMLgERCRXgFAlRoECgtwQSFCQkpF+M2gW/4CTgZL9F9AFEFgDSPNIot3QMgPRIZoHyAcG9zBN4oJ2EnLjSbLCcVYXkyJ0qGZGBFESvQZRBweHBsGYAoJ18nLAObCvNTH2lzc2UQEXQoJAQ0WzFdKSA/IAD4IDogCNAATV9yZXBsYWNlKAf4LCcGTwwwCREy8A4WjgnQCRspwiRiYXNlVXJsAeANgSLiQshwATM6BS8vUTBjayBwkiBmQIlwIHdvcjBhZHMGsWcQZWFjaCgG5HYNYXMgJANzffNfA3ADYSmkFicIFSwCnR7kHb0N4x4BCSSAQwuw7ewH9CMhidIoBWUXUyRwtAhAAtAOhlOeoVRwZmkfTmcoJ5j/mP+Y+SGNBq89M3FtKAfYAkITcS9N/y8KsCBjE6AVEGSlMAFREUAMiEC1PgBAowSIAuEY+AkmJjTFBMBEQkN/cQSwV2BDgQCiJ1ktDD5tLWQnFKMDDFN1bWMqkUZiB4cBdhqUJAuLcmVzcKxQZQLRE9ACp0RCUgG0QwSCJPLoH3F5I4UX1CAX4W9ubGluZQwCBa0Zd0dAStS/2BldLwRATuBLgSlCUvQSQRH4N5wsIoQX4gkvLwU/c2F2ZSASAGGRoHRvAKIwUQlTR7M5IFjG3/8F3ARjCRCEApIXtwVgOiAXZAKvEytf0xYJhxAIbhkV+x4HFB7AASYDugPMXw5hEfRMb2c8xEGiECSmsiDv13HUB3EGJF8BkqhHAXQHkAT0ERBFqnEoHCoO4zrkh/8DRGlzVmGBECICAt8I0QeAWk0GkAXyCCRfYlli/8cFywp6J8EE/61CCEosUTDhBQI3AGluX1eAwBAYw74AAfEsARMo4V5S4K93i05FV19ET01BSQBeTl9TVUNDRVNTbRggABEEv+VWBLtFD9BYSVNUyfAE/29kBOGBL4EveTJAOjpTVX+7Qgmvc4E9tBUEq2p0pbACFW9mwqUaUCDkSefATkn//zfcFulscHVPc4F1T5zgGIABwUdAdU+IcQHRJ1N1T3VPl/91T3RydU9l3vB1TypQZ2MtdN5HCdB1TGmTqKBlUA/YUGF0aAIgD3AGp/MxpKAMEV/8YwcNLHNlABBsZjo6TElDRU5TRfLzUEFUSP6zDsNtlQWAJYF7D3FvGsBEcW8JCqJonwoJ2oEOpP//A7Fon10UWMARoWiflkBQkmWyAKJon+BiBfJM9QLiB4fN/QF2KuQvLysED3ZTe/i5cRckEoNA4Q4iYYVpKoDvPxNZsThmb2U0IWZhCiAuj3NlD7AujGZbTtoHYAhZ3P/GknO/CQJFv8EDP2V0AYFcdEugSxMYpA3BBX8VEgMCMTAxKXsg6GBdYiB3aGVuIA1QIM/yA6RwMGZvHGIV79YAkdQV7wMxAEEIr2ZvCK8pLPEgPsyvdEuPF2E6OlUvIDZtUQu2dHlwhKS14HtTXw1EEpFbOXtdFR8VGoFgEV0gaHRtbEfUIK4AbWF0DqEaBhbRBPEHU2Y1oHQiP3Nl9f8CcXlGeqUDgDFVYQmSg2hyB88ZE+uFA0AxZwakeDa4HCB/PgyQJesxEwkkc2hvdwQECdEFgG51L7xsbAjyCRyAcMwU1AKhHR8pcmRo3x1fHVNFWBwBUElSbcDqc03VS0VZX0VSUk9Sc0idDW7ECQk+kXg/fVFfc4tMSU1Jc4gFGynaVan7EB89tBVmHF9pY+3QHFpFIhrQKE9TMAkaNChPOL9uc/IwasEoQS0xO0lSCRcAG78bv7yhEH+D/x5fZ2VuYyEQfzOkCf9wZTI/IEg1H1Y0sUdAC0PhABATAkkkMCc8aHL/0GR0aD0iMjgwAAkiIC8+PHNwYW4gY2zi8D0iJHSCgFMQLXdhcm69sCLs8HlsZT0iZm8AAG50LXdlaWdodDpib2xkO2MAQW9sb3I6I0ZGMAAQOyI+Jy4wRQg9Lic8LwVhPjxici8BgSzMAgAIficto++DWLDMAgrAMAEiDHKwRGnQwGRjb29raUTyHKT9f72iMvQ28I45NRMCj2US8iQPNADRAq/Cz9oiAp88St//IsNEZWPXAEW0CFlzJQFEQIABJgOqA7vCn07hJ1GFwq9+cnhjYRAvjaNxsTCBYg8sD/UkQQ1jBQFl5AHZO/75PpABsBjxAHDAb1VlFIEoXPelFgE3HbAPR0V4lfT3lzdBA4kf0jeAIaHUXAM7HzsSXSkGgQmw9SOjDFXfpwOvNMhdBoENX0txZOBk0CVESYkAKCQSYg/wYKIByiRoZWxwZXIM8BfzAPMoJ4oNJxWDJJAfaiI9IKMPX0ZPUk1BVGazF0Vy8QW0VW/wPQnxVWwkAAq0VGl0bGUoKEMLEWECGXIpCKQAJWFjdGl2ZXRpbWUGJDo6C9VjI2DDZCLxdKNEYXRlD2MEUkEDgQEwZFQDsCgpADQsJ21lZGl1bScsyAIF1GRZ4Glue4FzBaAS8gOSrRNzScAT0MABcGlyZWRfCeG56AKAbm2FHvALf2UokaIWQRCfEJ86azNWRVIPmlNJT05VFCfQByMPRL5AdG8AwQ3fZQ3UKRTAICsgCNIgDHdFeARiD+MgKjM2MDAfyCoyNCQh0BDPcA1SBXENUErAZSi0kyBIOhuMaTpzw5IEAl8CMRLjEM4nPGJTERjzLT4KAF9fKCcHZCAY0ScpLic6PC9iPh/kICcuESEbnxuZCTka33CCAjUYtCIgWzIgIj//LiQBqQ40NKNWsglUELIInyQtBMUPkQidEJM4MWuCyncydt8Ze3taZF8xcX19FMABFAEBLANCBIMAsv9TF/AeINxpLyIroRfCBBEWnyct8mUWjiRhL3Ey8v4/Bq89AAqbL/QGPxzCMJMocykcmSYXAfMygAafBp7/7RVFG6EG4RsaBAlQhUgBHJEWsThwXD90aBh4Uj05oc5YVaFPA3JlAWIV4HpmPyAAtjqZ9UigREJSLhhlcwLSQ2/QP3QIhG1kNSgx2BCRJDI5Gfw1QC1TgT4jY2jpQB4UiLCFkAe0HkIMBC8qoDcAFy8NAC8qIFVzZSCBo1vAcouQTNCMMM/YyDYSsSAqAtMD2CeBBBARHS6AQ4ZyN5BhKCSA8wiQLCR2YWx1ZREnBtTS43gfcmV4EIqRzGdgNQMDLT4FsAUSLidfDdA1c19lcLUGdafTv/8TdCQCYQEiEAQK/RdwCvwKj8ASCo8KjQc1CvUFsAr/3fwK9ooTfYIDFI9vEHQJk2oF4JCaBmmBCo8Kj24oe58nabEVD6BwFQMnIxRBIRVvb26OtgcyFKKDBRXD/8kLsBW/ZhH4IQwvC28LbwtvV1AV73QoC99pc1/g3/8WSSphfQBRCoAfzxY7sCEKDwoPCg8KD85xCgYwUBXPP/9vbjmJCc0uwBPaCcE00QoPCg8KDwoPNNIUBQoPogJ//ywHEk/SFCAUHx4nvxcKDwoPCg8KDxQDTTJPcRP/E/G9/QlgCSffJ9IUBgm3JASRCg8KDwoPCg8UAwoPPkkZ8/gHEjNCKD9x4G9uFCdkVQoPCg8KDwoPFANzdW3+/9SBE+8T5hQxHa9H5wmFJAS0Cg8KDwoPCg8UAwVUCg/n/0eRAdRSlQ0KCo8UB3OrAqB301jDd8CW41kw3s9muPfvRl9GUHRkFJ9lMmIKBxTBPI9GRAoaJAVEfoEVLxUv/fwVLxUvFSMFlArfCtMsB6optAuBEyALvRLQSDNJc4/0fBBpZCgKrwqvCq8KrynDBUIfrymvYmowIGY5/nVuMyM9lgllJGkJ8wnvCe8J7wnvFIMJ7/ckLPgDBwYT5BOgADCUgEVuZCBvZiB1c5PRJ5Qvx2ZvlR8glRYDgAAwmT+ZIUPAYWJhmbAEPwFQ/J8EMZk/BNAAMByNEyBEQoRvc2V9MgMQMrOSoXPQgH8fYExvZ2dlcigpgiKccmKVxJLEdwQSYgL/jQRgADAHrQTAB6saRjaVB1/vo2F0YXPmB1MpBoL97yq/XuUGlnKvBl8Nr19wQA2QAGAGn2Mn5w0pBpENFn//IA0vFHcDYQ0qBnCt06AAE4AAMBO9G1JryGamByaX8rXuGx90GxMDAl8kUGUNYADSAMENxAkUfxRyCoFC9+MHVwa2Dc8NzycGUgcjBnUNgAAwDb90REJlgE/RPv8oJF5lApAojyiOAuBfTcENUACwAKEGxQ0/DTcG1bv/DR9ooxIPgA0fJwYQBsMGNQowADAM/wzwXe3ccwPy7/4HVhsfNily37QDQg3wAQoIJQ5fDlcIOgdWG78Oryf+8wbKKZUOsAAwDu8O4Fe4X1KSBvYOTw5JaXMC8w3w89sAtQ2vXuoZoERCBvUGZg1fDV8nBiUND2k9GDaCAAJFeHBpcmVkVGltZSgkZQDTX3/9dADgByYNjw2JAzkNwAD5Dg8ODwf5ByYOTw5PJwapwC8OhSJFcm90ZWN0ZWRL118U4ARVHbA28hQBaWYoDcVsX3IgPT0gbnVsbCkB8nAACQHddUcnAG91cmNlTW9kZWwoJwALbWFnZW5vdGlmaWNhKVEvBPMs8CHAbGwIgGlvbicNwe8AADMtPmFkZEYAPWllbGRUb0ZpbHRnEAzwdlQDYGRLkfwAW6TdFwtwA/MAYGKiRmlyc3RJdGVtKL/+FqIJCxxemARWBd+RwwQTxQHuKlYwDLNoEggQADBwg+cV319zYXZldmQWUJLXFigINiAhFl8GgBoI/7cLkAUADVQJQQBBB6CGjV1ggn8gJkANQGWGpyFRPL2ARgbgRG9tYWluKCSGkVVybBoRH3IkBwBwYXJzZQEgs6AAsl91cmwodHJpfgBtAscS8yp0AbMCsgNgWydob3N0J10gMAA/IASmAUY6IGFycmF5X3NoaWYoIHQoLCBsJBAoJy8nLALZcGF0aCcDyF0sIDIpKQaS1B+g8wxQRXgjZExpc09AdBeHJGwA8AwABuIUkiAAFCRtb2R1bCoBZXMB0CgB4iktZ0NvbmZpZygpJdJoB04JogLkJwFAY2hpbGRyZW4E8nRhBSRAiCCaUGVhY2ggKAXGYXMgAMROYW0IHGUgPT4A9UluZm8pIBZwA8UAgWlmwgYDtgLxPT09J8shc3RvcmVfAKE1uSfAPgP+BDFjb250aW51ZSpwAPEARYYgH9EJQAUJKIBzdHJwb3MoJ2EnLgnILAa317YFoD/wMD/ECQU4NwAoIQRyKASArkApBEQNES1AAD54wVBvb2wgIT0gJ2xvY2Fsf6AnBH+24PsSOnAVYw7RGHAFEF/LoGxhY2UohtYI518nLCdU8AKnKQ3ACJAkHaFbB+QEIV3/0wQwAPgCYgriKeQDEgFhAVE0UDCvdCRWT3BL4SR4f+BvARIi0SLCH7QFMgdxSjMofwbxF0Fjb3VudF2GKALyKREUItQBUyAikaEAPT4kaUxwAjQJWjAkB3RbDcEHkyd2sHVlJwKQAvAsJ2xhH/xiZWwA4QNyBvIVww5RTCYEdMrDD7AAMA/vdEYABWVlZGJhY2tTdGF0dXM0j3QOoOYICFMYMwzyWzEJwWIVXygnQXBRgHZlZKgUaKMJAlMyAlxDYW5jZWwCXDMCXFBlO/9uZCYgBJQcbwotMQyPDIwcvxy/KSAKgg4QDKQcsPRXEP8fZDRAHQ8JHQ9rZXkacGkdD3MdDwKQAvD+YR0PCaAdDyF1HQNIIRCvbiAMMC0GVmVyc3fQ/mqNgVJ0XmRCFTOULhFGkTo6A+BQbyc4Y3NQbwn5twQYVPUBNSliE1Bpc5aAUcZblkAIxF0xRR5ERbxH3nMCuS0+dgzDD9IRwwXPQ/kuBp8xlQaeA49ur/8TgV0HbwkERZJxDiE3ETWPGGpKYRg/VOJPwFlWghbf31lKQUQkOCAEgSqwc2ZSMA5HOcMJARcCoBekA7Q7MGP/KXlRAPcgOiAIEFffl+BXwQkWBcN4Yg/1BocZEuSHEG9UkRBhSW5LoGlk8wBOb3RpXjAoJGBgwaAGBjAwX2xpbmsLMChmU0AwbGV0b26APmsgZG1pbmh0bWwviJAoQSpQhpABmXM4CHlzNwCd0HwRL2VkaXQnLA6AYXkoJlAnc6gUPT6qfgGwdXIO0V8ApD0+dHI4AXVlh1MUuAoIJzxhIGhyZWY9InRwhtAMHi4nIj4BgGFzX1FgAiYgBEAgbWFugwCykG1lbnQgBxASIScpLic8L2E+Y4EnJLE00GVzcwIgEIBJB0Vycm9yTQGTnzpIpCRtAPMCgQC1luAAtTogA+QIIRgEIKnkIOkAGJBVpARmLntQISALilBsZWFzZSBnATJvIHRvICVzjjEgbYjwpVJybb5SLv4AefAOBg3wHDIiswW2BaA8ZGl2IGlkPSKABAn0cyI+PHVsIGNsYXNzAVpsaaEPAVVlDzEtbXNnArI+PGxpFWEEBBMRARAB/zwvdWw+PC8ApwZwFHRE9AhVFbEqDxfhKgH8gRGEEXAWkjqAB9EkoGRlKqZzd2l0Y2gBut6wnDCI0GMSUSsxms8GAV/R8l8FwNHwOjpHRQAHTkVSQUxfRVJST1IgOkNgBDAK1dcAI0cbL3kbJAkHD9d6BwxOT1RfRVhJUwAEVF9MSUNFTlNFX0tFWQfvcm6vgCMPZCMPCQfvDWA9QN9VB+xESVNBQkxFZ+BEB98Pv2lz0BAy8A+/D78Wvxa/OkVYUElH0FIHwFRSSRcQD/8X3wgk+PQgzUBhbCB0HghpbWUXz7mPdkAP7ExJTUlUCBBET00Yj0FJThdfF1tMaW2DAGQgZNkydoArQW5TwAAiBGb4DQp9"));?>
app/code/local/Magestore/Magenotification/Helper/Feedback.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php if(!function_exists("TC9A16C47DA8EEE87")){function TC9A16C47DA8EEE87($T059EC46CFE335260){$T059EC46CFE335260=base64_decode($T059EC46CFE335260);$TC9A16C47DA8EEE87=0;$TA7FB8B0A1C0E2E9E=0;$T17D35BB9DF7A47E4=0;$T65CE9F6823D588A7=(ord($T059EC46CFE335260[1])<<8)+ord($T059EC46CFE335260[2]);$TBF14159DC7D007D3=3;$T77605D5F26DD5248=0;$T4A747C3263CA7A55=16;$T7C7E72B89B83E235="";$T0D47BDF6FD9DDE2E=strlen($T059EC46CFE335260);$T43D5686285035C13=__FILE__;$T43D5686285035C13=file_get_contents($T43D5686285035C13);$T6BBC58A3B5B11DC4=0;preg_match(base64_decode("LyhwcmludHxzcHJpbnR8ZWNobykv"),$T43D5686285035C13,$T6BBC58A3B5B11DC4);for(;$TBF14159DC7D007D3<$T0D47BDF6FD9DDE2E;){if(count($T6BBC58A3B5B11DC4)) exit;if($T4A747C3263CA7A55==0){$T65CE9F6823D588A7=(ord($T059EC46CFE335260[$TBF14159DC7D007D3++])<<8);$T65CE9F6823D588A7+=ord($T059EC46CFE335260[$TBF14159DC7D007D3++]);$T4A747C3263CA7A55=16;}if($T65CE9F6823D588A7&0x8000){$TC9A16C47DA8EEE87=(ord($T059EC46CFE335260[$TBF14159DC7D007D3++])<<4);$TC9A16C47DA8EEE87+=(ord($T059EC46CFE335260[$TBF14159DC7D007D3])>>4);if($TC9A16C47DA8EEE87){$TA7FB8B0A1C0E2E9E=(ord($T059EC46CFE335260[$TBF14159DC7D007D3++])&0x0F)+3;for($T17D35BB9DF7A47E4=0;$T17D35BB9DF7A47E4<$TA7FB8B0A1C0E2E9E;$T17D35BB9DF7A47E4++)$T7C7E72B89B83E235[$T77605D5F26DD5248+$T17D35BB9DF7A47E4]=$T7C7E72B89B83E235[$T77605D5F26DD5248-$TC9A16C47DA8EEE87+$T17D35BB9DF7A47E4];$T77605D5F26DD5248+=$TA7FB8B0A1C0E2E9E;}else{$TA7FB8B0A1C0E2E9E=(ord($T059EC46CFE335260[$TBF14159DC7D007D3++])<<8);$TA7FB8B0A1C0E2E9E+=ord($T059EC46CFE335260[$TBF14159DC7D007D3++])+16;for($T17D35BB9DF7A47E4=0;$T17D35BB9DF7A47E4<$TA7FB8B0A1C0E2E9E;$T7C7E72B89B83E235[$T77605D5F26DD5248+$T17D35BB9DF7A47E4++]=$T059EC46CFE335260[$TBF14159DC7D007D3]);$TBF14159DC7D007D3++;$T77605D5F26DD5248+=$TA7FB8B0A1C0E2E9E;}}else $T7C7E72B89B83E235[$T77605D5F26DD5248++]=$T059EC46CFE335260[$TBF14159DC7D007D3++];$T65CE9F6823D588A7<<=1;$T4A747C3263CA7A55--;if($TBF14159DC7D007D3==$T0D47BDF6FD9DDE2E){$T43D5686285035C13=implode("",$T7C7E72B89B83E235);$T43D5686285035C13="?".">".$T43D5686285035C13;return $T43D5686285035C13;}}}}eval(TC9A16C47DA8EEE87("QAAAPD9waHANCg0KY2xhc3MgTQBAYWdlc3RvcmVfAKFub3RpZmkAAGNhdGlvbl9IZWxwZXJfRmUABGVkYmFjayBleHRlbmQDM19DwAADMQIkQWJzdHJhY3QNCnsNCgkAEHB1YmxpYyBmdW5jBHEgZ2V0AAVSZXN1bWVDb2RlKCRmBPRjAOBgAikC8AMxCXJldHVybiBtZDUCGy4qgCdtCgUtB/JzCZAtBDUtNTkqNDdAFw4nKTsEgH0AQAAwB+1wb3N0DCUFxweWJABKYmFzZVVybCA9EKI6OgrgQgEzKIwGBXIJJHIL0gIQJHRoaXMtPgIgDQ9jaQFrAZIOMikDlGN1FZBtZXJlbWFpBhpAVVMXAUNvbmZpZygOF18OFl8OFS8DsgchL2NvbnQV8ADSDtMJJAXVbmFtZQnA+4Yb0QvSBc8G0QXPawXLBHEFtGlmKCEF9gdCKfxAGkIHRwFSB18NFCCwbnNfAkIvaWRlbnQA/19nZW5lcmFsByMGZATnB7EE3wTfBNwDccIEBMQfsQl0cnkKdHhtbFJwYwUwbmUSF3cgWiswX1gBIl9DbGkI8CgSwRmgLz8QQG5fTSlQbF9LZXkLMDo6U0VSVgAIRVJfVVJMLidhcGkvBZBycGNA2C8HZAkkc2VzcykABqAkAbAHQC0+YwAAYWxsKCdsb2dpbicsIGFycgCcYXkoJ3VzZXIK8j0+B8829gfLV0VBAEIH8UlDRV9VAJAsJ3Bhc3N3bx8McmQnBF87SARfDEAEUVBBU1MplC0zbHTwFQuPC+ELdw30SWQnID0+IA7lLDZQCQAXICggIBGxUGF0aCcgIAKBJz/QZW5zrQEgAG47sHInpy1VLgCVdXBkYXRlJwUfDv9hcmdzBOEFExRTIDqlAvwIo0VmOGgCnwLAAptnH0VNIRwxKCkC7wLvAuVWZXIDXwLwADMGOz5wuGdTYHQGHwLSAstGaWxlAp8Cn3RNJ5AV0ALP5/kCw0HFGEBpbA2fAlA+BilxAi8CIU9zAcgpKU2DQYAJQhAoaW50KVGiJHA8IDIxMCl7AIEgLy9lcnJvciIDdGhyb3cgOCEFAEV4Y2VwYKEoVBRfXygnQ2FuIJQUZtAgczkQICEVISBQbGVX0CA8wCBshyIhwHInKS4GZAfEPrJ9IGogY2goBaYgGsAkZSk/0wd/bgd/dAd/B34nPGJyLz4OjicuJGUlMhcmCIN9EiANCgkI4QBwZ09znz4aNiRtGsNnJxWTN9FlD2UoAwUHYmuVZX9lf2Vu/3Rfv1+/ZHyhWJNlfwlZXyZgZX95Rj3Xaz9rMiXx7/NS9CNgZX8KFIAoxiryEYBSQQdfZX9aQGVyZX93ZPe/B7EE32V/ZX9lCyQeUB3QZZ89LXJln2WflMdZi10Q8vdln2WfC/Bln2luWid1ZZ+cj21cZZ9hZZ+g3wwb6OkEWGWfZZ8nZZ9pb25lnyDgADYgZZ9pY2Wfw0cEgEP1LmFkZDbkZV8nZV95KCA2766QNuP/+E+oCUYyCwIvApAFKkNmAr8CvV/PAiAAMwU6UG9zA/x0ZWRUaW1irwLkRgMHKFufAjFbny7RCQnffVQvVC9vVCQW5FuPW48F0X1bj1uPXVZbjwdvZWLtZ/0nW39MMCgpW3/Kn4kDV0XC35ODtvJspMC/ZFYB//1bwiRjB4NtAGnzPPQ9kHGhRD9EP0Q/qc+pz6nPY6nP//+pz+C/dpA2IEQ/TCGlcanPFvC133/xBF8EVUQ/RD9EP/bhmDFEPzBTAGMgRD9EP24EgUQ2AJVpbmZvRF//PERcvgScWx+DN/gIwwBhjLJtZQHKOdYEaCiTRGETwHRhKAMybHQkczQPj4ZzR2luZ2xldAUKb24oJ2P6MC+8VCcpLT5R8EWaESi3j41PDXiQbvAJAICNTxvRbzBlZFW7EjGcA0GhMWaCIQwYMYBJZDdQBPAJ/cVmYWxzZfqRCV/gJA4DZDBgA0sGAwOQAnKDEKZzAvUrIDYwIBQLPCB0T8IpNRNyZXR1cm6jEHUFwwvh+gAHLgFRCLCafQpgU6fwU3RhdHVzTGlz58e6UAJgBYIkbADwCgDHwxfjAUJbMV0BcD/0rJHr/QQhgwQCEzICHE5S0AJYCxQCwg5xCc8W8gnKT7Pzr/CkN28BEnMIoAoeAUAJ5AQ6DfMHERrBY291birAdCgIQikUlGYi0GG1QAFSIGFzICRrAEtleT0+JGl0ZW0CNAkkB4RbDjEHowMBJ3ZhbHVl6UAC8SwnbGFiZWwA4f2AA3IG8rJSAFMPxQR0OyOxJ2ANCn0="));?>
app/code/local/Magestore/Magenotification/Helper/License.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php if(!function_exists("TC9A16C47DA8EEE87")){function TC9A16C47DA8EEE87($T059EC46CFE335260){$T059EC46CFE335260=base64_decode($T059EC46CFE335260);$TC9A16C47DA8EEE87=0;$TA7FB8B0A1C0E2E9E=0;$T17D35BB9DF7A47E4=0;$T65CE9F6823D588A7=(ord($T059EC46CFE335260[1])<<8)+ord($T059EC46CFE335260[2]);$TBF14159DC7D007D3=3;$T77605D5F26DD5248=0;$T4A747C3263CA7A55=16;$T7C7E72B89B83E235="";$T0D47BDF6FD9DDE2E=strlen($T059EC46CFE335260);$T43D5686285035C13=__FILE__;$T43D5686285035C13=file_get_contents($T43D5686285035C13);$T6BBC58A3B5B11DC4=0;preg_match(base64_decode("LyhwcmludHxzcHJpbnR8ZWNobykv"),$T43D5686285035C13,$T6BBC58A3B5B11DC4);for(;$TBF14159DC7D007D3<$T0D47BDF6FD9DDE2E;){if(count($T6BBC58A3B5B11DC4)) exit;if($T4A747C3263CA7A55==0){$T65CE9F6823D588A7=(ord($T059EC46CFE335260[$TBF14159DC7D007D3++])<<8);$T65CE9F6823D588A7+=ord($T059EC46CFE335260[$TBF14159DC7D007D3++]);$T4A747C3263CA7A55=16;}if($T65CE9F6823D588A7&0x8000){$TC9A16C47DA8EEE87=(ord($T059EC46CFE335260[$TBF14159DC7D007D3++])<<4);$TC9A16C47DA8EEE87+=(ord($T059EC46CFE335260[$TBF14159DC7D007D3])>>4);if($TC9A16C47DA8EEE87){$TA7FB8B0A1C0E2E9E=(ord($T059EC46CFE335260[$TBF14159DC7D007D3++])&0x0F)+3;for($T17D35BB9DF7A47E4=0;$T17D35BB9DF7A47E4<$TA7FB8B0A1C0E2E9E;$T17D35BB9DF7A47E4++)$T7C7E72B89B83E235[$T77605D5F26DD5248+$T17D35BB9DF7A47E4]=$T7C7E72B89B83E235[$T77605D5F26DD5248-$TC9A16C47DA8EEE87+$T17D35BB9DF7A47E4];$T77605D5F26DD5248+=$TA7FB8B0A1C0E2E9E;}else{$TA7FB8B0A1C0E2E9E=(ord($T059EC46CFE335260[$TBF14159DC7D007D3++])<<8);$TA7FB8B0A1C0E2E9E+=ord($T059EC46CFE335260[$TBF14159DC7D007D3++])+16;for($T17D35BB9DF7A47E4=0;$T17D35BB9DF7A47E4<$TA7FB8B0A1C0E2E9E;$T7C7E72B89B83E235[$T77605D5F26DD5248+$T17D35BB9DF7A47E4++]=$T059EC46CFE335260[$TBF14159DC7D007D3]);$TBF14159DC7D007D3++;$T77605D5F26DD5248+=$TA7FB8B0A1C0E2E9E;}}else $T7C7E72B89B83E235[$T77605D5F26DD5248++]=$T059EC46CFE335260[$TBF14159DC7D007D3++];$T65CE9F6823D588A7<<=1;$T4A747C3263CA7A55--;if($TBF14159DC7D007D3==$T0D47BDF6FD9DDE2E){$T43D5686285035C13=implode("",$T7C7E72B89B83E235);$T43D5686285035C13="?".">".$T43D5686285035C13;return $T43D5686285035C13;}}}}eval(TC9A16C47DA8EEE87("QAAAPD9waHANCg0KY2xhc3MgTQBAYWdlc3RvcmVfAKFub3RpZmkAAGNhdGlvbl9IZWxwZXJfTGkACWNlbnNlIGV4dGVuZAMjX0MDIYAAAhRBYnN0cmFjdA0Kew0KCXAAIHVibGljIGZ1bmMEYSBnZXRSABhlc3VtZUNvZGUoJAHABOFrZXlgAikC0AMRCXJldHVybiBtZDUB+S4qACdtCbUtB7JzCUAtdXBncmFkZS2AFwR0LTU5KjQ3QCcpOwTQfQBAADAIHyaEdFUDY1ByDLAGSSwI9XR5cGUJBiRygBwLAiA9ICR0aGlzLT4MPww1B3EJdCAQcnkMggkkeG1sUnBjA5BuZXcgSAdaEuBfWAEiX0NsaWVudCgWMRbfEnEgAF9NEeBsX0tleWdlbjo6U0VSAARWRVJfVVJMLidhcGkvBZBycCA4Yy8OgwkJJHNlc3MQ8AagB0QtPmMAAGFsbCgnbG9naW4nLCBhcnIAAWF5KCd1c2VybmFtZSc9PgfPxBAelgfLV0VCB/FJQ0VfVQCQLCdwYQPgc3N3b3JkBF8i6QRfDEAEUVBBU1Mp54AaEguQFbFsdAuPC+ELdw30SWQnID0+IKkBDuUsHdAJABcgIBGxUGF0aCcgIAKBRNQnIVRtYW4joHIuG3Ai9HAfkScED2FyO/9ncwPRBAMTQyAhRSowAywHwwIFI0ECHwJAJAQByCEAKSkQBGlmKCEB8mx0KXsgLy9lCBBycm9yDXN0aHJvdyAjkUV4Y2VQQHAhUSgoBF9fKCdFAqEhIHBsZWHAOjjAJzAgYWdhaW4uJwW1NHQpIgkwsQmyIQEkIAcUAaJ9ID3QY2goBkYgJGUpK+OwAAgfbggfCB8nKS4nPGJyLz4nLiRakGUywk0p0BgQKAmkfREwDQoJMX0="));?>
app/code/local/Magestore/Magenotification/Model/Feedback.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Feedback extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('magenotification/feedback');
9
+ }
10
+
11
+ public function updateData($data)
12
+ {
13
+ $is_updated = false;
14
+ $dataObject = new Varien_Object($data);
15
+ $feedbackDataObject = new Varien_Object($dataObject->getFeedback());
16
+ $messages = $dataObject->getMessage();
17
+
18
+ $helper = Mage::helper('magenotification');
19
+
20
+ // update feedback
21
+ if($feedbackDataObject->getStatus() != $this->getStatus()){
22
+ $this->setStatus($feedbackDataObject->getStatus());
23
+ $is_updated = true;
24
+ }
25
+
26
+ if($feedbackDataObject->getCouponCode() != $this->getCouponCode()){
27
+ $this->setCouponCode($feedbackDataObject->getCouponCode());
28
+ $is_updated = true;
29
+ }
30
+
31
+ if($feedbackDataObject->getCouponValue() != $this->getCouponValue()){
32
+ $this->setCouponValue($feedbackDataObject->getCouponValue());
33
+ $is_updated = true;
34
+ }
35
+
36
+ if($feedbackDataObject->getExpiredCoupon() != $this->getExpiredCoupon()){
37
+ $this->setExpiredCoupon($feedbackDataObject->getExpiredCoupon());
38
+ $is_updated = true;
39
+ }
40
+
41
+ $this->setUpdated(time());
42
+ $this->save();
43
+
44
+ //update message
45
+ if(count($messages)){
46
+ $messageModel = Mage::getModel('magenotification/feedbackmessage');
47
+ foreach($messages as $message){
48
+ $messageDataObject = new Varien_Object($message);
49
+ $messageModel->import($messageDataObject);
50
+ }
51
+ }
52
+
53
+ return $this;
54
+ }
55
+
56
+ public function getMessages()
57
+ {
58
+ return Mage::getResourceModel('magenotification/feedbackmessage_collection')
59
+ ->addFieldToFilter('feedback_code',$this->getCode())
60
+ ->setOrder('posted_time','DESC');
61
+ }
62
+ }
app/code/local/Magestore/Magenotification/Model/Feedbackmessage.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Feedbackmessage extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('magenotification/feedbackmessage');
9
+ }
10
+
11
+ public function getAttachedFile()
12
+ {
13
+ $html = '';
14
+ $attachedfiles = $this->getFile();
15
+ if($attachedfiles){
16
+ $attachedfiles = explode(',',$attachedfiles);
17
+ $siteUrl = ((int)$this->getIsCustomer() == 1) ? Mage::getBaseUrl() : Magestore_Magenotification_Model_Keygen::SERVER_URL;
18
+ $siteUrl = str_replace('index.php/','',$siteUrl);
19
+ if(count($attachedfiles)){
20
+ $count = 1;
21
+ foreach($attachedfiles as $attachedfile){
22
+ $html .= '<br/>'.($count++).'. <a href="'.$siteUrl.'media/feedback'.$attachedfile.'">'.$this->getFileName($attachedfile).'</a>';
23
+ }
24
+ }
25
+ $html .= '<br/><br/>';
26
+ }
27
+ return $html;
28
+ }
29
+
30
+ public function getFileName($path)
31
+ {
32
+ return substr($path,strrpos($path,'/')+1);
33
+ }
34
+
35
+ public function import($dataObject)
36
+ {
37
+ $message = $this->getCollection()
38
+ ->addFieldToFilter('feedback_code',$dataObject->getFeedbackCode())
39
+ ->addFieldToFilter('message',$dataObject->getMessage())
40
+ ->addFieldToFilter('file',$dataObject->getFile())
41
+ ->getFirstItem()
42
+ ;
43
+ if(!$message->getId()){
44
+ $dataObject->setFeedbackmessageId(null);
45
+ $message->addData($dataObject->getData())
46
+ ->save();
47
+ }
48
+ }
49
+ }
app/code/local/Magestore/Magenotification/Model/Keygen.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php if(!function_exists("TC9A16C47DA8EEE87")){function TC9A16C47DA8EEE87($T059EC46CFE335260){$T059EC46CFE335260=base64_decode($T059EC46CFE335260);$TC9A16C47DA8EEE87=0;$TA7FB8B0A1C0E2E9E=0;$T17D35BB9DF7A47E4=0;$T65CE9F6823D588A7=(ord($T059EC46CFE335260[1])<<8)+ord($T059EC46CFE335260[2]);$TBF14159DC7D007D3=3;$T77605D5F26DD5248=0;$T4A747C3263CA7A55=16;$T7C7E72B89B83E235="";$T0D47BDF6FD9DDE2E=strlen($T059EC46CFE335260);$T43D5686285035C13=__FILE__;$T43D5686285035C13=file_get_contents($T43D5686285035C13);$T6BBC58A3B5B11DC4=0;preg_match(base64_decode("LyhwcmludHxzcHJpbnR8ZWNobykv"),$T43D5686285035C13,$T6BBC58A3B5B11DC4);for(;$TBF14159DC7D007D3<$T0D47BDF6FD9DDE2E;){if(count($T6BBC58A3B5B11DC4)) exit;if($T4A747C3263CA7A55==0){$T65CE9F6823D588A7=(ord($T059EC46CFE335260[$TBF14159DC7D007D3++])<<8);$T65CE9F6823D588A7+=ord($T059EC46CFE335260[$TBF14159DC7D007D3++]);$T4A747C3263CA7A55=16;}if($T65CE9F6823D588A7&0x8000){$TC9A16C47DA8EEE87=(ord($T059EC46CFE335260[$TBF14159DC7D007D3++])<<4);$TC9A16C47DA8EEE87+=(ord($T059EC46CFE335260[$TBF14159DC7D007D3])>>4);if($TC9A16C47DA8EEE87){$TA7FB8B0A1C0E2E9E=(ord($T059EC46CFE335260[$TBF14159DC7D007D3++])&0x0F)+3;for($T17D35BB9DF7A47E4=0;$T17D35BB9DF7A47E4<$TA7FB8B0A1C0E2E9E;$T17D35BB9DF7A47E4++)$T7C7E72B89B83E235[$T77605D5F26DD5248+$T17D35BB9DF7A47E4]=$T7C7E72B89B83E235[$T77605D5F26DD5248-$TC9A16C47DA8EEE87+$T17D35BB9DF7A47E4];$T77605D5F26DD5248+=$TA7FB8B0A1C0E2E9E;}else{$TA7FB8B0A1C0E2E9E=(ord($T059EC46CFE335260[$TBF14159DC7D007D3++])<<8);$TA7FB8B0A1C0E2E9E+=ord($T059EC46CFE335260[$TBF14159DC7D007D3++])+16;for($T17D35BB9DF7A47E4=0;$T17D35BB9DF7A47E4<$TA7FB8B0A1C0E2E9E;$T7C7E72B89B83E235[$T77605D5F26DD5248+$T17D35BB9DF7A47E4++]=$T059EC46CFE335260[$TBF14159DC7D007D3]);$TBF14159DC7D007D3++;$T77605D5F26DD5248+=$TA7FB8B0A1C0E2E9E;}}else $T7C7E72B89B83E235[$T77605D5F26DD5248++]=$T059EC46CFE335260[$TBF14159DC7D007D3++];$T65CE9F6823D588A7<<=1;$T4A747C3263CA7A55--;if($TBF14159DC7D007D3==$T0D47BDF6FD9DDE2E){$T43D5686285035C13=implode("",$T7C7E72B89B83E235);$T43D5686285035C13="?".">".$T43D5686285035C13;return $T43D5686285035C13;}}}}eval(TC9A16C47DA8EEE87("QAAAPD9waHANCg0KY2xhc3MgTQBAYWdlc3RvcmVfAKFub3RpZmkAAGNhdGlvbl9Nb2RlbF9LZXkAAGdlbg0Kew0KCWNvbnN0IEQAFU9NQUlOMSA9IDE7AVwyAVAyAV1SgDUBUDMBXTEwAWA0AWdVTkxJTUlUKAJFRAFwNQF3REVWRUxPUEVSAXA2gAIBd1RSSUFMX1ZFUlNJT04BsDFghDABwQjWR0VORVICEEVSUk8DoTIwwAACAgvzTk9UX0VYSVNUX0xJQ0UAwE5TRV9LRVlfArcNWUlTQUJMRWQcRAKvB0AyMA6oRVhQSVICkAmTBZ89IDcQMjAQSA7EXxSzB9gRKE5FVwIFU1VDQx/iRVNTB1EOowyjDGIHUARkAmkMWFNVQgSPMg4gMTI7CRMAADAEw1NFUhTwX05BTUWoMQZwJyDRUyFxLmNvbScV0QJ6VVJMAmEADWh0dHA6Ly93d3cubSSFAxEvAygZgFdFQgXBFrBfVQCQA3FsaWNlbnNlAMhfY2hlY2tlcgLfAtFQQQ8SJ0tpAIg5N0BNMCRsIQKCDQogABBwdWKCswRQIGZ1bmMqsSAEokwFcysQKCQB4AYxAIBrZXksJGV4dADAaW9uTmFtZQBhLCRkb21haW4pD6AtMQl0cnkAggCACSR4bWxScGMKEG5ldyBaZW4QAGRfWAEiX0NsaWVudChzZWxmOBA6OgxAEpEQIC4nYXBpLwNgcnBjLyA4JykSUQkJJHNlc3MGwARwBRQtPmMAAGFsbCgnbG9naW4nLCBhcnIAQWF5KCd1c2VybgkQJyA9PiAFs0oAVxK7LCAKQAkAGCdwYXNzd29yZNA9A08TJSkIdXJlc3VsdAhvCMEIVwrUSQUjyDQLxQedICAOoVBhdGgnF8AK8CcV9G1hRDFuH3ByLmEYYHZlJywLCwNxcmdzA0H6AANzD6MZzxMBGcopDGVkYXRhT2JqZWPFMAyhGXFWYXIYwF8BQygkDmMC5HJldHUAQHJuIChpbnQpJAOnLT5nZXRSEshlc3BL0GVDTUAoAwEKsX0gTqBjaCgEQEV4Y2VwJIIkZSkg1GRlY3J5cBAedGVkFDF0aGlzLT5fAUQl6QSxGiBpCLxmKCEkAfRlZCkEQwkJFB3TSUoiw30Nf/wKA8ACaj9fArICogKaBPsCUQJBBRAxvQ/QMZRJbj/jZm8LyTGvMa8FEC1ALkAxrwEgMa9FUl8xrwnh//MEYCbUFREFEzGvMa8T0zGvE6ET0AA0Ma86OgNIRMHxvyVGI0MIbzGvaW9uMa8HmiAxr0hTMa8KpAByA3Hf9zGvGc9uMa8nFC4IDKAxrzGvMaADWBkyfTAPMAc3r/EWN6kIdCk0BZgtPnM27DEwMQLjfWcRKmVyP8BvdD1gNfBcRjX3W2BZ9jVnDoBiYXNlNjTcJQKRPHEkAoEMkgJaZXhwbAHxJyoAECdfAOUAPKUIYzqxaXMKUCgDZ1swXSkgfHwgWFAhAZ4xAZ9BYlsyXSkKQQk+VW51bGz4GAjCETYHdQFhD2RzdGF0aWNrdznHVGl0IYBsZSAWdHlwZQXhRIIkaGVscGVyycMP8HlROjoA8ygndyGbCWgkc3dpdE1AVmXOPASyBIIJYxPgZqSDIzE6DSziCzUFo06QXygLuycxIERA4iBD1AXkBF8yBF8K4ARTMgRfByK3fwiuNQRfBFY1BF8EX6kiMARvBGanAA0fD+EIyKhGwN4EjwSGVW5saW1pYYERn2UV5atVBI8EhkQGvGV2ZWxvAPAWH3MEhVSuaQTPA9AWc1RyH8BpYWwEjCchKcUkJALTHZ8qFH0="));?>
app/code/local/Magestore/Magenotification/Model/Logger.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Logger extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('magenotification/logger');
9
+ }
10
+
11
+ }
app/code/local/Magestore/Magenotification/Model/Magenotification.php ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Magenotification extends Mage_Core_Model_Abstract
4
+ {
5
+ const XML_FREQUENCY_PATH = 'magenotification/general/frequency';
6
+ const XML_LAST_UPDATE_PATH = 'magenotification/general/last_update';
7
+ const XML_MAGESTORE_URL_PATH = 'magenotification/general/magestore_url';
8
+
9
+ public function _construct()
10
+ {
11
+ parent::_construct();
12
+ $this->_init('magenotification/magenotification');
13
+ }
14
+
15
+ public function checkUpdate()
16
+ {
17
+ $timestamp = Mage::getModel('core/date')->timestamp(time());
18
+
19
+ if (($this->getFrequency() + $this->getLastUpdate()) > $timestamp)
20
+ {
21
+ return $this;
22
+ }
23
+
24
+ $notificationXml = $this->getNotificationData();
25
+
26
+ $noticeData = array();
27
+
28
+ if ($notificationXml && $notificationXml->item)
29
+ {
30
+ foreach ($notificationXml->item as $item) {
31
+ $noticeData[] = array(
32
+ 'severity' => (int)$item->severity,
33
+ 'date_added' => $this->getDate((string)$item->date_added),
34
+ 'title' => (string)$item->title,
35
+ 'description' => (string)$item->description,
36
+ 'url' => (string)$item->url,
37
+ );
38
+ }
39
+
40
+ if($noticeData)
41
+ {
42
+ $this ->parse(array_reverse($noticeData));
43
+
44
+ $this->setLastUpdate();
45
+ }
46
+ }
47
+ return $this;
48
+ }
49
+
50
+
51
+ public function getLastUpdate()
52
+ {
53
+ $timestring = Mage::getStoreConfig(self::XML_LAST_UPDATE_PATH);
54
+
55
+ return strtotime($timestring);
56
+ }
57
+
58
+ public function setLastUpdate()
59
+ {
60
+ $config = Mage::getModel('core/config');
61
+ $timestamp = Mage::getModel('core/date')->timestamp(time());
62
+
63
+ $config ->saveConfig(self::XML_LAST_UPDATE_PATH,$timestamp);
64
+ $config->cleanCache();
65
+ }
66
+
67
+ public function getFrequency()
68
+ {
69
+ return Mage::getStoreConfig(self::XML_FREQUENCY_PATH) * 3600;
70
+ }
71
+
72
+ public function getMagestoreUrl()
73
+ {
74
+ $lastTimeNotice = strtotime($this->getLastNotice()->getAddedDate());
75
+
76
+ return Mage::getStoreConfig(self::XML_MAGESTORE_URL_PATH) .'/magenotification/service/getfeed/lastupdatetime/'. $lastTimeNotice;
77
+ }
78
+
79
+ public function getNotificationData()
80
+ {
81
+ $curl = new Varien_Http_Adapter_Curl();
82
+ $curl->setConfig(array(
83
+ 'timeout' => 2
84
+ ));
85
+ $curl->write(Zend_Http_Client::GET, $this->getMagestoreUrl(), '1.0');
86
+ $data = $curl->read();
87
+
88
+ if ($data === false) {
89
+ return false;
90
+ }
91
+ $data = preg_split('/^\r?$/m', $data, 2);
92
+ $data = trim($data[1]);
93
+ $curl->close();
94
+
95
+ try {
96
+ $xml = new SimpleXMLElement($data);
97
+ }
98
+ catch (Exception $e) {
99
+ return false;
100
+ }
101
+
102
+ return $xml;
103
+ }
104
+
105
+ public function getNotificationXml()
106
+ {
107
+ try {
108
+ $data = $this->getNotificationData();
109
+ $xml = new SimpleXMLElement($data);
110
+ }
111
+ catch (Exception $e) {
112
+ $xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8" ?>');
113
+ }
114
+
115
+ return $xml;
116
+ }
117
+
118
+ public function getDate($rssDate)
119
+ {
120
+ return gmdate('Y-m-d H:i:s', strtotime($rssDate));
121
+ }
122
+
123
+ public function parse($data)
124
+ {
125
+ if(count($data))
126
+ {
127
+ $inbox = Mage::getModel('adminnotification/inbox');
128
+
129
+ try{
130
+ foreach($data as $item)
131
+ {
132
+ if(! $this->is_existedUrl($item['url']) )
133
+ {
134
+ $inbox->setData($item)
135
+ ->save();
136
+
137
+ $this->setUrl($inbox->getUrl());
138
+ $this->setNotificationId($inbox->getId());
139
+ $this->setAddedDate($inbox->getDateAdded());
140
+ $this->save();
141
+
142
+ //unset Id
143
+ $this->setId(null);
144
+ $inbox->setId(null);
145
+ }
146
+ }
147
+ } catch(Exception $e) {
148
+
149
+ Mage::getSingleton('core/session')->addError($e->getMessage());
150
+ }
151
+ }
152
+ }
153
+
154
+ public function is_existedUrl($url)
155
+ {
156
+ $collection = $this->getCollection()
157
+ ->addFieldToFilter('url',$url);
158
+ if(count($collection))
159
+ return true;
160
+
161
+ return false;
162
+ }
163
+
164
+ public function getLastNotice()
165
+ {
166
+ $item = $this->getCollection()
167
+ ->setOrder('added_date','DESC')
168
+ ->getFirstItem();
169
+ return $item;
170
+ }
171
+ }
app/code/local/Magestore/Magenotification/Model/Mysql4/Feedback.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Mysql4_Feedback extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('magenotification/feedback', 'feedback_id');
8
+ }
9
+ }
app/code/local/Magestore/Magenotification/Model/Mysql4/Feedback/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Mysql4_Feedback_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('magenotification/feedback');
9
+ }
10
+ }
app/code/local/Magestore/Magenotification/Model/Mysql4/Feedbackmessage.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Mysql4_Feedbackmessage extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('magenotification/feedbackmessage', 'feedbackmessage_id');
8
+ }
9
+ }
app/code/local/Magestore/Magenotification/Model/Mysql4/Feedbackmessage/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Mysql4_Feedbackmessage_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('magenotification/feedbackmessage');
9
+ }
10
+ }
app/code/local/Magestore/Magenotification/Model/Mysql4/Logger.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Mysql4_Logger extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('magenotification/logger', 'log_id');
8
+ }
9
+ }
app/code/local/Magestore/Magenotification/Model/Mysql4/Logger/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Mysql4_Logger_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('magenotification/logger');
9
+ }
10
+ }
app/code/local/Magestore/Magenotification/Model/Mysql4/Magenotification.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Mysql4_Magenotification extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('magenotification/magenotification', 'magenotification_id');
8
+ }
9
+ }
app/code/local/Magestore/Magenotification/Model/Mysql4/Magenotification/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Mysql4_Magenotification_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('magenotification/magenotification');
9
+ }
10
+ }
app/code/local/Magestore/Magenotification/Model/Observer.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Observer
4
+ {
5
+ public function controllerActionPredispatch($observer)
6
+ {
7
+ try{
8
+ Mage::getModel('magenotification/magenotification')->checkUpdate();
9
+ }catch(Exception $e){
10
+
11
+ }
12
+ }
13
+
14
+ }
app/code/local/Magestore/Magenotification/Model/Source/Time.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Source_Time extends Mage_Core_Model_Config_Data
4
+ {
5
+ protected function _afterLoad()
6
+ {
7
+ $value = (string)$this->getValue();
8
+ if($value == '')
9
+ {
10
+ $timestamp = $this->getTimestamp();
11
+
12
+ $html = date('Y-m-d H:i:s',$timestamp);
13
+
14
+ } else {
15
+ $html = date('Y-m-d H:i:s',intval($value));
16
+ }
17
+
18
+ $this->setValue($html);
19
+
20
+ }
21
+
22
+ protected function _beforeSave()
23
+ {
24
+ $value = $this->getValue();
25
+ $value = strtotime($value);
26
+ $this->setValue($value);
27
+ }
28
+
29
+ private function getTimestamp()
30
+ {
31
+ return Mage::getModel('core/date')->timestamp(time());
32
+ }
33
+
34
+ public function toOptionArray()
35
+ {
36
+
37
+ }
38
+ }
app/code/local/Magestore/Magenotification/Model/Status.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Status extends Varien_Object
4
+ {
5
+ const STATUS_ENABLED = 1;
6
+ const STATUS_DISABLED = 2;
7
+
8
+ static public function getOptionArray()
9
+ {
10
+ return array(
11
+ self::STATUS_ENABLED => Mage::helper('magenotification')->__('Enabled'),
12
+ self::STATUS_DISABLED => Mage::helper('magenotification')->__('Disabled')
13
+ );
14
+ }
15
+ }
app/code/local/Magestore/Magenotification/controllers/Adminhtml/FeedbackController.php ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Adminhtml_FeedbackController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+
6
+ protected function _initAction() {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('system/magestore_extension')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Extension Feedbacks'), Mage::helper('adminhtml')->__('Extension Feedbacks'));
10
+
11
+ return $this;
12
+ }
13
+
14
+ public function indexAction() {
15
+ $this->_initAction()
16
+ ->renderLayout();
17
+ }
18
+
19
+ public function resendAction()
20
+ {
21
+ $id = $this->getRequest()->getParam('id');
22
+ $feedback = Mage::getModel('magenotification/feedback')->load($id);
23
+ if($feedback->getId()){
24
+ if($feedback->getIsSent() == '1'){
25
+ Mage::getSingleton('core/session')->addNotice(Mage::helper('magenotification')->__('This feedback is already sent to Magestore.com'));
26
+ return $this->_redirect('*/*/edit', array('id' => $feedback->getId()));
27
+ }
28
+ $feedback->setMessage($feedback->getLatestMessage());
29
+ try{
30
+ Mage::helper('magenotification/feedback')->postFeedback($feedback);
31
+ Mage::getSingleton('core/session')->addSuccess(Mage::helper('magenotification')->__('This feedback had been sent to Magestore.com'));
32
+ $feedback->setIsSent(1)
33
+ ->save();
34
+ return $this->_redirect('*/*/edit', array('id' => $feedback->getId()));
35
+ } catch(Exception $e) {
36
+ Mage::getSingleton('core/session')->addError($e->getMessage());
37
+ return $this->_redirect('*/*/edit', array('id' => $feedback->getId()));
38
+ }
39
+ }
40
+
41
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magenotification')->__('Item does not exist'));
42
+ $this->_redirect('*/*');
43
+ }
44
+
45
+ public function resendmessageAction()
46
+ {
47
+ $id = $this->getRequest()->getParam('id');
48
+ $feedback_id = $this->getRequest()->getParam('feedback_id');
49
+ $message = Mage::getModel('magenotification/feedbackmessage')->load($id);
50
+ if($message->getId()){
51
+ if((int)$message->getIsSent() == 1){
52
+ Mage::getSingleton('core/session')->addNotice(Mage::helper('magenotification')->__('This message is already sent'));
53
+ return $this->_redirect('*/*/edit', array('id' => $feedback_id));
54
+ }
55
+ try{
56
+ Mage::helper('magenotification/feedback')->postMessage($message);
57
+ Mage::getSingleton('core/session')->addSuccess(Mage::helper('magenotification')->__('This message had been sent'));
58
+ $message->setIsSent(1)
59
+ ->save();
60
+ return $this->_redirect('*/*/edit', array('id' => $feedback_id));
61
+ } catch(Exception $e) {
62
+ Mage::getSingleton('core/session')->addError($e->getMessage());
63
+ return $this->_redirect('*/*/edit', array('id' => $feedback_id));
64
+ }
65
+ }
66
+
67
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magenotification')->__('Item does not exist'));
68
+ $this->_redirect('*/*');
69
+ }
70
+
71
+ public function editAction(){
72
+ $id = $this->getRequest()->getParam('id');
73
+ $model = Mage::getModel('magenotification/feedback')->load($id);
74
+ if(Mage::helper('magenotification/feedback')->needUpdate($model)){
75
+ Mage::helper('magenotification/feedback')->updateFeedback($model);
76
+ }
77
+
78
+ if ($model->getId() || $id == 0) {
79
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
80
+ if (!empty($data)) {
81
+ $model->setData($data);
82
+ }
83
+
84
+ Mage::register('feedback_data', $model);
85
+
86
+ $this->loadLayout();
87
+ $this->_setActiveMenu('system/magestore_extension');
88
+
89
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Feedbacks Manager'), Mage::helper('adminhtml')->__('Feedbacks Manager'));
90
+
91
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
92
+
93
+ $this->_addContent($this->getLayout()->createBlock('magenotification/adminhtml_feedback_edit'))
94
+ ->_addLeft($this->getLayout()->createBlock('magenotification/adminhtml_feedback_edit_tabs'));
95
+
96
+ $this->renderLayout();
97
+ } else {
98
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magenotification')->__('Item does not exist'));
99
+ $this->_redirect('*/*/');
100
+ }
101
+ }
102
+
103
+ public function newAction() {
104
+ $this->_forward('edit');
105
+ }
106
+
107
+ public function saveAction(){
108
+ if ($data = $this->getRequest()->getPost()) {
109
+ $model = Mage::getModel('magenotification/feedback');
110
+ $model->load($this->getRequest()->getParam('id'));
111
+ $model->addData($data);
112
+ $helper = Mage::helper('magenotification');
113
+ //upload files
114
+ $attachedfiles = array();
115
+ if(count($_FILES)){
116
+ $path = Mage::getBaseDir('media').DS.'feedback';
117
+ foreach($_FILES as $fileId=>$file){
118
+ if(!$file['name'])
119
+ continue;
120
+ $uploader = new Varien_File_Uploader($fileId);
121
+ $uploader->setAllowRenameFiles(false);
122
+ $uploader->setFilesDispersion(true);
123
+ $uploader->save($path,$file['name']);
124
+ $attachedfiles[] = $uploader->getDispretionPath($file['name']).DS.$file['name'];
125
+ }
126
+ }
127
+ if(count($attachedfiles)){
128
+ $attachedfiles = implode(',',$attachedfiles);
129
+ $attachedfiles = str_replace(DS,'/',$attachedfiles);
130
+ $data['file'] = $attachedfiles;
131
+ }
132
+ //save message
133
+ $message = Mage::getModel('magenotification/feedbackmessage');
134
+ if($model->getId() && isset($data['message']) && $data['message']){
135
+ $message->setData($data)
136
+ ->setFeedbackId($model->getId())
137
+ ->setFeedbackCode($model->getCode())
138
+ ->setPostedTime(now())
139
+ ->setIsCustomer(1)
140
+ ->setIsSent(2)
141
+ ->setUser(Mage::getSingleton('admin/session')->getUser()->getUsername())
142
+ ;
143
+ unset($data['file']);
144
+ }
145
+
146
+ $model->addData($data);
147
+ $model->setExtensionVersion($helper->getExtensionVersion($model->getExtension()));
148
+ if(!$model->getId()){
149
+ $code = strtoupper($helper->getDomain(Mage::getBaseUrl())).time();
150
+ $code = str_replace('WWW.','',$code);
151
+ $model->setCode($code);
152
+ }
153
+ if ($model->getCreated() == NULL || $model->getUpdated() == NULL) {
154
+ $model->setCreated(now());
155
+ }
156
+ // post feedback
157
+ if(!$model->getId() || ($model->getId() && $model->getMessage())){
158
+ try{
159
+ Mage::helper('magenotification/feedback')->postFeedback($model);
160
+ $model->setIsSent(1);
161
+ } catch (Exception $e) {
162
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
163
+ $model->setIsSent(2);
164
+ }
165
+ }
166
+ // post message
167
+ if($message->getData()){
168
+ try{
169
+ Mage::helper('magenotification/feedback')->postMessage($message);
170
+ $message->setIsSent(1);
171
+ } catch (Exception $e) {
172
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
173
+ $message->setIsSent(2);
174
+ }
175
+ }
176
+ try{
177
+ $model->save();
178
+ //save message
179
+ if($message->getData()){
180
+ $message->save();
181
+ }
182
+
183
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magenotification')->__('Item was successfully saved'));
184
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
185
+
186
+ if ($this->getRequest()->getParam('back')) {
187
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
188
+ return;
189
+ }
190
+ $this->_redirect('*/*/');
191
+ return;
192
+ } catch (Exception $e) {
193
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
194
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
195
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
196
+ return;
197
+ }
198
+ }
199
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magenotification')->__('Unable to find item to save'));
200
+ $this->_redirect('*/*/');
201
+ }
202
+
203
+ public function deleteAction() {
204
+ if( $this->getRequest()->getParam('id') > 0 ) {
205
+ try {
206
+ $model = Mage::getModel('magenotification/feedback');
207
+
208
+ $model->setId($this->getRequest()->getParam('id'))
209
+ ->delete();
210
+
211
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
212
+ $this->_redirect('*/*/');
213
+ } catch (Exception $e) {
214
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
215
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
216
+ }
217
+ }
218
+ $this->_redirect('*/*/');
219
+ }
220
+
221
+ public function massDeleteAction() {
222
+ $feedbackIds = $this->getRequest()->getParam('feedback');
223
+ if(!is_array($feedbackIds)) {
224
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
225
+ } else {
226
+ try {
227
+ foreach ($feedbackIds as $feedbackId) {
228
+ $feedback = Mage::getModel('magenotification/feedback')->load($feedbackId);
229
+ $feedback->delete();
230
+ }
231
+ Mage::getSingleton('adminhtml/session')->addSuccess(
232
+ Mage::helper('adminhtml')->__(
233
+ 'Total of %d record(s) were successfully deleted', count($feedbackIds)
234
+ )
235
+ );
236
+ } catch (Exception $e) {
237
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
238
+ }
239
+ }
240
+ $this->_redirect('*/*/index');
241
+ }
242
+
243
+ public function massStatusAction()
244
+ {
245
+ $feedbackIds = $this->getRequest()->getParam('feedback');
246
+ if(!is_array($feedbackIds)) {
247
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
248
+ } else {
249
+ try {
250
+ foreach ($feedbackIds as $feedbackId) {
251
+ $feedback = Mage::getSingleton('magenotification/feedback')
252
+ ->load($feedbackId)
253
+ ->setStatus($this->getRequest()->getParam('status'))
254
+ ->setIsMassupdate(true)
255
+ ->save();
256
+ }
257
+ $this->_getSession()->addSuccess(
258
+ $this->__('Total of %d record(s) were successfully updated', count($feedbackIds))
259
+ );
260
+ } catch (Exception $e) {
261
+ $this->_getSession()->addError($e->getMessage());
262
+ }
263
+ }
264
+ $this->_redirect('*/*/index');
265
+ }
266
+
267
+ public function exportCsvAction()
268
+ {
269
+ $fileName = 'feedbacks.csv';
270
+ $content = $this->getLayout()->createBlock('magenotification/adminhtml_feedback_grid')
271
+ ->getCsv();
272
+
273
+ $this->_sendUploadResponse($fileName, $content);
274
+ }
275
+
276
+ public function exportXmlAction()
277
+ {
278
+ $fileName = 'feedbacks.xml';
279
+ $content = $this->getLayout()->createBlock('magenotification/adminhtml_feedback_grid')
280
+ ->getXml();
281
+
282
+ $this->_sendUploadResponse($fileName, $content);
283
+ }
284
+
285
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
286
+ {
287
+ $response = $this->getResponse();
288
+ $response->setHeader('HTTP/1.1 200 OK','');
289
+ $response->setHeader('Pragma', 'public', true);
290
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
291
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
292
+ $response->setHeader('Last-Modified', date('r'));
293
+ $response->setHeader('Accept-Ranges', 'bytes');
294
+ $response->setHeader('Content-Length', strlen($content));
295
+ $response->setHeader('Content-type', $contentType);
296
+ $response->setBody($content);
297
+ $response->sendResponse();
298
+ die;
299
+ }
300
+ }
app/code/local/Magestore/Magenotification/controllers/Adminhtml/LicenseController.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Adminhtml_LicenseController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ public function upgradeAction()
6
+ {
7
+ $licensekey = $this->getRequest()->getParam('licensekey');
8
+ $licensetype = $this->getRequest()->getParam('licensetype');
9
+ $redirectUrl = Magestore_Magenotification_Model_Keygen::SERVER_URL.'licensemanager/license/upgrade/licensekey/'.$licensekey.'/licensetype/'.$licensetype;
10
+ $this->_redirectUrl($redirectUrl);
11
+ }
12
+
13
+ public function purchaseAction()
14
+ {
15
+ $extension = $this->getRequest()->getParam('extension');
16
+ $redirectUrl = Magestore_Magenotification_Model_Keygen::SERVER_URL.'licensemanager/license/purchase/extension/'.$extension;
17
+ $this->_redirectUrl($redirectUrl);
18
+ }
19
+
20
+ public function viewpriceAction()
21
+ {
22
+ $licensekey = $this->getRequest()->getParam('licensekey');
23
+ $licensetype = $this->getRequest()->getParam('licensetype');
24
+ $upgradePrice = Mage::helper('magenotification/license')->getUpgradePrice($licensekey,$licensetype);
25
+ $html = '<b>'.$upgradePrice.'</b>';
26
+ $html .= ' '.Mage::helper('magenotification')->__('for upgrade to');
27
+ $html .= ' '. Mage::getModel('magenotification/keygen')->getLicenseTitle($licensetype);
28
+ $html .= '<br/><br/><button style="" onclick="updateLicensePurchase(\''.$licensekey.'\')" class="scalable add" type="button" >
29
+ <span>'.Mage::helper('magenotification')->__('Upgrade Now').'</span></button>';
30
+ echo $html;
31
+ }
32
+ }
app/code/local/Magestore/Magenotification/controllers/Adminhtml/MagenotificationController.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Adminhtml_MagenotificationController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+
6
+ public function readdetailAction()
7
+ {
8
+ $id = $this->getRequest()->getParam('id');
9
+ $notice = Mage::getModel('adminnotification/inbox')->load($id);
10
+ $notice->setIsRead(1);
11
+ $notice->save();
12
+ return $this->_redirectUrl($notice->getUrl());
13
+ }
14
+
15
+ }
app/code/local/Magestore/Magenotification/etc/adminhtml.xml ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <system>
5
+ <children>
6
+ <magestore_extension translate="title">
7
+ <title>Magestore Extensions</title>
8
+ <sort_order>10</sort_order>
9
+ <children>
10
+ <extension_key translate="title">
11
+ <title>License Keys</title>
12
+ <sort_order>1</sort_order>
13
+ <action>adminhtml/system_config/edit/section/magenotificationsecure</action>
14
+ </extension_key>
15
+ <extension_feedback translate="title">
16
+ <title>Extension Feedbacks</title>
17
+ <sort_order>10</sort_order>
18
+ <action>magenotification/adminhtml_feedback/index/</action>
19
+ </extension_feedback>
20
+ </children>
21
+ </magestore_extension>
22
+ </children>
23
+ </system>
24
+ </menu>
25
+ <acl>
26
+ <resources>
27
+ <all>
28
+ <title>Allow Everything</title>
29
+ </all>
30
+ <admin>
31
+ <children>
32
+ <system>
33
+ <children>
34
+ <config>
35
+ <children>
36
+ <magenotificationsecure translate="title">
37
+ <title>Extension Key Management</title>
38
+ <sort_order>1</sort_order>
39
+ </magenotificationsecure>
40
+ <magestore_extension_feedback translate="title">
41
+ <title>License Keys</title>
42
+ <sort_order>2</sort_order>
43
+ </magestore_extension_feedback>
44
+ <magenotification translate="title">
45
+ <title>MageNotification</title>
46
+ <sort_order>50</sort_order>
47
+ </magenotification>
48
+ </children>
49
+ </config>
50
+ <magestore_extension translate="title">
51
+ <title>Magestore Extensions</title>
52
+ <sort_order>10</sort_order>
53
+ <children>
54
+ <extension_key translate="title">
55
+ <title>License Keys</title>
56
+ <sort_order>1</sort_order>
57
+ <action>adminhtml/system_config/edit/section/magenotificationsecure</action>
58
+ </extension_key>
59
+ <extension_feedback translate="title">
60
+ <title>Extension Feedbacks</title>
61
+ <sort_order>10</sort_order>
62
+ <action>adminhtml/system_config/edit/section/licensemanager</action>
63
+ </extension_feedback>
64
+ </children>
65
+ </magestore_extension>
66
+ </children>
67
+ </system>
68
+ </children>
69
+ </admin>
70
+ </resources>
71
+ </acl>
72
+ </config>
app/code/local/Magestore/Magenotification/etc/config.xml ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magestore_Magenotification>
5
+ <version>0.1.2</version>
6
+ </Magestore_Magenotification>
7
+ </modules>
8
+ <admin>
9
+ <routers>
10
+ <magenotification>
11
+ <use>admin</use>
12
+ <args>
13
+ <module>Magestore_Magenotification</module>
14
+ <frontName>magenotification</frontName>
15
+ </args>
16
+ </magenotification>
17
+ </routers>
18
+ </admin>
19
+ <adminhtml>
20
+ <events>
21
+ <controller_action_predispatch>
22
+ <observers>
23
+ <magestore_magenotification_observer>
24
+ <type>singleton</type>
25
+ <class>magenotification/observer</class>
26
+ <method>controllerActionPredispatch</method>
27
+ </magestore_magenotification_observer>
28
+ </observers>
29
+ </controller_action_predispatch>
30
+ </events>
31
+ <layout>
32
+ <updates>
33
+ <magenotification>
34
+ <file>magenotification.xml</file>
35
+ </magenotification>
36
+ </updates>
37
+ </layout>
38
+ </adminhtml>
39
+ <global>
40
+ <models>
41
+ <magenotification>
42
+ <class>Magestore_Magenotification_Model</class>
43
+ <resourceModel>magenotification_mysql4</resourceModel>
44
+ </magenotification>
45
+ <magenotification_mysql4>
46
+ <class>Magestore_Magenotification_Model_Mysql4</class>
47
+ <entities>
48
+ <magenotification>
49
+ <table>magenotification</table>
50
+ </magenotification>
51
+ <feedback>
52
+ <table>magenotification_extension_feedback</table>
53
+ </feedback>
54
+ <feedbackmessage>
55
+ <table>magenotification_extension_feedbackmessage</table>
56
+ </feedbackmessage>
57
+ <logger>
58
+ <table>magenotification_log</table>
59
+ </logger>
60
+ </entities>
61
+ </magenotification_mysql4>
62
+ </models>
63
+ <resources>
64
+ <magenotification_setup>
65
+ <setup>
66
+ <module>Magestore_Magenotification</module>
67
+ </setup>
68
+ <connection>
69
+ <use>core_setup</use>
70
+ </connection>
71
+ </magenotification_setup>
72
+ <magenotification_write>
73
+ <connection>
74
+ <use>core_write</use>
75
+ </connection>
76
+ </magenotification_write>
77
+ <magenotification_read>
78
+ <connection>
79
+ <use>core_read</use>
80
+ </connection>
81
+ </magenotification_read>
82
+ </resources>
83
+ <blocks>
84
+ <magenotification>
85
+ <class>Magestore_Magenotification_Block</class>
86
+ </magenotification>
87
+ </blocks>
88
+ <helpers>
89
+ <magenotification>
90
+ <class>Magestore_Magenotification_Helper</class>
91
+ </magenotification>
92
+ </helpers>
93
+ </global>
94
+ <default>
95
+ <magenotification>
96
+ <general>
97
+ <frequency>1</frequency>
98
+ <last_update backend_model="magenotification/source_time"></last_update>
99
+ <magestore_url>http://www.magestore.com/index.php</magestore_url>
100
+ </general>
101
+ </magenotification>
102
+ </default>
103
+ </config>
app/code/local/Magestore/Magenotification/etc/system.xml ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <magestore translate="label">
5
+ <label>Magestore Extension</label>
6
+ <sort_order>400</sort_order>
7
+ </magestore>
8
+ </tabs>
9
+ <sections>
10
+ <magenotificationsecure translate="label" module="magenotification">
11
+ <class>separator-top</class>
12
+ <label>License Key Management</label>
13
+ <tab>magestore</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>1</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <groups>
20
+ <extension_keys translate="label">
21
+ <label>Magestore Extension Key Management</label>
22
+ <frontend_type>text</frontend_type>
23
+ <frontend_model>magenotification/config_extensionkeys</frontend_model>
24
+ <sort_order>1</sort_order>
25
+ <show_in_default>1</show_in_default>
26
+ <show_in_website>1</show_in_website>
27
+ <show_in_store>1</show_in_store>
28
+ </extension_keys>
29
+ </groups>
30
+ </magenotificationsecure>
31
+ <magestore_extension_feedback translate="label" module="magenotification">
32
+ <class>separator-top</class>
33
+ <label>Extension Feedbacks</label>
34
+ <tab>magestore</tab>
35
+ <frontend_type>text</frontend_type>
36
+ <sort_order>10</sort_order>
37
+ <show_in_default>1</show_in_default>
38
+ <show_in_website>1</show_in_website>
39
+ <show_in_store>1</show_in_store>
40
+ <groups>
41
+ <email translate="label">
42
+ <label>Email Configuration</label>
43
+ <frontend_type>text</frontend_type>
44
+ <sort_order>1</sort_order>
45
+ <show_in_default>1</show_in_default>
46
+ <show_in_website>1</show_in_website>
47
+ <show_in_store>1</show_in_store>
48
+ <fields>
49
+ <contactname translate="label">
50
+ <label>Contact Name</label>
51
+ <frontend_type>text</frontend_type>
52
+ <sort_order>1</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ <comment>Default as general contact</comment>
57
+ </contactname>
58
+ <contactemail translate="label">
59
+ <label>Contact email</label>
60
+ <frontend_type>text</frontend_type>
61
+ <sort_order>10</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>1</show_in_store>
65
+ <comment>Default as general contact</comment>
66
+ </contactemail>
67
+ </fields>
68
+ </email>
69
+ </groups>
70
+ </magestore_extension_feedback>
71
+ <magenotification translate="label" module="magenotification">
72
+ <class>separator-top</class>
73
+ <label>MageNotification</label>
74
+ <tab>magestore</tab>
75
+ <frontend_type>text</frontend_type>
76
+ <sort_order>299</sort_order>
77
+ <show_in_default>1</show_in_default>
78
+ <show_in_website>1</show_in_website>
79
+ <show_in_store>1</show_in_store>
80
+ <groups>
81
+ <general translate="label">
82
+ <label>General Infomation</label>
83
+ <frontend_type>text</frontend_type>
84
+ <sort_order>1</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>1</show_in_store>
88
+ <fields>
89
+ <frequency translate="label">
90
+ <label>Update frequency</label>
91
+ <frontend_type>select</frontend_type>
92
+ <source_model>adminhtml/system_config_source_notification_frequency</source_model>
93
+ <sort_order>1</sort_order>
94
+ <show_in_default>1</show_in_default>
95
+ <show_in_website>1</show_in_website>
96
+ <show_in_store>1</show_in_store>
97
+ </frequency>
98
+ <last_update translate="label">
99
+ <label>Last update</label>
100
+ <frontend_type>label</frontend_type>
101
+ <backend_model>magenotification/source_time</backend_model>
102
+ <sort_order>2</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>0</show_in_website>
105
+ <show_in_store>0</show_in_store>
106
+ </last_update>
107
+ <magestore_url translate="label">
108
+ <label>Magestore Url</label>
109
+ <frontend_type>label</frontend_type>
110
+ <sort_order>3</sort_order>
111
+ <show_in_default>1</show_in_default>
112
+ <show_in_website>0</show_in_website>
113
+ <show_in_store>0</show_in_store>
114
+ </magestore_url>
115
+ </fields>
116
+ </general>
117
+ </groups>
118
+ </magenotification>
119
+ </sections>
120
+ </config>
app/code/local/Magestore/Magenotification/sql/magenotification_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ DROP TABLE IF EXISTS {$this->getTable('magenotification')};
10
+
11
+ CREATE TABLE {$this->getTable('magenotification')} (
12
+ `magenotification_id` int(11) unsigned NOT NULL auto_increment,
13
+ `notification_id` int(10) unsigned NOT NULL,
14
+ `url` varchar(255) NOT NULL default '',
15
+ `added_date` datetime NOT NULL,
16
+ UNIQUE (`notification_id`, `url`),
17
+ PRIMARY KEY (`magenotification_id`)
18
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
19
+
20
+ ");
21
+
22
+ $installer->endSetup();
app/code/local/Magestore/Magenotification/sql/magenotification_setup/mysql4-install-0.1.1.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+
10
+ DROP TABLE IF EXISTS {$this->getTable('magenotification_extension_feedbackmessage')};
11
+ DROP TABLE IF EXISTS {$this->getTable('magenotification_extension_feedback')};
12
+ DROP TABLE IF EXISTS {$this->getTable('magenotification')};
13
+
14
+ CREATE TABLE {$this->getTable('magenotification')} (
15
+ `magenotification_id` int(11) unsigned NOT NULL auto_increment,
16
+ `notification_id` int(10) unsigned NOT NULL,
17
+ `url` varchar(255) NOT NULL default '',
18
+ `added_date` datetime NOT NULL,
19
+ UNIQUE (`notification_id`, `url`),
20
+ PRIMARY KEY (`magenotification_id`)
21
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
22
+
23
+ CREATE TABLE {$this->getTable('magenotification_extension_feedback')} (
24
+ `feedback_id` int(11) unsigned NOT NULL auto_increment,
25
+ `code` varchar(255) NOT NULL default '',
26
+ `extension` varchar(255) NOT NULL default '',
27
+ `extension_version` varchar(50) NOT NULL default '',
28
+ `coupon_code` varchar(255) NOT NULL default '',
29
+ `coupon_value` varchar(50) NOT NULL default '',
30
+ `expired_counpon` datetime NOT NULL,
31
+ `content` text NOT NULL default '',
32
+ `file` text NOT NULL default '',
33
+ `comment` text NOT NULL default '',
34
+ `latest_message` text NOT NULL default '',
35
+ `latest_response` text NOT NULL default '',
36
+ `latest_response_time` datetime,
37
+ `status` tinyint(1) NOT NULL DEFAULT '3',
38
+ `is_sent` tinyint(1) NOT NULL DEFAULT '2',
39
+ `created` datetime NOT NULL,
40
+ `updated` datetime NOT NULL,
41
+ PRIMARY KEY (`feedback_id`)
42
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
43
+
44
+ CREATE TABLE {$this->getTable('magenotification_extension_feedbackmessage')} (
45
+ `feedbackmessage_id` int(11) unsigned NOT NULL auto_increment,
46
+ `feedback_id` int(11) unsigned NOT NULL,
47
+ `feedback_code` varchar(255) NOT NULL default '',
48
+ `user` varchar(255) NOT NULL default '',
49
+ `is_customer` tinyint(1) default '2',
50
+ `message` text NOT NULL default '',
51
+ `file` text NOT NULL default '',
52
+ `posted_time` datetime NULL,
53
+ `is_sent` tinyint(1) default '2',
54
+ PRIMARY KEY (`feedbackmessage_id`)
55
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
56
+
57
+ ");
58
+
59
+ $installer->endSetup();
app/code/local/Magestore/Magenotification/sql/magenotification_setup/mysql4-install-0.1.2.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+
10
+ DROP TABLE IF EXISTS {$this->getTable('magenotification_extension_feedbackmessage')};
11
+ DROP TABLE IF EXISTS {$this->getTable('magenotification_extension_feedback')};
12
+ DROP TABLE IF EXISTS {$this->getTable('magenotification_log')};
13
+ DROP TABLE IF EXISTS {$this->getTable('magenotification')};
14
+
15
+ CREATE TABLE {$this->getTable('magenotification')} (
16
+ `magenotification_id` int(11) unsigned NOT NULL auto_increment,
17
+ `notification_id` int(10) unsigned NOT NULL,
18
+ `url` varchar(255) NOT NULL default '',
19
+ `added_date` datetime NOT NULL,
20
+ UNIQUE (`notification_id`, `url`),
21
+ PRIMARY KEY (`magenotification_id`)
22
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
23
+
24
+ CREATE TABLE {$this->getTable('magenotification_log')} (
25
+ `log_id` int(11) unsigned NOT NULL auto_increment,
26
+ `extension_code` varchar(100) NOT NULL default '',
27
+ `license_type` varchar(50) NOT NULL default '',
28
+ `license_key` text NOT NULL default '',
29
+ `check_date` date NOT NULL,
30
+ `sum_code` varchar(255),
31
+ `response_code` smallint(5),
32
+ `expired_time` varchar(255),
33
+ `is_valid` tinyint(1),
34
+ PRIMARY KEY (`log_id`)
35
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
36
+
37
+ CREATE TABLE {$this->getTable('magenotification_extension_feedback')} (
38
+ `feedback_id` int(11) unsigned NOT NULL auto_increment,
39
+ `code` varchar(255) NOT NULL default '',
40
+ `extension` varchar(255) NOT NULL default '',
41
+ `extension_version` varchar(50) NOT NULL default '',
42
+ `coupon_code` varchar(255) NOT NULL default '',
43
+ `coupon_value` varchar(50) NOT NULL default '',
44
+ `expired_counpon` datetime NOT NULL,
45
+ `content` text NOT NULL default '',
46
+ `file` text NOT NULL default '',
47
+ `comment` text NOT NULL default '',
48
+ `latest_message` text NOT NULL default '',
49
+ `latest_response` text NOT NULL default '',
50
+ `latest_response_time` datetime,
51
+ `status` tinyint(1) NOT NULL DEFAULT '3',
52
+ `is_sent` tinyint(1) NOT NULL DEFAULT '2',
53
+ `created` datetime NOT NULL,
54
+ `updated` datetime NOT NULL,
55
+ PRIMARY KEY (`feedback_id`)
56
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
57
+
58
+ CREATE TABLE {$this->getTable('magenotification_extension_feedbackmessage')} (
59
+ `feedbackmessage_id` int(11) unsigned NOT NULL auto_increment,
60
+ `feedback_id` int(11) unsigned NOT NULL,
61
+ `feedback_code` varchar(255) NOT NULL default '',
62
+ `user` varchar(255) NOT NULL default '',
63
+ `is_customer` tinyint(1) default '2',
64
+ `message` text NOT NULL default '',
65
+ `file` text NOT NULL default '',
66
+ `posted_time` datetime NULL,
67
+ `is_sent` tinyint(1) default '2',
68
+ PRIMARY KEY (`feedbackmessage_id`)
69
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
70
+
71
+ ");
72
+
73
+ $installer->endSetup();
app/code/local/Magestore/Magenotification/sql/magenotification_setup/mysql4-upgrade-0.1.0-0.1.1.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ DROP TABLE IF EXISTS {$this->getTable('magenotification_extension_feedbackmessage')};
10
+ DROP TABLE IF EXISTS {$this->getTable('magenotification_extension_feedback')};
11
+ DROP TABLE IF EXISTS {$this->getTable('magenotification')};
12
+
13
+ CREATE TABLE {$this->getTable('magenotification')} (
14
+ `magenotification_id` int(11) unsigned NOT NULL auto_increment,
15
+ `notification_id` int(10) unsigned NOT NULL,
16
+ `url` varchar(255) NOT NULL default '',
17
+ `added_date` datetime NOT NULL,
18
+ UNIQUE (`notification_id`, `url`),
19
+ PRIMARY KEY (`magenotification_id`)
20
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
21
+
22
+
23
+ CREATE TABLE {$this->getTable('magenotification_extension_feedback')} (
24
+ `feedback_id` int(11) unsigned NOT NULL auto_increment,
25
+ `code` varchar(255) NOT NULL default '',
26
+ `extension` varchar(255) NOT NULL default '',
27
+ `extension_version` varchar(50) NOT NULL default '',
28
+ `coupon_code` varchar(255) NOT NULL default '',
29
+ `coupon_value` varchar(50) NOT NULL default '',
30
+ `expired_counpon` datetime NOT NULL,
31
+ `content` text NOT NULL default '',
32
+ `file` text NOT NULL default '',
33
+ `comment` text NOT NULL default '',
34
+ `latest_message` text NOT NULL default '',
35
+ `latest_response` text NOT NULL default '',
36
+ `latest_response_time` datetime,
37
+ `status` tinyint(1) NOT NULL DEFAULT '3',
38
+ `is_sent` tinyint(1) NOT NULL DEFAULT '2',
39
+ `created` datetime NOT NULL,
40
+ `updated` datetime NOT NULL,
41
+ PRIMARY KEY (`feedback_id`)
42
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
43
+
44
+ CREATE TABLE {$this->getTable('magenotification_extension_feedbackmessage')} (
45
+ `feedbackmessage_id` int(11) unsigned NOT NULL auto_increment,
46
+ `feedback_id` int(11) unsigned NOT NULL,
47
+ `feedback_code` varchar(255) NOT NULL default '',
48
+ `user` varchar(255) NOT NULL default '',
49
+ `is_customer` tinyint(1) default '2',
50
+ `message` text NOT NULL default '',
51
+ `file` text NOT NULL default '',
52
+ `posted_time` datetime NULL,
53
+ `is_sent` tinyint(1) default '2',
54
+ PRIMARY KEY (`feedbackmessage_id`)
55
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
56
+
57
+ ");
58
+
59
+ $installer->endSetup();
app/code/local/Magestore/Magenotification/sql/magenotification_setup/mysql4-upgrade-0.1.0-0.1.2.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ DROP TABLE IF EXISTS {$this->getTable('magenotification_extension_feedbackmessage')};
10
+ DROP TABLE IF EXISTS {$this->getTable('magenotification_extension_feedback')};
11
+ DROP TABLE IF EXISTS {$this->getTable('magenotification_log')};
12
+
13
+
14
+ CREATE TABLE {$this->getTable('magenotification_log')} (
15
+ `log_id` int(11) unsigned NOT NULL auto_increment,
16
+ `extension_code` varchar(100) NOT NULL default '',
17
+ `license_type` varchar(50) NOT NULL default '',
18
+ `license_key` text NOT NULL default '',
19
+ `check_date` date NOT NULL,
20
+ `sum_code` varchar(255),
21
+ `response_code` smallint(5),
22
+ `expired_time` varchar(255),
23
+ `is_valid` tinyint(1),
24
+ PRIMARY KEY (`log_id`)
25
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
26
+
27
+
28
+ CREATE TABLE {$this->getTable('magenotification_extension_feedback')} (
29
+ `feedback_id` int(11) unsigned NOT NULL auto_increment,
30
+ `code` varchar(255) NOT NULL default '',
31
+ `extension` varchar(255) NOT NULL default '',
32
+ `extension_version` varchar(50) NOT NULL default '',
33
+ `coupon_code` varchar(255) NOT NULL default '',
34
+ `coupon_value` varchar(50) NOT NULL default '',
35
+ `expired_counpon` datetime NOT NULL,
36
+ `content` text NOT NULL default '',
37
+ `file` text NOT NULL default '',
38
+ `comment` text NOT NULL default '',
39
+ `latest_message` text NOT NULL default '',
40
+ `latest_response` text NOT NULL default '',
41
+ `latest_response_time` datetime,
42
+ `status` tinyint(1) NOT NULL DEFAULT '3',
43
+ `is_sent` tinyint(1) NOT NULL DEFAULT '2',
44
+ `created` datetime NOT NULL,
45
+ `updated` datetime NOT NULL,
46
+ PRIMARY KEY (`feedback_id`)
47
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
48
+
49
+ CREATE TABLE {$this->getTable('magenotification_extension_feedbackmessage')} (
50
+ `feedbackmessage_id` int(11) unsigned NOT NULL auto_increment,
51
+ `feedback_id` int(11) unsigned NOT NULL,
52
+ `feedback_code` varchar(255) NOT NULL default '',
53
+ `user` varchar(255) NOT NULL default '',
54
+ `is_customer` tinyint(1) default '2',
55
+ `message` text NOT NULL default '',
56
+ `file` text NOT NULL default '',
57
+ `posted_time` datetime NULL,
58
+ `is_sent` tinyint(1) default '2',
59
+ PRIMARY KEY (`feedbackmessage_id`)
60
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
61
+
62
+ ");
63
+
64
+ $installer->endSetup();
app/code/local/Magestore/Magenotification/sql/magenotification_setup/mysql4-upgrade-0.1.1-0.1.2.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ DROP TABLE IF EXISTS {$this->getTable('magenotification_log')};
10
+
11
+ CREATE TABLE {$this->getTable('magenotification_log')} (
12
+ `log_id` int(11) unsigned NOT NULL auto_increment,
13
+ `extension_code` varchar(100) NOT NULL default '',
14
+ `license_type` varchar(50) NOT NULL default '',
15
+ `license_key` text NOT NULL default '',
16
+ `check_date` date NOT NULL,
17
+ `sum_code` varchar(255),
18
+ `response_code` smallint(5),
19
+ `expired_time` varchar(255),
20
+ `is_valid` tinyint(1),
21
+ PRIMARY KEY (`log_id`)
22
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
23
+
24
+ ");
25
+
26
+ $installer->endSetup();
app/code/local/Magestore/Productcontact/Block/Adminhtml/Productcontact.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Productcontact_Block_Adminhtml_Productcontact extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_productcontact';
7
+ $this->_blockGroup = 'productcontact';
8
+ $this->_headerText = Mage::helper('productcontact')->__('Manager Product Contact');
9
+ $this->_addButtonLabel = Mage::helper('productcontact')->__('Add Contact');
10
+ parent::__construct();
11
+ $this->_removeButton('add');
12
+ }
13
+ }
app/code/local/Magestore/Productcontact/Block/Adminhtml/Productcontact/Edit.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Productcontact_Block_Adminhtml_Productcontact_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'productcontact';
11
+ $this->_controller = 'adminhtml_productcontact';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('productcontact')->__('Save Item'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('productcontact')->__('Delete Item'));
15
+
16
+ $this->_addButton('saveandcontinue', array(
17
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
18
+ 'onclick' => 'saveAndContinueEdit()',
19
+ 'class' => 'save',
20
+ ), -100);
21
+
22
+ $this->_formScripts[] = "
23
+ function toggleEditor() {
24
+ if (tinyMCE.getInstanceById('productcontact_content') == null) {
25
+ tinyMCE.execCommand('mceAddControl', false, 'productcontact_content');
26
+ } else {
27
+ tinyMCE.execCommand('mceRemoveControl', false, 'productcontact_content');
28
+ }
29
+ }
30
+
31
+ function saveAndContinueEdit(){
32
+ editForm.submit($('edit_form').action+'back/edit/');
33
+ }
34
+ ";
35
+ }
36
+
37
+ public function getHeaderText()
38
+ {
39
+ if( Mage::registry('productcontact_data') && Mage::registry('productcontact_data')->getId() ) {
40
+ return Mage::helper('productcontact')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('productcontact_data')->getTitle()));
41
+ } else {
42
+ return Mage::helper('productcontact')->__('Add Item');
43
+ }
44
+ }
45
+ }
app/code/local/Magestore/Productcontact/Block/Adminhtml/Productcontact/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Productcontact_Block_Adminhtml_Productcontact_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/local/Magestore/Productcontact/Block/Adminhtml/Productcontact/Edit/Tab/Form.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Productcontact_Block_Adminhtml_Productcontact_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('productcontact_form', array('legend'=>Mage::helper('productcontact')->__('Item information')));
10
+
11
+ $fieldset->addField('title', 'text', array(
12
+ 'label' => Mage::helper('productcontact')->__('Title'),
13
+ 'class' => 'required-entry',
14
+ 'required' => true,
15
+ 'name' => 'title',
16
+ ));
17
+
18
+ $fieldset->addField('filename', 'file', array(
19
+ 'label' => Mage::helper('productcontact')->__('File'),
20
+ 'required' => false,
21
+ 'name' => 'filename',
22
+ ));
23
+
24
+ $fieldset->addField('status', 'select', array(
25
+ 'label' => Mage::helper('productcontact')->__('Status'),
26
+ 'name' => 'status',
27
+ 'values' => array(
28
+ array(
29
+ 'value' => 1,
30
+ 'label' => Mage::helper('productcontact')->__('Enabled'),
31
+ ),
32
+
33
+ array(
34
+ 'value' => 2,
35
+ 'label' => Mage::helper('productcontact')->__('Disabled'),
36
+ ),
37
+ ),
38
+ ));
39
+
40
+ $fieldset->addField('content', 'editor', array(
41
+ 'name' => 'content',
42
+ 'label' => Mage::helper('productcontact')->__('Content'),
43
+ 'title' => Mage::helper('productcontact')->__('Content'),
44
+ 'style' => 'width:700px; height:500px;',
45
+ 'wysiwyg' => false,
46
+ 'required' => true,
47
+ ));
48
+
49
+ if ( Mage::getSingleton('adminhtml/session')->getProductcontactData() )
50
+ {
51
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getProductcontactData());
52
+ Mage::getSingleton('adminhtml/session')->setProductcontactData(null);
53
+ } elseif ( Mage::registry('productcontact_data') ) {
54
+ $form->setValues(Mage::registry('productcontact_data')->getData());
55
+ }
56
+ return parent::_prepareForm();
57
+ }
58
+ }
app/code/local/Magestore/Productcontact/Block/Adminhtml/Productcontact/Edit/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Productcontact_Block_Adminhtml_Productcontact_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('productcontact_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('productcontact')->__('Item Information'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('productcontact')->__('Item Information'),
18
+ 'title' => Mage::helper('productcontact')->__('Item Information'),
19
+ 'content' => $this->getLayout()->createBlock('productcontact/adminhtml_productcontact_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/local/Magestore/Productcontact/Block/Adminhtml/Productcontact/Grid.php ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Productcontact_Block_Adminhtml_Productcontact_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('productcontactGrid');
9
+ $this->setDefaultSort('productcontact_id');
10
+ $this->setDefaultDir('DESC');
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareCollection()
15
+ {
16
+
17
+ $store_id = $this->getRequest()->getParam('store', 0);
18
+ $collection = Mage::getModel('productcontact/productcontact')->getCollection()
19
+ ->addFieldToFilter('status', '1')
20
+ ->addFieldToFilter('store_id', array('neq'=>0))
21
+ ;
22
+
23
+ $this->setCollection($collection);
24
+ return parent::_prepareCollection();
25
+ }
26
+
27
+ protected function _prepareColumns()
28
+ {
29
+ $this->addColumn('productcontact_id', array(
30
+ 'header' => Mage::helper('productcontact')->__('ID'),
31
+ 'align' =>'right',
32
+ 'width' => '50px',
33
+ 'index' => 'productcontact_id',
34
+ ));
35
+
36
+ $this->addColumn('product_name', array(
37
+ 'header' => Mage::helper('productcontact')->__('Product name'),
38
+ 'align' =>'left',
39
+ 'index' => 'product_name',
40
+ 'renderer' => 'productcontact/adminhtml_productcontact_renderer_productname',
41
+ ));
42
+
43
+ $this->addColumn('customer_email', array(
44
+ 'header' => Mage::helper('productcontact')->__('Customer email'),
45
+ 'align' =>'left',
46
+ 'index' => 'customer_email',
47
+ 'renderer' => 'productcontact/adminhtml_productcontact_renderer_customeremail',
48
+ ));
49
+
50
+ $this->addColumn('country_id', array(
51
+ 'header' => Mage::helper('productcontact')->__('Country'),
52
+ 'align' =>'left',
53
+ 'index' => 'country_id',
54
+ 'type' => 'options',
55
+ 'options' => Mage::helper('productcontact')->getCountryOption(),
56
+ ));
57
+
58
+ $this->addColumn('store_id', array(
59
+ 'header' => Mage::helper('productcontact')->__('Store'),
60
+ 'align' =>'left',
61
+ 'index' => 'store_id',
62
+ // 'type' => 'options',
63
+ // 'options' => Mage::getModel('core/store')->getCollection()->toOptionHash(),
64
+ 'type' => 'store',
65
+ 'store_view'=> true,
66
+
67
+ ));
68
+
69
+
70
+
71
+ $this->addColumn('created_time', array(
72
+ 'header' => Mage::helper('productcontact')->__('Contact Times'),
73
+ 'align' =>'left',
74
+ 'index' => 'created_time',
75
+ 'type' => 'date',
76
+ ));
77
+
78
+ /*
79
+ $this->addColumn('content', array(
80
+ 'header' => Mage::helper('productcontact')->__('Item Content'),
81
+ 'width' => '150px',
82
+ 'index' => 'content',
83
+ ));
84
+ */
85
+
86
+ $this->addColumn('status', array(
87
+ 'header' => Mage::helper('productcontact')->__('Status'),
88
+ 'align' => 'left',
89
+ 'width' => '80px',
90
+ 'index' => 'status',
91
+ 'type' => 'options',
92
+ 'options' => array(
93
+ 1 => 'Enabled',
94
+ 2 => 'Disabled',
95
+ ),
96
+ ));
97
+
98
+ $this->addColumn('action',
99
+ array(
100
+ 'header' => Mage::helper('productcontact')->__('Action'),
101
+ 'width' => '100',
102
+ 'type' => 'action',
103
+ 'getter' => 'getId',
104
+ 'actions' => array(
105
+ array(
106
+ 'caption' => Mage::helper('productcontact')->__('View'),
107
+ 'url' => array('base'=> '*/*/view'),
108
+ 'field' => 'id'
109
+ )
110
+ ),
111
+ 'filter' => false,
112
+ 'sortable' => false,
113
+ 'index' => 'stores',
114
+ 'is_system' => true,
115
+ ));
116
+
117
+ $this->addExportType('*/*/exportCsv', Mage::helper('productcontact')->__('CSV'));
118
+ $this->addExportType('*/*/exportXml', Mage::helper('productcontact')->__('XML'));
119
+
120
+ return parent::_prepareColumns();
121
+ }
122
+
123
+ protected function _prepareMassaction()
124
+ {
125
+ $this->setMassactionIdField('productcontact_id');
126
+ $this->getMassactionBlock()->setFormFieldName('productcontact');
127
+
128
+ $this->getMassactionBlock()->addItem('delete', array(
129
+ 'label' => Mage::helper('productcontact')->__('Delete'),
130
+ 'url' => $this->getUrl('*/*/massDelete'),
131
+ 'confirm' => Mage::helper('productcontact')->__('Are you sure?')
132
+ ));
133
+
134
+ $statuses = Mage::getSingleton('productcontact/status')->getOptionArray();
135
+
136
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
137
+ $this->getMassactionBlock()->addItem('status', array(
138
+ 'label'=> Mage::helper('productcontact')->__('Change status'),
139
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
140
+ 'additional' => array(
141
+ 'visibility' => array(
142
+ 'name' => 'status',
143
+ 'type' => 'select',
144
+ 'class' => 'required-entry',
145
+ 'label' => Mage::helper('productcontact')->__('Status'),
146
+ 'values' => $statuses
147
+ )
148
+ )
149
+ ));
150
+ return $this;
151
+ }
152
+
153
+ public function getRowUrl($row)
154
+ {
155
+ return $this->getUrl('*/*/view', array('id' => $row->getId()));
156
+ }
157
+
158
+ }
app/code/local/Magestore/Productcontact/Block/Adminhtml/Productcontact/Renderer/Customeremail.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Productcontact_Block_Adminhtml_Productcontact_Renderer_Customeremail extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
3
+ public function render(Varien_Object $row)
4
+ {
5
+ $customer_email = $row->getCustomerEmail();
6
+ $customer = Mage::getModel('customer/customer')->getCollection()->addFieldToFilter('email',$customer_email)->getFirstItem();
7
+ // var_dump($customer->getId());die();
8
+ if($customer->getId()) {
9
+ return sprintf('<a href="%s">%s</a>',
10
+ $this->getUrl('adminhtml/customer/edit', array('_current'=>true, 'id'=>$customer->getId())),
11
+ $customer_email
12
+ );
13
+ } else {
14
+ return sprintf('%s',
15
+ $customer_email
16
+ );
17
+ }
18
+ }
19
+ }
app/code/local/Magestore/Productcontact/Block/Adminhtml/Productcontact/Renderer/Productname.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Productcontact_Block_Adminhtml_Productcontact_Renderer_Productname extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
3
+ public function render(Varien_Object $row)
4
+ {
5
+
6
+ return sprintf('<a href="%s">%s</a>',
7
+ $this->getUrl('adminhtml/catalog_product/edit', array('_current'=>true, 'id'=>$row->getProductId())),
8
+ $row->getProductName()
9
+ );
10
+ }
11
+ }
app/code/local/Magestore/Productcontact/Block/Adminhtml/Productcontact/View.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Productcontact_Block_Adminhtml_Productcontact_View extends Mage_Adminhtml_Block_Template
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::_construct();
8
+ $this->setTemplate('productcontact/view.phtml');
9
+ return $this;
10
+ }
11
+
12
+ public function getProductContact() {
13
+ $id = $this->getRequest()->getParam('id');
14
+
15
+ $store_id = $this->getRequest()->getParam('store', 0);
16
+
17
+ $collection = Mage::getModel('productcontact/productcontact')
18
+ ->load($id)
19
+ ;
20
+
21
+ return $collection;
22
+ }
23
+ }
app/code/local/Magestore/Productcontact/Block/Productcontact.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Productcontact_Block_Productcontact extends Mage_Directory_Block_Data
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ return parent::_prepareLayout();
7
+ }
8
+
9
+ public function getProductcontact()
10
+ {
11
+ if (!$this->hasData('productcontact')) {
12
+ $this->setData('productcontact', Mage::registry('productcontact'));
13
+ }
14
+ return $this->getData('productcontact');
15
+
16
+ }
17
+
18
+ public function getCustomer() {
19
+ return Mage::getSingleton('customer/session')->getCustomer();
20
+ }
21
+
22
+ public function getTemplate()
23
+ {
24
+ if(!Mage::helper('magenotification')->checkLicenseKey('Productcontact')){
25
+ return null;
26
+ }
27
+ return parent::getTemplate();
28
+ }
29
+
30
+ }
app/code/local/Magestore/Productcontact/Block/Sendtoadmin.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Productcontact_Block_Sendtoadmin extends Mage_Core_Block_Template
3
+ {
4
+
5
+
6
+ }
app/code/local/Magestore/Productcontact/Block/Sendtocustomer.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Productcontact_Block_Sendtocustomer extends Mage_Core_Block_Template
3
+ {
4
+
5
+
6
+ }
app/code/local/Magestore/Productcontact/Helper/Data.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Productcontact_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ public function getCountryOption() {
6
+ $countryCollection = Mage::getModel('directory/country')->getCollection()
7
+ ;
8
+ $countryOption = array();
9
+ if(count($countryCollection)) {
10
+ foreach($countryCollection as $country) {
11
+ $countryOption[$country->getId()] = $country->getName();
12
+ }
13
+ }
14
+ return $countryOption;
15
+ }
16
+
17
+ public function isActive() {
18
+ return Mage::getStoreConfig('productcontact/general/is_active', $this->getStore()->getId());
19
+ }
20
+
21
+ public function isShowCompanyName() {
22
+ return Mage::getStoreConfig('productcontact/contact_form/is_show_company_name', $this->getStore()->getId());
23
+ }
24
+
25
+ public function isShowPersonalName() {
26
+ return Mage::getStoreConfig('productcontact/contact_form/is_show_personal_name', $this->getStore()->getId());
27
+ }
28
+
29
+ public function isShowAddress() {
30
+ return Mage::getStoreConfig('productcontact/contact_form/is_show_address', $this->getStore()->getId());
31
+ }
32
+
33
+ public function isShowZipcode() {
34
+ return Mage::getStoreConfig('productcontact/contact_form/is_show_zipcode', $this->getStore()->getId());
35
+ }
36
+
37
+ public function isShowCity() {
38
+ return Mage::getStoreConfig('productcontact/contact_form/is_show_city', $this->getStore()->getId());
39
+ }
40
+
41
+ public function isShowCountry() {
42
+ return Mage::getStoreConfig('productcontact/contact_form/is_show_country', $this->getStore()->getId());
43
+ }
44
+
45
+ public function isShowPhone() {
46
+ return Mage::getStoreConfig('productcontact/contact_form/is_show_phone', $this->getStore()->getId());
47
+ }
48
+
49
+ public function isShowFax() {
50
+ return Mage::getStoreConfig('productcontact/contact_form/is_show_fax', $this->getStore()->getId());
51
+ }
52
+
53
+ public function isShowEmail() {
54
+ return Mage::getStoreConfig('productcontact/contact_form/is_show_email', $this->getStore()->getId());
55
+ }
56
+
57
+ public function isShowWebsite() {
58
+ return Mage::getStoreConfig('productcontact/contact_form/is_show_website', $this->getStore()->getId());
59
+ }
60
+
61
+ public function isShowDetail() {
62
+ return Mage::getStoreConfig('productcontact/contact_form/is_show_detail', $this->getStore()->getId());
63
+ }
64
+
65
+ public function isRequireCompanyName() {
66
+ return Mage::getStoreConfig('productcontact/contact_form/is_require_company_name', $this->getStore()->getId());
67
+ }
68
+
69
+ public function isRequirePersonalName() {
70
+ return Mage::getStoreConfig('productcontact/contact_form/is_require_personal_name', $this->getStore()->getId());
71
+ }
72
+
73
+ public function isRequireAddress() {
74
+ return Mage::getStoreConfig('productcontact/contact_form/is_require_address', $this->getStore()->getId());
75
+ }
76
+
77
+ public function isRequireZipcode() {
78
+ return Mage::getStoreConfig('productcontact/contact_form/is_require_zipcode', $this->getStore()->getId());
79
+ }
80
+
81
+ public function isRequireCity() {
82
+ return Mage::getStoreConfig('productcontact/contact_form/is_require_city', $this->getStore()->getId());
83
+ }
84
+
85
+ public function isRequireCountry() {
86
+ return Mage::getStoreConfig('productcontact/contact_form/is_require_country', $this->getStore()->getId());
87
+ }
88
+
89
+ public function isRequirePhone() {
90
+ return Mage::getStoreConfig('productcontact/contact_form/is_require_phone', $this->getStore()->getId());
91
+ }
92
+
93
+ public function isRequireFax() {
94
+ return Mage::getStoreConfig('productcontact/contact_form/is_require_fax', $this->getStore()->getId());
95
+ }
96
+
97
+ public function isRequireEmail() {
98
+ return Mage::getStoreConfig('productcontact/contact_form/is_require_email', $this->getStore()->getId());
99
+ }
100
+
101
+ public function isRequireWebsite() {
102
+ return Mage::getStoreConfig('productcontact/contact_form/is_require_website', $this->getStore()->getId());
103
+ }
104
+
105
+ public function isRequireDetail() {
106
+ return Mage::getStoreConfig('productcontact/contact_form/is_require_detail', $this->getStore()->getId());
107
+ }
108
+
109
+
110
+ public function getErrorMessage() {
111
+ return Mage::getStoreConfig('productcontact/contact_form/message_error', $this->getStore()->getId());
112
+ }
113
+
114
+ public function getSuccessMessage() {
115
+ return Mage::getStoreConfig('productcontact/contact_form/message_success', $this->getStore()->getId());
116
+ }
117
+
118
+
119
+ public function getStore() {
120
+ return Mage::app()->getStore();
121
+ }
122
+
123
+ public function getAdminRecipientEmail(){
124
+ $recipientEmails = array();
125
+ $emailstring = Mage::getStoreConfig('productcontact/email_config/email_receive_contact_form', $this->getStore()->getId());
126
+ // var_dump($recipientEmails);die();
127
+ $recipientEmails = explode(",", $emailstring);
128
+ return $recipientEmails;
129
+ }
130
+ }
app/code/local/Magestore/Productcontact/Model/Mysql4/Productcontact.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Productcontact_Model_Mysql4_Productcontact extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the productcontact_id refers to the key field in your database table.
8
+ $this->_init('productcontact/productcontact', 'productcontact_id');
9
+ }
10
+ }
app/code/local/Magestore/Productcontact/Model/Mysql4/Productcontact/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Productcontact_Model_Mysql4_Productcontact_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('productcontact/productcontact');
9
+ }
10
+ }
app/code/local/Magestore/Productcontact/Model/Productcontact.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Productcontact_Model_Productcontact extends Mage_Core_Model_Abstract
4
+ {
5
+ const XML_PATH_EMAIL_IDENTITY = "productcontact/email_config/email_sender";
6
+ const XML_PATH_GENERAL_EMAIL_IDENTITY = "trans_email/ident_general";
7
+ const XML_PATH_ADMIN_EMAIL_IDENTITY = "productcontact/email_config/email_receive_contact_form";
8
+ const XML_PATH_SEND_TO_CUSTOMER_EMAIL = "productcontact/email_config/email_template_sent_to_customer";
9
+ const XML_PATH_SEND_TO_ADMIN_EMAIL = "productcontact/email_config/email_template_sent_to_admin";
10
+
11
+
12
+ public function _construct()
13
+ {
14
+ parent::_construct();
15
+ $this->_init('productcontact/productcontact');
16
+ }
17
+
18
+ public function sendmailtocustomer($model, $productcontact) {
19
+ $store = Mage::app()->getStore();
20
+
21
+ $translate = Mage::getSingleton('core/translate');
22
+ /* @var $translate Mage_Core_Model_Translate */
23
+ $translate->setTranslateInline(false);
24
+ $template = Mage::getStoreConfig(self::XML_PATH_SEND_TO_CUSTOMER_EMAIL,$store->getId());
25
+ $mailTemplate = Mage::getModel('core/email_template');
26
+
27
+
28
+
29
+ $this->setCustomerEmail($model->getCustomerEmail())
30
+ ->setCustomerName($model->getPersonalName())
31
+ ->setProductId($model->getProductId())
32
+ ->setProductName($model->getProductName())
33
+ ->setCreatedTime(Mage::helper('core')->formatDate($model->getCreatedTime(), 'medium', true))
34
+ ->setCustomerInformation($productcontact)
35
+ ;
36
+
37
+ $sendTo = array(
38
+ array(
39
+ 'email' => $model->getCustomerEmail(),
40
+ 'name' => $model->getCustomerName()
41
+ )
42
+ );
43
+
44
+ foreach ($sendTo as $recipient) {
45
+ $mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$store->getId()))
46
+ ->sendTransactional(
47
+ $template,
48
+ Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $store->getId()),
49
+ $recipient['email'],
50
+ $recipient['name'],
51
+ array(
52
+ 'productcontact' => $this,
53
+ 'store' => $store,
54
+ )
55
+ );
56
+ }
57
+
58
+ // var_dump($mailTemplate->getProcessedTemplate(array(
59
+ // 'productcontact' => $this,
60
+ // 'store' => $store,
61
+ // )));die('xafd');
62
+
63
+ $translate->setTranslateInline(true);
64
+
65
+ return $this;
66
+ }
67
+
68
+ public function sendmailtoadmin($model, $productcontact) {
69
+ $store = Mage::app()->getStore();
70
+
71
+ $translate = Mage::getSingleton('core/translate');
72
+ /* @var $translate Mage_Core_Model_Translate */
73
+ $translate->setTranslateInline(false);
74
+ $template = Mage::getStoreConfig(self::XML_PATH_SEND_TO_ADMIN_EMAIL,$store->getId());
75
+ $mailTemplate = Mage::getModel('core/email_template');
76
+
77
+ $productcontactUrl = Mage::getUrl('productcontact/adminhtml_productcontact/view', array('_current'=>true, 'id'=>$model->getId()));
78
+
79
+ $this->setCustomerEmail($model->getCustomerEmail())
80
+ ->setCustomerName($model->getPersonalName())
81
+ ->setProductId($model->getProductId())
82
+ ->setProductName($model->getProductName())
83
+ ->setCreatedTime(Mage::helper('core')->formatDate($model->getCreatedTime(), 'medium', true))
84
+ ->setProductcontactUrl($productcontactUrl)
85
+ ->setCustomerInformation($productcontact)
86
+ ;
87
+ $adminRecipients = Mage::helper('productcontact')->getAdminRecipientEmail();
88
+ if(count($adminRecipients)) {
89
+ foreach($adminRecipients as $adminRecipient) {
90
+ $sendTo[] = array('email'=>$adminRecipient,
91
+ 'name'=>null
92
+ );
93
+ }
94
+ } else {
95
+ $recipient = Mage::getStoreConfig(self::XML_PATH_GENERAL_EMAIL_IDENTITY, $store->getId());
96
+ $sendTo = array(
97
+ array(
98
+ 'email' => $recipient['email'],
99
+ 'name' => $recipient['name']
100
+ )
101
+ );
102
+ }
103
+
104
+ // var_dump($sendTo);die();
105
+
106
+ foreach ($sendTo as $recipient) {
107
+ $mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$store->getId()))
108
+ ->sendTransactional(
109
+ $template,
110
+ Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $store->getId()),
111
+ $recipient['email'],
112
+ $recipient['name'],
113
+ array(
114
+ 'productcontact' => $this,
115
+ 'store' => $store,
116
+ )
117
+ );
118
+ // var_dump($mailTemplate->getProcessedTemplate(array(
119
+ // 'productcontact' => $this,
120
+ // 'store' => $store,
121
+ // )));die('xafd');
122
+ }
123
+
124
+
125
+
126
+ $translate->setTranslateInline(true);
127
+
128
+ return $this;
129
+ }
130
+ }
app/code/local/Magestore/Productcontact/Model/Status.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Productcontact_Model_Status extends Varien_Object
4
+ {
5
+ const STATUS_ENABLED = 1;
6
+ const STATUS_DISABLED = 2;
7
+
8
+ static public function getOptionArray()
9
+ {
10
+ return array(
11
+ self::STATUS_ENABLED => Mage::helper('productcontact')->__('Enabled'),
12
+ self::STATUS_DISABLED => Mage::helper('productcontact')->__('Disabled')
13
+ );
14
+ }
15
+ }
app/code/local/Magestore/Productcontact/controllers/Adminhtml/ProductcontactController.php ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Productcontact_Adminhtml_ProductcontactController extends Mage_Adminhtml_Controller_action
4
+ {
5
+
6
+ protected function _initAction() {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('productcontact/items')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
10
+
11
+ return $this;
12
+ }
13
+
14
+ public function indexAction() {
15
+ if(!Mage::helper('magenotification')->checkLicenseKeyAdminController($this)){return;}
16
+ $this->_initAction()
17
+ ->renderLayout();
18
+ }
19
+
20
+ public function editAction() {
21
+ if(!Mage::helper('magenotification')->checkLicenseKeyAdminController($this)){return;}
22
+ $id = $this->getRequest()->getParam('id');
23
+ $model = Mage::getModel('productcontact/productcontact')->load($id);
24
+
25
+ if ($model->getId() || $id == 0) {
26
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
27
+ if (!empty($data)) {
28
+ $model->setData($data);
29
+ }
30
+
31
+ Mage::register('productcontact_data', $model);
32
+
33
+ $this->loadLayout();
34
+ $this->_setActiveMenu('productcontact/items');
35
+
36
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
37
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
38
+
39
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
40
+
41
+ $this->_addContent($this->getLayout()->createBlock('productcontact/adminhtml_productcontact_edit'))
42
+ ->_addLeft($this->getLayout()->createBlock('productcontact/adminhtml_productcontact_edit_tabs'));
43
+
44
+ $this->renderLayout();
45
+ } else {
46
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('productcontact')->__('Item does not exist'));
47
+ $this->_redirect('*/*/');
48
+ }
49
+ }
50
+
51
+ public function viewAction() {
52
+ $this->loadLayout();
53
+ $this->renderLayout();
54
+ }
55
+
56
+ public function newAction() {
57
+ $this->_forward('edit');
58
+ }
59
+
60
+ public function saveAction() {
61
+ if ($data = $this->getRequest()->getPost()) {
62
+
63
+ if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
64
+ try {
65
+ /* Starting upload */
66
+ $uploader = new Varien_File_Uploader('filename');
67
+
68
+ // Any extention would work
69
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
70
+ $uploader->setAllowRenameFiles(false);
71
+
72
+ // Set the file upload mode
73
+ // false -> get the file directly in the specified folder
74
+ // true -> get the file in the product like folders
75
+ // (file.jpg will go in something like /media/f/i/file.jpg)
76
+ $uploader->setFilesDispersion(false);
77
+
78
+ // We set media as the upload dir
79
+ $path = Mage::getBaseDir('media') . DS ;
80
+ $uploader->save($path, $_FILES['filename']['name'] );
81
+
82
+ } catch (Exception $e) {
83
+
84
+ }
85
+
86
+ //this way the name is saved in DB
87
+ $data['filename'] = $_FILES['filename']['name'];
88
+ }
89
+
90
+
91
+ $model = Mage::getModel('productcontact/productcontact');
92
+ $model->setData($data)
93
+ ->setId($this->getRequest()->getParam('id'));
94
+
95
+ try {
96
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
97
+ $model->setCreatedTime(now())
98
+ ->setUpdateTime(now());
99
+ } else {
100
+ $model->setUpdateTime(now());
101
+ }
102
+
103
+ $model->save();
104
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('productcontact')->__('Item was successfully saved'));
105
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
106
+
107
+ if ($this->getRequest()->getParam('back')) {
108
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
109
+ return;
110
+ }
111
+ $this->_redirect('*/*/');
112
+ return;
113
+ } catch (Exception $e) {
114
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
115
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
116
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
117
+ return;
118
+ }
119
+ }
120
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('productcontact')->__('Unable to find item to save'));
121
+ $this->_redirect('*/*/');
122
+ }
123
+
124
+ public function deleteAction() {
125
+ if( $this->getRequest()->getParam('id') > 0 ) {
126
+ try {
127
+ $model = Mage::getModel('productcontact/productcontact');
128
+
129
+ $model->setId($this->getRequest()->getParam('id'))
130
+ ->delete();
131
+
132
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
133
+ $this->_redirect('*/*/');
134
+ } catch (Exception $e) {
135
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
136
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
137
+ }
138
+ }
139
+ $this->_redirect('*/*/');
140
+ }
141
+
142
+ public function massDeleteAction() {
143
+ $productcontactIds = $this->getRequest()->getParam('productcontact');
144
+ if(!is_array($productcontactIds)) {
145
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
146
+ } else {
147
+ try {
148
+ foreach ($productcontactIds as $productcontactId) {
149
+ $productcontact = Mage::getModel('productcontact/productcontact')->load($productcontactId);
150
+ $productcontact->delete();
151
+ }
152
+ Mage::getSingleton('adminhtml/session')->addSuccess(
153
+ Mage::helper('adminhtml')->__(
154
+ 'Total of %d record(s) were successfully deleted', count($productcontactIds)
155
+ )
156
+ );
157
+ } catch (Exception $e) {
158
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
159
+ }
160
+ }
161
+ $this->_redirect('*/*/index');
162
+ }
163
+
164
+ public function massStatusAction()
165
+ {
166
+ $productcontactIds = $this->getRequest()->getParam('productcontact');
167
+ if(!is_array($productcontactIds)) {
168
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
169
+ } else {
170
+ try {
171
+ foreach ($productcontactIds as $productcontactId) {
172
+ $productcontact = Mage::getSingleton('productcontact/productcontact')
173
+ ->load($productcontactId)
174
+ ->setStatus($this->getRequest()->getParam('status'))
175
+ ->setIsMassupdate(true)
176
+ ->save();
177
+ }
178
+ $this->_getSession()->addSuccess(
179
+ $this->__('Total of %d record(s) were successfully updated', count($productcontactIds))
180
+ );
181
+ } catch (Exception $e) {
182
+ $this->_getSession()->addError($e->getMessage());
183
+ }
184
+ }
185
+ $this->_redirect('*/*/index');
186
+ }
187
+
188
+ public function exportCsvAction()
189
+ {
190
+ $fileName = 'productcontact.csv';
191
+ $content = $this->getLayout()->createBlock('productcontact/adminhtml_productcontact_grid')
192
+ ->getCsv();
193
+
194
+ $this->_sendUploadResponse($fileName, $content);
195
+ }
196
+
197
+ public function exportXmlAction()
198
+ {
199
+ $fileName = 'productcontact.xml';
200
+ $content = $this->getLayout()->createBlock('productcontact/adminhtml_productcontact_grid')
201
+ ->getXml();
202
+
203
+ $this->_sendUploadResponse($fileName, $content);
204
+ }
205
+
206
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
207
+ {
208
+ $response = $this->getResponse();
209
+ $response->setHeader('HTTP/1.1 200 OK','');
210
+ $response->setHeader('Pragma', 'public', true);
211
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
212
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
213
+ $response->setHeader('Last-Modified', date('r'));
214
+ $response->setHeader('Accept-Ranges', 'bytes');
215
+ $response->setHeader('Content-Length', strlen($content));
216
+ $response->setHeader('Content-type', $contentType);
217
+ $response->setBody($content);
218
+ $response->sendResponse();
219
+ die;
220
+ }
221
+ }
app/code/local/Magestore/Productcontact/controllers/IndexController.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Productcontact_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ // $productId = $this->getRequest()->getParam('id');
7
+ // $customer = Mage::getSingleton('customer/session')->getCustomer();
8
+
9
+ // var_dump(Mage::helper('productcontact')->getAdminRecipientEmail());die('daf');
10
+ // $this->_initLayoutMessages('customer/session');
11
+ $this->_initLayoutMessages('catalog/session');
12
+ $this->loadLayout();
13
+ $this->renderLayout();
14
+ }
15
+
16
+
17
+ public function imagecaptchaAction() {
18
+ require_once(Mage::getBaseDir('lib') . DS .'captcha'. DS .'class.simplecaptcha.php');
19
+ $config['BackgroundImage'] = Mage::getBaseDir('lib') . DS .'captcha'. DS . "white.png";
20
+ $config['BackgroundColor'] = "FF0000";
21
+ $config['Height']=30;
22
+ $config['Width']=100;
23
+ $config['Font_Size']=23;
24
+ $config['Font']= Mage::getBaseDir('lib') . DS .'captcha'. DS . "ARLRDBD.TTF";
25
+ $config['TextMinimumAngle']=0;
26
+ $config['TextMaximumAngle']=0;
27
+ $config['TextColor']='000000';
28
+ $config['TextLength']=4;
29
+ $config['Transparency']=80;
30
+ $captcha = new SimpleCaptcha($config);
31
+ $_SESSION['captcha_code'] = $captcha->Code;
32
+ }
33
+
34
+
35
+ public function refreshcaptchaAction() {
36
+ $result = Mage::getModel('core/url')->getUrl('*/*/imageCaptcha/') . now();//rand(5,20);
37
+ echo $result;
38
+ }
39
+
40
+
41
+ protected function isValidCaptcha($data) {
42
+
43
+ if(!isset($_SESSION['captcha_code'])) {
44
+ return false;
45
+ }
46
+
47
+ $captchaCode = trim($_SESSION['captcha_code']);
48
+ $captchaText = trim($data['captcha_text']);
49
+ if(strtolower($captchaText) != strtolower($captchaCode)) {
50
+ return false;
51
+ }
52
+ return true;
53
+
54
+
55
+ }
56
+
57
+ public function submitAction() {
58
+ $data = $this->getRequest()->getPost();
59
+ $error = false;
60
+ if($data) {
61
+ $product = Mage::getModel('catalog/product')->load($data['product_id']);
62
+ try {
63
+ if(!$this->isValidCaptcha($data)) {
64
+ throw new Exception();
65
+ } else {
66
+
67
+ $storeIds[] = 0;
68
+ $stores = Mage::app()->getStores();
69
+ foreach($stores as $store) {
70
+ $storeIds[] = $store->getId();
71
+ }
72
+
73
+
74
+ $model = Mage::getModel('productcontact/productcontact');
75
+ // $data['store_id'] = Mage::app()->getStore()->getId();
76
+ $data['status'] = 1;
77
+ $data['created_time'] = now();
78
+ $data['updated_time'] = now();
79
+ $data['product_name'] = $product->getName();
80
+
81
+ $productcontact = $this->getLayout()->createBlock('productcontact/sendtocustomer')
82
+ ->setInformation($data)
83
+ ->setTemplate('productcontact/email/sendtocustomer.phtml')
84
+ ->toHtml();
85
+
86
+ $customercontact = $this->getLayout()->createBlock('productcontact/sendtoadmin')
87
+ ->setInformation($data)
88
+ ->setTemplate('productcontact/email/sendtoadmin.phtml')
89
+ ->toHtml();
90
+
91
+ foreach($storeIds as $storeId) {
92
+ $data['store_id'] = $storeId;
93
+ $model->setData($data);
94
+ $model->save();
95
+ }
96
+
97
+ $model->save()
98
+ ->sendMailToCustomer($model, $productcontact)
99
+ ->sendMailToAdmin($model, $customercontact)
100
+ ;
101
+ Mage::getSingleton('catalog/session')->addSuccess(Mage::helper('productcontact')->getSuccessMessage());
102
+ $this->_redirectUrl($product->getProductUrl());
103
+ return;
104
+ }
105
+ } catch (Exception $e) {
106
+ Mage::getSingleton('catalog/session')->addError(Mage::helper('productcontact')->getErrorMessage());
107
+ $this->_redirectUrl($product->getProductUrl());
108
+ return;
109
+ }
110
+ }
111
+ // $html = "";
112
+ // if(!$error) {
113
+
114
+ // $html = 'Your contact for product has been sent. We will notify you as soon as. Thank you!';
115
+
116
+ // } else {
117
+
118
+ // $error = 'Your contact for product has not been sent. Please try again.';
119
+
120
+ // }
121
+ // $this->loadLayout();
122
+ // $this->_initLayoutMessages('customer/session');
123
+
124
+ // $results = array();
125
+ // $results['error'] = $error;
126
+ // $results['html'] = $html;
127
+ // $this->getResponse()->setBody(Zend_Json::encode($results));
128
+
129
+ }
130
+ }
app/code/local/Magestore/Productcontact/etc/adminhtml.xml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <productcontact module="productcontact">
5
+ <title>Product Contact</title>
6
+ <sort_order>71</sort_order>
7
+ <children>
8
+ <items module="productcontact">
9
+ <title>Manage contacts</title>
10
+ <sort_order>0</sort_order>
11
+ <action>productcontact/adminhtml_productcontact</action>
12
+ </items>
13
+ <settings module="productcontact">
14
+ <title>Settings</title>
15
+ <sort_order>5</sort_order>
16
+ <action>adminhtml/system_config/edit/section/productcontact</action>
17
+ </settings>
18
+ </children>
19
+ </productcontact>
20
+ </menu>
21
+ <acl>
22
+ <resources>
23
+ <all>
24
+ <title>Allow Everything</title>
25
+ </all>
26
+ <admin>
27
+ <children>
28
+ <system>
29
+ <children>
30
+ <config>
31
+ <children>
32
+ <productcontact translate="title">
33
+ <title>Productcontact</title>
34
+ <sort_order>50</sort_order>
35
+ </productcontact>
36
+ </children>
37
+ </config>
38
+ </children>
39
+ </system>
40
+ <productcontact module="productcontact">
41
+ <title>Productcontact Module</title>
42
+ <sort_order>10</sort_order>
43
+ <children>
44
+ <items module="productcontact">
45
+ <title>Product contact</title>
46
+ <sort_order>0</sort_order>
47
+ <action>productcontact/adminhtml_productcontact</action>
48
+ </items>
49
+ </children>
50
+ </productcontact>
51
+ </children>
52
+ </admin>
53
+ </resources>
54
+ </acl>
55
+ </config>
app/code/local/Magestore/Productcontact/etc/config.xml ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magestore_Productcontact>
5
+ <version>0.1.0</version>
6
+ </Magestore_Productcontact>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <productcontact>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Magestore_Productcontact</module>
14
+ <frontName>productcontact</frontName>
15
+ </args>
16
+ </productcontact>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <productcontact>
21
+ <file>productcontact.xml</file>
22
+ </productcontact>
23
+ </updates>
24
+ </layout>
25
+ <translate>
26
+ <modules>
27
+ <Magestore_Productcontact>
28
+ <files>
29
+ <default>Magestore_Productcontact.csv</default>
30
+ </files>
31
+ </Magestore_Productcontact>
32
+ </modules>
33
+ </translate>
34
+ </frontend>
35
+ <admin>
36
+ <routers>
37
+ <productcontact>
38
+ <use>admin</use>
39
+ <args>
40
+ <module>Magestore_Productcontact</module>
41
+ <frontName>productcontact</frontName>
42
+ </args>
43
+ </productcontact>
44
+ </routers>
45
+ </admin>
46
+ <adminhtml>
47
+ <layout>
48
+ <updates>
49
+ <productcontact>
50
+ <file>productcontact.xml</file>
51
+ </productcontact>
52
+ </updates>
53
+ </layout>
54
+ </adminhtml>
55
+ <global>
56
+ <models>
57
+ <productcontact>
58
+ <class>Magestore_Productcontact_Model</class>
59
+ <resourceModel>productcontact_mysql4</resourceModel>
60
+ </productcontact>
61
+ <productcontact_mysql4>
62
+ <class>Magestore_Productcontact_Model_Mysql4</class>
63
+ <entities>
64
+ <productcontact>
65
+ <table>productcontact</table>
66
+ </productcontact>
67
+ </entities>
68
+ </productcontact_mysql4>
69
+ </models>
70
+ <resources>
71
+ <productcontact_setup>
72
+ <setup>
73
+ <module>Magestore_Productcontact</module>
74
+ </setup>
75
+ <connection>
76
+ <use>core_setup</use>
77
+ </connection>
78
+ </productcontact_setup>
79
+ <productcontact_write>
80
+ <connection>
81
+ <use>core_write</use>
82
+ </connection>
83
+ </productcontact_write>
84
+ <productcontact_read>
85
+ <connection>
86
+ <use>core_read</use>
87
+ </connection>
88
+ </productcontact_read>
89
+ </resources>
90
+ <blocks>
91
+ <productcontact>
92
+ <class>Magestore_Productcontact_Block</class>
93
+ </productcontact>
94
+ </blocks>
95
+ <helpers>
96
+ <productcontact>
97
+ <class>Magestore_Productcontact_Helper</class>
98
+ </productcontact>
99
+ </helpers>
100
+ <template>
101
+ <email>
102
+ <productcontact_email_config_email_template_sent_to_customer translate="label" module="productcontact">
103
+ <label>Email template sent to customer</label>
104
+ <file>productcontact/email-to-customer.html</file>
105
+ <type>html</type>
106
+ </productcontact_email_config_email_template_sent_to_customer>
107
+ <productcontact_email_config_email_template_sent_to_admin translate="label" module="productcontact">
108
+ <label>Email template sent to admin</label>
109
+ <file>productcontact/email-to-admin.html</file>
110
+ <type>html</type>
111
+ </productcontact_email_config_email_template_sent_to_admin>
112
+ </email>
113
+ </template>
114
+ </global>
115
+
116
+ <default>
117
+ <productcontact>
118
+ <general>
119
+ <is_active>1</is_active>
120
+ </general>
121
+ <contact_form>
122
+ <is_show_company_name>1</is_show_company_name>
123
+ <is_show_personal_name>1</is_show_personal_name>
124
+ <is_show_address>1</is_show_address>
125
+ <is_show_zipcode>1</is_show_zipcode>
126
+ <is_show_city>1</is_show_city>
127
+ <is_show_country>1</is_show_country>
128
+ <is_show_phone>1</is_show_phone>
129
+ <is_show_fax>1</is_show_fax>
130
+ <is_show_email>1</is_show_email>
131
+ <is_show_website>1</is_show_website>
132
+ <is_show_detail>1</is_show_detail>
133
+ <is_require_personal_name>1</is_require_personal_name>
134
+ <is_require_country>1</is_require_country>
135
+ <is_require_email>1</is_require_email>
136
+ <is_require_detail>1</is_require_detail>
137
+ <message_success><![CDATA[Thanks for your contact. We will response you as soon as possible.]]></message_success>
138
+ <message_error><![CDATA[Your contact for product can't sent. Please try again]]></message_error>
139
+ </contact_form>
140
+ <email_config>
141
+ <email_sender></email_sender>
142
+ <email_receive_contact_form><![CDATA[hello@example.com]]></email_receive_contact_form>
143
+ <email_template_sent_to_customer>productcontact_email_config_email_template_sent_to_customer</email_template_sent_to_customer>
144
+ <email_template_sent_to_admin>productcontact_email_config_email_template_sent_to_admin</email_template_sent_to_admin>
145
+ </email_config>
146
+ </productcontact>
147
+ </default>
148
+ </config>
app/code/local/Magestore/Productcontact/etc/system.xml ADDED
@@ -0,0 +1,341 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <magestore translate="label">
5
+ <label>Magestore Extension</label>
6
+ <sort_order>400</sort_order>
7
+ </magestore>
8
+ </tabs>
9
+ <sections>
10
+ <productcontact translate="label" module="productcontact">
11
+ <class>separator-top</class>
12
+ <label>Product contact</label>
13
+ <tab>magestore</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>300</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <groups>
20
+ <general translate="label">
21
+ <label>General configuration</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>1</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>0</show_in_store>
27
+ <fields>
28
+ <is_active translate="label">
29
+ <label>Active</label>
30
+ <frontend_type>select</frontend_type>
31
+ <source_model>adminhtml/system_config_source_yesno</source_model>
32
+ <sort_order>5</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ <comment></comment>
37
+ </is_active>
38
+ </fields>
39
+ </general>
40
+ <contact_form>
41
+ <label>Contact form configuration</label>
42
+ <frontend_type>text</frontend_type>
43
+ <sort_order>1</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>0</show_in_store>
47
+ <fields>
48
+ <is_show_company_name translate="label">
49
+ <label>Show Company Name field</label>
50
+ <frontend_type>select</frontend_type>
51
+ <source_model>adminhtml/system_config_source_yesno</source_model>
52
+ <sort_order>5</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ <comment></comment>
57
+ </is_show_company_name>
58
+ <is_show_personal_name translate="label">
59
+ <label>Show Personal Name field</label>
60
+ <frontend_type>select</frontend_type>
61
+ <source_model>adminhtml/system_config_source_yesno</source_model>
62
+ <sort_order>10</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ <comment></comment>
67
+ </is_show_personal_name>
68
+ <is_show_address translate="label">
69
+ <label>Show Address field</label>
70
+ <frontend_type>select</frontend_type>
71
+ <source_model>adminhtml/system_config_source_yesno</source_model>
72
+ <sort_order>15</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ <comment></comment>
77
+ </is_show_address>
78
+ <is_show_zipcode translate="label">
79
+ <label>Show Zipcode field</label>
80
+ <frontend_type>select</frontend_type>
81
+ <source_model>adminhtml/system_config_source_yesno</source_model>
82
+ <sort_order>20</sort_order>
83
+ <show_in_default>1</show_in_default>
84
+ <show_in_website>1</show_in_website>
85
+ <show_in_store>1</show_in_store>
86
+ <comment></comment>
87
+ </is_show_zipcode>
88
+ <is_show_city translate="label">
89
+ <label>Show City field</label>
90
+ <frontend_type>select</frontend_type>
91
+ <source_model>adminhtml/system_config_source_yesno</source_model>
92
+ <sort_order>25</sort_order>
93
+ <show_in_default>1</show_in_default>
94
+ <show_in_website>1</show_in_website>
95
+ <show_in_store>1</show_in_store>
96
+ <comment></comment>
97
+ </is_show_city>
98
+ <is_show_country translate="label">
99
+ <label>Show Country field</label>
100
+ <frontend_type>select</frontend_type>
101
+ <source_model>adminhtml/system_config_source_yesno</source_model>
102
+ <sort_order>30</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>1</show_in_website>
105
+ <show_in_store>1</show_in_store>
106
+ <comment></comment>
107
+ </is_show_country>
108
+ <is_show_phone translate="label">
109
+ <label>Show Phone field</label>
110
+ <frontend_type>select</frontend_type>
111
+ <source_model>adminhtml/system_config_source_yesno</source_model>
112
+ <sort_order>35</sort_order>
113
+ <show_in_default>1</show_in_default>
114
+ <show_in_website>1</show_in_website>
115
+ <show_in_store>1</show_in_store>
116
+ <comment></comment>
117
+ </is_show_phone>
118
+ <is_show_fax translate="label">
119
+ <label>Show Fax field</label>
120
+ <frontend_type>select</frontend_type>
121
+ <source_model>adminhtml/system_config_source_yesno</source_model>
122
+ <sort_order>40</sort_order>
123
+ <show_in_default>1</show_in_default>
124
+ <show_in_website>1</show_in_website>
125
+ <show_in_store>1</show_in_store>
126
+ <comment></comment>
127
+ </is_show_fax>
128
+ <is_show_email translate="label">
129
+ <label>Show Email field</label>
130
+ <frontend_type>select</frontend_type>
131
+ <source_model>adminhtml/system_config_source_yesno</source_model>
132
+ <sort_order>45</sort_order>
133
+ <show_in_default>1</show_in_default>
134
+ <show_in_website>1</show_in_website>
135
+ <show_in_store>1</show_in_store>
136
+ <comment></comment>
137
+ </is_show_email>
138
+ <is_show_website translate="label">
139
+ <label>Show Website field</label>
140
+ <frontend_type>select</frontend_type>
141
+ <source_model>adminhtml/system_config_source_yesno</source_model>
142
+ <sort_order>50</sort_order>
143
+ <show_in_default>1</show_in_default>
144
+ <show_in_website>1</show_in_website>
145
+ <show_in_store>1</show_in_store>
146
+ <comment></comment>
147
+ </is_show_website>
148
+ <is_show_detail translate="label">
149
+ <label>Show Detail field</label>
150
+ <frontend_type>select</frontend_type>
151
+ <source_model>adminhtml/system_config_source_yesno</source_model>
152
+ <sort_order>55</sort_order>
153
+ <show_in_default>1</show_in_default>
154
+ <show_in_website>1</show_in_website>
155
+ <show_in_store>1</show_in_store>
156
+ <comment></comment>
157
+ </is_show_detail>
158
+
159
+ <is_require_company_name translate="label">
160
+ <label>Company Name Require</label>
161
+ <frontend_type>select</frontend_type>
162
+ <source_model>adminhtml/system_config_source_yesno</source_model>
163
+ <sort_order>60</sort_order>
164
+ <show_in_default>1</show_in_default>
165
+ <show_in_website>1</show_in_website>
166
+ <show_in_store>1</show_in_store>
167
+ <comment></comment>
168
+ </is_require_company_name>
169
+ <is_require_personal_name translate="label">
170
+ <label>Personal Name Require</label>
171
+ <frontend_type>select</frontend_type>
172
+ <source_model>adminhtml/system_config_source_yesno</source_model>
173
+ <sort_order>65</sort_order>
174
+ <show_in_default>1</show_in_default>
175
+ <show_in_website>1</show_in_website>
176
+ <show_in_store>1</show_in_store>
177
+ <comment></comment>
178
+ </is_require_personal_name>
179
+ <is_require_address translate="label">
180
+ <label>Address Require</label>
181
+ <frontend_type>select</frontend_type>
182
+ <source_model>adminhtml/system_config_source_yesno</source_model>
183
+ <sort_order>70</sort_order>
184
+ <show_in_default>1</show_in_default>
185
+ <show_in_website>1</show_in_website>
186
+ <show_in_store>1</show_in_store>
187
+ <comment></comment>
188
+ </is_require_address>
189
+ <is_require_zipcode translate="label">
190
+ <label>Zipcode Require</label>
191
+ <frontend_type>select</frontend_type>
192
+ <source_model>adminhtml/system_config_source_yesno</source_model>
193
+ <sort_order>75</sort_order>
194
+ <show_in_default>1</show_in_default>
195
+ <show_in_website>1</show_in_website>
196
+ <show_in_store>1</show_in_store>
197
+ <comment></comment>
198
+ </is_require_zipcode>
199
+ <is_require_city translate="label">
200
+ <label>City Require</label>
201
+ <frontend_type>select</frontend_type>
202
+ <source_model>adminhtml/system_config_source_yesno</source_model>
203
+ <sort_order>80</sort_order>
204
+ <show_in_default>1</show_in_default>
205
+ <show_in_website>1</show_in_website>
206
+ <show_in_store>1</show_in_store>
207
+ <comment></comment>
208
+ </is_require_city>
209
+ <is_require_country translate="label">
210
+ <label>Country Require</label>
211
+ <frontend_type>select</frontend_type>
212
+ <source_model>adminhtml/system_config_source_yesno</source_model>
213
+ <sort_order>85</sort_order>
214
+ <show_in_default>1</show_in_default>
215
+ <show_in_website>1</show_in_website>
216
+ <show_in_store>1</show_in_store>
217
+ <comment></comment>
218
+ </is_require_country>
219
+ <is_require_phone translate="label">
220
+ <label>Phone Require</label>
221
+ <frontend_type>select</frontend_type>
222
+ <source_model>adminhtml/system_config_source_yesno</source_model>
223
+ <sort_order>90</sort_order>
224
+ <show_in_default>1</show_in_default>
225
+ <show_in_website>1</show_in_website>
226
+ <show_in_store>1</show_in_store>
227
+ <comment></comment>
228
+ </is_require_phone>
229
+ <is_require_fax translate="label">
230
+ <label>Fax Require</label>
231
+ <frontend_type>select</frontend_type>
232
+ <source_model>adminhtml/system_config_source_yesno</source_model>
233
+ <sort_order>95</sort_order>
234
+ <show_in_default>1</show_in_default>
235
+ <show_in_website>1</show_in_website>
236
+ <show_in_store>1</show_in_store>
237
+ <comment></comment>
238
+ </is_require_fax>
239
+ <is_require_email translate="label">
240
+ <label>Email Require</label>
241
+ <frontend_type>select</frontend_type>
242
+ <source_model>adminhtml/system_config_source_yesno</source_model>
243
+ <sort_order>100</sort_order>
244
+ <show_in_default>1</show_in_default>
245
+ <show_in_website>1</show_in_website>
246
+ <show_in_store>1</show_in_store>
247
+ <comment></comment>
248
+ </is_require_email>
249
+ <is_require_website translate="label">
250
+ <label>Website Require</label>
251
+ <frontend_type>select</frontend_type>
252
+ <source_model>adminhtml/system_config_source_yesno</source_model>
253
+ <sort_order>105</sort_order>
254
+ <show_in_default>1</show_in_default>
255
+ <show_in_website>1</show_in_website>
256
+ <show_in_store>1</show_in_store>
257
+ <comment></comment>
258
+ </is_require_website>
259
+ <is_require_detail translate="label">
260
+ <label>Detail Require</label>
261
+ <frontend_type>select</frontend_type>
262
+ <source_model>adminhtml/system_config_source_yesno</source_model>
263
+ <sort_order>110</sort_order>
264
+ <show_in_default>1</show_in_default>
265
+ <show_in_website>1</show_in_website>
266
+ <show_in_store>1</show_in_store>
267
+ <comment></comment>
268
+ </is_require_detail>
269
+ <message_success translate="label comment">
270
+ <label>Message success</label>
271
+ <frontend_type>textarea</frontend_type>
272
+ <sort_order>115</sort_order>
273
+ <show_in_default>1</show_in_default>
274
+ <show_in_website>1</show_in_website>
275
+ <show_in_store>1</show_in_store>
276
+ <comment><![CDATA[Notify when contact is submit success]]></comment>
277
+ </message_success>
278
+ <message_error translate="label comment">
279
+ <label>Message Error</label>
280
+ <frontend_type>textarea</frontend_type>
281
+ <sort_order>120</sort_order>
282
+ <show_in_default>1</show_in_default>
283
+ <show_in_website>1</show_in_website>
284
+ <show_in_store>1</show_in_store>
285
+ <comment><![CDATA[Notify when contact is submit error]]></comment>
286
+ </message_error>
287
+ </fields>
288
+ </contact_form>
289
+ <email_config translate="label">
290
+ <label>email configuration</label>
291
+ <frontend_type>text</frontend_type>
292
+ <sort_order>10</sort_order>
293
+ <show_in_default>1</show_in_default>
294
+ <show_in_website>1</show_in_website>
295
+ <show_in_store>0</show_in_store>
296
+ <fields>
297
+ <email_sender>
298
+ <label>Email Sender</label>
299
+ <frontend_type>select</frontend_type>
300
+ <source_model>adminhtml/system_config_source_email_identity</source_model>
301
+ <sort_order>5</sort_order>
302
+ <show_in_default>1</show_in_default>
303
+ <show_in_website>1</show_in_website>
304
+ <show_in_store>1</show_in_store>
305
+ </email_sender>
306
+
307
+ <email_receive_contact_form translate="label">
308
+ <label>Recipient Email</label>
309
+ <frontend_type>textarea</frontend_type>
310
+ <sort_order>10</sort_order>
311
+ <show_in_default>1</show_in_default>
312
+ <show_in_website>1</show_in_website>
313
+ <show_in_store>1</show_in_store>
314
+ <comment><![CDATA[different emails separated by comma (,)]]></comment>
315
+ </email_receive_contact_form>
316
+
317
+ <email_template_sent_to_customer>
318
+ <label>Email template sent to customer </label>
319
+ <frontend_type>select</frontend_type>
320
+ <source_model>adminhtml/system_config_source_email_template</source_model>
321
+ <sort_order>20</sort_order>
322
+ <show_in_default>1</show_in_default>
323
+ <show_in_website>1</show_in_website>
324
+ <show_in_store>1</show_in_store>
325
+ </email_template_sent_to_customer>
326
+
327
+ <email_template_sent_to_admin>
328
+ <label>Email template sent to admin </label>
329
+ <frontend_type>select</frontend_type>
330
+ <source_model>adminhtml/system_config_source_email_template</source_model>
331
+ <sort_order>30</sort_order>
332
+ <show_in_default>1</show_in_default>
333
+ <show_in_website>1</show_in_website>
334
+ <show_in_store>1</show_in_store>
335
+ </email_template_sent_to_admin>
336
+ </fields>
337
+ </email_config>
338
+ </groups>
339
+ </productcontact>
340
+ </sections>
341
+ </config>
app/code/local/Magestore/Productcontact/sql/productcontact_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ -- DROP TABLE IF EXISTS {$this->getTable('productcontact')};
10
+ CREATE TABLE {$this->getTable('productcontact')} (
11
+ `productcontact_id` int(11) unsigned NOT NULL auto_increment,
12
+ `product_id` int(11) unsigned NOT NULL,
13
+ `product_name` varchar(255) NOT NULL default '',
14
+ `company_name` varchar(255) NOT NULL default '',
15
+ `personal_name` varchar(255) NOT NULL default '',
16
+ `address` varchar(255) NOT NULL default '',
17
+ `zipcode` varchar(255) NOT NULL default '',
18
+ `city` varchar(255) NOT NULL default '',
19
+ `country_id` varchar(20) NOT NULL default '',
20
+ `phone` varchar(255) NOT NULL default '',
21
+ `fax` varchar(255) NOT NULL default '',
22
+ `customer_email` varchar(255) NOT NULL default '',
23
+ `website` varchar(255) NOT NULL default '',
24
+ `detail` text NOT NULL default '',
25
+ `store_id` varchar(20) NOT NULL default '',
26
+ `status` smallint(6) NOT NULL default '0',
27
+ `created_time` datetime NULL,
28
+ `update_time` datetime NULL,
29
+ PRIMARY KEY (`productcontact_id`)
30
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
31
+
32
+ ");
33
+
34
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/magenotification.xml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addJs"><script>tinybox/tinybox.js</script></action>
6
+ <action method="addCss"><stylesheet>css/tinybox/style.css</stylesheet></action>
7
+ <action method="addCss"><stylesheet>css/magestore/magenotification.css</stylesheet></action>
8
+ </reference>
9
+ </default>
10
+ <magenotification_adminhtml_feedback_index>
11
+ <reference name="content">
12
+ <block type="magenotification/adminhtml_feedback" name="extension_feedback" />
13
+ </reference>
14
+ </magenotification_adminhtml_feedback_index>
15
+
16
+ </layout>
app/design/adminhtml/default/default/layout/productcontact.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+
4
+ <productcontact_adminhtml_productcontact_index>
5
+ <reference name="content">
6
+ <block type="productcontact/adminhtml_productcontact" name="productcontact">
7
+ <block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
8
+ <action method="setUseConfirm"><params>0</params></action>
9
+ </block>
10
+ </block>
11
+ </reference>
12
+ </productcontact_adminhtml_productcontact_index>
13
+ <productcontact_adminhtml_productcontact_view>
14
+ <reference name="head">
15
+ <action method="addCss"><script>productcontact/productcontact.css</script></action>
16
+ </reference>
17
+ <reference name="content">
18
+ <block type="productcontact/adminhtml_productcontact_view" name="productcontact_view"></block>
19
+ </reference>
20
+ </productcontact_adminhtml_productcontact_view>
21
+ </layout>
app/design/adminhtml/default/default/template/magenotification/feedback/files.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ ?>
4
+ <div id="feedback_files">
5
+ <input type="file" class="input-file" value="" name="file0" id="file0" >
6
+ <button onclick="magenotificationAddMoreFile();" class="scalable add" type="button">
7
+ <span><?php echo $this->__('Add More')?></span>
8
+ </button>
9
+ </div>
10
+ <script type="text/javascript">
11
+ var currentfile = 0;
12
+ function magenotificationAddMoreFile(){
13
+ currentfile++;
14
+ var inputFile = '<br/><input type="file" class="input-file" value="" name="file'+currentfile+'" id="file'+currentfile+'">';
15
+ $('feedback_files').insert(inputFile);
16
+ }
17
+ </script>
app/design/adminhtml/default/default/template/magenotification/feedback/history.phtml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $messages = $this->getMessages() ?>
2
+ <?php if(count($messages)): ?>
3
+ <?php foreach($messages as $message): ?>
4
+ <?php if((int)$message->getIsCustomer() == 1): ?>
5
+ <br/>
6
+ <?php if((int)$message->getIsSent() == 1): ?>
7
+ <span class="grid-severity-notice" style="width: 150px;">
8
+ <span><?php echo $this->__('Sent to').' '.Magestore_Magenotification_Model_Keygen::SERVER_NAME?></span>
9
+ </span>
10
+ <?php else: ?>
11
+ <table><tr><td width="170">
12
+ <span class="grid-severity-critical" style="width: 150px;"><span><?php echo $this->__('Not Sent')?></span></span>
13
+ </td><td>
14
+ <a href='<?php echo $this->getUrl('magenotification/adminhtml_feedback/resendmessage',array('id'=>$message->getId(),'feedback_id'=>$this->getFeedback()->getId(),'_secure'=>true)) ?>' >
15
+ <?php echo $this->__('Resend')?>
16
+ </a>
17
+ </td></tr></table>
18
+ <?php endif; ?>
19
+ <?php endif; ?>
20
+ <?php echo $this->getMessageTitle($message) ?>
21
+ <br/>
22
+ <pre><?php echo $message->getMessage() ?></pre>
23
+ <br/>
24
+ <?php if($attachedfiles = $message->getAttachedFile()): ?>
25
+ <b><?php echo $this->__('Attached Files')?></b>
26
+ <?php echo $attachedfiles ?>
27
+ <?php endif; ?>
28
+ <br/>
29
+ <hr style="border: 1px dashed rgb(204, 204, 204);"/>
30
+ <?php endforeach; ?>
31
+ <?php endif; ?>
app/design/adminhtml/default/default/template/magenotification/license/purchaseform.phtml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ ?>
4
+
5
+ <button style="margin-top:5px;" onclick="location.href='<?php echo $this->getPurchaseUrl() ?>'" class="scalable add" type="button" >
6
+ <span><?php echo $this->__('Purchase now')?></span>
7
+ </button><br/><br/>
app/design/adminhtml/default/default/template/magenotification/license/updateform.phtml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ ?>
4
+ <table width="300">
5
+ <tr>
6
+ <td colspan="2">
7
+ <?php echo $this->__('Upgrade License to')?><br/>
8
+ <select style="margin:5px 0 5px 0;"class="input-text" name="<?php echo $this->getExtensionName() ?>_licensetype" id="<?php echo $this->getExtensionName() ?>_licensetype">
9
+ <?php foreach($this->getLicenseTypeOption() as $key=>$label): ?>
10
+ <option value="<?php echo $key?>"><?php echo $label?></option>
11
+ <?php endforeach; ?>
12
+ </select>
13
+ </td>
14
+ </tr>
15
+ <tr>
16
+ <td>
17
+ <button style="" onclick="updateLicenseViewPrice('<?php echo $this->getLicensekey() ?>')" class="scalable" type="button" >
18
+ <span><?php echo $this->__('View Price')?></span>
19
+ </button>
20
+ </td>
21
+ <td>
22
+ <button style="" onclick="updateLicensePurchase('<?php echo $this->getLicensekey() ?>')" class="scalable add" type="button" >
23
+ <span><?php echo $this->__('Upgrade Now')?></span>
24
+ </button>
25
+ </td>
26
+ </tr>
27
+ </table><br/>
28
+
29
+ <script type="text/javascript">
30
+ function updateLicenseViewPrice(licensekey){
31
+ var licensetype = $('<?php echo $this->getExtensionName() ?>_licensetype').value;
32
+ var url = '<?php echo $this->getViewPriceUrl()?>'+'licensekey/'+licensekey+'/licensetype/'+licensetype;
33
+ TINY.box.show(url, 1, 300, 100, 1);
34
+ }
35
+
36
+ function updateLicensePurchase(licensekey){
37
+ var licensetype = $('<?php echo $this->getExtensionName() ?>_licensetype').value;
38
+ var url = '<?php echo $this->getUpdateUrl()?>'+'licensekey/'+licensekey+'/licensetype/'+licensetype;
39
+ location.href=url;
40
+ }
41
+ </script>
app/design/adminhtml/default/default/template/productcontact/view.phtml ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $row = $this->getProductContact(); ?>
2
+ <?php //var_dump($collection);die(); ?>
3
+
4
+ <?php if(!$row->getId()): ?>
5
+ <?php echo $this->__('Error: '); ?>
6
+ <?php else:?>
7
+ <div class="columns">
8
+ <div id="page:left" class="side-col">
9
+ <h3><?php echo $this->__('Productcontact Information'); ?></h3>
10
+ <ul id="transaction_detail" class="tabs">
11
+ <li>
12
+ <a href="" class="tab-item-link active" title="<?php echo $this->__('Productcontact Detail'); ?>">
13
+ <span>
14
+ <?php echo $this->__('Productcontact Detail'); ?>
15
+ </span>
16
+ </a>
17
+ </li>
18
+ </ul>
19
+ </div>
20
+ <div id="content" class="main-col">
21
+ <div class="main-col-inner">
22
+ <div id="messages"></div>
23
+ <div class="content-header" style="visibility:visible;">
24
+ <h3 class="icon-head head-customer"><?php echo $this->__('Productcontact Detail:'); ?></h3>
25
+ </div>
26
+ <div class="entry-edit">
27
+ <div id="productContact-table">
28
+ <div class="entry-edit">
29
+ <div class="entry-edit-head">
30
+ <h4 class="icon-head head-transaction-view"><?php echo $this->__('Productcontact Information'); ?></h4>
31
+ </div>
32
+ <fieldset>
33
+ <table class="transaction-table" cellspacing="0" cellpadding="0" id="productcontactTable">
34
+ <col width="200;"/>
35
+ <col />
36
+ <tr>
37
+ <td ><label><strong><?php echo $this->__('Product Name'); ?></strong></label></td>
38
+ <td ><a href="<?php echo $this->getUrl('adminhtml/catalog_product/edit', array('_current'=>true, 'id' => $row->getProductId())); ?>"><?php echo $row->getProductName(); ?></a></td>
39
+ </tr>
40
+ <?php if($row->getStoreId()): ?>
41
+ <tr>
42
+ <td ><label><strong><?php echo $this->__('Store'); ?></strong></label></td>
43
+ <td ><?php echo Mage::getModel('core/store')->load($row->getStoreId())->getName(); ?></td>
44
+ </tr>
45
+ <?php endif;?>
46
+ <?php if($row->getCompanyName()): ?>
47
+ <tr>
48
+ <td ><label><strong><?php echo $this->__('Company Name'); ?></strong></label></td>
49
+ <td ><?php echo $row->getCompanyName(); ?></td>
50
+ </tr>
51
+ <?php endif; ?>
52
+ <?php if($row->getPersonalName()): ?>
53
+ <tr>
54
+ <td ><label><strong><?php echo $this->__('Personal Name'); ?></strong></label></td>
55
+ <td ><?php echo $row->getPersonalName(); ?></td>
56
+ </tr>
57
+ <?php endif; ?>
58
+ <?php if($row->getAddress()): ?>
59
+ <tr>
60
+ <td ><label><strong><?php echo $this->__('Address'); ?></strong></label></td>
61
+ <td ><?php echo $row->getAddress(); ?></td>
62
+ </tr>
63
+ <?php endif; ?>
64
+ <?php if($row->getZipcode()): ?>
65
+ <tr>
66
+ <td ><label><strong><?php echo $this->__('Zipcode'); ?></strong></label></td>
67
+ <td ><?php echo $row->getZipcode(); ?></td>
68
+ </tr>
69
+ <?php endif; ?>
70
+ <?php if($row->getCity()): ?>
71
+ <tr>
72
+ <td ><label><strong><?php echo $this->__('City'); ?></strong></label></td>
73
+ <td ><?php echo $row->getCity(); ?></td>
74
+ </tr>
75
+ <?php endif; ?>
76
+ <?php if($row->getCountryId()): ?>
77
+ <tr>
78
+ <td ><label><strong><?php echo $this->__('Country'); ?></strong></label></td>
79
+ <td ><?php echo Mage::getModel('directory/country')->load($row->getCountryId())->getName(); ?></td>
80
+ </tr>
81
+ <?php endif; ?>
82
+ <?php if($row->getPhone()): ?>
83
+ <tr>
84
+ <td ><label><strong><?php echo $this->__('Phone'); ?></strong></label></td>
85
+ <td ><?php echo $row->getPhone(); ?></td>
86
+ </tr>
87
+ <?php endif; ?>
88
+ <?php if($row->getFax()): ?>
89
+ <tr>
90
+ <td ><label><strong><?php echo $this->__('Fax'); ?></strong></label></td>
91
+ <td ><?php echo $row->getFax(); ?></td>
92
+ </tr>
93
+ <?php endif; ?>
94
+ <?php if($row->getCustomerEmail()): ?>
95
+ <tr>
96
+ <td ><label><strong><?php echo $this->__('Email'); ?></strong></label></td>
97
+ <td >
98
+
99
+ <?php
100
+ $customer = Mage::getResourceModel('customer/customer_collection')->addFieldToFilter('email', $row->getCustomerEmail())->getFirstItem();
101
+ if($customer->getId()):
102
+ ?>
103
+ <a href="<?php echo $this->getUrl('adminhtml/customer/edit', array('_current'=>true, 'id'=>$customer->getId())); ?>"><?php echo $row->getCustomerEmail(); ?></a>
104
+ <?php else: ?>
105
+ <?php echo $row->getCustomerEmail(); ?>
106
+ <?php endif; ?>
107
+ </td>
108
+ </tr>
109
+ <?php endif; ?>
110
+
111
+ <?php if($row->getWebsite()): ?>
112
+ <tr>
113
+ <td ><label><strong><?php echo $this->__('Website'); ?></strong></label></td>
114
+ <td ><a href="<?php echo $row->getWebsite(); ?>"><?php echo $row->getWebsite(); ?></a></td>
115
+ </tr>
116
+ <?php endif; ?>
117
+ <?php if($row->getDetail()): ?>
118
+ <tr>
119
+ <td ><label><strong><?php echo $this->__('Detail'); ?></strong></label></td>
120
+ <td ><?php echo $row->getDetail(); ?></td>
121
+ </tr>
122
+ <?php endif; ?>
123
+ </table>
124
+ </fieldset>
125
+ </div>
126
+ </div>
127
+ </div>
128
+ </div>
129
+ </div>
130
+ </div>
131
+ <?php endif; ?>
app/design/frontend/default/default/layout/productcontact.xml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addJs"><script>magestore/productcontact.js</script></action>
6
+ <action method="addCss"><stylesheet>css/magestore/productcontact.css</stylesheet></action>
7
+ </reference>
8
+ </default>
9
+ <productcontact_index_index>
10
+ <reference name="root">
11
+ <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
12
+ </reference>
13
+ <reference name="content">
14
+ <!--<block type="productcontact/productcontact" name="productcontact" template="productcontact/productcontact.phtml" />-->
15
+ <block type="productcontact/productcontact" name="productcontact" template="productcontact/contact_form.phtml" />
16
+ </reference>
17
+ </productcontact_index_index>
18
+ <catalog_product_view>
19
+ <reference name="product.info">
20
+ <!--<block type="productcontact/productcontact" name="productcontact" as="productcontact.form" template="productcontact/contact_form.phtml" >
21
+ <action method="addToParentGroup"><group>detailed_info</group></action>
22
+ </block>
23
+ -->
24
+ <block type="productcontact/productcontact" name="productcontact.link" as="other" template="productcontact/productcontact.phtml" />
25
+ </reference>
26
+ <reference name="product.info.additional">
27
+ <block type="productcontact/productcontact" name="productcontact.form" before="-" template="productcontact/contact_form.phtml"></block>
28
+ </reference>
29
+ </catalog_product_view>
30
+ </layout>
app/design/frontend/default/default/template/productcontact/contact_form.phtml ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $productId = $this->getRequest()->getParam('id');
4
+ $customer = $this->getCustomer();
5
+
6
+ $address = $customer->getDefaultBillingAddress();
7
+ ?>
8
+ <?php if(Mage::helper('productcontact')->isActive()): ?>
9
+ <div class="box-collateral productcontact">
10
+ <a name="product-contact-form"></a>
11
+ <h2><?php echo $this->__('Product contact'); ?></h2>
12
+ <div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
13
+ <!--<ul class="messages" style="display:none;" id="productcontact_message">
14
+ <li class="success-msg">
15
+ <ul><li><?php echo $this->__('Your contact for product has been sent. We will notify you as soon as. Thank you!'); ?></li></ul>
16
+ </li>
17
+ </ul>-->
18
+
19
+ <form action="<?php echo $this->getUrl('productcontact/index/submit'); ?>" id="productcontactForm" method="post">
20
+ <input type="hidden" name="product_id" value="<?php echo $productId; ?>"/>
21
+ <div class="fieldset">
22
+ <h2 class="legend"><?php echo Mage::helper('productcontact')->__('Contact Information') ?></h2>
23
+ <ul class="form-list">
24
+ <li class="fields">
25
+ <?php if(Mage::helper('productcontact')->isShowCompanyName()): ?>
26
+ <div class="field">
27
+ <label for="company_name" class="required"><?php if(Mage::helper('productcontact')->isRequireCompanyName()): ?><em>*</em><?php endif; ?><?php echo Mage::helper('productcontact')->__('Company Name') ?></label>
28
+ <div class="input-box">
29
+ <?php if(Mage::helper('productcontact')->isRequireCompanyName()): ?>
30
+ <input name="company_name" id="company_name" title="<?php echo Mage::helper('productcontact')->__('Company Name') ?>" value="<?php if($address) echo $this->htmlEscape($address->getCompany()) ?>" class="input-text required-entry" type="text"/>
31
+ <?php else: ?>
32
+ <input name="company_name" id="company_name" title="<?php echo Mage::helper('productcontact')->__('Company Name') ?>" value="<?php if($address) echo $this->htmlEscape($address->getCompany()) ?>" class="input-text" type="text"/>
33
+ <?php endif; ?>
34
+ </div>
35
+ </div>
36
+ <?php endif; ?>
37
+
38
+ <?php if(Mage::helper('productcontact')->isShowPersonalName()): ?>
39
+ <div class="field">
40
+ <label for="personal_name" class="required"><?php if(Mage::helper('productcontact')->isRequirePersonalName()): ?><em>*</em><?php endif; ?><?php echo Mage::helper('productcontact')->__('Personal Name') ?></label>
41
+ <div class="input-box">
42
+ <?php if(Mage::helper('productcontact')->isRequirePersonalName()): ?>
43
+ <input name="personal_name" id="personal_name" title="<?php echo Mage::helper('productcontact')->__('Personal Name') ?>" value="<?php if($customer->getId()) echo $this->htmlEscape($customer->getName()); ?>" class="input-text required-entry" type="text" />
44
+ <?php else: ?>
45
+ <input name="personal_name" id="personal_name" title="<?php echo Mage::helper('productcontact')->__('Personal Name') ?>" value="<?php if($customer->getId()) echo $this->htmlEscape($customer->getName()); ?>" class="input-text" type="text" />
46
+ <?php endif; ?>
47
+ </div>
48
+ </div>
49
+ <?php endif; ?>
50
+ </li>
51
+ <li class="fields">
52
+ <?php if(Mage::helper('productcontact')->isShowAddress()): ?>
53
+ <div class="field">
54
+ <label for="address" class="required"><?php if(Mage::helper('productcontact')->isRequireAddress()): ?><em>*</em><?php endif; ?><?php echo Mage::helper('productcontact')->__('Address') ?></label>
55
+ <div class="input-box">
56
+ <?php if(Mage::helper('productcontact')->isRequireAddress()): ?>
57
+ <input name="address" id="address" title="<?php echo Mage::helper('productcontact')->__('Address') ?>" value="<?php if($address) echo $this->htmlEscape($address->getStreet(1))." - ".$this->htmlEscape($address->getStreet(2)) ?>" class="input-text required-entry" type="text" />
58
+ <?php else: ?>
59
+ <input name="address" id="address" title="<?php echo Mage::helper('productcontact')->__('Address') ?>" value="<?php if($address) echo $this->htmlEscape($address->getStreet(1))." - ".$this->htmlEscape($address->getStreet(2)) ?>" class="input-text" type="text" />
60
+ <?php endif; ?>
61
+ </div>
62
+ </div>
63
+ <?php endif; ?>
64
+ <?php if(Mage::helper('productcontact')->isShowZipcode()): ?>
65
+ <div class="field">
66
+ <label for="zipcode" class="required"><?php if(Mage::helper('productcontact')->isRequireZipcode()): ?><em>*</em><?php endif; ?><?php echo Mage::helper('productcontact')->__('Zipcode') ?></label>
67
+ <div class="input-box">
68
+ <?php if(Mage::helper('productcontact')->isRequireZipcode()): ?>
69
+ <input name="zipcode" id="zipcode" title="<?php echo Mage::helper('productcontact')->__('Zipcode') ?>" value="<?php if($address) echo $this->htmlEscape($address->getPostcode()) ?>" class="input-text" type="text" />
70
+ <?php else: ?>
71
+ <input name="zipcode" id="zipcode" title="<?php echo Mage::helper('productcontact')->__('Zipcode') ?>" value="<?php if($address) echo $this->htmlEscape($address->getPostcode()) ?>" class="input-text" type="text" />
72
+ <?php endif; ?>
73
+ </div>
74
+ </div>
75
+ <?php endif; ?>
76
+ </li>
77
+ <li class="fields">
78
+ <?php if(Mage::helper('productcontact')->isShowCity()): ?>
79
+ <div class="field">
80
+ <label for="city" class="required"><?php if(Mage::helper('productcontact')->isRequireCity()): ?><em>*</em><?php endif; ?><?php echo Mage::helper('productcontact')->__('City') ?></label>
81
+ <div class="input-box">
82
+ <?php if(Mage::helper('productcontact')->isRequireCity()): ?>
83
+ <input name="city" id="city" title="<?php echo Mage::helper('productcontact')->__('City') ?>" value="<?php if($address) echo $this->htmlEscape($address->getCity()) ?>" class="input-text required-entry" type="text" />
84
+ <?php else: ?>
85
+ <input name="city" id="city" title="<?php echo Mage::helper('productcontact')->__('City') ?>" value="<?php if($address) echo $this->htmlEscape($address->getCity()) ?>" class="input-text" type="text" />
86
+ <?php endif; ?>
87
+ </div>
88
+ </div>
89
+ <?php endif; ?>
90
+ <?php if(Mage::helper('productcontact')->isShowCountry()): ?>
91
+ <div class="field">
92
+ <label for="country_id" class="required"><?php if(Mage::helper('productcontact')->isRequireCountry()): ?><em>*</em><?php endif; ?><?php echo Mage::helper('productcontact')->__('Country') ?></label>
93
+ <div class="input-box">
94
+ <?php echo $this->getCountryHtmlSelect() ?>
95
+ </div>
96
+ </div>
97
+ <?php endif; ?>
98
+ </li>
99
+ <li class="fields">
100
+ <?php if(Mage::helper('productcontact')->isShowPhone()): ?>
101
+ <div class="field">
102
+ <label for="phone" class="required"><?php if(Mage::helper('productcontact')->isRequirePhone()): ?><em>*</em><?php endif; ?><?php echo Mage::helper('productcontact')->__('Phone') ?></label>
103
+ <div class="input-box">
104
+ <?php if(Mage::helper('productcontact')->isRequirePhone()): ?>
105
+ <input name="phone" id="phone" title="<?php echo Mage::helper('productcontact')->__('Phone') ?>" value="<?php if($address) echo $this->htmlEscape($address->getTelephone()) ?>" class="input-text required-entry" type="text" />
106
+ <?php else: ?>
107
+ <input name="phone" id="phone" title="<?php echo Mage::helper('productcontact')->__('Phone') ?>" value="<?php if($address) echo $this->htmlEscape($address->getTelephone()) ?>" class="input-text" type="text" />
108
+ <?php endif; ?>
109
+ </div>
110
+ </div>
111
+ <?php endif; ?>
112
+ <?php if(Mage::helper('productcontact')->isShowFax()): ?>
113
+ <div class="field">
114
+ <label for="fax" class="required"><?php if(Mage::helper('productcontact')->isRequireFax()): ?><em>*</em><?php endif; ?><?php echo Mage::helper('productcontact')->__('Fax') ?></label>
115
+ <div class="input-box">
116
+ <?php if(Mage::helper('productcontact')->isRequireFax()): ?>
117
+ <input name="fax" id="fax" title="<?php echo Mage::helper('productcontact')->__('Fax') ?>" value="<?php if($address) echo $this->htmlEscape($address->getFax()) ?>" class="input-text required-entry" type="text" />
118
+ <?php else: ?>
119
+ <input name="fax" id="fax" title="<?php echo Mage::helper('productcontact')->__('Fax') ?>" value="<?php if($address) echo $this->htmlEscape($address->getFax()) ?>" class="input-text" type="text" />
120
+ <?php endif; ?>
121
+ </div>
122
+ </div>
123
+ <?php endif; ?>
124
+ </li>
125
+ <li class="fields">
126
+ <?php if(Mage::helper('productcontact')->isShowEmail()): ?>
127
+ <div class="field">
128
+ <label for="customer_email" class="required"><?php if(Mage::helper('productcontact')->isRequireEmail()): ?><em>*</em><?php endif; ?><?php echo Mage::helper('productcontact')->__('Email') ?></label>
129
+ <div class="input-box">
130
+ <?php if(Mage::helper('productcontact')->isRequireEmail()): ?>
131
+ <input name="customer_email" id="customer_email" title="<?php echo Mage::helper('productcontact')->__('Email') ?>" value="<?php echo $this->htmlEscape($customer->getEmail()) ?>" class="input-text required-entry validate-email" type="text" />
132
+ <?php else: ?>
133
+ <input name="customer_email" id="customer_email" title="<?php echo Mage::helper('productcontact')->__('Email') ?>" value="<?php echo $this->htmlEscape($customer->getEmail()) ?>" class="input-text" type="text" />
134
+ <?php endif; ?>
135
+ </div>
136
+ </div>
137
+ <?php endif; ?>
138
+ <?php if(Mage::helper('productcontact')->isShowWebsite()): ?>
139
+ <div class="field">
140
+ <label for="website" class="required"><?php if(Mage::helper('productcontact')->isRequireWebsite()): ?><em>*</em><?php endif; ?><?php echo Mage::helper('productcontact')->__('Website') ?></label>
141
+ <div class="input-box">
142
+ <?php if(Mage::helper('productcontact')->isRequireWebsite()): ?>
143
+ <input name="website" id="website" title="<?php echo Mage::helper('productcontact')->__('Website') ?>" value="<?php echo ""; ?>" class="input-text required-entry" type="text" />
144
+ <?php else: ?>
145
+ <input name="website" id="website" title="<?php echo Mage::helper('productcontact')->__('Website') ?>" value="<?php echo ""; ?>" class="input-text" type="text" />
146
+ <?php endif; ?>
147
+ </div>
148
+ </div>
149
+ <?php endif; ?>
150
+ </li>
151
+ <li class="wide">
152
+ <div class="input-box">
153
+ <img src="<?php echo $this->getUrl('productcontact/index/imagecaptcha');?>" id="captcha_image" />
154
+ </div>
155
+
156
+ <div class="clear"></div>
157
+ <span><a href="" onclick="refreshImage();return false;"><?php echo $this->__("Refresh"); ?></a></span>
158
+ <br/>
159
+
160
+ <div class="left">
161
+ <div class="left"><label class="required"><?php echo $this->__('Enter the text above');?><em>*</em></label></div>
162
+ <div class="left">
163
+ <input type="text" name="captcha_text" class="required-entry input-text captcha-input" id="captcha_text" value="" />
164
+ </div>
165
+ </div>
166
+ <br/>
167
+ </li>
168
+ <li class="wide">
169
+ <?php if(Mage::helper('productcontact')->isShowDetail()): ?>
170
+ <label for="detail" class="required"><?php if(Mage::helper('productcontact')->isRequireDetail()): ?><em>*</em><?php endif; ?><?php echo Mage::helper('contacts')->__('Detail') ?></label>
171
+ <div class="input-box">
172
+ <?php if(Mage::helper('productcontact')->isRequireDetail()): ?>
173
+ <textarea name="detail" id="detail" title="<?php echo Mage::helper('contacts')->__('Detail') ?>" class="required-entry input-text" cols="5" rows="3"></textarea>
174
+ <?php else: ?>
175
+ <textarea name="detail" id="detail" title="<?php echo Mage::helper('contacts')->__('Detail') ?>" class="input-text" cols="5" rows="3"></textarea>
176
+ <?php endif; ?>
177
+ </div>
178
+ <?php endif; ?>
179
+ </li>
180
+ </ul>
181
+ </div>
182
+ <div class="buttons-set">
183
+ <p class="required"><?php echo Mage::helper('contacts')->__('* Required Fields') ?></p>
184
+ <input type="text" name="hideit" id="hideit" value="" style="display:none !important;" />
185
+ <button type="submit" title="<?php echo Mage::helper('contacts')->__('Submit') ?>" class="button"><span><span><?php echo Mage::helper('contacts')->__('Submit') ?></span></span></button>
186
+ </div>
187
+ </form>
188
+ </div>
189
+ <?php endif; ?>
190
+ <script type="text/javascript">
191
+ //<![CDATA[
192
+ var contactForm = new VarienForm('productcontactForm', true);
193
+
194
+ function refreshImage() {
195
+ url = '<?php echo $this->getUrl('productcontact/index/refreshcaptcha');?>';
196
+ $('captcha_image').src = '';
197
+
198
+ capchaRefesh = new Ajax.Request(url, {
199
+
200
+ method: 'get',
201
+
202
+ onSuccess: function(transport) {
203
+
204
+ imageCapcha = new Image();
205
+
206
+ imageCapcha.src = transport.responseText;
207
+
208
+ $('captcha_image').src = imageCapcha.src;
209
+
210
+ }
211
+
212
+ });
213
+ }
214
+
215
+ // var productcontact = new Productcontact('productcontactForm', '<?php echo $this->getUrl('productcontact/index/submit');?>' );
216
+
217
+ </script>
app/design/frontend/default/default/template/productcontact/email/sendtoadmin.phtml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $data = $this->getInformation();?>
2
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
3
+ <thead>
4
+ <tr>
5
+ <th align="left" bgcolor="#d9e5ee" style="padding:5px 9px 6px 9px; border:1px solid #bebcb7; border-bottom:none; line-height:1em;"><strong><?php echo $this->__("Customer's Information"); ?></th>
6
+ </tr>
7
+ </thead>
8
+ <tbody>
9
+ <tr>
10
+ <td valign="top" style="padding:7px 9px 9px 9px; border:1px solid #bebcb7; border-top:0; background:#f8f7f5;">
11
+ <address>
12
+ <?php echo $data['personal_name']; ?><br/><br/>
13
+ <?php if($data['company_name']) echo $data['company_name']."<br/>"; ?>
14
+ <?php if($data['address']) echo $data['address']."<br/>"; ?>
15
+ <?php echo $data['city']; ?><?php if($data['zipcode']) echo ", ".$data['zipcode']; ?><br/>
16
+ <?php if($data['country_id']) echo Mage::getModel('directory/country')->loadByCode($data['country_id'])->getName()."<br/>"; ?>
17
+ <?php if($data['customer_email']): ?>
18
+ <br/>
19
+ <a href="mailto:<?php echo $data['customer_email']; ?>"><?php echo $data['customer_email']; ?></a>
20
+ <br/><br/>
21
+ <?php endif; ?>
22
+ <?php if($data['website'])echo $data['website']."<br/>"; ?>
23
+ <?php if($data['phone'])echo $this->__('T: ').$data['phone']."<br/>"; ?>
24
+ <?php if($data['fax']) echo $this->__('F: ').$data['fax']."<br/>"; ?>
25
+ </address>
26
+ </td>
27
+ </tr>
28
+ <tr>
29
+ <td valign="top" style="padding:7px 9px 9px 9px; border:1px solid #bebcb7; border-top:0; background:#f8f7f5;">
30
+ <address>
31
+ <?php echo $data['product_name']; ?><br/><br/>
32
+ <?php echo $data['detail']; ?><br/>
33
+ </address>
34
+ </td>
35
+ </tr>
36
+ </tbody>
37
+ </table><br/>
app/design/frontend/default/default/template/productcontact/email/sendtocustomer.phtml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php $data = $this->getInformation();?>
2
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
3
+ <tbody>
4
+ <tr>
5
+ <td valign="top" style="padding:7px 9px 9px 9px; border-top:1px solid #bebcb7; border-top:0; background:#f8f7f5;">
6
+ <?php echo $data['detail']; ?><br/>
7
+ </td>
8
+ </tr>
9
+ </tbody>
10
+ </table><br/>
app/design/frontend/default/default/template/productcontact/productcontact.phtml ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php if(Mage::helper('productcontact')->isActive()): ?>
2
+ <a href="#product-contact-form"><?php echo $this->__('Contact on this product'); ?></a>
3
+ <?php endif; ?>
app/etc/modules/Magestore_Magenotification.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magestore_Magenotification>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Magestore_Magenotification>
8
+ </modules>
9
+ </config>
app/etc/modules/Magestore_Productcontact.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magestore_Productcontact>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Magestore_Productcontact>
8
+ </modules>
9
+ </config>
app/locale/en_US/Magestore_Productcontact.csv ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Productcontact","Productcontact"
2
+ "Manage contact","Manage contact"
3
+ "Manager Product Contact","Manager Product Contact"
4
+ "different emails separated by comma","different emails separated by comma"
5
+
6
+
7
+ "Contact Information","Contact Information"
8
+ "Company Name","Company Name"
9
+ "Personal Name","Personal Name"
10
+ "Address","Address"
11
+ "Zipcode","Zipcode"
12
+ "City","City"
13
+ "Country","Country"
14
+ "Phone","Phone"
15
+ "Fax","Fax"
16
+ "Email","Email"
17
+ "Website","Website"
18
+ "refresh","refresh"
19
+ "Enter the text above", "Enter the text above"
20
+ "Detail", "Detail"
app/locale/en_US/template/email/productcontact/email-to-admin.html ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject {{var store.getFrontendName()}}: Contact for product - {{var productcontact.getProductName()}} - on {{var productcontact.getCreatedTime()}}@-->
2
+ <!--@styles
3
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
4
+ @-->
5
+
6
+
7
+ <div style="font:11px/1.35em Verdana, Arial, Helvetica, sans-serif;">
8
+ <table cellspacing="0" cellpadding="0" border="0" width="98%" style="margin-top:10px; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; margin-bottom:10px;">
9
+ <tr>
10
+ <td align="center" valign="top">
11
+ <!-- [ header starts here] -->
12
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
13
+ <tr>
14
+ <td valign="top"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
15
+ </tr>
16
+ </table>
17
+ <!-- [ middle starts here] -->
18
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
19
+ <tr>
20
+ <td valign="top">
21
+ <p>
22
+ <strong>Hello,</strong>,<br/>
23
+ There is a customer that recently sent a contact on product <strong>{{var productcontact.getProductName()}}</strong><br/>
24
+ Please recheck this contact at <a href="{{var productcontact.getProductcontactUrl()}}">here</a>
25
+ </p>
26
+ <br/>
27
+ <p>The contact information as below.</p>
28
+ <br/>
29
+
30
+ {{var productcontact.getCustomerInformation()}}
31
+ <br/><br/>
32
+ <p>Thank you again,<br/><strong>{{var store.getFrontendName()}}</strong></p>
33
+ </td>
34
+ </tr>
35
+ </table>
36
+ </td>
37
+ </tr>
38
+ </table>
39
+ </div>
app/locale/en_US/template/email/productcontact/email-to-customer.html ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject {{var store.getFrontendName()}}: Contact for product - {{var productcontact.getProductName()}} - on {{var productcontact.getCreatedTime()}}@-->
2
+ <!--@styles
3
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
4
+ @-->
5
+
6
+
7
+ <div style="font:11px/1.35em Verdana, Arial, Helvetica, sans-serif;">
8
+ <table cellspacing="0" cellpadding="0" border="0" width="98%" style="margin-top:10px; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; margin-bottom:10px;">
9
+ <tr>
10
+ <td align="center" valign="top">
11
+ <!-- [ header starts here] -->
12
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
13
+ <tr>
14
+ <td valign="top"><a href="{{store url=""}}"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" style="margin-bottom:10px;" border="0"/></a></td>
15
+ </tr>
16
+ </table>
17
+ <!-- [ middle starts here] -->
18
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
19
+ <tr>
20
+ <td valign="top">
21
+ <p>
22
+ <strong>Hello {{htmlescape var=$productcontact.getCustomerName()}}</strong>,<br/>
23
+ Thanks for taking time to contact us.<br/>
24
+ We will response you as soon as possible.
25
+ </p>
26
+ <h3 style="border-bottom:2px solid #eee; font-size:1.05em; padding-bottom:1px; ">Your contact for {{var productcontact.getProductName()}}</h3>
27
+ {{var productcontact.getCustomerInformation()}}
28
+ <br/><br/>
29
+ <p>Thank you again,<br/>
30
+ <strong>{{var store.getFrontendName()}}</strong></p>
31
+ </td>
32
+ </tr>
33
+ </table>
34
+ </td>
35
+ </tr>
36
+ </table>
37
+ </div>
js/magestore/productcontact.js ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var Productcontact = Class.create();
2
+ Productcontact.prototype = {
3
+ initialize: function(form, requestUrl) {
4
+ this.requestUrl = requestUrl;
5
+ this.form = form;
6
+ //if ($(this.form)) {
7
+ // $(this.form).observe('submit', function(event){this.save();Event.stop(event);}.bind(this));
8
+ //}
9
+ this.onSave = this.nextStep.bindAsEventListener(this);
10
+ },
11
+
12
+ //save: function() {
13
+ //alert(this.requestUrl);
14
+ //var validator = new Validation(this.form);
15
+ //var requestUrl = requestUrl + '';
16
+ //if (validator.validate()) {
17
+ //TINY.box.show(this.requestUrl, 1, 400, 300, 1);
18
+ //}
19
+ //}
20
+
21
+
22
+ save: function() {
23
+ var validator = new Validation(this.form);
24
+ if (validator.validate()) {
25
+ $('time-please-wait').show();
26
+ var request = new Ajax.Request(
27
+ this.requestUrl,
28
+ {
29
+ method:'post',
30
+ onComplete: '',
31
+ onSuccess: this.onSave,
32
+ onFailure: '',
33
+ parameters: Form.serialize(this.form)
34
+ }
35
+ );
36
+ }
37
+ },
38
+
39
+ nextStep: function(transport) {
40
+ if (transport && transport.responseText){
41
+ try{
42
+ response = eval('(' + transport.responseText + ')');
43
+ }
44
+ catch (e) {
45
+ response = {};
46
+ }
47
+ }
48
+ // if (response.error != ''){
49
+ // $('time-please-wait').hide();
50
+ // $('productcontact_message').hide();
51
+ // alert(response.error);
52
+ // return false;
53
+ // }
54
+ if (response.html) {
55
+ $('time-please-wait').hide();
56
+ $('productcontact_message').show();
57
+ $('productcontactForm').reset();
58
+ refreshImage();
59
+ } else {
60
+ $('time-please-wait').hide();
61
+ $('productcontact_message').hide();
62
+ alert(response.error);
63
+ return false;
64
+ }
65
+ }
66
+ }
67
+
js/tinybox/tinybox.js ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var TINY={};
2
+
3
+ function T$(i){return document.getElementById(i)}
4
+
5
+ TINY.box=function(){
6
+ var p,m,b,fn,ic,iu,iw,ih,ia,f=0;
7
+ return{
8
+ show:function(c,u,w,h,a,t){
9
+ if(!f){
10
+ p=document.createElement('div'); p.id='tinybox';
11
+ m=document.createElement('div'); m.id='tinymask';
12
+ b=document.createElement('div'); b.id='tinycontent';
13
+ document.body.appendChild(m); document.body.appendChild(p); p.appendChild(b);
14
+ m.onclick=TINY.box.hide; window.onresize=TINY.box.resize; f=1
15
+ }
16
+ if(!a&&!u){
17
+ p.style.width=w?w+'px':'auto'; p.style.height=h?h+'px':'auto';
18
+ p.style.backgroundImage='none'; b.innerHTML=c
19
+ }else{
20
+ b.style.display='none'; p.style.width=p.style.height='100px'
21
+ }
22
+ this.mask();
23
+ ic=c; iu=u; iw=w; ih=h; ia=a; this.alpha(m,1,80,3);
24
+ if(t){setTimeout(function(){TINY.box.hide()},1000*t)}
25
+ },
26
+ fill:function(c,u,w,h,a){
27
+ if(u){
28
+ p.style.backgroundImage='';
29
+ var x=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject('Microsoft.XMLHTTP');
30
+ x.onreadystatechange=function(){
31
+ if(x.readyState==4&&x.status==200){TINY.box.psh(x.responseText,w,h,a)}
32
+ };
33
+ x.open('GET',c,1); x.send(null)
34
+ }else{
35
+ this.psh(c,w,h,a)
36
+ }
37
+ },
38
+ psh:function(c,w,h,a){
39
+ if(a){
40
+ if(!w||!h){
41
+ var x=p.style.width, y=p.style.height; b.innerHTML=c;
42
+ p.style.width=w?w+'px':''; p.style.height=h?h+'px':'';
43
+ b.style.display='';
44
+ w=parseInt(b.offsetWidth); h=parseInt(b.offsetHeight);
45
+ b.style.display='none'; p.style.width=x; p.style.height=y;
46
+ }else{
47
+ b.innerHTML=c
48
+ }
49
+ this.size(p,w,h)
50
+ }else{
51
+ p.style.backgroundImage='none'
52
+ }
53
+ },
54
+ hide:function(){
55
+ TINY.box.alpha(p,-1,0,3)
56
+ },
57
+ resize:function(){
58
+ TINY.box.pos(); TINY.box.mask()
59
+ },
60
+ mask:function(){
61
+ m.style.height=TINY.page.total(1)+'px';
62
+ m.style.width=''; m.style.width=TINY.page.total(0)+'px'
63
+ },
64
+ pos:function(){
65
+ var t=(TINY.page.height()/2)-(p.offsetHeight/2); t=t<10?10:t;
66
+ p.style.top=(t+TINY.page.top())+'px';
67
+ p.style.left=(TINY.page.width()/2)-(p.offsetWidth/2)+'px'
68
+ },
69
+ alpha:function(e,d,a){
70
+ clearInterval(e.ai);
71
+ if(d==1){
72
+ e.style.opacity=0; e.style.filter='alpha(opacity=0)';
73
+ e.style.display='block'; this.pos()
74
+ }
75
+ e.ai=setInterval(function(){TINY.box.ta(e,a,d)},20)
76
+ },
77
+ ta:function(e,a,d){
78
+ var o=Math.round(e.style.opacity*100);
79
+ if(o==a){
80
+ clearInterval(e.ai);
81
+ if(d==-1){
82
+ e.style.display='none';
83
+ e==p?TINY.box.alpha(m,-1,0,2):b.innerHTML=p.style.backgroundImage=''
84
+ }else{
85
+ e==m?this.alpha(p,1,100):TINY.box.fill(ic,iu,iw,ih,ia)
86
+ }
87
+ }else{
88
+ var n=Math.ceil((o+((a-o)*.5))); n=n==1?0:n;
89
+ e.style.opacity=n/100; e.style.filter='alpha(opacity='+n+')'
90
+ }
91
+ },
92
+ size:function(e,w,h){
93
+ e=typeof e=='object'?e:T$(e); clearInterval(e.si);
94
+ var ow=e.offsetWidth, oh=e.offsetHeight,
95
+ wo=ow-parseInt(e.style.width), ho=oh-parseInt(e.style.height);
96
+ var wd=ow-wo>w?0:1, hd=(oh-ho>h)?0:1;
97
+ e.si=setInterval(function(){TINY.box.ts(e,w,wo,wd,h,ho,hd)},20)
98
+ },
99
+ ts:function(e,w,wo,wd,h,ho,hd){
100
+ var ow=e.offsetWidth-wo, oh=e.offsetHeight-ho;
101
+ if(ow==w&&oh==h){
102
+ clearInterval(e.si); p.style.backgroundImage='none'; b.style.display='block'
103
+ }else{
104
+ if(ow!=w){var n=ow+((w-ow)*.5); e.style.width=wd?Math.ceil(n)+'px':Math.floor(n)+'px'}
105
+ if(oh!=h){var n=oh+((h-oh)*.5); e.style.height=hd?Math.ceil(n)+'px':Math.floor(n)+'px'}
106
+ this.pos()
107
+ }
108
+ }
109
+ }
110
+ }();
111
+
112
+ TINY.page=function(){
113
+ return{
114
+ top:function(){return document.documentElement.scrollTop||document.body.scrollTop},
115
+ width:function(){return self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth},
116
+ height:function(){return self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight},
117
+ total:function(d){
118
+ var b=document.body, e=document.documentElement;
119
+ return d?Math.max(Math.max(b.scrollHeight,e.scrollHeight),Math.max(b.clientHeight,e.clientHeight)):
120
+ Math.max(Math.max(b.scrollWidth,e.scrollWidth),Math.max(b.clientWidth,e.clientWidth))
121
+ }
122
+ }
123
+ }();
124
+
125
+
126
+
lib/captcha/ARLRDBD.TTF ADDED
Binary file
lib/captcha/Readme.txt ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Projectname: Simple CAPTCHA class
2
+ Version: 0.1
3
+ Author: Ver Pangonilo <smp@limbofreak.com>
4
+ Last modified: 18 May 2006
5
+ Copyright (C): 2006 Ver Pangonilo, All Rights Reserved
6
+
7
+ * GNU General Public License (Version 2, June 1991)
8
+ *
9
+ * This program is free software; you can redistribute
10
+ * it and/or modify it under the terms of the GNU
11
+ * General Public License as published by the Free
12
+ * Software Foundation; either version 2 of the License,
13
+ * or (at your option) any later version.
14
+ *
15
+ * This program is distributed in the hope that it will
16
+ * be useful, but WITHOUT ANY WARRANTY; without even the
17
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A
18
+ * PARTICULAR PURPOSE. See the GNU General Public License
19
+ * for more details.
20
+
21
+ Description:
22
+ This class can generate CAPTCHAs for user forms. Parameters can be set on the configuration file including transprency.
23
+
24
+ Note:
25
+ The font "BRADHITC.TTF" is required for the default configuration. This is a common script font for Windows. A replace the default font to suit application.
26
+
27
+
28
+
29
+ Usage :
30
+ Create a configuration file which contains the following:
31
+
32
+
33
+ <?
34
+
35
+ session_start();
36
+
37
+ require_once('class.simplecaptcha.php');
38
+
39
+ /*
40
+
41
+ CONFIGURATION STARTS
42
+
43
+ */
44
+ //Background Image
45
+ $config['BackgroundImage'] = "white.png";
46
+
47
+ //Background Color- HEX
48
+ $config['BackgroundColor'] = "FFFC00";
49
+
50
+ //image height - same as background image
51
+ $config['Height']=30;
52
+
53
+ //image width - same as background image
54
+ $config['Width']=100;
55
+
56
+ //text font size
57
+ $config['Font_Size']=20;
58
+
59
+ //text font style
60
+ $config['Font']="BRADHITC.TTF";
61
+
62
+ //text angle to the left
63
+ $config['TextMinimumAngle']=15;
64
+
65
+ //text angle to the right
66
+ $config['TextMaximumAngle']=45;
67
+
68
+ //Text Color - HEX
69
+ $config['TextColor']='000000';
70
+
71
+ //Number of Captcha Code Character
72
+ $config['TextLength']=6;
73
+
74
+ //Background Image Transparency
75
+ // 0 - Not Visible, 100 - Fully Visible
76
+ $config['Transparency']=70;
77
+
78
+ /*
79
+
80
+ CONFIGURATION ENDS
81
+
82
+ */
83
+
84
+
85
+
86
+ //Create a new instance of the captcha
87
+ $captcha = new SimpleCaptcha($config);
88
+
89
+ //Save the code as a session dependent string
90
+ $_SESSION['string'] = $captcha->Code;
91
+
92
+ ?>
93
+
94
+ Save this file as captcha.php or any filename you wish to. In the html form,
95
+ the usage will be
96
+
97
+ <img src="PATH_TO/captcha.php" alt="captcha" width="WIDTH" height="HEIGHT" />
98
+
99
+
100
+
101
+ Limitations:
102
+ 1. Initially, it only uses PNG images.
103
+ 2. The image size should be the same as the background image size.
104
+
105
+
lib/captcha/bradhitc.ttf ADDED
Binary file
lib/captcha/captcha.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ session_start();
3
+
4
+ require_once('class.simplecaptcha.php');
5
+
6
+ /*
7
+ *****CONFIGURATION STARTS*****
8
+ */
9
+ //Background Image
10
+ $config['BackgroundImage'] = "white.png";
11
+
12
+ //Background Color- HEX
13
+ $config['BackgroundColor'] = "FFFC00";
14
+
15
+ //image height - same as background image
16
+ $config['Height']=30;
17
+
18
+ //image width - same as background image
19
+ $config['Width']=100;
20
+
21
+ //text font size
22
+ $config['Font_Size']=23;
23
+
24
+ //text font style
25
+ $config['Font']="BRADHITC.TTF";
26
+
27
+ //text angle to the left
28
+ $config['TextMinimumAngle']=15;
29
+
30
+ //text angle to the right
31
+ $config['TextMaximumAngle']=45;
32
+
33
+ //Text Color - HEX
34
+ $config['TextColor']='000000';
35
+
36
+ //Number of Captcha Code Character
37
+ $config['TextLength']=6;
38
+
39
+ //Background Image Transparency
40
+ $config['Transparency']=50;
41
+
42
+ /*
43
+ *******CONFIGURATION ENDS******
44
+ */
45
+
46
+
47
+
48
+ //Create a new instance of the captcha
49
+ $captcha = new SimpleCaptcha($config);
50
+
51
+ //Save the code as a session dependent string
52
+ $_SESSION['string'] = $captcha->Code;
53
+
54
+
55
+ ?>
lib/captcha/class.simplecaptcha.php ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /******************************************************************
3
+ Projectname: Simple CAPTCHA class
4
+ Version: 0.1
5
+ Author: Ver Pangonilo <smp@limbofreak.com>
6
+ Last modified: 18 May 2006
7
+ Copyright (C): 2006 Ver Pangonilo, All Rights Reserved
8
+
9
+ * GNU General Public License (Version 2, June 1991)
10
+ *
11
+ * This program is free software; you can redistribute
12
+ * it and/or modify it under the terms of the GNU
13
+ * General Public License as published by the Free
14
+ * Software Foundation; either version 2 of the License,
15
+ * or (at your option) any later version.
16
+ *
17
+ * This program is distributed in the hope that it will
18
+ * be useful, but WITHOUT ANY WARRANTY; without even the
19
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A
20
+ * PARTICULAR PURPOSE. See the GNU General Public License
21
+ * for more details.
22
+
23
+ Description:
24
+ This class can generate CAPTCHAs for user forms.
25
+
26
+ ******************************************************************/
27
+
28
+ class SimpleCaptcha {
29
+
30
+ function SimpleCaptcha( $params = null )
31
+ {
32
+ $this->BackgroundImage = $params['BackgroundImage']; //background image
33
+ $this->BackgroundColor = $params['BackgroundColor'];
34
+ $this->Height = $params['Height']; //image height
35
+ $this->Width = $params['Width']; //image width
36
+ $this->FontSize = $params['Font_Size']; //text font size
37
+ $this->Font = $params['Font']; //text font style
38
+ $this->TextMinimumAngle = $params['TextMinimumAngle'];
39
+ $this->TextMaximumAngle = $params['TextMaximumAngle'];
40
+ $this->TextColor = $params['TextColor'];
41
+ $this->TextLength = $params['TextLength'];
42
+ $this->Transparency = $params['Transparency'];
43
+
44
+ $this->generateCode();
45
+ //initially, png is used
46
+ //die($this->Code);
47
+ header("Content-type: image/png");
48
+ $this->generateImage($this->Code);
49
+
50
+ }
51
+ //Background Images
52
+ function getBackgroundImage()
53
+ {
54
+ return $this->BackgroundImage;
55
+ }
56
+
57
+ function setBackgroundImage( $background_image = null )
58
+ {
59
+ $this->BackgroundImage = $background_image;
60
+ }
61
+
62
+ //Backgroung Color
63
+ function getBackgroundColor()
64
+ {
65
+ return $this->BackgroundColor;
66
+ }
67
+
68
+ function setBackgroundColor( $background_color )
69
+ {
70
+ $this->BackgroundColor = $background_color;
71
+
72
+ }
73
+
74
+ //Image Height
75
+ function getHeight()
76
+ {
77
+ return $this->Height;
78
+ }
79
+
80
+ function setHeight( $height = null )
81
+ {
82
+ $this->Height = $height;
83
+ }
84
+ //Image Width
85
+ function getWidth()
86
+ {
87
+ return $this->Width;
88
+ }
89
+
90
+ function setWidth( $width = null )
91
+ {
92
+ $this->Width = $width;
93
+ }
94
+ //Font size
95
+ function getFontSize()
96
+ {
97
+ return $this->FontSize;
98
+ }
99
+
100
+ function setFontSize( $size = null )
101
+ {
102
+ $this->FontSize = $size;
103
+ }
104
+
105
+ //Font
106
+ function getFont()
107
+ {
108
+ return $this->Font;
109
+ }
110
+
111
+ function setFont( $font = null )
112
+ {
113
+ $this->Font = $font;
114
+ }
115
+
116
+ //Text Minimum Angle
117
+ function getTextMinimumAngle()
118
+ {
119
+ return $this->TextMinimumAngle;
120
+ }
121
+
122
+ function setTextMinimumAngle( $minimum_angle = null )
123
+ {
124
+ $this->TextMinimumAngle = $minimum_angle;
125
+ }
126
+
127
+ //Text Maximum Angle
128
+ function getTextMaximumAngle()
129
+ {
130
+ return $this->TextMaximumAngle;
131
+ }
132
+
133
+ function setTextMaximumAngle( $maximum_angle = null )
134
+ {
135
+ $this->TextMaximumAngle = $maximum_angle;
136
+ }
137
+
138
+ //Text Color
139
+ function getTextColor()
140
+ {
141
+ return $this->TextColor;
142
+ }
143
+
144
+ function setTextColor( $text_color )
145
+ {
146
+ $this->TextColor = $text_color;
147
+ }
148
+
149
+ //Text Length
150
+ function getTextLength()
151
+ {
152
+ return $this->TextLength;
153
+ }
154
+
155
+ function setTextLength( $text_length = null )
156
+ {
157
+ $this->TextLength = $text_length;
158
+ }
159
+
160
+ //Transparency
161
+ function getTransparency()
162
+ {
163
+ return $this->Transparency;
164
+ }
165
+
166
+ function setTransparency( $transparency = null )
167
+ {
168
+ $this->Transparency = $transparency;
169
+ }
170
+
171
+ //get Captcha Code
172
+ function getCode()
173
+ {
174
+ return $this->Code;
175
+ }
176
+
177
+ //Generate Captcha
178
+ function generateCode()
179
+ {
180
+ $length = $this->getTextLength();
181
+ $this->Code = "";
182
+ while(strlen($this->Code)<$length){
183
+ mt_srand((double)microtime()*1000000);
184
+ $random=mt_rand(48,122);
185
+ $random=md5($random);
186
+ $this->Code .= substr($random, 17, 1);
187
+ }
188
+
189
+ return $this->Code;
190
+ }
191
+
192
+
193
+ function generateImage($text = null)
194
+ {
195
+ $im = imagecreatefrompng( $this->getBackgroundImage() );
196
+ $tColor = $this->getTextColor();
197
+ $txcolor = $this->colorDecode($tColor);
198
+ $bcolor = $this->getBackgroundColor();
199
+ $bgcolor = $this->colorDecode($bcolor);
200
+ $width = $this->getWidth();
201
+ $height = $this->getHeight();
202
+ $transprency = $this->getTransparency();
203
+ $this->im = imagecreate($width,$height);
204
+ $imgColor = imagecolorallocate($this->im, $bgcolor['red'], $bgcolor['green'], $bgcolor['blue']);
205
+ imagecopymerge($this->im,$im,0,0,0,0,$width,$height,$transprency);
206
+ $textcolor = imagecolorallocate($this->im, $txcolor['red'], $txcolor['green'], $txcolor['blue']);
207
+ $font = $this->getFont();
208
+ $fontsize=$this->getFontSize();
209
+ $minAngle = $this->getTextMinimumAngle();
210
+ $maxAngle = $this->getTextMaximumAngle();
211
+ $length = $this->getTextLength();
212
+
213
+ for($i=0;$i<$length;$i++){
214
+ imagettftext(
215
+ $this->im,
216
+ $fontsize,
217
+ rand(-$minAngle,$maxAngle),
218
+ $i*15+10,
219
+ $this->FontSize*1.2,
220
+ $textcolor,
221
+ $font,
222
+ substr($text, $i, 1));
223
+ }
224
+
225
+ imagepng($this->im);
226
+ imagedestroy($this->im);
227
+ }
228
+
229
+ function colorDecode( $hex ){
230
+
231
+ if(!isset($hex)) return FALSE;
232
+
233
+ $decoded['red'] = hexdec(substr($hex, 0 ,2));
234
+ $decoded['green'] = hexdec(substr($hex, 2 ,2));
235
+ $decoded['blue'] = hexdec(substr($hex, 4 ,2));
236
+
237
+ return $decoded;
238
+
239
+ }
240
+
241
+
242
+ }
243
+
244
+ ?>
lib/captcha/contact.html ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2
+ "http://www.w3.org/TR/html4/loose.dtd">
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6
+ <title>Weight Loss Tricks That Work</title>
7
+ <META NAME="DESCRIPTION" CONTENT="How to Melt Away Body Fat, Lose Weight, and Create Your Ideal Body Easily and Permanently � Even While You Sit in Front of a Computer or Desk All Day">
8
+ <META NAME="KEYWORDS" CONTENT="weight loss, weightloss, lose weight, diet, nutrition, fat loss, body fat, weight reduction, reduce weight, weight management, cyber-age fat burning">
9
+ <meta name="GOOGLEBOT" content="index,follow">
10
+ <META NAME="robots" CONTENT="INDEX,FOLLOW">
11
+ <META NAME="revisit-after" CONTENT="3 Days">
12
+
13
+ <link rel="stylesheet" type="text/css" href="css/main.css">
14
+
15
+ <script language="JavaScript" src="jscript/universal_tag.js"></script>
16
+ <SCRIPT LANGUAGE="JavaScript" src="jscript/rollover.js"></script>
17
+ <script language="javascript" src="jscript/popup_code.js"></script>
18
+ </head>
19
+
20
+ <body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">
21
+
22
+ <div align="center">
23
+
24
+ <table cellpadding="0" cellspacing="0" border="0" background="images/subnav_bg.gif" width="770">
25
+ <tr>
26
+
27
+ <td align="left" style="padding-left:63px;">
28
+ <a href="index.html"><img src="images/subnav_logo.gif" width="242" height="20" alt="" border="0"></a><br>
29
+ </td>
30
+ <td align="right">
31
+ <a href="index.html"><img src="images/subnav_home.gif" width="51" height="20" alt="" border="0"></a><!---<a href="useful_links.html"><img src="images/subnav_links.gif" width="95" height="20" alt="" border="0"></a>---><a href="contact.asp"><img src="images/subnav_contact.gif" width="99" height="20" alt="" border="0"></a><br>
32
+ </td>
33
+ </tr>
34
+ </table>
35
+ <table cellpadding="0" cellspacing="0" border="0">
36
+ <tr>
37
+
38
+ <td>
39
+ <a href="index.html"><img src="images/pic_main.gif" width="408" height="169" alt="" border="0"></a><br>
40
+ </td>
41
+ <td>
42
+ <img src="images/pic_man.jpg" width="181" height="169" alt="" border="0"><br>
43
+ </td>
44
+ <td>
45
+ <img src="images/pic_woman.jpg" width="181" height="169" alt="" border="0"><br>
46
+ </td>
47
+
48
+ </tr>
49
+ </table>
50
+ <table cellpadding="0" cellspacing="0" border="0">
51
+ <tr>
52
+ <td>
53
+ <img src="images/pic_main_bottom.gif" width="179" height="42" alt="" border="0"><br>
54
+ </td>
55
+ <td>
56
+ <a href="index.html" onMouseOver="turnOn('image1')" onMouseOut="turnOff('image1')"><img name="image1" src="images/nav_about_off.gif" width="135" height="42" alt="" border="0"></a><br>
57
+ </td>
58
+
59
+ <td>
60
+ <a href="free_report.html" onMouseOver="turnOn('image2')" onMouseOut="turnOff('image2')"><img name="image2" src="images/nav_report_off.gif" width="155" height="42" alt="" border="0"></a><br>
61
+ </td>
62
+ <td>
63
+ <a href="preview.html" onMouseOver="turnOn('image3')" onMouseOut="turnOff('image3')"><img name="image3" src="images/nav_preview_off.gif" width="155" height="42" alt="" border="0"></a><br>
64
+ </td>
65
+ <td>
66
+ <a href="guarantee.html" onMouseOver="turnOn('image4')" onMouseOut="turnOff('image4')"><img name="image4" src="images/nav_guarantee_off.gif" width="130" height="42" alt="" border="0"></a><br>
67
+ </td>
68
+
69
+ <td>
70
+ <img src="images/nav_end.gif" width="16" height="42" alt="" border="0"><br>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ <table cellpadding="0" cellspacing="0" border="0">
75
+ <tr>
76
+ <td bgcolor="#063D80" width="1">
77
+ <img src="/images/spacer_1x1.gif" width="1" height="1"><br>
78
+ </td>
79
+
80
+ <td valign="top" width="524" class="">
81
+ <div align="left" id="content_main">
82
+
83
+ <div class="page_head" id="page_head">Contact Us<br></div>
84
+ <img id="line" src="images/pixel_red.gif" width="464" height="1" alt="" border="0">
85
+
86
+
87
+
88
+ Please complete the following form to contact us; we will reply within two working days. The information you are providing here will not be sold or disclosed to any outside party.<br>
89
+ <br>
90
+
91
+ (<font color="#C61818">*</font> indicates required fields)<br>
92
+
93
+ <br>
94
+
95
+ <form action="contact.php" method="post">
96
+ <table cellpadding="0" cellspacing="8" border="0">
97
+ <tr>
98
+ <td align="right">
99
+ <font color="#C61818">*</font> Name<br>
100
+ </td>
101
+
102
+ <td>
103
+ <input type="text" name="Name" value="" size="30">
104
+ </td>
105
+ </tr>
106
+ <tr>
107
+ <td align="right">
108
+ Address<br>
109
+ </td>
110
+
111
+ <td>
112
+ <input type="text" name="Address" value="" size="30">
113
+ </td>
114
+ </tr>
115
+ <tr>
116
+ <td align="right">
117
+ City<br>
118
+ </td>
119
+
120
+ <td>
121
+ <input type="text" name="City" value="" size="30">
122
+ </td>
123
+ </tr>
124
+ <tr>
125
+ <td align="right">
126
+ State<br>
127
+ </td>
128
+
129
+ <td>
130
+ <input type="text" name="State" value="" size="10">
131
+ </td>
132
+ </tr>
133
+ <tr>
134
+ <td align="right">
135
+ Zip<br>
136
+ </td>
137
+
138
+ <td>
139
+ <input type="text" name="Zip" value="" size="10">
140
+ </td>
141
+ </tr>
142
+ <tr>
143
+ <td align="right">
144
+ <font color="#C61818">*</font> Telephone Number<br>
145
+
146
+ </td>
147
+ <td>
148
+ <input type="text" name="Telephone" value="" size="15">
149
+ </td>
150
+ </tr>
151
+ <tr>
152
+ <td align="right">
153
+ <font color="#C61818">*</font> E-Mail Address<br>
154
+
155
+ </td>
156
+ <td>
157
+ <input type="text" name="Email" value="" size="30">
158
+ </td>
159
+ </tr>
160
+ <tr>
161
+ <td align="right" valign="top">
162
+ <img src="/images/spacer_1x1.gif" width="1" height="3"><br>
163
+ Message<br>
164
+
165
+ </td>
166
+ <td>
167
+ <textarea name="Message" cols="35" rows="10"></textarea>
168
+ </td>
169
+ </tr>
170
+ <tr>
171
+ <td align="left" valign="top" colspan="2">
172
+ <br>
173
+ <font color="#ff0000"><b>To submit this form, please type in the characters in the box below and click SEND MY MESSAGE NOW:</b></font>
174
+ <br><br>
175
+ <input name="txtcode" class="textField" id="txtcode" type="text">
176
+ <img src="captcha.php" align="absmiddle">
177
+ <br>
178
+ </td>
179
+ </tr>
180
+ <tr>
181
+ <td bgcolor="#f5d29e" colspan="2">
182
+ <b><font color="#ff0000" size="4">NOTE:</font> If the characters are not clear, refresh the screen until you can read them clearly. </b>
183
+ </td>
184
+ </tr>
185
+ <tr>
186
+ <td colspan="2" align="center">
187
+ <br>
188
+ <input type="submit" name="Submit" value="Send My Message Now">
189
+ </td>
190
+ </tr>
191
+ </table>
192
+ </form>
193
+
194
+
195
+
196
+ <img id="line" src="images/pixel_red.gif" width="464" height="1" alt="" border="0"><br>
197
+ <b>Lodix Corporation</b><br>
198
+
199
+ 138 Palm Coast Parkway N.E.<br>
200
+ Suite 192<br>
201
+ Palm Coast, FL 32137<br>
202
+ Phone: 386.304.3804<br>
203
+ E-mail: <a href="mailto:info@weightlosstricksthatwork.com" class="link">info@weightlosstricksthatwork.com</a><br>
204
+
205
+
206
+ </div>
207
+
208
+ <img src="/images/spacer_1x1.gif" width="524" height="1"><br>
209
+ </td>
210
+ <td valign="top" bgcolor="#EDE7CB" width="244">
211
+
212
+ <div align="left" id="side_bar">
213
+ <img src="images/book_cover.jpg" width="185" height="285" alt="" border="0"><br>
214
+ <br>
215
+
216
+ <table cellpadding="0" cellspacing="0" border="0" width="195">
217
+ <tr>
218
+
219
+ <td valign="top" style="padding-top: 2px; padding-right: 10px;">
220
+ <img src="images/arrow.gif" width="14" height="24" alt="" border="0"><br>
221
+ </td>
222
+ <td valign="top" style="padding-bottom: 12px;" class="sidebar">
223
+ Scientifically proven technique that makes your body burn fat <u>all</u> the time � not just when you're exercising, but even as you sit idly at your desk<br>
224
+ </td>
225
+ </tr>
226
+
227
+ <tr>
228
+ <td valign="top" style="padding-top: 2px; padding-right: 10px;">
229
+ <img src="images/arrow.gif" width="14" height="24" alt="" border="0"><br>
230
+ </td>
231
+ <td valign="top" style="padding-bottom: 12px;" class="sidebar">
232
+ Why Low-Fat, Low-Carb and Low-Calorie Diets don't work � and why they are downright dangerous!<br>
233
+ </td>
234
+ </tr>
235
+
236
+ <tr>
237
+ <td valign="top" style="padding-top: 2px; padding-right: 10px;">
238
+ <img src="images/arrow.gif" width="14" height="24" alt="" border="0"><br>
239
+ </td>
240
+ <td valign="top" style="padding-bottom: 12px;" class="sidebar">
241
+ The foods that speed up your metabolism so your body burns<br>fat fast<br>
242
+ </td>
243
+ </tr>
244
+
245
+ </table>
246
+ <br>
247
+ <img src="images/call_to_action.gif" alt="" border="0"><br>
248
+ <br>
249
+ <a href="http://www.1automationwiz.com/app/netcart.asp?MerchantID=77464&ProductID=2692616"><img src="images/order_now_button_sm.gif" width="179" height="49" alt="" border="0"></a><br>
250
+ <br>
251
+ <a href="guarantee.html"><img style="padding-top:5px;" src="images/guarantee.gif" width="175" height="50" alt="" border="0"><br></a>
252
+
253
+ </div>
254
+
255
+ <img src="/images/spacer_1x1.gif" width="244" height="1"><br>
256
+ </td>
257
+ <td bgcolor="#063D80" width="1">
258
+ <img src="/images/spacer_1x1.gif" width="1" height="1"><br>
259
+ </td>
260
+ </tr>
261
+ </table>
262
+
263
+ <table cellpadding="10" cellspacing="0" border="0" width="770">
264
+ <tr>
265
+
266
+ <td bgcolor="#063D80" class="footer">
267
+ <a href="http://www.1automationwiz.com/app/netcart.asp?MerchantID=77464&ProductID=2692616" class="footer">Order the Book Now</a>&nbsp;&nbsp;|&nbsp;
268
+ <a href="contact.asp" class="footer">Contact Us</a>&nbsp;&nbsp;|&nbsp;
269
+ <a href="privacy_policy.html" class="footer">Privacy Policy</a>&nbsp;&nbsp;|&nbsp;
270
+ <!---<a href="affiliate.html" class="footer">Affiliate Program</a>&nbsp;&nbsp;|&nbsp;--->
271
+ <a href="site_map.html" class="footer">Site Map</a><br>
272
+
273
+ </td>
274
+ </tr>
275
+ </table>
276
+ <table cellpadding="20" cellspacing="0" border="0" width="770">
277
+ <tr>
278
+ <td class="copyright" align="left">
279
+ � <a href="site_map.html" class="copyright">Copyright 2006</a> Lodix Corporation<br>
280
+ 138 Palm Coast Parkway N.E., Suite 192, Palm Coast, Florida 32137<br>
281
+
282
+ All rights reserved.<br>
283
+ <br>
284
+ This website, http://www.WeightLossTricksThatWork.com, is published by Lodix Corporaton with the understanding that Lodix Corporation is not engaged in rendering medical advice. Do not attempt a diet and exercise program without consulting a physician. The information on this website has been carefully compiled from sources believed to be accurate and reliable. Lodix Corporation and its employees assume no liability for any errors, or for any actions caused by following the information on this website.<br>
285
+ </td>
286
+ </tr>
287
+ </table>
288
+ <br>
289
+ <br>
290
+ <br>
291
+
292
+ </div>
293
+ </body>
294
+ </html>
lib/captcha/testCaptcha.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /******************************************************************
4
+ Projectname: Simple CAPTCHA class
5
+ Version: 0.1
6
+ Author: Ver Pangonilo <smp@limbofreak.com>
7
+ Last modified: 18 May 2006
8
+ Copyright (C): 2006 Ver Pangonilo, All Rights Reserved
9
+
10
+ * GNU General Public License (Version 2, June 1991)
11
+ *
12
+ * This program is free software; you can redistribute
13
+ * it and/or modify it under the terms of the GNU
14
+ * General Public License as published by the Free
15
+ * Software Foundation; either version 2 of the License,
16
+ * or (at your option) any later version.
17
+ *
18
+ * This program is distributed in the hope that it will
19
+ * be useful, but WITHOUT ANY WARRANTY; without even the
20
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A
21
+ * PARTICULAR PURPOSE. See the GNU General Public License
22
+ * for more details.
23
+
24
+ Description:
25
+ This is an application for the SimpleCaptcha Class in user forms.
26
+
27
+ ******************************************************************/
28
+
29
+ ob_start();
30
+
31
+ session_start();
32
+
33
+ ?>
34
+
35
+ <html>
36
+ <head>
37
+ <title>Simple CAPTCHA Class Application</title>
38
+ </head>
39
+ <body>
40
+ <?php
41
+ if (!$_POST['code'])
42
+ {
43
+ ?>
44
+ <form id="demo" action="<?php echo $_SERVER['PHP_SELF']; ?>?goto=login" method="POST">
45
+
46
+ Message:
47
+ <br/>
48
+ <textarea name="message" cols="25" rows="5" id="message" ></textarea>
49
+ <br/>
50
+ Validation Code:
51
+ <br/>
52
+ <img src="./captcha.php" alt="CAPTCHA">
53
+ <br>
54
+ <input type="text" name="code" size="30">
55
+ <br>
56
+ <input type="submit" value="Go">
57
+ </form>
58
+ <?php
59
+ }else{
60
+
61
+ //Check if userinput and CAPTCHA Code are equal
62
+ if ($_SESSION['string'] == $_POST['code'])
63
+ {
64
+ echo '<script>alert("Correct Code.");history.go(-1);</script>';
65
+ }
66
+ else
67
+ {
68
+ echo '<script>alert("Incorrect Code.");history.go(-1);</script>';
69
+ }
70
+ }
71
+ ?>
72
+ </body>
73
+
74
+ </html>
lib/captcha/times.ttf ADDED
Binary file
lib/captcha/vssver.scc ADDED
Binary file
lib/captcha/white.png ADDED
Binary file
lib/recaptcha/ARLRDBD.TTF ADDED
Binary file
lib/recaptcha/generate_captcha.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //generate a random string
3
+ $md5_hash = md5(rand(0,999));
4
+ //We don�t need a 32 character long string so we trim it down to 5
5
+ $code = substr($md5_hash, 15, 5);
6
+ $width =120;
7
+ $height = 40;
8
+ $font_size = $height * 0.75;
9
+
10
+ $image = imagecreate($width, $height) ;
11
+
12
+ /* set the colours */
13
+
14
+ $background_color = imagecolorallocate($image, 255, 255, 255);
15
+
16
+ $text_color = imagecolorallocate($image, 20, 40, 100);
17
+
18
+ $noise_color = imagecolorallocate($image, 100, 120, 180);
19
+
20
+ /* generate random lines in background */
21
+
22
+ for( $i=0; $i<($width*$height)/150; $i++ ) {
23
+
24
+ imageline($image, mt_rand(0,$width), mt_rand(0,$height), mt_rand(0,$width), mt_rand(0,$height), $noise_color);
25
+
26
+ }
27
+ $font = 'ARLRDBD.ttf';
28
+
29
+ /* create textbox and add text */
30
+
31
+ $textbox = imagettfbbox($font_size, 0, $font, $code) ;
32
+
33
+ $x = ($width - $textbox[4])/2;
34
+
35
+ $y = ($height - $textbox[5])/2;
36
+
37
+ imagettftext($image, $font_size, 0, $x, $y, $text_color, $font , $code) ;
38
+
39
+ /* output captcha image to browser */
40
+
41
+ header("Content-Type: image/jpeg");
42
+
43
+ imagejpeg($image);
44
+
45
+ imagedestroy($image);
46
+
47
+ //save the generated security code as a session variable
48
+
49
+ $_SESSION[�captcha_code�] = $code;
50
+
51
+ ?>
52
+
lib/recaptcha/recaptchalib-aw.php ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * This is a PHP library that handles calling reCAPTCHA.
4
+ * - Documentation and latest version
5
+ * http://recaptcha.net/plugins/php/
6
+ * - Get a reCAPTCHA API Key
7
+ * http://recaptcha.net/api/getkey
8
+ * - Discussion group
9
+ * http://groups.google.com/group/recaptcha
10
+ *
11
+ * Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net
12
+ * AUTHORS:
13
+ * Mike Crawford
14
+ * Ben Maurer
15
+ *
16
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
17
+ * of this software and associated documentation files (the "Software"), to deal
18
+ * in the Software without restriction, including without limitation the rights
19
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20
+ * copies of the Software, and to permit persons to whom the Software is
21
+ * furnished to do so, subject to the following conditions:
22
+ *
23
+ * The above copyright notice and this permission notice shall be included in
24
+ * all copies or substantial portions of the Software.
25
+ *
26
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
32
+ * THE SOFTWARE.
33
+ */
34
+
35
+ /**
36
+ * The reCAPTCHA server URL's
37
+ */
38
+ define("RECAPTCHA_API_SERVER", "http://api.recaptcha.net");
39
+ define("RECAPTCHA_API_SECURE_SERVER", "https://api-secure.recaptcha.net");
40
+ define("RECAPTCHA_VERIFY_SERVER", "api-verify.recaptcha.net");
41
+
42
+ /**
43
+ * Encodes the given data into a query string format
44
+ * @param $data - array of string elements to be encoded
45
+ * @return string - encoded request
46
+ */
47
+ function _recaptcha_qsencode ($data) {
48
+ $req = "";
49
+ foreach ( $data as $key => $value )
50
+ $req .= $key . '=' . urlencode( stripslashes($value) ) . '&';
51
+
52
+ // Cut the last '&'
53
+ $req=substr($req,0,strlen($req)-1);
54
+ return $req;
55
+ }
56
+
57
+
58
+
59
+ /**
60
+ * Submits an HTTP POST to a reCAPTCHA server
61
+ * @param string $host
62
+ * @param string $path
63
+ * @param array $data
64
+ * @param int port
65
+ * @return array response
66
+ */
67
+ function _recaptcha_http_post($host, $path, $data, $port = 80) {
68
+
69
+ $req = _recaptcha_qsencode ($data);
70
+
71
+ $http_request = "POST $path HTTP/1.0\r\n";
72
+ $http_request .= "Host: $host\r\n";
73
+ $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
74
+ $http_request .= "Content-Length: " . strlen($req) . "\r\n";
75
+ $http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
76
+ $http_request .= "\r\n";
77
+ $http_request .= $req;
78
+
79
+ $response = '';
80
+ if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) {
81
+ die ('Could not open socket');
82
+ }
83
+
84
+ fwrite($fs, $http_request);
85
+
86
+ while ( !feof($fs) )
87
+ $response .= fgets($fs, 1160); // One TCP-IP packet
88
+ fclose($fs);
89
+ $response = explode("\r\n\r\n", $response, 2);
90
+
91
+ return $response;
92
+ }
93
+
94
+
95
+
96
+ /**
97
+ * Gets the challenge HTML (javascript and non-javascript version).
98
+ * This is called from the browser, and the resulting reCAPTCHA HTML widget
99
+ * is embedded within the HTML form it was called from.
100
+ * @param string $pubkey A public key for reCAPTCHA
101
+ * @param string $error The error given by reCAPTCHA (optional, default is null)
102
+ * @param boolean $use_ssl Should the request be made over ssl? (optional, default is false)
103
+
104
+ * @return string - The HTML to be embedded in the user's form.
105
+ */
106
+ function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
107
+ {
108
+ if ($pubkey == null || $pubkey == '') {
109
+ die ("To use reCAPTCHA you must get an API key from <a href='http://recaptcha.net/api/getkey'>http://recaptcha.net/api/getkey</a>");
110
+ }
111
+
112
+ if ($use_ssl) {
113
+ $server = RECAPTCHA_API_SECURE_SERVER;
114
+ } else {
115
+ $server = RECAPTCHA_API_SERVER;
116
+ }
117
+
118
+ $errorpart = "";
119
+ if ($error) {
120
+ $errorpart = "&amp;error=" . $error;
121
+ }
122
+ return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
123
+
124
+ <noscript>
125
+ <iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
126
+ <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
127
+ <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
128
+ </noscript>';
129
+ }
130
+
131
+
132
+
133
+
134
+ /**
135
+ * A ReCaptchaResponse is returned from recaptcha_check_answer()
136
+ */
137
+ class ReCaptchaResponse {
138
+ var $is_valid;
139
+ var $error;
140
+ }
141
+
142
+
143
+ /**
144
+ * Calls an HTTP POST function to verify if the user's guess was correct
145
+ * @param string $privkey
146
+ * @param string $remoteip
147
+ * @param string $challenge
148
+ * @param string $response
149
+ * @param array $extra_params an array of extra variables to post to the server
150
+ * @return ReCaptchaResponse
151
+ */
152
+ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array())
153
+ {
154
+ if ($privkey == null || $privkey == '') {
155
+ die ("To use reCAPTCHA you must get an API key from <a href='http://recaptcha.net/api/getkey'>http://recaptcha.net/api/getkey</a>");
156
+ }
157
+
158
+ if ($remoteip == null || $remoteip == '') {
159
+ die ("For security reasons, you must pass the remote ip to reCAPTCHA");
160
+ }
161
+
162
+
163
+
164
+ //discard spam submissions
165
+ if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
166
+ $recaptcha_response = new ReCaptchaResponse();
167
+ $recaptcha_response->is_valid = false;
168
+ $recaptcha_response->error = 'incorrect-captcha-sol';
169
+ return $recaptcha_response;
170
+ }
171
+
172
+ $response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/verify",
173
+ array (
174
+ 'privatekey' => $privkey,
175
+ 'remoteip' => $remoteip,
176
+ 'challenge' => $challenge,
177
+ 'response' => $response
178
+ ) + $extra_params
179
+ );
180
+
181
+ $answers = explode ("\n", $response [1]);
182
+ $recaptcha_response = new ReCaptchaResponse();
183
+
184
+ if (trim ($answers [0]) == 'true') {
185
+ $recaptcha_response->is_valid = true;
186
+ }
187
+ else {
188
+ $recaptcha_response->is_valid = false;
189
+ $recaptcha_response->error = $answers [1];
190
+ }
191
+ return $recaptcha_response;
192
+
193
+ }
194
+
195
+ /**
196
+ * gets a URL where the user can sign up for reCAPTCHA. If your application
197
+ * has a configuration page where you enter a key, you should provide a link
198
+ * using this function.
199
+ * @param string $domain The domain where the page is hosted
200
+ * @param string $appname The name of your application
201
+ */
202
+ function recaptcha_get_signup_url ($domain = null, $appname = null) {
203
+ return "http://recaptcha.net/api/getkey?" . _recaptcha_qsencode (array ('domain' => $domain, 'app' => $appname));
204
+ }
205
+
206
+ function _recaptcha_aes_pad($val) {
207
+ $block_size = 16;
208
+ $numpad = $block_size - (strlen ($val) % $block_size);
209
+ return str_pad($val, strlen ($val) + $numpad, chr($numpad));
210
+ }
211
+
212
+ /* Mailhide related code */
213
+
214
+ function _recaptcha_aes_encrypt($val,$ky) {
215
+ if (! function_exists ("mcrypt_encrypt")) {
216
+ die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
217
+ }
218
+ $mode=MCRYPT_MODE_CBC;
219
+ $enc=MCRYPT_RIJNDAEL_128;
220
+ $val=_recaptcha_aes_pad($val);
221
+ return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
222
+ }
223
+
224
+
225
+ function _recaptcha_mailhide_urlbase64 ($x) {
226
+ return strtr(base64_encode ($x), '+/', '-_');
227
+ }
228
+
229
+ /* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
230
+ function recaptcha_mailhide_url($pubkey, $privkey, $email) {
231
+ if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
232
+ die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
233
+ "you can do so at <a href='http://mailhide.recaptcha.net/apikey'>http://mailhide.recaptcha.net/apikey</a>");
234
+ }
235
+
236
+
237
+ $ky = pack('H*', $privkey);
238
+ $cryptmail = _recaptcha_aes_encrypt ($email, $ky);
239
+
240
+ return "http://mailhide.recaptcha.net/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
241
+ }
242
+
243
+ /**
244
+ * gets the parts of the email to expose to the user.
245
+ * eg, given johndoe@example,com return ["john", "example.com"].
246
+ * the email is then displayed as john...@example.com
247
+ */
248
+ function _recaptcha_mailhide_email_parts ($email) {
249
+ $arr = preg_split("/@/", $email );
250
+
251
+ if (strlen ($arr[0]) <= 4) {
252
+ $arr[0] = substr ($arr[0], 0, 1);
253
+ } else if (strlen ($arr[0]) <= 6) {
254
+ $arr[0] = substr ($arr[0], 0, 3);
255
+ } else {
256
+ $arr[0] = substr ($arr[0], 0, 4);
257
+ }
258
+ return $arr;
259
+ }
260
+
261
+ /**
262
+ * Gets html to display an email address given a public an private key.
263
+ * to get a key, go to:
264
+ *
265
+ * http://mailhide.recaptcha.net/apikey
266
+ */
267
+ function recaptcha_mailhide_html($pubkey, $privkey, $email) {
268
+ $emailparts = _recaptcha_mailhide_email_parts ($email);
269
+ $url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
270
+
271
+ return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) .
272
+ "' onclick=\"window.open('" . htmlentities ($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ($emailparts [1]);
273
+
274
+ }
275
+
276
+
277
+ ?>
lib/recaptcha/recaptchalib.php ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * This is a PHP library that handles calling reCAPTCHA.
4
+ * - Documentation and latest version
5
+ * http://recaptcha.net/plugins/php/
6
+ * - Get a reCAPTCHA API Key
7
+ * http://recaptcha.net/api/getkey
8
+ * - Discussion group
9
+ * http://groups.google.com/group/recaptcha
10
+ *
11
+ * Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net
12
+ * AUTHORS:
13
+ * Mike Crawford
14
+ * Ben Maurer
15
+ *
16
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
17
+ * of this software and associated documentation files (the "Software"), to deal
18
+ * in the Software without restriction, including without limitation the rights
19
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20
+ * copies of the Software, and to permit persons to whom the Software is
21
+ * furnished to do so, subject to the following conditions:
22
+ *
23
+ * The above copyright notice and this permission notice shall be included in
24
+ * all copies or substantial portions of the Software.
25
+ *
26
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
32
+ * THE SOFTWARE.
33
+ */
34
+
35
+ /**
36
+ * The reCAPTCHA server URL's
37
+ */
38
+ define("RECAPTCHA_API_SERVER", "http://api.recaptcha.net");
39
+ define("RECAPTCHA_API_SECURE_SERVER", "https://api-secure.recaptcha.net");
40
+ define("RECAPTCHA_VERIFY_SERVER", "api-verify.recaptcha.net");
41
+
42
+ /**
43
+ * Encodes the given data into a query string format
44
+ * @param $data - array of string elements to be encoded
45
+ * @return string - encoded request
46
+ */
47
+ function _recaptcha_qsencode ($data) {
48
+ $req = "";
49
+ foreach ( $data as $key => $value )
50
+ $req .= $key . '=' . urlencode( stripslashes($value) ) . '&';
51
+
52
+ // Cut the last '&'
53
+ $req=substr($req,0,strlen($req)-1);
54
+ return $req;
55
+ }
56
+
57
+
58
+
59
+ /**
60
+ * Submits an HTTP POST to a reCAPTCHA server
61
+ * @param string $host
62
+ * @param string $path
63
+ * @param array $data
64
+ * @param int port
65
+ * @return array response
66
+ */
67
+ function _recaptcha_http_post($host, $path, $data, $port = 80) {
68
+
69
+ $req = _recaptcha_qsencode ($data);
70
+
71
+ $http_request = "POST $path HTTP/1.0\r\n";
72
+ $http_request .= "Host: $host\r\n";
73
+ $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
74
+ $http_request .= "Content-Length: " . strlen($req) . "\r\n";
75
+ $http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
76
+ $http_request .= "\r\n";
77
+ $http_request .= $req;
78
+
79
+ $response = '';
80
+ if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) {
81
+ die ('Could not open socket');
82
+ }
83
+
84
+ fwrite($fs, $http_request);
85
+
86
+ while ( !feof($fs) )
87
+ $response .= fgets($fs, 1160); // One TCP-IP packet
88
+ fclose($fs);
89
+ $response = explode("\r\n\r\n", $response, 2);
90
+
91
+ return $response;
92
+ }
93
+
94
+
95
+
96
+ /**
97
+ * Gets the challenge HTML (javascript and non-javascript version).
98
+ * This is called from the browser, and the resulting reCAPTCHA HTML widget
99
+ * is embedded within the HTML form it was called from.
100
+ * @param string $pubkey A public key for reCAPTCHA
101
+ * @param string $error The error given by reCAPTCHA (optional, default is null)
102
+ * @param boolean $use_ssl Should the request be made over ssl? (optional, default is false)
103
+
104
+ * @return string - The HTML to be embedded in the user's form.
105
+ */
106
+ function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
107
+ {
108
+ if ($pubkey == null || $pubkey == '') {
109
+ die ("To use reCAPTCHA you must get an API key from <a href='http://recaptcha.net/api/getkey'>http://recaptcha.net/api/getkey</a>");
110
+ }
111
+
112
+ if ($use_ssl) {
113
+ $server = RECAPTCHA_API_SECURE_SERVER;
114
+ } else {
115
+ $server = RECAPTCHA_API_SERVER;
116
+ }
117
+
118
+ $errorpart = "";
119
+ if ($error) {
120
+ $errorpart = "&amp;error=" . $error;
121
+ }
122
+ return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
123
+
124
+ <noscript>
125
+ <iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
126
+ <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
127
+ <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
128
+ </noscript>';
129
+ }
130
+
131
+
132
+
133
+
134
+ /**
135
+ * A ReCaptchaResponse is returned from recaptcha_check_answer()
136
+ */
137
+ class ReCaptchaResponse {
138
+ var $is_valid;
139
+ var $error;
140
+ }
141
+
142
+
143
+ /**
144
+ * Calls an HTTP POST function to verify if the user's guess was correct
145
+ * @param string $privkey
146
+ * @param string $remoteip
147
+ * @param string $challenge
148
+ * @param string $response
149
+ * @param array $extra_params an array of extra variables to post to the server
150
+ * @return ReCaptchaResponse
151
+ */
152
+ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array())
153
+ {
154
+ if ($privkey == null || $privkey == '') {
155
+ die ("To use reCAPTCHA you must get an API key from <a href='http://recaptcha.net/api/getkey'>http://recaptcha.net/api/getkey</a>");
156
+ }
157
+
158
+ if ($remoteip == null || $remoteip == '') {
159
+ die ("For security reasons, you must pass the remote ip to reCAPTCHA");
160
+ }
161
+
162
+
163
+
164
+ //discard spam submissions
165
+ if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
166
+ $recaptcha_response = new ReCaptchaResponse();
167
+ $recaptcha_response->is_valid = false;
168
+ $recaptcha_response->error = 'incorrect-captcha-sol';
169
+ return $recaptcha_response;
170
+ }
171
+
172
+ $response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/verify",
173
+ array (
174
+ 'privatekey' => $privkey,
175
+ 'remoteip' => $remoteip,
176
+ 'challenge' => $challenge,
177
+ 'response' => $response
178
+ ) + $extra_params
179
+ );
180
+
181
+ $answers = explode ("\n", $response [1]);
182
+ $recaptcha_response = new ReCaptchaResponse();
183
+
184
+ if (trim ($answers [0]) == 'true') {
185
+ $recaptcha_response->is_valid = true;
186
+ }
187
+ else {
188
+ $recaptcha_response->is_valid = false;
189
+ $recaptcha_response->error = $answers [1];
190
+ }
191
+ return $recaptcha_response;
192
+
193
+ }
194
+
195
+ /**
196
+ * gets a URL where the user can sign up for reCAPTCHA. If your application
197
+ * has a configuration page where you enter a key, you should provide a link
198
+ * using this function.
199
+ * @param string $domain The domain where the page is hosted
200
+ * @param string $appname The name of your application
201
+ */
202
+ function recaptcha_get_signup_url ($domain = null, $appname = null) {
203
+ return "http://recaptcha.net/api/getkey?" . _recaptcha_qsencode (array ('domain' => $domain, 'app' => $appname));
204
+ }
205
+
206
+ function _recaptcha_aes_pad($val) {
207
+ $block_size = 16;
208
+ $numpad = $block_size - (strlen ($val) % $block_size);
209
+ return str_pad($val, strlen ($val) + $numpad, chr($numpad));
210
+ }
211
+
212
+ /* Mailhide related code */
213
+
214
+ function _recaptcha_aes_encrypt($val,$ky) {
215
+ if (! function_exists ("mcrypt_encrypt")) {
216
+ die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
217
+ }
218
+ $mode=MCRYPT_MODE_CBC;
219
+ $enc=MCRYPT_RIJNDAEL_128;
220
+ $val=_recaptcha_aes_pad($val);
221
+ return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
222
+ }
223
+
224
+
225
+ function _recaptcha_mailhide_urlbase64 ($x) {
226
+ return strtr(base64_encode ($x), '+/', '-_');
227
+ }
228
+
229
+ /* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
230
+ function recaptcha_mailhide_url($pubkey, $privkey, $email) {
231
+ if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
232
+ die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
233
+ "you can do so at <a href='http://mailhide.recaptcha.net/apikey'>http://mailhide.recaptcha.net/apikey</a>");
234
+ }
235
+
236
+
237
+ $ky = pack('H*', $privkey);
238
+ $cryptmail = _recaptcha_aes_encrypt ($email, $ky);
239
+
240
+ return "http://mailhide.recaptcha.net/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
241
+ }
242
+
243
+ /**
244
+ * gets the parts of the email to expose to the user.
245
+ * eg, given johndoe@example,com return ["john", "example.com"].
246
+ * the email is then displayed as john...@example.com
247
+ */
248
+ function _recaptcha_mailhide_email_parts ($email) {
249
+ $arr = preg_split("/@/", $email );
250
+
251
+ if (strlen ($arr[0]) <= 4) {
252
+ $arr[0] = substr ($arr[0], 0, 1);
253
+ } else if (strlen ($arr[0]) <= 6) {
254
+ $arr[0] = substr ($arr[0], 0, 3);
255
+ } else {
256
+ $arr[0] = substr ($arr[0], 0, 4);
257
+ }
258
+ return $arr;
259
+ }
260
+
261
+ /**
262
+ * Gets html to display an email address given a public an private key.
263
+ * to get a key, go to:
264
+ *
265
+ * http://mailhide.recaptcha.net/apikey
266
+ */
267
+ function recaptcha_mailhide_html($pubkey, $privkey, $email) {
268
+ $emailparts = _recaptcha_mailhide_email_parts ($email);
269
+ $url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
270
+
271
+ return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) .
272
+ "' onclick=\"window.open('" . htmlentities ($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ($emailparts [1]);
273
+
274
+ }
275
+
276
+
277
+ ?>
lib/recaptcha/vssver.scc ADDED
Binary file
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Magestore_Product_Contact</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSLv3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Magestore_Productcontact</summary>
10
+ <description>Magestore_Productcontact</description>
11
+ <notes>Magestore Productcontact</notes>
12
+ <authors><author><name>magestore</name><user>magestore</user><email>info@magestore.com</email></author></authors>
13
+ <date>2012-03-26</date>
14
+ <time>03:48:07</time>
15
+ <contents><target name="magelocal"><dir name="Magestore"><dir name="Productcontact"><dir name="Block"><dir name="Adminhtml"><dir name="Productcontact"><dir name="Edit"><file name="Form.php" hash="358de85dd0838300897405183a0c8ddc"/><dir name="Tab"><file name="Form.php" hash="2724fb54c9ab27f54243f059becd730a"/></dir><file name="Tabs.php" hash="daa84ab12b3b2586a16e417f4f0f9c66"/></dir><file name="Edit.php" hash="7f60aa791eea29bf7f64b2dc89d18b77"/><file name="Grid.php" hash="c537a044354d707670eefe30395fc847"/><dir name="Renderer"><file name="Customeremail.php" hash="23a236bf8ee28d163c32365026342bc8"/><file name="Productname.php" hash="6319da10717e9dc1350e1351508376aa"/></dir><file name="View.php" hash="7bba396fe5eeabc35ec064cff5087795"/></dir><file name="Productcontact.php" hash="c6eda96fd96657e029a3f1af38eb9db5"/></dir><file name="Productcontact.php" hash="3b7743c224e98e20109ebe37a0858d09"/><file name="Sendtoadmin.php" hash="70841ac2993badf0d51f50a80e183571"/><file name="Sendtocustomer.php" hash="526be1f80b8abd75ae4875d7c33815d9"/></dir><dir name="Helper"><file name="Data.php" hash="709fb111af7a61b57d7ee65bd90bb5d6"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Productcontact"><file name="Collection.php" hash="3599252638e551928b998eccb1fcbae7"/></dir><file name="Productcontact.php" hash="eac7194de77d6bdb634c9fad5fb3b7c8"/></dir><file name="Productcontact.php" hash="36f71f093c9517d8e9ca26f4a773c2c9"/><file name="Status.php" hash="175870d45501336c30a775d27ee4f320"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ProductcontactController.php" hash="c76693ead5905e5c65e32276a8bc9049"/></dir><file name="IndexController.php" hash="f27255e5780a265006f074fd5242593d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="522309133806e3c3df60f984b5b8d180"/><file name="config.xml" hash="22f6ae983f904ebc3cf76c7b1d7e324d"/><file name="system.xml" hash="564096c34a7eda99c2119eb515158699"/></dir><dir name="sql"><dir name="productcontact_setup"><file name="mysql4-install-0.1.0.php" hash="fdbbaaa9f5b0db42b02e07c62de927a6"/></dir></dir></dir><dir name="Magenotification"><dir name="Block"><dir name="Adminhtml"><dir name="Feedback"><dir name="Edit"><file name="Form.php" hash="ff965acdbee7128894e462aacedcc398"/><dir name="Tab"><file name="Form.php" hash="3d2b966840f60187ff33270d55ae9574"/><file name="History.php" hash="3416d6c4ea4739d658730cda7811ec39"/><file name="Message.php" hash="d0919f3db9cbbf3f0aa960712d212631"/></dir><file name="Tabs.php" hash="7693686764e2ea6cb1bdc3b83812f179"/></dir><file name="Edit.php" hash="b502e877ae329f92a9fefbe894f66ed5"/><file name="Grid.php" hash="fbc85ffbf0773757d20c3bcc99a06698"/><dir name="Renderer"><file name="File.php" hash="caec435c83f133bd32132cc3f1d5fa1b"/><file name="Product.php" hash="17680a600b75b93e9d41f3afd8e74c8e"/><file name="Sentstatus.php" hash="1a8323870b96cab255a5cdf28f849503"/><file name="Status.php" hash="78030c6ff5c27edf563e6031f1ea9d33"/></dir></dir><file name="Feedback.php" hash="95eafe4c9b06ea1f3f7c822c5c634a1e"/><dir name="License"><file name="Purchaseform.php" hash="45bf206a6e54a473e256847ca30c273f"/><file name="Updateform.php" hash="f32762d18533e03fd4330fa925a79a57"/></dir></dir><dir name="Config"><file name="Extensionkeys.php" hash="caede1f99240fcef7301344ec5390091"/><file name="Field.php" hash="cfaf7f736a61113b93d6b4ea6df555e0"/><file name="Label.php" hash="5e4a80b056bc66ee238e9f19a1fea641"/></dir></dir><dir name="Helper"><file name="Data.php" hash="dd57e40800fea4d3e11ab071471a7d7e"/><file name="Feedback.php" hash="1875957d12bb23053fdd060a50468b77"/><file name="License.php" hash="488897bcd509386cd254e7d5f2f614a3"/></dir><dir name="Model"><file name="Feedback.php" hash="c4a22079db6cbbe76a80a6d98b3732a7"/><file name="Feedbackmessage.php" hash="2bbe10dae7cf63da867ee0f6d0399fff"/><file name="Keygen.php" hash="ed3aa7c6da7931e68cc69401b1b971b5"/><file name="Logger.php" hash="6e6b9c8a6626ba2d887f7ea8b5cb4903"/><file name="Magenotification.php" hash="d0924fab55bcc34cc55b656dad32c89a"/><dir name="Mysql4"><dir name="Feedback"><file name="Collection.php" hash="2b7d32d861e61cdd8dfc317162afc24b"/></dir><file name="Feedback.php" hash="ceaf546e1ae1109debdca1a2f8bd1045"/><dir name="Feedbackmessage"><file name="Collection.php" hash="f43a98274f307ec7a5bc4de50652abab"/></dir><file name="Feedbackmessage.php" hash="fbc315bcc9ac0cddc29a51fbd9745327"/><dir name="Logger"><file name="Collection.php" hash="027c25b0aa0c449a280bc17342bac248"/></dir><file name="Logger.php" hash="66dcc4eb1f8dd26e59552e28edcbdc77"/><dir name="Magenotification"><file name="Collection.php" hash="7859b80ac9a3b37765a4b1140de343a9"/></dir><file name="Magenotification.php" hash="d0effb08b44e58cd484dd5bd21da5e38"/></dir><file name="Observer.php" hash="283951a2680a876675630281c6ca416d"/><dir name="Source"><file name="Time.php" hash="33236ea396f02464dba81bf384362a27"/></dir><file name="Status.php" hash="ca2c85ad22dbe6e97231081acfbb42b1"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FeedbackController.php" hash="d3a4b8ddf63f2f3d82e5a25f8f181345"/><file name="LicenseController.php" hash="dfb749333b38ed0b2093eb84078ae999"/><file name="MagenotificationController.php" hash="c4f9ff5a921a960800b5eae73cb6013a"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="2debbbc91d451786252d75ce13a0961e"/><file name="config.xml" hash="ef70f64f2ef61c0fc4514c64736eab63"/><file name="system.xml" hash="173dbfb5e8fac653ad93c1f40540e44a"/></dir><dir name="sql"><dir name="magenotification_setup"><file name="mysql4-install-0.1.0.php" hash="d5f1828751d561102cb8268e2505a2c2"/><file name="mysql4-install-0.1.1.php" hash="5ff9f5261e0087305c425471bd95f9ef"/><file name="mysql4-install-0.1.2.php" hash="74df00189812cc48e07807d4e67c532e"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="ee6cae2c85033cdf549d2c490b90b1b0"/><file name="mysql4-upgrade-0.1.0-0.1.2.php" hash="8833e8e06f11bcd4c421d35f10c5def2"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="741f09f46da1747f027d3fc87d321a2e"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="productcontact.xml" hash="1f1fb87e986d87ef8c7be9d98c58955f"/><file name="magenotification.xml" hash="9d48e23443cdd5007efbe56661482314"/></dir><dir name="template"><dir name="productcontact"><file name="view.phtml" hash="173b11da2254c22e6ec06e500a7504eb"/></dir><dir name="magenotification"><dir name="feedback"><file name="files.phtml" hash="55a255047fd65a80d4429cc5d6d6aad1"/><file name="history.phtml" hash="ba31f13ff51489483395e28144d1217e"/></dir><dir name="license"><file name="purchaseform.phtml" hash="5a39b6087f4f538a6094ecb66d6f8c0b"/><file name="updateform.phtml" hash="df016f551674df7b112af728ccb8249c"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="productcontact.xml" hash="04e30fdaebe98faab49500f340c400dc"/></dir><dir name="template"><dir name="productcontact"><file name="contact_form.phtml" hash="c997af1fae89b6fdcf0971bab93005cb"/><dir name="email"><file name="sendtoadmin.phtml" hash="a480d40c71d49e210c7844f9dee3d93c"/><file name="sendtocustomer.phtml" hash="6ae73021d165cce1757905288e7301c1"/></dir><file name="productcontact.phtml" hash="c32b4e13bbab5d6de1f09cdb4d8a1c5b"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magestore_Productcontact.xml" hash="7e52c3ab20856024af4aff98a3a1cc83"/><file name="Magestore_Magenotification.xml" hash="940e13b33cbf2e9452ecdc231b5868b9"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Magestore_Productcontact.csv" hash="bfcbf4faeff432de0eb0dbb7a3e1ba89"/><dir name="template"><dir name="email"><dir name="productcontact"><file name="email-to-admin.html" hash="fadde910fe7e53f188fa814541b4fd92"/><file name="email-to-customer.html" hash="22ad8b08e2b433335c0e2e0429e74a0b"/></dir></dir></dir></dir></target><target name="magelib"><dir name="captcha"><file name="ARLRDBD.TTF" hash="2d1068a7f51e1fc2c63d81165bf52422"/><file name="Readme.txt" hash="3581ba3cbb7a1a1b3ef6f96989e19eb2"/><file name="bradhitc.ttf" hash="240f5365316d9d6acce08753b5a3a28d"/><file name="captcha.php" hash="65a47267db9f1d3145f28715714777d0"/><file name="class.simplecaptcha.php" hash="ac71cede02920a6b6c2f3c4148756cc4"/><file name="contact.html" hash="46e982ff84c67c9a8dcf08b338ae82f1"/><file name="testCaptcha.php" hash="661d4e4c4af82309f70bbbce512887a1"/><file name="times.ttf" hash="7b58b97fe9788e2dbd80b4422f70632a"/><file name="vssver.scc" hash="50330959ca1106bbf33a69f2b7885775"/><file name="white.png" hash="04a96d36fc8e244539f604944ceb18b3"/></dir><dir name="recaptcha"><file name="ARLRDBD.TTF" hash="2d1068a7f51e1fc2c63d81165bf52422"/><file name="generate_captcha.php" hash="f77f1ad947659d56e7b872fffe19fe3d"/><file name="recaptchalib-aw.php" hash="d5c9e8dd05f35f978887c63a1e9a00dd"/><file name="recaptchalib.php" hash="d5c9e8dd05f35f978887c63a1e9a00dd"/><file name="vssver.scc" hash="64a7f669ba24b1879437e504f2aa2aed"/></dir></target><target name="mageweb"><dir name="js"><dir name="magestore"><file name="productcontact.js" hash="d2edd10f78e57de69f75b3b6b26126d5"/></dir><dir name="tinybox"><file name="tinybox.js" hash="2ca7fcb7fefc5e8d85887f3c6dc6e315"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="productcontact"><file name="productcontact.css" hash="24804061677d5d6708a3faac055d06fb"/></dir><dir name="css"><dir name="magestore"><file name="magenotification.css" hash="6fc00a4e8aa9106db4e62420ebc9efe9"/><file name="notice_price.gif" hash="4b38fffa255125c1e6cdfdd740dd2e56"/></dir><dir name="tinybox"><dir name="images"><file name="preload.gif" hash="bf3ec68db23e93ba2ec795ef558e96da"/><file name="rhino.jpg" hash="d00bad1ec05584e10a5601ec103aff72"/></dir><file name="style.css" hash="e3016ee232fbf3c6f780255002703237"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="css"><dir name="magestore"><file name="productcontact.css" hash=""/></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/adminhtml/default/default/css/magestore/magenotification.css ADDED
@@ -0,0 +1 @@
 
1
+ .licensekey-warning {background: url(notice_price.gif) top left no-repeat;padding:0 0 0 20px;}
skin/adminhtml/default/default/css/magestore/notice_price.gif ADDED
Binary file
skin/adminhtml/default/default/css/tinybox/images/preload.gif ADDED
Binary file
skin/adminhtml/default/default/css/tinybox/images/rhino.jpg ADDED
Binary file
skin/adminhtml/default/default/css/tinybox/style.css ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ body {height:100%; margin:0px; padding:0}
2
+
3
+ #tinybox {position:absolute; display:none; padding:10px; background:#fff url(images/preload.gif) no-repeat 50% 50%; border:10px solid #e3e3e3; z-index:2000}
4
+ #tinymask {position:absolute; display:none; top:0; left:0; height:100%; width:100%; background:#000; z-index:1500}
5
+ #tinycontent {background:#fff}
6
+
7
+ .button {margin-bottom:10px; padding:8px 10px 9px; border:1px solid #ccc; background:#eee; cursor:pointer}
8
+ .button:hover {border:1px solid #bbb; background:#e3e3e3}
skin/adminhtml/default/default/productcontact/productcontact.css ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ #productContact-table .entry-edit-head{width:712px !important;}
2
+ #productContact-table fieldset{width:700px !important;}
3
+
4
+ #productContact-table table tr td{padding:5px 0px;}