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

$_REQUEST conversion

Discussion in 'XenForo Development Discussions' started by Mythotical, Sep 17, 2011.

  1. Mythotical

    Mythotical Well-Known Member

    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
     
  2. Jeremy

    Jeremy Well-Known Member

    If you are calling it XFArcade, then all of your classes and file structure should be "XFArcade" and not "Arcade."
     
    Steve Moore likes this.
  3. Mythotical

    Mythotical Well-Known Member

    That is beside the point. It works using Arcade, the name is just a name, the classes are Arcade.
     
  4. Digital Doctor

    Digital Doctor Well-Known Member

    I would think you could avoid conflicts with other Addons by using XFArcade.
     
    Steve Moore likes this.
  5. Mythotical

    Mythotical Well-Known Member

    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.
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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);
    
     
    Steve Moore likes this.
  7. Mythotical

    Mythotical Well-Known Member

    Thanks much Jake. Any advice on the $_REQUEST issue?
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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.
     

Share This Page