Version Notes
1.0.0
-----------------------
First release.
Download this release
Release Info
Developer | Magento Core Team |
Extension | Centerax_Akismet |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Centerax/Akismet/Block/Adminhtml/Akismet/Grid.php +98 -0
- app/code/community/Centerax/Akismet/Block/Adminhtml/Akismet/List.php +16 -0
- app/code/community/Centerax/Akismet/Block/Adminhtml/Akismet/View.php +56 -0
- app/code/community/Centerax/Akismet/Block/Adminhtml/Akismet/View/Form.php +46 -0
- app/code/community/Centerax/Akismet/Helper/Data.php +14 -0
- app/code/community/Centerax/Akismet/Model/Akismet/Akismet.php +10 -0
- app/code/community/Centerax/Akismet/Model/Api.php +118 -0
- app/code/community/Centerax/Akismet/Model/Mysql4/Akismet/Akismet.php +9 -0
- app/code/community/Centerax/Akismet/Model/Mysql4/Akismet/Akismet/Collection.php +9 -0
- app/code/community/Centerax/Akismet/controllers/Adminhtml/AkismetController.php +153 -0
- app/code/community/Centerax/Akismet/controllers/Contacts/IndexController.php +97 -0
- app/code/community/Centerax/Akismet/controllers/Review/ProductController.php +100 -0
- app/code/community/Centerax/Akismet/etc/config.xml +123 -0
- app/code/community/Centerax/Akismet/etc/system.xml +30 -0
- app/code/community/Centerax/Akismet/sql/akismet_setup/mysql4-install-1.0.0.php +22 -0
- app/etc/modules/Centerax_Akismet.xml +10 -0
- app/locale/en_US/Centerax_Akismet.csv +0 -0
- package.xml +20 -0
app/code/community/Centerax/Akismet/Block/Adminhtml/Akismet/Grid.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Centerax_Akismet_Block_Adminhtml_Akismet_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('akismet_spam');
|
10 |
+
$this->setUseAjax(true);
|
11 |
+
$this->setDefaultSort('created_at');
|
12 |
+
$this->setDefaultDir('DESC');
|
13 |
+
$this->setSaveParametersInSession(true);
|
14 |
+
}
|
15 |
+
|
16 |
+
protected function _prepareCollection()
|
17 |
+
{
|
18 |
+
|
19 |
+
$collection = Mage::getModel('akismet/akismet_akismet')->getCollection();
|
20 |
+
$this->setCollection($collection);
|
21 |
+
|
22 |
+
return parent::_prepareCollection();
|
23 |
+
|
24 |
+
}
|
25 |
+
|
26 |
+
protected function _prepareColumns()
|
27 |
+
{
|
28 |
+
|
29 |
+
$this->addColumn('id', array(
|
30 |
+
'header'=> Mage::helper('akismet')->__('ID'),
|
31 |
+
'width' => '80px',
|
32 |
+
'type' => 'text',
|
33 |
+
'index' => 'id',
|
34 |
+
));
|
35 |
+
$this->addColumn('type', array(
|
36 |
+
'header' => Mage::helper('akismet')->__('Type'),
|
37 |
+
'index' => 'type',
|
38 |
+
'type' => 'options',
|
39 |
+
'options' => $this->getTypeOptions(),
|
40 |
+
'width' => '300px',
|
41 |
+
));
|
42 |
+
$this->addColumn('status', array(
|
43 |
+
'header' => Mage::helper('akismet')->__('Status'),
|
44 |
+
'index' => 'status',
|
45 |
+
'type' => 'options',
|
46 |
+
'options' => $this->getStatusesOptions(),
|
47 |
+
'width' => '300px',
|
48 |
+
));
|
49 |
+
$this->addColumn('created_at', array(
|
50 |
+
'header' => Mage::helper('akismet')->__('Created At'),
|
51 |
+
'index' => 'created_at',
|
52 |
+
'type' => 'text',
|
53 |
+
'width' => '300px',
|
54 |
+
));
|
55 |
+
|
56 |
+
$this->addColumn('action',
|
57 |
+
array(
|
58 |
+
'header' => Mage::helper('akismet')->__('Action'),
|
59 |
+
'width' => '100px',
|
60 |
+
'type' => 'action',
|
61 |
+
'getter' => 'getId',
|
62 |
+
'actions' => array(
|
63 |
+
array(
|
64 |
+
'caption' => Mage::helper('akismet')->__('Delete'),
|
65 |
+
'url' => array('base'=>'*/*/delete'),
|
66 |
+
'field' => 'id',
|
67 |
+
'confirm' => Mage::helper('akismet')->__('Are you sure you want to do this?')
|
68 |
+
)
|
69 |
+
),
|
70 |
+
'filter' => false,
|
71 |
+
'sortable' => false,
|
72 |
+
));
|
73 |
+
|
74 |
+
return parent::_prepareColumns();
|
75 |
+
}
|
76 |
+
|
77 |
+
public function getRowUrl($row)
|
78 |
+
{
|
79 |
+
return $this->getUrl('*/*/view', array(
|
80 |
+
'id'=>$row->getId())
|
81 |
+
);
|
82 |
+
}
|
83 |
+
|
84 |
+
public function getGridUrl()
|
85 |
+
{
|
86 |
+
return $this->getUrl('*/*/listGrid', array('_current'=>true));
|
87 |
+
}
|
88 |
+
|
89 |
+
public function getTypeOptions()
|
90 |
+
{
|
91 |
+
return array('contact'=>'Contact Us Form', 'review'=>'Product Review');
|
92 |
+
}
|
93 |
+
|
94 |
+
public function getStatusesOptions()
|
95 |
+
{
|
96 |
+
return array(1=>'Unread', 2=>'Read');
|
97 |
+
}
|
98 |
+
}
|
app/code/community/Centerax/Akismet/Block/Adminhtml/Akismet/List.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Centerax_Akismet_Block_Adminhtml_Akismet_List extends Mage_Adminhtml_Block_Widget_Grid_Container
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
$this->_blockGroup = 'akismet';
|
9 |
+
$this->_controller = 'adminhtml_akismet';
|
10 |
+
$this->_headerText = Mage::helper('akismet')->__('SPAM');
|
11 |
+
|
12 |
+
parent::__construct();
|
13 |
+
$this->removeButton('add');
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/Centerax/Akismet/Block/Adminhtml/Akismet/View.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Centerax_Akismet_Block_Adminhtml_Akismet_View extends Mage_Adminhtml_Block_Widget_Form_Container
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
$this->_objectId = 'id';
|
9 |
+
$this->_controller = 'adminhtml_akismet';
|
10 |
+
$this->_blockGroup = 'akismet';
|
11 |
+
$this->_mode = 'view';
|
12 |
+
|
13 |
+
parent::__construct();
|
14 |
+
|
15 |
+
$this->_removeButton('save');
|
16 |
+
$this->_removeButton('reset');
|
17 |
+
|
18 |
+
if ((int)$this->getSpam()->getStatus() === Centerax_Akismet_Model_Api::UNREAD_STATUS) {
|
19 |
+
$this->_addButton('read', array(
|
20 |
+
'label' => Mage::helper('akismet')->__('Mark as Read'),
|
21 |
+
'onclick' => 'deleteConfirm(\''. Mage::helper('akismet')->__('Are you sure you want to do this?')
|
22 |
+
.'\', \'' . $this->getMarkReadUrl() . '\')',
|
23 |
+
));
|
24 |
+
|
25 |
+
if ($this->getSpam()->getType() == 'review') {
|
26 |
+
$this->_addButton('convert', array(
|
27 |
+
'label' => Mage::helper('akismet')->__('Convert To Review'),
|
28 |
+
'onclick' => 'deleteConfirm(\''. Mage::helper('akismet')->__('Are you sure you want to do this?')
|
29 |
+
.'\', \'' . $this->getConvertUrl() . '\')',
|
30 |
+
));
|
31 |
+
}
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getConvertUrl()
|
38 |
+
{
|
39 |
+
return $this->getUrl('*/*/convertToReview', array($this->_objectId => $this->getRequest()->getParam($this->_objectId)));
|
40 |
+
}
|
41 |
+
|
42 |
+
public function getMarkReadUrl()
|
43 |
+
{
|
44 |
+
return $this->getUrl('*/*/markread', array($this->_objectId => $this->getRequest()->getParam($this->_objectId)));
|
45 |
+
}
|
46 |
+
|
47 |
+
public function getSpam()
|
48 |
+
{
|
49 |
+
return Mage::registry('akismet_spam');
|
50 |
+
}
|
51 |
+
|
52 |
+
public function getHeaderText()
|
53 |
+
{
|
54 |
+
return Mage::helper('akismet')->__('Viewing SPAM');
|
55 |
+
}
|
56 |
+
}
|
app/code/community/Centerax/Akismet/Block/Adminhtml/Akismet/View/Form.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Centerax_Akismet_Block_Adminhtml_Akismet_View_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _prepareForm()
|
7 |
+
{
|
8 |
+
$model = Mage::registry('akismet_spam');
|
9 |
+
|
10 |
+
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => Mage::getUrl('*/*/save'), 'method' => 'post'));
|
11 |
+
|
12 |
+
$fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('akismet')->__('SPAM details')));
|
13 |
+
|
14 |
+
if ($model->getId()) {
|
15 |
+
$fieldset->addField('id', 'hidden', array(
|
16 |
+
'name' => 'id',
|
17 |
+
));
|
18 |
+
}
|
19 |
+
|
20 |
+
$spamData = unserialize($model->getExtra());
|
21 |
+
foreach($spamData as $k=>$f):
|
22 |
+
|
23 |
+
if($k == 'comment_type')
|
24 |
+
continue;
|
25 |
+
|
26 |
+
$fieldset->addField($k, ( (strlen($f)>30) ? 'textarea' : 'text' ), array(
|
27 |
+
'name' => $k,
|
28 |
+
'label' => Mage::helper('akismet')->__( $this->helper('akismet')->slug($k) ),
|
29 |
+
'id' => $k,
|
30 |
+
'style' => 'background:#FAFAFA;width:300px;',
|
31 |
+
'readonly' =>'readonly',
|
32 |
+
'title' => Mage::helper('akismet')->__( $this->helper('akismet')->slug($k) ),
|
33 |
+
'required' => false
|
34 |
+
));
|
35 |
+
|
36 |
+
endforeach;
|
37 |
+
|
38 |
+
$form->setValues($spamData);
|
39 |
+
|
40 |
+
$form->setUseContainer(true);
|
41 |
+
$this->setForm($form);
|
42 |
+
|
43 |
+
return parent::_prepareForm();
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
app/code/community/Centerax/Akismet/Helper/Data.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Centerax_Akismet_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
public function slug($str)
|
7 |
+
{
|
8 |
+
$str = strtolower(trim(str_replace('comment_', '',$str)));
|
9 |
+
$str = preg_replace('/[^a-z0-9-]/', '-', $str);
|
10 |
+
$str = preg_replace('/-+/', " ", $str);
|
11 |
+
return ucwords($str);
|
12 |
+
}
|
13 |
+
|
14 |
+
}
|
app/code/community/Centerax/Akismet/Model/Akismet/Akismet.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Centerax_Akismet_Model_Akismet_Akismet extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('akismet/akismet_akismet');
|
8 |
+
}
|
9 |
+
|
10 |
+
}
|
app/code/community/Centerax/Akismet/Model/Api.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Centerax_Akismet_Model_Api extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
const READ_STATUS = 2;
|
6 |
+
const UNREAD_STATUS = 1;
|
7 |
+
|
8 |
+
protected $_akismetKey = null;
|
9 |
+
|
10 |
+
protected function _getAkismetModel($setCA = true)
|
11 |
+
{
|
12 |
+
$model = Mage::getModel('akismet/akismet_akismet');
|
13 |
+
|
14 |
+
if($setCA)
|
15 |
+
$model->setCreatedAt(Mage::getModel('core/date')->date('Y-m-d H:i:s'));
|
16 |
+
|
17 |
+
return $model;
|
18 |
+
}
|
19 |
+
|
20 |
+
public function getHttpHelper()
|
21 |
+
{
|
22 |
+
return Mage::helper('core/http');
|
23 |
+
}
|
24 |
+
|
25 |
+
public function getAkismetApiKey()
|
26 |
+
{
|
27 |
+
if(is_null($this->_akismetKey)){
|
28 |
+
$this->_akismetKey = Mage::getStoreConfig('contacts/akismet/api_key');
|
29 |
+
}
|
30 |
+
return $this->_akismetKey;
|
31 |
+
}
|
32 |
+
|
33 |
+
protected function _getAkismet()
|
34 |
+
{
|
35 |
+
return new Zend_Service_Akismet($this->getAkismetApiKey(), Mage::getUrl('/'));
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Filter spam contact messages
|
40 |
+
*/
|
41 |
+
public function filterContactsPostData()
|
42 |
+
{
|
43 |
+
$akismet = $this->_getAkismet();
|
44 |
+
|
45 |
+
$isSpam = false;
|
46 |
+
|
47 |
+
// Verify akismet api key
|
48 |
+
if ($akismet->verifyKey($this->getAkismetApiKey())) {
|
49 |
+
$post = Mage::getModel('core/url')->getRequest()->getPost();
|
50 |
+
$data = array(
|
51 |
+
'user_ip' => $this->getHttpHelper()->getRemoteAddr(),
|
52 |
+
'user_agent' => $this->getHttpHelper()->getHttpUserAgent(),
|
53 |
+
'comment_type' => 'contact',
|
54 |
+
'comment_author' => $post['name'],
|
55 |
+
'comment_author_email' => $post['email'],
|
56 |
+
'comment_content' => $post['comment']
|
57 |
+
);
|
58 |
+
|
59 |
+
// Check if the submit post is spam
|
60 |
+
if ($akismet->isSpam($data)) {
|
61 |
+
$this->_getAkismetModel()->setExtra(serialize($data))->setType('contact')->save();
|
62 |
+
$isSpam = true;
|
63 |
+
}
|
64 |
+
}else{
|
65 |
+
// Log exception for admin reference
|
66 |
+
Mage::logException('Invalid Akismet API Key');
|
67 |
+
}
|
68 |
+
|
69 |
+
return $isSpam;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Filter spam contact messages
|
74 |
+
*/
|
75 |
+
public function filterProductReviewPostData($productId)
|
76 |
+
{
|
77 |
+
$akismet = $this->_getAkismet();
|
78 |
+
|
79 |
+
$isSpam = false;
|
80 |
+
|
81 |
+
// Verify akismet api key
|
82 |
+
if ($akismet->verifyKey($this->getAkismetApiKey())) {
|
83 |
+
$post = Mage::getModel('core/url')->getRequest()->getPost();
|
84 |
+
$data = array(
|
85 |
+
'user_ip' => $this->getHttpHelper()->getRemoteAddr(),
|
86 |
+
'user_agent' => $this->getHttpHelper()->getHttpUserAgent(),
|
87 |
+
'comment_type' => 'review',
|
88 |
+
'comment_author' => $post['nickname'],
|
89 |
+
'comment_content' => $post['detail']
|
90 |
+
);
|
91 |
+
// Check if the submit post is spam
|
92 |
+
if ($akismet->isSpam($data)) {
|
93 |
+
|
94 |
+
$data['product_id'] = $productId;
|
95 |
+
$data['title'] = $post['title'];
|
96 |
+
$data['store_id'] = Mage::app()->getStore()->getId();
|
97 |
+
$data['customer_id'] = Mage::getSingleton('customer/session')->getCustomerId();
|
98 |
+
|
99 |
+
$this->_getAkismetModel()->setExtra(serialize($data))->setType('review')->save();
|
100 |
+
$isSpam = true;
|
101 |
+
}
|
102 |
+
}else{
|
103 |
+
// Log exception for admin reference
|
104 |
+
Mage::logException('Invalid Akismet API Key');
|
105 |
+
}
|
106 |
+
|
107 |
+
return $isSpam;
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Submit FALSE POSITIVE
|
112 |
+
*/
|
113 |
+
public function submitHam()
|
114 |
+
{
|
115 |
+
//ToDo
|
116 |
+
}
|
117 |
+
|
118 |
+
}
|
app/code/community/Centerax/Akismet/Model/Mysql4/Akismet/Akismet.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Centerax_Akismet_Model_Mysql4_Akismet_Akismet extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('akismet/akismet_akismet', 'id');
|
8 |
+
}
|
9 |
+
}
|
app/code/community/Centerax/Akismet/Model/Mysql4/Akismet/Akismet/Collection.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Centerax_Akismet_Model_Mysql4_Akismet_Akismet_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('akismet/akismet_akismet');
|
8 |
+
}
|
9 |
+
}
|
app/code/community/Centerax/Akismet/controllers/Adminhtml/AkismetController.php
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Centerax_Akismet_Adminhtml_AkismetController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _initAction()
|
7 |
+
{
|
8 |
+
$this->loadLayout()
|
9 |
+
->_setActiveMenu('system');
|
10 |
+
return $this;
|
11 |
+
}
|
12 |
+
|
13 |
+
public function indexAction()
|
14 |
+
{
|
15 |
+
$this->_initAction()
|
16 |
+
->_addContent($this->getLayout()->createBlock('akismet/adminhtml_akismet_list'))
|
17 |
+
->renderLayout();
|
18 |
+
}
|
19 |
+
|
20 |
+
public function listGridAction()
|
21 |
+
{
|
22 |
+
$this->loadLayout();
|
23 |
+
$this->getResponse()->setBody(
|
24 |
+
$this->getLayout()->createBlock('akismet/adminhtml_akismet_grid')->toHtml()
|
25 |
+
);
|
26 |
+
}
|
27 |
+
|
28 |
+
public function deleteAction()
|
29 |
+
{
|
30 |
+
$id = $this->getRequest()->getParam('id');
|
31 |
+
if(!$id){
|
32 |
+
$this->_getSession()->addError($this->__('ID not provided'));
|
33 |
+
$this->_redirect('*/*/');
|
34 |
+
return;
|
35 |
+
}
|
36 |
+
$model = Mage::getModel('akismet/akismet_akismet');
|
37 |
+
$obj = $model->load($id);
|
38 |
+
|
39 |
+
if($obj->getId()){
|
40 |
+
try{
|
41 |
+
$obj->delete();
|
42 |
+
}catch(Exception $e){
|
43 |
+
$this->_getSession()->addError($this->__('Could not delete PDF on file system'));
|
44 |
+
$this->_redirect('*/*/');
|
45 |
+
return;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
$this->_getSession()->addSuccess($this->__('Record successfuly deleted'));
|
50 |
+
$this->_redirect('*/*/');
|
51 |
+
return;
|
52 |
+
}
|
53 |
+
|
54 |
+
public function markreadAction()
|
55 |
+
{
|
56 |
+
$id = $this->getRequest()->getParam('id');
|
57 |
+
|
58 |
+
$model = Mage::getModel('akismet/akismet_akismet');
|
59 |
+
if($id){
|
60 |
+
$model->load($id);
|
61 |
+
if (! $model->getId()) {
|
62 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('This record no longer exists'));
|
63 |
+
$this->_redirect('*/*/');
|
64 |
+
return;
|
65 |
+
}else{
|
66 |
+
try{
|
67 |
+
$model->setStatus(Centerax_Akismet_Model_Api::READ_STATUS)
|
68 |
+
->save();
|
69 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Success'));
|
70 |
+
$this->_redirect('*/*/');
|
71 |
+
return;
|
72 |
+
}catch(Exception $e){
|
73 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('An error ocurred: %s', $e->getMessage()));
|
74 |
+
$this->_redirect('*/*/');
|
75 |
+
return;
|
76 |
+
}
|
77 |
+
}
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
public function convertToReviewAction()
|
82 |
+
{
|
83 |
+
$id = $this->getRequest()->getParam('id');
|
84 |
+
$model = Mage::getModel('akismet/akismet_akismet');
|
85 |
+
|
86 |
+
if ($id) {
|
87 |
+
$model->load($id);
|
88 |
+
if (! $model->getId()) {
|
89 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('This record no longer exists'));
|
90 |
+
$this->_redirect('*/*/');
|
91 |
+
return;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
$spamD = unserialize($model->getExtra());
|
96 |
+
|
97 |
+
try{
|
98 |
+
$id = Mage::getModel('review/review')
|
99 |
+
->setTitle($spamD['title'])
|
100 |
+
->setNickname($spamD['comment_author'])
|
101 |
+
->setDetail($spamD['comment_content'])
|
102 |
+
->setEntityId(Mage_Review_Model_Review::ENTITY_PRODUCT)
|
103 |
+
->setEntityPkValue($spamD['product_id'])
|
104 |
+
->setStatusId(Mage_Review_Model_Review::STATUS_PENDING)
|
105 |
+
->setCustomerId($spamD['customer_id'])
|
106 |
+
->setStoreId($spamD['store_id'])
|
107 |
+
->setStores(array($spamD['store_id']))
|
108 |
+
->save();
|
109 |
+
|
110 |
+
if($id->getReviewId()){
|
111 |
+
|
112 |
+
Mage::getModel('akismet/akismet_akismet')->setId($model->getId())->setStatus(Centerax_Akismet_Model_Api::READ_STATUS)->save();
|
113 |
+
$viewReviewURL = $this->getUrl('adminhtml/catalog_product_review/edit', array('id' => $id->getReviewId()));
|
114 |
+
|
115 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->__('A new review was created <a href="%s">Edit</a>', $viewReviewURL));
|
116 |
+
$this->_redirect('*/*/');
|
117 |
+
return;
|
118 |
+
}
|
119 |
+
}catch(Exception $e){
|
120 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__($e->getMessage()));
|
121 |
+
$this->_redirect('*/*/');
|
122 |
+
return;
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
public function viewAction()
|
127 |
+
{
|
128 |
+
$id = $this->getRequest()->getParam('id');
|
129 |
+
$model = Mage::getModel('akismet/akismet_akismet');
|
130 |
+
|
131 |
+
if ($id) {
|
132 |
+
$model->load($id);
|
133 |
+
if (! $model->getId()) {
|
134 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('This record no longer exists'));
|
135 |
+
$this->_redirect('*/*/');
|
136 |
+
return;
|
137 |
+
}
|
138 |
+
}
|
139 |
+
// Restore previously entered form data from session
|
140 |
+
$data = Mage::getSingleton('adminhtml/session')->getAkismetSpamData(true);
|
141 |
+
if (!empty($data)) {
|
142 |
+
$model->setData($data);
|
143 |
+
}
|
144 |
+
|
145 |
+
Mage::register('akismet_spam', $model);
|
146 |
+
|
147 |
+
$this->_initAction()
|
148 |
+
->_addContent($this->getLayout()->createBlock('akismet/adminhtml_akismet_view'));
|
149 |
+
|
150 |
+
$this->renderLayout();
|
151 |
+
}
|
152 |
+
|
153 |
+
}
|
app/code/community/Centerax/Akismet/controllers/Contacts/IndexController.php
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once 'Mage/Contacts/controllers/IndexController.php';
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Contacts index controller
|
7 |
+
*
|
8 |
+
* @category Centerax
|
9 |
+
* @package Centerax_Akismet
|
10 |
+
* @author Centerax <cx@pablobenitez.com>
|
11 |
+
*/
|
12 |
+
class Centerax_Akismet_Contacts_IndexController extends Mage_Contacts_IndexController
|
13 |
+
{
|
14 |
+
|
15 |
+
public function postAction()
|
16 |
+
{
|
17 |
+
|
18 |
+
$post = $this->getRequest()->getPost();
|
19 |
+
if ($post) {
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Check for SPAM
|
23 |
+
*/
|
24 |
+
$isSpam = false;
|
25 |
+
try{
|
26 |
+
$isSpam = Mage::getModel('akismet/api')->filterContactsPostData();
|
27 |
+
if($isSpam === true){
|
28 |
+
Mage::getSingleton('customer/session')->addSuccess(Mage::helper('contacts')->__('Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.'));
|
29 |
+
$this->_redirect('*/*/');
|
30 |
+
return;
|
31 |
+
}
|
32 |
+
}catch(Exception $e){
|
33 |
+
Mage::logException($e);
|
34 |
+
}
|
35 |
+
/**
|
36 |
+
* Check for SPAM
|
37 |
+
*/
|
38 |
+
|
39 |
+
$translate = Mage::getSingleton('core/translate');
|
40 |
+
/* @var $translate Mage_Core_Model_Translate */
|
41 |
+
$translate->setTranslateInline(false);
|
42 |
+
try {
|
43 |
+
$postObject = new Varien_Object();
|
44 |
+
$postObject->setData($post);
|
45 |
+
|
46 |
+
$error = false;
|
47 |
+
|
48 |
+
if (!Zend_Validate::is(trim($post['name']) , 'NotEmpty')) {
|
49 |
+
$error = true;
|
50 |
+
}
|
51 |
+
|
52 |
+
if (!Zend_Validate::is(trim($post['comment']) , 'NotEmpty')) {
|
53 |
+
$error = true;
|
54 |
+
}
|
55 |
+
|
56 |
+
if (!Zend_Validate::is(trim($post['email']), 'EmailAddress')) {
|
57 |
+
$error = true;
|
58 |
+
}
|
59 |
+
if ($error) {
|
60 |
+
throw new Exception();
|
61 |
+
}
|
62 |
+
$mailTemplate = Mage::getModel('core/email_template');
|
63 |
+
/* @var $mailTemplate Mage_Core_Model_Email_Template */
|
64 |
+
$mailTemplate->setDesignConfig(array('area' => 'frontend'))
|
65 |
+
->setReplyTo($post['email'])
|
66 |
+
->sendTransactional(
|
67 |
+
Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE),
|
68 |
+
Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER),
|
69 |
+
Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT),
|
70 |
+
null,
|
71 |
+
array('data' => $postObject)
|
72 |
+
);
|
73 |
+
|
74 |
+
if (!$mailTemplate->getSentSuccess()) {
|
75 |
+
throw new Exception();
|
76 |
+
}
|
77 |
+
|
78 |
+
$translate->setTranslateInline(true);
|
79 |
+
|
80 |
+
Mage::getSingleton('customer/session')->addSuccess(Mage::helper('contacts')->__('Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.'));
|
81 |
+
$this->_redirect('*/*/');
|
82 |
+
|
83 |
+
return;
|
84 |
+
} catch (Exception $e) {
|
85 |
+
$translate->setTranslateInline(true);
|
86 |
+
|
87 |
+
Mage::getSingleton('customer/session')->addError(Mage::helper('contacts')->__('Unable to submit your request. Please, try again later'));
|
88 |
+
$this->_redirect('*/*/');
|
89 |
+
return;
|
90 |
+
}
|
91 |
+
|
92 |
+
} else {
|
93 |
+
$this->_redirect('*/*/');
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
}
|
app/code/community/Centerax/Akismet/controllers/Review/ProductController.php
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once 'Mage/Review/controllers/ProductController.php';
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Contacts index controller
|
7 |
+
*
|
8 |
+
* @category Centerax
|
9 |
+
* @package Centerax_Akismet
|
10 |
+
* @author Centerax <cx@pablobenitez.com>
|
11 |
+
*/
|
12 |
+
class Centerax_Akismet_Review_ProductController extends Mage_Review_ProductController
|
13 |
+
{
|
14 |
+
|
15 |
+
public function postAction()
|
16 |
+
{
|
17 |
+
if ($data = Mage::getSingleton('review/session')->getFormData(true)) {
|
18 |
+
$rating = array();
|
19 |
+
if (isset($data['ratings']) && is_array($data['ratings'])) {
|
20 |
+
$rating = $data['ratings'];
|
21 |
+
}
|
22 |
+
} else {
|
23 |
+
$data = $this->getRequest()->getPost();
|
24 |
+
$rating = $this->getRequest()->getParam('ratings', array());
|
25 |
+
}
|
26 |
+
|
27 |
+
if (($product = $this->_initProduct()) && !empty($data)) {
|
28 |
+
$session = Mage::getSingleton('core/session');
|
29 |
+
/* @var $session Mage_Core_Model_Session */
|
30 |
+
Mage::log($data);
|
31 |
+
$review = Mage::getModel('review/review')->setData($data);
|
32 |
+
/* @var $review Mage_Review_Model_Review */
|
33 |
+
|
34 |
+
$validate = $review->validate();
|
35 |
+
if ($validate === true) {
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Check for SPAM
|
39 |
+
*/
|
40 |
+
$isSpam = false;
|
41 |
+
try{
|
42 |
+
$isSpam = Mage::getModel('akismet/api')->filterProductReviewPostData($product->getId());
|
43 |
+
if($isSpam === true){
|
44 |
+
$session->addSuccess(Mage::helper('contacts')->__('Your review has been accepted for moderation.'));
|
45 |
+
$this->_redirectReferer();
|
46 |
+
return;
|
47 |
+
}
|
48 |
+
}catch(Exception $e){
|
49 |
+
Mage::logException($e);
|
50 |
+
}
|
51 |
+
/**
|
52 |
+
* Check for SPAM
|
53 |
+
*/
|
54 |
+
|
55 |
+
try {
|
56 |
+
$review->setEntityId(Mage_Review_Model_Review::ENTITY_PRODUCT)
|
57 |
+
->setEntityPkValue($product->getId())
|
58 |
+
->setStatusId(Mage_Review_Model_Review::STATUS_PENDING)
|
59 |
+
->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId())
|
60 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
61 |
+
->setStores(array(Mage::app()->getStore()->getId()))
|
62 |
+
->save();
|
63 |
+
|
64 |
+
foreach ($rating as $ratingId => $optionId) {
|
65 |
+
Mage::getModel('rating/rating')
|
66 |
+
->setRatingId($ratingId)
|
67 |
+
->setReviewId($review->getId())
|
68 |
+
->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId())
|
69 |
+
->addOptionVote($optionId, $product->getId());
|
70 |
+
}
|
71 |
+
|
72 |
+
$review->aggregate();
|
73 |
+
$session->addSuccess($this->__('Your review has been accepted for moderation'));
|
74 |
+
}
|
75 |
+
catch (Exception $e) {
|
76 |
+
$session->setFormData($data);
|
77 |
+
$session->addError($this->__('Unable to post review. Please, try again later.'));
|
78 |
+
}
|
79 |
+
}
|
80 |
+
else {
|
81 |
+
$session->setFormData($data);
|
82 |
+
if (is_array($validate)) {
|
83 |
+
foreach ($validate as $errorMessage) {
|
84 |
+
$session->addError($errorMessage);
|
85 |
+
}
|
86 |
+
}
|
87 |
+
else {
|
88 |
+
$session->addError($this->__('Unable to post review. Please, try again later.'));
|
89 |
+
}
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
+
if ($redirectUrl = Mage::getSingleton('review/session')->getRedirectUrl(true)) {
|
94 |
+
$this->_redirectUrl($redirectUrl);
|
95 |
+
return;
|
96 |
+
}
|
97 |
+
$this->_redirectReferer();
|
98 |
+
}
|
99 |
+
|
100 |
+
}
|
app/code/community/Centerax/Akismet/etc/config.xml
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<modules>
|
3 |
+
<Centerax_Akismet>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
</Centerax_Akismet>
|
6 |
+
</modules>
|
7 |
+
<global>
|
8 |
+
<blocks>
|
9 |
+
<akismet>
|
10 |
+
<class>Centerax_Akismet_Block</class>
|
11 |
+
</akismet>
|
12 |
+
</blocks>
|
13 |
+
<helpers>
|
14 |
+
<akismet>
|
15 |
+
<class>Centerax_Akismet_Helper</class>
|
16 |
+
</akismet>
|
17 |
+
</helpers>
|
18 |
+
<rewrite>
|
19 |
+
<contacts_index_post>
|
20 |
+
<from><![CDATA[#contacts/index/post(.*)#]]></from>
|
21 |
+
<to>cxakismet/contacts_index/post$1</to>
|
22 |
+
</contacts_index_post>
|
23 |
+
<review_product_post>
|
24 |
+
<from><![CDATA[#review/product/post(.*)#]]></from>
|
25 |
+
<to>cxakismet/review_product/post$1</to>
|
26 |
+
</review_product_post>
|
27 |
+
</rewrite>
|
28 |
+
<models>
|
29 |
+
<akismet>
|
30 |
+
<class>Centerax_Akismet_Model</class>
|
31 |
+
<resourceModel>akismet_mysql4</resourceModel>
|
32 |
+
</akismet>
|
33 |
+
<akismet_mysql4>
|
34 |
+
<class>Centerax_Akismet_Model_Mysql4</class>
|
35 |
+
<entities>
|
36 |
+
<akismet_akismet>
|
37 |
+
<table>centerax_akismet</table>
|
38 |
+
</akismet_akismet>
|
39 |
+
</entities>
|
40 |
+
</akismet_mysql4>
|
41 |
+
</models>
|
42 |
+
<resources>
|
43 |
+
<akismet_setup>
|
44 |
+
<setup>
|
45 |
+
<module>Centerax_Akismet</module>
|
46 |
+
</setup>
|
47 |
+
<connection>
|
48 |
+
<use>core_setup</use>
|
49 |
+
</connection>
|
50 |
+
</akismet_setup>
|
51 |
+
<akismet_write>
|
52 |
+
<connection>
|
53 |
+
<use>core_write</use>
|
54 |
+
</connection>
|
55 |
+
</akismet_write>
|
56 |
+
<akismet_read>
|
57 |
+
<connection>
|
58 |
+
<use>core_read</use>
|
59 |
+
</connection>
|
60 |
+
</akismet_read>
|
61 |
+
</resources>
|
62 |
+
</global>
|
63 |
+
<admin>
|
64 |
+
<routers>
|
65 |
+
<akismet>
|
66 |
+
<use>admin</use>
|
67 |
+
<args>
|
68 |
+
<module>Centerax_Akismet</module>
|
69 |
+
<frontName>akismet</frontName>
|
70 |
+
</args>
|
71 |
+
</akismet>
|
72 |
+
</routers>
|
73 |
+
</admin>
|
74 |
+
<frontend>
|
75 |
+
<routers>
|
76 |
+
<akismet>
|
77 |
+
<use>standard</use>
|
78 |
+
<args>
|
79 |
+
<module>Centerax_Akismet</module>
|
80 |
+
<frontName>cxakismet</frontName>
|
81 |
+
</args>
|
82 |
+
</akismet>
|
83 |
+
</routers>
|
84 |
+
</frontend>
|
85 |
+
<adminhtml>
|
86 |
+
<acl>
|
87 |
+
<resources>
|
88 |
+
<admin>
|
89 |
+
<children>
|
90 |
+
<system>
|
91 |
+
<children>
|
92 |
+
<akismet translate="title" module="adminnotification">
|
93 |
+
<title>Akismet SPAM</title>
|
94 |
+
<sort_order>90</sort_order>
|
95 |
+
</akismet>
|
96 |
+
</children>
|
97 |
+
</system>
|
98 |
+
</children>
|
99 |
+
</admin>
|
100 |
+
</resources>
|
101 |
+
</acl>
|
102 |
+
<menu>
|
103 |
+
<system>
|
104 |
+
<children>
|
105 |
+
<akismet translate="title" module="akismet">
|
106 |
+
<title>Akismet Anti SPAM</title>
|
107 |
+
<action>akismet/adminhtml_akismet</action>
|
108 |
+
<sort_order>199</sort_order>
|
109 |
+
</akismet>
|
110 |
+
</children>
|
111 |
+
</system>
|
112 |
+
</menu>
|
113 |
+
<translate>
|
114 |
+
<modules>
|
115 |
+
<Centerax_Akismet>
|
116 |
+
<files>
|
117 |
+
<default>Centerax_Akismet.csv</default>
|
118 |
+
</files>
|
119 |
+
</Centerax_Akismet>
|
120 |
+
</modules>
|
121 |
+
</translate>
|
122 |
+
</adminhtml>
|
123 |
+
</config>
|
app/code/community/Centerax/Akismet/etc/system.xml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<contacts>
|
5 |
+
<groups>
|
6 |
+
<akismet translate="label">
|
7 |
+
<label>Akismet</label>
|
8 |
+
<comment><![CDATA[<div class="box">Support this extension by clicking on this button <a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=GD7N3F58XDX56&lc=UY&item_name=Support+Centerax+Development¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted"><img src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" border="0" valign="bottom" alt="PayPal - The safer, easier way to pay online!" /></a></div>]]>
|
9 |
+
</comment>
|
10 |
+
<frontend_type>text</frontend_type>
|
11 |
+
<sort_order>99</sort_order>
|
12 |
+
<show_in_default>1</show_in_default>
|
13 |
+
<show_in_website>1</show_in_website>
|
14 |
+
<show_in_store>1</show_in_store>
|
15 |
+
<fields>
|
16 |
+
<api_key translate="label">
|
17 |
+
<label>API Key</label>
|
18 |
+
<frontend_type>text</frontend_type>
|
19 |
+
<comment>You may get one for signing up for a WordPress.com account. You do not need to activate a blog; simply acquiring the account will provide you with the API key.</comment>
|
20 |
+
<sort_order>1</sort_order>
|
21 |
+
<show_in_default>1</show_in_default>
|
22 |
+
<show_in_website>1</show_in_website>
|
23 |
+
<show_in_store>1</show_in_store>
|
24 |
+
</api_key>
|
25 |
+
</fields>
|
26 |
+
</akismet>
|
27 |
+
</groups>
|
28 |
+
</contacts>
|
29 |
+
</sections>
|
30 |
+
</config>
|
app/code/community/Centerax/Akismet/sql/akismet_setup/mysql4-install-1.0.0.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
5 |
+
|
6 |
+
$installer->startSetup();
|
7 |
+
|
8 |
+
$installer->run("
|
9 |
+
|
10 |
+
DROP TABLE IF EXISTS `{$this->getTable('centerax_akismet')}`;
|
11 |
+
CREATE TABLE `{$this->getTable('centerax_akismet')}` (
|
12 |
+
`id` int(11) unsigned NOT NULL auto_increment,
|
13 |
+
`type` enum('contact', 'review') NOT NULL default 'contact',
|
14 |
+
`status` int(1) unsigned NOT NULL default 1 COMMENT 'SPAM status',
|
15 |
+
`extra` text NOT NULL default '',
|
16 |
+
`created_at` datetime NOT NULL default '0000-00-00 00:00:00',
|
17 |
+
PRIMARY KEY (`id`)
|
18 |
+
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
19 |
+
|
20 |
+
");
|
21 |
+
|
22 |
+
$installer->endSetup();
|
app/etc/modules/Centerax_Akismet.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Centerax_Akismet>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<version>1.0.0</version>
|
8 |
+
</Centerax_Akismet>
|
9 |
+
</modules>
|
10 |
+
</config>
|
app/locale/en_US/Centerax_Akismet.csv
ADDED
Binary file
|
package.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Centerax_Akismet</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Prevent SPAM</summary>
|
10 |
+
<description>Prevent SPAM</description>
|
11 |
+
<notes>1.0.0
|
12 |
+
-----------------------
|
13 |
+
First release.</notes>
|
14 |
+
<authors><author><name>Pablo S. Benitez</name><user>auto-converted</user><email>pablos.benitez@gmail.com</email></author></authors>
|
15 |
+
<date>2009-10-29</date>
|
16 |
+
<time>00:59:46</time>
|
17 |
+
<contents><target name="magecommunity"><dir name="Centerax"><dir name="Akismet"><dir name="Block"><dir name="Adminhtml"><dir name="Akismet"><dir name="View"><file name="Form.php" hash="217663dc9d87f39e959cc24d9b8fbd98"/></dir><file name="Grid.php" hash="9be1d5ff7a4d783d29555e41fdde9b0c"/><file name="List.php" hash="a945c274754d4494a293f2c58a55475f"/><file name="View.php" hash="d17daf03dab5750a67f60c578be58530"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AkismetController.php" hash="322a0f656c8f4d705eb4fb757569a9f4"/></dir><dir name="Contacts"><file name="IndexController.php" hash="5d7e95670f6f738b9e013a0a19838aa7"/></dir><dir name="Review"><file name="ProductController.php" hash="b4a83bf76c0ee89285029b850122daf1"/></dir></dir><dir name="etc"><file name="config.xml" hash="57e1efec3b56def9a295f7bdaef67c3e"/><file name="system.xml" hash="fb64f9256962c1d5d72760d2e59b18a4"/></dir><dir name="Helper"><file name="Data.php" hash="d5c57d1405dc974479eb466f26aecebb"/></dir><dir name="Model"><dir name="Akismet"><file name="Akismet.php" hash="f52b5ab54a3366723d2ab57fef87c3aa"/></dir><dir name="Mysql4"><dir name="Akismet"><dir name="Akismet"><file name="Collection.php" hash="c1e92d1b90a6367e7a37f1bcc60fa984"/></dir><file name="Akismet.php" hash="d96949f57a11f1d01085b435b896ca3e"/></dir></dir><file name="Api.php" hash="bc0a09fae62b1b83d2702b6dc2a76f15"/></dir><dir name="sql"><dir name="akismet_setup"><file name="mysql4-install-1.0.0.php" hash="b727a75a850e0c51b1bb79a55aaf831b"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Centerax_Akismet.csv" hash="7e58f7c33fb8cf7686dbbd0d8a7ae8fe"/></dir></target><target name="mageetc"><dir name="modules"><file name="Centerax_Akismet.xml" hash="c18ad670cbda1844637dcf492a309905"/></dir></target></contents>
|
18 |
+
<compatible/>
|
19 |
+
<dependencies/>
|
20 |
+
</package>
|