Skip to content

Commit

Permalink
[504] Disable administration panel.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadez committed Oct 20, 2011
1 parent 384aae3 commit f9fa670
Showing 1 changed file with 2 additions and 121 deletions.
123 changes: 2 additions & 121 deletions admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,125 +22,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
**/

define('__ARMORY__', true);
define('ADMIN_PAGE', true);
if(!@include('../includes/armory_loader.php')) {
die('<b>Fatal error:</b> unable to load system files.');
}
if(isset($_GET['logout'])) {
Admin::PerformLogout();
header('Location: .');
exit;
}
if(isset($_POST['username']) && isset($_POST['password'])) {
$username = $_POST['username']; // No SQL Injection
$password = $_POST['password']; // No SQL Injection
Admin::PerformLogin($username, $password);
}
Template::SetPageData('action', isset($_GET['action']) ? $_GET['action'] : 'index');
Template::SetPageData('subaction', isset($_GET['subaction']) ? $_GET['subaction'] : null);
switch(Template::GetPageData('action')) {
case 'news':
switch(Template::GetPageData('subaction')) {
case 'edit':
if(isset($_POST['date'])) {
$_POST['id'] = $_POST['newsid'];
Template::SetPageData('news_result', Utils::AddNewsItem($_POST, true));
}
else {
if(isset($_GET['itemid'])) {
Template::SetPageData('news_item', Utils::GetArmoryNews(false, $_GET['itemid']));
}
}
break;
case 'add':
if(isset($_POST['date'])) {
$_POST['id'] = $_POST['newsid'];
Template::SetPageData('news_result', Utils::AddNewsItem($_POST));
}
else {
Template::SetPageData('news_item', Utils::GetArmoryNews(0, 0, true));
}
break;
}
break;
case 'config':
switch(Template::GetPageData('subaction')) {
case 'edit':
if(isset($_POST['subm'])) {
Admin::UpdateConfigFile($_POST);
header('Location: ?action=config');
exit;
}
break;
case 'addrealm':
if(isset($_POST['subm'])) {
Admin::AddNewRealm($_POST);
}
break;
}
break;
case 'accounts':
Template::SetPageData('page', isset($_GET['page']) ? (int) $_GET['page'] : 1);
switch(Template::GetPageData('subaction')) {
default:
Template::SetPageData('sortby', isset($_GET['sortby']) ? in_array($_GET['sortby'], array('id', 'username', 'gmlevel')) ? $_GET['sortby'] : 'username' : 'username');
Template::SetPageData('sorttype', isset($_GET['sorttype']) ? in_array(strtoupper($_GET['sorttype']), array('ASC', 'DESC')) ? $_GET['sorttype'] : 'ASC' : 'ASC');
if(isset($_POST['searchAccount'])) {
$searchAccount = $_POST['searchAccount'];
}
else {
$searchAccount = null;
}
switch(Template::GetPageData('sortby')) {
case 'username':
case 'gmlevel':
Template::SetPageData('accounts_list', Admin::GetAccountsList(Template::GetPageData('page'), Template::GetPageData('sortby'), Template::GetPageData('sorttype'), $searchAccount));
break;
}
break;
case 'edit':
Template::SetPageData('accountid', isset($_GET['accountid']) ? $_GET['accountid'] : 0);
if(isset($_POST['subm'])) {
Admin::UpdateAccount($_POST);
}
break;
case 'delete':
if(!isset($_GET['accountid'])) {
$accid = 0;
}
else {
$accid = (int) $_GET['accountid'];
}
Admin::DeleteAccount($accid);
header('Location: ?action=accounts');
exit;
break;
}
break;
case 'database':
switch(Template::GetPageData('subaction')) {
default:
break;
case 'open':
Template::SetPageData('page', isset($_GET['page']) ? (int) $_GET['page'] : 1);
if(isset($_GET['type']) && isset($_GET['name']) && isset($_GET['realm']) && isset(Armory::$realmData[$_GET['realm']]) && Armory::$realmData[$_GET['realm']]['name_' . $_GET['type']] == $_GET['name'] && in_array($_GET['type'], array('characters', 'world', 'realm', 'armory'))) {
Admin::InitDB($_GET['realm'], $_GET['name'], $_GET['type']);
if(!isset($_GET['table'])) {
Template::SetPageData('tables_list', Admin::GetTablesListFromDB());
}
else {
Template::SetPageData('table_data', Admin::LoadTableFromDB($_GET['table']));
}
}
break;
}
break;
}
if(!Admin::IsLoggedIn()) {
Template::LoadTemplate('page_login');
}
else {
Template::LoadTemplate('page_index');
}
header('HTTP/1.0 404 Not Found');
exit;
?>

0 comments on commit f9fa670

Please sign in to comment.