File: //opt/proundcontra.mosmuc.de/pages/profile.php
<?php
class PageProfile extends Page
{
public function __construct($row)
{
global $sDB, $sRequest, $sQuery, $sTemplate, $sUser;
parent::__construct($row);
$this->userId = $sRequest->getInt("userId");
$this->user = $sQuery->getUser("userId=".$this->userId);
if ($this->user != $sUser) {
$sTemplate->error($sTemplate->getString("ERROR_INVALID_PROFILE"));
}
// Optionally set a short URL if your user object supports it
$this->setShortUrl($this->user->shortUrl());
}
public function getUserId()
{
return $this->userId;
}
public function getUser()
{
return $this->user;
}
public function title()
{
global $sTemplate;
return $sTemplate->getString(
"HTML_META_TITLE_PROFILE",
["[USERNAME]"],
[$this->getUser()->getUserName()]
);
}
public function getFollowedQuestions()
{
global $sDB, $sUser;
$qF = [];
$res = $sDB->exec("
SELECT `questions`.*
FROM `notifications`
LEFT JOIN `questions` ON `questions`.questionId = `notifications`.`questionId`
LEFT JOIN `user_votes` ON questions.questionId = user_votes.questionId
WHERE `notifications`.`userId` = '".i($this->userId)."'
GROUP BY questions.questionId
ORDER BY argumentId, vote DESC;
");
while ($row = mysqli_fetch_object($res)) {
$q = new Question($row->questionId, $row);
$qF[] = $q;
}
return $qF;
}
private $userId;
private $user;
}
?>