Skip to content

Commit

Permalink
Merge pull request #533 from Groruk/fix
Browse files Browse the repository at this point in the history
Misc Fixes
  • Loading branch information
Groruk authored Nov 5, 2018
2 parents 3840845 + 0dd10d3 commit 398fab6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
8 changes: 8 additions & 0 deletions web/includes/sb-callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -1698,6 +1698,10 @@ function AddBan($nickname, $type, $steam, $ip, $length, $dfile, $dname, $reason,
$error++;
$objResponse->addAssign("ip.msg", "innerHTML", "You must type a valid IP");
$objResponse->addScript("$('ip.msg').setStyle('display', 'block');");
} elseif ($length < 0) {
$error++;
$objResponse->addAssign("length.msg", "innerHTML", "Length must be positive or 0");
$objResponse->addScript("$('length.msg').setStyle('display', 'block');");
} else {
$objResponse->addAssign("steam.msg", "innerHTML", "");
$objResponse->addScript("$('steam.msg').setStyle('display', 'none');");
Expand Down Expand Up @@ -3005,6 +3009,10 @@ function AddBlock($nickname, $type, $steam, $length, $reason)
$error++;
$objResponse->addAssign("steam.msg", "innerHTML", "Please enter a valid Steam ID or Community ID");
$objResponse->addScript("$('steam.msg').setStyle('display', 'block');");
} elseif ($length < 0) {
$error++;
$objResponse->addAssign("length.msg", "innerHTML", "Length must be positive or 0");
$objResponse->addScript("$('length.msg').setStyle('display', 'block');");
} else {
$objResponse->addAssign("steam.msg", "innerHTML", "");
$objResponse->addScript("$('steam.msg').setStyle('display', 'none');");
Expand Down
3 changes: 3 additions & 0 deletions web/includes/system-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ function CheckAdminAccess($mask)

function SecondsToString($sec, $textual=true)
{
if ($sec < 0) {
return 'Session';
}
if ($textual) {
$div = array( 2592000, 604800, 86400, 3600, 60, 1 );
$desc = array('mo','wk','d','hr','min','sec');
Expand Down
12 changes: 6 additions & 6 deletions web/pages/core/navbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,27 @@

$active = filter_input(INPUT_GET, 'p', FILTER_SANITIZE_STRING);
foreach ($navbar as $key => $tab) {
$navbar[$key]['state'] = ($active === $tab['endpoint']) ? 'active' : 'nonactive';

if (!$tab['permission']) {
unset($navbar[$key]);
}

$navbar[$key]['state'] = ($active === $tab['endpoint']) ? 'active' : 'nonactive';
}

if ($userbank->is_admin()) {
$cat = filter_input(INPUT_GET, 'c', FILTER_SANITIZE_STRING);
foreach ($admin as $key => $tab) {
$admin[$key]['state'] = ($cat === $tab['endpoint']) ? 'active' : '';

if (!$userbank->HasAccess($tab['permission'])) {
unset($admin[$key]);
}

$admin[$key]['state'] = ($cat === $tab['endpoint']) ? 'active' : '';
}
}

Template::render('core/navbar', [
'navbar' => $navbar,
'adminbar' => $admin,
'navbar' => array_values($navbar),
'adminbar' => array_values($admin),
'isAdmin' => $userbank->is_admin(),
'login' => $userbank->is_logged_in(),
'username' => $userbank->GetProperty("user")
Expand Down
2 changes: 1 addition & 1 deletion web/themes/default/page_admin_bans_add.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
</optgroup>
</select>
</div>
<div id="length.msg" ></div>
<div id="length.msg" class="badentry"></div>
</td>
</tr>

Expand Down
2 changes: 1 addition & 1 deletion web/themes/default/page_admin_comms_add.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
</optgroup>
</select>
</div>
<div id="length.msg" ></div>
<div id="length.msg" class="badentry"></div>
</td>
</tr>
<tr>
Expand Down

0 comments on commit 398fab6

Please sign in to comment.