Removed dependence on register_globals from everything except the special pages....
authorTim Starling <tstarling@users.mediawiki.org>
Mon, 29 Mar 2004 14:48:07 +0000 (14:48 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Mon, 29 Mar 2004 14:48:07 +0000 (14:48 +0000)
14 files changed:
includes/Article.php
includes/GlobalFunctions.php
includes/ImagePage.php
includes/OutputPage.php
includes/Parser.php
includes/Skin.php
includes/SkinCologneBlue.php
includes/SkinFramed.php
includes/SkinPHPTal.php
includes/SpecialUserlogin.php
includes/Title.php
includes/User.php
includes/WebRequest.php
languages/Language.php

index a57b040..3bd0b2c 100644 (file)
@@ -64,7 +64,12 @@ class Article {
        # Return the text of this revision
        function getContent( $noredir = false )
        {
-               global $action,$section,$count; # From query string
+               global $wgRequest;
+
+               # Get variables from query string :P
+               $action = $wgRequest->getText( 'action', 'view' );
+               $section = $wgRequest->getText( 'section' );
+
                $fname =  "Article::getContent"; 
                wfProfileIn( $fname );
 
@@ -116,8 +121,11 @@ class Article {
        # Load the revision (including cur_text) into this object
        function loadContent( $noredir = false )
        {
-               global $wgOut, $wgMwRedir;
-               global $oldid, $redirect; # From query
+               global $wgOut, $wgMwRedir, $wgRequest;
+               
+               # Query variables :P
+               $oldid = $wgRequest->getVal( 'oldid' );
+               $redirect = $wgRequest->getVal( 'redirect' );
 
                if ( $this->mContentLoaded ) return;
                $fname = "Article::loadContent";
@@ -377,28 +385,31 @@ class Article {
 
        function view()
        {
-               global $wgUser, $wgOut, $wgLang;
-               global $oldid, $diff; # From query
+               global $wgUser, $wgOut, $wgLang, $wgRequest;
                global $wgLinkCache, $IP, $wgEnableParserCache;
                
                $fname = "Article::view";
                wfProfileIn( $fname );
 
+               # Get variables from query string :P
+               $oldid = $wgRequest->getVal( 'oldid' );
+               $diff = $wgRequest->getVal( 'diff' );
+
                $wgOut->setArticleFlag( true );
                $wgOut->setRobotpolicy( "index,follow" );
 
                # If we got diff and oldid in the query, we want to see a
                # diff page instead of the article.
 
-               if ( isset( $diff ) ) {
+               if ( !is_null( $diff ) ) {
                        $wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
-                       $de = new DifferenceEngine( $oldid, $diff );
+                       $de = new DifferenceEngine( intval($oldid), intval($diff) );
                        $de->showDiffPage();
                        wfProfileOut( $fname );
                        return;
                }
 
-               if ( !isset( $oldid ) and $this->checkTouched() ) {
+               if ( !is_null( $oldid ) and $this->checkTouched() ) {
                        if( $wgOut->checkLastModified( $this->mTouched ) ){
                                return;
                        } else if ( $this->tryFileCache() ) {
@@ -416,7 +427,7 @@ class Article {
 
                # We're looking at an old revision
 
-               if ( $oldid ) {
+               if ( !empty( $oldid ) ) {
                        $this->setOldSubtitle();
                        $wgOut->setRobotpolicy( "noindex,follow" );
                }
@@ -736,14 +747,17 @@ class Article {
                return $this->protect( "" );
        }
 
+       # UI entry point for page deletion 
        function delete()
        {
-               global $wgUser, $wgOut, $wgMessageCache;
-               global $wpConfirm, $wpReason, $image, $oldimage;
+               global $wgUser, $wgOut, $wgMessageCache, $wgRequest;
                $fname = "Article::delete";
-
+               $confirm = $wgRequest->getBool( 'wpConfirm' ) && $wgRequest->isPosted();
+               $reason = $wgRequest->getText( 'wpReason' );
+               
                # This code desperately needs to be totally rewritten
                
+               # Check permissions
                if ( ( ! $wgUser->isSysop() ) ) {
                        $wgOut->sysopRequired();
                        return;
@@ -761,8 +775,8 @@ class Article {
                        return;
                }
 
-               if ( @$_POST["wpConfirm"] ) {
-                       $this->doDelete();
+               if ( $confirm ) {
+                       $this->doDelete( $reason );
                        return;
                }
 
@@ -774,7 +788,7 @@ class Article {
                $etitle = wfStrencode( $title );
                $sql = "SELECT old_text,old_flags FROM old WHERE old_namespace=$ns and old_title='$etitle' ORDER BY inverse_timestamp LIMIT 1";
                $res = wfQuery( $sql, DB_READ, $fname );
-               if( ($old=wfFetchObject($res)) && !$wpConfirm ) {
+               if( ($old=wfFetchObject($res)) && !$confirm ) {
                        $skin=$wgUser->getSkin();
                        $wgOut->addHTML("<B>".wfMsg("historywarning"));
                        $wgOut->addHTML( $skin->historyLink() ."</B><P>");
@@ -802,10 +816,11 @@ class Article {
                        
                        # this should not happen, since it is not possible to store an empty, new
                        # page. Let's insert a standard text in case it does, though
-                       if($length==0 && !$wpReason) { $wpReason=wfmsg("exblank");}
-                       
+                       if($length == 0 && $reason === "") { 
+                               $reason = wfMsg("exblank");
+                       }
                        
-                       if($length < 500 && !$wpReason) {
+                       if($length < 500 && $reason === "") {
                                                                        
                                # comment field=255, let's grep the first 150 to have some user
                                # space left
@@ -816,22 +831,22 @@ class Article {
                                $text=preg_replace("/\>/","&gt;",$text);
                                $text=preg_replace("/[\n\r]/","",$text);
                                if(!$blanked) {
-                                       $wpReason=wfMsg("excontent"). " '".$text;
+                                       $reason=wfMsg("excontent"). " '".$text;
                                } else {
-                                       $wpReason=wfMsg("exbeforeblank") . " '".$text;
+                                       $reason=wfMsg("exbeforeblank") . " '".$text;
                                }
-                               if($length>150) { $wpReason .= "..."; } # we've only pasted part of the text
-                               $wpReason.="'"; 
+                               if($length>150) { $reason .= "..."; } # we've only pasted part of the text
+                               $reason.="'"; 
                        }
                }
 
-               return $this->confirmDelete();
+               return $this->confirmDelete( "", $reason );
        }
        
-       function confirmDelete( $par = "" )
+       # Output deletion confirmation dialog
+       function confirmDelete( $par, $reason )
        {
                global $wgOut;
-               global $wpReason;
 
                wfDebug( "Article::confirmDelete\n" );
                
@@ -850,7 +865,7 @@ class Article {
 <form id=\"deleteconfirm\" method=\"post\" action=\"{$formaction}\">
 <table border=0><tr><td align=right>
 {$delcom}:</td><td align=left>
-<input type=text size=60 name=\"wpReason\" value=\"" . htmlspecialchars( $wpReason ) . "\">
+<input type=text size=60 name=\"wpReason\" value=\"" . htmlspecialchars( $reason ) . "\">
 </td></tr><tr><td>&nbsp;</td></tr>
 <tr><td align=right>
 <input type=checkbox name=\"wpConfirm\" value='1' id=\"wpConfirm\">
@@ -862,10 +877,10 @@ class Article {
                $wgOut->returnToMain( false );
        }
 
-       function doDelete()
+       # Perform a deletion and output success or failure messages
+       function doDelete( $reason )
        {
                global $wgOut, $wgUser, $wgLang;
-               global $wpReason;
                $fname = "Article::doDelete";
                wfDebug( "$fname\n" );
 
@@ -889,10 +904,12 @@ class Article {
                }
        }
 
-       # Delete the article, returns success
-       function doDeleteArticle()
+       # Back-end article deletion
+       # Deletes the article with database consistency, writes logs, purges caches
+       # Returns success
+       function doDeleteArticle( $reason )
        {
-               global $wgUser, $wgLang, $wgRequest;
+               global $wgUser, $wgLang;
                global  $wgUseSquid, $wgDeferredUpdateList, $wgInternalServer;
 
                $fname = "Article::doDeleteArticle";
@@ -991,8 +1008,7 @@ class Article {
                
                $log = new LogPage( wfMsg( "dellogpage" ), wfMsg( "dellogpagetext" ) );
                $art = $this->mTitle->getPrefixedText();
-               $wpReason = $wgRequest->getText( "wpReason" );
-               $log->addEntry( wfMsg( "deletedarticle", $art ), $wpReason );
+               $log->addEntry( wfMsg( "deletedarticle", $art ), $reason );
 
                # Clear the cached article id so the interface doesn't act like we exist
                $this->mTitle->resetArticleID( 0 );
@@ -1189,8 +1205,9 @@ class Article {
        }
 
        function isFileCacheable() {
-               global $wgUser, $wgUseFileCache, $wgShowIPinHeader;
-               global $action, $oldid, $diff, $redirect, $printable;
+               global $wgUser, $wgUseFileCache, $wgShowIPinHeader, $wgRequest;
+               extract( $wgRequest->getValues( 'action', 'oldid', 'diff', 'redirect', 'printable' ) );
+               
                return $wgUseFileCache
                        and (!$wgShowIPinHeader)
                        and ($this->getID() != 0)
index fc5b575..3fb0508 100644 (file)
@@ -484,7 +484,9 @@ function wfImageArchiveDir( $fname , $subdir="archive")
 function wfRecordUpload( $name, $oldver, $size, $desc )
 {
        global $wgUser, $wgLang, $wgTitle, $wgOut, $wgDeferredUpdateList;
-       global $wgUseCopyrightUpload , $wpUploadCopyStatus , $wpUploadSource ;
+       global $wgRequest, $wgUseCopyrightUpload; 
+       
+       extract( $wgRequest->getValues( 'wpUploadCopyStatus', 'wpUploadSource' ) );
        
        $fname = "wfRecordUpload";
 
index 04bb98d..902a0c5 100644 (file)
@@ -116,9 +116,12 @@ class ImagePage extends Article {
 
        function delete()
        {
-               global $wgUser, $wgOut;
-               global $wpConfirm, $wpReason, $image, $oldimage;
+               global $wgUser, $wgOut, $wgRequest;
 
+               $confirm = $wgRequest->getBool( 'wpConfirm' );
+               $image = $wgRequest->getVal( 'image' );
+               $oldimage = $wgRequest->getVal( 'oldimage' );
+               
                # Only sysops can delete images. Previously ordinary users could delete 
                # old revisions, but this is no longer the case.
                if ( !$wgUser->isSysop() ) {
@@ -132,7 +135,7 @@ class ImagePage extends Article {
 
                # Better double-check that it hasn't been deleted yet!
                $wgOut->setPagetitle( wfMsg( "confirmdelete" ) );
-               if ( $image ) {
+               if ( !is_null( $image ) ) {
                        if ( "" == trim( $image ) ) {
                                $wgOut->fatalError( wfMsg( "cannotdelete" ) );
                                return;
@@ -140,14 +143,14 @@ class ImagePage extends Article {
                }
                
                # Deleting old images doesn't require confirmation
-               if ( $oldimage || 1 == $wpConfirm ) {
+               if ( !is_null( $oldimage ) || $confirm ) {
                        $this->doDelete();
                        return;
                }
                
-               if ( $image ) {
+               if ( !is_null( $image ) ) {
                        $q = "&image={$image}";
-               } else if ( $oldimage ) {
+               } else if ( !is_null( $oldimage ) ) {
                        $q = "&oldimage={$oldimage}";
                }
                return $this->confirmDelete( $q );
@@ -155,12 +158,15 @@ class ImagePage extends Article {
 
        function doDelete()
        {
-               global $wgOut, $wgUser, $wgLang;
-               global $image, $oldimage, $wpReason;
+               global $wgOut, $wgUser, $wgLang, $wgRequest;
                global $wgUseSquid, $wgInternalServer, $wgDeferredUpdateList;
                $fname = "Article::doDelete";
 
-               if ( $image ) {
+               $reason = $wgRequest->getVal( 'wpReason' );
+               $image = $wgRequest->getVal( 'image' );
+               $oldimage = $wgRequest->getVal( 'oldimage' );
+
+               if ( !is_null( $image ) ) {
                        $dest = wfImageDir( $image );
                        $archive = wfImageDir( $image );
                        if ( ! unlink( "{$dest}/{$image}" ) ) {
@@ -206,10 +212,10 @@ class ImagePage extends Article {
 
                        $nt = Title::newFromText( $wgLang->getNsText( Namespace::getImage() ) . ":" . $image );
                        $article = new Article( $nt );
-                       $article->doDeleteArticle(); # ignore errors
+                       $article->doDeleteArticle( $reason ); # ignore errors
 
                        $deleted = $image;
-               } else if ( $oldimage ) {
+               } else if ( !is_null( $oldimage ) ) {
                        # Squid purging
                        if ( $wgUseSquid ) {
                                $urlArr = Array(
@@ -224,7 +230,7 @@ class ImagePage extends Article {
 
                        $deleted = $oldimage;
                } else {
-                       $this->doDeleteArticle(); # ignore errors
+                       $this->doDeleteArticle( $reason ); # ignore errors
                        $deleted = $this->mTitle->getPrefixedText();
                }
                $wgOut->setPagetitle( wfMsg( "actioncomplete" ) );
@@ -254,10 +260,11 @@ class ImagePage extends Article {
 
        function revert()
        {
-               global $wgOut;
-               global $oldimage;
+               global $wgOut, $wgRequest;
                global $wgUseSquid, $wgInternalServer, $wgDeferredUpdateList;
 
+               $oldimage = $wgRequest->getText( 'oldimage' );
+               
                if ( strlen( $oldimage ) < 16 ) {
                        $wgOut->unexpectedValueError( "oldimage", $oldimage );
                        return;
index ee10dcc..57ee228 100644 (file)
@@ -537,7 +537,9 @@ class OutputPage {
 
        function returnToMain( $auto = true )
        {
-               global $wgUser, $wgOut, $returnto;
+               global $wgUser, $wgOut, $wgRequest;
+               
+               $returnto = $wgRequest->getText( 'returnto' );
 
                $sk = $wgUser->getSkin();
                if ( "" == $returnto ) {
index 7ed044d..4d7c86e 100644 (file)
@@ -182,9 +182,9 @@ class Parser
                                $pre_content[$marker] = "<pre>$content</pre>";
                        }
                }
-
-               $state = array( $nowiki_content, $hiero_content, $math_content, $pre_content );
                
+               # Must expand in reverse order, otherwise nested tags will be corrupted
+               $state = array( $pre_content, $math_content, $hiero_content, $nowiki_content );
                return $text;
        }
 
@@ -576,6 +576,7 @@ class Parser
        
        /* private */ function handle5Quotes( &$state, $token )
        {
+               $s = "";
                if ( $state["em"] && $state["strong"] ) {
                        if ( $state["em"] < $state["strong"] ) {
                                $s .= "</strong></em>";
@@ -1407,7 +1408,10 @@ class Parser
                $full = "";
                $head = array();
                $sublevelCount = array();
+               $level = 0;
+               $prevlevel = 0;
                foreach( $matches[3] as $headline ) {
+                       $numbering = "";
                        if( $level ) {
                                $prevlevel = $level;
                        }
@@ -1425,11 +1429,11 @@ class Parser
                                $toclevel -= $prevlevel - $level;
                        }
                        # count number of headlines for each level
-                       $sublevelCount[$level]++;
-                       
+                       @$sublevelCount[$level]++;
                        if( $doNumberHeadings || $doShowToc ) {
+                               $dot = 0;
                                for( $i = 1; $i <= $level; $i++ ) {
-                                       if( $sublevelCount[$i] ) {
+                                       if( !empty( $sublevelCount[$i] ) ) {
                                                if( $dot ) {
                                                        $numbering .= ".";
                                                }
@@ -1452,7 +1456,7 @@ class Parser
                        $refer[$headlineCount] = $canonized_headline;
                        
                        # count how many in assoc. array so we can track dupes in anchors
-                       $refers[$canonized_headline]++;
+                       @$refers[$canonized_headline]++;
                        $refcount[$headlineCount]=$refers[$canonized_headline];
 
                        # Prepend the number to the heading text
@@ -1476,6 +1480,9 @@ class Parser
                                $toc .= $sk->tocLine($anchor,$tocline,$toclevel);
                        }
                        if( $showEditLink ) {
+                               if ( empty( $head[$headlineCount] ) ) {
+                                       $head[$headlineCount] = "";
+                               }
                                $head[$headlineCount] .= $sk->editSectionLink($headlineCount+1);
                        }
                        
@@ -1491,16 +1498,14 @@ class Parser
                        }
                                
                        # give headline the correct <h#> tag
-                       $head[$headlineCount] .= "<h".$level.$matches[2][$headlineCount] .$headline."</h".$level.">";
+                       @$head[$headlineCount] .= "<h".$level.$matches[2][$headlineCount] .$headline."</h".$level.">";
                        
                        # Add the edit section link
                        if( $rightClickHack ) {
                                $head[$headlineCount] = $sk->editSectionScript($headlineCount+1,$head[$headlineCount]); 
                        }
                        
-                       $numbering = "";
                        $headlineCount++;
-                       $dot = 0;
                }               
 
                if( $doShowToc ) {
@@ -1515,7 +1520,7 @@ class Parser
                $i = 0;
 
                foreach( $blocks as $block ) {
-                       if( $showEditLink && $headlineCount > 0 && $i == 0 ) {
+                       if( $showEditLink && $headlineCount > 0 && $i == 0 && $block != "\n" ) {
                            # This is the [edit] link that appears for the top block of text when 
                                # section editing is enabled
                                $full .= $sk->editSectionLink(0);
index 39f86c9..0f818a5 100644 (file)
@@ -174,21 +174,22 @@ class Skin {
 
        function getBodyOptions()
        {
-               global $wgUser, $wgTitle, $wgNamespaceBackgrounds, $wgOut, $oldid, $redirect, $diff,$action;
+               global $wgUser, $wgTitle, $wgNamespaceBackgrounds, $wgOut, $wgRequest;
+               
+               extract( $wgRequest->getValues( 'oldid', 'redirect', 'diff' ) );
 
                if ( 0 != $wgTitle->getNamespace() ) {
                        $a = array( "bgcolor" => "#ffffec" );
                }
                else $a = array( "bgcolor" => "#FFFFFF" );
-               if($wgOut->isArticle() && $wgUser->getOption("editondblclick")
-                       && 
-                       (!$wgTitle->isProtected() || $wgUser->isSysop())
-                       
-                       ) {
+               if($wgOut->isArticle() && $wgUser->getOption("editondblclick") && 
+                 (!$wgTitle->isProtected() || $wgUser->isSysop()) ) {
                        $t = wfMsg( "editthispage" );
                        $oid = $red = "";
-                       if ( $redirect ) { $red = "&redirect={$redirect}"; }
-                       if ( $oldid && ! isset( $diff ) ) {
+                       if ( $redirect ) { 
+                               $red = "&redirect={$redirect}"; 
+                       }
+                       if ( !empty($oldid) && ! isset( $diff ) ) {
                                $oid = "&oldid={$oldid}";
                        }
                        $s = $wgTitle->getFullURL( "action=edit{$oid}{$red}" );
@@ -411,7 +412,10 @@ class Skin {
 
        function pageTitleLinks()
        {
-               global $wgOut, $wgTitle, $oldid, $action, $diff, $wgUser, $wgLang, $wgUseApproval;
+               global $wgOut, $wgTitle, $wgUser, $wgLang, $wgUseApproval, $wgRequest;
+
+               extract( $wgRequest->getValues( 'oldid', 'diff' ) );
+               $action = $wgRequest->getText( 'action' );
 
                $s = $this->printableLink();
                if ( wfMsg ( "disclaimers" ) != "-" ) $s .= " | " . $this->makeKnownLink( wfMsg( "disclaimerpage" ), wfMsg( "disclaimers" ) ) ;
@@ -584,7 +588,9 @@ class Skin {
 
        function searchForm()
        {
-               global $search;
+               global $wgRequest;
+
+               $search = $wgRequest->getText( 'search' );;
 
                $s = "<form name='search' class='inline' method=post action=\""
                  . wfLocalUrl( "" ) . "\">"
@@ -658,9 +664,10 @@ class Skin {
 
        function pageStats()
        {
-               global $wgOut, $wgLang, $wgArticle;
-               global $oldid, $diff, $wgDisableCounters;
-
+               global $wgOut, $wgLang, $wgArticle, $wgRequest;
+               global $wgDisableCounters;
+               
+               extract( $wgRequest->getValues( 'oldid', 'diff' ) );
                if ( ! $wgOut->isArticle() ) { return ""; }
                if ( isset( $oldid ) || isset( $diff ) ) { return ""; }
                if ( 0 == $wgArticle->getID() ) { return ""; }
@@ -700,12 +707,14 @@ class Skin {
 
        function quickBar()
        {
-               global $wgOut, $wgTitle, $wgUser, $action, $wgLang;
-               global $wpPreview, $wgDisableUploads, $wgRemoteUploads;
+               global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgLang;
+               global $wgDisableUploads, $wgRemoteUploads;
            
                $fname =  "Skin::quickBar";
                wfProfileIn( $fname );
 
+               $action = $wgRequest->getText( 'action' );
+               $wpPreview = $wgRequest->getBool( 'wpPreview' );
                $tns=$wgTitle->getNamespace();
 
                $s = "\n<div id='quickbar'>";
@@ -921,8 +930,12 @@ class Skin {
 
        function editThisPage()
        {
-               global $wgOut, $wgTitle, $oldid, $redirect, $diff;
-
+               global $wgOut, $wgTitle, $wgRequest;
+               
+               $oldid = $wgRequest->getVal( 'oldid' );
+               $diff = $wgRequest->getVal( 'diff' );
+               $redirect = $wgRequest->getVal( 'redirect' );
+               
                if ( ! $wgOut->isArticleRelated() ) {
                        $s = wfMsg( "protectedpage" );
                } else {
@@ -935,7 +948,7 @@ class Skin {
                        }
                        $oid = $red = "";
 
-                       if ( $redirect ) { $red = "&redirect={$redirect}"; }
+                       if ( !is_null( $redirect ) ) { $red = "&redirect={$redirect}"; }
                        if ( $oldid && ! isset( $diff ) ) {
                                $oid = "&oldid={$oldid}";
                        }
@@ -946,8 +959,9 @@ class Skin {
 
        function deleteThisPage()
        {
-               global $wgUser, $wgOut, $wgTitle, $diff;
+               global $wgUser, $wgOut, $wgTitle, $wgRequest;
 
+               $diff = $wgRequest->getVal( 'diff' );
                if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
                        $n = $wgTitle->getPrefixedText();
                        $t = wfMsg( "deletethispage" );
@@ -961,8 +975,9 @@ class Skin {
 
        function protectThisPage()
        {
-               global $wgUser, $wgOut, $wgTitle, $diff;
+               global $wgUser, $wgOut, $wgTitle, $wgRequest;
 
+               $diff = $wgRequest->getVal( 'diff' );
                if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
                        $n = $wgTitle->getPrefixedText();
 
@@ -982,7 +997,7 @@ class Skin {
 
        function watchThisPage()
        {
-               global $wgUser, $wgOut, $wgTitle, $diff;
+               global $wgUser, $wgOut, $wgTitle;
 
                if ( $wgOut->isArticleRelated() ) {
                        $n = $wgTitle->getPrefixedText();
@@ -1067,7 +1082,6 @@ class Skin {
                global $wgOut, $wgLang, $wgTitle, $wgUseNewInterlanguage;
 
                $a = $wgOut->getLanguageLinks();
-               # TEST THIS @@@
                if ( 0 == count( $a ) ) {
                        if ( !$wgUseNewInterlanguage ) return "";
                        $ns = $wgLang->getNsIndex ( $wgTitle->getNamespace () ) ;
@@ -2233,11 +2247,11 @@ class Skin {
        }
 
        function tocIndent($level) {
-               return str_repeat( "<div class='tocindent'>\n", $level );
+               return str_repeat( "<div class='tocindent'>\n", $level>0 ? $level : 0 );
        }
 
        function tocUnindent($level) {
-               return str_repeat( "</div>\n", $level );
+               return str_repeat( "</div>\n", $level>0 ? $level : 0 );
        }
 
        # parameter level defines if we are on an indentation level
index 46dbdeb..44a2d9e 100644 (file)
@@ -252,7 +252,9 @@ class SkinCologneBlue extends Skin {
 
        function searchForm( $label = "" )
        {
-               global $search;
+               global $wgRequest;
+
+               $search = $wgRequest->getText( 'search' );
                $s = "<form id=\"search\" method=\"get\" class=\"inline\" action=\"" .
                  wfLocalUrlE( "" ) . "\">";
                if ( "" != $label ) { $s .= "{$label}: "; }
index cc18722..51bb929 100644 (file)
@@ -5,8 +5,8 @@ class SkinFramed extends Skin {
 
        function useBodyTag()
        {
-               global $frame;
-               return ( "set" != $frame );
+               global $wgRequest;
+               return ( "set" != $wgRequest->getText( 'frame' ) );
        }
 
        function qbSetting() { return 0; }
@@ -50,9 +50,10 @@ class SkinFramed extends Skin {
 
        function transformContent( $text )
        {
-               global $frame, $HTTP_SERVER_VARS;
+               global $wgRequest, $HTTP_SERVER_VARS;
                global $wgOut, $wgServer, $wgScript;
 
+               $frame = $wgRequest->getText( 'frame' );
                $qs = $HTTP_SERVER_VARS["QUERY_STRING"];
                $qs = wfEscapeHTML( $qs );
 
index 977c588..8ada94c 100644 (file)
                function outputPage( &$out ) {
                        global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgOut;
                        global $wgScriptPath, $wgStyleSheetPath, $wgLanguageCode, $wgUseNewInterlanguage;
-                       global $wgOutputEncoding, $wgUseDatabaseMessages, $action, $oldid, $diff;
+                       global $wgOutputEncoding, $wgUseDatabaseMessages, $wgRequest;
+                       
+                       $action = $wgRequest->getText( 'action' );
+                       $oldid = $wgRequest->getVal( 'oldid' );
+                       $diff = $wgRequest->getVal( 'diff' );
 
                        $this->initPage();
                        $tpl = new PHPTAL($this->template . '.pt', 'templates');
index cecd6c5..71d72fd 100644 (file)
@@ -304,7 +304,7 @@ function userNotPrivilegedMessage()
                if ( 0 != $wgUser->getID() ) {
                        $name = $wgUser->getName();
                } else {
-                       $name = $_COOKIE["{$wgDBname}UserName"];
+                       $name = @$_COOKIE["{$wgDBname}UserName"];
                }
        }
        $pwd = $wgRequest->getText( 'wpPassword' );
index 86a3f7d..b5f2a6e 100644 (file)
@@ -235,7 +235,9 @@ class Title {
        # The URL contains $1, which is replaced by the title
        function getInterwikiLink( $key )
        {       
-               global $wgMemc, $wgDBname, $title_interwiki_cache;
+               global $wgMemc, $wgDBname;
+               static $title_interwiki_cache = array();
+
                $k = "$wgDBname:interwiki:$key";
 
                if( array_key_exists( $k, $title_interwiki_cache ) )
index a6f1fb5..772672e 100644 (file)
@@ -226,7 +226,6 @@ class User {
                        }
                        wfFreeResult( $res );
                } else {
-                       # TEST THIS @@@
                        global $wgDBname, $wgMemc;
                        $key = "$wgDBname:newtalk:ip:{$this->mName}";
                        $newtalk = $wgMemc->get( $key );
index c75763e..2641058 100644 (file)
@@ -112,6 +112,18 @@ class WebRequest {
                return $this->getGPCText( $_REQUEST, $name, $default );
        }
        
+       function getValues() {  
+               $names = func_get_args();
+               $retVal = array();
+               foreach ( $names as $name ) { 
+                       $value = $this->getVal( $name );
+                       if ( !is_null( $value ) ) {
+                               $retVal[$name] = $value;
+                       }
+               }
+               return $retVal;
+       }
+
        function wasPosted() {
                return $_SERVER['REQUEST_METHOD'] == 'POST';
        }
@@ -150,4 +162,4 @@ class WebRequest {
        
 }
 
-?>
\ No newline at end of file
+?>
index 9310147..5b6361e 100644 (file)
@@ -84,7 +84,7 @@ if($wgMetaNamespace === FALSE)
        "contextlines" => 5, "contextchars" => 50,
        "skin" => 'standard', "math" => 1, "rcdays" => 7, "rclimit" => 50,
        "highlightbroken" => 1, "stubthreshold" => 0,
-       "previewontop" => 1, "editsection"=>0,"editsectiononrightclick"=>0, "showtoc"=>1,
+       "previewontop" => 1, "editsection"=>1,"editsectiononrightclick"=>0, "showtoc"=>1,
        "showtoolbar" =>1,
        "date" => 0
 );