r7517 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r7516‎ | r7517 | r7518 >
Date:18:20, 22 February 2005
Author:e23
Status:old
Tags:
Comment:
Made list of expiry options configurable.\nRemoved redundant setting $wgDefaultBlockExpiry
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/SpecialBlockip.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialBlockip.php
@@ -46,16 +46,12 @@
4747 }
4848
4949 function showForm( $err ) {
50 - global $wgOut, $wgUser, $wgLang, $wgDefaultBlockExpiry;
 50+ global $wgOut, $wgUser, $wgLang, $wgBlockExpiryOptions;
5151 global $wgRequest;
5252
5353 $wgOut->setPagetitle( htmlspecialchars( wfMsg( 'blockip' ) ) );
5454 $wgOut->addWikiText( htmlspecialchars( wfMsg( 'blockiptext' ) ) );
5555
56 - if ( is_null( $this->BlockExpiry ) || $this->BlockExpiry === '' ) {
57 - $this->BlockExpiry = $wgDefaultBlockExpiry;
58 - }
59 -
6056 $mIpaddress = htmlspecialchars( wfMsg( 'ipaddress' ) );
6157 $mIpbexpiry = htmlspecialchars( wfMsg( 'ipbexpiry' ) );
6258 $mIpbreason = htmlspecialchars( wfMsg( 'ipbreason' ) );
@@ -71,6 +67,10 @@
7268 $scBlockAddress = htmlspecialchars( $this->BlockAddress );
7369 $scBlockExpiry = htmlspecialchars( $this->BlockExpiry );
7470 $scBlockReason = htmlspecialchars( $this->BlockReason );
 71+
 72+ $blockExpiryOptions = join("</option><option>", split(",", $wgBlockExpiryOptions));
 73+ $blockExpiryOptions = "<option>" . $blockExpiryOptions . "</option>";
 74+
7575 $token = htmlspecialchars( $wgUser->editToken() );
7676
7777 $wgOut->addHTML( "
@@ -85,17 +85,8 @@
8686 <tr>
8787 <td align=\"right\">{$mIpbexpiry}:</td>
8888 <td align=\"left\">
89 - <select name=\"wpBlockExpiry\"/>
90 - <option>2 hours</option>
91 - <option>1 day</option>
92 - <option>3 days</option>
93 - <option>1 week</option>
94 - <option>2 weeks</option>
95 - <option>1 month</option>
96 - <option>3 months</option>
97 - <option>6 months</option>
98 - <option>1 year</option>
99 - <option>indefinite</option>
 89+ <select tabindex='2' name=\"wpBlockExpiry\"/>
 90+ <?= $blockExpiryOptions ?>
10091 </select>
10192 </td>
10293 </tr>
@@ -169,6 +160,7 @@
170161
171162 }
172163
 164+
173165 if ( $this->BlockReason == '') {
174166 $this->showForm( wfMsg( 'noblockreason' ) );
175167 return;
@@ -181,7 +173,6 @@
182174 $this->BlockReason, wfTimestampNow(), 0, $expiry );
183175
184176 if (wfRunHooks('BlockIp', $ban, $wgUser)) {
185 -
186177 $ban->insert();
187178
188179 wfRunHooks('BlockIpComplete', $ban, $wgUser);
Index: trunk/phase3/includes/DefaultSettings.php
@@ -457,8 +457,12 @@
458458
459459 $wgSysopUserBans = false; # Allow sysops to ban logged-in users
460460 $wgSysopRangeBans = false; # Allow sysops to ban IP ranges
461 -$wgDefaultBlockExpiry = '24 hours'; # default expiry time
462 - # strtotime format, or "infinite" for an infinite block
 461+
 462+/** Comma-separated list of options to show on the IP block form.
 463+ * Use strtotime() format, or "infinite" for an infinite block
 464+ */
 465+$wgBlockExpiryOptions = "2 hours,1 day,3 days,1 week,2 weeks,1 month,3 months,6 months,1 year,infinite";
 466+
463467 $wgAutoblockExpiry = 86400; # Number of seconds before autoblock entries expire
464468
465469 # Proxy scanner settings
@@ -1124,4 +1128,4 @@
11251129 } else {
11261130 die();
11271131 }
1128 -?>
\ No newline at end of file
 1132+?>

Status & tagging log