Index: branches/ApiEdit_Vodafone/includes/SpecialUpload.php |
— | — | @@ -357,7 +357,6 @@ |
358 | 358 | { |
359 | 359 | wfDebug( "Hook 'UploadForm:BeforeProcessing' broke processing the file." ); |
360 | 360 | return self::BEFORE_PROCESSING; |
361 | | - |
362 | 361 | } |
363 | 362 | |
364 | 363 | /* Check for PHP error if any, requires php 4.2 or newer */ |
— | — | @@ -399,7 +398,6 @@ |
400 | 399 | $partname .= '.' . $ext[$i]; |
401 | 400 | } |
402 | 401 | |
403 | | - |
404 | 402 | if( strlen( $partname ) < 1 ) { |
405 | 403 | return self::MIN_LENGHT_PARTNAME; |
406 | 404 | } |
— | — | @@ -410,7 +408,6 @@ |
411 | 409 | */ |
412 | 410 | $filtered = preg_replace ( "/[^".Title::legalChars()."]|:/", '-', $filtered ); |
413 | 411 | $nt = Title::makeTitleSafe( NS_IMAGE, $filtered ); |
414 | | - |
415 | 412 | if( is_null( $nt ) ) { |
416 | 413 | $resultDetails = array( 'filtered' => $filtered ); |
417 | 414 | return self::ILLEGAL_FILENAME; |
— | — | @@ -439,10 +436,8 @@ |
440 | 437 | /* Don't allow users to override the blacklist (check file extension) */ |
441 | 438 | global $wgStrictFileExtensions; |
442 | 439 | global $wgFileExtensions, $wgFileBlacklist; |
443 | | - |
444 | 440 | if ($finalExt == '') { |
445 | 441 | return self::FILETYPE_MISSING; |
446 | | - |
447 | 442 | } elseif ( $this->checkFileExtensionList( $ext, $wgFileBlacklist ) || |
448 | 443 | ($wgStrictFileExtensions && !$this->checkFileExtension( $finalExt, $wgFileExtensions ) ) ) { |
449 | 444 | $resultDetails = array( 'finalExt' => $finalExt ); |
— | — | @@ -481,6 +476,7 @@ |
482 | 477 | */ |
483 | 478 | if ( ! $this->mIgnoreWarning ) { |
484 | 479 | $warning = ''; |
| 480 | + |
485 | 481 | global $wgCapitalLinks; |
486 | 482 | if( $wgCapitalLinks ) { |
487 | 483 | $filtered = ucfirst( $filtered ); |
— | — | @@ -511,7 +507,6 @@ |
512 | 508 | if ( !$this->mDestWarningAck ) { |
513 | 509 | $warning .= self::getExistsWarning( $this->mLocalFile ); |
514 | 510 | } |
515 | | - |
516 | 511 | if( $warning != '' ) { |
517 | 512 | /** |
518 | 513 | * Stash the file in a temporary location; the user can choose |
— | — | @@ -656,7 +651,6 @@ |
657 | 652 | $llink = $sk->makeKnownLinkObj( $ltitle, wfMsgHtml( 'deletionlog' ), |
658 | 653 | 'type=delete&page=' . $file->getTitle()->getPrefixedUrl() ); |
659 | 654 | $warning .= '<li>' . wfMsgWikiHtml( 'filewasdeleted', $llink ) . '</li>'; |
660 | | - |
661 | 655 | } |
662 | 656 | return $warning; |
663 | 657 | } |
— | — | @@ -1160,6 +1154,7 @@ |
1161 | 1155 | #check mime type, if desired |
1162 | 1156 | global $wgVerifyMimeType; |
1163 | 1157 | if ($wgVerifyMimeType) { |
| 1158 | + |
1164 | 1159 | wfDebug ( "\n\nmime: <$mime> extension: <$extension>\n\n"); |
1165 | 1160 | #check mime type against file extension |
1166 | 1161 | if( !$this->verifyExtension( $mime, $extension ) ) { |
— | — | @@ -1170,7 +1165,6 @@ |
1171 | 1166 | global $wgMimeTypeBlacklist; |
1172 | 1167 | if( isset($wgMimeTypeBlacklist) && !is_null($wgMimeTypeBlacklist) |
1173 | 1168 | && $this->checkFileExtension( $mime, $wgMimeTypeBlacklist ) ) { |
1174 | | - |
1175 | 1169 | return new WikiErrorMsg( 'filetype-badmime', htmlspecialchars( $mime ) ); |
1176 | 1170 | } |
1177 | 1171 | } |
— | — | @@ -1189,7 +1183,6 @@ |
1190 | 1184 | } |
1191 | 1185 | |
1192 | 1186 | wfDebug( __METHOD__.": all clear; passing.\n" ); |
1193 | | - |
1194 | 1187 | return true; |
1195 | 1188 | } |
1196 | 1189 | |
— | — | @@ -1563,5 +1556,3 @@ |
1564 | 1557 | return $pageText; |
1565 | 1558 | } |
1566 | 1559 | } |
1567 | | - |
1568 | | - |
Index: branches/ApiEdit_Vodafone/includes/SpecialUserlogin.php |
— | — | @@ -8,7 +8,6 @@ |
9 | 9 | * constructor |
10 | 10 | */ |
11 | 11 | function wfSpecialUserlogin() { |
12 | | - |
13 | 12 | global $wgRequest; |
14 | 13 | if( session_id() == '' ) { |
15 | 14 | wfSetupSession(); |
— | — | @@ -57,7 +56,6 @@ |
58 | 57 | const ERROR = 30; |
59 | 58 | const SUCCESFUL_LOGIN = 31; |
60 | 59 | |
61 | | - |
62 | 60 | var $mName, $mPassword, $mRetype, $mReturnTo, $mCookieCheck, $mPosted; |
63 | 61 | var $mAction, $mCreateaccount, $mCreateaccountMail, $mMailmypassword; |
64 | 62 | var $mLoginattempt, $mRemember, $mEmail, $mDomain, $mLanguage; |
— | — | @@ -76,8 +74,6 @@ |
77 | 75 | $this->mRetype = $request->getText( 'wpRetype' ); |
78 | 76 | $this->mDomain = $request->getText( 'wpDomain' ); |
79 | 77 | $this->mReturnTo = $request->getVal( 'returnto' ); |
80 | | - |
81 | | - |
82 | 78 | $this->mCookieCheck = $request->getVal( 'wpCookieCheck' ); |
83 | 79 | $this->mPosted = $request->wasPosted(); |
84 | 80 | $this->mCreateaccount = $request->getCheck( 'wpCreateaccount' ); |
— | — | @@ -115,7 +111,7 @@ |
116 | 112 | function execute() { |
117 | 113 | $resultDetails = null; |
118 | 114 | $value = null; |
119 | | - |
| 115 | + |
120 | 116 | if ( !is_null( $this->mCookieCheck ) ) { |
121 | 117 | $value = $this->onCookieRedirectCheck( $this->mCookieCheck, $resultDetails ); |
122 | 118 | return $this->processRest($value, $resultDetails); |
— | — | @@ -167,6 +163,7 @@ |
168 | 164 | } |
169 | 165 | } |
170 | 166 | |
| 167 | + |
171 | 168 | /** |
172 | 169 | * @private |
173 | 170 | */ |
— | — | @@ -259,7 +256,6 @@ |
260 | 257 | { |
261 | 258 | $results['ip'] = $ip; |
262 | 259 | return self::SORBS; |
263 | | - |
264 | 260 | } |
265 | 261 | |
266 | 262 | # Now create a dummy user ($u) and check if it is valid |
— | — | @@ -267,22 +263,18 @@ |
268 | 264 | $u = User::newFromName( $name, 'creatable' ); |
269 | 265 | if ( is_null( $u ) ) { |
270 | 266 | return self::NO_NAME; |
271 | | - |
272 | 267 | } |
273 | 268 | |
274 | 269 | if ( 0 != $u->idForName() ) { |
275 | 270 | return self::USER_EXISTS; |
276 | | - |
277 | 271 | } |
278 | 272 | |
279 | 273 | if ( 0 != strcmp( $this->mPassword, $this->mRetype ) ) { |
280 | 274 | return self::BAD_RETYPE; |
281 | | - |
282 | 275 | } |
283 | 276 | |
284 | 277 | if ( !$u->isValidPassword( $this->mPassword ) ) { |
285 | 278 | return self::TOO_SHORT; |
286 | | - |
287 | 279 | } |
288 | 280 | |
289 | 281 | # Set some additional data so the AbortNewAccount hook can be |
— | — | @@ -296,7 +288,6 @@ |
297 | 289 | wfDebug( "LoginForm::addNewAccountInternal: a hook blocked creation\n" ); |
298 | 290 | $results['error'] = $abortError; |
299 | 291 | return self::ABORT_ERROR; |
300 | | - |
301 | 292 | } |
302 | 293 | |
303 | 294 | if ( $wgAccountCreationThrottle && $wgUser->isPingLimitable() ) { |
— | — | @@ -313,7 +304,6 @@ |
314 | 305 | |
315 | 306 | if( !$wgAuth->addUser( $u, $this->mPassword, $this->mEmail, $this->mRealName ) ) { |
316 | 307 | return self::DB_ERROR; |
317 | | - |
318 | 308 | } |
319 | 309 | |
320 | 310 | return $this->initUser( $u, false ); |
— | — | @@ -611,35 +601,29 @@ |
612 | 602 | |
613 | 603 | if( !$wgAuth->allowPasswordChange() ) { |
614 | 604 | return self::RESETPASS_FORBIDDEN; |
615 | | - |
616 | 605 | } |
617 | 606 | |
618 | 607 | # Check against blocked IPs |
619 | 608 | # fixme -- should we not? |
620 | 609 | if( $wgUser->isBlocked() ) { |
621 | 610 | return self::MAILPASSWORD_BLOCKED; |
622 | | - |
623 | 611 | } |
624 | 612 | |
625 | 613 | # Check against the rate limiter |
626 | 614 | if( $wgUser->pingLimiter( 'mailpassword' ) ) { |
627 | 615 | return self::RATE_LIMITED; |
628 | | - |
629 | 616 | } |
630 | 617 | |
631 | 618 | if ( '' == $this->mName ) { |
632 | 619 | return self::NO_NAME; |
633 | | - |
634 | 620 | } |
635 | 621 | $u = User::newFromName( $this->mName ); |
636 | 622 | if( is_null( $u ) ) { |
637 | 623 | return self::NO_NAME; |
638 | | - |
639 | 624 | } |
640 | 625 | if ( 0 == $u->getID() ) { |
641 | 626 | $results['user']=$u; |
642 | 627 | return self::NO_SUCH_USER; |
643 | | - |
644 | 628 | } |
645 | 629 | |
646 | 630 | # Check against password throttle |
Index: branches/ApiEdit_Vodafone/includes/EditPage.php |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | const AS_SUCCESS_NEW_ARTICLE = 201; |
18 | 18 | const AS_HOOK_ERROR = 210; |
19 | 19 | const AS_FILTERING = 211; |
20 | | - const AS_HOOK_ERROR_EXPECTED = 212; |
| 20 | + const AS_HOOK_ERROR_EXPECTED = 212; |
21 | 21 | const AS_BLOCKED_PAGE_FOR_USER = 215; |
22 | 22 | const AS_CONTENT_TOO_BIG = 216; |
23 | 23 | const AS_USER_CANNOT_EDIT = 217; |
— | — | @@ -364,7 +364,7 @@ |
365 | 365 | { |
366 | 366 | if ($this->edit) { |
367 | 367 | $this->formtype = 'preview'; |
368 | | - } else if ($this->save || $this->preview || $this->diff) { |
| 368 | + } elseif ($this->save || $this->preview || $this->diff) { |
369 | 369 | $remove[] = $error; |
370 | 370 | } |
371 | 371 | } |
— | — | @@ -663,7 +663,6 @@ |
664 | 664 | { |
665 | 665 | wfDebug( "Hook 'EditPage::attemptSave' aborted article saving" ); |
666 | 666 | return self::AS_HOOK_ERROR; |
667 | | -// return false; |
668 | 667 | } |
669 | 668 | |
670 | 669 | # Reintegrate metadata |
— | — | @@ -677,27 +676,23 @@ |
678 | 677 | wfProfileOut( "$fname-checks" ); |
679 | 678 | wfProfileOut( $fname ); |
680 | 679 | return self::AS_SPAM_ERROR; |
681 | | -// return false; |
682 | 680 | } |
683 | 681 | if ( $wgFilterCallback && $wgFilterCallback( $this->mTitle, $this->textbox1, $this->section ) ) { |
684 | 682 | # Error messages or other handling should be performed by the filter function |
685 | 683 | wfProfileOut( $fname ); |
686 | 684 | wfProfileOut( "$fname-checks" ); |
687 | 685 | return self::AS_FILTERING; |
688 | | -// return false; |
689 | 686 | } |
690 | 687 | if ( !wfRunHooks( 'EditFilter', array( $this, $this->textbox1, $this->section, &$this->hookError ) ) ) { |
691 | 688 | # Error messages etc. could be handled within the hook... |
692 | 689 | wfProfileOut( $fname ); |
693 | 690 | wfProfileOut( "$fname-checks" ); |
694 | | - return AS_HOOK_ERROR; |
695 | | -// return false; |
| 691 | + return self::AS_HOOK_ERROR; |
696 | 692 | } elseif( $this->hookError != '' ) { |
697 | 693 | # ...or the hook could be expecting us to produce an error |
698 | 694 | wfProfileOut( "$fname-checks " ); |
699 | 695 | wfProfileOut( $fname ); |
700 | 696 | return self::AS_HOOK_ERROR_EXPECTED; |
701 | | -// return true; |
702 | 697 | } |
703 | 698 | if ( $wgUser->isBlockedFrom( $this->mTitle, false ) ) { |
704 | 699 | # Check block state against master, thus 'false'. |
— | — | @@ -705,7 +700,6 @@ |
706 | 701 | wfProfileOut( "$fname-checks" ); |
707 | 702 | wfProfileOut( $fname ); |
708 | 703 | return self::AS_BLOCKED_PAGE_FOR_USER; |
709 | | -// return false; |
710 | 704 | } |
711 | 705 | $this->kblength = (int)(strlen( $this->textbox1 ) / 1024); |
712 | 706 | if ( $this->kblength > $wgMaxArticleSize ) { |
— | — | @@ -714,7 +708,6 @@ |
715 | 709 | wfProfileOut( "$fname-checks" ); |
716 | 710 | wfProfileOut( $fname ); |
717 | 711 | return self::AS_CONTENT_TOO_BIG; |
718 | | -// return true; |
719 | 712 | } |
720 | 713 | |
721 | 714 | if ( !$wgUser->isAllowed('edit') ) { |
— | — | @@ -723,14 +716,12 @@ |
724 | 717 | wfProfileOut( "$fname-checks" ); |
725 | 718 | wfProfileOut( $fname ); |
726 | 719 | return self::AS_READ_ONLY_PAGE_ANON; |
727 | | -// return false; |
728 | 720 | } |
729 | 721 | else { |
730 | 722 | // $wgOut->readOnlyPage(); |
731 | 723 | wfProfileOut( "$fname-checks" ); |
732 | 724 | wfProfileOut( $fname ); |
733 | 725 | return self::AS_READ_ONLY_PAGE_LOGGED; |
734 | | -// return false; |
735 | 726 | } |
736 | 727 | } |
737 | 728 | |
— | — | @@ -739,14 +730,12 @@ |
740 | 731 | wfProfileOut( "$fname-checks" ); |
741 | 732 | wfProfileOut( $fname ); |
742 | 733 | return self::AS_READ_ONLY_PAGE; |
743 | | -// return false; |
744 | 734 | } |
745 | 735 | if ( $wgUser->pingLimiter() ) { |
746 | 736 | // $wgOut->rateLimited(); |
747 | 737 | wfProfileOut( "$fname-checks" ); |
748 | 738 | wfProfileOut( $fname ); |
749 | 739 | return self::AS_RATE_LIMITED; |
750 | | -// return false; |
751 | 740 | } |
752 | 741 | |
753 | 742 | # If the article has been deleted while editing, don't save it without |
— | — | @@ -755,7 +744,6 @@ |
756 | 745 | wfProfileOut( "$fname-checks" ); |
757 | 746 | wfProfileOut( $fname ); |
758 | 747 | return self::AS_ARTICLE_WAS_DELETED; |
759 | | -// return true; |
760 | 748 | } |
761 | 749 | |
762 | 750 | wfProfileOut( "$fname-checks" ); |
— | — | @@ -763,33 +751,37 @@ |
764 | 752 | # If article is new, insert it. |
765 | 753 | $aid = $this->mTitle->getArticleID( GAID_FOR_UPDATE ); |
766 | 754 | if ( 0 == $aid ) { |
| 755 | + |
767 | 756 | // Late check for create permission, just in case *PARANOIA* |
768 | 757 | if ( !$this->mTitle->userCan( 'create' ) ) { |
769 | 758 | wfDebug( "$fname: no create permission\n" ); |
| 759 | +// $this->noCreatePermission(); |
770 | 760 | wfProfileOut( $fname ); |
771 | 761 | return self::AS_NO_CREATE_PERMISSION; |
772 | | -// $this->noCreatePermission(); |
773 | | -// return; |
774 | 762 | } |
775 | 763 | |
776 | 764 | # Don't save a new article if it's blank. |
777 | 765 | if ( ( '' == $this->textbox1 ) ) { |
| 766 | +// $wgOut->redirect( $this->mTitle->getFullURL() ); |
778 | 767 | wfProfileOut( $fname ); |
779 | 768 | return self::AS_BLANK_ARTICLE; |
780 | | -// return false; |
781 | 769 | } |
782 | 770 | |
783 | 771 | $isComment=($this->section=='new'); |
784 | 772 | $this->mArticle->insertNewArticle( $this->textbox1, $this->summary, |
785 | 773 | $this->minoredit, $this->watchthis, false, $isComment); |
| 774 | + |
786 | 775 | wfProfileOut( $fname ); |
787 | 776 | return self::AS_SUCCESS_NEW_ARTICLE; |
788 | | -// return false; |
789 | 777 | } |
| 778 | + |
790 | 779 | # Article exists. Check for edit conflict. |
| 780 | + |
791 | 781 | $this->mArticle->clear(); # Force reload of dates, etc. |
792 | 782 | $this->mArticle->forUpdate( true ); # Lock the article |
| 783 | + |
793 | 784 | wfDebug("timestamp: {$this->mArticle->getTimestamp()}, edittime: {$this->edittime}\n"); |
| 785 | + |
794 | 786 | if( $this->mArticle->getTimestamp() != $this->edittime ) { |
795 | 787 | $this->isConflict = true; |
796 | 788 | if( $this->section == 'new' ) { |
— | — | @@ -807,6 +799,7 @@ |
808 | 800 | } |
809 | 801 | } |
810 | 802 | $userid = $wgUser->getID(); |
| 803 | + |
811 | 804 | if ( $this->isConflict) { |
812 | 805 | wfDebug( "EditPage::editForm conflict! getting section '$this->section' for time '$this->edittime' (article time '" . |
813 | 806 | $this->mArticle->getTimestamp() . "')\n" ); |
— | — | @@ -816,7 +809,6 @@ |
817 | 810 | wfDebug( "EditPage::editForm getting section '$this->section'\n" ); |
818 | 811 | $text = $this->mArticle->replaceSection( $this->section, $this->textbox1, $this->summary); |
819 | 812 | } |
820 | | - |
821 | 813 | if( is_null( $text ) ) { |
822 | 814 | wfDebug( "EditPage::editForm activating conflict; section replace failed.\n" ); |
823 | 815 | $this->isConflict = true; |
— | — | @@ -846,7 +838,6 @@ |
847 | 839 | if ( $this->isConflict ) { |
848 | 840 | wfProfileOut( $fname ); |
849 | 841 | return self::AS_CONFLICT_DETECTED; |
850 | | -// return true; |
851 | 842 | } |
852 | 843 | |
853 | 844 | $oldtext = $this->mArticle->getContent(); |
— | — | @@ -858,7 +849,6 @@ |
859 | 850 | $this->missingSummary = true; |
860 | 851 | wfProfileOut( $fname ); |
861 | 852 | return self::AS_SUMMARY_NEEDED; |
862 | | -// return( true ); |
863 | 853 | } |
864 | 854 | } |
865 | 855 | |
— | — | @@ -868,9 +858,9 @@ |
869 | 859 | $this->missingSummary = true; |
870 | 860 | wfProfileOut( $fname ); |
871 | 861 | return self::AS_SUMMARY_NEEDED; |
872 | | -// return( true ); |
873 | 862 | } |
874 | 863 | } |
| 864 | + |
875 | 865 | # All's well |
876 | 866 | wfProfileIn( "$fname-sectionanchor" ); |
877 | 867 | $sectionanchor = ''; |
— | — | @@ -878,7 +868,6 @@ |
879 | 869 | if ( $this->textbox1 == '' ) { |
880 | 870 | $this->missingComment = true; |
881 | 871 | return self::AS_TEXTBOX_EMPTY; |
882 | | -// return true; |
883 | 872 | } |
884 | 873 | if( $this->summary != '' ) { |
885 | 874 | $sectionanchor = $wgParser->guessSectionNameFromWikiText( $this->summary ); |
— | — | @@ -906,27 +895,25 @@ |
907 | 896 | // replace that into a duplicated mess. |
908 | 897 | $this->textbox1 = $text; |
909 | 898 | $this->section = ''; |
| 899 | + |
910 | 900 | // Check for length errors again now that the section is merged in |
911 | 901 | $this->kblength = (int)(strlen( $text ) / 1024); |
912 | 902 | if ( $this->kblength > $wgMaxArticleSize ) { |
913 | 903 | $this->tooBig = true; |
914 | 904 | wfProfileOut( $fname ); |
915 | 905 | return self::AS_MAX_ARTICLE_SIZE_EXCEDED; |
916 | | -// return true; |
917 | 906 | } |
918 | 907 | |
919 | 908 | # update the article here |
920 | 909 | if( $this->mArticle->updateArticle( $text, $this->summary, $this->minoredit, |
921 | 910 | $this->watchthis, '', $sectionanchor ) ) { |
922 | 911 | wfProfileOut( $fname ); |
923 | | -return self::AS_SUCCESS_UPDATE; |
924 | | -// return false; |
| 912 | + return self::AS_SUCCESS_UPDATE; |
925 | 913 | } else { |
926 | 914 | $this->isConflict = true; |
927 | 915 | } |
928 | 916 | wfProfileOut( $fname ); |
929 | 917 | return self::AS_END; |
930 | | -// return true; |
931 | 918 | } |
932 | 919 | |
933 | 920 | /** |
— | — | @@ -2205,8 +2192,7 @@ |
2206 | 2193 | // case DEFAULT: |
2207 | 2194 | // return true; |
2208 | 2195 | } |
| 2196 | + } |
2209 | 2197 | } |
2210 | 2198 | |
2211 | | -} |
2212 | 2199 | |
2213 | | - |
Index: branches/ApiEdit_Vodafone/includes/AutoLoader.php |
— | — | @@ -335,9 +335,10 @@ |
336 | 336 | 'ApiQueryUserInfo' => 'includes/api/ApiQueryUserInfo.php', |
337 | 337 | 'ApiQueryWatchlist' => 'includes/api/ApiQueryWatchlist.php', |
338 | 338 | 'ApiResult' => 'includes/api/ApiResult.php', |
339 | | - // Added by VF |
| 339 | + |
| 340 | + # Added by VF - Api Edit branch |
340 | 341 | 'ApiEditPage' => 'includes/api/ApiEditPage.php', |
341 | | - 'ApiRegUser' => 'includes/api/ApiRegUser.php', |
| 342 | + 'ApiRegUser' => 'includes/api/ApiRegUser.php', |
342 | 343 | 'ApiUploadFile' => 'includes/api/ApiUploadFile.php', |
343 | 344 | ); |
344 | 345 | |
— | — | @@ -388,6 +389,4 @@ |
389 | 390 | require( $file ); |
390 | 391 | } |
391 | 392 | } |
392 | | -} |
393 | | - |
394 | | - |
| 393 | +} |
\ No newline at end of file |