cancel
Showing results for 
Search instead for 
Did you mean: 

SUPEE 10266: Call to undefined method Mage_Adminhtml_CustomerController::_setForcedFormKeyActions()

SUPEE 10266: Call to undefined method Mage_Adminhtml_CustomerController::_setForcedFormKeyActions()

Hello! 


After applying SUPEE 10266 to one of our sites, the customer management screen crashes with the following error: 

Call to undefined method Mage_Adminhtml_CustomerController::_setForcedFormKeyActions() 

The patch log:

Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/code/core/Mage/Admin/Model/Session.php app/code/core/Mage/Admin/Model/Session.php
|index 1c0a434..b3c7155 100644
|--- app/code/core/Mage/Admin/Model/Session.php
|+++ app/code/core/Mage/Admin/Model/Session.php
--------------------------
Patching file app/code/core/Mage/Admin/Model/Session.php using Plan A...
Hunk #1 succeeded at 76.
Hunk #2 succeeded at 100.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Notice.php app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Notice.php
|index ca9c088..b5f6a66 100644
|--- app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Notice.php
|+++ app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Notice.php
--------------------------
Patching file app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Notice.php using Plan A...
Hunk #1 succeeded at 43.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php
|index d7296cb..c4d2609 100644
|--- app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php
|+++ app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php
--------------------------
Patching file app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php using Plan A...
Hunk #1 succeeded at 108.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/code/core/Mage/Adminhtml/Controller/Action.php app/code/core/Mage/Adminhtml/Controller/Action.php
|index 1c4c515..b378fe6 100644
|--- app/code/core/Mage/Adminhtml/Controller/Action.php
|+++ app/code/core/Mage/Adminhtml/Controller/Action.php
--------------------------
Patching file app/code/core/Mage/Adminhtml/Controller/Action.php using Plan A...
Hunk #1 succeeded at 51.
Hunk #2 succeeded at 169.
Hunk #3 succeeded at 186.
Hunk #4 succeeded at 407.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/code/core/Mage/Adminhtml/Model/LayoutUpdate/Validator.php app/code/core/Mage/Adminhtml/Model/LayoutUpdate/Validator.php
|index 5ad19b9..e4a4b30 100644
|--- app/code/core/Mage/Adminhtml/Model/LayoutUpdate/Validator.php
|+++ app/code/core/Mage/Adminhtml/Model/LayoutUpdate/Validator.php
--------------------------
Patching file app/code/core/Mage/Adminhtml/Model/LayoutUpdate/Validator.php using Plan A...
Hunk #1 succeeded at 37.
Hunk #2 succeeded at 76.
Hunk #3 succeeded at 113.
Hunk #4 succeeded at 132.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/code/core/Mage/Adminhtml/controllers/CustomerController.php app/code/core/Mage/Adminhtml/controllers/CustomerController.php
|index b59bb12..91004ee 100644
|--- app/code/core/Mage/Adminhtml/controllers/CustomerController.php
|+++ app/code/core/Mage/Adminhtml/controllers/CustomerController.php
--------------------------
Patching file app/code/core/Mage/Adminhtml/controllers/CustomerController.php using Plan A...
Hunk #1 succeeded at 33.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/code/core/Mage/Adminhtml/controllers/Newsletter/QueueController.php app/code/core/Mage/Adminhtml/controllers/Newsletter/QueueController.php
|index c102d71..dbf974a 100644
|--- app/code/core/Mage/Adminhtml/controllers/Newsletter/QueueController.php
|+++ app/code/core/Mage/Adminhtml/controllers/Newsletter/QueueController.php
--------------------------
Patching file app/code/core/Mage/Adminhtml/controllers/Newsletter/QueueController.php using Plan A...
Hunk #1 succeeded at 63.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php
|index d6605da..74ff7ca 100644
|--- app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php
|+++ app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php
--------------------------
Patching file app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php using Plan A...
Hunk #1 succeeded at 142.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/code/core/Mage/Checkout/controllers/CartController.php app/code/core/Mage/Checkout/controllers/CartController.php
|index 7c9f28f..bee6034 100644
|--- app/code/core/Mage/Checkout/controllers/CartController.php
|+++ app/code/core/Mage/Checkout/controllers/CartController.php
--------------------------
Patching file app/code/core/Mage/Checkout/controllers/CartController.php using Plan A...
Hunk #1 succeeded at 284.
Hunk #2 succeeded at 711.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/code/core/Mage/Core/Model/Email/Template/Abstract.php app/code/core/Mage/Core/Model/Email/Template/Abstract.php
|index 794e924..d597358 100644
|--- app/code/core/Mage/Core/Model/Email/Template/Abstract.php
|+++ app/code/core/Mage/Core/Model/Email/Template/Abstract.php
--------------------------
Patching file app/code/core/Mage/Core/Model/Email/Template/Abstract.php using Plan A...
Hunk #1 succeeded at 235.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/code/core/Mage/Core/Model/File/Validator/Image.php app/code/core/Mage/Core/Model/File/Validator/Image.php
|index 9d57202..6a939c3 100644
|--- app/code/core/Mage/Core/Model/File/Validator/Image.php
|+++ app/code/core/Mage/Core/Model/File/Validator/Image.php
--------------------------
Patching file app/code/core/Mage/Core/Model/File/Validator/Image.php using Plan A...
Hunk #1 succeeded at 91.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/code/core/Mage/Core/Model/Session/Abstract/Varien.php app/code/core/Mage/Core/Model/Session/Abstract/Varien.php
|index dff3103..45d7365 100644
|--- app/code/core/Mage/Core/Model/Session/Abstract/Varien.php
|+++ app/code/core/Mage/Core/Model/Session/Abstract/Varien.php
--------------------------
Patching file app/code/core/Mage/Core/Model/Session/Abstract/Varien.php using Plan A...
Hunk #1 succeeded at 136.
Hunk #2 succeeded at 163.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/code/core/Mage/Core/etc/config.xml app/code/core/Mage/Core/etc/config.xml
|index c0ee1a2..3140f7f 100644
|--- app/code/core/Mage/Core/etc/config.xml
|+++ app/code/core/Mage/Core/etc/config.xml
--------------------------
Patching file app/code/core/Mage/Core/etc/config.xml using Plan A...
Hunk #1 succeeded at 467.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/code/core/Mage/Rss/Helper/Data.php app/code/core/Mage/Rss/Helper/Data.php
|index d681e4d..9db3079 100644
|--- app/code/core/Mage/Rss/Helper/Data.php
|+++ app/code/core/Mage/Rss/Helper/Data.php
--------------------------
Patching file app/code/core/Mage/Rss/Helper/Data.php using Plan A...
Hunk #1 succeeded at 74.
Hunk #2 succeeded at 82.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/code/core/Mage/Sales/Model/Resource/Order/Item/Collection.php app/code/core/Mage/Sales/Model/Resource/Order/Item/Collection.php
|index ee83ad48..c02afdf 100644
|--- app/code/core/Mage/Sales/Model/Resource/Order/Item/Collection.php
|+++ app/code/core/Mage/Sales/Model/Resource/Order/Item/Collection.php
--------------------------
Patching file app/code/core/Mage/Sales/Model/Resource/Order/Item/Collection.php using Plan A...
Hunk #1 succeeded at 152.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/code/core/Zend/Serializer/Adapter/PhpCode.php app/code/core/Zend/Serializer/Adapter/PhpCode.php
|new file mode 100644
|index 0000000..4007762
|--- /dev/null
|+++ app/code/core/Zend/Serializer/Adapter/PhpCode.php
--------------------------
(Creating file app/code/core/Zend/Serializer/Adapter/PhpCode.php...)
Patching file app/code/core/Zend/Serializer/Adapter/PhpCode.php using Plan A...
Empty context always matches.
Hunk #1 succeeded at 1.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/design/adminhtml/default/default/template/backup/dialogs.phtml app/design/adminhtml/default/default/template/backup/dialogs.phtml
|index ff8f0d6..76ef54a 100644
|--- app/design/adminhtml/default/default/template/backup/dialogs.phtml
|+++ app/design/adminhtml/default/default/template/backup/dialogs.phtml
--------------------------
Patching file app/design/adminhtml/default/default/template/backup/dialogs.phtml using Plan A...
Hunk #1 succeeded at 120.
Hunk #2 succeeded at 155.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/design/adminhtml/default/default/template/catalog/product/edit/options/type/file.phtml app/design/adminhtml/default/default/template/catalog/product/edit/options/type/file.phtml
|index e04c50d..f94abfe 100644
|--- app/design/adminhtml/default/default/template/catalog/product/edit/options/type/file.phtml
|+++ app/design/adminhtml/default/default/template/catalog/product/edit/options/type/file.phtml
--------------------------
Patching file app/design/adminhtml/default/default/template/catalog/product/edit/options/type/file.phtml using Plan A...
Hunk #1 succeeded at 33.
Hunk #2 succeeded at 45.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/design/adminhtml/default/default/template/customer/tab/view.phtml app/design/adminhtml/default/default/template/customer/tab/view.phtml
|index 5198263..0ae9060 100644
|--- app/design/adminhtml/default/default/template/customer/tab/view.phtml
|+++ app/design/adminhtml/default/default/template/customer/tab/view.phtml
--------------------------
Patching file app/design/adminhtml/default/default/template/customer/tab/view.phtml using Plan A...
Hunk #1 succeeded at 70.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/design/adminhtml/default/default/template/login.phtml app/design/adminhtml/default/default/template/login.phtml
|index f21fadb..427d1ff 100644
|--- app/design/adminhtml/default/default/template/login.phtml
|+++ app/design/adminhtml/default/default/template/login.phtml
--------------------------
Patching file app/design/adminhtml/default/default/template/login.phtml using Plan A...
Hunk #1 succeeded at 58.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/design/adminhtml/default/default/template/notification/toolbar.phtml app/design/adminhtml/default/default/template/notification/toolbar.phtml
|index 880e05c..27227f8 100644
|--- app/design/adminhtml/default/default/template/notification/toolbar.phtml
|+++ app/design/adminhtml/default/default/template/notification/toolbar.phtml
--------------------------
Patching file app/design/adminhtml/default/default/template/notification/toolbar.phtml using Plan A...
Hunk #1 succeeded at 75.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/design/adminhtml/default/default/template/oauth/authorize/form/login-simple.phtml app/design/adminhtml/default/default/template/oauth/authorize/form/login-simple.phtml
|index aa31254..11f2181 100644
|--- app/design/adminhtml/default/default/template/oauth/authorize/form/login-simple.phtml
|+++ app/design/adminhtml/default/default/template/oauth/authorize/form/login-simple.phtml
--------------------------
Patching file app/design/adminhtml/default/default/template/oauth/authorize/form/login-simple.phtml using Plan A...
Hunk #1 succeeded at 58.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/design/adminhtml/default/default/template/oauth/authorize/form/login.phtml app/design/adminhtml/default/default/template/oauth/authorize/form/login.phtml
|index 9e97a8a..8c5ce90 100644
|--- app/design/adminhtml/default/default/template/oauth/authorize/form/login.phtml
|+++ app/design/adminhtml/default/default/template/oauth/authorize/form/login.phtml
--------------------------
Patching file app/design/adminhtml/default/default/template/oauth/authorize/form/login.phtml using Plan A...
Hunk #1 succeeded at 46.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/design/adminhtml/default/default/template/resetforgottenpassword.phtml app/design/adminhtml/default/default/template/resetforgottenpassword.phtml
|index f8bbed5..144f612 100644
|--- app/design/adminhtml/default/default/template/resetforgottenpassword.phtml
|+++ app/design/adminhtml/default/default/template/resetforgottenpassword.phtml
--------------------------
Patching file app/design/adminhtml/default/default/template/resetforgottenpassword.phtml using Plan A...
Hunk #1 succeeded at 53.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/design/adminhtml/default/default/template/sales/order/view/history.phtml app/design/adminhtml/default/default/template/sales/order/view/history.phtml
|index d405481..8c2b8b8 100644
|--- app/design/adminhtml/default/default/template/sales/order/view/history.phtml
|+++ app/design/adminhtml/default/default/template/sales/order/view/history.phtml
--------------------------
Patching file app/design/adminhtml/default/default/template/sales/order/view/history.phtml using Plan A...
Hunk #1 succeeded at 75.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/design/adminhtml/default/default/template/sales/order/view/info.phtml app/design/adminhtml/default/default/template/sales/order/view/info.phtml
|index 41bb943..07e4403 100644
|--- app/design/adminhtml/default/default/template/sales/order/view/info.phtml
|+++ app/design/adminhtml/default/default/template/sales/order/view/info.phtml
--------------------------
Patching file app/design/adminhtml/default/default/template/sales/order/view/info.phtml using Plan A...
Hunk #1 succeeded at 130.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/design/install/default/default/template/install/create_admin.phtml app/design/install/default/default/template/install/create_admin.phtml
|index 2d8e72f..f8b7a91 100644
|--- app/design/install/default/default/template/install/create_admin.phtml
|+++ app/design/install/default/default/template/install/create_admin.phtml
--------------------------
Patching file app/design/install/default/default/template/install/create_admin.phtml using Plan A...
Hunk #1 succeeded at 66.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git app/locale/en_US/Mage_Adminhtml.csv app/locale/en_US/Mage_Adminhtml.csv
|index 343871b..ebb20d3 100644
|--- app/locale/en_US/Mage_Adminhtml.csv
|+++ app/locale/en_US/Mage_Adminhtml.csv
--------------------------
Patching file app/locale/en_US/Mage_Adminhtml.csv using Plan A...
Hunk #1 succeeded at 26.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git downloader/template/login.phtml downloader/template/login.phtml
|index 26a7b84..a846d60 100644
|--- downloader/template/login.phtml
|+++ downloader/template/login.phtml
--------------------------
Patching file downloader/template/login.phtml using Plan A...
Hunk #1 succeeded at 35.
done

 

Any idea how I can fix this?

 

With kind regards,

Brandon

9 REPLIES 9

Re: SUPEE 10266: Call to undefined method Mage_Adminhtml_CustomerController::_setForcedFormKeyAction

Hello,

 

I just had the same issue.

 

Finally, I notice that there were a rewrite of the 'Mage_Adminhtml_Controller_Action' core class in my 'app/code/local/Mage/Adminhtml/Controller' directory.

 

So just have a look to your local directory tree and add diff code like this

 

Regards,

 

Emmanuel

 

Re: SUPEE 10266: Call to undefined method Mage_Adminhtml_CustomerController::_setForcedFormKeyAction

Thank you for your reply!

 

I'm not very experienced with reading the Magento SUPEE patch logs.

Does the log say that there is an actual error hidden in there?

 

I need to be sure that the SUPEE was applied successfully because this happened on a live website belonging to one of our customers.

 

With kind regards,

Brandon

 

Re: SUPEE 10266: Call to undefined method Mage_Adminhtml_CustomerController::_setForcedFormKeyAction

Im having the same problem, with the additional info

/app/code/core/Mage/Adminhtml/controllers/CustomerController.php on line 43 

I've checked both files and they include the new changes form the patch, but still receiving the same error when clicking on customers in admin.

 

Re: SUPEE 10266: Call to undefined method Mage_Adminhtml_CustomerController::_setForcedFormKeyAction

Same issue here. For a quick workaround so we could get in and reset some customer passwords I commented out the new line 43 temporarily in the in the app/code/Mage/Adminhtml/controllers/CustomerController.php file. Went from this

public function preDispatch()
{
$this->_setForcedFormKeyActions('delete');
return parent::preDispatch();
}

to this

public function preDispatch()
 {
   //$this->_setForcedFormKeyActions('delete');
   return parent::preDispatch();
 }

then reset the customer passwords and changed it back. It worked fine, but I'd like to figure out why it isn't working and that's beyond what I know about Magento. The _setForcedFormKeyActions() function appears to be defined in the /app/code/Mage/Adminhtml/Controller/Action.php file, so I don't have any idea why the CustomerController.php file can't see it.

 

Re: SUPEE 10266: Call to undefined method Mage_Adminhtml_CustomerController::_setForcedFormKeyAction

Hi there,

 

Using  Magento 1.8.1.0

 

Its the first time that I write in the forum, because I find amazing that after 3 weeks of reporting this concerning issue, nobody from Magento take care of that. Even more the patch was released 15/09/2017 .

 

Am I missing something?

I can not find any information or fix for this bug anywhere.

Didn't receive a new patch from Magento. What's happening with this issue ?

 

Thanks a lot for your support.

 

Best regards.

 

 

 

Re: SUPEE 10266: Call to undefined method Mage_Adminhtml_CustomerController::_setForcedFormKeyAction

Tracked my issue down. I was overridding the Actions.php file to create a Read-Only user role and completely forgot about it in app/code/local/Mage/Adminhtml/Controller. Getting that updated with the changes from SUPEE-10266 fixed it for me.

Re: SUPEE 10266: Call to undefined method Mage_Adminhtml_CustomerController::_setForcedFormKeyAction

Hello Vigreen.


@vigreen wrote:


The article is quite detailed, I have some related information you can look through:


It looks like you forgot to add your link!

Re: SUPEE 10266: Call to undefined method Mage_Adminhtml_CustomerController::_setForcedFormKeyAction

Hi,

I had the same problem, but it seemed like the Class Mage_Adminhtml_CustomerController used as a parent a file at 

includes/src/Mage_Adminhtml_Controller_Action.php

and not the intended Core File at 

 

app/code/core/Mage/Adminhtml/Controller/Action.php

I checked this by inserting this inside the function before where the missing function is called (Mage_Adminhtml_CustomerController : Line 43).

$reflector = new ReflectionClass('Mage_Adminhtml_Controller_Action');
echo $reflector->getFileName();

I will investigate further.

After further Investigation i realized, that the compiler was still running and using old files. I deactivated the Compiler in Magento Backend and everything was working again.
Maybe you have the same problem. 

Re: SUPEE 10266: Call to undefined method Mage_Adminhtml_CustomerController::_setForcedFormKeyAction

Please check the file : Mage_Adminhtml_Controller_Action and there is some function missing that is required for the issue to resolved.

<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magento.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magento.com for more information.
*
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2017 X.commerce, Inc. and affiliates (http://www.magento.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
/**
* Base adminhtml controller
*
* @category Mage
* @package Mage_Adminhtml
* @author Magento Core Team <core@magentocommerce.com>
*/
class Mage_Adminhtml_Controller_Action extends Mage_Core_Controller_Varien_Action
{
/**
* Name of "is URLs checked" flag
*/
const FLAG_IS_URLS_CHECKED = 'check_url_settings';
/**
* Session namespace to refer in other places
*/
const SESSION_NAMESPACE = 'adminhtml';
/**
* Array of actions which can be processed without secret key validation
*
* @var array
*/
protected $_publicActions = array();
/**
*Array of actions which can't be processed without form key validation
*
* @var array
*/
protected $_forcedFormKeyActions = array();
/**
* Used module name in current adminhtml controller
*/
protected $_usedModuleName = 'adminhtml';
/**
* Currently used area
*
* @var string
*/
protected $_currentArea = 'adminhtml';
/**
* Namespace for session.
*
* @var string
*/
protected $_sessionNamespace = self:Smiley FrustratedESSION_NAMESPACE;
protected function _isAllowed()
{
return Mage::getSingleton('admin/session')->isAllowed('admin');
}
/**
* Retrieve adminhtml session model object
*
* @return Mage_Adminhtml_Model_Session
*/
protected function _getSession()
{
return Mage::getSingleton('adminhtml/session');
}
/**
* Retrieve base admihtml helper
*
* @return Mage_Adminhtml_Helper_Data
*/
protected function _getHelper()
{
return Mage::helper('adminhtml');
}
/**
* Define active menu item in menu block
*
* @return Mage_Adminhtml_Controller_Action
*/
protected function _setActiveMenu($menuPath)
{
$this->getLayout()->getBlock('menu')->setActive($menuPath);
return $this;
}
/**
* @return Mage_Adminhtml_Controller_Action
*/
protected function _addBreadcrumb($label, $title, $link=null)
{
$this->getLayout()->getBlock('breadcrumbs')->addLink($label, $title, $link);
return $this;
}
/**
* @return Mage_Adminhtml_Controller_Action
*/
protected function _addContent(Mage_Core_Block_Abstract $block)
{
$this->getLayout()->getBlock('content')->append($block);
return $this;
}
protected function _addLeft(Mage_Core_Block_Abstract $block)
{
$this->getLayout()->getBlock('left')->append($block);
return $this;
}
protected function _addJs(Mage_Core_Block_Abstract $block)
{
$this->getLayout()->getBlock('js')->append($block);
return $this;
}
/**
* Controller predispatch method
*
* @return Mage_Adminhtml_Controller_Action
*/
public function preDispatch()
{
// override admin store design settings via stores section
Mage::getDesign()
->setArea($this->_currentArea)
->setPackageName((string)Mage::getConfig()->getNode('stores/admin/design/package/name'))
->setTheme((string)Mage::getConfig()->getNode('stores/admin/design/theme/default'))
;
foreach (array('layout', 'template', 'skin', 'locale') as $type) {
if ($value = (string)Mage::getConfig()->getNode("stores/admin/design/theme/{$type}")) {
Mage::getDesign()->setTheme($type, $value);
}
}
$this->getLayout()->setArea($this->_currentArea);
Mage::dispatchEvent('adminhtml_controller_action_predispatch_start', array());
parent:Smiley TonguereDispatch();
$_isValidFormKey = true;
$_isValidSecretKey = true;
$_keyErrorMsg = '';
if (Mage::getSingleton('admin/session')->isLoggedIn()) {
if ($this->getRequest()->isPost() || $this->_checkIsForcedFormKeyAction()) {
$_isValidFormKey = $this->_validateFormKey();
$_keyErrorMsg = Mage::helper('adminhtml')->__('Invalid Form Key. Please refresh the page.');
} elseif (Mage::getSingleton('adminhtml/url')->useSecretKey()) {
$_isValidSecretKey = $this->_validateSecretKey();
$_keyErrorMsg = Mage::helper('adminhtml')->__('Invalid Secret Key. Please refresh the page.');
}
}
if (!$_isValidFormKey || !$_isValidSecretKey) {
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
$this->setFlag('', self::FLAG_NO_POST_DISPATCH, true);
if ($this->getRequest()->getQuery('isAjax', false) || $this->getRequest()->getQuery('ajax', false)) {
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array(
'error' => true,
'message' => $_keyErrorMsg
)));
} else {
if ($_keyErrorMsg != ''){
Mage::getSingleton('adminhtml/session')->addError($_keyErrorMsg);
}
$this->_redirect( Mage::getSingleton('admin/session')->getUser()->getStartupPageUrl() );
}
return $this;
}
if ($this->getRequest()->isDispatched()
&& $this->getRequest()->getActionName() !== 'denied'
&& !$this->_isAllowed()) {
$this->_forward('denied');
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
return $this;
}
if (!$this->getFlag('', self::FLAG_IS_URLS_CHECKED)
&& !$this->getRequest()->getParam('forwarded')
&& !$this->_getSession()->getIsUrlNotice(true)
&& !Mage::getConfig()->getNode('global/can_use_base_url')) {
//$this->_checkUrlSettings();
$this->setFlag('', self::FLAG_IS_URLS_CHECKED, true);
}
if (is_null(Mage::getSingleton('adminhtml/session')->getLocale())) {
Mage::getSingleton('adminhtml/session')->setLocale(Mage::app()->getLocale()->getLocaleCode());
}
return $this;
}
/**
* @deprecated after 1.4.0.0 alpha, logic moved to Mage_Adminhtml_Block_Notification_Baseurl
* @return Mage_Adminhtml_Controller_Action
*/
protected function _checkUrlSettings()
{
/**
* Don't check for data saving actions
*/
if ($this->getRequest()->getPost() || $this->getRequest()->getQuery('isAjax')) {
return $this;
}
$configData = Mage::getModel('core/config_data');
$defaultUnsecure = (string)Mage::getConfig()->getNode(
'default/' . Mage_Core_Model_Store::XML_PATH_UNSECURE_BASE_URL
);
$defaultSecure = (string)Mage::getConfig()->getNode(
'default/' . Mage_Core_Model_Store::XML_PATH_SECURE_BASE_URL
);
if ($defaultSecure == '{{base_url}}' || $defaultUnsecure == '{{base_url}}') {
$this->_getSession()->addNotice(
$this->__('{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure URL / Base Secure URL. It is highly recommended to change this value in your Magento <a href="%s">configuration</a>.', $this->getUrl('adminhtml/system_config/edit', array('section'=>'web')))
);
return $this;
}
$dataCollection = $configData->getCollection()
->addValueFilter('{{base_url}}');
$url = false;
foreach ($dataCollection as $data) {
if ($data->getScope() == 'stores') {
$code = Mage::app()->getStore($data->getScopeId())->getCode();
$url = $this->getUrl('adminhtml/system_config/edit', array('section'=>'web', 'store'=>$code));
}
if ($data->getScope() == 'websites') {
$code = Mage::app()->getWebsite($data->getScopeId())->getCode();
$url = $this->getUrl('adminhtml/system_config/edit', array('section'=>'web', 'website'=>$code));
}
if ($url) {
$this->_getSession()->addNotice(
$this->__('{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure URL / Base Secure URL. It is highly recommended to change this value in your Magento <a href="%s">configuration</a>.', $url)
);
return $this;
}
}
return $this;
}
public function deniedAction()
{
$this->getResponse()->setHeader('HTTP/1.1','403 Forbidden');
if (!Mage::getSingleton('admin/session')->isLoggedIn()) {
$this->_redirect('*/index/login');
return;
}
$this->loadLayout(array('default', 'adminhtml_denied'));
$this->renderLayout();
}
public function loadLayout($ids=null, $generateBlocks=true, $generateXml=true)
{
parent::loadLayout($ids, $generateBlocks, $generateXml);
$this->_initLayoutMessages('adminhtml/session');
return $this;
}
public function norouteAction($coreRoute = null)
{
$this->getResponse()->setHeader('HTTP/1.1','404 Not Found');
$this->getResponse()->setHeader('Status','404 File not found');
$this->loadLayout(array('default', 'adminhtml_noroute'));
$this->renderLayout();
}
/**
* Retrieve currently used module name
*
* @return string
*/
public function getUsedModuleName()
{
return $this->_usedModuleName;
}
/**
* Set currently used module name
*
* @param string $moduleName
* @return Mage_Adminhtml_Controller_Action
*/
public function setUsedModuleName($moduleName)
{
$this->_usedModuleName = $moduleName;
return $this;
}
/**
* Translate a phrase
*
* @return string
*/
public function __()
{
$args = func_get_args();
$expr = new Mage_Core_Model_Translate_Expr(array_shift($args), $this->getUsedModuleName());
array_unshift($args, $expr);
return Mage::app()->getTranslator()->translate($args);
}
/**
* Set referer url for redirect in responce
*
* Is overriden here to set defaultUrl to admin url
*
* @param string $defaultUrl
* @return Mage_Adminhtml_Controller_Action
*/
protected function _redirectReferer($defaultUrl=null)
{
$defaultUrl = empty($defaultUrl) ? $this->getUrl('*') : $defaultUrl;
parent::_redirectReferer($defaultUrl);
return $this;
}
/**
* Set redirect into responce
*
* @param string $path
* @param array $arguments
*/
protected function _redirect($path, $arguments=array())
{
$this->_getSession()->setIsUrlNotice($this->getFlag('', self::FLAG_IS_URLS_CHECKED));
$this->getResponse()->setRedirect($this->getUrl($path, $arguments));
return $this;
}
protected function _forward($action, $controller = null, $module = null, array $params = null)
{
$this->_getSession()->setIsUrlNotice($this->getFlag('', self::FLAG_IS_URLS_CHECKED));
return parent::_forward($action, $controller, $module, $params);
}
/**
* Generate url by route and parameters
*
* @param string $route
* @param array $params
* @return string
*/
public function getUrl($route='', $params=array())
{
return Mage::helper('adminhtml')->getUrl($route, $params);
}
/**
* Validate Secret Key
*
* @return bool
*/
protected function _validateSecretKey()
{
if (is_array($this->_publicActions) && in_array($this->getRequest()->getActionName(), $this->_publicActions)) {
return true;
}
if (!($secretKey = $this->getRequest()->getParam(Mage_Adminhtml_Model_Url:Smiley FrustratedECRET_KEY_PARAM_NAME, null))
|| $secretKey != Mage::getSingleton('adminhtml/url')->getSecretKey()) {
return false;
}
return true;
}
/**
* Validate password for current admin user
*
* @param string $password - current password
*
* @return mixed - returns true or array of errors
*/
protected function _validateCurrentPassword($password)
{
$user = Mage::getSingleton('admin/session')->getUser();
return $user->validateCurrentPassword($password);
}
/**
* Check forced use form key for action
*
* @return bool
*/
protected function _checkIsForcedFormKeyAction()
{
return in_array($this->getRequest()->getActionName(), $this->_forcedFormKeyActions);
}
/**
* Set actions name for forced use form key
*
* @param array | string $actionNames - action names for forced use form key
*/
protected function _setForcedFormKeyActions($actionNames)
{
$actionNames = (is_array($actionNames)) ? $actionNames: (array)$actionNames;
$actionNames = array_merge($this->_forcedFormKeyActions, $actionNames);
$actionNames = array_unique($actionNames);
$this->_forcedFormKeyActions = $actionNames;
}
}