Linux multi-monitor fullscreen support
[ryzomcore.git] / web / public_php / api / common / user.php
blob055332e97524c358f0876ccf787c676e9325df82
1 <?php
3 /* Copyright (C) 2009 Winch Gate Property Limited
5 * This file is part of ryzom_api.
6 * ryzom_api is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * ryzom_api is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with ryzom_api. If not, see <http://www.gnu.org/licenses/>.
21 class ryUser {
22 private $infos;
24 function __construct($infos) {
25 $this->infos = $infos;
28 function __get($name)
30 if (array_key_exists($name, $this->infos)) {
31 return $this->infos[$name];
32 } else {
33 /** TODO **/
34 return NULL;
38 function inGroup($groups) {
39 $groups = explode(':', $groups);
40 foreach ($groups as $group) {
41 if ($group != '') {
42 if (in_array($group, $this->groups))
43 return true;
44 if ('P_'.$this->id == $group)
45 return true;
46 if ('G_'.$this->guild_id == $group)
47 return true;
48 if ($group == '*')
49 return true;
52 return false;
56 function ryzom_auth_user($ask_login=true, $welcome_message='') {
57 global $user, $_USER;
59 $result = ryzom_app_authenticate($user, $ask_login, $welcome_message, true);
60 $_USER = new RyUser($user);
61 return $result;
64 function _user() {
65 global $_USER;
66 return $_USER;