Magerevol_Quickcontact - Version 1.0.0

Version Notes

Stable version of Quick Contact magento extension.

Download this release

Release Info

Developer Magerevol Magento Extensions
Extension Magerevol_Quickcontact
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (30) hide show
  1. app/code/local/Magerevol/Quickcontact/Block/Adminhtml/Quickcontact.php +30 -0
  2. app/code/local/Magerevol/Quickcontact/Block/Adminhtml/Quickcontact/Edit.php +61 -0
  3. app/code/local/Magerevol/Quickcontact/Block/Adminhtml/Quickcontact/Edit/Form.php +34 -0
  4. app/code/local/Magerevol/Quickcontact/Block/Adminhtml/Quickcontact/Edit/Tab/Form.php +71 -0
  5. app/code/local/Magerevol/Quickcontact/Block/Adminhtml/Quickcontact/Edit/Tabs.php +39 -0
  6. app/code/local/Magerevol/Quickcontact/Block/Adminhtml/Quickcontact/Grid.php +145 -0
  7. app/code/local/Magerevol/Quickcontact/Block/Form.php +33 -0
  8. app/code/local/Magerevol/Quickcontact/Block/Quickcontact.php +33 -0
  9. app/code/local/Magerevol/Quickcontact/Helper/Data.php +157 -0
  10. app/code/local/Magerevol/Quickcontact/Model/Mysql4/Quickcontact.php +25 -0
  11. app/code/local/Magerevol/Quickcontact/Model/Mysql4/Quickcontact/Collection.php +25 -0
  12. app/code/local/Magerevol/Quickcontact/Model/Quickcontact.php +25 -0
  13. app/code/local/Magerevol/Quickcontact/Model/Status.php +30 -0
  14. app/code/local/Magerevol/Quickcontact/controllers/Adminhtml/QuickcontactController.php +203 -0
  15. app/code/local/Magerevol/Quickcontact/controllers/ContactController.php +157 -0
  16. app/code/local/Magerevol/Quickcontact/controllers/IndexController.php +25 -0
  17. app/code/local/Magerevol/Quickcontact/etc/adminhtml.xml +69 -0
  18. app/code/local/Magerevol/Quickcontact/etc/config.xml +160 -0
  19. app/code/local/Magerevol/Quickcontact/etc/system.xml +108 -0
  20. app/code/local/Magerevol/Quickcontact/sql/quickcontact_setup/mysql4-install-1.0.0.php +37 -0
  21. app/design/adminhtml/default/default/layout/quickcontact.xml +8 -0
  22. app/design/frontend/default/default/layout/quickcontact.xml +16 -0
  23. app/design/frontend/default/default/template/quickcontact/quickcontact.phtml +1 -0
  24. app/design/frontend/default/default/template/quickcontact/quickcontact_form.phtml +63 -0
  25. app/etc/modules/Magerevol_Quickcontact.xml +17 -0
  26. captcha/quickcontact/CaptchaSecurityImages.php +84 -0
  27. captcha/quickcontact/Dist-Inking-Regular.otf +0 -0
  28. package.xml +18 -0
  29. skin/frontend/default/default/css/quickcontact/qc_bg.png +0 -0
  30. skin/frontend/default/default/css/quickcontact/quickcontact_default.css +8 -0
app/code/local/Magerevol/Quickcontact/Block/Adminhtml/Quickcontact.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magerevol
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Magerevol
13
+ * @package Magerevol_Quickcontact
14
+ * @author Magerevol Development Team
15
+ * @copyright Copyright (c) 2013 Magerevol. (http://www.magerevol.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php
17
+ */
18
+ class Magerevol_Quickcontact_Block_Adminhtml_Quickcontact extends Mage_Adminhtml_Block_Widget_Grid_Container
19
+ {
20
+ public function __construct()
21
+ {
22
+ $this->_controller = 'adminhtml_quickcontact';
23
+ $this->_blockGroup = 'quickcontact';
24
+ $this->_headerText = Mage::helper('quickcontact')->__('Messages');
25
+ $this->_addButtonLabel = Mage::helper('quickcontact')->__('Add Message');
26
+
27
+ parent::__construct();
28
+ $this->_removeButton('add');
29
+ }
30
+ }
app/code/local/Magerevol/Quickcontact/Block/Adminhtml/Quickcontact/Edit.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magerevol
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Magerevol
13
+ * @package Magerevol_Quickcontact
14
+ * @author Magerevol Development Team
15
+ * @copyright Copyright (c) 2013 Magerevol. (http://www.magerevol.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php
17
+ */
18
+ class Magerevol_Quickcontact_Block_Adminhtml_Quickcontact_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
19
+ {
20
+ public function __construct()
21
+ {
22
+ parent::__construct();
23
+
24
+ $this->_objectId = 'id';
25
+ $this->_blockGroup = 'quickcontact';
26
+ $this->_controller = 'adminhtml_quickcontact';
27
+
28
+ // $this->_updateButton('save', 'label', Mage::helper('quickcontact')->__('Save Message'));
29
+ $this->_updateButton('delete', 'label', Mage::helper('quickcontact')->__('Delete Message'));
30
+ $this->_removeButton('save');
31
+ $this->_removeButton('reset');
32
+ // $this->_addButton('saveandcontinue', array(
33
+ // 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
34
+ // 'onclick' => 'saveAndContinueEdit()',
35
+ // 'class' => 'save',
36
+ // ), -100);
37
+
38
+ $this->_formScripts[] = "
39
+ function toggleEditor() {
40
+ if (tinyMCE.getInstanceById('quickcontact_content') == null) {
41
+ tinyMCE.execCommand('mceAddControl', false, 'quickcontact_content');
42
+ } else {
43
+ tinyMCE.execCommand('mceRemoveControl', false, 'quickcontact_content');
44
+ }
45
+ }
46
+
47
+ function saveAndContinueEdit(){
48
+ editForm.submit($('edit_form').action+'back/edit/');
49
+ }
50
+ ";
51
+ }
52
+
53
+ public function getHeaderText()
54
+ {
55
+ if( Mage::registry('quickcontact_data') && Mage::registry('quickcontact_data')->getId() ) {
56
+ return Mage::helper('quickcontact')->__("View message from '%s'", $this->htmlEscape(Mage::registry('quickcontact_data')->getName()));
57
+ } else {
58
+ return Mage::helper('quickcontact')->__('Add Message');
59
+ }
60
+ }
61
+ }
app/code/local/Magerevol/Quickcontact/Block/Adminhtml/Quickcontact/Edit/Form.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magerevol
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Magerevol
13
+ * @package Magerevol_Quickcontact
14
+ * @author Magerevol Development Team
15
+ * @copyright Copyright (c) 2013 Magerevol. (http://www.magerevol.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php
17
+ */
18
+ class Magerevol_Quickcontact_Block_Adminhtml_Quickcontact_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
19
+ {
20
+ protected function _prepareForm()
21
+ {
22
+ $form = new Varien_Data_Form(array(
23
+ 'id' => 'edit_form',
24
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
25
+ 'method' => 'post',
26
+ 'enctype' => 'multipart/form-data'
27
+ )
28
+ );
29
+
30
+ $form->setUseContainer(true);
31
+ $this->setForm($form);
32
+ return parent::_prepareForm();
33
+ }
34
+ }
app/code/local/Magerevol/Quickcontact/Block/Adminhtml/Quickcontact/Edit/Tab/Form.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magerevol
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Magerevol
13
+ * @package Magerevol_Quickcontact
14
+ * @author Magerevol Development Team
15
+ * @copyright Copyright (c) 2013 Magerevol. (http://www.magerevol.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php
17
+ */
18
+ class Magerevol_Quickcontact_Block_Adminhtml_Quickcontact_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
19
+ {
20
+ protected function _prepareForm()
21
+ {
22
+ $form = new Varien_Data_Form();
23
+ $this->setForm($form);
24
+ $fieldset = $form->addFieldset('quickcontact_form', array('legend'=>Mage::helper('quickcontact')->__('Message detail')));
25
+
26
+ $fieldset->addField('name', 'label', array(
27
+ 'label' => Mage::helper('quickcontact')->__('Name'),
28
+ 'name' => 'name',
29
+ ));
30
+
31
+ $fieldset->addField('email', 'label', array(
32
+ 'label' => Mage::helper('quickcontact')->__('Email'),
33
+ 'name' => 'email',
34
+ ));
35
+
36
+ $fieldset->addField('phone', 'label', array(
37
+ 'label' => Mage::helper('quickcontact')->__('Phone No.'),
38
+ 'name' => 'phone',
39
+ ));
40
+
41
+ $fieldset->addField('subject', 'label', array(
42
+ 'label' => Mage::helper('quickcontact')->__('Subject'),
43
+ 'name' => 'subject',
44
+ ));
45
+
46
+ // $fieldset->addField('message', 'label', array(
47
+ // 'label' => Mage::helper('quickcontact')->__('Message'),
48
+ // 'name' => 'message',
49
+ // ));
50
+
51
+
52
+
53
+ $fieldset->addField('message', 'editor', array(
54
+ 'name' => 'message',
55
+ 'label' => Mage::helper('quickcontact')->__('Message'),
56
+ 'title' => Mage::helper('quickcontact')->__('Message'),
57
+ 'style' => 'width:500px; height:350px',
58
+ 'wysiwyg' => false,
59
+ 'required' => true,
60
+ ));
61
+
62
+ if ( Mage::getSingleton('adminhtml/session')->getQuickcontactData() )
63
+ {
64
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getQuickcontactData());
65
+ Mage::getSingleton('adminhtml/session')->setQuickcontactData(null);
66
+ } elseif ( Mage::registry('quickcontact_data') ) {
67
+ $form->setValues(Mage::registry('quickcontact_data')->getData());
68
+ }
69
+ return parent::_prepareForm();
70
+ }
71
+ }
app/code/local/Magerevol/Quickcontact/Block/Adminhtml/Quickcontact/Edit/Tabs.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magerevol
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Magerevol
13
+ * @package Magerevol_Quickcontact
14
+ * @author Magerevol Development Team
15
+ * @copyright Copyright (c) 2013 Magerevol. (http://www.magerevol.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php
17
+ */
18
+ class Magerevol_Quickcontact_Block_Adminhtml_Quickcontact_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
19
+ {
20
+
21
+ public function __construct()
22
+ {
23
+ parent::__construct();
24
+ $this->setId('quickcontact_tabs');
25
+ $this->setDestElementId('edit_form');
26
+ $this->setTitle(Mage::helper('quickcontact')->__('Message Detail'));
27
+ }
28
+
29
+ protected function _beforeToHtml()
30
+ {
31
+ $this->addTab('form_section', array(
32
+ 'label' => Mage::helper('quickcontact')->__('Message Detail'),
33
+ 'title' => Mage::helper('quickcontact')->__('Message Detail'),
34
+ 'content' => $this->getLayout()->createBlock('quickcontact/adminhtml_quickcontact_edit_tab_form')->toHtml(),
35
+ ));
36
+
37
+ return parent::_beforeToHtml();
38
+ }
39
+ }
app/code/local/Magerevol/Quickcontact/Block/Adminhtml/Quickcontact/Grid.php ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magerevol
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Magerevol
13
+ * @package Magerevol_Quickcontact
14
+ * @author Magerevol Development Team
15
+ * @copyright Copyright (c) 2013 Magerevol. (http://www.magerevol.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php
17
+ */
18
+ class Magerevol_Quickcontact_Block_Adminhtml_Quickcontact_Grid extends Mage_Adminhtml_Block_Widget_Grid
19
+ {
20
+ public function __construct()
21
+ {
22
+ parent::__construct();
23
+ $this->setId('quickcontactGrid');
24
+ $this->setDefaultSort('quickcontact_id');
25
+ $this->setDefaultDir('ASC');
26
+ $this->setSaveParametersInSession(true);
27
+ }
28
+
29
+ protected function _prepareCollection()
30
+ {
31
+ $collection = Mage::getModel('quickcontact/quickcontact')->getCollection();
32
+ $this->setCollection($collection);
33
+ return parent::_prepareCollection();
34
+ }
35
+
36
+ protected function _prepareColumns()
37
+ {
38
+ $this->addColumn('qc_id', array(
39
+ 'header' => Mage::helper('quickcontact')->__('ID'),
40
+ 'align' =>'right',
41
+ 'width' => '50px',
42
+ 'index' => 'qc_id',
43
+ ));
44
+
45
+ $this->addColumn('name', array(
46
+ 'header' => Mage::helper('quickcontact')->__('name'),
47
+ 'align' =>'left',
48
+ 'index' => 'name',
49
+ ));
50
+
51
+ $this->addColumn('email', array(
52
+ 'header' => Mage::helper('quickcontact')->__('email'),
53
+ 'align' =>'left',
54
+ 'index' => 'email',
55
+ ));
56
+
57
+ $this->addColumn('phone', array(
58
+ 'header' => Mage::helper('quickcontact')->__('phone'),
59
+ 'align' =>'left',
60
+ 'index' => 'phone',
61
+ ));
62
+
63
+ $this->addColumn('subject', array(
64
+ 'header' => Mage::helper('quickcontact')->__('Subject'),
65
+ 'align' =>'left',
66
+ 'index' => 'subject',
67
+ ));
68
+
69
+ $this->addColumn('created_time', array(
70
+ 'header' => Mage::helper('quickcontact')->__('Time Created'),
71
+ 'align' =>'left',
72
+ 'type' => 'datetime',
73
+ 'index' => 'created_time',
74
+ ));
75
+
76
+ /*
77
+ $this->addColumn('content', array(
78
+ 'header' => Mage::helper('quickcontact')->__('Item Content'),
79
+ 'width' => '150px',
80
+ 'index' => 'content',
81
+ ));
82
+ */
83
+
84
+
85
+ $this->addColumn('action',
86
+ array(
87
+ 'header' => Mage::helper('quickcontact')->__('Action'),
88
+ 'width' => '100',
89
+ 'type' => 'action',
90
+ 'getter' => 'getId',
91
+ 'actions' => array(
92
+ array(
93
+ 'caption' => Mage::helper('quickcontact')->__('View'),
94
+ 'url' => array('base'=> '*/*/edit'),
95
+ 'field' => 'id'
96
+ )
97
+ ),
98
+ 'filter' => false,
99
+ 'sortable' => false,
100
+ 'index' => 'stores',
101
+ 'is_system' => true,
102
+ ));
103
+
104
+ $this->addExportType('*/*/exportCsv', Mage::helper('quickcontact')->__('CSV'));
105
+ $this->addExportType('*/*/exportXml', Mage::helper('quickcontact')->__('XML'));
106
+
107
+ return parent::_prepareColumns();
108
+ }
109
+
110
+ protected function _prepareMassaction()
111
+ {
112
+ $this->setMassactionIdField('quickcontact_id');
113
+ $this->getMassactionBlock()->setFormFieldName('quickcontact');
114
+
115
+ $this->getMassactionBlock()->addItem('delete', array(
116
+ 'label' => Mage::helper('quickcontact')->__('Delete'),
117
+ 'url' => $this->getUrl('*/*/massDelete'),
118
+ 'confirm' => Mage::helper('quickcontact')->__('Are you sure?')
119
+ ));
120
+
121
+ // $statuses = Mage::getSingleton('quickcontact/status')->getOptionArray();
122
+ //
123
+ // array_unshift($statuses, array('label'=>'', 'value'=>''));
124
+ // $this->getMassactionBlock()->addItem('status', array(
125
+ // 'label'=> Mage::helper('quickcontact')->__('Change status'),
126
+ // 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
127
+ // 'additional' => array(
128
+ // 'visibility' => array(
129
+ // 'name' => 'status',
130
+ // 'type' => 'select',
131
+ // 'class' => 'required-entry',
132
+ // 'label' => Mage::helper('quickcontact')->__('Status'),
133
+ // 'values' => $statuses
134
+ // )
135
+ // )
136
+ // ));
137
+ return $this;
138
+ }
139
+
140
+ public function getRowUrl($row)
141
+ {
142
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
143
+ }
144
+
145
+ }
app/code/local/Magerevol/Quickcontact/Block/Form.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magerevol
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Magerevol
13
+ * @package Magerevol_Quickcontact
14
+ * @author Magerevol Development Team
15
+ * @copyright Copyright (c) 2013 Magerevol. (http://www.magerevol.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php
17
+ */
18
+ class Magerevol_Quickcontact_Block_Form extends Mage_Core_Block_Template
19
+ {
20
+ protected function _prepareLayout()
21
+ {
22
+ $this->getLayout()->getBlock('head')->addCss('css/quickcontact/quickcontact_default.css');
23
+ return parent::_prepareLayout();
24
+ }
25
+
26
+ public function getQuickcontact()
27
+ {
28
+ if (!$this->hasData('quickcontact')) {
29
+ $this->setData('quickcontact', Mage::registry('quickcontact'));
30
+ }
31
+ return $this->getData('quickcontact');
32
+ }
33
+ }
app/code/local/Magerevol/Quickcontact/Block/Quickcontact.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magerevol
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Magerevol
13
+ * @package Magerevol_Quickcontact
14
+ * @author Magerevol Development Team
15
+ * @copyright Copyright (c) 2013 Magerevol. (http://www.magerevol.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php
17
+ */
18
+ class Magerevol_Quickcontact_Block_Quickcontact extends Mage_Core_Block_Template
19
+ {
20
+ public function _prepareLayout()
21
+ {
22
+ return parent::_prepareLayout();
23
+ }
24
+
25
+ public function getQuickcontact()
26
+ {
27
+ if (!$this->hasData('quickcontact')) {
28
+ $this->setData('quickcontact', Mage::registry('quickcontact'));
29
+ }
30
+ return $this->getData('quickcontact');
31
+
32
+ }
33
+ }
app/code/local/Magerevol/Quickcontact/Helper/Data.php ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magerevol
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Magerevol
13
+ * @package Magerevol_Quickcontact
14
+ * @author Magerevol Development Team
15
+ * @copyright Copyright (c) 2013 Magerevol. (http://www.magerevol.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php
17
+ */
18
+ class Magerevol_Quickcontact_Helper_Data extends Mage_Core_Helper_Abstract
19
+ {
20
+
21
+ public function getSecureImageUrl()
22
+ {
23
+ //$path = Mage::getBaseUrl('media');
24
+ //$pos =strripos($path,'media');
25
+ $apppath = Mage::getBaseUrl() . 'captcha/quickcontact/';
26
+ return $apppath;
27
+ }
28
+
29
+ function getNewCode($length) {
30
+
31
+ if($length>0) {
32
+ $rand_id="";
33
+ for($i=1; $i<=$length; $i++) {
34
+ mt_srand((double)microtime() * 1000000);
35
+ $num = mt_rand(1,36);
36
+ $rand_id .= $this->assign_rand_value($num);
37
+ }
38
+ }
39
+ return $rand_id;
40
+ }
41
+
42
+ function assign_rand_value($num)
43
+ {
44
+ //accepts 1 - 36
45
+ switch($num) {
46
+ case "1":
47
+ $rand_value = "a";
48
+ break;
49
+ case "2":
50
+ $rand_value = "b";
51
+ break;
52
+ case "3":
53
+ $rand_value = "c";
54
+ break;
55
+ case "4":
56
+ $rand_value = "d";
57
+ break;
58
+ case "5":
59
+ $rand_value = "e";
60
+ break;
61
+ case "6":
62
+ $rand_value = "f";
63
+ break;
64
+ case "7":
65
+ $rand_value = "g";
66
+ break;
67
+ case "8":
68
+ $rand_value = "h";
69
+ break;
70
+ case "9":
71
+ $rand_value = "i";
72
+ break;
73
+ case "10":
74
+ $rand_value = "j";
75
+ break;
76
+ case "11":
77
+ $rand_value = "k";
78
+ break;
79
+ case "12":
80
+ $rand_value = "z";
81
+ break;
82
+ case "13":
83
+ $rand_value = "m";
84
+ break;
85
+ case "14":
86
+ $rand_value = "n";
87
+ break;
88
+ case "15":
89
+ $rand_value = "o";
90
+ break;
91
+ case "16":
92
+ $rand_value = "p";
93
+ break;
94
+ case "17":
95
+ $rand_value = "q";
96
+ break;
97
+ case "18":
98
+ $rand_value = "r";
99
+ break;
100
+ case "19":
101
+ $rand_value = "s";
102
+ break;
103
+ case "20":
104
+ $rand_value = "t";
105
+ break;
106
+ case "21":
107
+ $rand_value = "u";
108
+ break;
109
+ case "22":
110
+ $rand_value = "v";
111
+ break;
112
+ case "23":
113
+ $rand_value = "w";
114
+ break;
115
+ case "24":
116
+ $rand_value = "x";
117
+ break;
118
+ case "25":
119
+ $rand_value = "y";
120
+ break;
121
+ case "26":
122
+ $rand_value = "z";
123
+ break;
124
+ case "27":
125
+ $rand_value = "0";
126
+ break;
127
+ case "28":
128
+ $rand_value = "1";
129
+ break;
130
+ case "29":
131
+ $rand_value = "2";
132
+ break;
133
+ case "30":
134
+ $rand_value = "3";
135
+ break;
136
+ case "31":
137
+ $rand_value = "4";
138
+ break;
139
+ case "32":
140
+ $rand_value = "5";
141
+ break;
142
+ case "33":
143
+ $rand_value = "6";
144
+ break;
145
+ case "34":
146
+ $rand_value = "7";
147
+ break;
148
+ case "35":
149
+ $rand_value = "8";
150
+ break;
151
+ case "36":
152
+ $rand_value = "9";
153
+ break;
154
+ }
155
+ return $rand_value;
156
+ }
157
+ }
app/code/local/Magerevol/Quickcontact/Model/Mysql4/Quickcontact.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magerevol
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Magerevol
13
+ * @package Magerevol_Quickcontact
14
+ * @author Magerevol Development Team
15
+ * @copyright Copyright (c) 2013 Magerevol. (http://www.magerevol.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php
17
+ */
18
+ class Magerevol_Quickcontact_Model_Mysql4_Quickcontact extends Mage_Core_Model_Mysql4_Abstract
19
+ {
20
+ public function _construct()
21
+ {
22
+ // Note that the quickcontact_id refers to the key field in your database table.
23
+ $this->_init('quickcontact/quickcontact', 'qc_id');
24
+ }
25
+ }
app/code/local/Magerevol/Quickcontact/Model/Mysql4/Quickcontact/Collection.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magerevol
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Magerevol
13
+ * @package Magerevol_Quickcontact
14
+ * @author Magerevol Development Team
15
+ * @copyright Copyright (c) 2013 Magerevol. (http://www.magerevol.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php
17
+ */
18
+ class Magerevol_Quickcontact_Model_Mysql4_Quickcontact_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
19
+ {
20
+ public function _construct()
21
+ {
22
+ parent::_construct();
23
+ $this->_init('quickcontact/quickcontact');
24
+ }
25
+ }
app/code/local/Magerevol/Quickcontact/Model/Quickcontact.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magerevol
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Magerevol
13
+ * @package Magerevol_Quickcontact
14
+ * @author Magerevol Development Team
15
+ * @copyright Copyright (c) 2013 Magerevol. (http://www.magerevol.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php
17
+ */
18
+ class Magerevol_Quickcontact_Model_Quickcontact extends Mage_Core_Model_Abstract
19
+ {
20
+ public function _construct()
21
+ {
22
+ parent::_construct();
23
+ $this->_init('quickcontact/quickcontact');
24
+ }
25
+ }
app/code/local/Magerevol/Quickcontact/Model/Status.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magerevol
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Magerevol
13
+ * @package Magerevol_Quickcontact
14
+ * @author Magerevol Development Team
15
+ * @copyright Copyright (c) 2013 Magerevol. (http://www.magerevol.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php
17
+ */
18
+ class Magerevol_Quickcontact_Model_Status extends Varien_Object
19
+ {
20
+ const STATUS_ENABLED = 1;
21
+ const STATUS_DISABLED = 2;
22
+
23
+ static public function getOptionArray()
24
+ {
25
+ return array(
26
+ self::STATUS_ENABLED => Mage::helper('quickcontact')->__('Enabled'),
27
+ self::STATUS_DISABLED => Mage::helper('quickcontact')->__('Disabled')
28
+ );
29
+ }
30
+ }
app/code/local/Magerevol/Quickcontact/controllers/Adminhtml/QuickcontactController.php ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magerevol
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Magerevol
13
+ * @package Magerevol_Quickcontact
14
+ * @author Magerevol Development Team
15
+ * @copyright Copyright (c) 2013 Magerevol. (http://www.magerevol.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php
17
+ */
18
+ class Magerevol_Quickcontact_Adminhtml_QuickcontactController extends Mage_Adminhtml_Controller_Action
19
+ {
20
+
21
+ protected function _initAction() {
22
+ $this->loadLayout()
23
+ ->_setActiveMenu('quickcontact/items')
24
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
25
+
26
+ return $this;
27
+ }
28
+
29
+ public function indexAction() {
30
+ $this->_initAction()
31
+ ->renderLayout();
32
+ }
33
+
34
+ public function editAction() {
35
+ $id = $this->getRequest()->getParam('id');
36
+ $model = Mage::getModel('quickcontact/quickcontact')->load($id);
37
+
38
+ if ($model->getId() || $id == 0) {
39
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
40
+ if (!empty($data)) {
41
+ $model->setData($data);
42
+ }
43
+
44
+ Mage::register('quickcontact_data', $model);
45
+
46
+ $this->loadLayout();
47
+ $this->_setActiveMenu('quickcontact/items');
48
+
49
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
50
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
51
+
52
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
53
+
54
+ $this->_addContent($this->getLayout()->createBlock('quickcontact/adminhtml_quickcontact_edit'))
55
+ ->_addLeft($this->getLayout()->createBlock('quickcontact/adminhtml_quickcontact_edit_tabs'));
56
+
57
+ $this->renderLayout();
58
+ } else {
59
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('quickcontact')->__('Item does not exist'));
60
+ $this->_redirect('*/*/');
61
+ }
62
+ }
63
+
64
+ public function newAction() {
65
+ $this->_forward('edit');
66
+ }
67
+
68
+ public function saveAction() {
69
+ $this->_redirect('*/*/');
70
+ return;
71
+ if ($data = $this->getRequest()->getPost()) {
72
+
73
+ $model = Mage::getModel('quickcontact/quickcontact');
74
+ $model->setData($data)
75
+ ->setId($this->getRequest()->getParam('id'));
76
+
77
+ try {
78
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
79
+ $model->setCreatedTime(now())
80
+ ->setUpdateTime(now());
81
+ } else {
82
+ $model->setUpdateTime(now());
83
+ }
84
+
85
+ $model->save();
86
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('quickcontact')->__('Item was successfully saved'));
87
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
88
+
89
+ if ($this->getRequest()->getParam('back')) {
90
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
91
+ return;
92
+ }
93
+ $this->_redirect('*/*/');
94
+ return;
95
+ } catch (Exception $e) {
96
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
97
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
98
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
99
+ return;
100
+ }
101
+ }
102
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('quickcontact')->__('Unable to find item to save'));
103
+ $this->_redirect('*/*/');
104
+ }
105
+
106
+ public function deleteAction() {
107
+ if( $this->getRequest()->getParam('id') > 0 ) {
108
+ try {
109
+ $model = Mage::getModel('quickcontact/quickcontact');
110
+
111
+ $model->setId($this->getRequest()->getParam('id'))
112
+ ->delete();
113
+
114
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
115
+ $this->_redirect('*/*/');
116
+ } catch (Exception $e) {
117
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
118
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
119
+ }
120
+ }
121
+ $this->_redirect('*/*/');
122
+ }
123
+
124
+ public function massDeleteAction() {
125
+ $quickcontactIds = $this->getRequest()->getParam('quickcontact');
126
+ if(!is_array($quickcontactIds)) {
127
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
128
+ } else {
129
+ try {
130
+ foreach ($quickcontactIds as $quickcontactId) {
131
+ $quickcontact = Mage::getModel('quickcontact/quickcontact')->load($quickcontactId);
132
+ $quickcontact->delete();
133
+ }
134
+ Mage::getSingleton('adminhtml/session')->addSuccess(
135
+ Mage::helper('adminhtml')->__(
136
+ 'Total of %d record(s) were successfully deleted', count($quickcontactIds)
137
+ )
138
+ );
139
+ } catch (Exception $e) {
140
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
141
+ }
142
+ }
143
+ $this->_redirect('*/*/index');
144
+ }
145
+
146
+ public function massStatusAction()
147
+ {
148
+ $quickcontactIds = $this->getRequest()->getParam('quickcontact');
149
+ if(!is_array($quickcontactIds)) {
150
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
151
+ } else {
152
+ try {
153
+ foreach ($quickcontactIds as $quickcontactId) {
154
+ $quickcontact = Mage::getSingleton('quickcontact/quickcontact')
155
+ ->load($quickcontactId)
156
+ ->setStatus($this->getRequest()->getParam('status'))
157
+ ->setIsMassupdate(true)
158
+ ->save();
159
+ }
160
+ $this->_getSession()->addSuccess(
161
+ $this->__('Total of %d record(s) were successfully updated', count($quickcontactIds))
162
+ );
163
+ } catch (Exception $e) {
164
+ $this->_getSession()->addError($e->getMessage());
165
+ }
166
+ }
167
+ $this->_redirect('*/*/index');
168
+ }
169
+
170
+ public function exportCsvAction()
171
+ {
172
+ $fileName = 'quickcontact.csv';
173
+ $content = $this->getLayout()->createBlock('quickcontact/adminhtml_quickcontact_grid')
174
+ ->getCsv();
175
+
176
+ $this->_sendUploadResponse($fileName, $content);
177
+ }
178
+
179
+ public function exportXmlAction()
180
+ {
181
+ $fileName = 'quickcontact.xml';
182
+ $content = $this->getLayout()->createBlock('quickcontact/adminhtml_quickcontact_grid')
183
+ ->getXml();
184
+
185
+ $this->_sendUploadResponse($fileName, $content);
186
+ }
187
+
188
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
189
+ {
190
+ $response = $this->getResponse();
191
+ $response->setHeader('HTTP/1.1 200 OK','');
192
+ $response->setHeader('Pragma', 'public', true);
193
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
194
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
195
+ $response->setHeader('Last-Modified', date('r'));
196
+ $response->setHeader('Accept-Ranges', 'bytes');
197
+ $response->setHeader('Content-Length', strlen($content));
198
+ $response->setHeader('Content-type', $contentType);
199
+ $response->setBody($content);
200
+ $response->sendResponse();
201
+ die;
202
+ }
203
+ }
app/code/local/Magerevol/Quickcontact/controllers/ContactController.php ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magerevol
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Magerevol
13
+ * @package Magerevol_Quickcontact
14
+ * @author Magerevol Development Team
15
+ * @copyright Copyright (c) 2013 Magerevol. (http://www.magerevol.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php
17
+ */
18
+ class Magerevol_Quickcontact_ContactController extends Mage_Core_Controller_Front_Action
19
+ {
20
+ public function formAction()
21
+ {
22
+ $this->loadLayout();
23
+ $this->renderLayout();
24
+ }
25
+
26
+ public function submitAction() {
27
+ if ($data = $this->getRequest()->getPost()) {
28
+
29
+ $saved = false;
30
+ $emailed = false;
31
+
32
+ $isEmailEnabled = Mage::getStoreConfig('quickcontact/general/send_email');
33
+ $recipient_email = Mage::getStoreConfig('quickcontact/general/recipient_email');
34
+ if($recipient_email)
35
+ $email_added = true;
36
+ else $email_added = false;
37
+
38
+ $save_enabled = Mage::getStoreConfig('quickcontact/general/enable_save');
39
+
40
+ //if none is enabled
41
+ if($isEmailEnabled == 1 || $save_enabled == 1)
42
+ {
43
+
44
+ $captchaerror = false;
45
+
46
+ if (!Zend_Validate::is(trim($data['security_code']) , 'NotEmpty')) {
47
+ $captchaerror = true;
48
+ }
49
+ //++++++ CAPTCHA validation ++++++++++++++
50
+ $translate = Mage::getSingleton('core/translate');
51
+ $translate->setTranslateInline(false);
52
+
53
+ if (!$captchaerror && strtolower($data['security_code'])!= $data['captacha_code']) {
54
+ $translate->setTranslateInline(true);
55
+ Mage::getSingleton('core/session')->addError("The CAPTCHA you entered was incorrrect.");
56
+ Mage::getSingleton('core/session')->setQuickFormData($data);
57
+
58
+ $this->_redirectReferer();
59
+ return;
60
+ }
61
+
62
+
63
+
64
+ //+++++++++ Save to Database enabled +++++++++
65
+ $isSaveEnabled = Mage::getStoreConfig('quickcontact/general/enable_save');
66
+ if($isSaveEnabled){
67
+ $model = Mage::getModel('quickcontact/quickcontact');
68
+ $model->setData($data)
69
+ ->setId($this->getRequest()->getParam('id'));
70
+
71
+ try {
72
+ $model->setCreatedTime(now());
73
+
74
+ $model->save();
75
+
76
+ $emailed = true;
77
+ // Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('quickcontact')->__('Message was successfully saved'));
78
+ // Mage::getSingleton('adminhtml/session')->setFormData(false);
79
+ //
80
+ // $this->_redirect('*/*/');
81
+ // return;
82
+ } catch (Exception $e) {
83
+ // Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
84
+ // Mage::getSingleton('adminhtml/session')->setFormData($data);
85
+ // $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
86
+ // return;
87
+ }
88
+ }//if save to DB
89
+ /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
90
+
91
+ if($isEmailEnabled && $email_added)
92
+ {
93
+ try {
94
+ $emailTemplate = Mage::getModel('core/email_template')
95
+ ->loadDefault('quick_contact_email');
96
+
97
+ $sender_name = $data['name'];
98
+
99
+ $recipient_name = Mage::getStoreConfig('quickcontact/general/recipient_name');
100
+ $recipient_email = Mage::getStoreConfig('quickcontact/general/recipient_email');
101
+ //$recipient_email = 'support@magerevol.com';
102
+
103
+ $sender_email = $data['email'];
104
+ //Create an array of variables to assign to template
105
+ $emailTemplateVariables = array();
106
+
107
+ $emailTemplateVariables['sender_name'] = $data['name'];
108
+ $emailTemplateVariables['sender_email'] = $data['email'];
109
+ $emailTemplateVariables['email_subject'] = $data['subject'];
110
+ $emailTemplateVariables['phone'] = $data['phone'];
111
+ $emailTemplateVariables['message'] = $data['message'];
112
+
113
+ $processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);
114
+
115
+ $email_subject = $data['subject'];
116
+ /*
117
+ * Or you can send the email directly,
118
+ * note getProcessedTemplate is called inside send()
119
+ */
120
+ $emailTemplate->setSenderName($sender_name);
121
+ $emailTemplate->setSenderEmail($sender_email);
122
+ $emailTemplate->setTemplateSubject($email_subject);
123
+ $emailTemplate->send($recipient_email, $recipient_name, $emailTemplateVariables);
124
+
125
+ $emailed = true;
126
+
127
+ } catch(Exception $e) {
128
+ Mage::getSingleton('core/session')->addError(Mage::helper('quickcontact')->__('Unable to send message at this time. Please, try later.'));
129
+ $this->_redirectReferer();
130
+ return;
131
+ }
132
+ }//if email enabled
133
+
134
+ if($saved || $emailed)
135
+ {
136
+ $success_message = Mage::getStoreConfig('quickcontact/general/success_message');
137
+ Mage::getSingleton('core/session')->addSuccess(Mage::helper('quickcontact')->__($success_message));
138
+ $this->_redirectReferer();
139
+ return;
140
+ }
141
+
142
+ }//service unavailable
143
+ else {
144
+ $disabled_message = Mage::getStoreConfig('quickcontact/general/email_disabled_message');
145
+ if(!$disabled_message)
146
+ {$disabled_message = 'The service is unavailable at the moment please try again later';}
147
+ Mage::getSingleton('core/session')->addError(Mage::helper('quickcontact')->__($disabled_message));
148
+ $this->_redirectReferer();
149
+ return;
150
+ }
151
+
152
+ }
153
+ Mage::getSingleton('core/session')->addError(Mage::helper('quickcontact')->__('Unable to send message.'));
154
+ $this->_redirectReferer();
155
+
156
+ }
157
+ }
app/code/local/Magerevol/Quickcontact/controllers/IndexController.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magerevol
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Magerevol
13
+ * @package Magerevol_Quickcontact
14
+ * @author Magerevol Development Team
15
+ * @copyright Copyright (c) 2013 Magerevol. (http://www.magerevol.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php
17
+ */
18
+ class Magerevol_Quickcontact_IndexController extends Mage_Core_Controller_Front_Action
19
+ {
20
+ public function indexAction()
21
+ {
22
+ $this->loadLayout();
23
+ $this->renderLayout();
24
+ }
25
+ }
app/code/local/Magerevol/Quickcontact/etc/adminhtml.xml ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <magerevol translate="title" module="quickcontact">
5
+ <title>Magerevol</title>
6
+ <children>
7
+ <quickcontact module="quickcontact">
8
+ <title>Quickcontact</title>
9
+ <sort_order>71</sort_order>
10
+ <children>
11
+ <items module="quickcontact">
12
+ <title>Manage Messages</title>
13
+ <sort_order>0</sort_order>
14
+ <action>quickcontact/adminhtml_quickcontact</action>
15
+ </items>
16
+ <settings module="quickcontact">
17
+ <title>Configurations</title>
18
+ <sort_order>100</sort_order>
19
+ <action>adminhtml/system_config/edit/section/quickcontact</action>
20
+ </settings>
21
+ </children>
22
+ </quickcontact>
23
+ </children>
24
+ </magerevol>
25
+ </menu>
26
+ <acl>
27
+ <resources>
28
+ <all>
29
+ <title>Allow Everything</title>
30
+ </all>
31
+ <admin>
32
+ <children>
33
+ <magerevol translate="title" module="quickcontact">
34
+ <title>Magerevol</title>
35
+ <children>
36
+ <quickcontact module="quickcontact">
37
+ <title>Quickcontact</title>
38
+ <sort_order>71</sort_order>
39
+ <children>
40
+ <items module="quickcontact">
41
+ <title>Manage Messages</title>
42
+ <sort_order>0</sort_order>
43
+ <action>quickcontact/adminhtml_quickcontact</action>
44
+ </items>
45
+ <settings module="quickcontact">
46
+ <title>Configurations</title>
47
+ <sort_order>100</sort_order>
48
+ <action>adminhtml/system_config/edit/section/quickcontact</action>
49
+ </settings>
50
+ </children>
51
+ </quickcontact>
52
+ </children>
53
+ </magerevol>
54
+ <system>
55
+ <children>
56
+ <config>
57
+ <children>
58
+ <quickcontact>
59
+ <title>Quick Contact Section</title>
60
+ </quickcontact>
61
+ </children>
62
+ </config>
63
+ </children>
64
+ </system>
65
+ </children>
66
+ </admin>
67
+ </resources>
68
+ </acl>
69
+ </config>
app/code/local/Magerevol/Quickcontact/etc/config.xml ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magerevol
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ *
13
+ * @category Magerevol
14
+ * @package Magerevol_Quickcontact
15
+ * @author Magerevol Development Team
16
+ * @copyright Copyright (c) 2013 Magerevol. (http://www.magerevol.com)
17
+ * @license http://opensource.org/licenses/osl-3.0.php
18
+ */
19
+ -->
20
+ <config>
21
+ <modules>
22
+ <Magerevol_Quickcontact>
23
+ <version>1.0.0</version>
24
+ </Magerevol_Quickcontact>
25
+ </modules>
26
+ <frontend>
27
+ <routers>
28
+ <quickcontact>
29
+ <use>standard</use>
30
+ <args>
31
+ <module>Magerevol_Quickcontact</module>
32
+ <frontName>quickcontact</frontName>
33
+ </args>
34
+ </quickcontact>
35
+ </routers>
36
+ <layout>
37
+ <updates>
38
+ <quickcontact>
39
+ <file>quickcontact.xml</file>
40
+ </quickcontact>
41
+ </updates>
42
+ </layout>
43
+ </frontend>
44
+ <admin>
45
+ <routers>
46
+ <quickcontact>
47
+ <use>admin</use>
48
+ <args>
49
+ <module>Magerevol_Quickcontact</module>
50
+ <frontName>quickcontact</frontName>
51
+ </args>
52
+ </quickcontact>
53
+ </routers>
54
+ </admin>
55
+ <adminhtml>
56
+ <!-- <menu>
57
+ <quickcontact module="quickcontact">
58
+ <title>Quickcontact</title>
59
+ <sort_order>71</sort_order>
60
+ <children>
61
+ <items module="quickcontact">
62
+ <title>Manage Messages</title>
63
+ <sort_order>0</sort_order>
64
+ <action>quickcontact/adminhtml_quickcontact</action>
65
+ </items>
66
+ </children>
67
+ </quickcontact>
68
+ </menu>
69
+ <acl>
70
+ <resources>
71
+ <all>
72
+ <title>Allow Everything</title>
73
+ </all>
74
+ <admin>
75
+ <children>
76
+ <Magerevol_Quickcontact>
77
+ <title>Quickcontact Module</title>
78
+ <sort_order>10</sort_order>
79
+ </Magerevol_Quickcontact>
80
+ </children>
81
+ </admin>
82
+ </resources>
83
+ </acl>-->
84
+ <layout>
85
+ <updates>
86
+ <quickcontact>
87
+ <file>quickcontact.xml</file>
88
+ </quickcontact>
89
+ </updates>
90
+ </layout>
91
+ </adminhtml>
92
+ <global>
93
+ <models>
94
+ <quickcontact>
95
+ <class>Magerevol_Quickcontact_Model</class>
96
+ <resourceModel>quickcontact_mysql4</resourceModel>
97
+ </quickcontact>
98
+ <quickcontact_mysql4>
99
+ <class>Magerevol_Quickcontact_Model_Mysql4</class>
100
+ <entities>
101
+ <quickcontact>
102
+ <table>mr_quickcontact</table>
103
+ </quickcontact>
104
+ </entities>
105
+ </quickcontact_mysql4>
106
+ </models>
107
+ <resources>
108
+ <quickcontact_setup>
109
+ <setup>
110
+ <module>Magerevol_Quickcontact</module>
111
+ </setup>
112
+ <connection>
113
+ <use>core_setup</use>
114
+ </connection>
115
+ </quickcontact_setup>
116
+ <quickcontact_write>
117
+ <connection>
118
+ <use>core_write</use>
119
+ </connection>
120
+ </quickcontact_write>
121
+ <quickcontact_read>
122
+ <connection>
123
+ <use>core_read</use>
124
+ </connection>
125
+ </quickcontact_read>
126
+ </resources>
127
+ <blocks>
128
+ <quickcontact>
129
+ <class>Magerevol_Quickcontact_Block</class>
130
+ </quickcontact>
131
+ </blocks>
132
+ <helpers>
133
+ <quickcontact>
134
+ <class>Magerevol_Quickcontact_Helper</class>
135
+ </quickcontact>
136
+ </helpers>
137
+
138
+ <template>
139
+ <email>
140
+ <quick_contact_email module="quickcontact">
141
+ <label>Quick Contact Email</label>
142
+ <file>quick_contact_email.html</file>
143
+ <type>html</type>
144
+ </quick_contact_email>
145
+
146
+ </email>
147
+ </template>
148
+ </global>
149
+ <default>
150
+ <quickcontact>
151
+ <general>
152
+ <enable_quickcontact>1</enable_quickcontact>
153
+ <send_email>1</send_email>
154
+ <enable_save>1</enable_save>
155
+ <success_message><![CDATA[Your message has been sent successfully.]]></success_message>
156
+ <email_disabled_message><![CDATA[The service is temporarily unavailable at the moment. please try later.]]></email_disabled_message>
157
+ </general>
158
+ </quickcontact>
159
+ </default>
160
+ </config>
app/code/local/Magerevol/Quickcontact/etc/system.xml ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <Magerevol translate="label" module="quickcontact">
5
+ <label>Magerevol Extensions</label>
6
+ <sort_order>199</sort_order>
7
+ </Magerevol>
8
+ </tabs>
9
+ <sections>
10
+ <quickcontact translate="label" module="quickcontact">
11
+ <label>Quick Contact</label>
12
+ <tab>Magerevol</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>100</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <general translate="label">
20
+ <label>General Settings</label>
21
+ <sort_order>10</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ <fields>
26
+ <enable_quickcontact translate="label">
27
+ <label>Enable Extension</label>
28
+ <comment></comment>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>20</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ <can_be_empty>1</can_be_empty>
36
+ </enable_quickcontact>
37
+ <recipient_name translate="label">
38
+ <label>Recipient Name</label>
39
+ <frontend_type>text</frontend_type>
40
+ <sort_order>50</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ </recipient_name>
45
+ <recipient_email translate="label">
46
+ <label>Recipient Email</label>
47
+ <frontend_type>text</frontend_type>
48
+ <sort_order>60</sort_order>
49
+ <show_in_default>1</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>1</show_in_store>
52
+ </recipient_email>
53
+ <!--<email_subject translate="label">
54
+ <label>Email Subject</label>
55
+ <frontend_type>text</frontend_type>
56
+ <sort_order>70</sort_order>
57
+ <show_in_default>1</show_in_default>
58
+ <show_in_website>1</show_in_website>
59
+ <show_in_store>1</show_in_store>
60
+ </email_subject>-->
61
+ <send_email translate="label">
62
+ <label>Enable Email</label>
63
+ <comment></comment>
64
+ <frontend_type>select</frontend_type>
65
+ <source_model>adminhtml/system_config_source_yesno</source_model>
66
+ <sort_order>80</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>1</show_in_store>
70
+ <can_be_empty>1</can_be_empty>
71
+ </send_email>
72
+
73
+ <enable_save translate="label">
74
+ <label>Save to Database</label>
75
+ <comment></comment>
76
+ <frontend_type>select</frontend_type>
77
+ <source_model>adminhtml/system_config_source_yesno</source_model>
78
+ <sort_order>90</sort_order>
79
+ <show_in_default>1</show_in_default>
80
+ <show_in_website>1</show_in_website>
81
+ <show_in_store>1</show_in_store>
82
+ <can_be_empty>1</can_be_empty>
83
+ </enable_save>
84
+ <success_message translate="label">
85
+ <label>Success Message</label>
86
+ <frontend_type>text</frontend_type>
87
+ <sort_order>100</sort_order>
88
+ <show_in_default>1</show_in_default>
89
+ <show_in_website>1</show_in_website>
90
+ <show_in_store>1</show_in_store>
91
+ </success_message>
92
+ <email_disabled_message translate="label">
93
+ <label>Disabled Email Message</label>
94
+ <frontend_type>text</frontend_type>
95
+ <sort_order>100</sort_order>
96
+ <show_in_default>1</show_in_default>
97
+ <show_in_website>1</show_in_website>
98
+ <show_in_store>1</show_in_store>
99
+ <comment><![CDATA[Message incase both email sending and save to database options are disabled.]]></comment>
100
+ </email_disabled_message>
101
+
102
+ </fields>
103
+ </general>
104
+
105
+ </groups>
106
+ </quickcontact>
107
+ </sections>
108
+ </config>
app/code/local/Magerevol/Quickcontact/sql/quickcontact_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magerevol
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Magerevol
13
+ * @package Magerevol_Quickcontact
14
+ * @author Magerevol Development Team
15
+ * @copyright Copyright (c) 2013 Magerevol. (http://www.magerevol.com)
16
+ * @license http://opensource.org/licenses/osl-3.0.php
17
+ */
18
+ $installer = $this;
19
+
20
+ $installer->startSetup();
21
+
22
+ $installer->run("
23
+
24
+ -- DROP TABLE IF EXISTS {$this->getTable('mr_quickcontact')};
25
+ CREATE TABLE {$this->getTable('mr_quickcontact')} (
26
+ `qc_id` bigint(20) NOT NULL AUTO_INCREMENT,
27
+ `name` varchar(100) DEFAULT NULL,
28
+ `email` varchar(100) NOT NULL,
29
+ `subject` varchar(255) DEFAULT NULL,
30
+ `phone` varchar(20) DEFAULT NULL,
31
+ `message` text NOT NULL,
32
+ `created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
33
+ PRIMARY KEY (`qc_id`)
34
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
35
+ ");
36
+
37
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/quickcontact.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <quickcontact_adminhtml_quickcontact_index>
4
+ <reference name="content">
5
+ <block type="quickcontact/adminhtml_quickcontact" name="quickcontact" />
6
+ </reference>
7
+ </quickcontact_adminhtml_quickcontact_index>
8
+ </layout>
app/design/frontend/default/default/layout/quickcontact.xml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ </default>
5
+ <quickcontact_index_index>
6
+ <reference name="content">
7
+ <block type="quickcontact/quickcontact" name="quickcontact" template="quickcontact/quickcontact.phtml" />
8
+ </reference>
9
+ </quickcontact_index_index>
10
+
11
+ <quickcontact_contact_form>
12
+ <reference name="content">
13
+ <block type="quickcontact/form" name="quickcontact_form" template="quickcontact/quickcontact_form.phtml" />
14
+ </reference>
15
+ </quickcontact_contact_form>
16
+ </layout>
app/design/frontend/default/default/template/quickcontact/quickcontact.phtml ADDED
@@ -0,0 +1 @@
 
1
+ <?php ?>
app/design/frontend/default/default/template/quickcontact/quickcontact_form.phtml ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $isModuleEnabled = Mage::getStoreConfig('quickcontact/general/enable_quickcontact');
3
+
4
+ if($isModuleEnabled)
5
+ {
6
+ $data = Mage::getSingleton('core/session')->getQuickFormData();
7
+ Mage::getSingleton('core/session')->setQuickFormData(null);
8
+ ?>
9
+ <div class="footerform_container">
10
+ <form id="quick_contact" action="<?php echo Mage::getUrl('quickcontact/contact/submit'); ?>" method="POST">
11
+ <!--<table>
12
+ <tr><td><label for="name">Name</label><td></tr>
13
+ <tr><td><input class="inp_txt" type="text" name="name" /></td></tr>
14
+ <tr><td><label for="email">email</label></td></tr>
15
+ <tr><td><input class="inp_txt" type="text" name="email" /></td></tr>
16
+ <tr><td><label for="message">Message</label></td></tr>
17
+ <tr><td><textarea class="inp_txtarea" name="message"></textarea></td></tr>
18
+
19
+ </table>-->
20
+ <div class="form-field">
21
+ <label for="name_field" class="required"><?php echo $this->__('Name') ?><em>*</em></label><br />
22
+ <input class="input-text required-entry" name="name" id="name_field" type="text" value="<?php echo $this->htmlEscape($data['name']) ?>" />
23
+ </div>
24
+
25
+ <div class="form-field">
26
+ <label for="email_field" class="required"><?php echo $this->__('Email') ?><em>*</em></label><br />
27
+ <input class="input-text required-entry validate-email" name="email" id="email_field" type="text" value="<?php echo $this->htmlEscape($data['email']) ?>" />
28
+ </div>
29
+
30
+ <div class="form-field">
31
+ <label for="subject_field" class="required"><?php echo $this->__('Subject') ?><em>*</em></label><br />
32
+ <input class="input-text required-entry" name="subject" id="subject_field" type="text" value="<?php echo $this->htmlEscape($data['subject']) ?>" />
33
+ </div>
34
+
35
+ <div class="form-field">
36
+ <label for="phone_field" class="required"><?php echo $this->__('Phone No.') ?></label><br />
37
+ <input class="input-text" name="phone" id="phone_field" type="text" value="<?php echo $this->htmlEscape($data['phone']) ?>" />
38
+ </div>
39
+
40
+ <div class="form-field">
41
+ <label for="message_field" class="required"><?php echo $this->__('Message') ?><em>*</em></label><br />
42
+ <textarea class="required-entry" name="message" id="message_field" ><?php echo $this->htmlEscape($data['message']) ?></textarea>
43
+ </div>
44
+
45
+ <div class="form-field">
46
+ <label><?php echo $this->__('Security Code') ?><em>*</em></label>
47
+ <input name="captacha_code" type="hidden" id="captacha_code" value="<?php echo $code=Mage::helper('quickcontact')->getNewCode(6)?>" />
48
+ <label for="image"><img class="mr_captcha_img" style="display: block;" src="<?php echo Mage::helper('quickcontact')->getSecureImageUrl() ?>CaptchaSecurityImages.php?width=174&height=30&code=<?php echo $code?>" /></label>
49
+ <input id="security_code" class="input-text required-entry" name="security_code" value="" >
50
+ </div>
51
+
52
+ <div class="button-set">
53
+ <button class="button form-button" type="submit"><span><span><?php echo $this->__('Send') ?></span></span></button>
54
+ </div>
55
+
56
+ </form>
57
+ <script type="text/javascript">
58
+ //<![CDATA[
59
+ var quickContactForm = new VarienForm('quick_contact', true);
60
+ //]]>
61
+ </script>
62
+ </div>
63
+ <?php } ?>
app/etc/modules/Magerevol_Quickcontact.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Magerevol
5
+ * @package Magerevol_Quickcontact
6
+ * @author ModuleCreator
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Magerevol_Quickcontact>
13
+ <active>true</active>
14
+ <codePool>local</codePool>
15
+ </Magerevol_Quickcontact>
16
+ </modules>
17
+ </config>
captcha/quickcontact/CaptchaSecurityImages.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //session_start();
3
+
4
+ /*
5
+ * File: CaptchaSecurityImages.php
6
+ * Author: Simon Jarvis
7
+ * Copyright: 2006 Simon Jarvis
8
+ * Date: 03/08/06
9
+ * Updated: 07/02/07
10
+ * Requirements: PHP 4/5 with GD and FreeType libraries
11
+ * Link: http://www.white-hat-web-design.co.uk/articles/php-captcha.php
12
+ *
13
+ * This program is free software; you can redistribute it and/or
14
+ * modify it under the terms of the GNU General Public License
15
+ * as published by the Free Software Foundation; either version 2
16
+ * of the License, or (at your option) any later version.
17
+ *
18
+ * This program is distributed in the hope that it will be useful,
19
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ * GNU General Public License for more details:
22
+ * http://www.gnu.org/licenses/gpl.html
23
+ *
24
+ */
25
+
26
+ class CaptchaSecurityImages {
27
+
28
+ var $font = './Dist-Inking-Regular.otf';
29
+ var $mcode = "";
30
+
31
+ function generateCode($characters) {
32
+ /* list all possible characters, similar looking characters and vowels have been removed */
33
+ $possible = '23456789bcdfghjkmnpqrstvwxyz';
34
+ $code = '';
35
+ $i = 0;
36
+ while ($i < $characters) {
37
+ $code .= substr($possible, mt_rand(0, strlen($possible)-1), 1);
38
+ $i++;
39
+ }
40
+ return $code;
41
+ }
42
+
43
+ function CaptchaSecurityImages($width='120',$height='30',$characters='6', $sec_code='5') {
44
+ $code = $sec_code;
45
+ /* font size will be 75% of the image height */
46
+ $font_size = $height * 0.75;
47
+ $image = @imagecreate($width, $height) or die('Cannot initialize new GD image stream');
48
+ /* set the colours */
49
+ $background_color = imagecolorallocate($image, 214, 214, 214);//255, 255, 255);
50
+ $text_color = imagecolorallocate($image, 0, 0, 0);//20, 40, 100);
51
+ $noise_color = imagecolorallocate($image, 255, 0, 00);//100, 120, 180);
52
+ // /* generate random dots in background */
53
+ // for( $i=0; $i<($width*$height)/3; $i++ ) {
54
+ // imagefilledellipse($image, mt_rand(0,$width), mt_rand(0,$height), 1, 1, $noise_color);
55
+ // }
56
+ // /* generate random lines in background */
57
+ // for( $i=0; $i<($width*$height)/150; $i++ ) {
58
+ // imageline($image, mt_rand(0,$width), mt_rand(0,$height), mt_rand(0,$width), mt_rand(0,$height), $noise_color);
59
+ // }
60
+ /* create textbox and add text */
61
+ $textbox = imagettfbbox($font_size, 0, 'Dist-Inking-Regular.otf', $code) or die('Error in imagettfbbox function');
62
+ $x = ($width - $textbox[4])/2;
63
+ $y = ($height - $textbox[5])/2;
64
+ imagettftext($image, $font_size, 0, $x, $y, $text_color, 'Dist-Inking-Regular.otf' , $code) or die('Error in imagettftext function');
65
+ /* output captcha image to browser */
66
+ header('Content-Type: image/jpeg');
67
+ imagejpeg($image);
68
+ imagedestroy($image);
69
+ //$this->mcode = $code;
70
+ }
71
+ function getCode()
72
+ {
73
+ return $this->mcode;
74
+ }
75
+
76
+ }
77
+
78
+ $width = isset($_GET['width']) ? $_GET['width'] : '120';
79
+ $height = isset($_GET['height']) ? $_GET['height'] : '40';
80
+ $code = $_GET['code'];
81
+ $characters = isset($_GET['characters']) && $_GET['characters'] > 1 ? $_GET['characters'] : '6';
82
+
83
+ $captcha = new CaptchaSecurityImages($width,$height,$characters,$code);
84
+ ?>
captcha/quickcontact/Dist-Inking-Regular.otf ADDED
Binary file
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Magerevol_Quickcontact</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Quickcontact is a CAPTCHA enabled contact form that you can embed anywhere in page.</summary>
10
+ <description>Quick Contact is a CAPTCHA enabled contact form that you can embed anywhere in page. Quick Contact can be configured to send emails or save message to database or enable both.</description>
11
+ <notes>Stable version of Quick Contact magento extension.</notes>
12
+ <authors><author><name>Magerevol Magento Extensions</name><user>kingkaleemkhan</user><email>support@magerevol.com</email></author></authors>
13
+ <date>2013-01-25</date>
14
+ <time>19:53:12</time>
15
+ <contents><target name="magelocal"><dir name="Magerevol"><dir name="Quickcontact"><dir name="Block"><dir name="Adminhtml"><dir name="Quickcontact"><dir name="Edit"><file name="Form.php" hash="a9e458d5dab4b782cd16923b3be11448"/><dir name="Tab"><file name="Form.php" hash="d8643a82f71697c5ce23fc5fc379e009"/></dir><file name="Tabs.php" hash="a3a54a1d1c86fc79de4b68b804add4ad"/></dir><file name="Edit.php" hash="f68976852727840eb03e6c1444a23958"/><file name="Grid.php" hash="e980ccd4ac38ad4e10edac2ac6f1d00d"/></dir><file name="Quickcontact.php" hash="ae1f05228d7430c06eeff33a53f353ab"/></dir><file name="Form.php" hash="9baad13e10a1b8f873746b36de0ef2da"/><file name="Quickcontact.php" hash="c4e99fa1ab969fe7439d9ff02b0bd038"/></dir><dir name="Helper"><file name="Data.php" hash="5bcfbd2f04c44f10a732e7b9a98905c0"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Quickcontact"><file name="Collection.php" hash="a59cea27db83e6a779eb49ca67cd7e2b"/></dir><file name="Quickcontact.php" hash="369eb21ef2101fd50b775a5d572879d4"/></dir><file name="Quickcontact.php" hash="8a71bab150a6086a0d4abe5ee9b9900d"/><file name="Status.php" hash="2f35bae145b5f03c741218b471025689"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="QuickcontactController.php" hash="b127f6a80afd76dd7099c44cd1357ae3"/></dir><file name="ContactController.php" hash="b6d64dbee08141e1992b50d81bebb185"/><file name="IndexController.php" hash="3a5f8574fc96e1152a46efbd84b2d42d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="8056befbbdc3072d57f9b84f07203edf"/><file name="config.xml" hash="6d1c940c4dcd13af5dc3d59b48062cbf"/><file name="system.xml" hash="aa5b06b49293c3c5f7bf1a56eebcffe8"/></dir><dir name="sql"><dir name="quickcontact_setup"><file name="mysql4-install-1.0.0.php" hash="31b598512f99b42034c7b5c863eeaa50"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magerevol_Quickcontact.xml" hash="79a12a5ba71c95d631d4983b228e875c"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="quickcontact.xml" hash="2bdee480bd8b2f44d2584b8fcc600274"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="quickcontact.xml" hash="706bb9e5c6dc33c6421c312d06f4f9ef"/></dir><dir name="template"><dir name="quickcontact"><file name="quickcontact.phtml" hash="f309d694485da86750abf1a1d7d426d5"/><file name="quickcontact_form.phtml" hash="f4f6e5b1c5fc5a23db4f96e8d06c6a94"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="quickcontact"><file name="qc_bg.png" hash="e188cd521c1290f0d6629f36a1e09d42"/><file name="quickcontact_default.css" hash="cabcfd3b1f6b7b4cf28e3ea38364b787"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="captcha"><dir name="quickcontact"><file name="CaptchaSecurityImages.php" hash="6bcfe0240127a59d195c1fc42434801b"/><file name="Dist-Inking-Regular.otf" hash="47beb5365330d99a6d68d29f2d61c732"/></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.5.0.0</min><max>1.7.0.2</max></package><extension><name>gd</name><min>2.0.28</min><max>3.0</max></extension></required></dependencies>
18
+ </package>
skin/frontend/default/default/css/quickcontact/qc_bg.png ADDED
Binary file
skin/frontend/default/default/css/quickcontact/quickcontact_default.css ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ .footerform_container {text-align: left; float: left; margin-left: 10px; background: url(qc_bg.png) repeat scroll 0 0 #FFFFFF;
2
+ border: 3px solid #999999; border-radius: 10px 10px 10px 10px; padding: 10px;}
3
+ .footerform_container label {line-height: 14px;}
4
+ .footerform_container .form-field .input-text {width: 170px;}
5
+ .footerform_container .form-field textarea {width: 170px; height: 55px;}
6
+ .footerform_container .validation-advice {width: 170px;}
7
+ .footerform_container .form-button {margin-top: 3px;}
8
+ #security_code {margin-top: 3px}