Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mage_Contacts - DOC block update #699

Merged
merged 2 commits into from
May 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions app/code/core/Mage/Contacts/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,19 @@
*/
class Mage_Contacts_Helper_Data extends Mage_Core_Helper_Abstract
{

const XML_PATH_ENABLED = 'contacts/contacts/enabled';

/**
* @return bool
*/
public function isEnabled()
{
return Mage::getStoreConfig( self::XML_PATH_ENABLED );
return Mage::getStoreConfigFlag(self::XML_PATH_ENABLED);
}

/**
* @return string
*/
public function getUserName()
{
if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
Expand All @@ -50,6 +55,9 @@ public function getUserName()
return trim($customer->getName());
}

/**
* @return string
*/
public function getUserEmail()
{
if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,4 @@ class Mage_Contacts_Model_System_Config_Backend_Links extends Mage_Adminhtml_Mod
* @var array
*/
protected $_cacheTags = array(Mage_Core_Model_Store::CACHE_TAG, Mage_Cms_Model_Block::CACHE_TAG);

}
20 changes: 10 additions & 10 deletions app/code/core/Mage/Contacts/controllers/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,19 @@
*/
class Mage_Contacts_IndexController extends Mage_Core_Controller_Front_Action
{

const XML_PATH_EMAIL_RECIPIENT = 'contacts/email/recipient_email';
const XML_PATH_EMAIL_SENDER = 'contacts/email/sender_email_identity';
const XML_PATH_EMAIL_TEMPLATE = 'contacts/email/email_template';
const XML_PATH_ENABLED = 'contacts/contacts/enabled';

/**
* @return Mage_Core_Controller_Front_Action|void
*/
public function preDispatch()
{
parent::preDispatch();

if( !Mage::getStoreConfigFlag(self::XML_PATH_ENABLED) ) {
if (!Mage::getStoreConfigFlag(self::XML_PATH_ENABLED)) {
$this->norouteAction();
}
}
Expand All @@ -52,7 +54,7 @@ public function indexAction()
{
$this->loadLayout();
$this->getLayout()->getBlock('contactForm')
->setFormAction( Mage::getUrl('*/*/post', array('_secure' => $this->getRequest()->isSecure())) );
->setFormAction(Mage::getUrl('*/*/post', array('_secure' => $this->getRequest()->isSecure())));

$this->_initLayoutMessages('customer/session');
$this->_initLayoutMessages('catalog/session');
Expand All @@ -62,21 +64,21 @@ public function indexAction()
public function postAction()
{
$post = $this->getRequest()->getPost();
if ( $post ) {
if ($post) {
$translate = Mage::getSingleton('core/translate');
/* @var $translate Mage_Core_Model_Translate */
/* @var Mage_Core_Model_Translate $translate */
$translate->setTranslateInline(false);
try {
$postObject = new Varien_Object();
$postObject->setData($post);

$error = false;

if (!Zend_Validate::is(trim($post['name']) , 'NotEmpty')) {
if (!Zend_Validate::is(trim($post['name']), 'NotEmpty')) {
$error = true;
}

if (!Zend_Validate::is(trim($post['comment']) , 'NotEmpty')) {
if (!Zend_Validate::is(trim($post['comment']), 'NotEmpty')) {
$error = true;
}

Expand All @@ -92,7 +94,7 @@ public function postAction()
throw new Exception();
}
$mailTemplate = Mage::getModel('core/email_template');
/* @var $mailTemplate Mage_Core_Model_Email_Template */
/* @var Mage_Core_Model_Email_Template $mailTemplate */
$mailTemplate->setDesignConfig(array('area' => 'frontend'))
->setReplyTo($post['email'])
->sendTransactional(
Expand Down Expand Up @@ -120,10 +122,8 @@ public function postAction()
$this->_redirect('*/*/');
return;
}

} else {
$this->_redirect('*/*/');
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
*/


/* @var $installer Mage_Core_Model_Resource_Setup */
/* @var Mage_Core_Model_Resource_Setup $installer */

$installer = $this;

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/

$installer = $this;
/* @var $installer Mage_Core_Model_Resource_Setup */
/* @var Mage_Core_Model_Resource_Setup $installer */

$installer->startSetup();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
*/

$installer = $this;
/* @var $installer Mage_Core_Model_Resource_Setup */
/* @var Mage_Core_Model_Resource_Setup $installer */
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/

$installer = $this;
/* @var $installer Mage_Core_Model_Resource_Setup */
/* @var Mage_Core_Model_Resource_Setup $installer */

$installer->startSetup();

Expand Down