/** * Get our permission flags. * * @param $userid * * @return bool|static */ public function GetPermissionFlags($userid) { if ($this->groupmanager->IsValid($this->usergroups->GetGroup($userid))) { return $this->database->GetPermissionFlags($userid) . $this->groupmanager->GetPermissions($this->usergroups->GetGroup($userid)); } return $this->database->GetPermissionFlags($userid); }
/** * Does this post exist? * * @param $postid * * @return bool */ public function PostExists($postid) { if (!$this->database->GetPost($postid)) { return false; } return true; }
/** * Gets a selection fo music. * * @param $start * * @param $amount * * @param bool|false $json * * @return array|bool|string|static[] */ public function GetSelection($start, $amount, $json = false) { $result = $this->database->SelectMusic($start, $amount); if ($json) { return $result != false ? json_encode($result) : false; } return $result != false ? $result : false; }
/** * Creates a post. * * @param $userid * * @param $text * * @param array $tags */ public function CreatePost($userid, $text, $tags = ['Music']) { $data = ['authorid' => $userid, 'author' => $this->database->IDToUsername($userid), 'text' => $text]; $this->database->AddPost($userid, json_encode($tags), json_encode($data)); }
/** * Helper function to convert the username to userid. * * @param $username * * @return \___PHPSTORM_HELPERS\static|bool */ public function FindUserID($username) { return $this->database->UsernameToID($username); }
/** * Get the groups members. * * @param $groupid * * @return bool */ public function GetGroupMembers($groupid) { return $this->database->GetGroupMembers($groupid); }
/** * Returns the owners ID. * * @param $sessionid * * @return mixed */ public function SessionUserID($sessionid) { return !empty($this->database->GetSessionUserID($sessionid)) ? $this->database->GetSessionUserID($sessionid) : false; }