-ini_set( 'display_errors', 1 );
-error_reporting( E_ALL );
-
-if ( isset( $_SERVER["SCRIPT_FILENAME"] ) ) {
- # Known resource, sometimes a script sometimes a file
- $file = $_SERVER["SCRIPT_FILENAME"];
-} elseif ( isset( $_SERVER["SCRIPT_NAME"] ) ) {
- # Usually unknown, document root relative rather than absolute
- # Happens with some cases like /wiki/File:Image.png
- if ( is_readable( $_SERVER['DOCUMENT_ROOT'] . $_SERVER["SCRIPT_NAME"] ) ) {
- # Just in case this actually IS a file, set it here
- $file = $_SERVER['DOCUMENT_ROOT'] . $_SERVER["SCRIPT_NAME"];
- } else {
- # Otherwise let's pretend that this is supposed to go to index.php
- $file = $_SERVER['DOCUMENT_ROOT'] . '/index.php';
- }
-} else {
- # Meh, we'll just give up