Index: trunk/extensions/ConfirmAccount/ConfirmAccount_body.php |
— | — | @@ -57,10 +57,10 @@ |
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | | - function showForm( $msg='', $forgetFile=0 ) { |
| 61 | + function showForm( $msg='', $forgotFile=0 ) { |
62 | 62 | global $wgOut, $wgUser, $wgTitle, $wgAuth, $wgUseRealNamesOnly; |
63 | 63 | |
64 | | - $this->mForgotAttachment = $forgetFile; |
| 64 | + $this->mForgotAttachment = $forgotFile; |
65 | 65 | |
66 | 66 | $wgOut->setPagetitle( wfMsgHtml( "requestaccount" ) ); |
67 | 67 | # Output failure message if any |
— | — | @@ -579,6 +579,113 @@ |
580 | 580 | } |
581 | 581 | } |
582 | 582 | |
| 583 | + function showForm( $msg='' ) { |
| 584 | + global $wgOut, $wgTitle, $wgUser, $wgLang; |
| 585 | + |
| 586 | + # Output failure message |
| 587 | + if( $msg ) { |
| 588 | + $wgOut->addHTML( '<div class="errorbox">' . $msg . '</div><div class="visualClear"></div>' ); |
| 589 | + } |
| 590 | + $row = $this->getRequest(); |
| 591 | + if( !$row || $row->acr_rejected && !$this->showRejects ) { |
| 592 | + $wgOut->addHTML( wfMsgHtml('confirmaccount-badid') ); |
| 593 | + $wgOut->returnToMain( true, $wgTitle ); |
| 594 | + return; |
| 595 | + } |
| 596 | + |
| 597 | + $listLink = $this->skin->makeKnownLinkObj( $wgTitle, wfMsgHtml( 'confirmaccount-back' ) ); |
| 598 | + if( $this->showRejects ) { |
| 599 | + $listLink .= ' / '.$this->skin->makeKnownLinkObj( $wgTitle, wfMsgHtml( 'confirmaccount-back2' ), |
| 600 | + wfArrayToCGI( array('wpShowRejects' => 1 ) ) ); |
| 601 | + } |
| 602 | + $wgOut->setSubtitle( '<p>'.$listLink.'</p>' ); |
| 603 | + |
| 604 | + $wgOut->addWikiText( wfMsg( "confirmaccount-text" ) ); |
| 605 | + |
| 606 | + if( $this->showRejects ) { |
| 607 | + $time = $wgLang->timeanddate( wfTimestamp(TS_MW, $row->acr_rejected), true ); |
| 608 | + $wgOut->addHTML('<b>'.wfMsgExt( 'confirmaccount-reject', array('parseinline'), |
| 609 | + User::whoIs($row->acr_user), $time ).'</b>'); |
| 610 | + } else if( $row->acr_held ) { |
| 611 | + $time = $wgLang->timeanddate( wfTimestamp(TS_MW, $row->acr_held), true ); |
| 612 | + $wgOut->addHTML('<b>'.wfMsgExt( 'confirmaccount-held', array('parseinline'), |
| 613 | + User::whoIs($row->acr_user), $time ).'</b>'); |
| 614 | + } |
| 615 | + |
| 616 | + $action = $wgTitle->escapeLocalUrl( 'action=submit' ); |
| 617 | + $form = "<form name='accountconfirm' action='$action' method='post'><fieldset>"; |
| 618 | + $form .= '<legend>' . wfMsgHtml('requestaccount-legend1') . '</legend>'; |
| 619 | + $form .= '<table cellpadding=\'4\'>'; |
| 620 | + $form .= "<tr><td>".Xml::label( wfMsgHtml('username'), 'wpNewName' )."</td>"; |
| 621 | + $form .= "<td>".Xml::input( 'wpNewName', 30, $row->acr_name, array('id' => 'wpNewName') )."</td></tr>\n"; |
| 622 | + |
| 623 | + $econf = $row->acr_email_authenticated ? ' <strong>'.wfMsgHtml('confirmaccount-econf').'</strong>' : ''; |
| 624 | + $form .= "<tr><td>".wfMsgHtml('confirmaccount-email')."</td>"; |
| 625 | + $form .= "<td>".htmlspecialchars($row->acr_email).$econf."</td></tr>\n"; |
| 626 | + $form .= '</table></fieldset>'; |
| 627 | + |
| 628 | + $form .= '<fieldset>'; |
| 629 | + $form .= '<legend>' . wfMsgHtml('requestaccount-legend2') . '</legend>'; |
| 630 | + $form .= '<table cellpadding=\'4\'>'; |
| 631 | + $form .= "<tr><td>".wfMsgHtml('confirmaccount-real')."</td>"; |
| 632 | + $form .= "<td>".htmlspecialchars($row->acr_real_name)."</td></tr>\n"; |
| 633 | + $form .= '</table cellpadding=\'4\'>'; |
| 634 | + $form .= "<p>".wfMsgHtml('confirmaccount-bio')."</p>"; |
| 635 | + $form .= "<p><textarea tabindex='1' readonly name='wpBio' id='wpBio' rows='10' cols='80' style='width:100%'>" . |
| 636 | + htmlspecialchars($row->acr_bio) . |
| 637 | + "</textarea></p>\n"; |
| 638 | + $form .= '</fieldset>'; |
| 639 | + |
| 640 | + $form .= '<fieldset>'; |
| 641 | + $form .= '<legend>' . wfMsgHtml('requestaccount-legend3') . '</legend>'; |
| 642 | + $form .= '<p>'.wfMsgHtml('confirmaccount-attach') . ' '; |
| 643 | + if( $row->acr_filename ) { |
| 644 | + $form .= $this->skin->makeKnownLinkObj( $wgTitle, htmlspecialchars($row->acr_filename), |
| 645 | + 'file=' . $row->acr_storage_key ); |
| 646 | + } else { |
| 647 | + $form .= wfMsgHtml('confirmaccount-none'); |
| 648 | + } |
| 649 | + $form .= "</p><p>".wfMsgHtml('confirmaccount-notes')."</p>\n"; |
| 650 | + $form .= "<p><textarea tabindex='1' readonly name='wpNotes' id='wpNotes' rows='3' cols='80' style='width:100%'>" . |
| 651 | + htmlspecialchars($row->acr_notes) . |
| 652 | + "</textarea></p>\n"; |
| 653 | + $form .= "<p>".wfMsgHtml('confirmaccount-urls')."</p>\n"; |
| 654 | + $form .= "<p>".$this->parseLinks($row->acr_urls)."</p>"; |
| 655 | + if( $wgUser->isAllowed( 'requestips' ) ) { |
| 656 | + $blokip = SpecialPage::getTitleFor( 'blockip' ); |
| 657 | + $form .= "<p>".wfMsgHtml('confirmaccount-ip')." ".htmlspecialchars($row->acr_ip). |
| 658 | + " (" . $this->skin->makeKnownLinkObj( $blokip, wfMsgHtml('blockip'), |
| 659 | + 'ip=' . $row->acr_ip ).")</p>\n"; |
| 660 | + } |
| 661 | + $form .= '</fieldset>'; |
| 662 | + |
| 663 | + $form .= "<p>".wfMsgExt( 'confirmaccount-confirm', array('parse') )."</p>\n"; |
| 664 | + $form .= "<table cellpadding='5'><tr>"; |
| 665 | + $form .= "<td>".Xml::radio( 'wpSubmitType', 'accept', $this->submitType=='accept', array('id' => 'submitCreate') ); |
| 666 | + $form .= ' '.Xml::label( wfMsg('confirmaccount-create'), 'submitCreate' )."</td>\n"; |
| 667 | + $form .= "<td>".Xml::radio( 'wpSubmitType', 'reject', $this->submitType=='reject', array('id' => 'submitDeny') ); |
| 668 | + $form .= ' '.Xml::label( wfMsg('confirmaccount-deny'), 'submitDeny' )."</td>\n"; |
| 669 | + $form .= "<td>".Xml::radio( 'wpSubmitType', 'hold', $this->submitType=='hold', array('id' => 'submitHold') ); |
| 670 | + $form .= ' '.Xml::label( wfMsg('confirmaccount-hold'), 'submitHold' )."</td>\n"; |
| 671 | + $form .= "<td>".Xml::radio( 'wpSubmitType', 'spam', $this->submitType=='spam', array('id' => 'submitSpam') ); |
| 672 | + $form .= ' '.Xml::label( wfMsg('confirmaccount-spam'), 'submitSpam' )."</td>\n"; |
| 673 | + $form .= "</tr></table>"; |
| 674 | + |
| 675 | + $form .= "<p>".wfMsgHtml('confirmaccount-reason')."</p>\n"; |
| 676 | + $form .= "<p><textarea tabindex='1' name='wpReason' id='wpReason' rows='3' cols='80' style='width:80%'>" . |
| 677 | + htmlspecialchars($this->reason) . |
| 678 | + "</textarea></p>\n"; |
| 679 | + $form .= "<p>".Xml::submitButton( wfMsgHtml( 'confirmaccount-submit') )."</p>\n"; |
| 680 | + $form .= Xml::hidden( 'title', $wgTitle->getPrefixedUrl() )."\n"; |
| 681 | + $form .= Xml::hidden( 'action', 'reject' ); |
| 682 | + $form .= Xml::hidden( 'acrid', $row->acr_id ); |
| 683 | + $form .= Xml::hidden( 'wpShowRejects', $this->showRejects ); |
| 684 | + $form .= Xml::hidden( 'wpEditToken', $wgUser->editToken() )."\n"; |
| 685 | + $form .= '</form>'; |
| 686 | + |
| 687 | + $wgOut->addHTML( $form ); |
| 688 | + } |
| 689 | + |
583 | 690 | /** |
584 | 691 | * Show a private file requested by the visitor. |
585 | 692 | */ |
— | — | @@ -608,12 +715,12 @@ |
609 | 716 | return; |
610 | 717 | } |
611 | 718 | |
612 | | - if( $this->submitType == 'reject' ) { |
| 719 | + if( $this->submitType == 'reject' || $this->submitType == 'spam' ) { |
613 | 720 | # Make proxy user to email a rejection message :( |
614 | 721 | $u = User::newFromName( $row->acr_name, 'creatable' ); |
615 | 722 | $u->setEmail( $row->acr_email ); |
616 | | - # Do not send multiple times |
617 | | - if( !$row->acr_rejected ) { |
| 723 | + # Do not send multiple times, don't send for "spam" requests |
| 724 | + if( !$row->acr_rejected && $this->submitType != 'spam' ) { |
618 | 725 | if( $this->reason ) { |
619 | 726 | $result = $u->sendMail( wfMsg( 'confirmaccount-email-subj' ), |
620 | 727 | wfMsgExt( 'confirmaccount-email-body4', array('parsemag'), $u->getName(), $this->reason ) ); |
— | — | @@ -638,7 +745,7 @@ |
639 | 746 | array( 'acr_id' => $this->acrID, 'acr_deleted' => 0 ), |
640 | 747 | __METHOD__ ); |
641 | 748 | |
642 | | - $this->showSuccess( $action ); |
| 749 | + $this->showSuccess( $this->submitType ); |
643 | 750 | } else if( $this->submitType == 'accept' ) { |
644 | 751 | global $wgMakeUserPageFromBio, $wgAutoWelcomeNewUsers; |
645 | 752 | # Check if the name is to be overridden |
— | — | @@ -710,7 +817,7 @@ |
711 | 818 | wfMsg('confirmaccount-wsum'), EDIT_MINOR ); |
712 | 819 | } |
713 | 820 | |
714 | | - $this->showSuccess( $action, $user->getName() ); |
| 821 | + $this->showSuccess( $this->submitType, $user->getName() ); |
715 | 822 | } else if( $this->submitType == 'hold' ) { |
716 | 823 | global $wgUser; |
717 | 824 | # Make proxy user to email a message |
— | — | @@ -741,115 +848,12 @@ |
742 | 849 | return false; |
743 | 850 | } |
744 | 851 | } |
745 | | - $this->showSuccess( $action ); |
| 852 | + $this->showSuccess( $this->submitType ); |
746 | 853 | } else { |
747 | 854 | $this->showForm(); |
748 | 855 | } |
749 | 856 | } |
750 | 857 | |
751 | | - function showForm( $msg='' ) { |
752 | | - global $wgOut, $wgTitle, $wgUser, $wgLang; |
753 | | - |
754 | | - # Output failure message |
755 | | - if( $msg ) { |
756 | | - $wgOut->addHTML( '<div class="errorbox">' . $msg . '</div><div class="visualClear"></div>' ); |
757 | | - } |
758 | | - $row = $this->getRequest(); |
759 | | - if( !$row || $row->acr_rejected && !$this->showRejects ) { |
760 | | - $wgOut->addHTML( wfMsgHtml('confirmaccount-badid') ); |
761 | | - $wgOut->returnToMain( true, $wgTitle ); |
762 | | - return; |
763 | | - } |
764 | | - |
765 | | - $listLink = $this->skin->makeKnownLinkObj( $wgTitle, wfMsgHtml( 'confirmaccount-back' ) ); |
766 | | - if( $this->showRejects ) { |
767 | | - $listLink .= ' / '.$this->skin->makeKnownLinkObj( $wgTitle, wfMsgHtml( 'confirmaccount-back2' ), |
768 | | - wfArrayToCGI( array('wpShowRejects' => 1 ) ) ); |
769 | | - } |
770 | | - $wgOut->setSubtitle( '<p>'.$listLink.'</p>' ); |
771 | | - |
772 | | - $wgOut->addWikiText( wfMsg( "confirmaccount-text" ) ); |
773 | | - |
774 | | - if( $this->showRejects ) { |
775 | | - $time = $wgLang->timeanddate( wfTimestamp(TS_MW, $row->acr_rejected), true ); |
776 | | - $wgOut->addHTML('<b>'.wfMsgExt( 'confirmaccount-reject', array('parseinline'), |
777 | | - User::whoIs($row->acr_user), $time ).'</b>'); |
778 | | - } else if( $row->acr_held ) { |
779 | | - $time = $wgLang->timeanddate( wfTimestamp(TS_MW, $row->acr_held), true ); |
780 | | - $wgOut->addHTML('<b>'.wfMsgExt( 'confirmaccount-held', array('parseinline'), |
781 | | - User::whoIs($row->acr_user), $time ).'</b>'); |
782 | | - } |
783 | | - |
784 | | - $action = $wgTitle->escapeLocalUrl( 'action=submit' ); |
785 | | - $form = "<form name='accountconfirm' action='$action' method='post'><fieldset>"; |
786 | | - $form .= '<legend>' . wfMsgHtml('requestaccount-legend1') . '</legend>'; |
787 | | - $form .= '<table cellpadding=\'4\'>'; |
788 | | - $form .= "<tr><td>".Xml::label( wfMsgHtml('username'), 'wpNewName' )."</td>"; |
789 | | - $form .= "<td>".Xml::input( 'wpNewName', 30, $row->acr_name, array('id' => 'wpNewName') )."</td></tr>\n"; |
790 | | - |
791 | | - $econf = $row->acr_email_authenticated ? ' <strong>'.wfMsgHtml('confirmaccount-econf').'</strong>' : ''; |
792 | | - $form .= "<tr><td>".wfMsgHtml('confirmaccount-email')."</td>"; |
793 | | - $form .= "<td>".htmlspecialchars($row->acr_email).$econf."</td></tr>\n"; |
794 | | - $form .= '</table></fieldset>'; |
795 | | - |
796 | | - $form .= '<fieldset>'; |
797 | | - $form .= '<legend>' . wfMsgHtml('requestaccount-legend2') . '</legend>'; |
798 | | - $form .= '<table cellpadding=\'4\'>'; |
799 | | - $form .= "<tr><td>".wfMsgHtml('confirmaccount-real')."</td>"; |
800 | | - $form .= "<td>".htmlspecialchars($row->acr_real_name)."</td></tr>\n"; |
801 | | - $form .= '</table cellpadding=\'4\'>'; |
802 | | - $form .= "<p>".wfMsgHtml('confirmaccount-bio')."</p>"; |
803 | | - $form .= "<p><textarea tabindex='1' readonly name='wpBio' id='wpBio' rows='10' cols='80' style='width:100%'>" . |
804 | | - htmlspecialchars($row->acr_bio) . |
805 | | - "</textarea></p>\n"; |
806 | | - $form .= '</fieldset>'; |
807 | | - |
808 | | - $form .= '<fieldset>'; |
809 | | - $form .= '<legend>' . wfMsgHtml('requestaccount-legend3') . '</legend>'; |
810 | | - $form .= '<p>'.wfMsgHtml('confirmaccount-attach') . ' '; |
811 | | - if( $row->acr_filename ) { |
812 | | - $form .= $this->skin->makeKnownLinkObj( $wgTitle, htmlspecialchars($row->acr_filename), |
813 | | - 'file=' . $row->acr_storage_key ); |
814 | | - } else { |
815 | | - $form .= wfMsgHtml('confirmaccount-none'); |
816 | | - } |
817 | | - $form .= "</p><p>".wfMsgHtml('confirmaccount-notes')."</p>\n"; |
818 | | - $form .= "<p><textarea tabindex='1' readonly name='wpNotes' id='wpNotes' rows='3' cols='80' style='width:100%'>" . |
819 | | - htmlspecialchars($row->acr_notes) . |
820 | | - "</textarea></p>\n"; |
821 | | - $form .= "<p>".wfMsgHtml('confirmaccount-urls')."</p>\n"; |
822 | | - $form .= "<p>".$this->parseLinks($row->acr_urls)."</p>"; |
823 | | - if( $wgUser->isAllowed( 'requestips' ) ) { |
824 | | - $blokip = SpecialPage::getTitleFor( 'blockip' ); |
825 | | - $form .= "<p>".wfMsgHtml('confirmaccount-ip')." ".htmlspecialchars($row->acr_ip). |
826 | | - " (" . $this->skin->makeKnownLinkObj( $blokip, wfMsgHtml('blockip'), |
827 | | - 'ip=' . $row->acr_ip ).")</p>\n"; |
828 | | - } |
829 | | - $form .= '</fieldset>'; |
830 | | - |
831 | | - $form .= "<p>".wfMsgExt( 'confirmaccount-confirm', array('parse') )."</p>\n"; |
832 | | - $form .= "<p>".Xml::radio( 'wpSubmitType', 'accept', $this->submitType=='accept', array('id' => 'submitCreate') ); |
833 | | - $form .= ' '.Xml::label( wfMsg('confirmaccount-create'), 'submitCreate' )."</p>\n"; |
834 | | - $form .= "<p>".Xml::radio( 'wpSubmitType', 'reject', $this->submitType=='reject', array('id' => 'submitDeny') ); |
835 | | - $form .= ' '.Xml::label( wfMsg('confirmaccount-deny'), 'submitDeny' )."</p>\n"; |
836 | | - $form .= "<p>".Xml::radio( 'wpSubmitType', 'hold', $this->submitType=='hold', array('id' => 'submitHold') ); |
837 | | - $form .= ' '.Xml::label( wfMsg('confirmaccount-hold'), 'submitHold' )."</p>\n"; |
838 | | - |
839 | | - $form .= "<p>".wfMsgHtml('confirmaccount-reason')."</p>\n"; |
840 | | - $form .= "<p><textarea tabindex='1' name='wpReason' id='wpReason' rows='3' cols='80' style='width:80%'>" . |
841 | | - htmlspecialchars($this->reason) . |
842 | | - "</textarea></p>\n"; |
843 | | - $form .= "<p>".Xml::submitButton( wfMsgHtml( 'confirmaccount-submit') )."</p>\n"; |
844 | | - $form .= Xml::hidden( 'title', $wgTitle->getPrefixedUrl() )."\n"; |
845 | | - $form .= Xml::hidden( 'action', 'reject' ); |
846 | | - $form .= Xml::hidden( 'acrid', $row->acr_id ); |
847 | | - $form .= Xml::hidden( 'wpShowRejects', $this->showRejects ); |
848 | | - $form .= Xml::hidden( 'wpEditToken', $wgUser->editToken() )."\n"; |
849 | | - $form .= '</form>'; |
850 | | - |
851 | | - $wgOut->addHTML( $form ); |
852 | | - } |
853 | | - |
854 | 858 | /** |
855 | 859 | * Extract a list of all recognized HTTP links in the text. |
856 | 860 | * @param string $text |
— | — | @@ -902,13 +906,15 @@ |
903 | 907 | global $wgOut, $wgTitle; |
904 | 908 | |
905 | 909 | $wgOut->setPagetitle( wfMsgHtml('actioncomplete') ); |
906 | | - if( $this->submitType == 'accept' ) |
| 910 | + if( $this->submitType == 'accept' ) { |
907 | 911 | $wgOut->addWikiText( wfMsg( "confirmaccount-acc", $name ) ); |
908 | | - else if( $this->submitType == 'reject' ) |
| 912 | + } else if( $this->submitType == 'reject' || $this->submitType == 'spam' ) { |
909 | 913 | $wgOut->addWikiText( wfMsg( "confirmaccount-rej" ) ); |
910 | | - else |
| 914 | + } else { |
911 | 915 | $wgOut->redirect( $wgTitle->getFullUrl() ); |
912 | | - |
| 916 | + return; |
| 917 | + } |
| 918 | + # Give link to see other requests |
913 | 919 | $wgOut->returnToMain( true, $wgTitle ); |
914 | 920 | } |
915 | 921 | |
— | — | @@ -1062,6 +1068,7 @@ |
1063 | 1069 | $tables[] = 'user'; |
1064 | 1070 | $conds[] = 'acr_user = user_id'; |
1065 | 1071 | $fields[] = 'user_name'; |
| 1072 | + $fields[] = 'acr_rejected'; |
1066 | 1073 | } |
1067 | 1074 | return array( |
1068 | 1075 | 'tables' => $tables, |
Index: trunk/extensions/ConfirmAccount/ConfirmAccount.i18n.php |
— | — | @@ -97,7 +97,8 @@ |
98 | 98 | 'confirmaccount-held' => '(marked "on hold" by [[User:$1|$1]] on $2)', |
99 | 99 | 'confirmaccount-create' => 'Accept (create account)', |
100 | 100 | 'confirmaccount-deny' => 'Reject (delist)', |
101 | | - 'confirmaccount-hold' => 'Mark as "on hold"', |
| 101 | + 'confirmaccount-hold' => 'Hold', |
| 102 | + 'confirmaccount-spam' => 'Spam (don\'t send email)', |
102 | 103 | 'confirmaccount-reason' => 'Comment (will be included in email):', |
103 | 104 | 'confirmaccount-ip' => 'IP address:', |
104 | 105 | 'confirmaccount-submit' => 'Confirm', |