From: Aryeh Gregor Date: Tue, 8 Apr 2008 13:58:33 +0000 (+0000) Subject: Special-case the WHERE for a single restricted log type; use the database functions... X-Git-Tag: 1.31.0-rc.0~48534 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=642a27187d1c0ef3aade21f050607708a791bda5;p=lhc%2Fweb%2Fwiklou.git Special-case the WHERE for a single restricted log type; use the database functions for escaping and making lists. --- 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; }