Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

Commit

Permalink
Fixed Logut Page.
Browse files Browse the repository at this point in the history
Fixed Ranks on BattleHall
  • Loading branch information
jkroepke committed Oct 26, 2015
1 parent 2759d1a commit b2ed478
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 32 deletions.
2 changes: 1 addition & 1 deletion includes/pages/adm/ShowLoginPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

function ShowLoginPage()
{
global $USER, $LNG;
global $USER;

$session = Session::create();
if($session->adminAccess == 1)
Expand Down
9 changes: 7 additions & 2 deletions includes/pages/adm/ShowLogoutPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@
* @link http://2moons.cc/
*/


if ($USER['authlevel'] == AUTH_USR)
{
throw new PagePermissionException("Permission error!");
}

function ShowLogoutPage()
{
unset($_SESSION['admin_login']);
$session = Session::create();
$session->adminAccess = 0;
}

47 changes: 18 additions & 29 deletions includes/pages/game/ShowBattleHallPage.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,22 @@ function show()
global $USER, $LNG;
$order = HTTP::_GP('order', 'units');
$sort = HTTP::_GP('sort', 'desc');
$sort = strtoupper($sort);
$sort = strtoupper($sort) === "DESC" ? "DESC" : "ASC";


switch($order)
{
case 'date':
$key = '%%TOPKB%%.time '.$sort;
break;
case 'owner':
$key = '%%TOPKB%%.attacker '.$sort.',%%TOPKB%%.defender '.$sort;
break;
case 'units':
default:
$key = '%%TOPKB%%.units '.$sort;
break;
}

$db = Database::get();
$sql = "SELECT *, (
Expand All @@ -56,8 +71,7 @@ function show()
FROM %%TOPKB_USERS%% INNER JOIN %%USERS%% ON uid = id
WHERE %%TOPKB_USERS%%.rid = %%TOPKB%%.`rid` AND `role` = 2
) as defender
,@rank:=@rank+1 as rank
FROM %%TOPKB%% WHERE universe = :universe ORDER BY units DESC LIMIT 100;";
FROM %%TOPKB%% WHERE universe = :universe ORDER BY ".$key." LIMIT 100;";

$top = $db->select($sql, array(
':universe' => Universe::current()
Expand All @@ -66,21 +80,7 @@ function show()
$TopKBList = array();
foreach($top as $data)
{
switch($order)
{
case 'date':
$key = $data['time'];
break;
case 'owner':
$key = $data['attacker'].$data['defender'];
break;
case 'units':
default:
$key = $data['units'];
break;
}

$TopKBList[$key][] = array(
$TopKBList[] = array(
'result' => $data['result'],
'date' => _date($LNG['php_tdformat'], $data['time'], $USER['timezone']),
'time' => TIMESTAMP - $data['time'],
Expand All @@ -91,17 +91,6 @@ function show()
);
}

ksort($TopKBList);

if($sort === "DESC")
{
$TopKBList = array_reverse($TopKBList);
}
else
{
$sort = "ASC";
}

$this->assign(array(
'TopKBList' => $TopKBList,
'sort' => $sort,
Expand Down

0 comments on commit b2ed478

Please sign in to comment.