/** * function plugins_update to get * plugins updates from the Database using pagination object. * * @author shubham meena mentored by Matthew Lagoe */ function plugins_update() { if (Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) { $pagination = new Pagination("SELECT * FROM plugins INNER JOIN updates ON plugins.Id=updates.PluginId", "lib", 5, "Plugincache"); $pageResult['plug'] = Gui_Elements::make_table($pagination->getElements(), array("getId", "getPluginName", "getPluginInfo", "getUpdateInfo"), array("id", "plugin_name", "plugin_info", "update_info")); $pageResult['links'] = $pagination->getLinks(5); $pageResult['lastPage'] = $pagination->getLast(); $pageResult['currentPage'] = $pagination->getCurrent(); global $INGAME_WEBPATH; $pageResult['ingame_webpath'] = $INGAME_WEBPATH; // check if shard is online try { $dbs = new DBLayer("shard"); $pageResult['shard'] = "online"; } catch (PDOException $e) { $pageResult['shard'] = "offline"; } return $pageResult; } else { // ERROR: No access! $_SESSION['error_code'] = "403"; header("Cache-Control: max-age=1"); header("Location: index.php?page=error"); throw new SystemExit(); } }
/** * This function is beign used to load info that's needed for the userlist page. * 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. * @author Daan Janssens, mentored by Matthew Lagoe */ function userlist() { if (Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) { $pagination = new Pagination(WebUsers::getAllUsersQuery(), "web", 10, "WebUsers"); $pageResult['userlist'] = Gui_Elements::make_table($pagination->getElements(), array("getUId", "getUsername", "getEmail"), array("id", "username", "email")); $pageResult['links'] = $pagination->getLinks(5); $pageResult['lastPage'] = $pagination->getLast(); $pageResult['currentPage'] = $pagination->getCurrent(); $i = 0; foreach ($pageResult['userlist'] as $user) { $pageResult['userlist'][$i]['permission'] = Ticket_User::constr_ExternId($pageResult['userlist'][$i]['id'])->getPermission(); $i++; } if (Ticket_User::isAdmin(unserialize($_SESSION['ticket_user']))) { $pageResult['isAdmin'] = "TRUE"; } global $INGAME_WEBPATH; $pageResult['ingame_webpath'] = $INGAME_WEBPATH; global $BASE_WEBPATH; $pageResult['base_webpath'] = $BASE_WEBPATH; return $pageResult; } else { //ERROR: No access! $_SESSION['error_code'] = "403"; header("Cache-Control: max-age=1"); header("Location: index.php?page=error"); throw new SystemExit(); } }
/** * This function is beign used to load info that's needed for the syncing page. * this function is used for notifying admins that there are unsynced changes, a brief overview of the non syned changes will be shown. The entries are being loaded here * so that they can be passed to the template itself. Only admins can browse this page, others will be redirected to an error page. * @author Daan Janssens, mentored by Matthew Lagoe */ function syncing() { if (Ticket_User::isAdmin(unserialize($_SESSION['ticket_user']))) { //return a paginated version of all unsynced changes. $pagination = new Pagination("SELECT * FROM ams_querycache", "lib", 5, "Querycache"); $pageResult['liblist'] = Gui_Elements::make_table($pagination->getElements(), array("getSID", "getType"), array("id", "type")); $pageResult['links'] = $pagination->getLinks(5); $pageResult['lastPage'] = $pagination->getLast(); $pageResult['currentPage'] = $pagination->getCurrent(); global $INGAME_WEBPATH; $pageResult['ingame_webpath'] = $INGAME_WEBPATH; //check if shard is online try { $dbs = new DBLayer("shard"); $pageResult['shard'] = "online"; } catch (PDOException $e) { $pageResult['shard'] = "offline"; } return $pageResult; } else { //ERROR: No access! $_SESSION['error_code'] = "403"; header("Cache-Control: max-age=1"); header("Location: index.php?page=error"); throw new SystemExit(); } }