public function get($id)
{
$sth = $this->db->prepare('SELECT ' . implode(',', User::getDefaultFields()) . ', requests.id AS requestId, requests.request, requests.added, requests.filled, requests.p2p, requests.ersatt, requests.comment, requests.comments, requests.season, requests.imdbid, requests.typ, requests.slug, (SELECT COUNT(*) FROM reqvotes WHERE reqid = requests.id) AS votes, (SELECT SUM(krydda) FROM reqvotes WHERE reqid = requests.id) AS krydda FROM requests LEFT JOIN users ON requests.userid = users.id WHERE requests.id = ?');
$sth->bindParam(1, $id, PDO::PARAM_INT);
$sth->execute();
$row = $sth->fetch(PDO::FETCH_ASSOC);
if (!$row) {
throw new Exception(L::get("REQUEST_NOT_FOUND"), 404);
}
$arr = array();
$arr["id"] = $row["requestId"];
$arr["added"] = $row["added"];
$arr["filled"] = $row["filled"];
$arr["request"] = $row["request"];
$arr["p2p"] = $row["p2p"];
$arr["comment"] = $row["comment"];
$arr["comments"] = $row["comments"];
$arr["ersatt"] = $row["ersatt"];
$arr["season"] = $row["season"];
$arr["slug"] = $row["slug"];
$arr["imdbid"] = $row["imdbid"];
$arr["type"] = $row["typ"];
$arr["reward"] = $row["krydda"] += $this->getVoteTimeReward(strtotime($row["added"]));
$arr["votes"] = $row["votes"];
$arr["user"] = $this->user->generateUserObject($row);
return $arr;
}