Introducing $wgFeed variable. Allows tuning sydication feeds off, when desired.
[lhc/web/wiklou.git] / includes / PageHistory.php
index 9d84665..2cd56f9 100644 (file)
@@ -67,6 +67,7 @@ class PageHistory {
                $wgOut->setArticleRelated( true );
                $wgOut->setRobotpolicy( 'noindex,nofollow' );
                $wgOut->setSyndicated( true );
+               $wgOut->setFeedAppendQuery( 'action=history' );
 
                $logPage = SpecialPage::getTitleFor( 'Log' );
                $logLink = $this->mSkin->makeKnownLinkObj( $logPage, wfMsgHtml( 'viewpagelogs' ), 'page=' . $this->mTitle->getPrefixedUrl() );
@@ -82,7 +83,7 @@ class PageHistory {
                 * Fail if article doesn't exist.
                 */
                if( !$this->mTitle->exists() ) {
-                       $wgOut->addWikiText( wfMsg( 'nohistory' ) );
+                       $wgOut->addWikiMsg( 'nohistory' );
                        wfProfileOut( $fname );
                        return;
                }
@@ -261,7 +262,9 @@ class PageHistory {
                $tools = array();
                
                if ( !is_null( $next ) && is_object( $next ) ) {
-                       if( $wgUser->isAllowed( 'rollback' ) && $latest ) {
+                       if( !$this->mTitle->getUserPermissionsErrors( 'rollback', $wgUser )
+                       && !$this->mTitle->getUserPermissionsErrors( 'edit', $wgUser )
+                       && $latest ) {
                                $tools[] = '<span class="mw-rollback-link">'
                                        . $this->mSkin->buildRollbackLink( $rev )
                                        . '</span>';
@@ -480,10 +483,17 @@ class PageHistory {
        function feed( $type ) {
                require_once 'SpecialRecentchanges.php';
                
-               global $wgFeedClasses;
+               global $wgFeed, $wgFeedClasses;
+               
+               if ( !$wgFeed ) {
+                       global $wgOut;
+                       $wgOut->addWikiMsg( 'feed-unavailable' );
+                       return;
+               }
+               
                if( !isset( $wgFeedClasses[$type] ) ) {
                        global $wgOut;
-                       $wgOut->addWikiText( wfMsg( 'feed-invalid' ) );
+                       $wgOut->addWikiMsg( 'feed-invalid' );
                        return;
                }