fixed multiple "hidden ban" bugs

This commit is contained in:
Savetheinternet 2011-10-03 18:47:59 +11:00
parent 67b954924b
commit 23cfaf0cd3

18
mod.php
View File

@ -1440,7 +1440,7 @@
} }
} }
if(hasPermission($config['mod']['view_banexpired'])) { if(hasPermission($config['mod']['view_banexpired'])) {
$query = prepare("SELECT `bans`.*, `username`, `uri` FROM `bans` LEFT JOIN `boards` ON `boards`.`id` = `board` INNER JOIN `mods` ON `mod` = `mods`.`id` GROUP BY `ip` ORDER BY (`expires` IS NOT NULL AND `expires` < :time), `set` DESC"); $query = prepare("SELECT `bans`.*, `username`, `uri` FROM `bans` LEFT JOIN `boards` ON `boards`.`id` = `board` LEFT JOIN `mods` ON `mod` = `mods`.`id` GROUP BY `ip` ORDER BY (`expires` IS NOT NULL AND `expires` < :time), `set` DESC");
$query->bindValue(':time', time(), PDO::PARAM_INT); $query->bindValue(':time', time(), PDO::PARAM_INT);
$query->execute() or error(db_error($query)); $query->execute() or error(db_error($query));
} else { } else {
@ -1503,6 +1503,7 @@
// Staff // Staff
'<td>' . '<td>' .
(isset($ban['username']) ?
(!hasPermission($config['mod']['view_banstaff']) ? (!hasPermission($config['mod']['view_banstaff']) ?
($config['mod']['view_banquestionmark'] ? ($config['mod']['view_banquestionmark'] ?
'?' '?'
@ -1514,6 +1515,9 @@
) )
: :
utf8tohtml($ban['username']) utf8tohtml($ban['username'])
)
:
'<em>deleted?</em>'
) . ) .
'</td>' . '</td>' .
@ -2196,7 +2200,7 @@
} }
if(hasPermission($config['mod']['view_ban'])) { if(hasPermission($config['mod']['view_ban'])) {
$query = prepare("SELECT `bans`.*, `username`, `uri` FROM `bans` LEFT JOIN `boards` ON `boards`.`id` = `board` INNER JOIN `mods` ON `mod` = `mods`.`id` WHERE `ip` = :ip"); $query = prepare("SELECT `bans`.*, `username`, `uri` FROM `bans` LEFT JOIN `boards` ON `boards`.`id` = `board` LEFT JOIN `mods` ON `mod` = `mods`.`id` WHERE `ip` = :ip");
$query->bindValue(':ip', $ip); $query->bindValue(':ip', $ip);
$query->execute() or error(db_error($query)); $query->execute() or error(db_error($query));
@ -2219,11 +2223,16 @@
// Board // Board
'<tr><th>Board</th><td>' . '<tr><th>Board</th><td>' .
(isset($ban['board']) ?
(isset($ban['uri']) ? (isset($ban['uri']) ?
sprintf($config['board_abbreviation'], $ban['uri']) sprintf($config['board_abbreviation'], $ban['uri'])
: :
'<em>deleted?</em>'
)
:
'<em>all boards</em>' '<em>all boards</em>'
) . '</td></tr>' . ) .
'</td></tr>' .
// Set // Set
'<tr><th>Set</th><td>' . date($config['post_date'], $ban['set']) . '</td></tr>' . '<tr><th>Set</th><td>' . date($config['post_date'], $ban['set']) . '</td></tr>' .
@ -2239,6 +2248,7 @@
// Staff // Staff
'<tr><th>Staff</th><td>' . '<tr><th>Staff</th><td>' .
(isset($ban['username']) ?
(!hasPermission($config['mod']['view_banstaff']) ? (!hasPermission($config['mod']['view_banstaff']) ?
($config['mod']['view_banquestionmark'] ? ($config['mod']['view_banquestionmark'] ?
'?' '?'
@ -2250,6 +2260,8 @@
) )
: :
utf8tohtml($ban['username']) utf8tohtml($ban['username'])
)
: '<em>deleted?</em>'
) . ) .
'</td></tr></table>' . '</td></tr></table>' .