getAdmins() returns player objects
phpdoc improvements
This commit is contained in:
parent
0754b88aee
commit
9c028fbf23
@ -206,7 +206,7 @@ class AuthenticationManager implements CallbackListener {
|
|||||||
* Get all connected Players with at least the given Auth Level
|
* Get all connected Players with at least the given Auth Level
|
||||||
*
|
*
|
||||||
* @param int $authLevel
|
* @param int $authLevel
|
||||||
* @return array
|
* @return Player[]
|
||||||
*/
|
*/
|
||||||
public function getConnectedAdmins($authLevel = self::AUTH_LEVEL_MODERATOR) {
|
public function getConnectedAdmins($authLevel = self::AUTH_LEVEL_MODERATOR) {
|
||||||
$players = $this->maniaControl->playerManager->getPlayers();
|
$players = $this->maniaControl->playerManager->getPlayers();
|
||||||
@ -237,12 +237,11 @@ class AuthenticationManager implements CallbackListener {
|
|||||||
* Get a List of all Admins
|
* Get a List of all Admins
|
||||||
*
|
*
|
||||||
* @param int $authLevel
|
* @param int $authLevel
|
||||||
* @return array null
|
* @return Player[]
|
||||||
*/
|
*/
|
||||||
public function getAdmins($authLevel = self::AUTH_LEVEL_MODERATOR) {
|
public function getAdmins($authLevel = self::AUTH_LEVEL_MODERATOR) {
|
||||||
// TODO: return Player objects
|
|
||||||
$mysqli = $this->maniaControl->database->mysqli;
|
$mysqli = $this->maniaControl->database->mysqli;
|
||||||
$query = "SELECT * FROM `" . PlayerManager::TABLE_PLAYERS . "`
|
$query = "SELECT `login` FROM `" . PlayerManager::TABLE_PLAYERS . "`
|
||||||
WHERE `authLevel` > " . $authLevel . "
|
WHERE `authLevel` > " . $authLevel . "
|
||||||
ORDER BY `authLevel` DESC;";
|
ORDER BY `authLevel` DESC;";
|
||||||
$result = $mysqli->query($query);
|
$result = $mysqli->query($query);
|
||||||
@ -252,7 +251,10 @@ class AuthenticationManager implements CallbackListener {
|
|||||||
}
|
}
|
||||||
$admins = array();
|
$admins = array();
|
||||||
while ($row = $result->fetch_object()) {
|
while ($row = $result->fetch_object()) {
|
||||||
array_push($admins, $row);
|
$player = $this->maniaControl->playerManager->getPlayer($row->login, false);
|
||||||
|
if ($player) {
|
||||||
|
array_push($admins, $player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$result->free();
|
$result->free();
|
||||||
return $admins;
|
return $admins;
|
||||||
@ -341,7 +343,7 @@ class AuthenticationManager implements CallbackListener {
|
|||||||
* Get the PermissionLevelNameArray
|
* Get the PermissionLevelNameArray
|
||||||
*
|
*
|
||||||
* @param $authLevelNeeded
|
* @param $authLevelNeeded
|
||||||
* @return array
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
private function getPermissionLevelNameArray($authLevelNeeded) {
|
private function getPermissionLevelNameArray($authLevelNeeded) {
|
||||||
switch ($authLevelNeeded) {
|
switch ($authLevelNeeded) {
|
||||||
|
@ -384,7 +384,8 @@ class PlayerManager implements CallbackListener, TimerListener {
|
|||||||
private function getPlayerFromDatabaseByLogin($playerLogin) {
|
private function getPlayerFromDatabaseByLogin($playerLogin) {
|
||||||
$mysqli = $this->maniaControl->database->mysqli;
|
$mysqli = $this->maniaControl->database->mysqli;
|
||||||
|
|
||||||
$query = "SELECT * FROM `" . self::TABLE_PLAYERS . "` WHERE `login` LIKE '" . $mysqli->escape_string($playerLogin) . "';";
|
$query = "SELECT * FROM `" . self::TABLE_PLAYERS . "`
|
||||||
|
WHERE `login` LIKE '" . $mysqli->escape_string($playerLogin) . "';";
|
||||||
$result = $mysqli->query($query);
|
$result = $mysqli->query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
trigger_error($mysqli->error);
|
trigger_error($mysqli->error);
|
||||||
|
Loading…
Reference in New Issue
Block a user