Merge pull request #4 from jacob-g/master

Lots of improvements!
This commit is contained in:
seotts 2015-01-19 12:06:47 -06:00
commit b7a8982fbe
11 changed files with 4923 additions and 4879 deletions

View file

@ -1,118 +1,120 @@
<?php <?php
# ######## Configuration variables ######## # ######## Configuration variables ########
# IMPORTANT: DO NOT EDIT THIS FILE # IMPORTANT: DO NOT EDIT THIS FILE
# When configuring globals, set them at LocalSettings.php instead # When configuring globals, set them at LocalSettings.php instead
# Set the person's bio as their userpage? # Set the person's bio as their userpage?
$wgMakeUserPageFromBio = true; $wgMakeUserPageFromBio = true;
# Text to add to bio pages if the above option is on # Text to add to bio pages if the above option is on
$wgAutoUserBioText = ''; $wgAutoUserBioText = '';
# Create a user talk page with a welcome message for accepted users. # Create a user talk page with a welcome message for accepted users.
# The message can be customized by editing MediaWiki:confirmaccount-welc. # The message can be customized by editing MediaWiki:confirmaccount-welc.
$wgAutoWelcomeNewUsers = true; $wgAutoWelcomeNewUsers = true;
# How long to store rejected requests # How long to store rejected requests
$wgRejectedAccountMaxAge = 7 * 24 * 3600; // 1 week $wgRejectedAccountMaxAge = 7 * 24 * 3600; // 1 week
# How long after accounts have been requested/held before they count as 'rejected' # How long after accounts have been requested/held before they count as 'rejected'
$wgConfirmAccountRejectAge = 30 * 24 * 3600; // 1 month $wgConfirmAccountRejectAge = 30 * 24 * 3600; // 1 month
# How many requests can an IP make at once? # How many requests can an IP make at once?
$wgAccountRequestThrottle = 1; $wgAccountRequestThrottle = 1;
# Can blocked users with "prevent account creation" request accounts? # Can blocked users with "prevent account creation" request accounts?
$wgAccountRequestWhileBlocked = false; $wgAccountRequestWhileBlocked = false;
# Which form elements to show at Special:RequestAccount # Which form elements to show at Special:RequestAccount
$wgConfirmAccountRequestFormItems = array( $wgConfirmAccountRequestFormItems = array(
# Let users make names other than their "real name" # Let users make names other than their "real name"
'UserName' => array( 'enabled' => true ), 'UserName' => array( 'enabled' => true ),
# Real name of user # Real name of user
'RealName' => array( 'enabled' => false ), 'RealName' => array( 'enabled' => false ),
# Biographical info # Biographical info
'Biography' => array( 'enabled' => false, 'minWords' => 0 ), 'Biography' => array( 'enabled' => false, 'minWords' => 0 ),
# Interest checkboxes (defined in MediaWiki:requestaccount-areas) # Interest checkboxes (defined in MediaWiki:requestaccount-areas)
'AreasOfInterest' => array( 'enabled' => true ), 'AreasOfInterest' => array( 'enabled' => true ),
# CV/resume attachment option # CV/resume attachment option
'CV' => array( 'enabled' => false ), 'CV' => array( 'enabled' => false ),
# Additional non-public info for reviewer # Additional non-public info for reviewer
'Notes' => array( 'enabled' => true ), 'Notes' => array( 'enabled' => true ),
# Option to place web URLs that establish the user # Option to place web URLs that establish the user
'Links' => array( 'enabled' => false ), 'Links' => array( 'enabled' => false ),
# Terms of Service checkbox # Terms of Service checkbox
'TermsOfService' => array( 'enabled' => true ), 'TermsOfService' => array( 'enabled' => true ),
); );
# If files can be attached, what types can be used? (MIME data is checked) # If files can be attached, what types can be used? (MIME data is checked)
$wgAccountRequestExts = array( 'txt', 'pdf', 'doc', 'latex', 'rtf', 'text', 'wp', 'wpd', 'sxw' ); $wgAccountRequestExts = array( 'txt', 'pdf', 'doc', 'latex', 'rtf', 'text', 'wp', 'wpd', 'sxw' );
# Prospective account request types. # Prospective account request types.
# Format is an array of (integer => (subpage param,user group,autotext)) pairs. # Format is an array of (integer => (subpage param,user group,autotext)) pairs.
# The integer keys enumerate the request types. The key for a type should not change. # The integer keys enumerate the request types. The key for a type should not change.
# Each type has its own request queue at Special:ConfirmAccount/<subpage param>. # Each type has its own request queue at Special:ConfirmAccount/<subpage param>.
# When a request of a certain type is approved, the new user: # When a request of a certain type is approved, the new user:
# (a) is placed in the <user group> group (if not User or *) # (a) is placed in the <user group> group (if not User or *)
# (b) has <autotext> appended to his or her user page # (b) has <autotext> appended to his or her user page
$wgAccountRequestTypes = array( $wgAccountRequestTypes = array(
0 => array( 'authors', 'user', null ) 0 => array( 'authors', 'user', null )
); );
# If set, will add {{DEFAULTSORT:sortkey}} to userpages for auto-categories. # If set, will add {{DEFAULTSORT:sortkey}} to userpages for auto-categories.
# The sortkey will be made by doing a regex search and replace on the title. # The sortkey will be made by doing a regex search and replace on the title.
# Set this variable to false to avoid sortkey use. # Set this variable to false to avoid sortkey use.
$wgConfirmAccountSortkey = false; $wgConfirmAccountSortkey = false;
// For example, the below will do {{DEFAULTSORT:firstname, lastname}} // For example, the below will do {{DEFAULTSORT:firstname, lastname}}
# $wgConfirmAccountSortkey = array( '/^(.+) ([^ ]+)$/', '$2, $1' ); # $wgConfirmAccountSortkey = array( '/^(.+) ([^ ]+)$/', '$2, $1' );
# IMPORTANT: do we store the user's notes and credentials # IMPORTANT: do we store the user's notes and credentials
# for sucessful account request? This will be stored indefinetely # for sucessful account request? This will be stored indefinetely
# and will be accessible to users with crediential lookup permissions # and will be accessible to users with crediential lookup permissions
$wgConfirmAccountSaveInfo = true; $wgConfirmAccountSaveInfo = true;
# Send an email to this address when account requestors confirm their email. # Send an email to this address when account requestors confirm their email.
# Set to false to skip this # Set to false to skip this
$wgConfirmAccountContact = false; $wgConfirmAccountContact = false;
# If ConfirmEdit is installed and set to trigger for createaccount, # If ConfirmEdit is installed and set to trigger for createaccount,
# inject catpchas for requests too? # inject catpchas for requests too?
$wgConfirmAccountCaptchas = true; $wgConfirmAccountCaptchas = true;
# Storage repos. Has B/C for when this used FileStore. # Storage repos. Has B/C for when this used FileStore.
$wgConfirmAccountFSRepos = array( $wgConfirmAccountFSRepos = array(
'accountreqs' => array( # Location of attached files for pending requests 'accountreqs' => array( # Location of attached files for pending requests
'name' => 'accountreqs', 'name' => 'accountreqs',
'directory' => isset( $wgFileStore['accountreqs'] ) ? 'directory' => isset( $wgFileStore['accountreqs'] ) ?
$wgFileStore['accountreqs']['directory'] : "{$IP}/images/accountreqs", $wgFileStore['accountreqs']['directory'] : "{$IP}/images/accountreqs",
'url' => isset( $wgFileStore['accountreqs'] ) ? 'url' => isset( $wgFileStore['accountreqs'] ) ?
$wgFileStore['accountreqs']['url'] : null, $wgFileStore['accountreqs']['url'] : null,
'hashLevels' => isset( $wgFileStore['accountreqs'] ) ? 'hashLevels' => isset( $wgFileStore['accountreqs'] ) ?
$wgFileStore['accountreqs']['hash'] : 3 $wgFileStore['accountreqs']['hash'] : 3
), ),
'accountcreds' => array( # Location of credential files 'accountcreds' => array( # Location of credential files
'name' => 'accountcreds', 'name' => 'accountcreds',
'directory' => isset( $wgFileStore['accountcreds'] ) ? 'directory' => isset( $wgFileStore['accountcreds'] ) ?
$wgFileStore['accountcreds']['directory'] : "{$IP}/images/accountcreds", $wgFileStore['accountcreds']['directory'] : "{$IP}/images/accountcreds",
'url' => isset( $wgFileStore['accountcreds'] ) ? 'url' => isset( $wgFileStore['accountcreds'] ) ?
$wgFileStore['accountcreds']['url'] : null, $wgFileStore['accountcreds']['url'] : null,
'hashLevels' => isset( $wgFileStore['accountcreds'] ) ? 'hashLevels' => isset( $wgFileStore['accountcreds'] ) ?
$wgFileStore['accountcreds']['hash'] : 3 $wgFileStore['accountcreds']['hash'] : 3
) )
); );
# Restrict account creation # Restrict account creation
$wgGroupPermissions['*']['createaccount'] = false; $wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['user']['createaccount'] = false; $wgGroupPermissions['user']['createaccount'] = false;
# Grant account queue rights # Grant account queue rights
$wgGroupPermissions['bureaucrat']['confirmaccount'] = true; $wgGroupPermissions['bureaucrat']['confirmaccount'] = true;
# This right has the request IP show when confirming accounts # This right has the request IP show when confirming accounts
$wgGroupPermissions['bureaucrat']['requestips'] = true; $wgGroupPermissions['bureaucrat']['requestips'] = true;
# If credentials are stored, this right lets users look them up # If credentials are stored, this right lets users look them up - this just means being able to see the user's request notes
$wgGroupPermissions['bureaucrat']['lookupcredentials'] = true; $wgGroupPermissions['bureaucrat']['lookupcredentials'] = true;
$wgGroupPermissions['sysop']['lookupcredentials'] = true;
# Show notice for open requests to admins? $wgGroupPermissions['Experienced_Wikians']['lookupcredentials'] = true;
# This is cached, but still can be expensive on sites with thousands of requests.
$wgConfirmAccountNotice = true; # Show notice for open requests to admins?
# This is cached, but still can be expensive on sites with thousands of requests.
# End of configuration variables. $wgConfirmAccountNotice = true;
# ########
# End of configuration variables.
# ########

View file

@ -2,7 +2,7 @@
ALTER TABLE /*$wgDBprefix*/account_requests ALTER TABLE /*$wgDBprefix*/account_requests
ADD acr_type tinyint(255) unsigned NOT NULL default 0, ADD acr_type tinyint(255) unsigned NOT NULL default 0,
DROP INDEX IF EXISTS acr_deleted_reg, DROP INDEX acr_deleted_reg,
ADD INDEX acr_type_del_reg (acr_type,acr_deleted,acr_registration); ADD INDEX acr_type_del_reg (acr_type,acr_deleted,acr_registration);
-- This stores all of credential information -- This stores all of credential information

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 );
@ -122,7 +135,7 @@ class AccountConfirmSubmission {
} }
# Send out a request hold email... # Send out a request hold email...
$result = $u->sendMail( /*$result = $u->sendMail(
$context->msg( 'confirmaccount-email-subj' )->inContentLanguage()->text(), $context->msg( 'confirmaccount-email-subj' )->inContentLanguage()->text(),
$context->msg( 'confirmaccount-email-body5', $u->getName(), $this->reason )->inContentLanguage()->text() $context->msg( 'confirmaccount-email-body5', $u->getName(), $this->reason )->inContentLanguage()->text()
); );
@ -130,7 +143,7 @@ class AccountConfirmSubmission {
$dbw->rollback(); $dbw->rollback();
return array( 'accountconf_mailerror', return array( 'accountconf_mailerror',
$context->msg( 'mailerror' )->rawParams( $context->getOutput()->parse( $result->getWikiText() ) )->text() ); $context->msg( 'mailerror' )->rawParams( $context->getOutput()->parse( $result->getWikiText() ) )->text() );
} }*/
# Clear cache for notice of how many account requests there are # Clear cache for notice of how many account requests there are
ConfirmAccount::clearAccountRequestCountCache(); ConfirmAccount::clearAccountRequestCountCache();
@ -433,10 +446,14 @@ class AccountConfirmSubmission {
global $wgAutoWelcomeNewUsers; global $wgAutoWelcomeNewUsers;
if ( $wgAutoWelcomeNewUsers ) { if ( $wgAutoWelcomeNewUsers ) {
$msg = "confirmaccount-welc-pos{$this->type}"; if (trim($this->reason) == '') {
$welcome = wfEmptyMsg( $msg ) $msg = "confirmaccount-welc-pos{$this->type}";
? wfMessage( 'confirmaccount-welc' )->text() $welcome = wfEmptyMsg( $msg )
: wfMessage( $msg )->text(); // custom message ? wfMessage( 'confirmaccount-welc' )->text()
: wfMessage( $msg )->text(); // custom message
} else {
$welcome = $this->reason;
}
# Add user welcome message! # Add user welcome message!
$article = new WikiPage( $user->getTalkPage() ); $article = new WikiPage( $user->getTalkPage() );
$article->doEdit( $article->doEdit(

View file

@ -24,7 +24,7 @@ class AccountRequestSubmission {
protected $attachmentDidNotForget; // user already saw "please re-attach" notice protected $attachmentDidNotForget; // user already saw "please re-attach" notice
protected $attachmentSize; // bytes size of file protected $attachmentSize; // bytes size of file
protected $attachmentTempPath; // tmp path file was uploaded to FS protected $attachmentTempPath; // tmp path file was uploaded to FS
public function __construct( User $requester, array $params ) { public function __construct( User $requester, array $params ) {
$this->requester = $requester; $this->requester = $requester;
$this->userName = trim( $params['userName'] ); $this->userName = trim( $params['userName'] );
@ -90,10 +90,13 @@ class AccountRequestSubmission {
} }
//before we continue, verify user //before we continue, verify user
$code = sha1($_SERVER['REMOTE_ADDR'] . date('m')); //the project link is stored in the interface, so splice the URL out of it (it should be the only decimal there)
$data = file_get_contents('http://scratch.mit.edu/site-api/comments/project/10135908/?page=1&salt=' . md5(time())); //add the salt so it doesn't cache $project_link = $context->msg('requestaccount-project-link')->text();
preg_match('%(\d+)%', $project_link, $matches);
$code = $context->getRequest()->getSessionData('confirmaccount-code');
$data = file_get_contents('http://scratch.mit.edu/site-api/comments/project/' . $matches[1] . '/?page=1&salt=' . md5(time())); //add the salt so it doesn't cache
if (!$data) { if (!$data) {
return array('api_failed', 'Accessing the API to verify your registration failed. Please try again later.'); return array('api_failed', $context->msg('requestaccount-api-failed'));
return; return;
} }
$success = false; $success = false;
@ -101,18 +104,22 @@ 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;
} }
} }
if ($_POST['pwd1'] != $_POST['pwd2']) { if ($_POST['pwd1'] != $_POST['pwd2']) {
return array('pwds_no_match', 'The passwords did not match.'); return array('pwds_no_match', $context->msg('badretype'));
} }
if (strlen($_POST['pwd1']) <= 4) {
return array('pwd_too_short', $context->msg('passwordtooshort', 5));
}
if (!$success) { if (!$success) {
return array('no_comment', 'It does not appear you commented the verification code on the specified project. Please try again.'); return array('no_comment', $context->msg('requestaccount-nocomment-error'));
} }
$u = User::newFromName( $this->userName, 'creatable' ); $u = User::newFromName( $this->userName, 'creatable' );

View file

@ -64,11 +64,11 @@ class ConfirmAccountUIHooks {
if ( !$title->isSpecial( 'Recentchanges' ) && !$title->isSpecial( 'Watchlist' ) ) { if ( !$title->isSpecial( 'Recentchanges' ) && !$title->isSpecial( 'Watchlist' ) ) {
return true; return true;
} }
$count = ConfirmAccount::getOpenEmailConfirmedCount( '*' ); $count = ConfirmAccount::getOpenRequestCount( '*' );
if ( $count > 0 ) { if ( $count['open'] > 0 ) {
$out->prependHtml( $out->prependHtml(
'<div id="mw-confirmaccount-msg" class="plainlinks mw-confirmaccount-bar">' . '<div id="mw-confirmaccount-msg" class="plainlinks mw-confirmaccount-bar">' .
$context->msg( 'confirmaccount-newrequests' )->numParams( $count )->parse() . $context->msg( 'confirmaccount-newrequests' )->numParams( $count['open'] )->parse() .
'</div>' '</div>'
); );

View file

@ -10,7 +10,7 @@ $messages = array();
$messages['en'] = array( $messages['en'] = array(
# Site message for admins # Site message for admins
'confirmaccount-newrequests' => '\'\'\'$1\'\'\' open e-mail confirmed [[Special:ConfirmAccounts|account {{PLURAL:$1|request is pending|requests are pending}}]]. \'\'\'Your attention is needed!\'\'\'', 'confirmaccount-newrequests' => '\'\'\'$1\'\'\' open [[Special:ConfirmAccounts|account {{PLURAL:$1|request is pending|requests are pending}}]]. \'\'\'Your attention is needed!\'\'\'',
# Add to Special:Login # Add to Special:Login
'requestaccount-loginnotice' => 'To obtain a user account, you must \'\'\'[[Special:RequestAccount|request one]]\'\'\'.', 'requestaccount-loginnotice' => 'To obtain a user account, you must \'\'\'[[Special:RequestAccount|request one]]\'\'\'.',

View file

@ -28,10 +28,6 @@ They can still be approved into accounts.',
'confirmaccount-text' => 'This is a pending request for a user account at \'\'\'{{SITENAME}}\'\'\'. 'confirmaccount-text' => 'This is a pending request for a user account at \'\'\'{{SITENAME}}\'\'\'.
Carefully review the below information. Carefully review the below information.
If you are approving this request, use the position dropdown to set the account status of the user.
Edits made to the application biography will not affect any permanent credential storage.
Note that you can choose to create the account under a different username.
Use this only to avoid collisions with other names.
If you simply leave this page without confirming or denying this request, it will remain pending.', If you simply leave this page without confirming or denying this request, it will remain pending.',
'confirmaccount-none-o' => 'There are currently no open pending account requests in this list.', 'confirmaccount-none-o' => 'There are currently no open pending account requests in this list.',
@ -139,6 +135,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 +5723,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(

File diff suppressed because it is too large Load diff

View file

@ -295,13 +295,13 @@ class ConfirmAccountsPage extends SpecialPage {
$form .= '<legend>' . $this->msg( 'confirmaccount-leg-user' )->escaped() . '</legend>'; $form .= '<legend>' . $this->msg( 'confirmaccount-leg-user' )->escaped() . '</legend>';
$form .= '<table cellpadding=\'4\'>'; $form .= '<table cellpadding=\'4\'>';
$form .= "<tr><td>" . Xml::label( $this->msg( 'username' )->text(), 'wpNewName' ) . "</td>"; $form .= "<tr><td>" . Xml::label( $this->msg( 'username' )->text(), 'wpNewName' ) . "</td>";
$form .= "<td>" . Xml::input( 'wpNewName', 30, $this->reqUsername, array( 'id' => 'wpNewName' ) ) . "</td></tr>\n"; $form .= '<td>' . Xml::input( 'wpNewName', 30, $this->reqUsername, array( 'id' => 'wpNewName', 'type' => 'hidden' ) ) . ' <a href="http://scratch.mit.edu/users/' . htmlspecialchars(str_replace(' ', '_', $this->reqUsername)) . '">' . htmlspecialchars($this->reqUsername) . '</a></td></tr>' . "\n";
$econf = ''; $econf = '';
if ( $accountReq->getEmailAuthTimestamp() ) { /*if ( $accountReq->getEmailAuthTimestamp() ) {
$econf = ' <strong>' . $this->msg( 'confirmaccount-econf' )->escaped() . '</strong>'; $econf = ' <strong>' . $this->msg( 'confirmaccount-econf' )->escaped() . '</strong>';
} }
$form .= "<tr><td>" . $this->msg( 'confirmaccount-email' )->escaped() . "</td>"; $form .= "<tr><td>" . $this->msg( 'confirmaccount-email' )->escaped() . "</td>";
$form .= "<td>" . htmlspecialchars( $accountReq->getEmail() ) . $econf . "</td></tr>\n"; $form .= "<td>" . htmlspecialchars( $accountReq->getEmail() ) . $econf . "</td></tr>\n";*/
if ( count( $wgAccountRequestTypes ) > 1 ) { if ( count( $wgAccountRequestTypes ) > 1 ) {
$options = array(); $options = array();
$form .= "<tr><td><strong>" . $this->msg( 'confirmaccount-reqtype' )->escaped() . "</strong></td><td>"; $form .= "<tr><td><strong>" . $this->msg( 'confirmaccount-reqtype' )->escaped() . "</strong></td><td>";
@ -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;'>" .
@ -661,8 +666,8 @@ class ConfirmAccountsPage extends SpecialPage {
} }
} }
# Every 30th view, prune old deleted items # Every 10th view, prune old deleted items
if ( 0 == mt_rand( 0, 29 ) ) { if ( 0 == mt_rand( 0, 10 ) ) {
ConfirmAccount::runAutoMaintenance(); ConfirmAccount::runAutoMaintenance();
} }
} }

View file

@ -92,6 +92,12 @@ class RequestAccountPage extends SpecialPage {
protected function showForm( $msg = '', $forgotFile = 0 ) { protected function showForm( $msg = '', $forgotFile = 0 ) {
global $wgAccountRequestTypes, $wgMakeUserPageFromBio; global $wgAccountRequestTypes, $wgMakeUserPageFromBio;
//generate the codes randomly, and generate a new one every two hours in case the code gets censored for some reason or any other issue related to the code
if (!$this->getRequest()->getSessionData('confirmaccount-code') || $this->getRequest()->getSessionData('confirmaccount-time') < time() - 60 * 60 * 2) {
$this->getRequest()->setSessionData('confirmaccount-code', sha1(rand(1,999999999)));
$this->getRequest()->setSessionData('confirmaccount-time', time());
}
$reqUser = $this->getUser(); $reqUser = $this->getUser();
$this->mForgotAttachment = $forgotFile; $this->mForgotAttachment = $forgotFile;
@ -211,26 +217,26 @@ class RequestAccountPage extends SpecialPage {
//Scratch user verification //Scratch user verification
$form .= '<fieldset>'; $form .= '<fieldset>';
$form .= '<legend>User verification</legend>'; $form .= '<legend>' . $this->msg('requestaccount-user-verification') . '</legend>';
$form .= '<p>Please go to the <a href="http://scratch.mit.edu/projects/10135908/">user verification project</a> and comment the following code:<br /><b>' . sha1($_SERVER['REMOTE_ADDR'] . date('m')) . '</b></p> $form .= '<p>' . $this->msg('requestaccount-project-info', $this->msg('requestaccount-project-link')->text(), $this->getRequest()->getSessionData('confirmaccount-code')) . '</p>
<p><b>Note:</b>If you are having problems with User verification not working, please see our <a href="http://wiki.scratch.mit.edu/wiki/Scratch_Wiki:Become_a_contributor/Verification_code_troubleshooting">Troubleshooting page</a></p>' . "\n"; <p>' . $this->msg('requestaccount-code-troubleshoot') . '</p>' . "\n";
$form .= '</fieldset>'; $form .= '</fieldset>';
//Set temporary password //Set temporary password
$form .= '<fieldset>'; $form .= '<fieldset>';
$form .= '<legend>Set password</legend>'; $form .= '<legend>' . $this->msg('requestaccount-set-pwd') . '</legend>';
$form .= '<table border="0"> $form .= '<table border="0">
<tr> <tr>
<td>Password</td> <td>' . $this->msg('yourpassword') . '</td>
<td><input type="password" name="pwd1" /></td> <td><input type="password" name="pwd1" /></td>
</tr> </tr>
<tr> <tr>
<td>Confirm password</td> <td>' . $this->msg('yourpasswordagain') . '</td>
<td><input type="password" name="pwd2" /></td> <td><input type="password" name="pwd2" /></td>
</tr> </tr>
</table>' . "\n"; </table>' . "\n";
$form .= '</fieldset>'; $form .= '</fieldset>';
# FIXME: do this better... # FIXME: do this better...
global $wgConfirmAccountCaptchas, $wgCaptchaClass, $wgCaptchaTriggers; global $wgConfirmAccountCaptchas, $wgCaptchaClass, $wgCaptchaTriggers;
if ( $wgConfirmAccountCaptchas && isset( $wgCaptchaClass ) if ( $wgConfirmAccountCaptchas && isset( $wgCaptchaClass )
@ -319,7 +325,7 @@ class RequestAccountPage extends SpecialPage {
'attachmentSrcName' => $this->mSrcName, 'attachmentSrcName' => $this->mSrcName,
'attachmentDidNotForget' => $this->mForgotAttachment, // confusing name :) 'attachmentDidNotForget' => $this->mForgotAttachment, // confusing name :)
'attachmentSize' => $this->mFileSize, 'attachmentSize' => $this->mFileSize,
'attachmentTempPath' => $this->mTempPath 'attachmentTempPath' => $this->mTempPath,
) )
); );

View file

@ -93,8 +93,8 @@ class UserCredentialsPage extends SpecialPage {
$form .= "<td>" . Linker::makeLinkObj( $user->getUserPage(), htmlspecialchars( $user->getUserPage()->getText() ) ) . "</td></tr>\n"; $form .= "<td>" . Linker::makeLinkObj( $user->getUserPage(), htmlspecialchars( $user->getUserPage()->getText() ) ) . "</td></tr>\n";
$econf = $row->acd_email_authenticated ? ' <strong>' . $this->msg( 'confirmaccount-econf' )->escaped() . '</strong>' : ''; $econf = $row->acd_email_authenticated ? ' <strong>' . $this->msg( 'confirmaccount-econf' )->escaped() . '</strong>' : '';
$form .= "<tr><td>" . $this->msg( 'usercredentials-email' )->escaped() . "</td>"; //$form .= "<tr><td>" . $this->msg( 'usercredentials-email' )->escaped() . "</td>";
$form .= "<td>" . htmlspecialchars( $row->acd_email ) . $econf . "</td></tr>\n"; //$form .= "<td>" . htmlspecialchars( $row->acd_email ) . $econf . "</td></tr>\n";
$form .= $grouplist; $form .= $grouplist;
@ -135,7 +135,7 @@ class UserCredentialsPage extends SpecialPage {
$form .= '</fieldset>'; $form .= '</fieldset>';
} }
$form .= '<fieldset>'; /*$form .= '<fieldset>';
$form .= '<legend>' . $this->msg( 'usercredentials-leg-person' )->escaped() . '</legend>'; $form .= '<legend>' . $this->msg( 'usercredentials-leg-person' )->escaped() . '</legend>';
$form .= '<table cellpadding=\'4\'>'; $form .= '<table cellpadding=\'4\'>';
$form .= "<tr><td>" . $this->msg( 'usercredentials-real' )->escaped() . "</td>"; $form .= "<tr><td>" . $this->msg( 'usercredentials-real' )->escaped() . "</td>";
@ -145,24 +145,27 @@ class UserCredentialsPage extends SpecialPage {
$form .= "<p><textarea tabindex='1' readonly='readonly' name='wpBio' id='wpNewBio' rows='10' cols='80' style='width:100%'>" . $form .= "<p><textarea tabindex='1' readonly='readonly' name='wpBio' id='wpNewBio' rows='10' cols='80' style='width:100%'>" .
htmlspecialchars( $row->acd_bio ) . htmlspecialchars( $row->acd_bio ) .
"</textarea></p>\n"; "</textarea></p>\n";
$form .= '</fieldset>'; $form .= '</fieldset>';*/
$form .= '<fieldset>'; $form .= '<fieldset>';
$form .= '<legend>' . $this->msg( 'usercredentials-leg-other' )->escaped() . '</legend>'; $form .= '<legend>' . $this->msg( 'usercredentials-leg-other' )->escaped() . '</legend>';
if ( $this->hasItem( 'CV' ) || $this->hasItem( 'Notes' ) || $this->hasItem( 'Links' ) ) { if ( $this->hasItem( 'CV' ) || $this->hasItem( 'Notes' ) || $this->hasItem( 'Links' ) ) {
$form .= '<p>' . $this->msg( 'usercredentials-attach' )->escaped() . ' '; /*$form .= '<p>' . $this->msg( 'usercredentials-attach' )->escaped() . ' ';
if ( $row->acd_filename ) { if ( $row->acd_filename ) {
$form .= Linker::makeKnownLinkObj( $titleObj, htmlspecialchars( $row->acd_filename ), $form .= Linker::makeKnownLinkObj( $titleObj, htmlspecialchars( $row->acd_filename ),
'file=' . $row->acd_storage_key ); 'file=' . $row->acd_storage_key );
} else { } else {
$form .= $this->msg( 'confirmaccount-none-p' )->escaped(); $form .= $this->msg( 'confirmaccount-none-p' )->escaped();
} }
$form .= "</p><p>" . $this->msg( 'usercredentials-notes' )->escaped() . "</p>\n"; $form .= '</p>';*/
//get rid of the hashed password, which is currently jammed in with the request notes
$notes_parts = explode(chr(1), $row->acd_notes);
$form .= '<p>' . $this->msg( 'usercredentials-notes' )->escaped() . "</p>\n";
$form .= "<p><textarea tabindex='1' readonly='readonly' name='wpNotes' id='wpNotes' rows='3' cols='80' style='width:100%'>" . $form .= "<p><textarea tabindex='1' readonly='readonly' name='wpNotes' id='wpNotes' rows='3' cols='80' style='width:100%'>" .
htmlspecialchars( $row->acd_notes ) . htmlspecialchars( $notes_parts[0] ) .
"</textarea></p>\n"; "</textarea></p>\n";
$form .= "<p>" . $this->msg( 'usercredentials-urls' )->escaped() . "</p>\n"; /*$form .= "<p>" . $this->msg( 'usercredentials-urls' )->escaped() . "</p>\n";
$form .= ConfirmAccountsPage::parseLinks( $row->acd_urls ); $form .= ConfirmAccountsPage::parseLinks( $row->acd_urls );*/
} }
$form .= '</fieldset>'; $form .= '</fieldset>';