comment searching allows whitespace and allowed deleting old requests (closes #4, closes #2)

This commit is contained in:
Jacob G 2015-01-12 18:28:56 -05:00
parent e34ad0912e
commit 9cd536b43a
4 changed files with 24 additions and 5 deletions

View file

@ -46,6 +46,8 @@ class AccountConfirmSubmission {
return $this->holdRequest( $context ); return $this->holdRequest( $context );
} elseif ( $this->action === 'accept' ) { } elseif ( $this->action === 'accept' ) {
return $this->acceptRequest( $context ); return $this->acceptRequest( $context );
} elseif ($this->action === 'delete') {
return $this->deleteRequest($context);
} else { } else {
return array( 'accountconf_bad_action', $context->msg( 'confirmaccount-badaction' )->escaped() ); return array( 'accountconf_bad_action', $context->msg( 'confirmaccount-badaction' )->escaped() );
} }
@ -64,6 +66,17 @@ class AccountConfirmSubmission {
$dbw->commit(); $dbw->commit();
return array( true, null ); return array( true, null );
} }
protected function deleteRequest( IContextSource $context ) {
$dbw = wfGetDB( DB_MASTER );
$dbw->begin();
$ok = $this->accountReq->remove();
ConfirmAccount::clearAccountRequestCountCache();
$dbw->commit();
return array( true, null );
}
protected function rejectRequest( IContextSource $context ) { protected function rejectRequest( IContextSource $context ) {
$dbw = wfGetDB( DB_MASTER ); $dbw = wfGetDB( DB_MASTER );

View file

@ -104,7 +104,7 @@ class AccountRequestSubmission {
foreach ($matches[2] as $key => $val) { foreach ($matches[2] as $key => $val) {
$user = $matches[1][$key]; $user = $matches[1][$key];
$comment = trim($val); $comment = trim($val);
if (strtolower($user) == strtolower($this->userName) && $comment == $code) { if (strtolower($user) == strtolower(htmlspecialchars($this->userName)) && strstr($comment, $code)) {
$success = true; $success = true;
break; break;
} }

View file

@ -139,6 +139,7 @@ There may be contact lists on site that you can use if you want to know more abo
$2 $2
There may be contact lists on site that you can use if you want to know more about user account policy.', There may be contact lists on site that you can use if you want to know more about user account policy.',
); );
/** Message documentation (Message documentation) /** Message documentation (Message documentation)
@ -5726,7 +5727,7 @@ $2
Aquò permet dèsser sus la tièra dels contactes del site, se ne desiratz saber mai sus las règlas que concernisson los comptes.', Aquò permet dèsser sus la tièra dels contactes del site, se ne desiratz saber mai sus las règlas que concernisson los comptes.',
); );
/** Oriya (ିଆ) /** Oriya (ଡ଼ିଆ)
* @author Odisha1 * @author Odisha1
*/ */
$messages['or'] = array( $messages['or'] = array(

View file

@ -435,9 +435,14 @@ class ConfirmAccountsPage extends SpecialPage {
$form .= "<td>" . Xml::radio( 'wpSubmitType', 'hold', $this->submitType == 'hold', $form .= "<td>" . Xml::radio( 'wpSubmitType', 'hold', $this->submitType == 'hold',
array( 'id' => 'submitHold', 'onclick' => 'document.getElementById("wpComment").style.display="block"' ) ); array( 'id' => 'submitHold', 'onclick' => 'document.getElementById("wpComment").style.display="block"' ) );
$form .= ' ' . Xml::label( $this->msg( 'confirmaccount-hold' )->text(), 'submitHold' ) . "</td>\n"; $form .= ' ' . Xml::label( $this->msg( 'confirmaccount-hold' )->text(), 'submitHold' ) . "</td>\n";
$form .= "<td>" . Xml::radio( 'wpSubmitType', 'spam', $this->submitType == 'spam', if ($rejectTimestamp || $heldTimestamp) {
array( 'id' => 'submitSpam', 'onclick' => 'document.getElementById("wpComment").style.display="none"' ) ); $form .= "<td>" . Xml::radio( 'wpSubmitType', 'delete', $this->submitType == 'delete',
$form .= ' ' . Xml::label( $this->msg( 'confirmaccount-spam' )->text(), 'submitSpam' ) . "</td>\n"; array( 'id' => 'submitDelete', 'onclick' => 'document.getElementById("wpComment").style.display="block"' ) );
$form .= ' ' . Xml::label( $this->msg( 'delete' )->text(), 'submitDelete' ) . "</td>\n";
}
//$form .= "<td>" . Xml::radio( 'wpSubmitType', 'spam', $this->submitType == 'spam',
// array( 'id' => 'submitSpam', 'onclick' => 'document.getElementById("wpComment").style.display="none"' ) );
//$form .= ' ' . Xml::label( $this->msg( 'confirmaccount-spam' )->text(), 'submitSpam' ) . "</td>\n";
$form .= "</tr></table>"; $form .= "</tr></table>";
$form .= "<div id='wpComment'><p>" . $this->msg( 'confirmaccount-reason' )->escaped() . "</p>\n"; $form .= "<div id='wpComment'><p>" . $this->msg( 'confirmaccount-reason' )->escaped() . "</p>\n";
$form .= "<p><textarea name='wpReason' id='wpReason' rows='3' cols='80' style='width:80%; display=block;'>" . $form .= "<p><textarea name='wpReason' id='wpReason' rows='3' cols='80' style='width:80%; display=block;'>" .