From: Alexandre Emsenhuber Date: Wed, 27 Jul 2011 13:14:28 +0000 (+0000) Subject: * Changed OutputPage::$mIsArticle flag to be false by default. A lot of actions don... X-Git-Tag: 1.31.0-rc.0~28599 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=ba840115260d727abc96aa03dfb581e3fd8dc013;p=lhc%2Fweb%2Fwiklou.git * Changed OutputPage::$mIsArticle flag to be false by default. A lot of actions don't change that flag when they should, since about only action=view should have it to true. * Put OutputPage::$mIsArticleRelated declaration just below $mIsArticle's one since they are related * Made DifferenceEngine consistent with action=view, i.e. setting that flag to true when displaying any version of the page, current or not * Made Skin::getCopyright() always use history_copyright when displaying an old version, regardless to the diff parameter * Changed some checks from namespace != NS_SPECIAL && action=view to isArticle() so that they don't get executed when e.g. throwing an Exception (or similar things) --- diff --git a/includes/Article.php b/includes/Article.php index 998f378c77..9bf3f05838 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -364,7 +364,6 @@ class Article extends Page { return; } - $wgOut->setArticleFlag( true ); # Set page title (may be overridden by DISPLAYTITLE) $wgOut->setPageTitle( $this->getTitle()->getPrefixedText() ); @@ -377,6 +376,7 @@ class Article extends Page { return; } + $wgOut->setArticleFlag( true ); # Allow frames by default $wgOut->allowClickjacking(); diff --git a/includes/EditPage.php b/includes/EditPage.php index 958ea846e7..f3b24c5592 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -374,9 +374,6 @@ class EditPage { wfProfileIn( __METHOD__ ); wfDebug( __METHOD__.": enter\n" ); - // This is not an article - $wgOut->setArticleFlag( false ); - $this->importFormData( $wgRequest ); $this->firsttime = false; diff --git a/includes/OutputPage.php b/includes/OutputPage.php index fb7f67ef3e..dcd0675607 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -47,7 +47,13 @@ class OutputPage { var $mHTMLtitle = ''; /// Should be private. Is the displayed content related to the source of the corresponding wiki article. - var $mIsarticle = true; + var $mIsarticle = false; + + /** + * Should be private. Has get/set methods properly documented. + * Stores "article flag" toggle. + */ + var $mIsArticleRelated = true; /** * Should be private. We have to set isPrintable(). Some pages should @@ -145,12 +151,6 @@ class OutputPage { // Parser related. var $mContainsOldMagic = 0, $mContainsNewMagic = 0; - /** - * Should be private. Has get/set methods properly documented. - * Stores "article flag" toggle. - */ - var $mIsArticleRelated = true; - /// lazy initialised, use parserOptions() protected $mParserOptions = null; @@ -2303,14 +2303,7 @@ $templates $bodyAttrs = array(); # Crazy edit-on-double-click stuff - $action = $this->getRequest()->getVal( 'action', 'view' ); - - if ( - $this->getTitle()->getNamespace() != NS_SPECIAL && - in_array( $action, array( 'view', 'purge' ) ) && - $this->getUser()->getOption( 'editondblclick' ) - ) - { + if ( $this->isArticle() && $this->getUser()->getOption( 'editondblclick' ) ) { $editUrl = $this->getTitle()->getLocalUrl( $sk->editUrlOptions() ); $bodyAttrs['ondblclick'] = "document.location = '" . Xml::escapeJsString( $editUrl ) . "'"; diff --git a/includes/Skin.php b/includes/Skin.php index c8d057af33..0871f2f7bc 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -728,9 +728,7 @@ abstract class Skin extends ContextSource { global $wgRightsPage, $wgRightsUrl, $wgRightsText; if ( $type == 'detect' ) { - $diff = $this->getRequest()->getVal( 'diff' ); - - if ( is_null( $diff ) && !$this->isRevisionCurrent() && wfMsgForContent( 'history_copyright' ) !== '-' ) { + if ( !$this->isRevisionCurrent() && wfMsgForContent( 'history_copyright' ) !== '-' ) { $type = 'history'; } else { $type = 'normal'; diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index 96748909b1..1b8c3f7b13 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -1111,8 +1111,6 @@ class SkinTemplate extends Skin { wfProfileIn( __METHOD__ ); - $action = $wgRequest->getVal( 'action', 'view' ); - $nav_urls = array(); $nav_urls['mainpage'] = array( 'href' => self::makeMainPageUrl() ); if( $wgUploadNavigationUrl ) { @@ -1129,7 +1127,7 @@ class SkinTemplate extends Skin { // A print stylesheet is attached to all pages, but nobody ever // figures that out. :) Add a link... - if( $this->getTitle()->getNamespace() != NS_SPECIAL && ( $action == 'view' || $action == 'purge' ) ) { + if( $out->isArticle() ) { if ( !$out->isPrintable() ) { $nav_urls['print'] = array( 'text' => wfMsg( 'printableversion' ), diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 5f1a962b4e..74b909e1d4 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -223,7 +223,6 @@ CONTROL; return; } - $wgOut->setArticleFlag( false ); if ( !$this->loadRevisionData() ) { // Sounds like a deleted revision... Let's see what we can do. $t = $this->mTitle->getPrefixedText(); @@ -238,10 +237,6 @@ CONTROL; wfRunHooks( 'DiffViewHeader', array( $this, $this->mOldRev, $this->mNewRev ) ); - if ( $this->mNewRev->isCurrent() ) { - $wgOut->setArticleFlag( true ); - } - # mOldid is false if the difference engine is called with a "vague" query for # a diff between a version V and its previous version V' AND the version V # is the first version of that article. In that case, V' does not exist. @@ -521,6 +516,7 @@ CONTROL; $this->loadNewText(); $wgOut->setRevisionId( $this->mNewRev->getId() ); + $wgOut->setArticleFlag( true ); if ( $this->mTitle->isCssJsSubpage() || $this->mTitle->isCssOrJsPage() ) { // Stolen from Article::view --AG 2007-10-11 @@ -592,12 +588,8 @@ CONTROL; wfProfileOut( __METHOD__ ); return; } - if ( $this->mNewRev->isCurrent() ) { - $wgOut->setArticleFlag( true ); - } # Check if user is allowed to look at this page. If not, bail out. - # if ( !$this->mTitle->userCanRead() ) { $wgOut->loginToUse(); $wgOut->output();