X-Git-Url: http://git.cyclocoop.org/%28%28?a=blobdiff_plain;f=includes%2FOutputPage.php;h=b2ca53aa185ca47d8a8f107a7bcca103d27d5754;hb=bb94f4964d1da0ed6a5fc3ae9f0e1b629a8cfd96;hp=e78cd7bd124d0cdf32085134dc9d29ed0462e1a4;hpb=22ac82f4cd7960735339d23865fce21665ea9c17;p=lhc%2Fweb%2Fwiklou.git
diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index e78cd7bd12..b2ca53aa18 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -54,7 +54,8 @@ class OutputPage extends ContextSource {
protected $mCanonicalUrl = false;
/**
- * @var string The contents of
*/
+ * @var string The contents of
+ */
private $mPageTitle = '';
/**
@@ -1660,6 +1661,16 @@ class OutputPage extends ContextSource {
return $this->mRevisionId;
}
+ /**
+ * Whether the revision displayed is the latest revision of the page
+ *
+ * @since 1.34
+ * @return bool
+ */
+ public function isRevisionCurrent() {
+ return $this->mRevisionId == 0 || $this->mRevisionId == $this->getTitle()->getLatestRevID();
+ }
+
/**
* Set the timestamp of the revision which will be displayed. This is used
* to avoid a extra DB call in Skin::lastModified().
@@ -2665,6 +2676,8 @@ class OutputPage extends ContextSource {
* @param string|null $action Action that was denied or null if unknown
*/
public function showPermissionsErrorPage( array $errors, $action = null ) {
+ $services = MediaWikiServices::getInstance();
+ $permissionManager = $services->getPermissionManager();
foreach ( $errors as $key => $error ) {
$errors[$key] = (array)$error;
}
@@ -2674,11 +2687,12 @@ class OutputPage extends ContextSource {
// 1. the user is not logged in
// 2. the only error is insufficient permissions (i.e. no block or something else)
// 3. the error can be avoided simply by logging in
+
if ( in_array( $action, [ 'read', 'edit', 'createpage', 'createtalk', 'upload' ] )
&& $this->getUser()->isAnon() && count( $errors ) == 1 && isset( $errors[0][0] )
&& ( $errors[0][0] == 'badaccess-groups' || $errors[0][0] == 'badaccess-group0' )
- && ( User::groupHasPermission( 'user', $action )
- || User::groupHasPermission( 'autoconfirmed', $action ) )
+ && ( $permissionManager->groupHasPermission( 'user', $action )
+ || $permissionManager->groupHasPermission( 'autoconfirmed', $action ) )
) {
$displayReturnto = null;
@@ -2714,8 +2728,6 @@ class OutputPage extends ContextSource {
}
}
- $services = MediaWikiServices::getInstance();
-
$title = SpecialPage::getTitleFor( 'Userlogin' );
$linkRenderer = $services->getLinkRenderer();
$loginUrl = $title->getLinkURL( $query, false, PROTO_RELATIVE );
@@ -2729,8 +2741,6 @@ class OutputPage extends ContextSource {
$this->prepareErrorPage( $this->msg( 'loginreqtitle' ) );
$this->addHTML( $this->msg( $msg )->rawParams( $loginLink )->params( $loginUrl )->parse() );
- $permissionManager = $services->getPermissionManager();
-
# Don't return to a page the user can't read otherwise
# we'll end up in a pointless loop
if ( $displayReturnto && $permissionManager->userCan(
@@ -3047,8 +3057,8 @@ class OutputPage extends ContextSource {
// This library is intended to run on older browsers that MediaWiki no longer
// supports as Grade A. For these Grade C browsers, we provide an experience
- // using only HTML and CSS. Where standards-compliant browsers are able to style
- // unknown HTML elements without issue, old IE ignores these styles.
+ // using only HTML and CSS. But, where standards-compliant browsers are able to
+ // style unknown HTML elements without issue, old IE ignores these styles.
// The html5shiv library fixes that.
// Use an IE conditional comment to serve the script only to old IE
$shivUrl = $config->get( 'ResourceBasePath' ) . '/resources/lib/html5shiv/html5shiv.js';
@@ -3217,7 +3227,7 @@ class OutputPage extends ContextSource {
$title = $this->getTitle();
$ns = $title->getNamespace();
- $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
+ $nsInfo = $services->getNamespaceInfo();
$canonicalNamespace = $nsInfo->exists( $ns )
? $nsInfo->getCanonicalName( $ns )
: $title->getNsText();