Fixed PreferencesForm::validateDate().
[lhc/web/wiklou.git] / img_auth.php
index 6f6152e..4917fe5 100644 (file)
@@ -1,19 +1,15 @@
 <?php
 /**
  * Image download authorisation script
- * 
+ *
  * To use, in LocalSettings.php set $wgUploadDirectory to point to a non-public
  * directory, and $wgUploadPath to point to this file. Also set $wgWhitelistRead
  * to an array of pages you want everyone to be able to access. Your server must
- * support PATH_INFO, CGI-based configurations generally don't. 
+ * support PATH_INFO, CGI-based configurations generally don't.
  */
-# Valid web server entry point, enable includes
-define( 'MEDIAWIKI', true );
-
-require_once( 'includes/Defines.php' );
-require_once( './LocalSettings.php' );
-require_once( 'includes/Setup.php' );
-require_once( 'includes/StreamFile.php' );
+require_once( './includes/WebStart.php' );
+wfProfileIn( 'img_auth.php' );
+require_once( './includes/StreamFile.php' );
 
 if( !isset( $_SERVER['PATH_INFO'] ) ) {
        wfForbidden();
@@ -22,7 +18,7 @@ if( !isset( $_SERVER['PATH_INFO'] ) ) {
 # Get filenames/directories
 $filename = realpath( $wgUploadDirectory . $_SERVER['PATH_INFO'] );
 $realUploadDirectory = realpath( $wgUploadDirectory );
-$imageName = $wgLang->getNsText( NS_IMAGE ) . ":" . basename( $_SERVER['PATH_INFO'] );
+$imageName = $wgContLang->getNsText( NS_IMAGE ) . ":" . basename( $_SERVER['PATH_INFO'] );
 
 # Check if the filename is in the correct directory
 if ( substr( $filename, 0, strlen( $realUploadDirectory ) ) != $realUploadDirectory ) {
@@ -42,14 +38,16 @@ if( is_dir( $filename ) ) {
 
 # Write file
 wfStreamFile( $filename );
+wfLogProfilingData();
 
 function wfForbidden() {
        header( 'HTTP/1.0 403 Forbidden' );
-       print 
+       print
 "<html><body>
 <h1>Access denied</h1>
 <p>You need to log in to access files on this server</p>
 </body></html>";
+       wfLogProfilingData();
        exit;
 }