r23261 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23260‎ | r23261 | r23262 >
Date:22:21, 22 June 2007
Author:aaron
Status:old
Tags:
Comment:
*svn:eol-style native
Modified paths:
  • /trunk/extensions/DeletedContributions/DeletedContributions.i18n.php (modified) (history)
  • /trunk/extensions/DeletedContributions/DeletedContributions_body.php (modified) (history)
  • /trunk/extensions/DeletedContributions/SpecialDeletedContributions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DeletedContributions/SpecialDeletedContributions.php
@@ -1,24 +1,24 @@
2 -<?php
3 -/**
4 - * Extension based on SpecialContributions for arhived revisions
5 - * Modifications made to SpecialContributions.php by Aaron Schulz
6 - * Key code snipets from HideRevision.php also modified for use here
7 - */
8 -
9 -# Internationalisation
10 -$wgExtensionFunctions[] = 'efLoadDeletedContribsMessages';
11 -
12 -function efLoadDeletedContribsMessages() {
13 - global $wgMessageCache, $wgDeletedContribsMessages, $wgOut, $wgJsMimeType;
14 - # Internationalization
15 - require( dirname( __FILE__ ) . '/DeletedContributions.i18n.php' );
16 - require( dirname( __FILE__ ) . '/DeletedContributions_body.php' );
17 - foreach ( $wgDeletedContribsMessages as $lang => $langMessages ) {
18 - $wgMessageCache->addMessages( $langMessages, $lang );
19 - }
20 -}
21 -
22 -$wgSpecialPages['DeletedContributions'] = array( 'SpecialPage', 'DeletedContributions', 'delete',
23 - /*listed*/ true, /*function*/ false, /*file*/ false );
24 -
25 -?>
 2+<?php
 3+/**
 4+ * Extension based on SpecialContributions for arhived revisions
 5+ * Modifications made to SpecialContributions.php by Aaron Schulz
 6+ * Key code snipets from HideRevision.php also modified for use here
 7+ */
 8+
 9+# Internationalisation
 10+$wgExtensionFunctions[] = 'efLoadDeletedContribsMessages';
 11+
 12+function efLoadDeletedContribsMessages() {
 13+ global $wgMessageCache, $wgDeletedContribsMessages, $wgOut, $wgJsMimeType;
 14+ # Internationalization
 15+ require( dirname( __FILE__ ) . '/DeletedContributions.i18n.php' );
 16+ require( dirname( __FILE__ ) . '/DeletedContributions_body.php' );
 17+ foreach ( $wgDeletedContribsMessages as $lang => $langMessages ) {
 18+ $wgMessageCache->addMessages( $langMessages, $lang );
 19+ }
 20+}
 21+
 22+$wgSpecialPages['DeletedContributions'] = array( 'SpecialPage', 'DeletedContributions', 'delete',
 23+ /*listed*/ true, /*function*/ false, /*file*/ false );
 24+
 25+?>
Property changes on: trunk/extensions/DeletedContributions/SpecialDeletedContributions.php
___________________________________________________________________
Added: svn:eol-style
2626 + native
Index: trunk/extensions/DeletedContributions/DeletedContributions_body.php
@@ -1,327 +1,327 @@
2 -<?php
3 -/**
4 - * Extension based on SpecialContributions for arhived revisions
5 - * Modifications made to SpecialContributions.php by Aaron Schulz
6 - * Key code snipets from HideRevision.php also modified for use here
7 - */
8 -
9 -class DeletedContribsPager extends IndexPager {
10 - public $mDefaultDirection = true;
11 - var $messages, $target;
12 - var $namespace = '', $mDb;
13 -
14 - function __construct( $target, $namespace = false ) {
15 - parent::__construct();
16 - foreach( explode( ' ', 'deletionlog minoreditletter' ) as $msg ) {
17 - $this->messages[$msg] = wfMsgExt( $msg, array( 'escape') );
18 - }
19 - $this->target = $target;
20 - $this->namespace = $namespace;
21 - $this->mDb = wfGetDB( DB_SLAVE, 'contributions' );
22 - }
23 -
24 - function getDefaultQuery() {
25 - $query = parent::getDefaultQuery();
26 - $query['target'] = $this->target;
27 - return $query;
28 - }
29 -
30 - function getQueryInfo() {
31 - list( $index, $userCond ) = $this->getUserCond();
32 - $conds = array_merge( $userCond, $this->getNamespaceCond() );
33 -
34 - return array(
35 - 'tables' => array( 'archive' ),
36 - 'fields' => array(
37 - 'ar_rev_id', 'ar_namespace', 'ar_title', 'ar_timestamp', 'ar_comment', 'ar_minor_edit',
38 - 'ar_user', 'ar_user_text', 'ar_deleted'
39 - ),
40 - 'conds' => $conds,
41 - 'options' => array( 'FORCE INDEX' => $index )
42 - );
43 - }
44 -
45 - function getUserCond() {
46 - $condition = array();
47 -
48 - $condition['ar_user_text'] = $this->target;
49 - $index = 'usertext_timestamp';
50 -
51 - return array( $index, $condition );
52 - }
53 -
54 - function getIndexField() {
55 - return 'ar_timestamp';
56 - }
57 -
58 - function getStartBody() {
59 - return "<ul>\n";
60 - }
61 -
62 - function getEndBody() {
63 - return "</ul>\n";
64 - }
65 -
66 - function getNavigationBar() {
67 - if ( isset( $this->mNavigationBar ) ) {
68 - return $this->mNavigationBar;
69 - }
70 - $linkTexts = array(
71 - 'prev' => wfMsgHtml( "sp-contributions-newer", $this->mLimit ),
72 - 'next' => wfMsgHtml( 'sp-contributions-older', $this->mLimit ),
73 - 'first' => wfMsgHtml('sp-contributions-newest'),
74 - 'last' => wfMsgHtml( 'sp-contributions-oldest' )
75 - );
76 -
77 - $pagingLinks = $this->getPagingLinks( $linkTexts );
78 - $limitLinks = $this->getLimitLinks();
79 - $limits = implode( ' | ', $limitLinks );
80 -
81 - $this->mNavigationBar = "({$pagingLinks['first']} | {$pagingLinks['last']}) " .
82 - wfMsgHtml("viewprevnext", $pagingLinks['prev'], $pagingLinks['next'], $limits);
83 - return $this->mNavigationBar;
84 - }
85 -
86 - function getNamespaceCond() {
87 - if ( $this->namespace !== '' ) {
88 - return array( 'ar_namespace' => (int)$this->namespace );
89 - } else {
90 - return array();
91 - }
92 - }
93 -
94 - /**
95 - * Generates each row in the contributions list.
96 - *
97 - * Contributions which are marked "top" are currently on top of the history.
98 - * For these contributions, a [rollback] link is shown for users with sysop
99 - * privileges. The rollback link restores the most recent version that was not
100 - * written by the target user.
101 - *
102 - * @todo This would probably look a lot nicer in a table.
103 - */
104 - function formatRow( $row ) {
105 - wfProfileIn( __METHOD__ );
106 -
107 - global $wgLang, $wgUser;
108 -
109 - $sk = $this->getSkin();
110 -
111 - $rev = new Revision( array(
112 - 'id' => $row->ar_rev_id,
113 - 'comment' => $row->ar_comment,
114 - 'user' => $row->ar_user,
115 - 'user_text' => $row->ar_user_text,
116 - 'timestamp' => $row->ar_timestamp,
117 - 'minor_edit' => $row->ar_minor_edit,
118 - 'rev_deleted' => $row->ar_deleted,
119 - ) );
120 -
121 - $page = Title::makeTitle( $row->ar_namespace, $row->ar_title );
122 - $timestamp = $row->ar_timestamp;
123 -
124 - $undelete =& SpecialPage::getTitleFor( 'Undelete' );
125 -
126 - $reviewlink ='(' . $sk->makeKnownLinkObj( $undelete, $this->messages['deletionlog'], 'target=' . $page->getPrefixedUrl() ) . ')';
127 - $link = $sk->makeKnownLinkObj( $undelete, htmlspecialchars( $page->getPrefixedText() ), 'target=' . $page->getPrefixedUrl() . '&timestamp=' . $timestamp);
128 -
129 - $comment = $sk->revComment( $rev );
130 - $d = $wgLang->timeanddate( wfTimestamp( TS_MW, $row->ar_timestamp ), true );
131 -
132 - if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
133 - $d = '<span class="history-deleted">' . $d . '</span>';
134 - }
135 -
136 - if( $row->ar_minor_edit ) {
137 - $mflag = '<span class="minor">' . $this->messages['minoreditletter'] . '</span> ';
138 - } else {
139 - $mflag = '';
140 - }
141 -
142 - $ret = "{$d} {$reviewlink} {$mflag} {$link} {$comment}";
143 - if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
144 - $ret .= ' ' . wfMsgHtml( 'deletedrev' );
145 - }
146 -
147 - $ret = "<li>$ret</li>\n";
148 -
149 - wfProfileOut( __METHOD__ );
150 - return $ret;
151 - }
152 -
153 - /**
154 - * Get the Database object in use
155 - *
156 - * @return Database
157 - */
158 - public function getDatabase() {
159 - return $this->mDb;
160 - }
161 -
162 -}
163 -
164 -/**
165 - * Special page "deleted user contributions".
166 - * Shows a list of the deleted contributions of a user.
167 - *
168 - * @return none
169 - * @param $par String: (optional) user name of the user for which to show the contributions
170 - */
171 -function wfSpecialDeletedContributions( $par = null ) {
172 - global $wgUser, $wgOut, $wgLang, $wgRequest;
173 -
174 - $options = array();
175 -
176 - if ( isset( $par ) ) {
177 - $target = $par;
178 - } else {
179 - $target = $wgRequest->getVal( 'target' );
180 - }
181 -
182 - if ( !strlen( $target ) ) {
183 - $wgOut->addHTML( deletedContributionsForm( '' ) );
184 - return;
185 - }
186 -
187 - $options['limit'] = $wgRequest->getInt( 'limit', 50 );
188 - $options['target'] = $target;
189 -
190 - $nt = Title::makeTitleSafe( NS_USER, $target );
191 - if ( !$nt ) {
192 - $wgOut->addHTML( deletedContributionsForm( '' ) );
193 - return;
194 - }
195 - $id = User::idFromName( $nt->getText() );
196 -
197 - $target = $nt->getText();
198 - $wgOut->setSubtitle( deletedContributionsSub( $nt, $id ) );
199 -
200 - if ( ( $ns = $wgRequest->getVal( 'namespace', null ) ) !== null && $ns !== '' ) {
201 - $options['namespace'] = intval( $ns );
202 - } else {
203 - $options['namespace'] = '';
204 - }
205 -
206 - $wgOut->addHTML( deletedContributionsForm( $options ) );
207 -
208 - $pager = new DeletedContribsPager( $target, $options['namespace'] );
209 - if ( !$pager->getNumRows() ) {
210 - $wgOut->addWikiText( wfMsg( 'nocontribs' ) );
211 - return;
212 - }
213 -
214 - # Show a message about slave lag, if applicable
215 - if( ( $lag = $pager->getDatabase()->getLag() ) > 0 )
216 - $wgOut->showLagWarning( $lag );
217 -
218 - $wgOut->addHTML(
219 - '<p>' . $pager->getNavigationBar() . '</p>' .
220 - $pager->getBody() .
221 - '<p>' . $pager->getNavigationBar() . '</p>' );
222 -
223 - # If there were contributions, and it was a valid user or IP, show
224 - # the appropriate "footer" message - WHOIS tools, etc.
225 - if( $target != 'newbies' ) {
226 - $message = IP::isIPAddress( $target )
227 - ? 'sp-contributions-footer-anon'
228 - : 'sp-contributions-footer';
229 -
230 -
231 - $text = wfMsg( $message, $target );
232 - if( !wfEmptyMsg( $message, $text ) && $text != '-' ) {
233 - $wgOut->addHtml( '<div class="mw-contributions-footer">' );
234 - $wgOut->addWikiText( $text );
235 - $wgOut->addHtml( '</div>' );
236 - }
237 - }
238 -}
239 -
240 -/**
241 - * Generates the subheading with links
242 - * @param $nt @see Title object for the target
243 - */
244 -function deletedContributionsSub( $nt, $id ) {
245 - global $wgSysopUserBans, $wgLang, $wgUser;
246 -
247 - $sk = $wgUser->getSkin();
248 -
249 - if ( 0 == $id ) {
250 - $user = $nt->getText();
251 - } else {
252 - $user = $sk->makeLinkObj( $nt, htmlspecialchars( $nt->getText() ) );
253 - }
254 - $talk = $nt->getTalkPage();
255 - if( $talk ) {
256 - # Talk page link
257 - $tools[] = $sk->makeLinkObj( $talk, wfMsgHtml( 'talkpagelinktext' ) );
258 - if( ( $id != 0 && $wgSysopUserBans ) || ( $id == 0 && User::isIP( $nt->getText() ) ) ) {
259 - # Block link
260 - if( $wgUser->isAllowed( 'block' ) )
261 - $tools[] = $sk->makeKnownLinkObj( SpecialPage::getTitleFor( 'Blockip', $nt->getDBkey() ), wfMsgHtml( 'blocklink' ) );
262 - # Block log link
263 - $tools[] = $sk->makeKnownLinkObj( SpecialPage::getTitleFor( 'Log' ), wfMsgHtml( 'sp-contributions-blocklog' ), 'type=block&page=' . $nt->getPrefixedUrl() );
264 - }
265 - # Other logs link
266 - $tools[] = $sk->makeKnownLinkObj( SpecialPage::getTitleFor( 'Log' ), wfMsgHtml( 'log' ), 'user=' . $nt->getPartialUrl() );
267 - $links = implode( ' | ', $tools );
268 - }
269 -
270 - // Old message 'contribsub' had one parameter, but that doesn't work for
271 - // languages that want to put the "for" bit right after $user but before
272 - // $links. If 'contribsub' is around, use it for reverse compatibility,
273 - // otherwise use 'contribsub2'.
274 - if( wfEmptyMsg( 'contribsub', wfMsg( 'contribsub' ) ) ) {
275 - return wfMsgHtml( 'contribsub2', $user, $links );
276 - } else {
277 - return wfMsgHtml( 'contribsub', "$user ($links)" );
278 - }
279 -}
280 -
281 -/**
282 - * Generates the namespace selector form with hidden attributes.
283 - * @param $options Array: the options to be included.
284 - */
285 -function deletedContributionsForm( $options ) {
286 - global $wgScript, $wgTitle, $wgRequest;
287 -
288 - $options['title'] = $wgTitle->getPrefixedText();
289 - if ( !isset( $options['target'] ) ) {
290 - $options['target'] = '';
291 - } else {
292 - $options['target'] = str_replace( '_' , ' ' , $options['target'] );
293 - }
294 -
295 - if ( !isset( $options['namespace'] ) ) {
296 - $options['namespace'] = '';
297 - }
298 -
299 - if ( !isset( $options['contribs'] ) ) {
300 - $options['contribs'] = 'user';
301 - }
302 -
303 - if ( $options['contribs'] == 'newbie' ) {
304 - $options['target'] = '';
305 - }
306 -
307 - $f = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
308 -
309 - foreach ( $options as $name => $value ) {
310 - if ( in_array( $name, array( 'namespace', 'target', 'contribs' ) ) ) {
311 - continue;
312 - }
313 - $f .= "\t" . Xml::hidden( $name, $value ) . "\n";
314 - }
315 -
316 - $f .= '<fieldset>' .
317 - Xml::element( 'legend', array(), wfMsg( 'sp-contributions-search' ) ) .
318 - wfMsgExt( 'sp-contributions-username', array( 'parseinline' ) ) . ' ' .
319 - Xml::input( 'target', 20, $options['target']) . ' '.
320 - Xml::label( wfMsg( 'namespace' ), 'namespace' ) .
321 - Xml::namespaceSelector( $options['namespace'], '' ) .
322 - Xml::submitButton( wfMsg( 'sp-contributions-submit' ) ) .
323 - '</fieldset>' .
324 - Xml::closeElement( 'form' );
325 - return $f;
326 -}
327 -
328 -?>
 2+<?php
 3+/**
 4+ * Extension based on SpecialContributions for arhived revisions
 5+ * Modifications made to SpecialContributions.php by Aaron Schulz
 6+ * Key code snipets from HideRevision.php also modified for use here
 7+ */
 8+
 9+class DeletedContribsPager extends IndexPager {
 10+ public $mDefaultDirection = true;
 11+ var $messages, $target;
 12+ var $namespace = '', $mDb;
 13+
 14+ function __construct( $target, $namespace = false ) {
 15+ parent::__construct();
 16+ foreach( explode( ' ', 'deletionlog minoreditletter' ) as $msg ) {
 17+ $this->messages[$msg] = wfMsgExt( $msg, array( 'escape') );
 18+ }
 19+ $this->target = $target;
 20+ $this->namespace = $namespace;
 21+ $this->mDb = wfGetDB( DB_SLAVE, 'contributions' );
 22+ }
 23+
 24+ function getDefaultQuery() {
 25+ $query = parent::getDefaultQuery();
 26+ $query['target'] = $this->target;
 27+ return $query;
 28+ }
 29+
 30+ function getQueryInfo() {
 31+ list( $index, $userCond ) = $this->getUserCond();
 32+ $conds = array_merge( $userCond, $this->getNamespaceCond() );
 33+
 34+ return array(
 35+ 'tables' => array( 'archive' ),
 36+ 'fields' => array(
 37+ 'ar_rev_id', 'ar_namespace', 'ar_title', 'ar_timestamp', 'ar_comment', 'ar_minor_edit',
 38+ 'ar_user', 'ar_user_text', 'ar_deleted'
 39+ ),
 40+ 'conds' => $conds,
 41+ 'options' => array( 'FORCE INDEX' => $index )
 42+ );
 43+ }
 44+
 45+ function getUserCond() {
 46+ $condition = array();
 47+
 48+ $condition['ar_user_text'] = $this->target;
 49+ $index = 'usertext_timestamp';
 50+
 51+ return array( $index, $condition );
 52+ }
 53+
 54+ function getIndexField() {
 55+ return 'ar_timestamp';
 56+ }
 57+
 58+ function getStartBody() {
 59+ return "<ul>\n";
 60+ }
 61+
 62+ function getEndBody() {
 63+ return "</ul>\n";
 64+ }
 65+
 66+ function getNavigationBar() {
 67+ if ( isset( $this->mNavigationBar ) ) {
 68+ return $this->mNavigationBar;
 69+ }
 70+ $linkTexts = array(
 71+ 'prev' => wfMsgHtml( "sp-contributions-newer", $this->mLimit ),
 72+ 'next' => wfMsgHtml( 'sp-contributions-older', $this->mLimit ),
 73+ 'first' => wfMsgHtml('sp-contributions-newest'),
 74+ 'last' => wfMsgHtml( 'sp-contributions-oldest' )
 75+ );
 76+
 77+ $pagingLinks = $this->getPagingLinks( $linkTexts );
 78+ $limitLinks = $this->getLimitLinks();
 79+ $limits = implode( ' | ', $limitLinks );
 80+
 81+ $this->mNavigationBar = "({$pagingLinks['first']} | {$pagingLinks['last']}) " .
 82+ wfMsgHtml("viewprevnext", $pagingLinks['prev'], $pagingLinks['next'], $limits);
 83+ return $this->mNavigationBar;
 84+ }
 85+
 86+ function getNamespaceCond() {
 87+ if ( $this->namespace !== '' ) {
 88+ return array( 'ar_namespace' => (int)$this->namespace );
 89+ } else {
 90+ return array();
 91+ }
 92+ }
 93+
 94+ /**
 95+ * Generates each row in the contributions list.
 96+ *
 97+ * Contributions which are marked "top" are currently on top of the history.
 98+ * For these contributions, a [rollback] link is shown for users with sysop
 99+ * privileges. The rollback link restores the most recent version that was not
 100+ * written by the target user.
 101+ *
 102+ * @todo This would probably look a lot nicer in a table.
 103+ */
 104+ function formatRow( $row ) {
 105+ wfProfileIn( __METHOD__ );
 106+
 107+ global $wgLang, $wgUser;
 108+
 109+ $sk = $this->getSkin();
 110+
 111+ $rev = new Revision( array(
 112+ 'id' => $row->ar_rev_id,
 113+ 'comment' => $row->ar_comment,
 114+ 'user' => $row->ar_user,
 115+ 'user_text' => $row->ar_user_text,
 116+ 'timestamp' => $row->ar_timestamp,
 117+ 'minor_edit' => $row->ar_minor_edit,
 118+ 'rev_deleted' => $row->ar_deleted,
 119+ ) );
 120+
 121+ $page = Title::makeTitle( $row->ar_namespace, $row->ar_title );
 122+ $timestamp = $row->ar_timestamp;
 123+
 124+ $undelete =& SpecialPage::getTitleFor( 'Undelete' );
 125+
 126+ $reviewlink ='(' . $sk->makeKnownLinkObj( $undelete, $this->messages['deletionlog'], 'target=' . $page->getPrefixedUrl() ) . ')';
 127+ $link = $sk->makeKnownLinkObj( $undelete, htmlspecialchars( $page->getPrefixedText() ), 'target=' . $page->getPrefixedUrl() . '&timestamp=' . $timestamp);
 128+
 129+ $comment = $sk->revComment( $rev );
 130+ $d = $wgLang->timeanddate( wfTimestamp( TS_MW, $row->ar_timestamp ), true );
 131+
 132+ if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
 133+ $d = '<span class="history-deleted">' . $d . '</span>';
 134+ }
 135+
 136+ if( $row->ar_minor_edit ) {
 137+ $mflag = '<span class="minor">' . $this->messages['minoreditletter'] . '</span> ';
 138+ } else {
 139+ $mflag = '';
 140+ }
 141+
 142+ $ret = "{$d} {$reviewlink} {$mflag} {$link} {$comment}";
 143+ if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
 144+ $ret .= ' ' . wfMsgHtml( 'deletedrev' );
 145+ }
 146+
 147+ $ret = "<li>$ret</li>\n";
 148+
 149+ wfProfileOut( __METHOD__ );
 150+ return $ret;
 151+ }
 152+
 153+ /**
 154+ * Get the Database object in use
 155+ *
 156+ * @return Database
 157+ */
 158+ public function getDatabase() {
 159+ return $this->mDb;
 160+ }
 161+
 162+}
 163+
 164+/**
 165+ * Special page "deleted user contributions".
 166+ * Shows a list of the deleted contributions of a user.
 167+ *
 168+ * @return none
 169+ * @param $par String: (optional) user name of the user for which to show the contributions
 170+ */
 171+function wfSpecialDeletedContributions( $par = null ) {
 172+ global $wgUser, $wgOut, $wgLang, $wgRequest;
 173+
 174+ $options = array();
 175+
 176+ if ( isset( $par ) ) {
 177+ $target = $par;
 178+ } else {
 179+ $target = $wgRequest->getVal( 'target' );
 180+ }
 181+
 182+ if ( !strlen( $target ) ) {
 183+ $wgOut->addHTML( deletedContributionsForm( '' ) );
 184+ return;
 185+ }
 186+
 187+ $options['limit'] = $wgRequest->getInt( 'limit', 50 );
 188+ $options['target'] = $target;
 189+
 190+ $nt = Title::makeTitleSafe( NS_USER, $target );
 191+ if ( !$nt ) {
 192+ $wgOut->addHTML( deletedContributionsForm( '' ) );
 193+ return;
 194+ }
 195+ $id = User::idFromName( $nt->getText() );
 196+
 197+ $target = $nt->getText();
 198+ $wgOut->setSubtitle( deletedContributionsSub( $nt, $id ) );
 199+
 200+ if ( ( $ns = $wgRequest->getVal( 'namespace', null ) ) !== null && $ns !== '' ) {
 201+ $options['namespace'] = intval( $ns );
 202+ } else {
 203+ $options['namespace'] = '';
 204+ }
 205+
 206+ $wgOut->addHTML( deletedContributionsForm( $options ) );
 207+
 208+ $pager = new DeletedContribsPager( $target, $options['namespace'] );
 209+ if ( !$pager->getNumRows() ) {
 210+ $wgOut->addWikiText( wfMsg( 'nocontribs' ) );
 211+ return;
 212+ }
 213+
 214+ # Show a message about slave lag, if applicable
 215+ if( ( $lag = $pager->getDatabase()->getLag() ) > 0 )
 216+ $wgOut->showLagWarning( $lag );
 217+
 218+ $wgOut->addHTML(
 219+ '<p>' . $pager->getNavigationBar() . '</p>' .
 220+ $pager->getBody() .
 221+ '<p>' . $pager->getNavigationBar() . '</p>' );
 222+
 223+ # If there were contributions, and it was a valid user or IP, show
 224+ # the appropriate "footer" message - WHOIS tools, etc.
 225+ if( $target != 'newbies' ) {
 226+ $message = IP::isIPAddress( $target )
 227+ ? 'sp-contributions-footer-anon'
 228+ : 'sp-contributions-footer';
 229+
 230+
 231+ $text = wfMsg( $message, $target );
 232+ if( !wfEmptyMsg( $message, $text ) && $text != '-' ) {
 233+ $wgOut->addHtml( '<div class="mw-contributions-footer">' );
 234+ $wgOut->addWikiText( $text );
 235+ $wgOut->addHtml( '</div>' );
 236+ }
 237+ }
 238+}
 239+
 240+/**
 241+ * Generates the subheading with links
 242+ * @param $nt @see Title object for the target
 243+ */
 244+function deletedContributionsSub( $nt, $id ) {
 245+ global $wgSysopUserBans, $wgLang, $wgUser;
 246+
 247+ $sk = $wgUser->getSkin();
 248+
 249+ if ( 0 == $id ) {
 250+ $user = $nt->getText();
 251+ } else {
 252+ $user = $sk->makeLinkObj( $nt, htmlspecialchars( $nt->getText() ) );
 253+ }
 254+ $talk = $nt->getTalkPage();
 255+ if( $talk ) {
 256+ # Talk page link
 257+ $tools[] = $sk->makeLinkObj( $talk, wfMsgHtml( 'talkpagelinktext' ) );
 258+ if( ( $id != 0 && $wgSysopUserBans ) || ( $id == 0 && User::isIP( $nt->getText() ) ) ) {
 259+ # Block link
 260+ if( $wgUser->isAllowed( 'block' ) )
 261+ $tools[] = $sk->makeKnownLinkObj( SpecialPage::getTitleFor( 'Blockip', $nt->getDBkey() ), wfMsgHtml( 'blocklink' ) );
 262+ # Block log link
 263+ $tools[] = $sk->makeKnownLinkObj( SpecialPage::getTitleFor( 'Log' ), wfMsgHtml( 'sp-contributions-blocklog' ), 'type=block&page=' . $nt->getPrefixedUrl() );
 264+ }
 265+ # Other logs link
 266+ $tools[] = $sk->makeKnownLinkObj( SpecialPage::getTitleFor( 'Log' ), wfMsgHtml( 'log' ), 'user=' . $nt->getPartialUrl() );
 267+ $links = implode( ' | ', $tools );
 268+ }
 269+
 270+ // Old message 'contribsub' had one parameter, but that doesn't work for
 271+ // languages that want to put the "for" bit right after $user but before
 272+ // $links. If 'contribsub' is around, use it for reverse compatibility,
 273+ // otherwise use 'contribsub2'.
 274+ if( wfEmptyMsg( 'contribsub', wfMsg( 'contribsub' ) ) ) {
 275+ return wfMsgHtml( 'contribsub2', $user, $links );
 276+ } else {
 277+ return wfMsgHtml( 'contribsub', "$user ($links)" );
 278+ }
 279+}
 280+
 281+/**
 282+ * Generates the namespace selector form with hidden attributes.
 283+ * @param $options Array: the options to be included.
 284+ */
 285+function deletedContributionsForm( $options ) {
 286+ global $wgScript, $wgTitle, $wgRequest;
 287+
 288+ $options['title'] = $wgTitle->getPrefixedText();
 289+ if ( !isset( $options['target'] ) ) {
 290+ $options['target'] = '';
 291+ } else {
 292+ $options['target'] = str_replace( '_' , ' ' , $options['target'] );
 293+ }
 294+
 295+ if ( !isset( $options['namespace'] ) ) {
 296+ $options['namespace'] = '';
 297+ }
 298+
 299+ if ( !isset( $options['contribs'] ) ) {
 300+ $options['contribs'] = 'user';
 301+ }
 302+
 303+ if ( $options['contribs'] == 'newbie' ) {
 304+ $options['target'] = '';
 305+ }
 306+
 307+ $f = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
 308+
 309+ foreach ( $options as $name => $value ) {
 310+ if ( in_array( $name, array( 'namespace', 'target', 'contribs' ) ) ) {
 311+ continue;
 312+ }
 313+ $f .= "\t" . Xml::hidden( $name, $value ) . "\n";
 314+ }
 315+
 316+ $f .= '<fieldset>' .
 317+ Xml::element( 'legend', array(), wfMsg( 'sp-contributions-search' ) ) .
 318+ wfMsgExt( 'sp-contributions-username', array( 'parseinline' ) ) . ' ' .
 319+ Xml::input( 'target', 20, $options['target']) . ' '.
 320+ Xml::label( wfMsg( 'namespace' ), 'namespace' ) .
 321+ Xml::namespaceSelector( $options['namespace'], '' ) .
 322+ Xml::submitButton( wfMsg( 'sp-contributions-submit' ) ) .
 323+ '</fieldset>' .
 324+ Xml::closeElement( 'form' );
 325+ return $f;
 326+}
 327+
 328+?>
Property changes on: trunk/extensions/DeletedContributions/DeletedContributions_body.php
___________________________________________________________________
Added: svn:eol-style
329329 + native
Index: trunk/extensions/DeletedContributions/DeletedContributions.i18n.php
@@ -1,7 +1,7 @@
2 -<?php
3 -$wgDeletedContribsMessages = array();
4 -
5 -$wgDeletedContribsMessages['en'] = array(
6 - 'deletedcontributions' => 'Deleted contributions'
7 -);
8 -?>
 2+<?php
 3+$wgDeletedContribsMessages = array();
 4+
 5+$wgDeletedContribsMessages['en'] = array(
 6+ 'deletedcontributions' => 'Deleted contributions'
 7+);
 8+?>
Property changes on: trunk/extensions/DeletedContributions/DeletedContributions.i18n.php
___________________________________________________________________
Added: svn:eol-style
99 + native

Status & tagging log