[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Mark a revision as patrolled on a page 4 * 5 * Copyright © 2011 Alexandre Emsenhuber 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 20 * 21 * @file 22 * @ingroup Actions 23 */ 24 25 /** 26 * Mark a revision as patrolled on a page 27 * 28 * @ingroup Actions 29 */ 30 class MarkpatrolledAction extends FormlessAction { 31 32 public function getName() { 33 return 'markpatrolled'; 34 } 35 36 protected function getDescription() { 37 return ''; 38 } 39 40 public function onView() { 41 $request = $this->getRequest(); 42 43 $rcId = $request->getInt( 'rcid' ); 44 $rc = RecentChange::newFromId( $rcId ); 45 if ( is_null( $rc ) ) { 46 throw new ErrorPageError( 'markedaspatrollederror', 'markedaspatrollederrortext' ); 47 } 48 49 $user = $this->getUser(); 50 if ( !$user->matchEditToken( $request->getVal( 'token' ), $rcId ) ) { 51 throw new ErrorPageError( 'sessionfailure-title', 'sessionfailure' ); 52 } 53 54 $errors = $rc->doMarkPatrolled( $user ); 55 56 if ( in_array( array( 'rcpatroldisabled' ), $errors ) ) { 57 throw new ErrorPageError( 'rcpatroldisabled', 'rcpatroldisabledtext' ); 58 } 59 60 if ( in_array( array( 'hookaborted' ), $errors ) ) { 61 // The hook itself has handled any output 62 return; 63 } 64 65 # It would be nice to see where the user had actually come from, but for now just guess 66 $returnto = $rc->getAttribute( 'rc_type' ) == RC_NEW ? 'Newpages' : 'Recentchanges'; 67 $return = SpecialPage::getTitleFor( $returnto ); 68 69 if ( in_array( array( 'markedaspatrollederror-noautopatrol' ), $errors ) ) { 70 $this->getOutput()->setPageTitle( $this->msg( 'markedaspatrollederror' ) ); 71 $this->getOutput()->addWikiMsg( 'markedaspatrollederror-noautopatrol' ); 72 $this->getOutput()->returnToMain( null, $return ); 73 74 return; 75 } 76 77 if ( count( $errors ) ) { 78 throw new PermissionsError( 'patrol', $errors ); 79 } 80 81 # Inform the user 82 $this->getOutput()->setPageTitle( $this->msg( 'markedaspatrolled' ) ); 83 $this->getOutput()->addWikiMsg( 'markedaspatrolledtext', $rc->getTitle()->getPrefixedText() ); 84 $this->getOutput()->returnToMain( null, $return ); 85 } 86 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |