dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Deprecate and replace usages of User:isAllowed{All,Any}"
[lhc/web/wiklou.git]
/
includes
/
skins
/
SkinTemplate.php
diff --git
a/includes/skins/SkinTemplate.php
b/includes/skins/SkinTemplate.php
index
ef45d15
..
1e6c643
100644
(file)
--- a/
includes/skins/SkinTemplate.php
+++ b/
includes/skins/SkinTemplate.php
@@
-62,12
+62,10
@@
class SkinTemplate extends Skin {
* roughly equivalent to PHPTAL 0.7.
*
* @param string $classname
* roughly equivalent to PHPTAL 0.7.
*
* @param string $classname
- * @param bool|string $repository Subdirectory where we keep template files
- * @param bool|string $cache_dir
* @return QuickTemplate
* @private
*/
* @return QuickTemplate
* @private
*/
- function setupTemplate( $classname
, $repository = false, $cache_dir = false
) {
+ function setupTemplate( $classname ) {
return new $classname( $this->getConfig() );
}
return new $classname( $this->getConfig() );
}
@@
-179,7
+177,7
@@
class SkinTemplate extends Skin {
$user = $this->getUser();
$title = $this->getTitle();
$user = $this->getUser();
$title = $this->getTitle();
- $tpl = $this->setupTemplate( $this->template
, 'skins'
);
+ $tpl = $this->setupTemplate( $this->template );
$this->thispage = $title->getPrefixedDBkey();
$this->titletxt = $title->getPrefixedText();
$this->thispage = $title->getPrefixedDBkey();
$this->titletxt = $title->getPrefixedText();
@@
-207,21
+205,10
@@
class SkinTemplate extends Skin {
}
/**
}
/**
- * initialize various variables and generate the template
- *
- * @param OutputPage|null $out
+ * Initialize various variables and generate the template
*/
*/
- function outputPage(
OutputPage $out = null
) {
+ function outputPage() {
Profiler::instance()->setTemplated( true );
Profiler::instance()->setTemplated( true );
-
- $oldContext = null;
- if ( $out !== null ) {
- // Deprecated since 1.20, note added in 1.25
- wfDeprecated( __METHOD__, '1.25' );
- $oldContext = $this->getContext();
- $this->setContext( $out->getContext() );
- }
-
$out = $this->getOutput();
$this->initPage( $out );
$out = $this->getOutput();
$this->initPage( $out );
@@
-231,10
+218,6
@@
class SkinTemplate extends Skin {
// result may be an error
$this->printOrError( $res );
// result may be an error
$this->printOrError( $res );
-
- if ( $oldContext ) {
- $this->setContext( $oldContext );
- }
}
/**
}
/**
@@
-271,7
+254,7
@@
class SkinTemplate extends Skin {
* @return QuickTemplate The template to be executed by outputPage
*/
protected function prepareQuickTemplate() {
* @return QuickTemplate The template to be executed by outputPage
*/
protected function prepareQuickTemplate() {
- global $wgScript, $wgStylePath, $wgMimeType,
$wgJsMimeType,
+ global $wgScript, $wgStylePath, $wgMimeType,
$wgSitename, $wgLogo, $wgMaxCredits,
$wgShowCreditsIfMax, $wgArticlePath,
$wgScriptPath, $wgServer;
$wgSitename, $wgLogo, $wgMaxCredits,
$wgShowCreditsIfMax, $wgArticlePath,
$wgScriptPath, $wgServer;
@@
-321,7
+304,6
@@
class SkinTemplate extends Skin {
}
$tpl->set( 'mimetype', $wgMimeType );
}
$tpl->set( 'mimetype', $wgMimeType );
- $tpl->set( 'jsmimetype', $wgJsMimeType );
$tpl->set( 'charset', 'UTF-8' );
$tpl->set( 'wgScript', $wgScript );
$tpl->set( 'skinname', $this->skinname );
$tpl->set( 'charset', 'UTF-8' );
$tpl->set( 'wgScript', $wgScript );
$tpl->set( 'skinname', $this->skinname );
@@
-332,7
+314,7
@@
class SkinTemplate extends Skin {
$tpl->set( 'handheld', $request->getBool( 'handheld' ) );
$tpl->set( 'loggedin', $this->loggedin );
$tpl->set( 'notspecialpage', !$title->isSpecialPage() );
$tpl->set( 'handheld', $request->getBool( 'handheld' ) );
$tpl->set( 'loggedin', $this->loggedin );
$tpl->set( 'notspecialpage', !$title->isSpecialPage() );
- $tpl->set( 'searchaction', $this->
escape
SearchLink() );
+ $tpl->set( 'searchaction', $this->
get
SearchLink() );
$tpl->set( 'searchtitle', SpecialPage::getTitleFor( 'Search' )->getPrefixedDBkey() );
$tpl->set( 'search', trim( $request->getVal( 'search' ) ) );
$tpl->set( 'stylepath', $wgStylePath );
$tpl->set( 'searchtitle', SpecialPage::getTitleFor( 'Search' )->getPrefixedDBkey() );
$tpl->set( 'search', trim( $request->getVal( 'search' ) ) );
$tpl->set( 'stylepath', $wgStylePath );
@@
-603,6
+585,7
@@
class SkinTemplate extends Skin {
$request = $this->getRequest();
$pageurl = $title->getLocalURL();
$authManager = AuthManager::singleton();
$request = $this->getRequest();
$pageurl = $title->getLocalURL();
$authManager = AuthManager::singleton();
+ $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
/* set up the default links for the personal toolbar */
$personal_urls = [];
/* set up the default links for the personal toolbar */
$personal_urls = [];
@@
-622,7
+605,6
@@
class SkinTemplate extends Skin {
$returnto['returnto'] = $page;
$query = $request->getVal( 'returntoquery', $this->thisquery );
$paramsArray = wfCgiToArray( $query );
$returnto['returnto'] = $page;
$query = $request->getVal( 'returntoquery', $this->thisquery );
$paramsArray = wfCgiToArray( $query );
- unset( $paramsArray['logoutToken'] );
$query = wfArrayToCgi( $paramsArray );
if ( $query != '' ) {
$returnto['returntoquery'] = $query;
$query = wfArrayToCgi( $paramsArray );
if ( $query != '' ) {
$returnto['returntoquery'] = $query;
@@
-695,8
+677,7
@@
class SkinTemplate extends Skin {
'href' => self::makeSpecialUrl( 'Userlogout',
// Note: userlogout link must always contain an & character, otherwise we might not be able
// to detect a buggy precaching proxy (T19790)
'href' => self::makeSpecialUrl( 'Userlogout',
// Note: userlogout link must always contain an & character, otherwise we might not be able
// to detect a buggy precaching proxy (T19790)
- ( $title->isSpecial( 'Preferences' ) ? [] : $returnto )
- + [ 'logoutToken' => $this->getUser()->getEditToken( 'logoutToken', $this->getRequest() ) ] ),
+ ( $title->isSpecial( 'Preferences' ) ? [] : $returnto ) ),
'active' => false
];
}
'active' => false
];
}
@@
-724,7
+705,7
@@
class SkinTemplate extends Skin {
];
// No need to show Talk and Contributions to anons if they can't contribute!
];
// No need to show Talk and Contributions to anons if they can't contribute!
- if (
User::
groupHasPermission( '*', 'edit' ) ) {
+ if (
$permissionManager->
groupHasPermission( '*', 'edit' ) ) {
// Because of caching, we can't link directly to the IP talk and
// contributions pages. Instead we use the special page shortcuts
// (which work correctly regardless of caching). This means we can't
// Because of caching, we can't link directly to the IP talk and
// contributions pages. Instead we use the special page shortcuts
// (which work correctly regardless of caching). This means we can't
@@
-752,7
+733,7
@@
class SkinTemplate extends Skin {
}
if ( $authManager->canAuthenticateNow() ) {
}
if ( $authManager->canAuthenticateNow() ) {
- $key =
User::
groupHasPermission( '*', 'read' )
+ $key =
$permissionManager->
groupHasPermission( '*', 'read' )
? 'login'
: 'login-private';
$personal_urls[$key] = $login_url;
? 'login'
: 'login-private';
$personal_urls[$key] = $login_url;
@@
-1101,7
+1082,10
@@
class SkinTemplate extends Skin {
}
// Checks if the user is logged in
}
// Checks if the user is logged in
- if ( $this->loggedin && $user->isAllowedAll( 'viewmywatchlist', 'editmywatchlist' ) ) {
+ if ( $this->loggedin && MediaWikiServices::getInstance()
+ ->getPermissionManager()
+ ->userHasAllRights( $user, 'viewmywatchlist', 'editmywatchlist' )
+ ) {
/**
* The following actions use messages which, if made particular to
* the any specific skins, would break the Ajax code which makes this
/**
* The following actions use messages which, if made particular to
* the any specific skins, would break the Ajax code which makes this
@@
-1295,6
+1279,7
@@
class SkinTemplate extends Skin {
$nav_urls['contributions'] = false;
$nav_urls['log'] = false;
$nav_urls['blockip'] = false;
$nav_urls['contributions'] = false;
$nav_urls['log'] = false;
$nav_urls['blockip'] = false;
+ $nav_urls['mute'] = false;
$nav_urls['emailuser'] = false;
$nav_urls['userrights'] = false;
$nav_urls['emailuser'] = false;
$nav_urls['userrights'] = false;
@@
-1372,6
+1357,13
@@
class SkinTemplate extends Skin {
}
if ( !$user->isAnon() ) {
}
if ( !$user->isAnon() ) {
+ if ( $this->getUser()->isRegistered() && $this->getConfig()->get( 'EnableSpecialMute' ) ) {
+ $nav_urls['mute'] = [
+ 'text' => $this->msg( 'mute-preferences' )->text(),
+ 'href' => self::makeSpecialUrlSubpage( 'Mute', $rootUser )
+ ];
+ }
+
$sur = new UserrightsPage;
$sur->setContext( $this->getContext() );
$canChange = $sur->userCanChangeRights( $user );
$sur = new UserrightsPage;
$sur->setContext( $this->getContext() );
$canChange = $sur->userCanChangeRights( $user );