View Single Post
  #9  
Old 01-27-2016, 01:12 AM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 10,817
FounderSim is on a distinguished road
Default

See previous post, what I posted about Wallie.

Code I replaced with mine. I added a $safelist array and checked if in it.
Code:
class MyadoptsController extends AppController{

    const PARAM = "aid";
    const PARAM2 = "confirm";
	private $safelist = array("page1", "page2", "page3");
	private $adopt;
	private $image;

    public function __construct(){
        parent::__construct("member");
		$mysidia = Registry::get("mysidia");

		if(!in_array($this->action, $this->safelist))
		{
			if( $this->action != "index"){
				try{
					$this->adopt = new OwnedAdoptable($mysidia->input->get("aid"));	
					if($this->adopt->getOwner() != $mysidia->user->username) throw new NoPermissionException("permission");		
					$this->image = $this->adopt->getImage("gui");
				}
				catch(AdoptNotfoundException $pne){
					$this->setFlags("nonexist_title", "nonexist");
				}              			
			}
		}
    }
__________________
Reply With Quote