From 8510acd5a41a57f514bf33ec9131a5899fab7290 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 20 Mar 2004 08:41:33 +0000 Subject: [PATCH] Clean up initialized variables; fix upload error. --- includes/EditPage.php | 1 + includes/LinkCache.php | 4 ++-- includes/Parser.php | 3 ++- includes/SearchEngine.php | 14 ++++++++------ includes/SpecialContributions.php | 12 +++++++----- includes/SpecialUpload.php | 3 ++- 6 files changed, 22 insertions(+), 15 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index a56841950e..a51d183fb4 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -108,6 +108,7 @@ class EditPage { global $wgOut, $wgUser; global $wgLang, $wgParser, $wgTitle; global $wgAllowAnonymousMinor; + global $wgWhitelistEdit; $sk = $wgUser->getSkin(); $isConflict = false; diff --git a/includes/LinkCache.php b/includes/LinkCache.php index 93721af41d..c8c4fd7e48 100644 --- a/includes/LinkCache.php +++ b/includes/LinkCache.php @@ -188,7 +188,7 @@ class LinkCache { $this->mPreFilled = true; if ( $wgEnablePersistentLC ) { - $this->saveToLinkscc( $id, $dbkeyfrom ); + $this->saveToLinkscc( $id ); } wfProfileOut( $fname ); } @@ -290,7 +290,7 @@ class LinkCache { } - /* private */ function saveToLinkscc( $pid, $dbkeyfrom ){ + /* private */ function saveToLinkscc( $pid ){ global $wgCompressedPersistentLC; if( $wgCompressedPersistentLC and function_exists( "gzcompress" ) ) { $ser = wfStrencode( gzcompress( serialize( $this ), 3 )); diff --git a/includes/Parser.php b/includes/Parser.php index 39cbff5c92..ebaaf7d7ce 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -586,7 +586,8 @@ class Parser $state["em"] = FALSE; $state["strong"] = FALSE; $tagIsOpen = FALSE; - + $threeopen = false; + # The tokenizer splits the text into tokens and returns them one by one. # Every call to the tokenizer returns a new token. while ( $token = $tokenizer->nextToken() ) diff --git a/includes/SearchEngine.php b/includes/SearchEngine.php index 802e6c1ee0..08607d4a36 100644 --- a/includes/SearchEngine.php +++ b/includes/SearchEngine.php @@ -58,11 +58,11 @@ class SearchEngine { # that is done by showResults() function powersearch() { - global $wgUser, $wgOut, $wgLang, $wgTitle; + global $wgUser, $wgOut, $wgLang, $wgTitle, $wgRequest; - $search = $_REQUEST['search']; - $searchx = $_REQUEST['searchx']; - $listredirs = $_REQUEST['redirs']; + $search = $wgRequest->getText( 'search' ); + $searchx = $wgRequest->getVal( 'searchx' ); + $listredirs = $wgRequest->getVal( 'redirs' ); $ret = wfMsg("powersearchtext"); # Text to be returned $tempText = ""; # Temporary text, for substitution into $ret @@ -516,17 +516,19 @@ class SearchEngine { $spanabs = ceil($slen * (1 + $span)) - $slen; # print "Word: $sstr, len = $slen, range = [$min, $max], tolerance_count = $tolerance_count
\n"; $result = array(); + $cnt = 0; for( $i=0; $i <= $spanabs; $i++ ){ $titles = SearchEngine::getTitlesByLength( $slen + $i, $namespace ); - if( $i != 0) + if( $i != 0) { $titles = array_merge($titles, SearchEngine::getTitlesByLength( $slen - $i, $namespace ) ); + } foreach($titles as $t){ $d = levenshtein($sstr, $t); if($d < $tolerance_count) $result[] = array($d, $t); $cnt++; } - } + } usort($result, "SearchEngine_pcmp"); return $result; } diff --git a/includes/SpecialContributions.php b/includes/SpecialContributions.php index 11f2366dde..373857f0ec 100644 --- a/includes/SpecialContributions.php +++ b/includes/SpecialContributions.php @@ -129,13 +129,13 @@ function wfSpecialContributions( $par = "" ) function ucListEdit( $sk, $ns, $t, $ts, $topmark, $comment, $isminor ) { - global $wgLang, $wgOut, $wgUser, $target; + global $wgLang, $wgOut, $wgUser, $wgRequest, $target; $page = Title::makeName( $ns, $t ); $link = $sk->makeKnownLink( $page, "" ); $topmarktext = $topmark ? wfMsg ( "uctop" ) : ""; $sysop = $wgUser->isSysop(); - $extraRollback = $_REQUEST['bot'] ? '&bot=1' : ''; + $extraRollback = $wgRequest->getBool( "bot" ) ? '&bot=1' : ''; if($sysop && $topmark ) { $topmarktext .= " [". $sk->makeKnownLink( $page, wfMsg( "rollbacklink" ), @@ -148,9 +148,11 @@ function ucListEdit( $sk, $ns, $t, $ts, $topmark, $comment, $isminor ) } $d = $wgLang->timeanddate( $ts, true ); - if ($isminor) { - $mflag = "" . wfMsg( "minoreditletter" ) . " "; - } + if ($isminor) { + $mflag = "" . wfMsg( "minoreditletter" ) . " "; + } else { + $mflag = ""; + } $wgOut->addHTML( "
  • {$d} {$mflag}{$link} {$comment}{$topmarktext}
  • \n" ); } diff --git a/includes/SpecialUpload.php b/includes/SpecialUpload.php index 5b46e0b67e..75a679d7ca 100644 --- a/includes/SpecialUpload.php +++ b/includes/SpecialUpload.php @@ -38,6 +38,7 @@ function processUpload() global $wgUseCopyrightUpload , $wpUploadCopyStatus , $wpUploadSource ; global $wgCheckFileExtensions, $wgStrictFileExtensions; global $wgFileExtensions, $wgFileBlacklist; + global $wgRequest; if ( $wgUseCopyrightUpload ) { $wpUploadAffirm = 1; @@ -57,7 +58,7 @@ function processUpload() $wpUploadSize = $HTTP_POST_FILES['wpUploadFile']['size']; } $prev = error_reporting( E_ALL & ~( E_NOTICE | E_WARNING ) ); - $oname = $wgRequest->getVal( $HTTP_POST_FILES['wpUploadFile'], 'name' ); + $oname = $wgRequest->getGPCVal( $HTTP_POST_FILES['wpUploadFile'], 'name' ); error_reporting( $prev ); if ( "" != $oname ) { -- 2.20.1