Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -55,7 +55,7 @@ |
56 | 56 | # perhaps treat flagged pages as "done", |
57 | 57 | # or just be too damn lazy to always click "current". |
58 | 58 | # We may just want non-user visitors to see reviewed pages by default. |
59 | | -$wgFlaggedRevsAnonOnly = true; |
| 59 | +$wgFlaggedRevsAnonOnly = false; |
60 | 60 | # Can users make comments that will show up below flagged revisions? |
61 | 61 | $wgFlaggedRevComments = true; |
62 | 62 | # How long to cache stable versions? (seconds) |
— | — | @@ -652,7 +652,7 @@ |
653 | 653 | function pageOverride() { |
654 | 654 | global $wgFlaggedRevsAnonOnly, $wgUser, $wgRequest, $action; |
655 | 655 | return !( ( $wgFlaggedRevsAnonOnly && !$wgUser->isAnon() ) || $action !='view' || |
656 | | - $wgRequest->getVal('oldid') || $wgRequest->getVal('diff') || $wgRequest->getInt('stable')===0 ); |
| 656 | + $wgRequest->getVal('oldid') || $wgRequest->getVal('diff') || $wgRequest->getIntOrNull('stable')===0 ); |
657 | 657 | } |
658 | 658 | |
659 | 659 | /** |
— | — | @@ -840,15 +840,16 @@ |
841 | 841 | } |
842 | 842 | |
843 | 843 | function setCurrentTab( &$sktmp, &$content_actions ) { |
844 | | - global $wgRequest, $wgArticle, $wgFlaggedRevsAnonOnly, $wgUser, $action; |
845 | | - // Only trigger on article view, not for protect/delete/hist |
| 844 | + global $wgRequest, $wgFlaggedRevsAnonOnly, $wgUser, $action; |
| 845 | + // Get the subject page |
| 846 | + $title = $sktmp->mTitle->getSubjectPage(); |
846 | 847 | // Non-content pages cannot be validated |
847 | | - if( !$wgArticle || !$sktmp->mTitle->exists() || !$sktmp->mTitle->isContentPage() ) |
848 | | - return; |
| 848 | + if( !$title->isContentPage() || !$title->exists() ) return; |
| 849 | + $article = new Article( $title ); |
849 | 850 | // If we are viewing a page normally, and it was overrode |
850 | 851 | // change the edit tab to a "current revision" tab |
851 | 852 | if( !( $wgFlaggedRevsAnonOnly && !$wgUser->isAnon() ) ) { |
852 | | - $tfrev = $this->getOverridingRev( $wgArticle ); |
| 853 | + $tfrev = $this->getOverridingRev( $article ); |
853 | 854 | // No quality revs? Find the last reviewed one |
854 | 855 | if( !is_object($tfrev) ) return; |
855 | 856 | // Note that revisions may not be set to override for users |
— | — | @@ -864,7 +865,7 @@ |
865 | 866 | $new_actions['current'] = array( |
866 | 867 | 'class' => '', |
867 | 868 | 'text' => wfMsg('currentrev'), |
868 | | - 'href' => $sktmp->mTitle->getLocalUrl( 'stable=0' ) |
| 869 | + 'href' => $title->getLocalUrl( 'stable=0' ) |
869 | 870 | ); |
870 | 871 | } |
871 | 872 | $new_actions[$action] = $data; |
— | — | @@ -872,7 +873,7 @@ |
873 | 874 | } |
874 | 875 | # Reset static array |
875 | 876 | $content_actions = $new_actions; |
876 | | - } else if( $action != 'view' || $wgRequest->getVal('oldid') ) { |
| 877 | + } else if( $action != 'view' || $wgRequest->getVal('oldid') || $sktmp->mTitle->isTalkPage() ) { |
877 | 878 | # Straighten out order |
878 | 879 | $new_actions = array(); $counter = 0; |
879 | 880 | foreach( $content_actions as $action => $data ) { |
— | — | @@ -881,7 +882,7 @@ |
882 | 883 | $new_actions['current'] = array( |
883 | 884 | 'class' => '', |
884 | 885 | 'text' => wfMsg('currentrev'), |
885 | | - 'href' => $sktmp->mTitle->getLocalUrl( 'stable=0' ) |
| 886 | + 'href' => $title->getLocalUrl( 'stable=0' ) |
886 | 887 | ); |
887 | 888 | } |
888 | 889 | $new_actions[$action] = $data; |
— | — | @@ -898,7 +899,7 @@ |
899 | 900 | $new_actions['current'] = array( |
900 | 901 | 'class' => 'selected', |
901 | 902 | 'text' => wfMsg('currentrev'), |
902 | | - 'href' => $sktmp->mTitle->getLocalUrl( 'stable=0' ) |
| 903 | + 'href' => $title->getLocalUrl( 'stable=0' ) |
903 | 904 | ); |
904 | 905 | } |
905 | 906 | $new_actions[$action] = $data; |