use of $wgRequest
authorTim Starling <tstarling@users.mediawiki.org>
Thu, 1 Apr 2004 12:53:01 +0000 (12:53 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Thu, 1 Apr 2004 12:53:01 +0000 (12:53 +0000)
includes/SpecialAllpages.php
includes/SpecialCategories.php
includes/SpecialContributions.php
includes/SpecialEmailuser.php
includes/SpecialIpblocklist.php
includes/SpecialLockdb.php
includes/SpecialRandompage.php
includes/SpecialRecentchangeslinked.php
includes/SpecialUnlockdb.php
includes/SpecialUnusedimages.php

index 54b6442..e418756 100644 (file)
@@ -2,12 +2,13 @@
 
 function wfSpecialAllpages( $par=NULL )
 {
-       global $from, $indexMaxperpage;
+       global $indexMaxperpage, $wgRequest;
        $indexMaxperpage = 480;
+       $from = $wgRequest->getVal( 'from' );
 
        if( $par ) {
                indexShowChunk( $par );
-       } elseif( isset( $from ) ) {
+       } elseif( !is_null( $from ) ) {
                indexShowChunk( $from );
        } else {
                indexShowToplevel();
index 0b145ef..950cf4e 100644 (file)
@@ -2,8 +2,8 @@
 
 function wfSpecialCategories()
 {
-       global $wgUser, $wgOut , $wgLang ;
-       global $article , $category ;
+       global $wgUser, $wgOut , $wgLang;
+
        $sk = $wgUser->getSkin() ;
        $sc = "Special:Categories" ;
        $r = "" ;
index 6c954a3..0bc00f6 100644 (file)
@@ -149,7 +149,7 @@ TODO: This would probably look a lot nicer in a table.
 */
 function ucListEdit( $sk, $ns, $t, $ts, $topmark, $comment, $isminor, $isnew )
 {
-       global $wgLang, $wgOut, $wgUser, $wgRequest, $target;
+       global $wgLang, $wgOut, $wgUser, $wgRequest;
        $page = Title::makeName( $ns, $t );
        $link = $sk->makeKnownLink( $page, "" );
        $topmarktext="";
@@ -162,6 +162,7 @@ function ucListEdit( $sk, $ns, $t, $ts, $topmark, $comment, $isminor, $isnew )
                $sysop = $wgUser->isSysop();
                if($sysop ) {
                        $extraRollback = $wgRequest->getBool( "bot" ) ? '&bot=1' : '';
+                       $target = $wgRequest->getText( 'target' );
                        $topmarktext .= " [". $sk->makeKnownLink( $page,
                        wfMsg( "rollbacklink" ),
                        "action=rollback&from=" . urlencode( $target ) . $extraRollback ) ."]";
@@ -188,8 +189,9 @@ function ucListEdit( $sk, $ns, $t, $ts, $topmark, $comment, $isminor, $isnew )
 
 function ucCountLink( $lim, $d )
 {
-       global $wgUser, $wgLang, $target;
+       global $wgUser, $wgLang, $wgRequest;
 
+       $target = $wgRequest->getText( 'target' );
        $sk = $wgUser->getSkin();
        $s = $sk->makeKnownLink( $wgLang->specialPage( "Contributions" ),
          "{$lim}", "target={$target}&days={$d}&limit={$lim}" );
@@ -198,8 +200,9 @@ function ucCountLink( $lim, $d )
 
 function ucDaysLink( $lim, $d )
 {
-       global $wgUser, $wgLang, $target;
+       global $wgUser, $wgLang, $wgRequest;
 
+       $target = $wgRequest->getText( 'target' );
        $sk = $wgUser->getSkin();
        $s = $sk->makeKnownLink( $wgLang->specialPage( "Contributions" ),
          "{$d}", "target={$target}&days={$d}&limit={$lim}" );
index c1a071f..2d9645d 100644 (file)
@@ -11,8 +11,8 @@ function wfSpecialEmailuser()
                $wgOut->errorpage( "mailnologin", "mailnologintext" );
                return;
        }
-       $action = $wgRequest->getVal( $action );
-       $target = $wgRequest->getVal( $target );
+       $action = $wgRequest->getVal( 'action' );
+       $target = $wgRequest->getVal( 'target' );
        if ( "" == $target ) {
                $wgOut->errorpage( "notargettitle", "notargettext" );
                return;
@@ -59,12 +59,13 @@ class EmailUserForm {
        function showForm( $err )
        {
                global $wgOut, $wgUser, $wgLang;
-               global $wpSubject, $wpText;
 
                $wgOut->setPagetitle( wfMsg( "emailpage" ) );
                $wgOut->addWikiText( wfMsg( "emailpagetext" ) );
 
-               if ( ! $wpSubject ) { $wpSubject = wfMsg( "defemailsubject" ); }
+               if ( $this->subject === "" ) { 
+                       $this->subject = wfMsg( "defemailsubject" ); 
+               }
 
                $emf = wfMsg( "emailfrom" );
                $sender = $wgUser->getName();
@@ -73,7 +74,8 @@ class EmailUserForm {
                $emr = wfMsg( "emailsubject" );
                $emm = wfMsg( "emailmessage" );
                $ems = wfMsg( "emailsend" );
-
+               $encSubject = htmlspecialchars( $this->subject );
+               
                $titleObj = Title::makeTitle( NS_SPECIAL, "Emailuser" );
                $action = $titleObj->escapeLocalURL( "target={$this->target}&action=submit" );
 
@@ -92,13 +94,13 @@ class EmailUserForm {
 </tr><tr>
 <td align=right>{$emr}:</td>
 <td align=left>
-<input type=text name=\"wpSubject\" value=\"{$wpSubject}\">
+<input type=text name=\"wpSubject\" value=\"{$encSubject}\">
 </td>
 </tr><tr>
 <td align=right>{$emm}:</td>
 <td align=left>
 <textarea name=\"wpText\" rows=10 cols=60 wrap=virtual>
-{$wpText}
+{$this->text}
 </textarea>
 </td></tr><tr>
 <td>&nbsp;</td><td align=left>
@@ -111,16 +113,16 @@ class EmailUserForm {
        function doSubmit()
        {
                global $wgOut, $wgUser, $wgLang, $wgOutputEncoding;
-               global $wpSubject, $wpText, $this->target;
            
                $from = wfQuotedPrintable( $wgUser->getName() ) . " <" . $wgUser->getEmail() . ">";
                
-               $mailResult = userMailer( $this->mAddress, $from, wfQuotedPrintable( $wpSubject ), $wpText );
+               $mailResult = userMailer( $this->mAddress, $from, wfQuotedPrintable( $this->subject ), $this->text );
 
                if (! $mailResult)
                {
                        $titleObj = Title::makeTitle( NS_SPECIAL, "Emailuser" );
-                       $wgOut->redirect( $titleObj->getFullURL( "target={$this->target}&action=success" ) );
+                       $encTarget = wfUrlencode( $this->target );
+                       $wgOut->redirect( $titleObj->getFullURL( "target={$encTarget}&action=success" ) );
                }
                else
                        $wgOut->addHTML( wfMsg( "usermailererror" ) . $mailResult);
index 7d16f48..30fd583 100644 (file)
@@ -2,10 +2,11 @@
 
 function wfSpecialIpblocklist()
 {
-       global $wgUser, $wgOut, $wgRequest, $action;
+       global $wgUser, $wgOut, $wgRequest;
        
        $ip = $wgRequest->getVal( 'wpUnblockAddress', $wgRequest->getVal( 'ip' ) );
        $reason = $wgRequest->getText( 'wpUnblockReason' );
+       $action = $wgRequest->getText( 'action' );
        
        $ipu = new IPUnblockForm( $ip, $reason );
 
index 435a8dd..ff26cc3 100644 (file)
@@ -2,13 +2,13 @@
 
 function wfSpecialLockdb()
 {
-       global $wgUser, $wgOut, $wgRequest, $action;
+       global $wgUser, $wgOut, $wgRequest;
 
        if ( ! $wgUser->isDeveloper() ) {
                $wgOut->developerRequired();
                return;
        }
-
+       $action = $wgRequest->getText( 'action' );
        $f = new DBLockForm();
 
        if ( "success" == $action ) { $f->showSuccess(); }
@@ -27,7 +27,6 @@ class DBLockForm {
        function showForm( $err )
        {
                global $wgOut, $wgUser, $wgLang;
-               global $wpLockConfirm;
 
                $wgOut->setPagetitle( wfMsg( "lockdb" ) );
                $wgOut->addWikiText( wfMsg( "lockdbtext" ) );
index d55f643..a442623 100644 (file)
@@ -2,7 +2,7 @@
 
 function wfSpecialRandompage()
 {
-       global $wgOut, $wgTitle, $wgArticle, $force;
+       global $wgOut, $wgTitle, $wgArticle;
        $fname = "wfSpecialRandompage";
 
        wfSeedRandom();
index 1a50588..afe39ce 100644 (file)
@@ -3,10 +3,13 @@ include_once( "SpecialRecentchanges.php" );
 
 function wfSpecialRecentchangeslinked( $par = NULL )
 {
-       global $wgUser, $wgOut, $wgLang, $wgTitle;
-       global $days, $target, $hideminor; # From query string
+       global $wgUser, $wgOut, $wgLang, $wgTitle, $wgRequest;
        $fname = "wfSpecialRecentchangeslinked";
 
+       $days = $wgRequest->getInt( 'days' );
+       $target = $wgRequest->getText( 'target' );
+       $hideminor = $wgRequest->getBool( 'hideminor' ) ? 1 : 0;
+       
        $wgOut->setPagetitle( wfMsg( "recentchanges" ) );
        $sk = $wgUser->getSkin();
 
index b7ef19b..589f89f 100644 (file)
@@ -2,12 +2,13 @@
 
 function wfSpecialUnlockdb()
 {
-       global $wgUser, $wgOut, $action;
+       global $wgUser, $wgOut, $wgRequest;
 
        if ( ! $wgUser->isDeveloper() ) {
                $wgOut->developerRequired();
                return;
        }
+       $action = $wgRequest->getText( 'action' );
        $f = new DBUnlockForm();
 
        if ( "success" == $action ) { $f->showSuccess(); }
@@ -16,11 +17,9 @@ function wfSpecialUnlockdb()
 }
 
 class DBUnlockForm {
-
        function showForm( $err )
        {
                global $wgOut, $wgUser, $wgLang;
-               global $wpLockConfirm;
 
                $wgOut->setPagetitle( wfMsg( "unlockdb" ) );
                $wgOut->addWikiText( wfMsg( "unlockdbtext" ) );
@@ -52,8 +51,9 @@ class DBUnlockForm {
        function doSubmit()
        {
                global $wgOut, $wgUser, $wgLang;
-               global $wpLockConfirm, $wgReadOnlyFile;
+               global $wgRequest, $wgReadOnlyFile;
 
+               $wpLockConfirm = $wgRequest->getCheck( 'wpLockConfirm' );
                if ( ! $wpLockConfirm ) {
                        $this->showForm( wfMsg( "locknoconfirm" ) );
                        return;
index fb94bcc..5f05a31 100644 (file)
@@ -3,7 +3,6 @@
 function wfSpecialUnusedimages()
 {
        global $wgUser, $wgOut, $wgLang, $wgTitle;
-       global $limit, $offset; # From query string
        $fname = "wfSpecialUnusedimages";
 
        list( $limit, $offset ) = wfCheckLimits();