khanat-opennel-code/code/web/public_php/ams/inc/syncing.php

38 lines
1.5 KiB
PHP
Raw Normal View History

<?php
/**
* 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(){
2014-09-03 05:06:43 +00:00
2013-09-15 17:44:24 +00:00
if(Ticket_User::isAdmin(unserialize($_SESSION['ticket_user']))){
2014-09-03 05:06:43 +00:00
//return a paginated version of all unsynced changes.
$pagination = new Pagination("SELECT * FROM ams_querycache","lib",5,"Querycache");
2013-08-05 03:27:19 +00:00
$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();
2014-09-03 05:06:43 +00:00
2013-09-15 17:44:24 +00:00
global $INGAME_WEBPATH;
$pageResult['ingame_webpath'] = $INGAME_WEBPATH;
2014-09-03 05:06:43 +00:00
//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";
2014-09-03 05:36:10 +00:00
header("Cache-Control: max-age=1");
header("Location: index.php?page=error");
2014-09-03 05:23:39 +00:00
throw new SystemExit();
}
2014-09-03 05:06:43 +00:00
}