Another Puzzle to Solve: User Profiles Display As Blank
Hey there!
Okay, so some of the profiles display fine, while others display blank. To help us solve this riddle, I've cleared my error log and refreshed over one of those profiles that displays as blank and these are the errors it displays.
You may not need any of this extra information, as I think I /might/ have already figured it out. I believe the code was just angry I deleted user 19? >.> If that's the case, what am I suppose to do if a user no longer wishes to remain on the site and requests their account deleted? The delete feature in the ACP for users still doesn't work for MystFell.
[28-Aug-2016 15:25:05 America/Chicago]
PHP Code:
PHP Notice: Undefined variable: controller in /home/mystfell/public_html/classes/class_language.php on line 111
[28-Aug-2016 15:25:05 America/Chicago] PHP Notice: Undefined property: UserProfile::$usergroup in /home/mystfell/public_html/classes/class_userprofile.php on line 30
[28-Aug-2016 15:25:05 America/Chicago] PHP Notice: Undefined variable: ccstat in /home/mystfell/public_html/classes/class_userprofile.php on line 31
[28-Aug-2016 15:25:05 America/Chicago] PHP Fatal error: Uncaught exception 'MemberNotfoundException' with message 'The specified user 19 does not exist...' in /home/mystfell/public_html/classes/class_member.php:30
Stack trace:
#0 /home/mystfell/public_html/classes/class_friendlist.php(51): Member->__construct('19')
#1 /home/mystfell/public_html/classes/class_userprofile.php(162): Friendlist->display()
#2 /home/mystfell/public_html/classes/class_userprofile.php(82): UserProfile->getfriends(Object(Member))
#3 /home/mystfell/public_html/view/profileview.php(83): UserProfile->display('friends', Object(Member))
#4 /home/mystfell/public_html/classes/class_frontcontroller.php(100): ProfileView->view()
#5 /home/mystfell/public_html/index.php(74): FrontController->render()
#6 /home/mystfell/public_html/index.php(78): IndexController::main()
#7 {main}
thrown in /home/mystfell/public_html/classes/class_member.php on line 30
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined variable: controller in /home/mystfell/public_html/classes/class_language.php on line 111
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: ListRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
[28-Aug-2016 15:25:17 America/Chicago] PHP Notice: Undefined property: DocumentRenderer::$thematicBreak in /home/mystfell/public_html/classes/class_guirenderer.php on line 184
I did notice it mentioned a few files, so here's the ones I think we'll need to hunt for additional clues.
class_userprofile.php
PHP Code:
<?php
use Resource\Collection\LinkedList;
class UserProfile extends Model{
// The user profile class, it has dependency over class Member and cannot exist on its own
public $uid;
public $username;
protected $avatar;
protected $bio;
protected $color;
protected $about;
protected $favpet;
protected $gender;
protected $nickname;
public function __construct($uid){
// Fetch the basic profile params for users
$mysidia = Registry::get("mysidia");
$row = $mysidia->db->select("users_profile", array(), "uid ='{$uid}'")->fetchObject();
// loop through the anonymous object created to assign properties
foreach($row as $key => $val){
$this->$key = $val;
}
// Successfully instantiate user profile object
}
public function formatusername(){
$ccstats = cancp($this->usergroup);
$this->username = ($ccstat == "yes")?"<img src='templates/icons/star.gif' /> {$this->username}":$this->username;
return $this;
}
public function getAvatar(){
return $this->avatar;
}
public function getBio(){
return $this->bio;
}
public function getColor(){
return $this->color;
}
public function getFavpetID(){
return $this->favpet;
}
public function getFavpetInfo(){
return $this->about;
}
public function getFavpet(){
if(is_numeric($this->favpet)){
$this->favpet = ($this->favpet == 0)?new Comment("None Selected"):new Link("levelup/click/{$this->favpet}", new Image("levelup/siggy/{$this->favpet}"), TRUE);
}
return $this->favpet;
}
public function getGender(){
return $this->gender;
}
public function getNickname(){
return $this->nickname;
}
public function display($action = "", $data = ""){
switch($action){
case "vmessages":
$this->vmessages();
break;
case "aboutme":
$this->aboutme();
break;
case "adopts":
$this->showalladopts();
break;
case "friends":
$this->getfriends($data);
break;
case "contactinfo":
$this->contactinfo($data);
break;
default:
throw new Exception("Invalid profile tab...");
}
}
private function vmessages(){
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
$stmt = $mysidia->db->select("visitor_messages", array(), "touser = '{$mysidia->input->get("user")}' ORDER BY vid DESC LIMIT 0, 15");
if($stmt->rowCount() == 0){
return;
}
$vmList = new TableBuilder("vmessages", 800, FALSE);
$vmList->setHelper(new MessageTableHelper);
while($vmessage = $stmt->fetchObject()){
$sender = $mysidia->db->join("users_profile", "users_profile.uid = users.uid")
->select("users", array(), constant("PREFIX")."users.username = '{$vmessage->fromuser}'")
->fetchObject();
$cells = new LinkedList;
$cells->add(new TCell($vmList->getHelper()->getAvatarImage($sender->avatar)));
$cells->add(new TCell($vmList->getHelper()->getVisitorMessage($vmessage)));
if(($mysidia->user instanceof Admin) or ($mysidia->user->username == $vmessage->fromuser)){
$cells->add(new TCell($vmList->getHelper()->getManageActions($vmessage->vid)));
}
$vmList->buildRow($cells);
}
$document->add($vmList);
}
private function aboutme(){
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
$title = new Comment($mysidia->lang->basic.$mysidia->input->get("user"));
$title->setBold(TRUE);
$title->setUnderlined(TRUE);
$membersince = $mysidia->db->select("users", array("membersince"), "username = '{$mysidia->input->get("user")}'")->fetchColumn();
$basicinfo = "<br><strong>Member Since:</strong> {$membersince}<br>
Gender: {$this->gender}<br>
Favorite Color: {$this->color}<br>
Nickname: {$this->nickname}<br>
Bio: {$this->bio}";
$document->add($title);
$document->add(new Image($this->avatar, "avatar", 100));
$document->add(new Comment($basicinfo));
}
private function showalladopts(){
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
$spotlight = new Comment(".:AdoptSpotlight:.");
$spotlight->setHeading(2);
$document->add($spotlight);
$document->add($this->favpet);
$document->add(new Comment($this->about));
$title = new Comment("{$mysidia->input->get("user")}'s Pets:");
$title->setBold(TRUE);
$title->setUnderlined(TRUE);
$document->add($title);
$stmt = $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->input->get("user")}'");
while($id = $stmt->fetchColumn()){
$adopt = new OwnedAdoptable($id);
$document->add(new Comment('<p style="float:left; text-align:center;"><a href="/myadopts/manage/' . $id . '"><img src="' . $adopt->getImage() . '" width="100px" height="100px" /><br /><b>' . $adopt->getName() . '</b><br /><em>' . $adopt->getType() . '</em><br />Level: ' . $adopt->getCurrentLevel() . '<br />Clicks: ' . $adopt->getTotalClicks() . '</a></p>', FALSE));
}
$document->add(new Comment('<div style="clear:left;"> </div>'));
}
private function getfriends($user){
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
$friendlist = new Friendlist($user);
$document->add(new Comment("{$user->username} currently have {$friendlist->gettotal()} friends."));
$friendlist->display();
}
private function contactinfo($contacts){
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
$member = new Member($mysidia->input->get("user"));
$document->add(new Image("templates/icons/web.gif", "web"));
$document->add(new Comment($contacts->website));
$document->add(new Image("templates/icons/facebook.gif", "facebook"));
$document->add(new Comment($contacts->facebook));
$document->add(new Image("templates/icons/twitter.gif", "twitter"));
$document->add(new Comment($contacts->twitter));
$document->add(new Image("templates/icons/aim.gif", "aim"));
$document->add(new Comment($contacts->aim));
$document->add(new Image("templates/icons/msn.gif", "msn"));
$document->add(new Comment($contacts->msn));
$document->add(new Image("templates/icons/yahoo.gif", "yahoo"));
$document->add(new Comment($contacts->yim));
$document->add(new Image("templates/icons/skype.gif", "skype"));
$document->add(new Comment($contacts->skype));
$document->add(new Image("templates/icons/title.gif", "Write a PM"));
$document->add(new Link("messages/newpm/{$mysidia->input->get("user")}", "Send {$mysidia->input->get("user")} a Private Message", TRUE));
$document->add(new Image("templates/icons/fr.gif", "Send a Friend Request"));
$document->add(new Link("friends/request/{$member->uid}", "Send {$mysidia->input->get("user")} a Friend Request", TRUE));
$document->add(new Image("templates/icons/trade.gif", "Make a Trade Offer"));
$document->add(new Link("trade/offer/user/{$member->uid}", "Make {$mysidia->input->get("user")} a Trade Offer"));
}
protected function save($field, $value){
}
}
?>
class_friendlist.php
PHP Code:
<?php
use Resource\Collection\LinkedList as LinkedList;
class Friendlist extends UserContainer{
// The Friendlist class, which is a container
public $user;
protected $fids;
protected $fnum;
protected $privacy = "public";
public function __construct(User $user){
// Fetch the basic properties of friendlist
$this->user = $user->username;
$fids = $user->getfriends();
$this->fids = empty($fids)?"":explode(",", $fids);
$this->fnum = empty($fids)?0:count($this->fids);
}
public function getids(){
// Return an ArrayObject of ids in the friendlist
return $this->fids;
}
public function gettotal(){
// Return the total number of friends
return $this->fnum;
}
public function isfriend($uid){
// Check if the specific user is on this friendlist
if(is_array($this->fids) and in_array($uid, $this->fids)) return TRUE;
else return FALSE;
}
public function display(){
// Display the user's friendlist
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
if(!$this->isfriend($mysidia->user->uid) and $this->privacy == "protected") return FALSE;
elseif(!$this->fids) return FALSE;
else{
// The friendlist can be displayed, so let's show the content
$friendTable = new TableBuilder("friends", "", FALSE);
$friendTable->setHelper(new FriendTableHelper);
foreach($this->fids as $fid){
$friend = new Member($fid);
$friend->getprofile();
$friend->getcontacts();
$avatar = new TCell($friend->getavatar(60));
$avatar->setAlign(new Align("left"));
$info = new TCell($friendTable->getHelper()->getFriendInfo($friend));
$cells = new LinkedList;
$cells->add($avatar);
$cells->add($info);
if(!empty($mysidia->user->username) and $this->user == $mysidia->user->username){
$action = new TCell;
$action->setAlign(new Align("right"));
$action->add(new Comment("<br><br><br><br>"));
$action->add(new Link("friends/delete/{$friend->uid}", "Break Friendship"));
$cells->add($action);
}
$friendTable->buildRow($cells);
}
$document->add($friendTable);
}
// End of the display method
}
}
?>
class_member.php
PHP Code:
<?php
use Resource\Native\String;
use Resource\Collection\LinkedHashMap;
class Member extends User{
protected $salt;
protected $password;
protected $session;
protected $email;
public $birthday;
public $membersince;
public $money;
public $friends;
public $isloggedin;
public $profile;
public $contacts;
public $options;
public $status;
public function __construct($userinfo){
// Fetch the basic member properties for users
$mysidia = Registry::get("mysidia");
if($userinfo instanceof String) $userinfo = $userinfo->getValue();
$userinfo = ($userinfo == "SYSTEM")?$mysidia->settings->systemuser:$userinfo;
$whereclause = (is_numeric($userinfo))?"uid ='{$userinfo}'":"username ='{$userinfo}'";
$row = $mysidia->db->select("users", array(), $whereclause)->fetchObject();
// loop through the anonymous object created to assign properties
if(!is_object($row)) throw new MemberNotfoundException("The specified user {$userinfo} does not exist...");
foreach($row as $key => $val){
// For field usergroup, instantiate a Usergroup Object
$this->$key = $val;
if($key == "usergroup") $this->usergroup = new Usergroup($val);
}
$this->lastactivity = new DateTime();
$this->isloggedin = UserCreator::logincheck();
}
public function iscurrentuser(){
$mysidia = Registry::get("mysidia");
$iscurrent = ($mysidia->user->username == $this->username)?TRUE:FALSE;
return $iscurrent;
}
public function register(){
throw new AlreadyLoggedinException($mysidia->lang->global_login);
}
public function login($username = ""){
throw new AlreadyLoggedinException($mysidia->lang->global_login);
}
public function logout(){
$mysidia = Registry::get("mysidia");
$mysidia->session->destroy();
if($mysidia->cookies->getcookies("mysuid") and $mysidia->cookies->getcookies("myssession")){
$mysidia->cookies->deletecookies();
$this->isloggedin = "no";
include("inc/config_forums.php");
if($mybbenabled == 1){
include("functions/functions_forums.php");
mybblogout();
}
}
else throw new Exception('The user is already logged out');
}
public function getpassword(){
return $this->password;
}
public function getsalt(){
return $this->salt;
}
public function getemail(){
return $this->email;
}
public function getonlineimg(){
$mysidia = Registry::get("mysidia");
$online = $mysidia->db->select("online", array(), "username = '{$this->username}'")->fetchObject();
if(is_object($online)) $onlineimg = "<img src='templates/icons/user_online.gif'>";
else $onlineimg = "<img src='templates/icons/user_offline.gif'>";
return $onlineimg;
}
public function getavatar($dimension = 40){
$mysidia = Registry::get("mysidia");
$profile = $mysidia->db->select("users_profile", array("uid", "avatar"), "username = '{$this->username}'")->fetchObject();
$avatar = new Image($profile->avatar, "avatar", $dimension);
return $avatar;
}
public function getcash(){
return $this->money;
}
public function changecash($amount){
$mysidia = Registry::get("mysidia");
if(!is_numeric($amount)) throw new Exception('Cannot change user money by a non-numeric value!');
$this->money += $amount;
if($this->money >= 0){
$mysidia->db->update("users", array("money" => $this->money), "username = '{$this->username}'");
return TRUE;
}
else throw new InvalidActionException("It seems that {$this->username} cannot afford this transaction.");
}
public function getVotes($time = "today"){
$mysidia = Registry::get("mysidia");
$date = new DateTime($time);
$votes = $mysidia->db->select("vote_voters", array("void"), "username = '{$this->username}' and date = '{$date->format('Y-m-d')}'")->rowCount();
return $votes;
}
public function clickreward($amount){
$randamount = mt_rand($amount[0], $amount[1]);
return $randamount;
}
public function donate(User $recipient, $amount){
$mysidia = Registry::get("mysidia");
// First thing first, let's update the money field for the two users
$this->changecash(-$amount);
$recipient->changecash($amount);
// Then attempt to send an email to the recipient
$recipient->getoptions();
if($recipient->options->newmessagenotify == 1){
// We are sending this user an email about the donation
$headers = "From: {$mysidia->settings->systememail}";
$sitename = $mysidia->settings->sitename;
$message = "Hello {$recipient->username};\n\nYou have received {$amount} {$mysidia->settings->cost} donation from {$this->username} at {$sitename}.
Thank You. The {$siteName} team.";
mail($recipient->email, $sitename." - You Have Received a {$mysidia->settings->cost} Donation", $message, $headers);
}
}
public function gettheme(){
$mysidia = Registry::get("mysidia");
$option = $mysidia->db->select("users_options", array("theme"), "username = '{$this->username}'")->fetchObject();
return $option->theme;
}
public function getadopts(){
return FALSE;
}
public function getalladopts(){
$mysidia = Registry::get("mysidia");
$totals = $mysidia->db->select("owned_adoptables", array(), "owner = '{$this->username}'")->rowCount();
return $totals;
}
public function getallpms($folder = "inbox"){
$mysidia = Registry::get("mysidia");
$table = ($folder == "inbox")?"messages":"folders_messages";
$whereclause = ($folder == "inbox")?"touser='{$this->username}'":"touser='{$this->username}' AND folder='{$folder}' ORDER BY mid DESC";
$totalRows = $mysidia->db->select($table, array(), $whereclause)->rowCount();
return $totalRows;
}
public function getFolder($folder, Pagination $pagination){
$mysidia = Registry::get("mysidia");
$stmt = $mysidia->db->select("folders_messages", array(), "fromuser='{$this->username}' AND folder='{$folder}' ORDER BY mid DESC LIMIT {$pagination->getLimit()},{$pagination->getRowsperPage()}");
if($stmt->rowCount() == 0) throw new MessageNotfoundException;
else{
$fields = new LinkedHashMap;
$fields->put(new String("messagetitle"), NULL);
$fields->put(new String("fromuser"), new String("getProfile"));
$fields->put(new String("touser"), new String("getProfile"));
$fields->put(new String("datesent"), NULL);
$fields->put(new String("mid::read"), new String(($folder == "outbox")?"getOutboxReadLink":"getDraftReadLink"));
$fields->put(new String("mid::delete"), new String(($folder == "outbox")?"getOutboxDeleteLink":"getDraftDeleteLink"));
$folderTable = new TableBuilder($folder);
$folderTable->setAlign(new Align("center"));
$folderTable->buildHeaders("Message Title", "FromUser", "Recipient", "Date Appeared", "Access", "Delete");
$folderTable->setHelper(new MessageTableHelper);
$folderTable->buildTable($stmt, $fields);
return $folderTable;
}
}
public function getfriends(){
return $this->friends;
}
public function getprofile(){
// This method instantiate a user profile object, only called in profile.php page
if($this->profile) return $this->profile;
else{
$this->profile = new UserProfile($this->uid);
return $this->profile;
}
}
public function getcontacts(){
$mysidia = Registry::get("mysidia");
if(empty($this->contacts)) $this->contacts = $mysidia->db->select("users_contacts", array(), "uid = '{$this->uid}'")->fetchObject();
return $this->contacts;
}
public function formatcontacts(){
$sites = array("website", "facebook", "twitter");
$ims = array("msn", "aim", "yim", "skype");
foreach($sites as $site){
$this->contacts->$site = (empty($this->contacts->$site))?"No {$site} Information Given":$this->contacts->$site;
}
foreach($ims as $im){
$this->contacts->$im = (empty($this->contacts->$im))?"No {$im} Information Given":$this->contacts->$im;
}
}
public function getoptions(){
$mysidia = Registry::get("mysidia");
if(empty($this->options)) $this->options = $mysidia->db->select("users_options", array(), "username = '{$this->username}'")->fetchObject();
return $this->options;
}
public function getstatus(){
$mysidia = Registry::get("mysidia");
if(empty($this->status)) $this->status = $mysidia->db->select("users_status", array(), "username = '{$this->username}'")->fetchObject();
return $this->status;
}
}
?>
|