Index: branches/ApiEdit_Vodafone/includes/EditPage.php |
— | — | @@ -1,4 +1,3 @@ |
2 | | - |
3 | 2 | <?php |
4 | 3 | /** |
5 | 4 | * Contains the EditPage class |
— | — | @@ -437,8 +436,7 @@ |
438 | 437 | # in the back door with a hand-edited submission URL. |
439 | 438 | |
440 | 439 | if ( 'save' == $this->formtype ) { |
441 | | - $res = $this->processAttemptSave($this->attemptSave()); |
442 | | - if ( !$res ) { |
| 440 | + if ( !$this->attemptSave() ) { |
443 | 441 | wfProfileOut( "$fname-business-end" ); |
444 | 442 | wfProfileOut( $fname ); |
445 | 443 | return; |
— | — | @@ -647,10 +645,10 @@ |
648 | 646 | } |
649 | 647 | |
650 | 648 | /** |
651 | | - * Attempt submission |
652 | | - * @return bool false if output is done, true if the rest of the form should be displayed |
| 649 | + * Attempt submission (no UI) |
| 650 | + * @return one of the constants describing the result |
653 | 651 | */ |
654 | | - function attemptSave() { |
| 652 | + function internalAttemptSave( &$result ) { |
655 | 653 | global $wgSpamRegex, $wgFilterCallback, $wgUser, $wgOut, $wgParser; |
656 | 654 | global $wgMaxArticleSize; |
657 | 655 | |
— | — | @@ -671,6 +669,7 @@ |
672 | 670 | # Check for spam |
673 | 671 | $matches = array(); |
674 | 672 | if ( $wgSpamRegex && preg_match( $wgSpamRegex, $this->textbox1, $matches ) ) { |
| 673 | + $resultDetails['spam'] = $matches[0]; |
675 | 674 | wfProfileOut( "$fname-checks" ); |
676 | 675 | wfProfileOut( $fname ); |
677 | 676 | return self::AS_SPAM_ERROR; |
— | — | @@ -701,6 +700,7 @@ |
702 | 701 | $this->kblength = (int)(strlen( $this->textbox1 ) / 1024); |
703 | 702 | if ( $this->kblength > $wgMaxArticleSize ) { |
704 | 703 | // Error will be displayed by showEditForm() |
| 704 | + $this->tooBig = true; |
705 | 705 | wfProfileOut( "$fname-checks" ); |
706 | 706 | wfProfileOut( $fname ); |
707 | 707 | return self::AS_CONTENT_TOO_BIG; |
— | — | @@ -2106,9 +2106,15 @@ |
2107 | 2107 | } |
2108 | 2108 | } |
2109 | 2109 | |
2110 | | - function processAttemptSave($value) { |
| 2110 | + /** |
| 2111 | + * Attempt submission |
| 2112 | + * @return bool false if output is done, true if the rest of the form should be displayed |
| 2113 | + */ |
| 2114 | + function attemptSave() { |
2111 | 2115 | global $wgUser, $wgOut; |
2112 | 2116 | |
| 2117 | + $resultDetails = false; |
| 2118 | + $value = $this->internalAttemptSave( &$resultDetails ); |
2113 | 2119 | switch ($value) |
2114 | 2120 | { |
2115 | 2121 | case self::AS_END: |
— | — | @@ -2173,7 +2179,7 @@ |
2174 | 2180 | return true; |
2175 | 2181 | |
2176 | 2182 | case self::AS_SPAM_ERROR: |
2177 | | - $this->spamPage ( $matches[0] ); |
| 2183 | + $this->spamPage ( $resultDetails['spam'] ); |
2178 | 2184 | return false; |
2179 | 2185 | |
2180 | 2186 | case self::AS_FILTERING: |
Index: branches/ApiEdit_Vodafone/includes/SpecialUpload.php |
— | — | @@ -346,8 +346,8 @@ |
347 | 347 | * |
348 | 348 | * @access private |
349 | 349 | */ |
350 | | - function internalProcessUpload( &$resultDetails="" ) { |
351 | | - global $wgUser, $wgOut; |
| 350 | + function internalProcessUpload( &$resultDetails ) { |
| 351 | + global $wgUser; |
352 | 352 | |
353 | 353 | if( !wfRunHooks( 'UploadForm:BeforeProcessing', array( &$this ) ) ) |
354 | 354 | { |
Index: branches/ApiEdit_Vodafone/includes/api/ApiTalk.php |
— | — | @@ -181,7 +181,8 @@ |
182 | 182 | $editForm = new EditPage($myDiscussion);
|
183 | 183 | $editForm->mTitle = $object_discussion_title;
|
184 | 184 | $editForm->importFormData($params);
|
185 | | - $value=$editForm->attemptSave();
|
| 185 | + $resultDetails = false;
|
| 186 | + $value=$editForm->internalAttemptSave( &$resultDetails );
|
186 | 187 | }
|
187 | 188 | }
|
188 | 189 | }
|
Index: branches/ApiEdit_Vodafone/includes/api/ApiEditPage.php |
— | — | @@ -125,7 +125,8 @@ |
126 | 126 | $editForm->mTitle = $object_title;
|
127 | 127 | $editForm->importFormData($params);
|
128 | 128 |
|
129 | | - $value=$editForm->attemptSave();
|
| 129 | + $resultDetails = false;
|
| 130 | + $value=$editForm->internalAttemptSave( &$resultDetails );
|
130 | 131 | }
|
131 | 132 | }
|
132 | 133 | }
|