• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

$_REQUEST conversion

Mythotical

Well-known member
#1
Ok yes I am working on XFArcade and I can't stand not figuring this out. I thought by changing $_REQUEST to $this->getRequest() that would fix the issue which it did but then the redirect from the game on saving the score stopped working, if I revert then the score part redirects and gives an error. So here is the file using autocom:
PHP:
class Arcade_Extend_ControllerPublic_Index extends XFCP_Arcade_Extend_ControllerPublic_Index {
    public function actionIndex() {
        if ($this->getRequest('autocom') == 'arcade') {
            // TODO: use filterSingle here?
            switch ($this->getRequest()->getParam('do')) {
                case 'verifyscore':
                    return $this->responseReroute('Arcade_ControllerPublic_Arcade', 'IpbVerifyScore');
                case 'savescore':
                    return $this->responseReroute('Arcade_ControllerPublic_Arcade', 'IpbSaveScore');
                default:
                    return $this->responseNoPermission();
            }
        } else {
            return parent::actionIndex();
        }
    }
    
    protected function _checkCsrf($action) {
        if ($this->getRequest('autocom') == 'arcade') {
            self::$_executed['csrf'] = true;
            return true;
        } else {
            return parent::_checkCsrf($action);
        }
    }
}
Just replace $this->getRequest() with $_REQUEST[]

Here is the Session.php line:
PHP:
        extract($this->_getScoreComparison($reversedScoring));
The error is: Only variables should be passed by reference
 

Mythotical

Well-known member
#5
Ok ok, I will change it. Right now I have an issue to fix before anything changes. Otherwise it won't matter how I have it, the mod will break.
 

Jake Bunce

XenForo moderator
Staff member
#6
Here is the Session.php line:
PHP:
        extract($this->_getScoreComparison($reversedScoring));
The error is: Only variables should be passed by reference
That function takes a reference parameter:

http://us2.php.net/manual/en/function.extract.php

You need to pass in a variable instead of a value. For example:

Code:
$var = $this->_getScoreComparison($reversedScoring);

extract($var);
 

Jake Bunce

XenForo moderator
Staff member
#8
Thanks much Jake. Any advice on the $_REQUEST issue?
Nothing off hand. I would need to have access to your addon so I can test, debug, and fully explore what is going on. If you are comfortable giving me a copy then I can install it on my forum and have a look.