Index: MediaWiki/branches/1.11/includes/SpecialBlockip.php
===================================================================
--- MediaWiki/branches/1.11/includes/SpecialBlockip.php	(revision 1280)
+++ MediaWiki/branches/1.11/includes/SpecialBlockip.php	(revision 1281)
@@ -44,4 +44,5 @@
 class IPBlockForm {
 	var $BlockAddress, $BlockExpiry, $BlockReason;
+#	var $BlockEmail;
 
 	function IPBlockForm( $par ) {
@@ -61,10 +62,11 @@
 		$this->BlockCreateAccount = $wgRequest->getBool( 'wpCreateAccount', $byDefault );
 		$this->BlockEnableAutoblock = $wgRequest->getBool( 'wpEnableAutoblock', $byDefault );
+		$this->BlockEmail = $wgRequest->getBool( 'wpEmailBan', false );
 		# Re-check user's rights to hide names, very serious, defaults to 0
-		$this->BlockHideName = $wgRequest->getBool( 'wpHideName', 0 ) && $wgUser->isAllowed( 'hideuser' );
+		$this->BlockHideName = ( $wgRequest->getBool( 'wpHideName', 0 ) && $wgUser->isAllowed( 'hideuser' ) ) ? 1 : 0;
 	}
 
 	function showForm( $err ) {
-		global $wgOut, $wgUser, $wgSysopUserBans;
+		global $wgOut, $wgUser, $wgSysopUserBans, $wgContLang;
 
 		$wgOut->setPagetitle( wfMsg( 'blockip' ) );
@@ -85,4 +87,5 @@
 		$titleObj = SpecialPage::getTitleFor( 'Blockip' );
 		$action = $titleObj->escapeLocalURL( "action=submit" );
+		$alignRight = $wgContLang->isRtl() ? 'left' : 'right';
 
 		if ( "" != $err ) {
@@ -142,5 +145,5 @@
 		}
 
-		$token = htmlspecialchars( $wgUser->editToken() );
+		$token = $wgUser->editToken();
 
 		global $wgStylePath, $wgStyleVersion;
@@ -151,6 +154,6 @@
 	<table border='0'>
 		<tr>
-			<td align=\"right\">{$mIpaddress}:</td>
-			<td align=\"left\">
+			<td align=\"$alignRight\">{$mIpaddress}</td>
+			<td>
 				" . Xml::input( 'wpBlockAddress', 45, $this->BlockAddress,
 					array(
@@ -163,6 +166,6 @@
 		if ($showblockoptions) {
 			$wgOut->addHTML("
-			<td align=\"right\">{$mIpbexpiry}:</td>
-			<td align=\"left\">
+			<td align=\"$alignRight\">{$mIpbexpiry}</td>
+			<td>
 				<select tabindex='2' id='wpBlockExpiry' name=\"wpBlockExpiry\" onchange=\"considerChangingExpiryFocus()\">
 					$blockExpiryFormOptions
@@ -174,6 +177,6 @@
 		</tr>
 		<tr id='wpBlockOther'>
-			<td align=\"right\">{$mIpbother}:</td>
-			<td align=\"left\">
+			<td align=\"$alignRight\">{$mIpbother}</td>
+			<td>
 				" . Xml::input( 'wpBlockOther', 45, $this->BlockOther,
 					array( 'tabindex' => '3', 'id' => 'mw-bi-other' ) ) . "
@@ -183,6 +186,6 @@
 			$wgOut->addHTML("
 			<tr>
-				<td align=\"right\">{$mIpbreasonother}:</td>
-				<td align=\"left\">
+				<td align=\"$alignRight\">{$mIpbreasonother}</td>
+				<td>
 					<select tabindex='4' id=\"wpBlockReasonList\" name=\"wpBlockReasonList\">
 						$blockReasonList
@@ -193,13 +196,14 @@
 		$wgOut->addHTML("
 		<tr id=\"wpBlockReason\">
-			<td align=\"right\">{$mIpbreason}:</td>
-			<td align=\"left\">
+			<td align=\"$alignRight\">{$mIpbreason}</td>
+			<td>
 				" . Xml::input( 'wpBlockReason', 45, $this->BlockReason,
-					array( 'tabindex' => '5', 'id' => 'mw-bi-reason' ) ) . "
+					array( 'tabindex' => '5', 'id' => 'mw-bi-reason',
+			       		       'maxlength'=> '200' ) ) . "
 			</td>
 		</tr>
 		<tr id='wpAnonOnlyRow'>
 			<td>&nbsp;</td>
-			<td align=\"left\">
+			<td>
 				" . wfCheckLabel( wfMsgHtml( 'ipbanononly' ),
 					'wpAnonOnly', 'wpAnonOnly', $this->BlockAnonOnly,
@@ -209,5 +213,5 @@
 		<tr id='wpCreateAccountRow'>
 			<td>&nbsp;</td>
-			<td align=\"left\">
+			<td>
 				" . wfCheckLabel( wfMsgHtml( 'ipbcreateaccount' ),
 					'wpCreateAccount', 'wpCreateAccount', $this->BlockCreateAccount,
@@ -217,5 +221,5 @@
 		<tr id='wpEnableAutoblockRow'>
 			<td>&nbsp;</td>
-			<td align=\"left\">
+			<td>
 				" . wfCheckLabel( wfMsgHtml( 'ipbenableautoblock' ),
 						'wpEnableAutoblock', 'wpEnableAutoblock', $this->BlockEnableAutoblock,
@@ -229,5 +233,5 @@
 			<tr>
 			<td>&nbsp;</td>
-				<td align=\"left\">
+				<td>
 					" . wfCheckLabel( wfMsgHtml( 'ipbhidename' ),
 							'wpHideName', 'wpHideName', $this->BlockHideName,
@@ -237,10 +241,25 @@
 			");
 		}
+
+		global $wgSysopEmailBans;
+
+		if ( $wgSysopEmailBans && $wgUser->isAllowed( 'blockemail' ) ) {
+			$wgOut->addHTML("
+			<tr id='wpEnableEmailBan'>
+			<td>&nbsp;</td>
+				<td>
+					" . wfCheckLabel( wfMsgHtml( 'ipbemailban' ),
+							'wpEmailBan', 'wpEmailBan', $this->BlockEmail,
+								array( 'tabindex' => '10' )) . "
+				</td>
+			</tr>
+			");
+		}
 		$wgOut->addHTML("
 		<tr>
 			<td style='padding-top: 1em'>&nbsp;</td>
-			<td style='padding-top: 1em' align=\"left\">
-				" . Xml::submitButton( wfMsgHtml( 'ipbsubmit' ),
-							array( 'name' => 'wpBlock', 'tabindex' => '10' ) ) . "
+			<td style='padding-top: 1em'>
+				" . Xml::submitButton( wfMsg( 'ipbsubmit' ),
+							array( 'name' => 'wpBlock', 'tabindex' => '11' ) ) . "
 			</td>
 		</tr>
@@ -355,8 +374,8 @@
 		# Create block
 		# Note: for a user block, ipb_address is only for display purposes
-
 		$block = new Block( $this->BlockAddress, $userId, $wgUser->getID(),
 			$reasonstr, wfTimestampNow(), 0, $expiry, $this->BlockAnonOnly,
-			$this->BlockCreateAccount, $this->BlockEnableAutoblock, $this->BlockHideName);
+			$this->BlockCreateAccount, $this->BlockEnableAutoblock, $this->BlockHideName,
+			$this->BlockEmail);
 
 		if (wfRunHooks('BlockIp', array(&$block, &$wgUser))) {
@@ -419,4 +438,6 @@
 		if( !$this->BlockEnableAutoblock )
 			$flags[] = 'noautoblock';
+		if ( $this->BlockEmail )
+			$flags[] = 'noemail';
 		return implode( ',', $flags );
 	}
@@ -472,3 +493,3 @@
 	}
 }
-?>
+
