Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 01-20-2016, 09:12 PM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 7,617
FounderSim is on a distinguished road
Default Fatal error: Call to a member function setFlags() on a non-object in /class_appcontroller.php

When I access myadopts/add I get this error:
[spoiler]
its driving me crazy!!
[/spoiler]

Fatal error: Call to a member function setFlags() on a non-object in full_path_hidden/class_appcontroller.php on line 192;


So I added two functions.

myadopts.php
Code:
	
//sim edit
	public function add(){
	
		//die("EAT ME");
		$mysidia = Registry::get("mysidia");	
	}
	
//end sim edit
[/code]

my adoptsview.php
Code:
	//
	// Sim Edit
	//
	public function add(){
		
		$mysidia = Registry::get("mysidia");
		
		$document = $this->document;	
		
		$document->setTitle("Do you want to eat me");	
		
		$document->add(new Comment("<br><br>Welcome earthlings...<br>"));

		$eatForm = new Form("eaters", "eater", "post");	


		$eatForm->add(new Button("Eat me if you can", "submit", "submit"));	
		
		$document->add($eatForm);	
	}
	
	//
	// End Sim Edit
	//
__________________
Reply With Quote
  #2  
Old 01-21-2016, 03:55 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,886
Hwona is on a distinguished road
Default Re

Oookay... I'm not exactly great with v1.3.4 or coding, but just to check...
in your adoptsview.php:
$eatForm = new Form("eaters", "eater", "post");
It looks like you're trying to post the form to a page called 'eater' - at least that's how it works with my version.

Try this:
replace $eatForm = new Form("eaters", "eater", "post"); with $eatForm = new Form("eaters", "", "post");

In adoptsview.php, add this to the add function right below $document->setTitle("Do you want to eat me");

if($mysidia->input->post("submit")){
put your "eater" code here?
}

I'm not sure if this is what you were looking for, but I hope it works out for you!
__________________
Reply With Quote
  #3  
Old 01-22-2016, 11:49 PM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 7,617
FounderSim is on a distinguished road
Default

Don't believe that was the issue:

Believe the issue is in the constructor of myadopts.php

Code:
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");
				}
if( $this->action != "index"){, if the page isn't index page of myadopts/, it tries to fetch a pet id ? =)
__________________
Reply With Quote
  #4  
Old 01-23-2016, 02:49 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,886
Hwona is on a distinguished road
Default Re

Quote:
Originally Posted by FounderSim View Post
Don't believe that was the issue:

Believe the issue is in the constructor of myadopts.php

Code:
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");
				}
if( $this->action != "index"){, if the page isn't index page of myadopts/, it tries to fetch a pet id ? =)
Uh... does v.1.3.4 need the try{}?
Reply With Quote
  #5  
Old 01-23-2016, 09:30 AM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 7,617
FounderSim is on a distinguished road
Default

Quote:
Originally Posted by Wallie987 View Post
Uh... does v.1.3.4 need the try{}?
I don't know. Your asking the wrong guy that question. The try block could be removed, but might turn into bigger issues down the road.

I will either be creating a if elseif then with the $this->action or or just use a separate page. =0
__________________
Reply With Quote
  #6  
Old 01-23-2016, 10:34 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,886
Hwona is on a distinguished road
Default

Other such pages Ive seen dont use try.... even though they aim for the same effect.
Reply With Quote
  #7  
Old 01-23-2016, 12:20 PM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 7,617
FounderSim is on a distinguished road
Default

The try statement is better then using IF statements for error checking/handling. Especially when you need a few blocks of code to check for errors opposed to checking each line 1 by 1 for errors.

Maybe HOF hasn't gotten around to rest of pages.
__________________
Reply With Quote
  #8  
Old 01-26-2016, 06:03 PM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,886
Hwona is on a distinguished road
Default

Hi! I think I know why this is happening. Are the two codes you posted the entire files, or just a section?
I was a bit confused with this quite some time ago. Did you construct myadopts like this? I suspect that your were missing the "catch" statement in the _construct function.
PHP Code:
<?php

use Resource\Native\Integer;
use 
Resource\Native\String;

class 
MyadoptsController extends AppController{

    const 
PARAM "aid";
    const 
PARAM2 "confirm";
    private 
$adopt;
    private 
$image;

    public function 
__construct(){
        
parent::__construct("member");
        
$mysidia Registry::get("mysidia");
        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");
            }                          
        }
    }
    
    public function 
index(){
        
$mysidia Registry::get("mysidia");
        
$total $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->user->username}'")->rowCount();
        
$pagination = new Pagination($total10"myadopts");
        
$pagination->setPage($mysidia->input->get("page"));    
        
$stmt $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->user->username}' ORDER BY totalclicks LIMIT {$pagination->getLimit()},{$pagination->getRowsperPage()}");        
        
$this->setField("pagination"$pagination);
        
$this->setField("stmt", new DatabaseStatement($stmt));
    }
    
    public function 
add(){
        
$mysidia Registry::get("mysidia");    
    }
    
}
?>
Reply With Quote
  #9  
Old 01-27-2016, 01:12 AM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 7,617
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
  #10  
Old 01-28-2016, 07:21 PM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,886
Hwona is on a distinguished road
Default

Quote:
Originally Posted by FounderSim View Post
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");
				}              			
			}
		}
    }
Umm, have you tried just checking the page action in the 'if' condition? So... if($this->action != "index" && $this->action != "Page 1"....)
Other than that, I really have no idea as to what could possibly have gone wrong. I'm assuming everything works fine if you revert the file to its original state? :L
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:49 AM.

Currently Active Users: 9666 (0 members and 9666 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636