Index: trunk/extensions/Nuke/Nuke_body.php |
— | — | @@ -34,14 +34,22 @@ |
35 | 35 | ); |
36 | 36 | |
37 | 37 | if( $wgRequest->wasPosted() |
38 | | - && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) |
39 | | - && $wgRequest->getVal( 'action' ) == 'delete' ) { |
| 38 | + && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { |
40 | 39 | |
41 | | - $pages = $wgRequest->getArray( 'pages' ); |
| 40 | + |
| 41 | + if ( $wgRequest->getVal( 'action' ) == 'delete' ) { |
| 42 | + $pages = $wgRequest->getArray( 'pages' ); |
42 | 43 | |
43 | | - if( $pages ) { |
44 | | - return $this->doDelete( $pages, $reason ); |
| 44 | + if( $pages ) { |
| 45 | + return $this->doDelete( $pages, $reason ); |
| 46 | + } |
45 | 47 | } |
| 48 | + else if ( $wgRequest->getVal( 'action' ) == 'submit' ) { |
| 49 | + $this->listForm( $target, $reason, $wgRequest->getInt( 'limit', 500 ) ); |
| 50 | + } |
| 51 | + else { |
| 52 | + $this->promptForm(); |
| 53 | + } |
46 | 54 | } |
47 | 55 | else if ( $target === '' ) { |
48 | 56 | $this->promptForm(); |
— | — | @@ -71,6 +79,9 @@ |
72 | 80 | . '<td>' . htmlspecialchars( wfMsg( 'nuke-userorip' ) ) . '</td>' |
73 | 81 | . '<td>' . Xml::input( 'target', 40, $userName ) . '</td>' |
74 | 82 | . '</tr><tr>' |
| 83 | + . '<td>' . htmlspecialchars( wfMsg( 'nuke-pattern' ) ) . '</td>' |
| 84 | + . '<td>' . Xml::input( 'pattern', 40 ) . '</td>' |
| 85 | + . '</tr><tr>' |
75 | 86 | . '<td>' . htmlspecialchars( wfMsg( 'nuke-maxpages' ) ) . '</td>' |
76 | 87 | . '<td>' . Xml::input( 'limit', 7, '500' ) . '</td>' |
77 | 88 | . '</tr><tr>' |
— | — | @@ -95,11 +106,17 @@ |
96 | 107 | $pages = $this->getNewPages( $username, $limit ); |
97 | 108 | |
98 | 109 | if( count( $pages ) == 0 ) { |
99 | | - $wgOut->addWikiMsg( 'nuke-nopages', $username ); |
| 110 | + if ( $username === '' ) { |
| 111 | + $wgOut->addWikiMsg( 'nuke-nopages-global' ); |
| 112 | + } |
| 113 | + else { |
| 114 | + $wgOut->addWikiMsg( 'nuke-nopages', $username ); |
| 115 | + } |
| 116 | + |
100 | 117 | return $this->promptForm( $username ); |
101 | 118 | } |
102 | 119 | |
103 | | - if ( $username == '' ) { |
| 120 | + if ( $username === '' ) { |
104 | 121 | $wgOut->addWikiMsg( 'nuke-list-multiple' ); |
105 | 122 | } else { |
106 | 123 | $wgOut->addWikiMsg( 'nuke-list', $username ); |
— | — | @@ -156,7 +173,6 @@ |
157 | 174 | |
158 | 175 | $wgOut->addHTML( '<ul>' ); |
159 | 176 | |
160 | | - $sk = $wgUser->getSkin(); |
161 | 177 | foreach( $pages as $info ) { |
162 | 178 | list( $title, $edits, $userName ) = $info; |
163 | 179 | $image = $title->getNamespace() == NS_IMAGE ? wfLocalFile( $title ) : false; |
— | — | @@ -170,10 +186,10 @@ |
171 | 187 | ) . |
172 | 188 | ' ' . |
173 | 189 | ( $thumb ? $thumb->toHtml( array( 'desc-link' => true ) ) : '' ) . |
174 | | - $sk->makeKnownLinkObj( $title ) . |
| 190 | + $this->getSkin()->makeKnownLinkObj( $title ) . |
175 | 191 | ' (' . |
176 | 192 | ( $userName ? wfMsgExt( 'nuke-editby', 'parseinline', $userName ) . ', ' : '' ) . |
177 | | - $sk->makeKnownLinkObj( $title, $changes, 'action=history' ) . |
| 193 | + $this->getSkin()->makeKnownLinkObj( $title, $changes, 'action=history' ) . |
178 | 194 | ")</li>\n" ); |
179 | 195 | } |
180 | 196 | |
— | — | @@ -204,11 +220,16 @@ |
205 | 221 | |
206 | 222 | $where = array( "(rc_new = 1) OR (rc_log_type = 'upload' AND rc_log_action = 'upload')" ); |
207 | 223 | |
208 | | - if ( $username == '' ) { |
| 224 | + if ( $username === '' ) { |
209 | 225 | $what[] = 'rc_user_text'; |
210 | 226 | } else { |
211 | 227 | $where['rc_user_text'] = $username; |
212 | 228 | } |
| 229 | + |
| 230 | + $pattern = $this->getRequest()->getText( 'pattern' ); |
| 231 | + if ( !is_null( $pattern ) && trim( $pattern ) !== '' ) { |
| 232 | + $where[] = 'rc_title LIKE ' . $dbr->addQuotes( $pattern ); |
| 233 | + } |
213 | 234 | |
214 | 235 | $result = $dbr->select( 'recentchanges', |
215 | 236 | $what, |
Index: trunk/extensions/Nuke/Nuke.i18n.php |
— | — | @@ -35,6 +35,8 @@ |
36 | 36 | 'nuke-deleted' => "Page '''$1''' has been deleted.", |
37 | 37 | 'nuke-not-deleted' => "Page [[:$1]] '''could not''' be deleted.", |
38 | 38 | 'nuke-delete-more' => '[[Special:Nuke|Delete more pages]]', |
| 39 | + 'nuke-pattern' => 'Pattern for the page name:', |
| 40 | + 'nuke-nopages-global'=> 'There are no new pages in [[Special:RecentChanges|recent changes]].', |
39 | 41 | ); |
40 | 42 | |
41 | 43 | /** Message documentation (Message documentation) |