1 | <?php |
||||
2 | |||||
3 | /** |
||||
4 | * @copyright Copyright (c) 2009 by Gorlum for http://supernova.ws |
||||
5 | */ |
||||
6 | define('INSIDE', true); |
||||
7 | define('INSTALL', false); |
||||
8 | define('IN_ADMIN', true); |
||||
9 | |||||
10 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
||||
11 | |||||
12 | SnTemplate::messageBoxAdminAccessDenied(AUTH_LEVEL_MODERATOR); |
||||
13 | |||||
14 | global $lang, $user; |
||||
15 | |||||
16 | $mode = sys_get_param_str('mode', 'banit'); |
||||
17 | $name_unsafe = sys_get_param_str_unsafe('name'); |
||||
18 | $name_output = sys_safe_output($name_unsafe); |
||||
19 | $action = sys_get_param_str('action'); |
||||
20 | |||||
21 | $player_banned_row = db_user_by_username($name_unsafe); |
||||
0 ignored issues
–
show
Deprecated Code
introduced
by
![]() Are you sure the assignment to
$player_banned_row is correct as db_user_by_username($name_unsafe) seems to always return null .
This check looks for function or method calls that always return null and whose return value is assigned to a variable. class A
{
function getObject()
{
return null;
}
}
$a = new A();
$object = $a->getObject();
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||||
22 | if ($mode == 'banit' && $action) { |
||||
23 | if ($player_banned_row) { |
||||
0 ignored issues
–
show
|
|||||
24 | $reas = $_POST['why']; |
||||
25 | $days = $_POST['days']; |
||||
26 | $hour = $_POST['hour']; |
||||
27 | $mins = $_POST['mins']; |
||||
28 | $secs = $_POST['secs']; |
||||
29 | |||||
30 | $BanTime = $days * 86400; |
||||
31 | $BanTime += $hour * 3600; |
||||
32 | $BanTime += $mins * 60; |
||||
33 | $BanTime += $secs; |
||||
34 | |||||
35 | sys_admin_player_ban($user, $player_banned_row, $BanTime, $is_vacation = sys_get_param_int('isVacation'), sys_get_param_str('why')); |
||||
36 | |||||
37 | $DoneMessage = "{$lang['adm_bn_thpl']} {$name_output} {$lang['adm_bn_isbn']}"; |
||||
38 | |||||
39 | if ($is_vacation) { |
||||
40 | $DoneMessage .= $lang['adm_bn_vctn']; |
||||
41 | } |
||||
42 | |||||
43 | $DoneMessage .= $lang['adm_bn_plnt']; |
||||
44 | } else { |
||||
45 | $DoneMessage = sprintf($lang['adm_bn_errr'], $name_output); |
||||
46 | } |
||||
47 | |||||
48 | SnTemplate::messageBoxAdmin($DoneMessage, $lang['adm_ban_title']); |
||||
49 | } elseif ($mode == 'unbanit' && $action) { |
||||
50 | sys_admin_player_ban_unset($user, $player_banned_row, ($reason = sys_get_param_str('why')) ? $reason : $lang['sys_unbanned']); |
||||
51 | |||||
52 | $DoneMessage = $lang['adm_unbn_thpl'] . " " . $name_output . " " . $lang['adm_unbn_isbn']; |
||||
53 | SnTemplate::messageBoxAdmin($DoneMessage, $lang['adm_unbn_ttle']); |
||||
54 | }; |
||||
55 | |||||
56 | $parsetemplate = SnTemplate::gettemplate("admin/admin_ban", true); |
||||
0 ignored issues
–
show
true of type true is incompatible with the type null|template expected by parameter $template of SnTemplate::gettemplate() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
57 | |||||
58 | $parsetemplate->assign_vars(array( |
||||
59 | 'name' => $name_output, |
||||
60 | 'mode' => $mode, |
||||
61 | )); |
||||
62 | |||||
63 | SnTemplate::display($parsetemplate, $lang['adm_ban_title']); |
||||
64 |