*/
$wgPasswordSender = 'Wikipedia Mail <apache@' . $wgServerName . '>';
+/**
+ * Set to true to enable the e-mail basic features:
+ * Password reminders, etc. If sending e-mail on your
+ * server doesn't work, you might want to disable this.
+ * @global bool $wgEnableEmail
+ */
+$wgEnableEmail = true;
+
+/**
+ * Set to true to enable user-to-user e-mail.
+ * This can potentially be abused, as it's hard to track.
+ * @global bool $wgEnableUserEmail
+ */
+$wgEnableUserEmail = true;
/**
* SMTP Mode
if($id || $ip) { # both anons and non-anons have contri list
$s .= $sep . $this->userContribsLink();
}
- if ( 0 != $wgUser->getID() ) { # show only to signed in users
- if($id) { # can only email non-anons
- $s .= $sep . $this->emailUserLink();
- }
+ if( $this->showEmailUser( $id ) ) {
+ $s .= $sep . $this->emailUserLink();
}
}
if ( $wgTitle->getArticleId() ) {
return $s;
}
+ function showEmailUser( $id ) {
+ global $wgEnableEmail, $wgEnableUserEmail, $wgUser;
+ return $wgEnableEmail &&
+ $wgEnableUserEmail &&
+ 0 != $wgUser->getID() && # show only to signed in users
+ 0 != $id; # can only email non-anons
+ }
+
function emailUserLink() {
global $wgTitle, $wgContLang;
require_once('UserMailer.php');
function wfSpecialEmailuser( $par ) {
- global $wgUser, $wgOut, $wgRequest;
+ global $wgUser, $wgOut, $wgRequest, $wgEnableEmail, $wgEnableUserEmail;
+ if( !( $wgEnableEmail && $wgEnableUserEmail ) ) {
+ $wgOut->errorpage( "nosuchspecialpage", "nospecialpagetext" );
+ return;
+ }
+
if ( 0 == $wgUser->getID() ||
( false === strpos( $wgUser->getEmail(), "@" ) ) ) {
$wgOut->errorpage( "mailnologin", "mailnologintext" );
}
$wgUser->setPassword( $this->mNewpass );
}
- $wgUser->setEmail( $this->mUserEmail );
+ global $wgEnableEmail;
+ if( $wgEnableEmail ) {
+ $wgUser->setEmail( $this->mUserEmail );
+ }
$wgUser->setRealName( $this->mRealName );
$wgUser->setOption( 'language', $this->mUserLanguage );
$wgUser->setOption( 'variant', $this->mUserVariant );
$wgUser->setOption( "searchNs{$i}", $value );
}
- $wgUser->setOption( 'disablemail', $this->mEmailFlag );
+ global $wgEnableUserEmail;
+ if( $wgEnableEmail && $wgEnableUserEmail ) {
+ $wgUser->setOption( 'disablemail', $this->mEmailFlag );
+ }
# Set user toggles
foreach ( $this->mToggles as $tname => $tvalue ) {
if ($wgAllowRealName) {
$wgOut->addHTML("<div><label>$yrn: <input type='text' name=\"wpRealName\" value=\"{$this->mRealName}\" size='20' /></label></div>");
}
+
+ global $wgEnableEmail, $wgEnableUserEmail;
+ if( $wgEnableEmail ) {
+ $wgOut->addHTML("
+ <div><label>$yem: <input type='text' name=\"wpUserEmail\" value=\"{$this->mUserEmail}\" size='20' /></label></div>" );
+ if( $wgEnableUserEmail ) {
+ $wgOut->addHTML("
+ <div><label><input type='checkbox' $emfc value=\"1\" name=\"wpEmailFlag\" />$emf</label></div>" );
+ }
+ }
+
$wgOut->addHTML("
- <div><label>$yem: <input type='text' name=\"wpUserEmail\" value=\"{$this->mUserEmail}\" size='20' /></label></div>
- <div><label><input type='checkbox' $emfc value=\"1\" name=\"wpEmailFlag\" />$emf</label></div>
<div><label>$ynn: <input type='text' name=\"wpNick\" value=\"{$this->mNick}\" size='12' /></label></div>
<div><label>$yl: <select name=\"wpUserLanguage\">\n");
var $mLoginattempt, $mRemember, $mEmail;
function LoginForm( &$request ) {
- global $wgLang, $wgAllowRealName;
+ global $wgLang, $wgAllowRealName, $wgEnableEmail;
$this->mName = $request->getText( 'wpName' );
$this->mPassword = $request->getText( 'wpPassword' );
$this->mCookieCheck = $request->getVal( 'wpCookieCheck' );
$this->mPosted = $request->wasPosted();
$this->mCreateaccount = $request->getCheck( 'wpCreateaccount' );
- $this->mCreateaccountMail = $request->getCheck( 'wpCreateaccountMail' );
- $this->mMailmypassword = $request->getCheck( 'wpMailmypassword' );
+ $this->mCreateaccountMail = $request->getCheck( 'wpCreateaccountMail' )
+ && $wgEnableEmail;
+ $this->mMailmypassword = $request->getCheck( 'wpMailmypassword' )
+ && $wgEnableEmail;
$this->mLoginattempt = $request->getCheck( 'wpLoginattempt' );
$this->mAction = $request->getVal( 'action' );
$this->mRemember = $request->getCheck( 'wpRemember' );
- $this->mEmail = $request->getText( 'wpEmail' );
+ if( $wgEnableEmail ) {
+ $this->mEmail = $request->getText( 'wpEmail' );
+ } else {
+ $this->mEmail = '';
+ }
if( $wgAllowRealName ) {
$this->mRealName = $request->getText( 'wpRealName' );
} else {
*/
function mainLoginForm( $err ) {
global $wgUser, $wgOut, $wgLang;
- global $wgDBname, $wgAllowRealName;
+ global $wgDBname, $wgAllowRealName, $wgEnableEmail;
if ( '' == $this->mName ) {
if ( 0 != $wgUser->getID() ) {
$template->set( 'action', $titleObj->getLocalUrl( $q ) );
$template->set( 'error', $err );
$template->set( 'create', $wgUser->isAllowedToCreateAccount() );
- $template->set( 'createemail', $wgUser->getID() != 0 );
+ $template->set( 'createemail', $wgEnableEmail && $wgUser->getID() != 0 );
$template->set( 'userealname', $wgAllowRealName );
+ $template->set( 'useemail', $wgEnableEmail );
$template->set( 'remember', $wgUser->getOption( 'rememberpassword' ) );
$wgOut->setPageTitle( wfMsg( 'userlogin' ) );
<td><?php $this->msg('newusersonly') ?></td>
</tr>
<tr>
- <td align='right'><?php $this->msg('youremail') ?>:</td>
- <td align='left'>
- <input tabindex='7' type='text' name="wpEmail"
- value="<?php $this->text('email') ?>" size='20' />
- </td>
- <?php if( $this->data['userealname'] ) { ?>
- <td> </td>
- </tr>
- <tr>
- <td align='right'><?php $this->msg('yourrealname') ?>:</td>
- <td align='left'>
- <input tabindex='8' type='text' name="wpRealName"
- value="<?php $this->text('realname') ?>" size='20' />
- </td>
- <?php } ?>
-
+ <?php if( $this->data['useemail'] ) { ?>
+ <td align='right'><?php $this->msg('youremail') ?>:</td>
+ <td align='left'>
+ <input tabindex='7' type='text' name="wpEmail"
+ value="<?php $this->text('email') ?>" size='20' />
+ </td>
+ <?php } ?>
+ <?php if( $this->data['userealname'] ) { ?>
+ </tr>
+ <tr>
+ <td align='right'><?php $this->msg('yourrealname') ?>:</td>
+ <td align='left'>
+ <input tabindex='8' type='text' name="wpRealName"
+ value="<?php $this->text('realname') ?>" size='20' />
+ </td>
+ <?php } ?>
<td align='left'>
<input tabindex='9' type='submit' name="wpCreateaccount"
value="<?php $this->msg('createaccount') ?>" />
</td>
</tr>
<?php } ?>
+ <?php if( $this->data['useemail'] ) { ?>
<tr>
<td colspan='3'> </td>
</tr>
</p>
</td>
</tr>
+ <?php } ?>
</table>
</form>
<?php
$id=User::idFromName($wgTitle->getText());
if ($id != 0) {
$s .= $sep . $this->userContribsLink();
- if ( 0 != $wgUser->getID() ) {
+ if( $this->showEmailUser( $id ) ) {
$s .= $sep . $this->emailUserLink();
}
}
if($id||$ip) {
$s .= $sep . $this->userContribsLink();
}
- if ( 0 != $wgUser->getID() ) {
- if($id) { # can only email real users
- $s .= $sep . $this->emailUserLink();
- }
+ if( $this->showEmailUser( $id ) ) {
+ $s .= $sep . $this->emailUserLink();
}
}
$s .= "\n<br /><hr class='sep' />";