View Full Version : Problem accessing page
ffsharriet
01-16-2017, 08:21 AM
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:
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}'");
}
Dinocanid
01-16-2017, 08:35 AM
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.
Hall of Famer
01-16-2017, 09:46 AM
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.
ffsharriet
01-16-2017, 01:05 PM
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:
public function stats()
Full code below:
<?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 = "{$mysidia->path->getAbsolute()}levelup/siggy/{$adopt->getAdoptID()} ({$mysidia->path->getAbsolute()}levelup/click/{$adopt->getAdoptID()})";
$forumArea = new TextArea("forumcode", $forumcode, 4, 50);
$forumArea->setReadOnly(TRUE);
$altComment = new Comment("Alternative BBCode: ");
$altComment->setUnderlined();
$altcode = "{$mysidia->path->getAbsolute()}get/{$adopt->getAdoptID()}.gif" ({$mysidia->path->getAbsolute()}levelup/click/{$adopt->getAdoptID()})";
$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);
}
}
}
?>
Dinocanid
01-16-2017, 01:09 PM
Public function stats shouldn't have a "{" in front of it.
ffsharriet
01-16-2017, 01:42 PM
I've removed it and it's still showing the same message :/
Dinocanid
01-16-2017, 02:18 PM
Try this:
<?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 = "{$mysidia->path->getAbsolute()}levelup/siggy/{$adopt->getAdoptID()}";
$forumArea = new TextArea("forumcode", $forumcode, 4, 50);
$forumArea->setReadOnly(TRUE);
$altComment = new Comment("Alternative BBCode: ");
$altComment->setUnderlined();
$altcode = "{$mysidia->path->getAbsolute()}get/{$adopt->getAdoptID()}.gif";
$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);
}
}
}
?>
ffsharriet
01-17-2017, 11:53 AM
same again, line 73 this time which is:
$mysidia = Registry::get("mysidia");
Dinocanid
01-17-2017, 02:28 PM
Okay, I actually tested this one, so it should work:
<?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 = "{$mysidia->path->getAbsolute()}levelup/siggy/{$adopt->getAdoptID()}";
$forumArea = new TextArea("forumcode", $forumcode, 4, 50);
$forumArea->setReadOnly(TRUE);
$altComment = new Comment("Alternative BBCode: ");
$altComment->setUnderlined();
$altcode = "{$mysidia->path->getAbsolute()}get/{$adopt->getAdoptID()}.gif";
$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);
}
}
}
?>
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".
ffsharriet
01-19-2017, 01:57 PM
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:
$health = $adopt->getHealth();
Dinocanid
01-19-2017, 02:13 PM
Try adding this under $image= $this->getField("image");
$adopt = $this->getField("adopt");
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.