id = $id; $this->name = $name; $this->email = $email; $this->group = $group; $this->reviewGroups = $reviewGroups; $this->favorite = $favorite; $this->deniedPermissions = $deniedPermissions; } } $users = [ new User("uid-1", "John Smith", "smith@mial.ru", null, null, null, []), new User("uid-2", "Mark Pottato", "pottato@mial.ru", "group-2", ["group-2", ""], true, []), new User("uid-3", "Hamish Mitchell", "mitchell@mial.ru", "group-3", ["group-2"], false, ["copy", "download", "print"]), new User("uid-0", null, null, null, null, null, []) ]; function getAllUsers() { global $users; return $users; } function getUser($id) { global $users; foreach ($users as $user){ if ($user->id == $id) { sendlog("User ". $user->id, "common.log"); return $user; } } return $users[0]; } function getUsersForMentions($id) { global $users; $usersData = []; foreach ($users as $user) { if ($user->id != $id && $user->name != null && $user->email != null) { array_push($usersData,[ "name" => $user->name, "email" => $user->email ]); } } return json_encode($usersData); } ?>