2004-06-07 06:57:53 +00:00
|
|
|
<?php
|
2005-01-27 04:30:18 +00:00
|
|
|
/**
|
2020-02-04 21:44:38 +00:00
|
|
|
* The web entry point for serving non-public images to logged-in users.
|
2007-08-06 06:15:21 +00:00
|
|
|
*
|
2014-03-12 22:30:35 +00:00
|
|
|
* To use this, see https://www.mediawiki.org/wiki/Manual:Image_Authorization
|
2007-08-06 06:15:21 +00:00
|
|
|
*
|
2009-03-21 16:48:09 +00:00
|
|
|
* - Set $wgUploadDirectory to a non-public directory (not web accessible)
|
|
|
|
|
* - Set $wgUploadPath to point to this file
|
2006-01-07 13:09:30 +00:00
|
|
|
*
|
2009-09-10 21:12:55 +00:00
|
|
|
* Optional Parameters
|
|
|
|
|
*
|
2011-11-20 08:50:13 +00:00
|
|
|
* - Set $wgImgAuthDetails = true if you want the reason the access was denied messages to
|
|
|
|
|
* be displayed instead of just the 403 error (doesn't work on IE anyway),
|
|
|
|
|
* otherwise it will only appear in error logs
|
2009-09-10 21:12:55 +00:00
|
|
|
*
|
2011-11-20 08:50:13 +00:00
|
|
|
* For security reasons, you usually don't want your user to know *why* access was denied,
|
|
|
|
|
* just that it was. If you want to change this, you can set $wgImgAuthDetails to 'true'
|
|
|
|
|
* in localsettings.php and it will give the user the reason why access was denied.
|
2009-09-10 21:12:55 +00:00
|
|
|
*
|
2018-07-26 05:36:19 +00:00
|
|
|
* Your server needs to support REQUEST_URI or PATH_INFO; CGI-based
|
|
|
|
|
* configurations sometimes don't.
|
2009-03-21 16:48:09 +00:00
|
|
|
*
|
2012-05-23 11:41:30 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
2009-09-10 21:12:55 +00:00
|
|
|
*
|
2012-05-23 11:41:30 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
*
|
|
|
|
|
* @file
|
2020-02-04 21:44:38 +00:00
|
|
|
* @ingroup entrypoint
|
2012-05-23 11:41:30 +00:00
|
|
|
*/
|
2009-09-10 21:12:55 +00:00
|
|
|
|
2007-02-19 23:03:37 +00:00
|
|
|
define( 'MW_NO_OUTPUT_COMPRESSION', 1 );
|
2019-09-02 23:55:00 +00:00
|
|
|
define( 'MW_ENTRY_POINT', 'img_auth' );
|
2013-05-17 00:16:59 +00:00
|
|
|
require __DIR__ . '/includes/WebStart.php';
|
2004-06-07 06:57:53 +00:00
|
|
|
|
2011-11-20 08:50:13 +00:00
|
|
|
wfImageAuthMain();
|
2015-05-20 23:32:20 +00:00
|
|
|
|
|
|
|
|
$mediawiki = new MediaWiki();
|
2019-09-20 07:27:30 +00:00
|
|
|
$mediawiki->doPostOutputShutdown();
|
2011-02-01 23:08:10 +00:00
|
|
|
|
2011-11-20 08:50:13 +00:00
|
|
|
function wfImageAuthMain() {
|
2020-03-31 05:33:41 +00:00
|
|
|
global $wgImgAuthUrlPathMap, $wgScriptPath, $wgImgAuthPath;
|
2020-02-20 15:57:16 +00:00
|
|
|
|
|
|
|
|
$services = \MediaWiki\MediaWikiServices::getInstance();
|
|
|
|
|
$permissionManager = $services->getPermissionManager();
|
2014-04-20 23:52:08 +00:00
|
|
|
|
|
|
|
|
$request = RequestContext::getMain()->getRequest();
|
2022-11-13 21:17:11 +00:00
|
|
|
$publicWiki = $services->getGroupPermissionsLookup()->groupHasPermission( '*', 'read' );
|
2011-11-20 08:50:13 +00:00
|
|
|
|
2020-03-31 05:33:41 +00:00
|
|
|
// Find the path assuming the request URL is relative to the local public zone URL
|
|
|
|
|
$baseUrl = $services->getRepoGroup()->getLocalRepo()->getZoneUrl( 'public' );
|
|
|
|
|
if ( $baseUrl[0] === '/' ) {
|
|
|
|
|
$basePath = $baseUrl;
|
|
|
|
|
} else {
|
|
|
|
|
$basePath = parse_url( $baseUrl, PHP_URL_PATH );
|
|
|
|
|
}
|
|
|
|
|
$path = WebRequest::getRequestPathSuffix( $basePath );
|
|
|
|
|
|
|
|
|
|
if ( $path === false ) {
|
|
|
|
|
// Try instead assuming img_auth.php is the base path
|
|
|
|
|
$basePath = $wgImgAuthPath ?: "$wgScriptPath/img_auth.php";
|
|
|
|
|
$path = WebRequest::getRequestPathSuffix( $basePath );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( $path === false ) {
|
|
|
|
|
wfForbidden( 'img-auth-accessdenied', 'img-auth-notindir' );
|
2012-02-07 03:43:23 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2020-03-31 05:33:41 +00:00
|
|
|
|
|
|
|
|
if ( $path === '' || $path[0] !== '/' ) {
|
2011-11-24 09:55:33 +00:00
|
|
|
// Make sure $path has a leading /
|
|
|
|
|
$path = "/" . $path;
|
|
|
|
|
}
|
2011-11-20 08:50:13 +00:00
|
|
|
|
2019-06-03 10:48:02 +00:00
|
|
|
$user = RequestContext::getMain()->getUser();
|
|
|
|
|
|
2013-11-13 23:25:37 +00:00
|
|
|
// Various extensions may have their own backends that need access.
|
|
|
|
|
// Check if there is a special backend and storage base path for this file.
|
|
|
|
|
foreach ( $wgImgAuthUrlPathMap as $prefix => $storageDir ) {
|
|
|
|
|
$prefix = rtrim( $prefix, '/' ) . '/'; // implicit trailing slash
|
|
|
|
|
if ( strpos( $path, $prefix ) === 0 ) {
|
2020-02-20 15:57:16 +00:00
|
|
|
$be = $services->getFileBackendGroup()->backendFromPath( $storageDir );
|
2013-11-13 23:25:37 +00:00
|
|
|
$filename = $storageDir . substr( $path, strlen( $prefix ) ); // strip prefix
|
2014-03-15 08:59:41 +00:00
|
|
|
// Check basic user authorization
|
2020-02-20 15:57:16 +00:00
|
|
|
$isAllowedUser = $permissionManager->userHasRight( $user, 'read' );
|
|
|
|
|
if ( !$isAllowedUser ) {
|
2014-03-15 08:59:41 +00:00
|
|
|
wfForbidden( 'img-auth-accessdenied', 'img-auth-noread', $path );
|
|
|
|
|
return;
|
|
|
|
|
}
|
2016-02-17 09:09:32 +00:00
|
|
|
if ( $be->fileExists( [ 'src' => $filename ] ) ) {
|
2013-11-13 23:25:37 +00:00
|
|
|
wfDebugLog( 'img_auth', "Streaming `" . $filename . "`." );
|
2020-03-31 06:02:49 +00:00
|
|
|
$be->streamFile( [
|
|
|
|
|
'src' => $filename,
|
|
|
|
|
'headers' => [ 'Cache-Control: private', 'Vary: Cookie' ]
|
|
|
|
|
] );
|
2013-11-13 23:25:37 +00:00
|
|
|
} else {
|
2014-01-07 19:32:40 +00:00
|
|
|
wfForbidden( 'img-auth-accessdenied', 'img-auth-nofile', $path );
|
2013-11-13 23:25:37 +00:00
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-20 03:52:06 +00:00
|
|
|
// Get the local file repository
|
2020-02-20 15:57:16 +00:00
|
|
|
$repo = $services->getRepoGroup()->getRepo( 'local' );
|
2014-05-07 17:01:16 +00:00
|
|
|
$zone = strstr( ltrim( $path, '/' ), '/', true );
|
2011-11-20 08:50:13 +00:00
|
|
|
|
2011-12-20 03:52:06 +00:00
|
|
|
// Get the full file storage path and extract the source file name.
|
|
|
|
|
// (e.g. 120px-Foo.png => Foo.png or page2-120px-Foo.png => Foo.png).
|
2014-05-07 17:01:16 +00:00
|
|
|
// This only applies to thumbnails/transcoded, and each of them should
|
2011-12-20 03:52:06 +00:00
|
|
|
// be under a folder that has the source file name.
|
2014-05-07 17:01:16 +00:00
|
|
|
if ( $zone === 'thumb' || $zone === 'transcoded' ) {
|
|
|
|
|
$name = wfBaseName( dirname( $path ) );
|
2014-07-20 19:41:41 +00:00
|
|
|
$filename = $repo->getZonePath( $zone ) . substr( $path, strlen( "/" . $zone ) );
|
2014-04-20 23:52:08 +00:00
|
|
|
// Check to see if the file exists
|
|
|
|
|
if ( !$repo->fileExists( $filename ) ) {
|
|
|
|
|
wfForbidden( 'img-auth-accessdenied', 'img-auth-nofile', $filename );
|
|
|
|
|
return;
|
|
|
|
|
}
|
2011-12-20 03:52:06 +00:00
|
|
|
} else {
|
|
|
|
|
$name = wfBaseName( $path ); // file is a source file
|
|
|
|
|
$filename = $repo->getZonePath( 'public' ) . $path;
|
2014-04-20 23:52:08 +00:00
|
|
|
// Check to see if the file exists and is not deleted
|
|
|
|
|
$bits = explode( '!', $name, 2 );
|
|
|
|
|
if ( substr( $path, 0, 9 ) === '/archive/' && count( $bits ) == 2 ) {
|
|
|
|
|
$file = $repo->newFromArchiveName( $bits[1], $name );
|
|
|
|
|
} else {
|
|
|
|
|
$file = $repo->newFile( $name );
|
|
|
|
|
}
|
|
|
|
|
if ( !$file->exists() || $file->isDeleted( File::DELETED_FILE ) ) {
|
|
|
|
|
wfForbidden( 'img-auth-accessdenied', 'img-auth-nofile', $filename );
|
|
|
|
|
return;
|
|
|
|
|
}
|
2011-11-20 08:50:13 +00:00
|
|
|
}
|
|
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
$headers = []; // extra HTTP headers to send
|
2011-11-20 08:50:13 +00:00
|
|
|
|
2019-03-15 04:03:29 +00:00
|
|
|
$title = Title::makeTitleSafe( NS_FILE, $name );
|
|
|
|
|
|
2014-04-20 23:52:08 +00:00
|
|
|
if ( !$publicWiki ) {
|
|
|
|
|
// For private wikis, run extra auth checks and set cache control headers
|
2019-03-15 04:03:29 +00:00
|
|
|
$headers['Cache-Control'] = 'private';
|
|
|
|
|
$headers['Vary'] = 'Cookie';
|
2011-11-20 08:50:13 +00:00
|
|
|
|
2014-04-20 23:52:08 +00:00
|
|
|
if ( !$title instanceof Title ) { // files have valid titles
|
|
|
|
|
wfForbidden( 'img-auth-accessdenied', 'img-auth-badtitle', $name );
|
|
|
|
|
return;
|
|
|
|
|
}
|
2012-02-07 13:05:31 +00:00
|
|
|
|
2014-04-20 23:52:08 +00:00
|
|
|
// Run hook for extension authorization plugins
|
2019-02-02 13:39:58 +00:00
|
|
|
/** @var array $result */
|
2014-04-20 23:52:08 +00:00
|
|
|
$result = null;
|
Hooks::run() call site migration
Migrate all callers of Hooks::run() to use the new
HookContainer/HookRunner system.
General principles:
* Use DI if it is already used. We're not changing the way state is
managed in this patch.
* HookContainer is always injected, not HookRunner. HookContainer
is a service, it's a more generic interface, it is the only
thing that provides isRegistered() which is needed in some cases,
and a HookRunner can be efficiently constructed from it
(confirmed by benchmark). Because HookContainer is needed
for object construction, it is also needed by all factories.
* "Ask your friendly local base class". Big hierarchies like
SpecialPage and ApiBase have getHookContainer() and getHookRunner()
methods in the base class, and classes that extend that base class
are not expected to know or care where the base class gets its
HookContainer from.
* ProtectedHookAccessorTrait provides protected getHookContainer() and
getHookRunner() methods, getting them from the global service
container. The point of this is to ease migration to DI by ensuring
that call sites ask their local friendly base class rather than
getting a HookRunner from the service container directly.
* Private $this->hookRunner. In some smaller classes where accessor
methods did not seem warranted, there is a private HookRunner property
which is accessed directly. Very rarely (two cases), there is a
protected property, for consistency with code that conventionally
assumes protected=private, but in cases where the class might actually
be overridden, a protected accessor is preferred over a protected
property.
* The last resort: Hooks::runner(). Mostly for static, file-scope and
global code. In a few cases it was used for objects with broken
construction schemes, out of horror or laziness.
Constructors with new required arguments:
* AuthManager
* BadFileLookup
* BlockManager
* ClassicInterwikiLookup
* ContentHandlerFactory
* ContentSecurityPolicy
* DefaultOptionsManager
* DerivedPageDataUpdater
* FullSearchResultWidget
* HtmlCacheUpdater
* LanguageFactory
* LanguageNameUtils
* LinkRenderer
* LinkRendererFactory
* LocalisationCache
* MagicWordFactory
* MessageCache
* NamespaceInfo
* PageEditStash
* PageHandlerFactory
* PageUpdater
* ParserFactory
* PermissionManager
* RevisionStore
* RevisionStoreFactory
* SearchEngineConfig
* SearchEngineFactory
* SearchFormWidget
* SearchNearMatcher
* SessionBackend
* SpecialPageFactory
* UserNameUtils
* UserOptionsManager
* WatchedItemQueryService
* WatchedItemStore
Constructors with new optional arguments:
* DefaultPreferencesFactory
* Language
* LinkHolderArray
* MovePage
* Parser
* ParserCache
* PasswordReset
* Router
setHookContainer() now required after construction:
* AuthenticationProvider
* ResourceLoaderModule
* SearchEngine
Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
2020-03-19 02:42:09 +00:00
|
|
|
if ( !Hooks::runner()->onImgAuthBeforeStream( $title, $path, $name, $result ) ) {
|
2014-04-20 23:52:08 +00:00
|
|
|
wfForbidden( $result[0], $result[1], array_slice( $result, 2 ) );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check user authorization for this title
|
|
|
|
|
// Checks Whitelist too
|
2019-06-03 10:48:02 +00:00
|
|
|
|
|
|
|
|
if ( !$permissionManager->userCan( 'read', $user, $title ) ) {
|
2014-04-20 23:52:08 +00:00
|
|
|
wfForbidden( 'img-auth-accessdenied', 'img-auth-noread', $name );
|
|
|
|
|
return;
|
|
|
|
|
}
|
2011-11-20 08:50:13 +00:00
|
|
|
}
|
|
|
|
|
|
2014-04-20 08:40:06 +00:00
|
|
|
if ( isset( $_SERVER['HTTP_RANGE'] ) ) {
|
2019-03-15 04:03:29 +00:00
|
|
|
$headers['Range'] = $_SERVER['HTTP_RANGE'];
|
2014-04-20 08:40:06 +00:00
|
|
|
}
|
|
|
|
|
if ( isset( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) {
|
2019-03-15 04:03:29 +00:00
|
|
|
$headers['If-Modified-Since'] = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
|
2014-04-20 08:40:06 +00:00
|
|
|
}
|
|
|
|
|
|
2014-04-20 23:52:08 +00:00
|
|
|
if ( $request->getCheck( 'download' ) ) {
|
2019-03-15 04:03:29 +00:00
|
|
|
$headers['Content-Disposition'] = 'attachment';
|
2014-03-24 23:31:21 +00:00
|
|
|
}
|
|
|
|
|
|
2019-03-15 04:03:29 +00:00
|
|
|
// Allow modification of headers before streaming a file
|
Hooks::run() call site migration
Migrate all callers of Hooks::run() to use the new
HookContainer/HookRunner system.
General principles:
* Use DI if it is already used. We're not changing the way state is
managed in this patch.
* HookContainer is always injected, not HookRunner. HookContainer
is a service, it's a more generic interface, it is the only
thing that provides isRegistered() which is needed in some cases,
and a HookRunner can be efficiently constructed from it
(confirmed by benchmark). Because HookContainer is needed
for object construction, it is also needed by all factories.
* "Ask your friendly local base class". Big hierarchies like
SpecialPage and ApiBase have getHookContainer() and getHookRunner()
methods in the base class, and classes that extend that base class
are not expected to know or care where the base class gets its
HookContainer from.
* ProtectedHookAccessorTrait provides protected getHookContainer() and
getHookRunner() methods, getting them from the global service
container. The point of this is to ease migration to DI by ensuring
that call sites ask their local friendly base class rather than
getting a HookRunner from the service container directly.
* Private $this->hookRunner. In some smaller classes where accessor
methods did not seem warranted, there is a private HookRunner property
which is accessed directly. Very rarely (two cases), there is a
protected property, for consistency with code that conventionally
assumes protected=private, but in cases where the class might actually
be overridden, a protected accessor is preferred over a protected
property.
* The last resort: Hooks::runner(). Mostly for static, file-scope and
global code. In a few cases it was used for objects with broken
construction schemes, out of horror or laziness.
Constructors with new required arguments:
* AuthManager
* BadFileLookup
* BlockManager
* ClassicInterwikiLookup
* ContentHandlerFactory
* ContentSecurityPolicy
* DefaultOptionsManager
* DerivedPageDataUpdater
* FullSearchResultWidget
* HtmlCacheUpdater
* LanguageFactory
* LanguageNameUtils
* LinkRenderer
* LinkRendererFactory
* LocalisationCache
* MagicWordFactory
* MessageCache
* NamespaceInfo
* PageEditStash
* PageHandlerFactory
* PageUpdater
* ParserFactory
* PermissionManager
* RevisionStore
* RevisionStoreFactory
* SearchEngineConfig
* SearchEngineFactory
* SearchFormWidget
* SearchNearMatcher
* SessionBackend
* SpecialPageFactory
* UserNameUtils
* UserOptionsManager
* WatchedItemQueryService
* WatchedItemStore
Constructors with new optional arguments:
* DefaultPreferencesFactory
* Language
* LinkHolderArray
* MovePage
* Parser
* ParserCache
* PasswordReset
* Router
setHookContainer() now required after construction:
* AuthenticationProvider
* ResourceLoaderModule
* SearchEngine
Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
2020-03-19 02:42:09 +00:00
|
|
|
Hooks::runner()->onImgAuthModifyHeaders( $title->getTitleValue(), $headers );
|
2019-03-15 04:03:29 +00:00
|
|
|
|
2011-11-20 08:50:13 +00:00
|
|
|
// Stream the requested file
|
2022-10-21 04:32:38 +00:00
|
|
|
[ $headers, $options ] = HTTPFileStreamer::preprocessHeaders( $headers );
|
2013-02-13 18:38:32 +00:00
|
|
|
wfDebugLog( 'img_auth', "Streaming `" . $filename . "`." );
|
2019-04-20 01:06:50 +00:00
|
|
|
$repo->streamFileWithStatus( $filename, $headers, $options );
|
2011-10-15 22:58:42 +00:00
|
|
|
}
|
2004-10-14 02:13:12 +00:00
|
|
|
|
2007-08-06 06:15:21 +00:00
|
|
|
/**
|
2009-09-10 21:12:55 +00:00
|
|
|
* Issue a standard HTTP 403 Forbidden header ($msg1-a message index, not a message) and an
|
|
|
|
|
* error message ($msg2, also a message index), (both required) then end the script
|
2011-02-01 23:08:10 +00:00
|
|
|
* subsequent arguments to $msg2 will be passed as parameters only for replacing in $msg2
|
2014-04-14 19:43:18 +00:00
|
|
|
* @param string $msg1
|
|
|
|
|
* @param string $msg2
|
Get rid of unnecessary func_get_args() and friends
HHVM does not support variadic arguments with type hints. This is
mostly not a big problem, because we can just drop the type hint, but
for some reason PHPUnit adds a type hint of "array" when it creates
mocks, so a class with a variadic method can't be mocked (at least in
some cases). As such, I left alone all the classes that seem like
someone might like to mock them, like Title and User. If anyone wants
to mock them in the future, they'll have to switch back to
func_get_args(). Some of the changes are definitely safe, like
functions and test classes.
In most cases, func_get_args() (and/or func_get_arg(), func_num_args() )
were only present because the code was written before we required PHP
5.6, and writing them as variadic functions is strictly superior. In
some cases I left them alone, aside from HHVM compatibility:
* Forwarding all arguments to another function. It's useful to keep
func_get_args() here where we want to keep the list of expected
arguments and their meanings in the function signature line for
documentation purposes, but don't want to copy-paste a long line of
argument names.
* Handling deprecated calling conventions.
* One or two miscellaneous cases where we're basically using the
arguments individually but want to use them as an array as well for
some reason.
Change-Id: I066ec95a7beb7c0665146195a08e7cce1222c788
2018-10-08 14:10:45 +00:00
|
|
|
* @param mixed ...$args To pass as params to wfMessage() with $msg2. Either variadic, or a single
|
|
|
|
|
* array argument.
|
2007-08-06 06:15:21 +00:00
|
|
|
*/
|
Get rid of unnecessary func_get_args() and friends
HHVM does not support variadic arguments with type hints. This is
mostly not a big problem, because we can just drop the type hint, but
for some reason PHPUnit adds a type hint of "array" when it creates
mocks, so a class with a variadic method can't be mocked (at least in
some cases). As such, I left alone all the classes that seem like
someone might like to mock them, like Title and User. If anyone wants
to mock them in the future, they'll have to switch back to
func_get_args(). Some of the changes are definitely safe, like
functions and test classes.
In most cases, func_get_args() (and/or func_get_arg(), func_num_args() )
were only present because the code was written before we required PHP
5.6, and writing them as variadic functions is strictly superior. In
some cases I left them alone, aside from HHVM compatibility:
* Forwarding all arguments to another function. It's useful to keep
func_get_args() here where we want to keep the list of expected
arguments and their meanings in the function signature line for
documentation purposes, but don't want to copy-paste a long line of
argument names.
* Handling deprecated calling conventions.
* One or two miscellaneous cases where we're basically using the
arguments individually but want to use them as an array as well for
some reason.
Change-Id: I066ec95a7beb7c0665146195a08e7cce1222c788
2018-10-08 14:10:45 +00:00
|
|
|
function wfForbidden( $msg1, $msg2, ...$args ) {
|
2009-09-10 21:12:55 +00:00
|
|
|
global $wgImgAuthDetails;
|
2011-11-20 08:50:13 +00:00
|
|
|
|
2013-11-13 23:25:37 +00:00
|
|
|
$args = ( isset( $args[0] ) && is_array( $args[0] ) ) ? $args[0] : $args;
|
2011-11-20 08:50:13 +00:00
|
|
|
|
2019-10-04 14:11:29 +00:00
|
|
|
$msgHdr = wfMessage( $msg1 )->text();
|
2011-11-20 08:50:13 +00:00
|
|
|
$detailMsgKey = $wgImgAuthDetails ? $msg2 : 'badaccess-group0';
|
2019-10-04 14:11:29 +00:00
|
|
|
$detailMsg = wfMessage( $detailMsgKey, $args )->text();
|
2011-11-20 08:50:13 +00:00
|
|
|
|
|
|
|
|
wfDebugLog( 'img_auth',
|
2013-02-13 18:38:32 +00:00
|
|
|
"wfForbidden Hdr: " . wfMessage( $msg1 )->inLanguage( 'en' )->text() . " Msg: " .
|
|
|
|
|
wfMessage( $msg2, $args )->inLanguage( 'en' )->text()
|
2011-11-20 08:50:13 +00:00
|
|
|
);
|
|
|
|
|
|
2015-06-01 14:31:52 +00:00
|
|
|
HttpStatus::header( 403 );
|
2009-09-10 21:12:55 +00:00
|
|
|
header( 'Cache-Control: no-cache' );
|
2007-02-21 01:02:47 +00:00
|
|
|
header( 'Content-Type: text/html; charset=utf-8' );
|
2019-10-04 14:11:29 +00:00
|
|
|
$templateParser = new TemplateParser();
|
|
|
|
|
echo $templateParser->processTemplate( 'ImageAuthForbidden', [
|
|
|
|
|
'msgHdr' => $msgHdr,
|
|
|
|
|
'detailMsg' => $detailMsg,
|
|
|
|
|
] );
|
2007-11-03 02:38:40 +00:00
|
|
|
}
|