* (bug 3782) Throw fatal installation warning if mbstring.func_overload on.
[lhc/web/wiklou.git] / config / index.php
index 9e3ea18..02375d6 100644 (file)
@@ -32,9 +32,13 @@ header( "Content-type: text/html; charset=utf-8" );
 
                @import "../skins/monobook/main.css"; 
 
-               .license {
-                       font-size: 85%;
-                       padding-top: 3em;
+               .env-check {
+                       font-size: 90%;
+                       margin: 1em 0 1em 2.5em;
+               }
+
+               .config-section {
+                       margin-top: 2em;
                }
 
                .config-section label.column {
@@ -79,7 +83,7 @@ header( "Content-type: text/html; charset=utf-8" );
                        font-size: 130%;
                        font-weight: bold;
                        padding: 1em 1.5em;
-                       float: left;
+                       margin: 2em 0 1em;
                }
 
                ul.plain {
@@ -90,10 +94,15 @@ header( "Content-type: text/html; charset=utf-8" );
                        padding: 0;
                }
 
-               h2 {
-                       border-bottom: 1px solid #aaa;
-                       margin-bottom: 1em;
-                       clear: left;
+               .btn-install {
+                       font-weight: bold;
+                       font-size: 110%;
+                       padding: .2em .3em;
+               }
+
+               .license {
+                       font-size: 85%;
+                       padding-top: 3em;
                }
 
        </style>
@@ -132,11 +141,9 @@ require_once( "includes/Namespace.php" );
 /* Check for existing configurations and bug out! */
 
 if( file_exists( "../LocalSettings.php" ) ) {
-       dieout( "<h2>Already configured</h2>
-
-       <p><strong>Setup has completed, <a href='../index.php'>your wiki</a> is configured.</strong></p>
+       dieout( "       <p><strong>Setup has completed, <a href='../index.php'>your wiki</a> is configured.</strong></p>
 
-       <p>Please delete the /config directory for extra security.</p>" );
+       <p>Please delete the /config directory for extra security.</p></div></div></div></div>" );
 }
 
 if( file_exists( "./LocalSettings.php" ) ) {
@@ -179,7 +186,7 @@ class ConfigData {
 
 <h2>Checking environment...</h2>
 <p><em>Please include all of the lines below when reporting installation problems.</em></p>
-<ul>
+<ul class="env-check">
 <?php
 $endl = "
 ";
@@ -188,15 +195,17 @@ $conf = new ConfigData;
 
 install_version_checks();
 
-print "<li>PHP " . phpversion() . ": ok</li>\n";
+print "<li>PHP " . phpversion() . " installed</li>\n";
 
 if( ini_get( "register_globals" ) ) {
        ?>
-       <li><b class='error'>Warning:</b> <strong>PHP's
-       <tt><a href="http://php.net/register_globals">register_globals</a></tt>
-       option is enabled.</strong> MediaWiki will work correctly, but this setting
-       increases your exposure to potential security vulnerabilities in PHP-based
-       software running on your server. <strong>You should disable it if you are able.</strong></li>
+       <li>
+               <div style="font-size:110%">
+               <strong class="error">Warning:</strong>
+               <strong>PHP's   <tt><a href="http://php.net/register_globals">register_globals</a></tt> option is enabled. Disable it if you can.</strong>
+               </div>
+               MediaWiki will work, but your server is more exposed to PHP-based security vulnerabilities.
+       </li>
        <?php
 }
 
@@ -218,6 +227,14 @@ if( ini_get( "magic_quotes_sybase" ) ) {
        <?php
 }
 
+if( ini_get( "mbstring.func_overload" ) ) {
+       $fatal = true;
+       ?><li class='error'><strong>Fatal: <a href='http://www.php.net/manual/en/ref.mbstring.php#mbstring.overload'>mbstring.func_overload</a> is active!</strong>
+       This option causes errors and may corrupt data unpredictably;
+       you cannot install or use MediaWiki unless this option is disabled.
+       <?php
+}
+
 if( $fatal ) {
        dieout( "</ul><p>Cannot install Mediawiki.</p>" );
 }
@@ -307,8 +324,8 @@ if (!$conf->turck && !$conf->eaccel) {
 }
 
 $conf->diff3 = false;
-$diff3locations = array("/usr/bin", "/opt/csw/bin", "/usr/gnu/bin", "/usr/sfw/bin") + explode(":", getenv("PATH"));
-$diff3names = array("gdiff3", "diff3");
+$diff3locations = array("/usr/bin", "/opt/csw/bin", "/usr/gnu/bin", "/usr/sfw/bin") + explode($sep, getenv("PATH"));
+$diff3names = array("gdiff3", "diff3", "diff3.exe");
 
 $diff3versioninfo = array('$1 --version 2>&1', 'diff3 (GNU diffutils)');
 foreach ($diff3locations as $loc) {
@@ -358,7 +375,7 @@ print "<li>Installation directory: <tt>" . htmlspecialchars( $conf->IP ) . "</tt
 $conf->ScriptPath = preg_replace( '{^(.*)/config.*$}', '$1', $_SERVER["PHP_SELF"] ); # was SCRIPT_NAME
 print "<li>Script URI path: <tt>" . htmlspecialchars( $conf->ScriptPath ) . "</tt></li>\n";
 
-print "<li style='font-weight:bold;color:green'>Environment checked. You can install MediaWiki.</li>\n";
+print "<li style='font-weight:bold;color:green;font-size:110%'>Environment checked. You can install MediaWiki.</li>\n";
        $conf->posted = ($_SERVER["REQUEST_METHOD"] == "POST");
 
        $conf->Sitename = ucfirst( importPost( "Sitename", "" ) );
@@ -373,9 +390,10 @@ print "<li style='font-weight:bold;color:green'>Environment checked. You can ins
        $conf->DBpassword = importPost( "DBpassword" );
        $conf->DBpassword2 = importPost( "DBpassword2" );
        $conf->DBprefix = importPost( "DBprefix" );
+       $conf->DBmysql5 = (importPost( "DBmysql5" ) == "true") ? "true" : "false";
        $conf->RootPW = importPost( "RootPW" );
        $conf->LanguageCode = importPost( "LanguageCode", "en" );
-       $conf->SysopName = importPost( "SysopName", "WikiAdmin" );
+       $conf->SysopName = importPost( "SysopName", "WikiSysop" );
        $conf->SysopPass = importPost( "SysopPass" );
        $conf->SysopPass2 = importPost( "SysopPass2" );
 
@@ -383,7 +401,7 @@ print "<li style='font-weight:bold;color:green'>Environment checked. You can ins
 $errs = array();
 
 if( $conf->Sitename == "" || $conf->Sitename == "MediaWiki" || $conf->Sitename == "Mediawiki" ) {
-       $errs["Sitename"] = "Must not be blank or \"MediaWiki\".";
+       $errs["Sitename"] = "Must not be blank or \"MediaWiki\"";
 }
 if( $conf->DBuser == "" ) {
        $errs["DBuser"] = "Must not be blank";
@@ -561,6 +579,14 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
                                <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'
                                >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b>";
                }
+               if( $wgDBmysql5 ) {
+                       if( $mysqlNewAuth ) {
+                               print "; enabling MySQL 4.1/5.0 charset mode";
+                       } else {
+                               print "; <b class='error'>MySQL 4.1/5.0 charset mode enabled,
+                                       but older version detected; will likely fail.</b>";
+                       }
+               }
                print "</li>\n";
 
                if ($conf->DBtype == 'mysql') {
@@ -618,7 +644,13 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
                        # FIXME: Check for errors
                        print "<li>Creating tables...";
                        if ($conf->DBtype == 'mysql') {
-                               dbsource( "../maintenance/tables.sql", $wgDatabase );
+                               if( $wgDBmysql5 ) {
+                                       print " using MySQL 5 table defs...";
+                                       dbsource( "../maintenance/mysql5/tables.sql", $wgDatabase );
+                               } else {
+                                       print " using MySQL 4 table defs...";
+                                       dbsource( "../maintenance/tables.sql", $wgDatabase );
+                               }
                                dbsource( "../maintenance/interwiki.sql", $wgDatabase );
                        } else {
                                dbsource( "../maintenance/oracle/tables.sql", $wgDatabase );
@@ -727,15 +759,12 @@ if( count( $errs ) ) {
 <div class="config-section">
        <div class="config-input">
                <?php
-               aField( $conf, "Sitename", "Site name:" );
+               aField( $conf, "Sitename", "Wiki name:" );
                ?>
        </div>
        <p class="config-desc">
-               Your site name should be a relatively short word. It'll appear as the namespace
-               name for 'meta' pages as well as throughout the user interface. Good site names
-               are things like "<a href="http://www.wikipedia.org/">Wikipedia</a>" and
-               "<a href="http://openfacts.berlios.de/">OpenFacts</a>"; avoid punctuation,
-               which may cause problems.
+               Preferably a short word without punctuation, i.e. "Wikipedia".<br>
+               Will appear as the namespace name for "meta" pages, and throughout the interface.
        </p>
 
        <div class="config-input">
@@ -744,10 +773,7 @@ if( count( $errs ) ) {
                ?>
        </div>
        <p class="config-desc">
-               This will be used as the return address for password reminders and
-               may be displayed in some error conditions so visitors can get in
-               touch with you. It is also be used as the default sender address of e-mail
-               notifications (enotifs).
+               Displayed to users in some error messages, used as the return address for password reminders, and used as the default sender address of e-mail notifications.
        </p>
 
        <div class="config-input">
@@ -764,19 +790,17 @@ if( count( $errs ) ) {
                </select>
        </div>
        <p class="config-desc">
-               You may select the language for the user interface of the wiki...
-               Some localizations are less complete than others. Unicode (UTF-8 encoding)
-               is used for all localizations.
+               Select the language for your wiki's interface. Some localizations aren't fully complete. Unicode (UTF-8) used for all localizations.
        </p>
 
        <div class="config-input">
                <label class='column'>Copyright/license:</label>
 
                <ul class="plain">
-               <li><?php aField( $conf, "License", "no license metadata", "radio", "none" ); ?></li>
+               <li><?php aField( $conf, "License", "No license metadata", "radio", "none" ); ?></li>
                <li><?php aField( $conf, "License", "GNU Free Documentation License 1.2 (Wikipedia-compatible)", "radio", "gfdl" ); ?></li>
                <li><?php
-                       aField( $conf, "License", "a Creative Commons license...", "radio", "cc" );
+                       aField( $conf, "License", "A Creative Commons license - ", "radio", "cc" );
                        $partner = "MediaWiki";
                        $exit = urlencode( "$wgServer{$conf->ScriptPath}/config/index.php?License=cc&RightsUrl=[license_url]&RightsText=[license_name]&RightsCode=[license_code]&RightsIcon=[license_button]" );
                        $icon = urlencode( "$wgServer$wgUploadPath/wiki.png" );
@@ -795,10 +819,7 @@ if( count( $errs ) ) {
                </ul>
        </div>
        <p class="config-desc">
-               MediaWiki can include a basic license notice, icon, and machine-readable
-               copyright metadata if your wiki's content is to be licensed under
-               the GNU FDL or a Creative Commons license. If you're not sure, leave
-               it at "none".
+               A notice, icon, and machine-readable copyright metadata will be displayed for the license you pick.
        </p>
 
 
@@ -806,23 +827,21 @@ if( count( $errs ) ) {
                <?php aField( $conf, "SysopName", "Admin username:" ) ?>
        </div>
        <div class="config-input">
-               <?php aField( $conf, "SysopPass", "password:", "password" ) ?>
+               <?php aField( $conf, "SysopPass", "Password:", "password" ) ?>
        </div>
        <div class="config-input">
-               <?php aField( $conf, "SysopPass2", "again:", "password" ) ?>
+               <?php aField( $conf, "SysopPass2", "Password confirm:", "password" ) ?>
        </div>
        <p class="config-desc">
-               An admin user account can lock or delete pages, block problematic IP
-               addresses from editing, and other maintenance tasks. If creating a new
-               wiki database, an admin account will be created with the given name
-               and password.
+               An admin can lock/delete pages, block users from editing, and other maintenance tasks.<br>
+               A new account will be added only when creating a new wiki database.
        </p>
 
        <div class="config-input">
                <label class='column'>Shared memory caching:</label>
 
                <ul class="plain">
-               <li><?php aField( $conf, "Shm", "no caching", "radio", "none" ); ?></li>
+               <li><?php aField( $conf, "Shm", "No caching", "radio", "none" ); ?></li>
                <?php
                        if ( $conf->turck ) {
                                echo "<li>";
@@ -855,8 +874,8 @@ if( count( $errs ) ) {
        <div class="config-input">
                <label class='column'>E-mail (general):</label>
                <ul class="plain">
-               <li><?php aField( $conf, "Email", "enabled", "radio", "email_enabled" ); ?></li>
-               <li><?php aField( $conf, "Email", "disabled", "radio", "email_disabled" ); ?></li>
+               <li><?php aField( $conf, "Email", "Enabled", "radio", "email_enabled" ); ?></li>
+               <li><?php aField( $conf, "Email", "Disabled", "radio", "email_disabled" ); ?></li>
                </ul>
        </div>
        <p class="config-desc">
@@ -866,8 +885,8 @@ if( count( $errs ) ) {
        <div class="config-input">
                <label class='column'>User-to-user e-mail:</label>
                <ul class="plain">
-               <li><?php aField( $conf, "Emailuser", "enabled", "radio", "emailuser_enabled" ); ?></li>
-               <li><?php aField( $conf, "Emailuser", "disabled", "radio", "emailuser_disabled" ); ?></li>
+               <li><?php aField( $conf, "Emailuser", "Enabled", "radio", "emailuser_enabled" ); ?></li>
+               <li><?php aField( $conf, "Emailuser", "Disabled", "radio", "emailuser_disabled" ); ?></li>
                </ul>
        </div>
        <p class="config-desc">
@@ -876,9 +895,9 @@ if( count( $errs ) ) {
        <div class="config-input">
                <label class='column'>E-mail notification:</label>
                <ul class="plain">
-               <li><?php aField( $conf, "Enotif", "disabled", "radio", "enotif_disabled" ); ?></li>
-               <li><?php aField( $conf, "Enotif", "enabled for changes of watch-listed and user_talk pages (recommended for small wikis; perhaps not suited for large wikis)", "radio", "enotif_allpages" ); ?></li>
-               <li><?php aField( $conf, "Enotif", "enabled for changes of user_talk pages only (suited for small and large wikis)", "radio", "enotif_usertalk" ); ?></li>
+               <li><?php aField( $conf, "Enotif", "Disabled", "radio", "enotif_disabled" ); ?></li>
+               <li><?php aField( $conf, "Enotif", "Enabled for user_talk changes only", "radio", "enotif_usertalk" ); ?></li>
+               <li><?php aField( $conf, "Enotif", "Enabled for user_talk and watch list changes (not recommended for large wikis)", "radio", "enotif_allpages" ); ?></li>
                </ul>
        </div>
        <div class="config-desc">
@@ -897,8 +916,8 @@ if( count( $errs ) ) {
        <div class="config-input">
                <label class='column'>E-mail authentication:</label>
                <ul class="plain">
-               <li><?php aField( $conf, "Eauthent", "disabled", "radio", "eauthent_disabled" ); ?></li>
-               <li><?php aField( $conf, "Eauthent", "enabled", "radio", "eauthent_enabled" ); ?></li>
+               <li><?php aField( $conf, "Eauthent", "Disabled", "radio", "eauthent_disabled" ); ?></li>
+               <li><?php aField( $conf, "Eauthent", "Enabled", "radio", "eauthent_enabled" ); ?></li>
                </ul>
        </div>
        <div class="config-desc">
@@ -946,7 +965,7 @@ if( count( $errs ) ) {
                aField( $conf, "DBpassword", "DB password:", "password" );
        ?></div>
        <div class="config-input"><?php
-               aField( $conf, "DBpassword2", "again:", "password" );
+               aField( $conf, "DBpassword2", "DB password confirm:", "password" );
        ?></div>
        <p class="config-desc">
                If you only have a single user account and database available,
@@ -964,6 +983,20 @@ if( count( $errs ) ) {
 
                <p>Avoid exotic characters; something like <tt>mw_</tt> is good.</p>
        </div>
+       
+       <div class="config-input"><label class="column">Database charset</label>
+               <div>Select one:</div>
+               <ul class="plain">
+               <li><?php aField( $conf, "DBmysql5", "Backwards-compatible UTF-8", "radio", "false" ); ?></li>
+               <li><?php aField( $conf, "DBmysql5", "Experimental MySQL 4.1/5.0 UTF-8", "radio", "true" ); ?></li>
+               </ul>
+       </div>
+       <p class="config-desc">
+               <b>EXPERIMENTAL:</b> You can enable explicit Unicode charset support
+               for MySQL 4.1 and 5.0 servers. This is not well tested and may
+               cause things to break. <b>If upgrading an older installation, leave
+               in backwards-compatible mode.</b>
+       </p>
 
        <div class="config-input">
                <?php
@@ -980,7 +1013,7 @@ if( count( $errs ) ) {
 
        <div class="config-input" style="padding:2em 0 3em">
                <label class='column'>&nbsp;</label>
-               <input type="submit" value="Install MediaWiki!" style="font-weight: bold; font-size: 110%; padding: .2em .5em;" />
+               <input type="submit" value="Install MediaWiki!" class="btn-install" />
        </div>
 
 </div>
@@ -1162,6 +1195,9 @@ if ( \$wgCommandLineMode ) {
 \$wgDBprefix         = \"{$slconf['DBprefix']}\";
 \$wgDBtype           = \"{$slconf['DBtype']}\";
 
+# Experimental charset support for MySQL 4.1/5.0.
+\$wgDBmysql5 = {$conf->DBmysql5};
+
 ## Shared memory settings
 \$wgMainCacheType = $cacheType;
 \$wgMemCachedServers = $mcservers;
@@ -1316,13 +1352,14 @@ function locate_executable($loc, $names, $versioninfo = false) {
                $names = array($names);
 
        foreach ($names as $name) {
-               if (file_exists("$loc/$name")) {
+               $command = "$loc".DIRECTORY_SEPARATOR."$name";
+               if (file_exists($command)) {
                        if (!$versioninfo)
-                               return "$loc/$name";
+                               return $command;
 
-                       $file = str_replace('$1', "$loc/$name", $versioninfo[0]);
+                       $file = str_replace('$1', $command, $versioninfo[0]);
                        if (strstr(`$file`, $versioninfo[1]) !== false)
-                               return "$loc/$name";
+                               return $command;
                }
        }
        return false;
@@ -1406,18 +1443,20 @@ function testMemcachedServer( $server ) {
 <div id="column-one">
        <div class="portlet" id="p-logo">
          <a style="background-image: url(../skins/common/images/mediawiki.png);"
-           href="/phase3/index.php/Main_Page"
+           href="http://www.mediawiki.org/"
            title="Main Page"></a>
        </div>
        <script type="text/javascript"> if (window.isMSIE55) fixalpha(); </script>
        <div class='portlet'><div class='pBody'>
-               <p style="font-size:90%"><strong><a href="http://www.mediawiki.org/">MediaWiki</a></strong> is Copyright (C) 2001-2005 by Magnus Manske, Brion Vibber, Lee Daniel Crocker, Tim Starling, Erik M&ouml;ller, Gabriel Wicke and others.</p>
                <ul>
+                       <li><strong><a href="http://www.mediawiki.org/">MediaWiki home</a></strong></li>
                        <li><a href="../README">Readme</a></li>
                        <li><a href="../RELEASE-NOTES">Release notes</a></li>
-                       <li><a href="../docs/">doc/</a></li>
+                       <li><a href="../docs/">Documentation</a></li>
                        <li><a href="http://meta.wikipedia.org/wiki/MediaWiki_User's_Guide">User's Guide</a></li>
+                       <li><a href="http://meta.wikimedia.org/wiki/MediaWiki_FAQ">FAQ</a></li>
                </ul>
+               <p style="font-size:90%;margin-top:1em">MediaWiki is Copyright &copy; 2001-2005 by Magnus Manske, Brion Vibber, Lee Daniel Crocker, Tim Starling, Erik M&ouml;ller, Gabriel Wicke and others.</p>
        </div></div>
 </div>