Permalink
Browse files

Patched

  • Loading branch information...
sashas777 committed Apr 17, 2015
1 parent 92ffcc3 commit c7d5fedcba174d9cacc1d7e375cf0226ccc1f736
@@ -44,6 +44,10 @@ public function actionPreDispatchAdmin($observer)
{
$session = Mage::getSingleton('admin/session');
/** @var $session Mage_Admin_Model_Session */
/**
* @var $request Mage_Core_Controller_Request_Http
*/
$request = Mage::app()->getRequest();
$user = $session->getUser();
@@ -58,7 +62,7 @@ public function actionPreDispatchAdmin($observer)
if (in_array($requestedActionName, $openActions)) {
$request->setDispatched(true);
} else {
if($user) {
if ($user) {
$user->reload();
}
if (!$user || !$user->getId()) {
@@ -69,13 +73,14 @@ public function actionPreDispatchAdmin($observer)
$session->login($username, $password, $request);
$request->setPost('login', null);
}
if (!$request->getParam('forwarded')) {
if (!$request->getInternallyForwarded()) {
$request->setInternallyForwarded();
if ($request->getParam('isIframe')) {
$request->setParam('forwarded', true)
->setControllerName('index')
->setActionName('deniedIframe')
->setDispatched(false);
} elseif($request->getParam('isAjax')) {
} elseif ($request->getParam('isAjax')) {
$request->setParam('forwarded', true)
->setControllerName('index')
->setActionName('deniedJson')
@@ -444,7 +444,7 @@ public function getChartUrl($directUrl = true)
}
return self::API_URL . '?' . implode('&', $p);
} else {
$gaData = urlencode(base64_encode(serialize($params)));
$gaData = urlencode(base64_encode(json_encode($params)));
$gaHash = Mage::helper('adminhtml/dashboard_data')->getChartDataHash($gaData);
$params = array('ga' => $gaData, 'h' => $gaHash);
return $this->getUrl('*/*/tunnel', array('_query' => $params));
@@ -92,7 +92,8 @@ public function tunnelAction()
if ($gaData && $gaHash) {
$newHash = Mage::helper('adminhtml/dashboard_data')->getChartDataHash($gaData);
if ($newHash == $gaHash) {
if ($params = unserialize(base64_decode(urldecode($gaData)))) {
$params = json_decode(base64_decode(urldecode($gaData)), true);
if ($params) {
$response = $httpClient->setUri(Mage_Adminhtml_Block_Dashboard_Graph::API_URL)
->setParameterGet($params)
->setConfig(array('timeout' => 5))
@@ -55,7 +55,7 @@ class Mage_Oauth_Adminhtml_Oauth_AuthorizeController extends Mage_Adminhtml_Cont
*/
public function preDispatch()
{
$this->getRequest()->setParam('forwarded', true);
Mage::app()->getRequest()->setInternallyForwarded();
// check login data before it set null in Mage_Admin_Model_Observer::actionPreDispatchAdmin
$loginError = $this->_checkLoginIsEmpty();
@@ -143,7 +143,7 @@ public function actionFrontPreDispatchXmlAdmin($event)
/** @var $request Mage_Core_Controller_Request_Http */
$request = Mage::app()->getRequest();
if (true === $this->_checkAdminController($request, $event->getControllerAction())) {
$request->setParam('forwarded', true)->setDispatched(true);
$request->setInternallyForwarded()->setDispatched(true);
}
}
@@ -160,7 +160,7 @@ public function actionPreDispatchXmlAdmin($event)
if (false === $this->_checkAdminController($request, $event->getControllerAction())
&& !Mage::getSingleton('admin/session')->isLoggedIn()
) {
$request->setParam('forwarded', true)->setRouteName('adminhtml')->setControllerName('connect_user')
$request->setInternallyForwarded()->setRouteName('adminhtml')->setControllerName('connect_user')
->setActionName('loginform')->setDispatched(false);
}
}
@@ -2834,10 +2834,6 @@ public function prepareSqlCondition($fieldName, $condition)
$query = '';
if (is_array($condition)) {
if (isset($condition['field_expr'])) {
$fieldName = str_replace('#?', $this->quoteIdentifier($fieldName), $condition['field_expr']);
unset($condition['field_expr']);
}
$key = key(array_intersect_key($condition, $conditionKeyMap));
if (isset($condition['from']) || isset($condition['to'])) {

10 comments on commit c7d5fed

@Dr3am3rz

This comment has been minimized.

Dr3am3rz replied Apr 20, 2015

Hi, I have followed your steps to update my files. But I got an error message as below :

Fatal error: Call to undefined method Mage_Core_Controller_Request_Http::getInternallyForwarded() in /home/avenuesg/public_html/app/code/core/Mage/Admin/Model/Observer.php on line 76

I'm stuck here, hope you can help me out.

@angela79

This comment has been minimized.

angela79 replied Apr 20, 2015

Hi,
app/code/core/Mage/Core/Controller/Request/Http.php is missing:

diff --git app/code/core/Mage/Core/Controller/Request/Http.php app/code/core/Mage/Core/Controller/Request/Http.php
index 6513db9..31eb6d6 100644
--- app/code/core/Mage/Core/Controller/Request/Http.php
+++ app/code/core/Mage/Core/Controller/Request/Http.php
@@ -76,6 +76,13 @@ class Mage_Core_Controller_Request_Http extends Zend_Controller_Request_Http
protected $_beforeForwardInfo = array();

 /**

+ * Flag for recognizing if request internally forwarded

  • *
    
  • \* @var bool
    
  • _/
    
  • protected $_internallyForwarded = false;
  • /_*
    * Returns ORIGINAL_PATH_INFO.
    * This value is calculated instead of reading PATH_INFO
    * directly from $_SERVER due to cross-platform differences.
    @@ -534,4 +541,26 @@ class Mage_Core_Controller_Request_Http extends Zend_Controller_Request_Http
    }
    return false;
    }
  • /**
  • \* Define that request was forwarded internally
    
  • *
    
  • \* @param boolean $flag
    
  • \* @return Mage_Core_Controller_Request_Http
    
  • _/
    
  • public function setInternallyForwarded($flag = true)
  • {
  •    $this->_internallyForwarded = (bool)$flag;
    
  •    return $this;
    
  • }
  • /_*
  • \* Checks if request was forwarded internally
    
  • *
    
  • \* @return bool
    
  • */
    
  • public function getInternallyForwarded()
  • {
  •    return $this->_internallyForwarded;
    
  • }
    }
@gngoldstein

This comment has been minimized.

gngoldstein replied Apr 20, 2015

Sorry, I'm having the same problem as @Dr3am3rz.

@sashas777

This comment has been minimized.

Owner

sashas777 replied Apr 20, 2015

@gngoldstein

This comment has been minimized.

gngoldstein replied Apr 20, 2015

@sashas777 thanks for your reply. Sorry for my ignorance, is it the information added by @angela79? If not, would you mind to guide me to the right direction? I'm new to Magento :(

@Dr3am3rz

This comment has been minimized.

Dr3am3rz replied Apr 21, 2015

Hi, thanks for the update!

The HTTP.php file was already there, what do I need to do? I have only added the last section of the code but still prompts error.

Attached is the screenshot.
screenshot

@Dr3am3rz

This comment has been minimized.

Dr3am3rz replied Apr 21, 2015

Hi sashas777, I have tried to replace the existing with your file and it worked!

So I have gone through lines by lines to see where are the differences. I have put some comments in your commit : 9ae5e46?diff=split

Not sure whether if you can see it. Kindly take a look and advise if there are any updates to be done.

Thanks for your help again!

@sashas777

This comment has been minimized.

Owner

sashas777 replied Apr 21, 2015

@Dr3am3rz

This comment has been minimized.

Dr3am3rz replied Apr 22, 2015

Thanks for the help! =)

@SteffNC

This comment has been minimized.

SteffNC replied Apr 23, 2015

Thanks for the summary. it helped me a lot..

Please sign in to comment.