]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - includes/templates/NoLocalSettings.php
MediaWiki 1.16.0
[autoinstallsdev/mediawiki.git] / includes / templates / NoLocalSettings.php
1 <?php
2 /**
3  * @file
4  * @ingroup Templates
5  */
6
7 if ( !isset( $wgVersion ) ) {
8         $wgVersion = 'VERSION';
9 }
10
11 $scriptName = $_SERVER['SCRIPT_NAME'];
12 $ext = substr( $scriptName, strrpos( $scriptName, "." ) + 1 );
13 $path = '';
14 # Add any directories in the main folder that could contain an entrypoint (even possibly).
15 # We cannot just do a dir listing here, as we do not know where it is yet
16 # These must not also be the names of subfolders that may contain an entrypoint
17 $topdirs = array( 'extensions', 'includes' );
18 foreach( $topdirs as $dir ){
19         # Check whether a directory by this name is in the path
20         if( strrpos( $scriptName, "/" . $dir . "/" ) ){
21                 # If so, check whether it is the right folder
22                 # First, get the number of directories up it is (to generate path)
23                 $numToGoUp = substr_count( substr( $scriptName, strrpos( $scriptName, "/" . $dir . "/" ) + 1 ), "/" );
24                 # And generate the path using ..'s
25                 for( $i = 0; $i < $numToGoUp; $i++ ){
26                         $realPath = "../" . $realPath;
27                 }
28                 # Checking existance (using the image here as it is something not likely to change, and to always be here)
29                 if( file_exists( $realPath . "skins/common/images/mediawiki.png" ) ) {
30                         # If so, get the path that we can use in this file, and stop looking
31                         $path = substr( $scriptName, 0, strrpos( $scriptName, "/" . $dir . "/" ) + 1 );
32                         break;
33                 }
34         }
35 }
36 ?>
37 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
38 <html xmlns='http://www.w3.org/1999/xhtml' lang='en'>
39         <head>
40                 <title>MediaWiki <?php echo htmlspecialchars( $wgVersion ) ?></title>
41                 <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
42                 <style type='text/css' media='screen'>
43                         html, body {
44                                 color: #000;
45                                 background-color: #fff;
46                                 font-family: sans-serif;
47                                 text-align: center;
48                         }
49
50                         h1 {
51                                 font-size: 150%;
52                         }
53                 </style>
54         </head>
55         <body>
56                 <img src="<?php echo htmlspecialchars( $path ) ?>skins/common/images/mediawiki.png" alt='The MediaWiki logo' />
57
58                 <h1>MediaWiki <?php echo htmlspecialchars( $wgVersion ) ?></h1>
59                 <div class='error'>
60                 <?php
61                 if ( file_exists( 'config/LocalSettings.php' ) ) {
62                         echo( 'To complete the installation, move <tt>config/LocalSettings.php</tt> to the parent directory.' );
63                 } else {
64                         echo( "Please <a href=\"" . htmlspecialchars( $path ) . "config/index." . htmlspecialchars( $ext ) . "\" title='setup'> set up the wiki</a> first." );
65                 }
66                 ?>
67
68                 </div>
69         </body>
70 </html>