X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=config%2Findex.php;h=7051b01ece96c96ceb13638c0c9e9642a8ecc575;hb=32a8f9c71169ffe15994e1235b1de2442d62c0f2;hp=7aede224120bc1a2bc2ab0d0afc27d8c1d4e638b;hpb=aeaada603307a299998fbcae5787e3be3cda21bc;p=lhc%2Fweb%2Fwiklou.git
diff --git a/config/index.php b/config/index.php
index 7aede22412..7051b01ece 100644
--- a/config/index.php
+++ b/config/index.php
@@ -1,6 +1,7 @@
+# Copyright (C) 2004 Brion Vibber , 2006 Rob Church
# http://www.mediawiki.org/
#
# This program is free software; you can redistribute it and/or modify
@@ -22,121 +23,133 @@ error_reporting( E_ALL );
header( "Content-type: text/html; charset=utf-8" );
@ini_set( "display_errors", true );
-?>
+# In case of errors, let output be clean.
+$wgRequestTime = microtime();
+
+# Attempt to set up the include path, to fix problems with relative includes
+$IP = dirname( dirname( __FILE__ ) );
+define( 'MW_INSTALL_PATH', $IP );
+$sep = PATH_SEPARATOR;
+if( !ini_set( "include_path", ".$sep$IP$sep$IP/includes$sep$IP/languages" ) ) {
+ set_include_path( ".$sep$IP$sep$IP/includes$sep$IP/languages" );
+}
+
+# Define an entry point and include some files
+define( "MEDIAWIKI", true );
+define( "MEDIAWIKI_INSTALL", true );
+require_once( "includes/Defines.php" );
+require_once( "includes/DefaultSettings.php" );
+require_once( "includes/MagicWord.php" );
+require_once( "includes/Namespace.php" );
+
+?>
+
-
- MediaWiki installation
+ MediaWiki Installation
-
+ @import "../skins/monobook/main.css";
-
+ .env-check {
+ font-size: 90%;
+ margin: 1em 0 1em 2.5em;
+ }
-
-
-
-
-
- MediaWiki is
- Copyright (C) 2001-2004 by Magnus Manske, Brion Vibber, Lee Daniel Crocker,
- Tim Starling, Erik Möller, Gabriel Wicke and others.
-
-
This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
-
This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
-
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- or read it online
Please move LocalSettings.php to the parent directory, then
- try out your wiki.
- (You should remove this config directory for added security once you're done.)
Please include all of the lines below when reporting installation problems.
-
Checking environment...
-
+
Please include all of the lines below when reporting installation problems.
+
PHP " . phpversion() . ": ";
-if( version_compare( phpversion(), "5.0", "lt" ) ) {
- print "ok";
-} else {
- print " the MonoBook skin will be disabled due to an incompatibility
- between the PHPTAL template library and PHP 5. The wiki should
- function normally, but with the older look and feel.";
-}
-print "\n";
+print "
PHP " . phpversion() . " installed
\n";
if( ini_get( "register_globals" ) ) {
?>
-
Warning:PHP's
- register_globals
- option is enabled. MediaWiki will work correctly, but this setting
- increases your exposure to potential security vulnerabilities in PHP-based
- software running on your server. You should disable it if you are able.
+
+
+ Warning:
+ PHP's register_globals option is enabled. Disable it if you can.
+
+ MediaWiki will work, but your server is more exposed to PHP-based security vulnerabilities.
+
+
Fatal: magic_quotes_runtime is active!
+ This option corrupts data input unpredictably; you cannot install or use
+ MediaWiki unless this option is disabled.
+
Fatal: magic_quotes_sybase is active!
+ This option corrupts data input unpredictably; you cannot install or use
+ MediaWiki unless this option is disabled.
+
Fatal: mbstring.func_overload is active!
+ This option causes errors and may corrupt data unpredictably;
+ you cannot install or use MediaWiki unless this option is disabled.
Warning: PHP's
- safe mode is active!
- You will likely have problems caused by this. You may need to make the
- 'images' subdirectory writable or specify a TMP environment variable pointing to
- a writable temporary directory owned by you, since safe mode breaks the system
- temporary directory.
+
Warning:PHP's
+ safe mode is active.
+ You may have problems caused by this, particularly if using image uploads.
+
safeMode = false;
}
$sapi = php_sapi_name();
@@ -229,14 +259,15 @@ case "apache":
case "apache2handler":
print "ok, using pretty URLs (index.php/Page_Title)";
break;
+default:
+ print "unknown; ";
case "cgi":
case "cgi-fcgi":
case "apache2filter":
+case "isapi":
print "using ugly URLs (index.php?title=Page_Title)";
$conf->prettyURLs = false;
break;
-default:
- print "unknown; using pretty URLs (index.php/Page_Title), if you have trouble change this in LocalSettings.php";
}
print "\n";
@@ -251,13 +282,13 @@ if( $conf->xml ) {
$memlimit = ini_get( "memory_limit" );
$conf->raiseMemory = false;
-if( empty( $memlimit ) ) {
+if( empty( $memlimit ) || $memlimit == -1 ) {
print "
PHP is configured with no memory_limit.
\n";
} else {
- print "
PHP's memory_limit is " . htmlspecialchars( $memlimit ) . ". If this is too low, installation may fail! ";
- $n = IntVal( $memlimit );
+ print "
PHP's memory_limit is " . htmlspecialchars( $memlimit ) . ". If this is too low, installation may fail! ";
+ $n = intval( $memlimit );
if( preg_match( '/^([0-9]+)[Mm]$/', trim( $memlimit ), $m ) ) {
- $n = IntVal( $m[1] * (1024*1024) );
+ $n = intval( $m[1] * (1024*1024) );
}
if( $n < 20*1024*1024 ) {
print "Attempting to raise limit to 20M... ";
@@ -278,21 +309,57 @@ if( $conf->zlib ) {
print "
PHP is linked with old MySQL client libraries. If you are
+ using a MySQL 4.1 server and have problems connecting to the database,
+ see http://dev.mysql.com/doc/mysql/en/old-client.html for help.
\n";
+ }
+ $dbc = new $dbclass;
+
+ if( $conf->DBtype == 'mysql' ) {
+ $ok = true; # Let's be optimistic
+
+ # Decide if we're going to use the superuser or the regular database user
+ if( $conf->RootPW == '-' ) {
+ # Regular user
+ $conf->Root = false;
+ $db_user = $wgDBuser;
+ $db_pass = $wgDBpassword;
+ } else {
+ # Superuser
+ $conf->Root = true;
+ $db_user = $conf->RootUser;
+ $db_pass = $conf->RootPW;
+ }
+
+ # Attempt to connect
+ echo( "
Attempting to connect to database server as $db_user..." );
+ $wgDatabase = Database::newFromParams( $wgDBserver, $db_user, $db_pass, '', 1 );
+
+ # Check the connection and respond to errors
+ if( $wgDatabase->isOpen() ) {
+ # Seems OK
+ $ok = true;
+ $wgDBadminuser = $db_user;
+ $wgDBadminpassword = $db_pass;
+ echo( "success.
\n" );
+ $wgDatabase->ignoreErrors( true );
+ $myver = mysql_get_server_info( $wgDatabase->mConn );
+ } else {
+ # There were errors, report them and back out
+ $ok = false;
+ $errno = mysql_errno();
+ $errtx = htmlspecialchars( mysql_error() );
+ switch( $errno ) {
+ case 1045:
+ case 2000:
+ echo( "failed due to authentication errors. Check passwords." );
+ if( $conf->Root ) {
+ # The superuser details are wrong
+ $errs["RootUser"] = "Check username";
+ $errs["RootPW"] = "and password";
+ } else {
+ # The regular user details are wrong
+ $errs["DBuser"] = "Check username";
+ $errs["DBpassword"] = "and password";
+ }
+ break;
+ case 2002:
+ case 2003:
+ default:
+ # General connection problem
+ echo( "failed with error [$errno] $errtx.\n" );
+ $errs["DBserver"] = "Connection failed";
+ break;
+ } # switch
+ } #conn. att.
+
+ if( !$ok ) { continue; }
+
+ } else /* not mysql */ {
+ print "
Connected to $myver";
+ if( version_compare( $myver, "4.0.0" ) < 0 ) {
+ die( " -- mysql 4.0 or later required. Aborting." );
+ }
+ $mysqlNewAuth = version_compare( $myver, "4.1.0", "ge" );
+ if( $mysqlNewAuth && $mysqlOldClient ) {
+ print "; You are using MySQL 4.1 server, but PHP is linked
+ to old client libraries; if you have trouble with authentication, see
+ http://dev.mysql.com/doc/mysql/en/old-client.html for help.";
+ }
+ if( $wgDBmysql5 ) {
+ if( $mysqlNewAuth ) {
+ print "; enabling MySQL 4.1/5.0 charset mode";
+ } else {
+ print "; MySQL 4.1/5.0 charset mode enabled,
+ but older version detected; will likely fail.";
+ }
}
print "
Initializing data...";
- $wgDatabase->query( "INSERT INTO site_stats (ss_row_id,ss_total_views," .
- "ss_total_edits,ss_good_articles) VALUES (1,0,0,0)" );
- # setting up the db user
+ $wgDatabase->insert( 'site_stats',
+ array( 'ss_row_id' => 1,
+ 'ss_total_views' => 0,
+ 'ss_total_edits' => 0,
+ 'ss_good_articles' => 0 ) );
+
+ # Set up the "regular user" account *if we can, and if we need to*
if( $conf->Root ) {
- print "
Granting user permissions...
\n";
- dbsource( "../maintenance/users.sql", $wgDatabase );
+ # See if we need to
+ $wgDatabase2 = Database::newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, '', 1 );
+ if( $wgDatabase2->isOpen() ) {
+ # Nope, just close the test connection and continue
+ $wgDatabase2->close();
+ echo( "
User $wgDBuser exists. Skipping grants.
" );
+ } else {
+ # Yes, so run the grants
+ echo( "
Granting user permissions to $wgDBuser on $wgDBname..." );
+ dbsource( "../maintenance/users.sql", $wgDatabase );
+ echo( "success.
";
initialiseMessages();
@@ -561,6 +730,8 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
/* Write out the config file now that all is well */
print "
Creating LocalSettings.php...
\n\n";
$localSettings = "<" . "?php$endl$local$endl?" . ">";
+ // Fix up a common line-ending problem (due to CVS on Windows)
+ $localSettings = str_replace( "\r\n", "\n", $localSettings );
if( version_compare( phpversion(), "4.3.2" ) >= 0 ) {
$xt = "xt"; # Refuse to overwrite an existing file
@@ -574,11 +745,14 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
"
Here's the file that would have been written, try to paste it into place manually:
If you are in a shared hosting environment, do not just move LocalSettings.php
+remotely. LocalSettings.php is currently owned by the user your webserver is running under,
+which means that anyone on the same server can read your database password! Downloading
+it and uploading it again will hopefully change the ownership to a user ID specific to you.
+EOT;
+ } else {
+ echo "
Installation successful! Move the config/LocalSettings.php file into the parent directory, then follow
+ this link to your wiki.
Warning: \$wgSecretKey key is insecure, generated with mt_rand(). Consider changing it manually.
\n";
}
# Add slashes to strings for double quoting
@@ -809,15 +1156,28 @@ function writeLocalSettings( $conf ) {
$slconf['RightsIcon'] = $conf->RightsIcon;
}
- $sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":";
- return "
+ $sep = PATH_SEPARATOR;
+ $localsettings = "
# This file was automatically generated by the MediaWiki installer.
# If you make manual changes, please keep track in case you need to
# recreate them later.
+#
+# See includes/DefaultSettings.php for all configurable settings
+# and their default values, but don't forget to make changes in _this_
+# file, not there.
+
+# If you customize your file layout, set \$IP to the directory that contains
+# the other MediaWiki files. It will be used as a base to locate files.
+if( defined( 'MW_INSTALL_PATH' ) ) {
+ \$IP = MW_INSTALL_PATH;
+} else {
+ \$IP = dirname( __FILE__ );
+}
+
+\$path = array( \$IP, \"\$IP/includes\", \"\$IP/languages\" );
+set_include_path( implode( PATH_SEPARATOR, \$path ) );
-\$IP = \"{$slconf['IP']}\";
-ini_set( \"include_path\", \".$sep\$IP$sep\$IP/includes$sep\$IP/languages\" );
-require_once( \"DefaultSettings.php\" );
+require_once( \"includes/DefaultSettings.php\" );
# If PHP's memory limit is very low, some operations may fail.
" . ($conf->raiseMemory ? '' : '# ' ) . "ini_set( 'memory_limit', '20M' );" . "
@@ -826,7 +1186,7 @@ if ( \$wgCommandLineMode ) {
if ( isset( \$_SERVER ) && array_key_exists( 'REQUEST_METHOD', \$_SERVER ) ) {
die( \"This script must be run from the command line\\n\" );
}
-} elseif ( empty( \$wgConfiguring ) ) {
+} elseif ( empty( \$wgNoOutputBuffer ) ) {
## Compress output if the browser supports it
{$zlib}if( !ini_get( 'zlib.output_compression' ) ) @ob_start( 'ob_gzhandler' );
}
@@ -837,7 +1197,9 @@ if ( \$wgCommandLineMode ) {
\$wgScript = \"\$wgScriptPath/index.php\";
\$wgRedirectScript = \"\$wgScriptPath/redirect.php\";
-## If using PHP as a CGI module, use the ugly URLs
+## For more information on customizing the URLs please see:
+## http://meta.wikimedia.org/wiki/Eliminating_index.php_from_the_url
+## If using PHP as a CGI module, the ?title= style usually must be used.
{$pretty}\$wgArticlePath = \"\$wgScript/\$1\";
{$ugly}\$wgArticlePath = \"\$wgScript?title=\$1\";
@@ -848,36 +1210,51 @@ if ( \$wgCommandLineMode ) {
\$wgUploadPath = \"\$wgScriptPath/images\";
\$wgUploadDirectory = \"\$IP/images\";
+\$wgEnableEmail = $enableemail;
+\$wgEnableUserEmail = $enableuseremail;
+
\$wgEmergencyContact = \"{$slconf['EmergencyContact']}\";
\$wgPasswordSender = \"{$slconf['PasswordSender']}\";
+## For a detailed description of the following switches see
+## http://meta.wikimedia.org/Enotif and http://meta.wikimedia.org/Eauthent
+## There are many more options for fine tuning available see
+## /includes/DefaultSettings.php
+## UPO means: this is also a user preference option
+\$wgEnotifUserTalk = $enotifusertalk; # UPO
+\$wgEnotifWatchlist = $enotifwatchlist; # UPO
+\$wgEmailAuthentication = $eauthent;
+
\$wgDBserver = \"{$slconf['DBserver']}\";
\$wgDBname = \"{$slconf['DBname']}\";
\$wgDBuser = \"{$slconf['DBuser']}\";
\$wgDBpassword = \"{$slconf['DBpassword']}\";
+\$wgDBprefix = \"{$slconf['DBprefix']}\";
+\$wgDBtype = \"{$slconf['DBtype']}\";
-## To allow SQL queries through the wiki's Special:Askaql page,
-## uncomment the next lines. THIS IS VERY INSECURE. If you want
-## to allow semipublic read-only SQL access for your sysops,
-## you should define a MySQL user with limited privileges.
-## See MySQL docs: http://www.mysql.com/doc/en/GRANT.html
-#
-# \$wgAllowSysopQueries = true;
-# \$wgDBsqluser = \"sqluser\";
-# \$wgDBsqlpassword = \"sqlpass\";
+# Experimental charset support for MySQL 4.1/5.0.
+\$wgDBmysql5 = {$conf->DBmysql5};
-\$wgDBmysql4 = \$wgEnablePersistentLC = {$conf->DBmysql4};
+## Shared memory settings
+\$wgMainCacheType = $cacheType;
+\$wgMemCachedServers = $mcservers;
## To enable image uploads, make sure the 'images' directory
-## is writable, then uncomment this:
-# \$wgDisableUploads = false;
+## is writable, then set this to true:
+\$wgEnableUploads = false;
\$wgUseImageResize = {$conf->UseImageResize};
{$magic}\$wgUseImageMagick = true;
{$magic}\$wgImageMagickConvertCommand = \"{$convert}\";
+## If you want to use image uploads under safe mode,
+## create the directories images/archive, images/thumb and
+## images/temp, and make them all writable. Then uncomment
+## this, if it's not already uncommented:
+{$hashedUploads}\$wgHashedUploadDirectory = false;
+
## If you have the appropriate support software installed
## you can enable inline LaTeX equations:
-# \$wgUseTeX = true;
+\$wgUseTeX = false;
\$wgMathPath = \"{\$wgUploadPath}/math\";
\$wgMathDirectory = \"{\$wgUploadDirectory}/math\";
\$wgTmpDirectory = \"{\$wgUploadDirectory}/tmp\";
@@ -885,13 +1262,12 @@ if ( \$wgCommandLineMode ) {
\$wgLocalInterwiki = \$wgSitename;
\$wgLanguageCode = \"{$slconf['LanguageCode']}\";
-\$wgUseLatin1 = " . ($conf->Latin1 ? 'true' : 'false') . ";\n
-\$wgProxyKey = \"$proxyKey\";
+\$wgProxyKey = \"$secretKey\";
## Default skin: you can change the default skin. Use the internal symbolic
## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':
-# \$wgDefaultSkin = 'monobook';
+\$wgDefaultSkin = 'monobook';
## For attaching licensing metadata to pages, and displaying an
## appropriate copyright notice / icon. GNU Free Documentation
@@ -902,7 +1278,17 @@ if ( \$wgCommandLineMode ) {
\$wgRightsText = \"{$slconf['RightsText']}\";
\$wgRightsIcon = \"{$slconf['RightsIcon']}\";
# \$wgRightsCode = \"{$slconf['RightsCode']}\"; # Not yet used
+
+\$wgDiff3 = \"{$slconf['diff3']}\";
+
+# When you make changes to this configuration file, this will make
+# sure that cached pages are cleared.
+\$configdate = gmdate( 'YmdHis', @filemtime( __FILE__ ) );
+\$wgCacheEpoch = max( \$wgCacheEpoch, \$configdate );
";
+ // Keep things in Unix line endings internally;
+ // the system will write out as local text type.
+ return str_replace( "\r\n", "\n", $localsettings );
}
function dieout( $text ) {
@@ -929,7 +1315,10 @@ function importRequest( $name, $default = "" ) {
return importVar( $_REQUEST, $name, $default );
}
-function aField( &$conf, $field, $text, $type = "", $value = "" ) {
+$radioCount = 0;
+
+function aField( &$conf, $field, $text, $type = "text", $value = "" ) {
+ global $radioCount;
if( $type != "" ) {
$xtype = "type=\"$type\"";
} else {
@@ -938,6 +1327,10 @@ function aField( &$conf, $field, $text, $type = "", $value = "" ) {
if(!(isset($id)) or ($id == "") ) $id = $field;
$nolabel = ($type == "radio") || ($type == "hidden");
+
+ if ($type == 'radio')
+ $id .= $radioCount++;
+
if( $nolabel ) {
echo "\t\t