summaryrefslogtreecommitdiff
path: root/includes/templates/NoLocalSettings.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
committerPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
commitb9b85843572bf283f48285001e276ba7e61b63f6 (patch)
tree4c6f4571552ada9ccfb4030481dcf77308f8b254 /includes/templates/NoLocalSettings.php
parentd9a20acc4e789cca747ad360d87ee3f3e7aa58c1 (diff)
updated to MediaWiki 1.14.0
Diffstat (limited to 'includes/templates/NoLocalSettings.php')
-rw-r--r--includes/templates/NoLocalSettings.php29
1 files changed, 24 insertions, 5 deletions
diff --git a/includes/templates/NoLocalSettings.php b/includes/templates/NoLocalSettings.php
index 75a7e95a..5f7e93c7 100644
--- a/includes/templates/NoLocalSettings.php
+++ b/includes/templates/NoLocalSettings.php
@@ -10,12 +10,31 @@ if ( isset( $wgVersion ) ) {
} else {
$wgVersion = 'VERSION';
}
-# Set the path in case we hit a page such as /index.php/Main_Page
-# Could use <base href> but then we have to worry about http[s]/port #/etc.
-$ext = strpos( $_SERVER['SCRIPT_NAME'], 'index.php5' ) === false ? 'php' : 'php5';
+
+$scriptName = $_SERVER['SCRIPT_NAME'];
+$ext = substr( $scriptName, strrpos( $scriptName, "." ) + 1 );
$path = '';
-if( isset( $_SERVER['SCRIPT_NAME'] )) {
- $path = htmlspecialchars( preg_replace('/index.php5?/', '', $_SERVER['SCRIPT_NAME']) );
+# Add any directories in the main folder that could contain an entrypoint (even possibly).
+# We cannot just do a dir listing here, as we do not know where it is yet
+# These must not also be the names of subfolders that may contain an entrypoint
+$topdirs = array( 'extensions', 'includes' );
+foreach( $topdirs as $dir ){
+ # Check whether a directory by this name is in the path
+ if( strrpos( $scriptName, "/" . $dir . "/" ) ){
+ # If so, check whether it is the right folder
+ # First, get the number of directories up it is (to generate path)
+ $numToGoUp = substr_count( substr( $scriptName, strrpos( $scriptName, "/" . $dir . "/" ) + 1 ), "/" );
+ # And generate the path using ..'s
+ for( $i = 0; $i < $numToGoUp; $i++ ){
+ $realPath = "../" . $realPath;
+ }
+ # Checking existance (using the image here as it is something not likely to change, and to always be here)
+ if( file_exists( $realPath . "skins/common/images/mediawiki.png" ) ) {
+ # If so, get the path that we can use in this file, and stop looking
+ $path = substr( $scriptName, 0, strrpos( $scriptName, "/" . $dir . "/" ) + 1 );
+ break;
+ }
+ }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">