public function Argument($argumentId, $row = false, $parent = false) { global $sDB, $sQuery; if (!$row) { $res = $sDB->exec("SELECT * FROM `arguments` WHERE `argumentId` = '" . i($argumentId) . "' LIMIT 1;"); $row = mysql_fetch_object($res); } if (!$row) { $this->argumentId = -1; return; } $this->argumentId = $argumentId; $this->questionId = $row->questionId; $this->parentId = $row->parentId; $this->parent = $parent; $this->userId = $row->userId; $this->username = $sQuery->getUsernameById($row->userId); $this->headline = $row->headline; $this->abstract = $row->abstract; $this->details = $row->details; $this->dateAdded = $row->dateAdded; $this->type = $row->type; $this->score = $row->score; $this->url = $row->url; $this->timeSince = timeSinceString($row->dateAdded); $this->arguments = array(); }
public function Question($questionId, $row = false) { global $sDB, $sQuery, $sRequest, $sUser, $sStatistics; $this->questionId = 0; if (!$row) { $res = $sDB->exec("SELECT * FROM `questions` WHERE `questionId` = '" . i($questionId) . "' LIMIT 1;"); if (mysql_num_rows($res) == 0) { return; } $row = mysql_fetch_object($res); } $this->questionId = $row->questionId; $this->title = $row->title; $this->url = $row->url; $this->urlPlain = $row->url; $this->details = $row->details; $this->dateAdded = $row->dateAdded; $this->userId = $row->userId; $this->username = $sQuery->getUsernameById($row->userId); $this->score = $row->score; $this->scoreTrending = $row->scoreTrending; $this->scoreTop = $row->scoreTop; $this->additionalData = unserialize($row->additionalData); $this->timeSince = timeSinceString($row->dateAdded); $this->groupId = $row->groupId; $this->group = NULL; if ($this->groupId) { $this->group = new Group($this->groupId); } $this->type = $row->type; $this->flags = $row->flags; if ($this->hasFlag(QUESTION_FLAG_PART_ALL)) { $this->url = "unregistered/" . $this->url; } if ($this->type == QUESTION_TYPE_UNLISTED) { $this->url = "unlisted/" . $this->url; } $this->arguments = -1; $this->tags = -1; }