More globals and uninitialized variables fixes. Added WebRequest ($wgRequest)
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 8 Mar 2004 09:09:35 +0000 (09:09 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 8 Mar 2004 09:09:35 +0000 (09:09 +0000)
commit014093acc4e0c277d0d92fdc54fb620210d6ec8a
treead350d3b493b0f496fbfc0bb9b6616008ddafb51
parent51f738ea9a198d11e78cf030dce54f814fa8bc69
More globals and uninitialized variables fixes. Added WebRequest ($wgRequest)
object to encapsulate the handling of get/post variables:

The following grab something out of $_REQUEST. The first parameter is the
variable name and is required. The second is an optional default value:

  $wgRequest->getVal() - any type, returns NULL if no default given
  $wgRequest->getInt() - forced integer, 0 default
  $wgRequest->getText() - runs through $wgLang->recodeInput()
  $wgRequest->getBool() - return true/false
  $wgRequest->getCheck() - returns true if the var is set, even if to ""

$wgRequest strips slashes at initialization if necessary.

Also in this fine object:
  $wgRequest->wasPosted() - returns false if this wasn't a real form post,
    so we can protect against faked submissions in get urls.

There's still plenty of work to do, not everything uses the new functions
yet. To test the strict mode, do define('DEBUG_GLOBALS', 1);
24 files changed:
includes/Article.php
includes/EditPage.php
includes/GlobalFunctions.php
includes/LinksUpdate.php
includes/LogPage.php
includes/Parser.php
includes/QueryPage.php
includes/Setup.php
includes/SpecialAsksql.php
includes/SpecialBlockip.php
includes/SpecialContributions.php
includes/SpecialEmailuser.php
includes/SpecialImagelist.php
includes/SpecialIpblocklist.php
includes/SpecialLockdb.php
includes/SpecialMovepage.php
includes/SpecialNewpages.php
includes/SpecialPreferences.php
includes/SpecialUpload.php
includes/SpecialUserlogin.php
includes/Title.php
includes/WatchedItem.php
includes/WebRequest.php [new file with mode: 0644]
index.php