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-16-2017, 09:21 AM
ffsharriet ffsharriet is offline
Member
 
Join Date: Jan 2017
Posts: 22
Gender: Female
Credits: 4,794
ffsharriet is on a distinguished road
Default Problem accessing page

Can't access the /myadopts page or the /adopt page. It displays this message on /myadopts:

Parse error: syntax error, unexpected end of file, expecting function (T_FUNCTION) in /home/equiland/public_html/classes/class_ownedadoptable.php on line 230

and the /adopt page is white blank page.

This is the code in /classes/class_ownedadoptable.php:

Code:
class OwnedAdoptable extends Adoptable{

    protected $aid;
    protected $name;
    protected $owner;
    protected $currentlevel;
    protected $totalclicks;
    protected $code;
    protected $imageurl;
    protected $usealternates;
    protected $tradestatus;
    protected $isfrozen;  
    protected $gender;
    protected $offsprings;
    protected $lastbred;
    protected $nextlevel;
    protected $voters;
  
    public function __construct($aid, $owner = ""){      
        $mysidia = Registry::get("mysidia");
        $whereClause = "aid ='{$aid}'";
        if(!empty($owner)) $whereClause .= " and owner = '{$owner}'";
        $row = $mysidia->db->select("owned_adoptables", array(), $whereClause)->fetchObject();
        if(!is_object($row)) throw new AdoptNotfoundException("Adoptable ID {$aid} does not exist or does not belong to the owner specified...");
        
        parent::__construct($row->type);
        foreach($row as $key => $val){
            $this->$key = $val;              
        }      
    }

    public function getAdoptID(){
        return $this->aid;
    }

    public function getName(){
        return $this->name;
    }
    
    public function setName($name, $assignMode = ""){
        if($assignMode == Model::UPDATE) $this->save("name", $name);
        $this->name = $name;
    }

    public function getOwner($fetchMode = ""){
        if($fetchMode == Model::MODEL) return new Member($this->owner);
        else return $this->owner;
    }
    
    public function setOwner($owner, $assignMode = ""){
        if($assignMode == Model::UPDATE) $this->save("owner", $owner);
        $this->owner = $owner;
    }
  
    public function getCurrentLevel($fetchMode = ""){
        if($fetchMode == Model::MODEL) return new AdoptLevel($this->type, $this->currentlevel);
        else return $this->currentlevel;
    }
    
    public function setCurrentLevel($level, $assignMode = ""){
        if($assignMode == Model::UPDATE){
            $this->save("currentlevel", $level);
            if($this->getAltStatus() == "yes") $this->save("usealternates", "yes");
        }
        $this->currentlevel = $level;
    }
    
    public function getTotalClicks(){
        return $this->totalclicks;
    }
    
    public function setTotalClicks($clicks, $assignMode = ""){
        if($assignMode == Model::UPDATE) $this->save("totalclicks", $clicks);
        $this->totalclicks = $clicks;
    }
    
    public function getCode(){
        return $this->code;
    }
    
    public function getImageURL($fetchMode = ""){
        if($fetchMode == Model::GUI) return new Image($this->imageurl);
        else return $this->imageurl;
    }
    
    public function useAlternates(){
        return $this->usealternates;
    }
    
    public function getTradeStatus(){
        return $this->tradestatus;
    }
    
    public function setTradeStatus($status, $assignMode = ""){
        if($assignMode == Model::UPDATE) $this->save("tradestatus", $status);
        $this->tradestatus = $status;
    }
    
    public function isFrozen(){
        return $this->isfrozen;
    }
    
    public function setFrozen($frozen = TRUE, $assignMode = ""){
        if($assignMode == Model::UPDATE) $this->save("isfrozen", $frozen);
        $this->isfrozen = $frozen;
    }
    
    public function getGender($fetchMode = ""){
        if($fetchMode == Model::GUI) return new Image("picuploads/{$this->gender}.png");
        else return $this->gender;
    }
    
    public function getOffsprings(){
        return $this->offsprings;
    }
    
    public function setOffsprings($offsprings = 1, $assignMode = ""){
        $this->offsprings = $offsprings; 
        if($assignMode == Model::UPDATE) $this->save("offsprings", $this->offsprings);
    }
    
    public function getLastBred($fetchMode = ""){
        if($fetchMode == Model::OBJ) return new DateTime($this->lastbred);
        return $this->lastbred;
    }
    
    public function setLastBred($lastBred = 0, $assignMode = ""){
        if($assignMode == Model::UPDATE) $this->save("lastbred", $lastBred);
        $this->lastbred = $lastBred;    
    }
  
    public function getAltStatus(){
        if($this->alternates == "enabled" and $this->currentlevel == $this->altoutlevel){
            $rand = mt_rand(1, $this->altchance);
            if($rand == 1) return "yes";            
        }
        return "no";
    }
    
    public function getImage($fetchMode = ""){
        if($this->imageurl) return $this->getImageUrl($fetchMode);
        if($this->currentlevel == 0) return $this->getEggImage($fetchMode);
        
        $mysidia = Registry::get("mysidia");        
        $level = $this->getCurrentLevel("model");
        if($this->useAlternates() == "yes") return $level->getAlternateImage($fetchMode);
        else return $level->getPrimaryImage($fetchMode);            
    }
  
      public function hasNextLevel(){
        try{
            $this->nextlevel = new AdoptLevel($this->type, $this->currentlevel + 1);
            return TRUE;
        }
        catch(LevelNotfoundException $lne){
            return FALSE;
        }
    }
    
    public function getNextLevel(){
        if(!$this->nextlevel) return FALSE;
        return $this->nextlevel;
    }
    
    public function getLevelupClicks(){
        if(!$this->nextlevel) return FALSE;
        return $this->nextlevel->getRequiredClicks() - $this->totalclicks;
    }
    
    public function getStats(){
        $mysidia = Registry::get("mysidia");
        $document = $mysidia->frame->getDocument();    
        $stats = new Division("adoptstats");
        $stats->add(new Comment("<br><br><b>Total Clicks: {$this->totalclicks}"));
        $stats->add(new Comment("Gender: ", FALSE));
        $stats->add(new Image("picuploads/{$this->gender}.png"));
        
        if($this->hasNextLevel()){
            $level = $this->getNextLevel();
            $levelupClicks = $this->getLevelupClicks();
            $nextLevel = $level->getLevel().$mysidia->lang->clicks.$levelupClicks; 
        }
        else $nextLevel = $mysidia->lang->maximum;
        
        $adoptStats = "<br>Trade Status: {$this->tradestatus}<br>
                       Current Level: {$this->currentlevel}<br>Next Level: {$nextLevel}</b>";
        $stats->add(new Comment($adoptStats));
        return $stats;        
    }
    
    public function hasVoter($user, $date = ""){
        if(!$date) $date = new DateTime;        
        $mysidia = Registry::get("mysidia");
        
        if($user instanceof Member){            
            $whereClause = "adoptableid='{$this->aid}' and username = '{$user->username}' and date = '{$date->format('Y-m-d')}'";
        }
        else{
            $ip = secure($_SERVER['REMOTE_ADDR']);
            $whereClause = "adoptableid='{$mysidia->input->get("aid")}' and ip = '{$ip}' and date = '{$date->format('Y-m-d')}'";
        }    
        
        $void = $mysidia->db->select("vote_voters", array("void"), $whereClause)->fetchColumn();
        if(is_numeric($void)) return TRUE;
        else return FALSE;        
    }
    
    protected function save($field, $value){
        $mysidia = Registry::get("mysidia");
        $mysidia->db->update("owned_adoptables", array($field => $value), "aid='{$this->aid}'");
    }
Reply With Quote
  #2  
Old 01-16-2017, 09:35 AM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 516
Gender: Unknown/Other
Credits: 78,914
Dinocanid is on a distinguished road
Default

You're missing a "}" at the end of the code. There should another one on the line below the last one.
Also as a tip, could you use the php bbcode when posting these? ([+php][+/php], remove the plus signs) It makes the post shorter so you don't have to scroll down so far when you post long codes.
__________________
Reply With Quote
  #3  
Old 01-16-2017, 10:46 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 487,276
Hall of Famer is on a distinguished road
Default

Quote:
Originally Posted by Dinocanid View Post
Also as a tip, could you use the php bbcode when posting these? ([+php][+/php], remove the plus signs) It makes the post shorter so you don't have to scroll down so far when you post long codes.
Actually, nowadays I find the PHP bbcode no longer works, it condenses the code to one line and its very difficult to read. Not sure if it happens to you, but you can use [code] tag as a workaround. It wont have syntax highlighting, but it will be at least a lot more readable.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #4  
Old 01-16-2017, 02:05 PM
ffsharriet ffsharriet is offline
Member
 
Join Date: Jan 2017
Posts: 22
Gender: Female
Credits: 4,794
ffsharriet is on a distinguished road
Default ...

It's now saying this:

Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /home/equiland/public_html/view/myadoptsview.php on line 72

Line 72 is:

Code:
public function stats()
Full code below:

Code:
<?php

use Resource\Native\String;
use Resource\Collection\LinkedList;
use Resource\Collection\LinkedHashMap;

class MyadoptsView extends View{
	
	public function index(){
	    $mysidia = Registry::get("mysidia");
		$document = $this->document;
	    $document->setTitle($this->lang->title);
 
        $pagination = $this->getField("pagination");
		$stmt = $this->getField("stmt")->get();
		if($stmt->rowCount() == 0){
		    $document->addLangvar($this->lang->empty);
		    return;
		}
		
	    $adoptTable = new TableBuilder("adopttable", 650);
		$adoptTable->setAlign(new Align("center", "middle"));
		$adoptTable->buildHeaders("Gender", "Name/Type", "Image", "Clicks", "Level");
		
		while($aid = $stmt->fetchColumn()){
		    $adopt = new OwnedAdoptable($aid);
			$cells = new LinkedList;
		    $cells->add(new TCell($adopt->getGender("gui")));
			$cells->add(new TCell("<em>{$adopt->getName()}</em> the {$adopt->getType()}"));
			$cells->add(new TCell(new Link("myadopts/manage/{$aid}", $adopt->getImage("gui"))));
			$cells->add(new TCell($adopt->getTotalClicks()));
			$cells->add(new TCell($adopt->getCurrentLevel()));
			$adoptTable->buildRow($cells);
		}
		$document->add($adoptTable);
		$document->addLangvar($pagination->showPage());
	}
	
	public function manage(){
        $health = $adopt->getHealth(); 
        $mood = $adopt->getMood(); 
$addHealth = $adopt->getHealth() + 10; 
$addMood = $adopt->getMood() + 10; 
$subtractHealth = $adopt->getHealth() - 10; 
$subtractMood = $adopt->getMood() - 10;
$document->add(new Comment ("Health: <progress max='100' value='{$health}'></progress> <br></br>Mood: <progress max='100' value='{$mood}'></progress>"));  
		$mysidia = Registry::get("mysidia");
		$aid = $this->getField("aid")->getValue();
		$name = $this->getField("name")->getValue();
		$image = $this->getField("image");
		
		$document = $this->document;		
		$document->setTitle("Managing {$name}");
		$document->add($image);
		$document->add(new Comment("<br><br>This page allows you to manage {$name}.  Click on an option below to change settings.<br>"));
		
		$document->add(new Image("templates/icons/add.gif"));
		$document->add(new Link("levelup/click/{$aid}", " Level Up {$name}", TRUE));
		$document->add(new Image("templates/icons/stats.gif"));
		$document->add(new Link("myadopts/stats/{$aid}", " Get Stats for {$name}", TRUE));
		$document->add(new Image("templates/icons/bbcodes.gif"));
		$document->add(new Link("myadopts/bbcode/{$aid}", " Get BBCodes / HTML Codes for {$name}", TRUE));
	   	$document->add(new Image("templates/icons/title.gif"));
		$document->add(new Link("myadopts/rename/{$aid}", " Rename {$name}", TRUE)); 
		$document->add(new Image("templates/icons/trade.gif"));
		$document->add(new Link("myadopts/trade/{$aid}", " Change Trade status for {$name}", TRUE)); 
		$document->add(new Image("templates/icons/freeze.gif"));
		$document->add(new Link("myadopts/freeze/{$aid}", " Freeze or Unfreeze {$name}", TRUE)); 
		$document->add(new Image("templates/icons/delete.gif"));
		$document->add(new Link("pound/pound/{$aid}", " Pound {$name}", TRUE));}
	}
	{public function stats()
		$mysidia = Registry::get("mysidia");
		$adopt = $this->getField("adopt");		
		$image = $this->getField("image");
		$stmt = $this->getField("stmt")->get();
		
		$document = $this->document;			
        $document->setTitle($adopt->getName().$this->lang->stats);
        $document->add($image);	
		$document->add($adopt->getStats());					   				       
        $document->addLangvar("<h2>{$adopt->getName()}'s Voters:</h2><br>{$this->lang->voters}<br><br>");	
		
        $fields = new LinkedHashMap;
		$fields->put(new String("username"), new String("getUsername"));
		$fields->put(new String("date"), NULL);
		$fields->put(new String("username::profile"), new String("getProfileImage"));
		$fields->put(new String("username::message"), new String("getPMImage"));
		
	    $voterTable = new TableBuilder("voters", 500);
		$voterTable->setAlign(new Align("center"));
		$voterTable->buildHeaders("User", "Date Voted", "Profile", "PM");
		$voterTable->setHelper(new UserTableHelper);
		$voterTable->buildTable($stmt, $fields);
		$document->add($voterTable);
	}
	
	public function bbcode(){
		$mysidia = Registry::get("mysidia");
		$adopt = $this->getField("adopt");			
		$document = $this->document;
		$document->setTitle($this->lang->bbcode.$adopt->getName()); 
		$document->addLangvar($this->lang->bbcode_info);
		$document->add(new Comment("<br>"));
		
        $forumComment = new Comment("Forum BBCode: ");		
		$forumComment->setUnderlined();
        $forumcode = "[img]{$mysidia->path->getAbsolute()}levelup/siggy/{$adopt->getAdoptID()}[/img]";		
	    $forumArea = new TextArea("forumcode", $forumcode, 4, 50);
		$forumArea->setReadOnly(TRUE);
		
		$altComment = new Comment("Alternative BBCode: ");		
		$altComment->setUnderlined();
        $altcode = "[img]{$mysidia->path->getAbsolute()}get/{$adopt->getAdoptID()}.gif"[/img]";
	    $altArea = new TextArea("altcode", $altcode, 4, 50);
		$altArea->setReadOnly(TRUE);
		
		$htmlComment = new Comment("HTML BBCode: ");		
		$htmlComment->setUnderlined();
        $htmlcode = "<a href='{$mysidia->path->getAbsolute()}levelup/click/{$adopt->getAdoptID()}' target='_blank'>
	                 <img src='{$mysidia->path->getAbsolute()}levelup/siggy/{$adopt->getAdoptID()}' border=0></a>";
	    $htmlArea = new TextArea("htmlcode", $htmlcode, 4, 50);
		$htmlArea->setReadOnly(TRUE);
		
		$document->add($forumComment);
		$document->add($forumArea);
		$document->add($altComment);
		$document->add(($mysidia->settings->usealtbbcode == "yes")?$altArea:new Comment("The Admin has disabled Alt BBCode for this site."));
		$document->add($htmlComment);
		$document->add($htmlArea);
	}
	
	public function rename(){
		$mysidia = Registry::get("mysidia");
		$adopt = $this->getField("adopt");		
		$image = $this->getField("image");		
		$document = $this->document;
		
		if($mysidia->input->post("submit")){
			$document->setTitle($this->lang->rename_success_title);
			$document->add($image);
			$message = "<br>{$this->lang->rename_success}{$mysidia->input->post("adoptname")}. 
					    You can now manage {$mysidia->input->post("adoptname")} on the";
			$document->addLangvar($message);
			$document->add(new Link("myadopts/manage/{$adopt->getAdoptID()}", "My Adopts Page"));
			return;
		}
		
		$document->setTitle($this->lang->rename.$adopt->getName());
		$document->add($image);
		$document->addLangvar("<br />{$this->lang->rename_default}{$adopt->getName()}{$this->lang->rename_details}<br />");
		
		$renameForm = new FormBuilder("renameform", "", "post");
		$renameForm->buildTextField("adoptname")->buildButton("Rename Adopt", "submit", "submit");
		$document->add($renameForm);		   
	}
	
	public function trade(){
		$mysidia = Registry::get("mysidia");
		$aid = $this->getField("aid")->getValue();		
		$image = $this->getField("image");	
        $message = $this->getField("message")->getValue();		
		$document = $this->document;
        $document->setTitle($this->lang->trade);
		$document->add($image);
		$document->addLangvar($message);
	}
	
	public function freeze(){
		$mysidia = Registry::get("mysidia");
		$adopt = $this->getField("adopt");		
		$image = $this->getField("image");	
        $message = $this->getField("message")->getValue();			
		$document = $this->document;		
		$document->setTitle($this->lang->freeze);	
		
		if($mysidia->input->get("confirm") == "confirm"){
			 $document->addLangvar($message);
			 $document->add(new Link("myadopts/manage/{$adopt->getAdoptID()}", "My Adopts Page"));        
	    }	 
	    else{
		    $document->add($image);
			$document->add(new Comment("<br /><b>{$adopt->getName()}'s Current Status: "));
			
		    if($adopt->isfrozen() == "yes"){			    
			    $document->add(new Image("templates/icons/freeze.gif", "Frozen"));
				$document->add(new Comment("Frozen<br<br>"));
				$document->add(new Comment($this->lang->freeze));
				$document->add(new Image("templates/icons/unfreeze.gif", "Unfreeze"));
				$document->add(new Link("myadopts/freeze/{$adopt->getAdoptID()}/confirm", "Unfreeze this Adoptable", TRUE));
			}
			else{
			    $document->add(new Image("templates/icons/unfreeze.gif", "Not Frozen"));
				$document->add(new Comment("Not Frozen<br><br>"));
				$document->add(new Comment($this->lang->freeze));
				$document->add(new Image("templates/icons/freeze.gif", "Greeze"));
				$document->add(new Link("myadopts/freeze/{$adopt->getAdoptID()}/confirm", "Freeze this Adoptable", TRUE));
			}
            $document->add(new Comment("<br><br>"));
            $document->add(new Image("templates/icons/warning.gif"));
			$document->addLangvar($this->lang->freeze_warning);
	    }
	}
}
?>
Reply With Quote
  #5  
Old 01-16-2017, 02:09 PM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 516
Gender: Unknown/Other
Credits: 78,914
Dinocanid is on a distinguished road
Default

Public function stats shouldn't have a "{" in front of it.
__________________
Reply With Quote
  #6  
Old 01-16-2017, 02:42 PM
ffsharriet ffsharriet is offline
Member
 
Join Date: Jan 2017
Posts: 22
Gender: Female
Credits: 4,794
ffsharriet is on a distinguished road
Default

I've removed it and it's still showing the same message :/
Reply With Quote
  #7  
Old 01-16-2017, 03:18 PM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 516
Gender: Unknown/Other
Credits: 78,914
Dinocanid is on a distinguished road
Default

Try this:
PHP Code:
<?php

use Resource\Native\String;
use 
Resource\Collection\LinkedList;
use 
Resource\Collection\LinkedHashMap;

class 
MyadoptsView extends View{
    
    public function 
index(){
        
$mysidia Registry::get("mysidia");
        
$document $this->document;
        
$document->setTitle($this->lang->title);
 
        
$pagination $this->getField("pagination");
        
$stmt $this->getField("stmt")->get();
        if(
$stmt->rowCount() == 0){
            
$document->addLangvar($this->lang->empty);
            return;
        }
        
        
$adoptTable = new TableBuilder("adopttable"650);
        
$adoptTable->setAlign(new Align("center""middle"));
        
$adoptTable->buildHeaders("Gender""Name/Type""Image""Clicks""Level");
        
        while(
$aid $stmt->fetchColumn()){
            
$adopt = new OwnedAdoptable($aid);
            
$cells = new LinkedList;
            
$cells->add(new TCell($adopt->getGender("gui")));
            
$cells->add(new TCell("<em>{$adopt->getName()}</em> the {$adopt->getType()}"));
            
$cells->add(new TCell(new Link("myadopts/manage/{$aid}"$adopt->getImage("gui"))));
            
$cells->add(new TCell($adopt->getTotalClicks()));
            
$cells->add(new TCell($adopt->getCurrentLevel()));
            
$adoptTable->buildRow($cells);
        }
        
$document->add($adoptTable);
        
$document->addLangvar($pagination->showPage());
    }
    
    public function 
manage(){
        
$health $adopt->getHealth(); 
        
$mood $adopt->getMood(); 
$addHealth $adopt->getHealth() + 10
$addMood $adopt->getMood() + 10
$subtractHealth $adopt->getHealth() - 10
$subtractMood $adopt->getMood() - 10;
$document->add(new Comment ("Health: <progress max='100' value='{$health}'></progress> <br></br>Mood: <progress max='100' value='{$mood}'></progress>"));  
        
$mysidia Registry::get("mysidia");
        
$aid $this->getField("aid")->getValue();
        
$name $this->getField("name")->getValue();
        
$image $this->getField("image");
        
        
$document $this->document;        
        
$document->setTitle("Managing {$name}");
        
$document->add($image);
        
$document->add(new Comment("<br><br>This page allows you to manage {$name}.  Click on an option below to change settings.<br>"));
        
        
$document->add(new Image("templates/icons/add.gif"));
        
$document->add(new Link("levelup/click/{$aid}"" Level Up {$name}"TRUE));
        
$document->add(new Image("templates/icons/stats.gif"));
        
$document->add(new Link("myadopts/stats/{$aid}"" Get Stats for {$name}"TRUE));
        
$document->add(new Image("templates/icons/bbcodes.gif"));
        
$document->add(new Link("myadopts/bbcode/{$aid}"" Get BBCodes / HTML Codes for {$name}"TRUE));
           
$document->add(new Image("templates/icons/title.gif"));
        
$document->add(new Link("myadopts/rename/{$aid}"" Rename {$name}"TRUE)); 
        
$document->add(new Image("templates/icons/trade.gif"));
        
$document->add(new Link("myadopts/trade/{$aid}"" Change Trade status for {$name}"TRUE)); 
        
$document->add(new Image("templates/icons/freeze.gif"));
        
$document->add(new Link("myadopts/freeze/{$aid}"" Freeze or Unfreeze {$name}"TRUE)); 
        
$document->add(new Image("templates/icons/delete.gif"));
        
$document->add(new Link("pound/pound/{$aid}"" Pound {$name}"TRUE));}

    public function 
stats(){
        
$mysidia Registry::get("mysidia");
        
$adopt $this->getField("adopt");        
        
$image $this->getField("image");
        
$stmt $this->getField("stmt")->get();
        
        
$document $this->document;            
        
$document->setTitle($adopt->getName().$this->lang->stats);
        
$document->add($image);    
        
$document->add($adopt->getStats());                                              
        
$document->addLangvar("<h2>{$adopt->getName()}'s Voters:</h2><br>{$this->lang->voters}<br><br>");    
        
        
$fields = new LinkedHashMap;
        
$fields->put(new String("username"), new String("getUsername"));
        
$fields->put(new String("date"), NULL);
        
$fields->put(new String("username::profile"), new String("getProfileImage"));
        
$fields->put(new String("username::message"), new String("getPMImage"));
        
        
$voterTable = new TableBuilder("voters"500);
        
$voterTable->setAlign(new Align("center"));
        
$voterTable->buildHeaders("User""Date Voted""Profile""PM");
        
$voterTable->setHelper(new UserTableHelper);
        
$voterTable->buildTable($stmt$fields);
        
$document->add($voterTable);
    }
    
    public function 
bbcode(){
        
$mysidia Registry::get("mysidia");
        
$adopt $this->getField("adopt");            
        
$document $this->document;
        
$document->setTitle($this->lang->bbcode.$adopt->getName()); 
        
$document->addLangvar($this->lang->bbcode_info);
        
$document->add(new Comment("<br>"));
        
        
$forumComment = new Comment("Forum BBCode: ");        
        
$forumComment->setUnderlined();
        
$forumcode "[img]{$mysidia->path->getAbsolute()}levelup/siggy/{$adopt->getAdoptID()}[/img]";        
        
$forumArea = new TextArea("forumcode"$forumcode450);
        
$forumArea->setReadOnly(TRUE);
        
        
$altComment = new Comment("Alternative BBCode: ");        
        
$altComment->setUnderlined();
        
$altcode "[img]{$mysidia->path->getAbsolute()}get/{$adopt->getAdoptID()}.gif[/img]";
        
$altArea = new TextArea("altcode"$altcode450);
        
$altArea->setReadOnly(TRUE);
        
        
$htmlComment = new Comment("HTML BBCode: ");        
        
$htmlComment->setUnderlined();
        
$htmlcode "<a href='{$mysidia->path->getAbsolute()}levelup/click/{$adopt->getAdoptID()}' target='_blank'>
                     <img src='
{$mysidia->path->getAbsolute()}levelup/siggy/{$adopt->getAdoptID()}' border=0></a>";
        
$htmlArea = new TextArea("htmlcode"$htmlcode450);
        
$htmlArea->setReadOnly(TRUE);
        
        
$document->add($forumComment);
        
$document->add($forumArea);
        
$document->add($altComment);
        
$document->add(($mysidia->settings->usealtbbcode == "yes")?$altArea:new Comment("The Admin has disabled Alt BBCode for this site."));
        
$document->add($htmlComment);
        
$document->add($htmlArea);
    }
    
    public function 
rename(){
        
$mysidia Registry::get("mysidia");
        
$adopt $this->getField("adopt");        
        
$image $this->getField("image");        
        
$document $this->document;
        
        if(
$mysidia->input->post("submit")){
            
$document->setTitle($this->lang->rename_success_title);
            
$document->add($image);
            
$message "<br>{$this->lang->rename_success}{$mysidia->input->post("adoptname")}
                        You can now manage 
{$mysidia->input->post("adoptname")} on the";
            
$document->addLangvar($message);
            
$document->add(new Link("myadopts/manage/{$adopt->getAdoptID()}""My Adopts Page"));
            return;
        }
        
        
$document->setTitle($this->lang->rename.$adopt->getName());
        
$document->add($image);
        
$document->addLangvar("<br />{$this->lang->rename_default}{$adopt->getName()}{$this->lang->rename_details}<br />");
        
        
$renameForm = new FormBuilder("renameform""""post");
        
$renameForm->buildTextField("adoptname")->buildButton("Rename Adopt""submit""submit");
        
$document->add($renameForm);           
    }
    
    public function 
trade(){
        
$mysidia Registry::get("mysidia");
        
$aid $this->getField("aid")->getValue();        
        
$image $this->getField("image");    
        
$message $this->getField("message")->getValue();        
        
$document $this->document;
        
$document->setTitle($this->lang->trade);
        
$document->add($image);
        
$document->addLangvar($message);
    }
    
    public function 
freeze(){
        
$mysidia Registry::get("mysidia");
        
$adopt $this->getField("adopt");        
        
$image $this->getField("image");    
        
$message $this->getField("message")->getValue();            
        
$document $this->document;        
        
$document->setTitle($this->lang->freeze);    
        
        if(
$mysidia->input->get("confirm") == "confirm"){
             
$document->addLangvar($message);
             
$document->add(new Link("myadopts/manage/{$adopt->getAdoptID()}""My Adopts Page"));        
        }     
        else{
            
$document->add($image);
            
$document->add(new Comment("<br /><b>{$adopt->getName()}'s Current Status: "));
            
            if(
$adopt->isfrozen() == "yes"){                
                
$document->add(new Image("templates/icons/freeze.gif""Frozen"));
                
$document->add(new Comment("Frozen<br<br>"));
                
$document->add(new Comment($this->lang->freeze));
                
$document->add(new Image("templates/icons/unfreeze.gif""Unfreeze"));
                
$document->add(new Link("myadopts/freeze/{$adopt->getAdoptID()}/confirm""Unfreeze this Adoptable"TRUE));
            }
            else{
                
$document->add(new Image("templates/icons/unfreeze.gif""Not Frozen"));
                
$document->add(new Comment("Not Frozen<br><br>"));
                
$document->add(new Comment($this->lang->freeze));
                
$document->add(new Image("templates/icons/freeze.gif""Greeze"));
                
$document->add(new Link("myadopts/freeze/{$adopt->getAdoptID()}/confirm""Freeze this Adoptable"TRUE));
            }
            
$document->add(new Comment("<br><br>"));
            
$document->add(new Image("templates/icons/warning.gif"));
            
$document->addLangvar($this->lang->freeze_warning);
        }
    }
    }
?>
__________________
Reply With Quote
  #8  
Old 01-17-2017, 12:53 PM
ffsharriet ffsharriet is offline
Member
 
Join Date: Jan 2017
Posts: 22
Gender: Female
Credits: 4,794
ffsharriet is on a distinguished road
Default

same again, line 73 this time which is:

Code:
$mysidia = Registry::get("mysidia");
Reply With Quote
  #9  
Old 01-17-2017, 03:28 PM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 516
Gender: Unknown/Other
Credits: 78,914
Dinocanid is on a distinguished road
Default

Okay, I actually tested this one, so it should work:
PHP Code:
<?php 

use Resource\Native\String
use 
Resource\Collection\LinkedList
use 
Resource\Collection\LinkedHashMap

class 
MyadoptsView extends View
     
    public function 
index(){ 
        
$mysidia Registry::get("mysidia"); 
        
$document $this->document
        
$document->setTitle("title"); 
  
        
$pagination $this->getField("pagination"); 
        
$stmt $this->getField("stmt")->get(); 
        if(
$stmt->rowCount() == 0){ 
            
$document->addLangvar($this->lang->empty); 
            return; 
        } 
         
        
$adoptTable = new TableBuilder("adopttable"650); 
        
$adoptTable->setAlign(new Align("center""middle")); 
        
$adoptTable->buildHeaders("Gender""Name/Type""Image""Clicks""Level"); 
         
        while(
$aid $stmt->fetchColumn()){ 
            
$adopt = new OwnedAdoptable($aid); 
            
$cells = new LinkedList
            
$cells->add(new TCell($adopt->getGender("gui"))); 
            
$cells->add(new TCell("<em>{$adopt->getName()}</em> the {$adopt->getType()}")); 
            
$cells->add(new TCell(new Link("myadopts/manage/{$aid}"$adopt->getImage("gui")))); 
            
$cells->add(new TCell($adopt->getTotalClicks())); 
            
$cells->add(new TCell($adopt->getCurrentLevel())); 
            
$adoptTable->buildRow($cells); 
        } 
        
$document->add($adoptTable); 
        
$document->addLangvar($pagination->showPage()); 
    } 
     
    public function 
manage(){   
        
$mysidia Registry::get("mysidia"); 
        
$aid $this->getField("aid")->getValue(); 
        
$name $this->getField("name")->getValue(); 
        
$image $this->getField("image"); 
         
        
$document $this->document;        
                
$health $adopt->getHealth();  
        
$mood $adopt->getMood();  
$addHealth $adopt->getHealth() + 10;  
$addMood $adopt->getMood() + 10;  
$subtractHealth $adopt->getHealth() - 10;  
$subtractMood $adopt->getMood() - 10
         
        
$document->setTitle("Managing {$name}"); 
        
$document->add($image); 
        
$document->add(new Comment("<br><br>This page allows you to manage {$name}.  Click on an option below to change settings.<br>")); 
         
$document->add(new Comment ("Health: <progress max='100' value='{$health}'></progress> <br></br>Mood: <progress max='100' value='{$mood}'></progress>")); 
        
$document->add(new Image("templates/icons/add.gif")); 
        
$document->add(new Link("levelup/click/{$aid}"" Level Up {$name}"TRUE)); 
        
$document->add(new Image("templates/icons/stats.gif")); 
        
$document->add(new Link("myadopts/stats/{$aid}"" Get Stats for {$name}"TRUE)); 
        
$document->add(new Image("templates/icons/bbcodes.gif")); 
        
$document->add(new Link("myadopts/bbcode/{$aid}"" Get BBCodes / HTML Codes for {$name}"TRUE)); 
           
$document->add(new Image("templates/icons/title.gif")); 
        
$document->add(new Link("myadopts/rename/{$aid}"" Rename {$name}"TRUE));  
        
$document->add(new Image("templates/icons/trade.gif")); 
        
$document->add(new Link("myadopts/trade/{$aid}"" Change Trade status for {$name}"TRUE));  
        
$document->add(new Image("templates/icons/freeze.gif")); 
        
$document->add(new Link("myadopts/freeze/{$aid}"" Freeze or Unfreeze {$name}"TRUE));  
        
$document->add(new Image("templates/icons/delete.gif")); 
        
$document->add(new Link("pound/pound/{$aid}"" Pound {$name}"TRUE));} 

    public function 
stats(){ 
        
$mysidia Registry::get("mysidia"); 
        
$adopt $this->getField("adopt");         
        
$image $this->getField("image"); 
        
$stmt $this->getField("stmt")->get(); 
         
        
$document $this->document;             
        
$document->setTitle($adopt->getName().$this->lang->stats); 
        
$document->add($image);     
        
$document->add($adopt->getStats());                                               
        
$document->addLangvar("<h2>{$adopt->getName()}'s Voters:</h2><br>{$this->lang->voters}<br><br>");     
         
        
$fields = new LinkedHashMap
        
$fields->put(new String("username"), new String("getUsername")); 
        
$fields->put(new String("date"), NULL); 
        
$fields->put(new String("username::profile"), new String("getProfileImage")); 
        
$fields->put(new String("username::message"), new String("getPMImage")); 
         
        
$voterTable = new TableBuilder("voters"500); 
        
$voterTable->setAlign(new Align("center")); 
        
$voterTable->buildHeaders("User""Date Voted""Profile""PM"); 
        
$voterTable->setHelper(new UserTableHelper); 
        
$voterTable->buildTable($stmt$fields); 
        
$document->add($voterTable); 
    } 
     
    public function 
bbcode(){ 
        
$mysidia Registry::get("mysidia"); 
        
$adopt $this->getField("adopt");             
        
$document $this->document
        
$document->setTitle($this->lang->bbcode.$adopt->getName());  
        
$document->addLangvar($this->lang->bbcode_info); 
        
$document->add(new Comment("<br>")); 
         
        
$forumComment = new Comment("Forum BBCode: ");         
        
$forumComment->setUnderlined(); 
        
$forumcode "[img]{$mysidia->path->getAbsolute()}levelup/siggy/{$adopt->getAdoptID()}[/img]";         
        
$forumArea = new TextArea("forumcode"$forumcode450); 
        
$forumArea->setReadOnly(TRUE); 
         
        
$altComment = new Comment("Alternative BBCode: ");         
        
$altComment->setUnderlined(); 
        
$altcode "[img]{$mysidia->path->getAbsolute()}get/{$adopt->getAdoptID()}.gif[/img]"
        
$altArea = new TextArea("altcode"$altcode450); 
        
$altArea->setReadOnly(TRUE); 
         
        
$htmlComment = new Comment("HTML BBCode: ");         
        
$htmlComment->setUnderlined(); 
        
$htmlcode "<a href='{$mysidia->path->getAbsolute()}levelup/click/{$adopt->getAdoptID()}' target='_blank'> 
                     <img src='
{$mysidia->path->getAbsolute()}levelup/siggy/{$adopt->getAdoptID()}' border=0></a>"
        
$htmlArea = new TextArea("htmlcode"$htmlcode450); 
        
$htmlArea->setReadOnly(TRUE); 
         
        
$document->add($forumComment); 
        
$document->add($forumArea); 
        
$document->add($altComment); 
        
$document->add(($mysidia->settings->usealtbbcode == "yes")?$altArea:new Comment("The Admin has disabled Alt BBCode for this site.")); 
        
$document->add($htmlComment); 
        
$document->add($htmlArea); 
    } 
     
    public function 
rename(){ 
        
$mysidia Registry::get("mysidia"); 
        
$adopt $this->getField("adopt");         
        
$image $this->getField("image");         
        
$document $this->document
         
        if(
$mysidia->input->post("submit")){ 
            
$document->setTitle($this->lang->rename_success_title); 
            
$document->add($image); 
            
$message "<br>{$this->lang->rename_success}{$mysidia->input->post("adoptname")}.  
                        You can now manage 
{$mysidia->input->post("adoptname")} on the"
            
$document->addLangvar($message); 
            
$document->add(new Link("myadopts/manage/{$adopt->getAdoptID()}""My Adopts Page")); 
            return; 
        } 
         
        
$document->setTitle($this->lang->rename.$adopt->getName()); 
        
$document->add($image); 
        
$document->addLangvar("<br />{$this->lang->rename_default}{$adopt->getName()}{$this->lang->rename_details}<br />"); 
         
        
$renameForm = new FormBuilder("renameform""""post"); 
        
$renameForm->buildTextField("adoptname")->buildButton("Rename Adopt""submit""submit"); 
        
$document->add($renameForm);            
    } 
     
    public function 
trade(){ 
        
$mysidia Registry::get("mysidia"); 
        
$aid $this->getField("aid")->getValue();         
        
$image $this->getField("image");     
        
$message $this->getField("message")->getValue();         
        
$document $this->document
        
$document->setTitle($this->lang->trade); 
        
$document->add($image); 
        
$document->addLangvar($message); 
    } 
     
    public function 
freeze(){ 
        
$mysidia Registry::get("mysidia"); 
        
$adopt $this->getField("adopt");         
        
$image $this->getField("image");     
        
$message $this->getField("message")->getValue();             
        
$document $this->document;         
        
$document->setTitle($this->lang->freeze);     
         
        if(
$mysidia->input->get("confirm") == "confirm"){ 
             
$document->addLangvar($message); 
             
$document->add(new Link("myadopts/manage/{$adopt->getAdoptID()}""My Adopts Page"));         
        }      
        else{ 
            
$document->add($image); 
            
$document->add(new Comment("<br /><b>{$adopt->getName()}'s Current Status: ")); 
             
            if(
$adopt->isfrozen() == "yes"){                 
                
$document->add(new Image("templates/icons/freeze.gif""Frozen")); 
                
$document->add(new Comment("Frozen<br<br>")); 
                
$document->add(new Comment($this->lang->freeze)); 
                
$document->add(new Image("templates/icons/unfreeze.gif""Unfreeze")); 
                
$document->add(new Link("myadopts/freeze/{$adopt->getAdoptID()}/confirm""Unfreeze this Adoptable"TRUE)); 
            } 
            else{ 
                
$document->add(new Image("templates/icons/unfreeze.gif""Not Frozen")); 
                
$document->add(new Comment("Not Frozen<br><br>")); 
                
$document->add(new Comment($this->lang->freeze)); 
                
$document->add(new Image("templates/icons/freeze.gif""Greeze")); 
                
$document->add(new Link("myadopts/freeze/{$adopt->getAdoptID()}/confirm""Freeze this Adoptable"TRUE)); 
            } 
            
$document->add(new Comment("<br><br>")); 
            
$document->add(new Image("templates/icons/warning.gif")); 
            
$document->addLangvar($this->lang->freeze_warning); 
        } 
    } 
    } 
?>
It seems like when you were installing mods, you put lines of code in the wrong places; so it's calling stuff that hadn't even been defined yet. For example, "$mysidia = Registry::get("mysidia");" should always go directly under a "public function" or "private function" line; and "$document = $this->document;" should always be called before any line of code in the function that starts with "$document".
__________________
Reply With Quote
  #10  
Old 01-19-2017, 02:57 PM
ffsharriet ffsharriet is offline
Member
 
Join Date: Jan 2017
Posts: 22
Gender: Female
Credits: 4,794
ffsharriet is on a distinguished road
Default

Okay, the /myadopts page is now working but once you click on an adopt it shows this message:

Fatal error: Call to a member function getHealth() on null in /home/equiland/public_html/view/myadoptsview.php on line 46

This is line 46:

Code:
$health = $adopt->getHealth();
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 02:32 AM.

Currently Active Users: 697 (0 members and 697 guests)
Threads: 4,081, Posts: 32,029, 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