X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=img_auth.php;h=885914171c2e2b7a16e3aa367affe864044e6bfa;hb=941f88d4c83bfdb9f1389e81ed35e8d91da8df9c;hp=6f449c687791bf73c97a46f86b7ea558be3249d5;hpb=348a0bead146d133b3773e1b34bc30e524b6c1bb;p=lhc%2Fweb%2Fwiklou.git diff --git a/img_auth.php b/img_auth.php index 6f449c6877..885914171c 100644 --- a/img_auth.php +++ b/img_auth.php @@ -39,7 +39,6 @@ define( 'MW_NO_OUTPUT_COMPRESSION', 1 ); require __DIR__ . '/includes/WebStart.php'; -wfProfileIn( 'img_auth.php' ); # Set action base paths so that WebRequest::getPathInfo() # recognizes the "X" as the 'title' in ../img_auth.php/X urls. @@ -47,11 +46,9 @@ $wgArticlePath = false; # Don't let a "/*" article path clober our action path $wgActionPaths = array( "$wgUploadPath/" ); wfImageAuthMain(); -wfLogProfilingData(); -// Commit and close up! -$factory = wfGetLBFactory(); -$factory->commitMasterChanges(); -$factory->shutdown(); + +$mediawiki = new MediaWiki(); +$mediawiki->doPostOutputShutdown( 'fast' ); function wfImageAuthMain() { global $wgImgAuthUrlPathMap; @@ -114,7 +111,7 @@ function wfImageAuthMain() { // be under a folder that has the source file name. if ( $zone === 'thumb' || $zone === 'transcoded' ) { $name = wfBaseName( dirname( $path ) ); - $filename = $repo->getZonePath( $zone ) . substr( $path, strlen( "/".$zone ) ); + $filename = $repo->getZonePath( $zone ) . substr( $path, strlen( "/" . $zone ) ); // Check to see if the file exists if ( !$repo->fileExists( $filename ) ) { wfForbidden( 'img-auth-accessdenied', 'img-auth-nofile', $filename ); @@ -152,7 +149,7 @@ function wfImageAuthMain() { // Run hook for extension authorization plugins /** @var $result array */ $result = null; - if ( !wfRunHooks( 'ImgAuthBeforeStream', array( &$title, &$path, &$name, &$result ) ) ) { + if ( !Hooks::run( 'ImgAuthBeforeStream', array( &$title, &$path, &$name, &$result ) ) ) { wfForbidden( $result[0], $result[1], array_slice( $result, 2 ) ); return; } @@ -198,11 +195,16 @@ function wfForbidden( $msg1, $msg2 ) { wfMessage( $msg2, $args )->inLanguage( 'en' )->text() ); - header( 'HTTP/1.0 403 Forbidden' ); + HttpStatus::header( 403 ); header( 'Cache-Control: no-cache' ); header( 'Content-Type: text/html; charset=utf-8' ); echo << + + +$msgHdr +

$msgHdr

$detailMsg