Index: trunk/phase3/includes/actions/DeleteAction.php |
— | — | @@ -0,0 +1,42 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Handle page deletion |
| 5 | + * |
| 6 | + * Copyright © 2012 Timo Tijhof |
| 7 | + * |
| 8 | + * This program is free software; you can redistribute it and/or modify |
| 9 | + * it under the terms of the GNU General Public License as published by |
| 10 | + * the Free Software Foundation; either version 2 of the License, or |
| 11 | + * (at your option) any later version. |
| 12 | + * |
| 13 | + * This program is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | + * GNU General Public License for more details. |
| 17 | + * |
| 18 | + * You should have received a copy of the GNU General Public License |
| 19 | + * along with this program; if not, write to the Free Software |
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
| 21 | + * |
| 22 | + * @file |
| 23 | + * @ingroup Actions |
| 24 | + * @author Timo Tijhof |
| 25 | + */ |
| 26 | + |
| 27 | +class DeleteAction extends FormlessAction { |
| 28 | + |
| 29 | + public function getName() { |
| 30 | + return 'delete'; |
| 31 | + } |
| 32 | + |
| 33 | + public function onView(){ |
| 34 | + return null; |
| 35 | + } |
| 36 | + |
| 37 | + public function show(){ |
| 38 | + |
| 39 | + $this->page->delete(); |
| 40 | + |
| 41 | + } |
| 42 | + |
| 43 | +} |
Property changes on: trunk/phase3/includes/actions/DeleteAction.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 44 | + native |
Index: trunk/phase3/includes/actions/EditAction.php |
— | — | @@ -0,0 +1,74 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * action=edit / action=submit handler |
| 5 | + * |
| 6 | + * Copyright © 2012 Timo Tijhof |
| 7 | + * |
| 8 | + * This program is free software; you can redistribute it and/or modify |
| 9 | + * it under the terms of the GNU General Public License as published by |
| 10 | + * the Free Software Foundation; either version 2 of the License, or |
| 11 | + * (at your option) any later version. |
| 12 | + * |
| 13 | + * This program is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | + * GNU General Public License for more details. |
| 17 | + * |
| 18 | + * You should have received a copy of the GNU General Public License |
| 19 | + * along with this program; if not, write to the Free Software |
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
| 21 | + * |
| 22 | + * @file |
| 23 | + * @ingroup Actions |
| 24 | + * @author Timo Tijhof |
| 25 | + */ |
| 26 | + |
| 27 | +class EditAction extends FormlessAction { |
| 28 | + |
| 29 | + public function getName() { |
| 30 | + return 'edit'; |
| 31 | + } |
| 32 | + |
| 33 | + public function onView(){ |
| 34 | + return null; |
| 35 | + } |
| 36 | + |
| 37 | + public function show(){ |
| 38 | + $page = $this->page; |
| 39 | + $request = $this->getRequest(); |
| 40 | + $user = $this->getUser(); |
| 41 | + $context = $this->getContext(); |
| 42 | + |
| 43 | + if ( wfRunHooks( 'CustomEditor', array( $page, $user ) ) ) { |
| 44 | + if ( ExternalEdit::useExternalEngine( $context, 'edit' ) |
| 45 | + && $this->getName() == 'edit' && !$request->getVal( 'section' ) |
| 46 | + && !$request->getVal( 'oldid' ) ) |
| 47 | + { |
| 48 | + $extedit = new ExternalEdit( $context ); |
| 49 | + $extedit->execute(); |
| 50 | + } else { |
| 51 | + $editor = new EditPage( $page ); |
| 52 | + $editor->edit(); |
| 53 | + } |
| 54 | + } |
| 55 | + |
| 56 | + } |
| 57 | + |
| 58 | +} |
| 59 | + |
| 60 | +class SubmitAction extends EditAction { |
| 61 | + |
| 62 | + public function getName() { |
| 63 | + return 'submit'; |
| 64 | + } |
| 65 | + |
| 66 | + public function show(){ |
| 67 | + if ( session_id() == '' ) { |
| 68 | + // Send a cookie so anons get talk message notifications |
| 69 | + wfSetupSession(); |
| 70 | + } |
| 71 | + |
| 72 | + parent::show(); |
| 73 | + } |
| 74 | + |
| 75 | +} |
Property changes on: trunk/phase3/includes/actions/EditAction.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 76 | + native |
Index: trunk/phase3/includes/actions/ViewAction.php |
— | — | @@ -0,0 +1,43 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * An action that views article content |
| 5 | + * |
| 6 | + * Copyright © 2012 Timo Tijhof |
| 7 | + * |
| 8 | + * This program is free software; you can redistribute it and/or modify |
| 9 | + * it under the terms of the GNU General Public License as published by |
| 10 | + * the Free Software Foundation; either version 2 of the License, or |
| 11 | + * (at your option) any later version. |
| 12 | + * |
| 13 | + * This program is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | + * GNU General Public License for more details. |
| 17 | + * |
| 18 | + * You should have received a copy of the GNU General Public License |
| 19 | + * along with this program; if not, write to the Free Software |
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
| 21 | + * |
| 22 | + * @file |
| 23 | + * @ingroup Actions |
| 24 | + * @author Timo Tijhof |
| 25 | + */ |
| 26 | + |
| 27 | +class ViewAction extends FormlessAction { |
| 28 | + |
| 29 | + public function getName() { |
| 30 | + return 'view'; |
| 31 | + } |
| 32 | + |
| 33 | + public function onView(){ |
| 34 | + return null; |
| 35 | + } |
| 36 | + |
| 37 | + public function show(){ |
| 38 | + global $wgSquidMaxage; |
| 39 | + |
| 40 | + $this->getOutput()->setSquidMaxage( $wgSquidMaxage ); |
| 41 | + $this->page->view(); |
| 42 | + } |
| 43 | + |
| 44 | +} |
Property changes on: trunk/phase3/includes/actions/ViewAction.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 45 | + native |
Index: trunk/phase3/includes/actions/RenderAction.php |
— | — | @@ -0,0 +1,42 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Handle action=render |
| 5 | + * |
| 6 | + * Copyright © 2012 Timo Tijhof |
| 7 | + * |
| 8 | + * This program is free software; you can redistribute it and/or modify |
| 9 | + * it under the terms of the GNU General Public License as published by |
| 10 | + * the Free Software Foundation; either version 2 of the License, or |
| 11 | + * (at your option) any later version. |
| 12 | + * |
| 13 | + * This program is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | + * GNU General Public License for more details. |
| 17 | + * |
| 18 | + * You should have received a copy of the GNU General Public License |
| 19 | + * along with this program; if not, write to the Free Software |
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
| 21 | + * |
| 22 | + * @file |
| 23 | + * @ingroup Actions |
| 24 | + * @author Timo Tijhof |
| 25 | + */ |
| 26 | + |
| 27 | +class RenderAction extends FormlessAction { |
| 28 | + |
| 29 | + public function getName() { |
| 30 | + return 'render'; |
| 31 | + } |
| 32 | + |
| 33 | + public function onView(){ |
| 34 | + return null; |
| 35 | + } |
| 36 | + |
| 37 | + public function show(){ |
| 38 | + |
| 39 | + $this->page->render(); |
| 40 | + |
| 41 | + } |
| 42 | + |
| 43 | +} |
Property changes on: trunk/phase3/includes/actions/RenderAction.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 44 | + native |
Index: trunk/phase3/includes/actions/ProtectAction.php |
— | — | @@ -0,0 +1,56 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * action=protect handler |
| 5 | + * |
| 6 | + * Copyright © 2012 Timo Tijhof |
| 7 | + * |
| 8 | + * This program is free software; you can redistribute it and/or modify |
| 9 | + * it under the terms of the GNU General Public License as published by |
| 10 | + * the Free Software Foundation; either version 2 of the License, or |
| 11 | + * (at your option) any later version. |
| 12 | + * |
| 13 | + * This program is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | + * GNU General Public License for more details. |
| 17 | + * |
| 18 | + * You should have received a copy of the GNU General Public License |
| 19 | + * along with this program; if not, write to the Free Software |
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
| 21 | + * |
| 22 | + * @file |
| 23 | + * @ingroup Actions |
| 24 | + * @author Timo Tijhof |
| 25 | + */ |
| 26 | + |
| 27 | +class ProtectAction extends FormlessAction { |
| 28 | + |
| 29 | + public function getName() { |
| 30 | + return 'protect'; |
| 31 | + } |
| 32 | + |
| 33 | + public function onView(){ |
| 34 | + return null; |
| 35 | + } |
| 36 | + |
| 37 | + public function show(){ |
| 38 | + |
| 39 | + $this->page->protect(); |
| 40 | + |
| 41 | + } |
| 42 | + |
| 43 | +} |
| 44 | + |
| 45 | +class UnprotectAction extends ProtectAction { |
| 46 | + |
| 47 | + public function getName() { |
| 48 | + return 'unprotect'; |
| 49 | + } |
| 50 | + |
| 51 | + public function show(){ |
| 52 | + |
| 53 | + $this->page->unprotect(); |
| 54 | + |
| 55 | + } |
| 56 | + |
| 57 | +} |
Property changes on: trunk/phase3/includes/actions/ProtectAction.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 58 | + native |
Index: trunk/phase3/includes/Wiki.php |
— | — | @@ -516,46 +516,11 @@ |
517 | 517 | return; |
518 | 518 | } |
519 | 519 | |
520 | | - switch( $act ) { |
521 | | - case 'view': |
522 | | - $output->setSquidMaxage( $wgSquidMaxage ); |
523 | | - $this->performedAction = $act; |
524 | | - $article->view(); |
525 | | - break; |
526 | | - case 'delete': |
527 | | - case 'protect': |
528 | | - case 'unprotect': |
529 | | - case 'render': |
530 | | - $this->performedAction = $act; |
531 | | - $article->$act(); |
532 | | - break; |
533 | | - case 'submit': |
534 | | - if ( session_id() == '' ) { |
535 | | - // Send a cookie so anons get talk message notifications |
536 | | - wfSetupSession(); |
537 | | - } |
538 | | - // Continue... |
539 | | - case 'edit': |
540 | | - if ( wfRunHooks( 'CustomEditor', array( $article, $user ) ) ) { |
541 | | - $this->performedAction = 'edit'; |
542 | | - if ( ExternalEdit::useExternalEngine( $this->context, 'edit' ) |
543 | | - && $act == 'edit' && !$request->getVal( 'section' ) |
544 | | - && !$request->getVal( 'oldid' ) ) |
545 | | - { |
546 | | - $extedit = new ExternalEdit( $this->context ); |
547 | | - $extedit->execute(); |
548 | | - } else { |
549 | | - $editor = new EditPage( $article ); |
550 | | - $editor->edit(); |
551 | | - } |
552 | | - } |
553 | | - break; |
554 | | - default: |
555 | | - if ( wfRunHooks( 'UnknownAction', array( $act, $article ) ) ) { |
556 | | - $this->performedAction = 'nosuchaction'; |
557 | | - $output->showErrorPage( 'nosuchaction', 'nosuchactiontext' ); |
558 | | - } |
| 520 | + if ( wfRunHooks( 'UnknownAction', array( $act, $article ) ) ) { |
| 521 | + $this->performedAction = 'nosuchaction'; |
| 522 | + $output->showErrorPage( 'nosuchaction', 'nosuchactiontext' ); |
559 | 523 | } |
| 524 | + |
560 | 525 | wfProfileOut( __METHOD__ ); |
561 | 526 | } |
562 | 527 | |
Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -253,19 +253,26 @@ |
254 | 254 | |
255 | 255 | # includes/actions |
256 | 256 | 'CreditsAction' => 'includes/actions/CreditsAction.php', |
| 257 | + 'DeleteAction' => 'includes/actions/DeleteAction.php', |
| 258 | + 'EditAction' => 'includes/actions/EditAction.php', |
257 | 259 | 'HistoryAction' => 'includes/actions/HistoryAction.php', |
258 | 260 | 'HistoryPage' => 'includes/actions/HistoryAction.php', |
259 | 261 | 'HistoryPager' => 'includes/actions/HistoryAction.php', |
260 | 262 | 'InfoAction' => 'includes/actions/InfoAction.php', |
261 | 263 | 'MarkpatrolledAction' => 'includes/actions/MarkpatrolledAction.php', |
| 264 | + 'ProtectAction' => 'includes/actions/ProtectAction.php', |
262 | 265 | 'PurgeAction' => 'includes/actions/PurgeAction.php', |
263 | 266 | 'RawAction' => 'includes/actions/RawAction.php', |
264 | 267 | 'RawPage' => 'includes/actions/RawAction.php', |
| 268 | + 'RenderAction' => 'includes/actions/RenderAction.php', |
265 | 269 | 'RevertAction' => 'includes/actions/RevertAction.php', |
266 | 270 | 'RevertFileAction' => 'includes/actions/RevertAction.php', |
267 | 271 | 'RevisiondeleteAction' => 'includes/actions/RevisiondeleteAction.php', |
268 | 272 | 'RollbackAction' => 'includes/actions/RollbackAction.php', |
| 273 | + 'SubmitAction' => 'includes/actions/EditAction.php', |
| 274 | + 'UnprotectAction' => 'includes/actions/ProtectAction.php', |
269 | 275 | 'UnwatchAction' => 'includes/actions/WatchAction.php', |
| 276 | + 'ViewAction' => 'includes/actions/ViewAction.php', |
270 | 277 | 'WatchAction' => 'includes/actions/WatchAction.php', |
271 | 278 | |
272 | 279 | # includes/api |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -5303,15 +5303,22 @@ |
5304 | 5304 | */ |
5305 | 5305 | $wgActions = array( |
5306 | 5306 | 'credits' => true, |
| 5307 | + 'delete' => true, |
| 5308 | + 'edit' => true, |
5307 | 5309 | 'history' => true, |
5308 | 5310 | 'info' => true, |
5309 | 5311 | 'markpatrolled' => true, |
| 5312 | + 'protect' => true, |
5310 | 5313 | 'purge' => true, |
5311 | 5314 | 'raw' => true, |
| 5315 | + 'render' => true, |
5312 | 5316 | 'revert' => true, |
5313 | 5317 | 'revisiondelete' => true, |
5314 | 5318 | 'rollback' => true, |
| 5319 | + 'submit' => true, |
| 5320 | + 'unprotect' => true, |
5315 | 5321 | 'unwatch' => true, |
| 5322 | + 'view' => true, |
5316 | 5323 | 'watch' => true, |
5317 | 5324 | ); |
5318 | 5325 | |