From 642a27187d1c0ef3aade21f050607708a791bda5 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Tue, 8 Apr 2008 13:58:33 +0000 Subject: [PATCH] Special-case the WHERE for a single restricted log type; use the database functions for escaping and making lists. --- includes/LogEventsList.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/includes/LogEventsList.php b/includes/LogEventsList.php index 3db0c46ca0..19790c45c3 100644 --- a/includes/LogEventsList.php +++ b/includes/LogEventsList.php @@ -372,15 +372,17 @@ class LogEventsList { global $wgLogRestrictions, $wgUser; // Reset the array, clears extra "where" clauses when $par is used $hiddenLogs = array(); - // Don't show private logs to unpriviledged users + // Don't show private logs to unprivileged users foreach( $wgLogRestrictions as $logtype => $right ) { if( !$wgUser->isAllowed($right) ) { $safetype = $db->strencode( $logtype ); - $hiddenLogs[] = "'$safetype'"; + $hiddenLogs[] = $safetype; } } - if( !empty($hiddenLogs) ) { - return 'log_type NOT IN(' . implode(',',$hiddenLogs) . ')'; + if( count($hiddenLogs) == 1 ) { + return 'log_type != ' . $db->addQuotes( $hiddenLogs[0] ); + } elseif( !empty( $hiddenLogs ) ) { + return 'log_type NOT IN (' . $db->makeList($hiddenLogs) . ')'; } return false; } -- 2.20.1