Clean up initialized variables; fix upload error.
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 20 Mar 2004 08:41:33 +0000 (08:41 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 20 Mar 2004 08:41:33 +0000 (08:41 +0000)
includes/EditPage.php
includes/LinkCache.php
includes/Parser.php
includes/SearchEngine.php
includes/SpecialContributions.php
includes/SpecialUpload.php

index a568419..a51d183 100644 (file)
@@ -108,6 +108,7 @@ class EditPage {
                global $wgOut, $wgUser;
                global $wgLang, $wgParser, $wgTitle;
            global $wgAllowAnonymousMinor;
+           global $wgWhitelistEdit;
 
                $sk = $wgUser->getSkin();
                $isConflict = false;
index 93721af..c8c4fd7 100644 (file)
@@ -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 ));
index 39cbff5..ebaaf7d 100644 (file)
@@ -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() )
index 802e6c1..08607d4 100644 (file)
@@ -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<BR>\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;
        }
index 11f2366..373857f 100644 (file)
@@ -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 = "<strong>" . wfMsg( "minoreditletter" ) . "</strong> ";
-        }
+       if ($isminor) {
+               $mflag = "<strong>" . wfMsg( "minoreditletter" ) . "</strong> ";
+       } else {
+               $mflag = "";
+       }
 
        $wgOut->addHTML( "<li>{$d} {$mflag}{$link} {$comment}{$topmarktext}</li>\n" );
 }
index 5b46e0b..75a679d 100644 (file)
@@ -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 ) {