From d11bdf29ca7bc32200cc439b88ccbbacf89630f3 Mon Sep 17 00:00:00 2001
From: Brion Vibber 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 progarm 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 Already configured... return to the wiki. (You should probably remove this directory for added security.) 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.)
+
+
+
+ MediaWiki installation
+
+
+Wiki is configured.
+
+ You're configured!
+
+ Checking environment...
+
+PHP " . phpversion() . " ok\n";
+
+/*
+$conf->zlib = function_exists( "gzencode" );
+$z = $conf->zlib ? "Have" : "No";
+print "
+
+
+Sitename = ucfirst( importPost( "Sitename", "" ) );
+ $conf->EmergencyContact = importPost( "EmergencyContact", $_SERVER["SERVER_ADMIN"] );
+ $conf->DBserver = importPost( "DBserver", "localhost" );
+ $conf->DBname = importPost( "DBname", "wikidb" );
+ $conf->DBuser = importPost( "DBuser", "wikiuser" );
+ $conf->DBpassword = importPost( "DBpassword" );
+ $conf->DBpassword2 = importPost( "DBpassword2" );
+ $conf->RootPW = importPost( "RootPW" );
+ $conf->LanguageCode = importPost( "LanguageCode", "en-utf8" );
+
+/* Check for validity */
+$errs = array();
+
+if( $conf->Sitename == "" || $conf->Sitename == "MediaWiki" || $conf->Sitename == "Mediawiki" ) {
+ $errs["Sitename"] = "Must not be blank or \"MediaWiki\".";
+}
+if( $conf->DBpassword == "" ) {
+ $errs["DBpassword"] = "Must not be blank";
+}
+if( $conf->DBpassword != $conf->DBpassword2 ) {
+ $errs["DBpassword2"] = "Passwords don't match!";
+}
+
+if( count( $errs ) ) {
+ /* Display options form */
+?>
+Database config
+
+
+
+Creating LocalSettings.php...
Success! Move the LocalSettings.php file into the parent directory, then follow + this link to your wiki.
\n"; +} + +/* -------------------------------------------------------------------------------------- */ + +function writeAdminSettings( $conf ) { + return "<" . "?php +\$wgDBadminuser = \"{$conf->DBadminuser}\"; +\$wgDBadminpassword = \"{$conf->DBadminpassword}\"; +?" . ">"; +} + +function writeLocalSettings( $conf ) { + $conf->DBmysql4 = $conf->DBmysql4 ? 'true' : 'false'; + $conf->UseImageResize = $conf->UseImageResize ? 'true' : 'false'; + $conf->DBsqluser = $conf->DBuser; + $conf->DBsqlpassword = $conf->DBpassword; + $conf->PasswordSender = $conf->EmergencyContact; + if( $conf->LanguageCode == "en-utf8" ) { + $conf->LanguageCode = "en"; + $conf->Encoding = "UTF-8"; + } + return "<" . "?php +# This file was automatically generated. Don't touch unless you +# know what you're doing; see LocalSettings.sample for an edit- +# friendly file. + +\$IP = \"{$conf->IP}\"; +ini_set( \"include_path\", ini_get(\"include_path\") . \":\$IP/includes:\$IP/languages\" ); +include_once( \"includes/DefaultSettings.php\" ); + +if( \$wgCommandLineMode ) { + die( \"Can't use command-line utils with in-place install yet, sorry.\" ); +} + +\$wgSitename = \"{$conf->Sitename}\"; + +\$wgScriptPath = \"{$conf->ScriptPath}\"; +\$wgScript = \"\$wgScriptPath/index.php\"; +\$wgRedirectScript = \"\$wgScriptPath/redirect.php\"; + +\$wgArticlePath = \"\$wgScript?title=\$1\"; +# \$wgArticlePath = \"\$wgScript/\$1\"; # Prettier if you're setup for it + +\$wgStyleSheetPath = \"\$wgScriptPath/stylesheets\"; +\$wgStyleSheetDirectory = \"\$IP/stylesheets\"; + +\$wgUploadPath = \"\$wgScriptPath/images\"; +\$wgUploadDirectory = \"\$IP/images\"; +\$wgLogo = \"\$wgUploadPath/wiki.png\"; + +\$wgEmergencyContact = \"{$conf->EmergencyContact}\"; +\$wgPasswordSender = \"{$conf->PasswordSender}\"; + +\$wgDBserver = \"{$conf->DBserver}\"; +\$wgDBname = \"{$conf->DBname}\"; +\$wgDBuser = \"{$conf->DBuser}\"; +\$wgDBpassword = \"{$conf->DBpassword}\"; +\$wgDBsqluser = \"{$conf->DBsqluser}\"; +\$wgDBsqlpassword = \"{$conf->DBsqlpassword}\"; + +\$wgDBmysql4 = \$wgEnablePersistentLC = {$conf->DBmysql4}; + +\$wgUseImageResize = {$conf->UseImageResize}; + +## If you have the appropriate support software installed +## you can enable inline LaTeX equations: +# \$wgUseTeX = true; +# \$wgMathPath = \"{$wgUploadPath}/math\"; +# \$wgMathDirectory = \"{$wgUploadDirectory}/math\"; +# \$wgTmpDirectory = \"{$wgUploadDirectory}/tmp\"; + +\$wgLocalInterwiki = \$wgSitename; + +\$wgLanguageCode = \"{$conf->LanguageCode}\"; +" . ($conf->Encoding ? "\$wgInputEncoding = \$wgOutputEncoding = \"{$conf->Encoding}\";" : "" ) . " + +?" . ">"; +} + +function dieout( $text ) { + die( $text . "\n\n\n" ); +} + +function importPost( $name, $default = "" ) { + if( isset( $_POST[$name] ) ) { + return $_POST[$name]; + } else { + return $default; + } +} + +function aField( &$conf, $field, $text, $type = "" ) { + if( $type != "" ) $type = "type=\"$type\""; + echo "\t\t\n"; + echo "\t\t$field ); + echo "\" />\n"; + + global $errs; + if(isset($errs[$field])) echo "" . $errs[$field] . "\n"; +} + +function getLanguageList() { + $wgLanguageCode = "xxx"; + function wfLocalUrl( $x ) { return $x; } + function wfLocalUrlE( $x ) { return $x; } + include( "../languages/Language.php" ); + + $codes = array(); + $latin1 = array( "da", "de", "en", "es", "fr", "nl", "sv" ); + + $d = opendir( "../languages" ); + while( false !== ($f = readdir( $d ) ) ) { + if( preg_match( '/Language([A-Z][a-z]+)\.php$/', $f, $m ) ) { + $code = strtolower( $m[1] ); + $codes[$code] = "$code - " . $wgLanguageNames[$code]; + if( in_array( $code, $latin1 ) ) { + $codes[$code] .= " - Latin-1"; + } + } + } + $codes["en-utf8"] = "en - English - Unicode"; + closedir( $d ); + ksort( $codes ); + return $codes; +} + +?> +