Index: trunk/extensions/Nuke/Nuke_body.php |
— | — | @@ -17,41 +17,44 @@ |
18 | 18 | $this->setHeaders(); |
19 | 19 | $this->outputHeader(); |
20 | 20 | |
21 | | - if( $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { |
22 | | - $target = $wgRequest->getText( 'target', $par ); |
| 21 | + $target = trim( $wgRequest->getText( 'target', $par ) ); |
| 22 | + |
| 23 | + // Normalise name |
| 24 | + if ( $target !== '' ) { |
| 25 | + $user = User::newFromName( $target ); |
| 26 | + if ( $user ) $target = $user->getName(); |
| 27 | + } |
| 28 | + |
| 29 | + $reason = $wgRequest->getText( |
| 30 | + 'wpReason', |
| 31 | + wfMsgForContent( |
| 32 | + 'nuke-defaultreason', |
| 33 | + $target === '' ? wfMsg( 'nuke-multiplepeople' ) : $target |
| 34 | + ) |
| 35 | + ); |
| 36 | + |
| 37 | + if( $wgRequest->wasPosted() |
| 38 | + && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) |
| 39 | + && $wgRequest->getVal( 'action' ) == 'delete' ) { |
| 40 | + |
| 41 | + $pages = $wgRequest->getArray( 'pages' ); |
23 | 42 | |
24 | | - // Normalise name |
25 | | - if ( $target !== '' ) { |
26 | | - $user = User::newFromName( $target ); |
27 | | - if ( $user ) $target = $user->getName(); |
| 43 | + if( $pages ) { |
| 44 | + return $this->doDelete( $pages, $reason ); |
28 | 45 | } |
29 | | - |
30 | | - $reason = $wgRequest->getText( |
31 | | - 'wpReason', |
32 | | - wfMsgForContent( |
33 | | - 'nuke-defaultreason', |
34 | | - $target === '' ? wfMsg( 'nuke-multiplepeople' ) : $target |
35 | | - ) |
36 | | - ); |
37 | | - |
38 | | - if ( $wgRequest->getVal( 'action' ) == 'delete' ) { |
39 | | - $pages = $wgRequest->getArray( 'pages' ); |
40 | | - |
41 | | - if( $pages ) { |
42 | | - return $this->doDelete( $pages, $reason ); |
43 | | - } |
44 | | - } else { |
45 | | - $this->listForm( $target, $reason, $wgRequest->getInt( 'limit' ) ); |
46 | | - } |
47 | | - } else { |
| 46 | + } |
| 47 | + else if ( $target === '' ) { |
48 | 48 | $this->promptForm(); |
49 | 49 | } |
| 50 | + else { |
| 51 | + $this->listForm( $target, $reason, $wgRequest->getInt( 'limit', 500 ) ); |
| 52 | + } |
50 | 53 | } |
51 | 54 | |
52 | 55 | /** |
53 | 56 | * Prompt for a username or IP address. |
54 | 57 | */ |
55 | | - protected function promptForm() { |
| 58 | + protected function promptForm( $userName = '' ) { |
56 | 59 | global $wgOut, $wgUser; |
57 | 60 | |
58 | 61 | $wgOut->addWikiMsg( 'nuke-tools' ); |
— | — | @@ -66,7 +69,7 @@ |
67 | 70 | ) |
68 | 71 | . '<table><tr>' |
69 | 72 | . '<td>' . htmlspecialchars( wfMsg( 'nuke-userorip' ) ) . '</td>' |
70 | | - . '<td>' . Xml::input( 'target', 40 ) . '</td>' |
| 73 | + . '<td>' . Xml::input( 'target', 40, $userName ) . '</td>' |
71 | 74 | . '</tr><tr>' |
72 | 75 | . '<td>' . htmlspecialchars( wfMsg( 'nuke-maxpages' ) ) . '</td>' |
73 | 76 | . '<td>' . Xml::input( 'limit', 7, '500' ) . '</td>' |
— | — | @@ -93,7 +96,7 @@ |
94 | 97 | |
95 | 98 | if( count( $pages ) == 0 ) { |
96 | 99 | $wgOut->addWikiMsg( 'nuke-nopages', $username ); |
97 | | - return $this->promptForm(); |
| 100 | + return $this->promptForm( $username ); |
98 | 101 | } |
99 | 102 | |
100 | 103 | if ( $username == '' ) { |
— | — | @@ -257,6 +260,10 @@ |
258 | 261 | $res[] = wfMsgExt( 'nuke-not-deleted', array( 'parseinline' ), $title->getPrefixedText() ); |
259 | 262 | } |
260 | 263 | } |
| 264 | + |
261 | 265 | $wgOut->addHTML( "<ul>\n<li>" . implode( "</li>\n<li>", $res ) . "</li>\n</ul>\n" ); |
| 266 | + |
| 267 | + $wgOut->addWikiMsg( 'nuke-delete-more' ); |
262 | 268 | } |
| 269 | + |
263 | 270 | } |
Index: trunk/extensions/Nuke/Nuke.i18n.php |
— | — | @@ -33,6 +33,7 @@ |
34 | 34 | 'nuke-editby' => 'Created by [[Special:Contributions/$1|$1]]', |
35 | 35 | 'nuke-deleted' => "Page '''$1''' has been deleted.", |
36 | 36 | 'nuke-not-deleted' => "Page [[:$1]] '''could not''' be deleted.", |
| 37 | + 'nuke-delete-more' => '[[Special:Nuke|Delete more pages]]', |
37 | 38 | ); |
38 | 39 | |
39 | 40 | /** Message documentation (Message documentation) |
Index: trunk/extensions/Nuke/Nuke.php |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | die( 'Not an entry point.' ); |
6 | 6 | } |
7 | 7 | |
8 | | -define( 'Nuke_VERSION', '1.1' ); |
| 8 | +define( 'Nuke_VERSION', '1.1.1' ); |
9 | 9 | |
10 | 10 | $dir = dirname(__FILE__) . '/'; |
11 | 11 | |