Merge branch 'main/rendor-staging' into main/atys-live
[ryzomcore.git] / web / public_php / ams / inc / userlist.php
blob4455da069ca266b24f6c1a36c95dcf72d8aa0784
1 <?php
2 /**
3 * This function is beign used to load info that's needed for the userlist page.
4 * this function will return all users by using he pagination class, so that it can be used in the template. Only Mods and Admins can browse this page though.
5 * @author Daan Janssens, mentored by Matthew Lagoe
6 */
7 function userlist(){
8 if(Ticket_User::isMod(unserialize($_SESSION['ticket_user']))){
10 $pagination = new Pagination(WebUsers::getAllUsersQuery(),"web",10,"WebUsers");
11 $pageResult['userlist'] = Gui_Elements::make_table($pagination->getElements() , Array("getUId","getUsername","getEmail"), Array("id","username","email"));
12 $pageResult['links'] = $pagination->getLinks(5);
13 $pageResult['lastPage'] = $pagination->getLast();
14 $pageResult['currentPage'] = $pagination->getCurrent();
16 $i = 0;
17 foreach( $pageResult['userlist'] as $user ){
18 $pageResult['userlist'][$i]['permission'] = Ticket_User::constr_ExternId($pageResult['userlist'][$i]['id'])->getPermission();
19 $i++;
22 if (Ticket_User::isAdmin(unserialize($_SESSION['ticket_user']))){
23 $pageResult['isAdmin'] = "TRUE";
25 global $INGAME_WEBPATH;
26 $pageResult['ingame_webpath'] = $INGAME_WEBPATH;
27 global $BASE_WEBPATH;
28 $pageResult['base_webpath'] = $BASE_WEBPATH;
29 return $pageResult;
30 }else{
31 //ERROR: No access!
32 $_SESSION['error_code'] = "403";
33 header("Cache-Control: max-age=1");
34 header("Location: index.php?page=error");
35 throw new SystemExit();