Index: trunk/extensions/FlaggedRevs/forms/PageStabilityForm.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | abstract class PageStabilityForm |
15 | 15 | { |
16 | 16 | /* Form parameters which can be user given */ |
17 | | - protected $target = null; # Target page text |
| 17 | + protected $page = false; # Target page obj |
18 | 18 | protected $watchThis = null; # Watch checkbox |
19 | 19 | protected $reviewThis = null; # Auto-review option... |
20 | 20 | protected $reason = ''; # Custom/extra reason |
— | — | @@ -23,19 +23,17 @@ |
24 | 24 | protected $override = -1; # Default version |
25 | 25 | protected $autoreview = ''; # Autoreview restrictions... |
26 | 26 | |
27 | | - protected $page = false; # Target page obj (of $target) |
28 | 27 | protected $oldConfig = array(); # Old page config |
29 | 28 | protected $oldExpiry = ''; # Old page config expiry (GMT) |
30 | 29 | |
31 | 30 | protected $inputLock = 0; # Disallow bad submissions |
32 | 31 | |
33 | | - public function getTarget() { |
34 | | - return $this->target; |
| 32 | + public function getPage() { |
| 33 | + return $this->page; |
35 | 34 | } |
36 | 35 | |
37 | | - public function setTarget( $value ) { |
38 | | - $this->trySet( $this->target, $value ); |
39 | | - $this->page = Title::newFromURL( $this->target ); |
| 36 | + public function setPage( Title $value ) { |
| 37 | + $this->trySet( $this->page, $value ); |
40 | 38 | } |
41 | 39 | |
42 | 40 | public function getWatchThis() { |
— | — | @@ -165,7 +163,6 @@ |
166 | 164 | * @return mixed (true on success, error string on failure) |
167 | 165 | */ |
168 | 166 | protected function checkTarget() { |
169 | | - $this->page = Title::newFromURL( $this->target ); |
170 | 167 | if ( is_null( $this->page ) ) { |
171 | 168 | return 'stabilize_page_invalid'; |
172 | 169 | } elseif ( !$this->page->exists() ) { |
— | — | @@ -185,17 +182,6 @@ |
186 | 183 | } |
187 | 184 | |
188 | 185 | /* |
189 | | - * Gets the target page Obj |
190 | | - * @return mixed (Title or null) |
191 | | - */ |
192 | | - public function getPage() { |
193 | | - if ( !$this->inputLock ) { |
194 | | - throw new MWException( __CLASS__ . " input fields not set yet.\n"); |
195 | | - } |
196 | | - return $this->page; |
197 | | - } |
198 | | - |
199 | | - /* |
200 | 186 | * Gets the current config expiry in GMT (or 'infinite') |
201 | 187 | * @return string |
202 | 188 | */ |
Index: trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php |
— | — | @@ -35,11 +35,16 @@ |
36 | 36 | # Set page title |
37 | 37 | $this->setHeaders(); |
38 | 38 | $this->sk = $wgUser->getSkin(); |
39 | | - |
| 39 | + |
40 | 40 | $this->form = new PageStabilityGeneralForm(); |
41 | 41 | $form = $this->form; // convenience |
42 | 42 | # Target page |
43 | | - $form->setTarget( $wgRequest->getVal( 'page', $par ) ); |
| 43 | + $title = Title::newFromURL( $wgRequest->getVal( 'page', $par ) ); |
| 44 | + if ( !$title ) { |
| 45 | + $wgOut->showErrorPage( 'notargettitle', 'notargettext' ); |
| 46 | + return; |
| 47 | + } |
| 48 | + $form->setPage( $title ); |
44 | 49 | # Watch checkbox |
45 | 50 | $form->setWatchThis( (bool)$wgRequest->getCheck( 'wpWatchthis' ) ); |
46 | 51 | # Get auto-review option... |
— | — | @@ -57,11 +62,6 @@ |
58 | 63 | $form->setAutoreview( $wgRequest->getVal( 'mwProtect-level-autoreview' ) ); |
59 | 64 | |
60 | 65 | $status = $form->ready(); // params all set |
61 | | - if ( $status === 'stabilize_page_invalid' ) { |
62 | | - $wgOut->showErrorPage( 'notargettitle', 'notargettext' ); |
63 | | - return; |
64 | | - } |
65 | | - $title = $form->getPage(); // convenience |
66 | 66 | if ( $status === 'stabilize_page_notexists' ) { |
67 | 67 | $wgOut->addWikiText( |
68 | 68 | wfMsg( 'stabilization-notexists', $title->getPrefixedText() ) ); |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -2225,7 +2225,7 @@ |
2226 | 2226 | return true; // user cannot change anything |
2227 | 2227 | } |
2228 | 2228 | $form = new PageStabilityProtectForm(); |
2229 | | - $form->setTarget( $article->getTitle() ); // target page |
| 2229 | + $form->setPage( $article->getTitle() ); // target page |
2230 | 2230 | $permission = $wgRequest->getVal( 'mwStabilityLevel' ); |
2231 | 2231 | if ( $permission == "none" ) { |
2232 | 2232 | $permission = ''; // 'none' => '' |
Index: trunk/extensions/FlaggedRevs/api/ApiStabilize.php |
— | — | @@ -51,7 +51,7 @@ |
52 | 52 | ? new PageStabilityProtectForm() |
53 | 53 | : new PageStabilityGeneralForm(); |
54 | 54 | |
55 | | - $form->setTarget( $title ); # Our target page |
| 55 | + $form->setPage( $title ); # Our target page |
56 | 56 | $form->setWatchThis( $params['watch'] ); # Watch this page |
57 | 57 | $form->setReason( $params['reason'] ); # Reason |
58 | 58 | $form->setReasonSelection( 'other' ); # Reason dropdown |
— | — | @@ -75,7 +75,6 @@ |
76 | 76 | $restriction = ''; // 'none' => '' |
77 | 77 | } |
78 | 78 | $form->setAutoreview( $restriction ); # Autoreview restriction |
79 | | - $form->setWasPosted( true ); // already validated |
80 | 79 | $form->ready(); |
81 | 80 | |
82 | 81 | $status = $form->submit(); // true/error message key |