For unknown sort to bydate
[lhc/web/wiklou.git] / config / index.php
index 264f170..f72d4dc 100644 (file)
@@ -189,7 +189,27 @@ $wgConfiguring = true;
 $conf = new ConfigData;
 
 install_version_checks();
-print "<li>PHP " . phpversion() . " ok</li>\n";
+
+print "<li>PHP " . phpversion() . ": ";
+if( version_compare( phpversion(), "5.0", "lt" ) ) {
+       print "ok";
+} else {
+       print " <b>the MonoBook skin will be disabled due to an incompatibility
+               between the PHPTAL template library and PHP 5</b>. The wiki should
+               function normally, but with the older look and feel.";
+}
+print "</li>\n";
+
+if( ini_get( "safe_mode" ) ) {
+       ?>
+       <li class='error'><b>Warning: PHP's
+       <a href='http://www.php.net/features.safe-mode'>safe mode</a> is active!</b>
+       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.</li>
+       <?php
+}
 
 $sapi = php_sapi_name();
 $conf->prettyURLs = true;
@@ -720,6 +740,18 @@ function writeAdminSettings( $conf ) {
 ";
 }
 
+function escapePhpString( $string ) {
+       return strtr( $string,
+               array(
+                       "\n" => "\\n",
+                       "\r" => "\\r",
+                       "\t" => "\\t",
+                       "\\" => "\\\\",
+                       "\$" => "\\\$",
+                       "\"" => "\\\""
+               ));
+}
+
 function writeLocalSettings( $conf ) {
        $conf->DBmysql4 = @$conf->DBmysql4 ? 'true' : 'false';
        $conf->UseImageResize = $conf->UseImageResize ? 'true' : 'false';
@@ -750,7 +782,7 @@ function writeLocalSettings( $conf ) {
        }
 
        # Add slashes to strings for double quoting
-       $slconf = array_map( "addslashes", get_object_vars( $conf ) );
+       $slconf = array_map( "escapePhpString", get_object_vars( $conf ) );
 
 
        $sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":";