From: Tim Starling Date: Fri, 13 Aug 2004 11:57:20 +0000 (+0000) Subject: Fixed register_globals dependence, fixed HTML-insertion vulnerability by replacing... X-Git-Tag: 1.5.0alpha1~2383 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=674b24b02465f0d80aba8df843a8fbc985616d67;p=lhc%2Fweb%2Fwiklou.git Fixed register_globals dependence, fixed HTML-insertion vulnerability by replacing the useless $limit with the actual number of rows returned --- diff --git a/includes/SpecialWatchlist.php b/includes/SpecialWatchlist.php index cd96ae921b..0518dc9d18 100644 --- a/includes/SpecialWatchlist.php +++ b/includes/SpecialWatchlist.php @@ -4,9 +4,8 @@ require_once( "WatchedItem.php" ); function wfSpecialWatchlist() { - global $wgUser, $wgOut, $wgLang, $wgTitle, $wgMemc; + global $wgUser, $wgOut, $wgLang, $wgTitle, $wgMemc, $wgRequest; global $wgUseWatchlistCache, $wgWLCacheTimeout, $wgDBname; - global $days, $limit, $target; # From query string $fname = "wfSpecialWatchlist"; $wgOut->setPagetitle( wfMsg( "watchlist" ) ); @@ -22,7 +21,12 @@ function wfSpecialWatchlist() return; } - global $action,$remove,$id; + # Get query variables + $days = $wgRequest->getVal( 'days' ); + $action = $wgRequest->getVal( 'action' ); + $remove = $wgRequest->getVal( 'remove' ); + $id = $wgRequest->getVal( 'id' ); + if(($action == "submit") && isset($remove) && is_array($id)) { $wgOut->addHTML( wfMsg( "removingchecked" ) ); foreach($id as $one) { @@ -62,8 +66,8 @@ function wfSpecialWatchlist() $wgOut->addHTML( wfMsg( "nowatchlist" ) ); return; } - - if ( ! isset( $days ) ) { + + if ( is_null( $days ) ) { $big = 1000; if($nitems > $big) { # Set default cutoff shorter @@ -100,7 +104,6 @@ function wfSpecialWatchlist() "