From 9e53bfc81c11a5880291e0c4ac3e84d84ad3f821 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 8 Mar 2004 01:51:32 +0000 Subject: [PATCH] Imported the register_globals hack from REL1_2. Also starting work on elimination of the use of import_request_variables (which gives us all the insecurity of register_globals). Uncomment the define of DEBUG_GLOBALS in index.php to turn on extra error reporting and trace down use of uninitialized variables and nassssty globals. Also rearranged the magic_quotes fixing, may not yet cover everything... --- RELEASE-NOTES | 3 ++- includes/DefaultSettings.php | 5 ++++ includes/EditPage.php | 4 +-- includes/MessageCache.php | 2 +- includes/Setup.php | 11 ++------ includes/Skin.php | 2 +- includes/SpecialUpload.php | 8 +++--- includes/User.php | 42 ++++++++++++----------------- index.php | 52 +++++++++++++++++++++++++++++++----- install-utils.inc | 3 --- 10 files changed, 79 insertions(+), 53 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index cc46dca3d0..45b8ba242a 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -29,12 +29,13 @@ New features in 1.2: privilege, such as the 'Developer' account created by the install. Fixes and tweaks: +* Now works with register_globals off! +* Works with short tags disabled. * Should work out of the box on MySQL 3.2.x again. On 4.x set $wgEnablePersistentLC = true; to turn on the link cache table for a slight rendering speed boost. * rebuildMessages.php can now selectively update new messages, or overwrite everything. -* Works with short tags disabled. * Various bug fixes. * Other stuff we forgot. * Documentation more out of date than ever before! diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 0992bb7a3a..4a7fe1fa28 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -251,4 +251,9 @@ $wgSiteNotice = ""; # Whether to allow anonymous users to set changes to 'minor' $wgAllowAnonymousMinor = false; + +if( !isset( $wgCommandLineMode ) ) { + $wgCommandLineMode = false; +} + ?> diff --git a/includes/EditPage.php b/includes/EditPage.php index 6f06d0e5ad..6ea4472b45 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -308,10 +308,10 @@ class EditPage { # if this is a comment, show a subject line at the top, which is also the edit summary. # Otherwise, show a summary field at the bottom if($section=="new") { - $commentsubject="{$subject}:
"; + $editsummary = ""; } else { - + $commentsubject = ""; $editsummary="{$summary}:
"; } diff --git a/includes/MessageCache.php b/includes/MessageCache.php index 5dd1516ddf..ed4e1de1bf 100755 --- a/includes/MessageCache.php +++ b/includes/MessageCache.php @@ -175,7 +175,7 @@ class MessageCache if ( !$message && $useDB) { $sql = "SELECT cur_text FROM cur WHERE cur_namespace=" . NS_MEDIAWIKI . " AND cur_title='$title'"; - $res = wfQuery( $sql, DB_READ, $fname ); + $res = wfQuery( $sql, DB_READ, "MessageCache::get" ); if ( wfNumRows( $res ) ) { $obj = wfFetchObject( $res ); diff --git a/includes/Setup.php b/includes/Setup.php index 98e3ba90af..f421e05aea 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -64,21 +64,14 @@ global $wgBlockCache, $wgParserCache, $wgParser; # Useful debug output if ( function_exists( "getallheaders" ) ) { wfDebug( "\nStart request\n" ); - wfDebug( "$REQUEST_METHOD $REQUEST_URI\n" ); + wfDebug( $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . "\n" ); $headers = getallheaders(); foreach ($headers as $name => $value) { wfDebug( "$name: $value\n" ); } wfDebug( "\n" ); } else { - wfDebug( "$REQUEST_METHOD $REQUEST_URI\n" ); -} - -# Fix "magic" quotes -if ( get_magic_quotes_gpc() ) { - foreach ( $_REQUEST as $field => $value ) { - $_REQUEST[$field] = stripslashes( $value ); - } + wfDebug( $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . "\n" ); } # Set up Memcached diff --git a/includes/Skin.php b/includes/Skin.php index f57466cb14..fc806400e7 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -2354,7 +2354,7 @@ class Skin { "sample"=>"", "tip"=>wfMsg("hr_tip")) ); - $toolbar.="