From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- includes/actions/MarkpatrolledAction.php | 86 ++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 includes/actions/MarkpatrolledAction.php (limited to 'includes/actions/MarkpatrolledAction.php') diff --git a/includes/actions/MarkpatrolledAction.php b/includes/actions/MarkpatrolledAction.php new file mode 100644 index 00000000..a5d76627 --- /dev/null +++ b/includes/actions/MarkpatrolledAction.php @@ -0,0 +1,86 @@ +matchEditToken( $this->getRequest()->getVal( 'token' ), $this->getRequest()->getInt( 'rcid' ) ) ) { + throw new ErrorPageError( 'sessionfailure-title', 'sessionfailure' ); + } + + return parent::checkCanExecute( $user ); + } + + public function onView() { + $rc = RecentChange::newFromId( $this->getRequest()->getInt( 'rcid' ) ); + + if ( is_null( $rc ) ) { + throw new ErrorPageError( 'markedaspatrollederror', 'markedaspatrollederrortext' ); + } + + $errors = $rc->doMarkPatrolled( $this->getUser() ); + + if ( in_array( array( 'rcpatroldisabled' ), $errors ) ) { + throw new ErrorPageError( 'rcpatroldisabled', 'rcpatroldisabledtext' ); + } + + if ( in_array( array( 'hookaborted' ), $errors ) ) { + // The hook itself has handled any output + return; + } + + # It would be nice to see where the user had actually come from, but for now just guess + $returnto = $rc->getAttribute( 'rc_type' ) == RC_NEW ? 'Newpages' : 'Recentchanges'; + $return = SpecialPage::getTitleFor( $returnto ); + + if ( in_array( array( 'markedaspatrollederror-noautopatrol' ), $errors ) ) { + $this->getOutput()->setPageTitle( wfMsg( 'markedaspatrollederror' ) ); + $this->getOutput()->addWikiMsg( 'markedaspatrollederror-noautopatrol' ); + $this->getOutput()->returnToMain( null, $return ); + return; + } + + if ( !empty( $errors ) ) { + $this->getOutput()->showPermissionsErrorPage( $errors ); + return; + } + + # Inform the user + $this->getOutput()->setPageTitle( wfMsg( 'markedaspatrolled' ) ); + $this->getOutput()->addWikiMsg( 'markedaspatrolledtext', $rc->getTitle()->getPrefixedText() ); + $this->getOutput()->returnToMain( null, $return ); + } +} -- cgit v1.2.3-54-g00ecf