r57646 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57645‎ | r57646 | r57647 >
Date:19:55, 11 October 2009
Author:ialex
Status:ok
Tags:
Comment:
* removed trailing spaces
* spacing fixes
Modified paths:
  • /trunk/phase3/includes/LogEventsList.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/LogEventsList.php
@@ -77,19 +77,19 @@
7878 $month = '', $filter = null, $tagFilter='' )
7979 {
8080 global $wgScript, $wgMiserMode;
81 -
 81+
8282 $action = $wgScript;
8383 $title = SpecialPage::getTitleFor( 'Log' );
8484 $special = $title->getPrefixedDBkey();
85 -
 85+
8686 // For B/C, we take strings, but make sure they are converted...
8787 $types = ($types === '') ? array() : (array)$types;
8888
8989 $tagSelector = ChangeTags::buildTagFilterSelector( $tagFilter );
90 -
 90+
9191 $html = '';
9292 $html .= Xml::hidden( 'title', $special );
93 -
 93+
9494 // Basic selectors
9595 $html .= $this->getTypeMenu( $types ) . "\n";
9696 $html .= $this->getUserInput( $user ) . "\n";
@@ -100,32 +100,32 @@
101101 if (!$wgMiserMode) {
102102 $html .= $this->getTitlePattern( $pattern ) . "\n";
103103 }
104 -
 104+
105105 // date menu
106106 $html .= Xml::tags( 'p', null, Xml::dateMenu( $year, $month ) );
107 -
 107+
108108 // Tag filter
109109 if ($tagSelector) {
110110 $html .= Xml::tags( 'p', null, implode( ' ', $tagSelector ) );
111111 }
112 -
 112+
113113 // Filter links
114114 if ($filter) {
115115 $html .= Xml::tags( 'p', null, $this->getFilterLinks( $filter ) );
116116 }
117 -
 117+
118118 // Submit button
119119 $html .= Xml::submitButton( wfMsg( 'allpagessubmit' ) );
120 -
 120+
121121 // Fieldset
122122 $html = Xml::fieldset( wfMsg( 'log' ), $html );
123 -
 123+
124124 // Form wrapping
125125 $html = Xml::tags( 'form', array( 'action' => $action, 'method' => 'get' ), $html );
126126
127127 $this->out->addHTML( $html );
128128 }
129 -
 129+
130130 /**
131131 * @param $filter Array
132132 * @return String: Formatted HTML
@@ -160,7 +160,7 @@
161161 // Build links
162162 return '<small>'.$wgLang->pipeList( $links ) . '</small>' . $hiddens;
163163 }
164 -
 164+
165165 private function getDefaultQuery() {
166166 if ( !isset( $this->mDefaultQuery ) ) {
167167 $this->mDefaultQuery = $_GET;
@@ -239,7 +239,7 @@
240240 Xml::checkLabel( wfMsg( 'log-title-wildcard' ), 'pattern', 'pattern', $pattern ) .
241241 '</span>';
242242 }
243 -
 243+
244244 private function getExtraInputs( $types ) {
245245 global $wgRequest;
246246 $offender = $wgRequest->getVal('offender');
@@ -271,17 +271,17 @@
272272
273273 $title = Title::makeTitle( $row->log_namespace, $row->log_title );
274274 $classes = array( "mw-logline-{$row->log_type}" );
275 - $time = $wgLang->timeanddate( wfTimestamp(TS_MW, $row->log_timestamp), true );
 275+ $time = $wgLang->timeanddate( wfTimestamp( TS_MW, $row->log_timestamp ), true );
276276 // User links
277 - if( self::isDeleted($row,LogPage::DELETED_USER) ) {
 277+ if( self::isDeleted( $row, LogPage::DELETED_USER ) ) {
278278 $userLink = '<span class="history-deleted">' . wfMsgHtml( 'rev-deleted-user' ) . '</span>';
279279 } else {
280280 $userLink = $this->skin->userLink( $row->log_user, $row->user_name ) .
281281 $this->skin->userToolLinks( $row->log_user, $row->user_name, true, 0, $row->user_editcount );
282282 }
283283 // Comment
284 - if( self::isDeleted($row,LogPage::DELETED_COMMENT) ) {
285 - $comment = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-comment') . '</span>';
 284+ if( self::isDeleted( $row, LogPage::DELETED_COMMENT ) ) {
 285+ $comment = '<span class="history-deleted">' . wfMsgHtml( 'rev-deleted-comment' ) . '</span>';
286286 } else {
287287 $comment = $wgContLang->getDirMark() . $this->skin->commentBlock( $row->log_comment );
288288 }
@@ -289,16 +289,16 @@
290290 $paramArray = LogPage::extractParams( $row->log_params );
291291 $revert = $del = '';
292292 // Some user can hide log items and have review links
293 - if( !($this->flags & self::NO_ACTION_LINK) && $wgUser->isAllowed( 'deletedhistory' ) ) {
 293+ if( !( $this->flags & self::NO_ACTION_LINK ) && $wgUser->isAllowed( 'deletedhistory' ) ) {
294294 // Don't show useless link to people who cannot hide revisions
295295 if( $row->log_deleted || $wgUser->isAllowed( 'deleterevision' ) ) {
296296 $del = $this->getShowHideLinks( $row ) . ' ';
297297 }
298298 }
299299 // Add review links and such...
300 - if( ($this->flags & self::NO_ACTION_LINK) || ($row->log_deleted & LogPage::DELETED_ACTION) ) {
 300+ if( ( $this->flags & self::NO_ACTION_LINK ) || ( $row->log_deleted & LogPage::DELETED_ACTION ) ) {
301301 // Action text is suppressed...
302 - } else if( self::typeAction($row,'move','move','move') && !empty($paramArray[0]) ) {
 302+ } else if( self::typeAction( $row, 'move', 'move', 'move' ) && !empty( $paramArray[0] ) ) {
303303 $destTitle = Title::newFromText( $paramArray[0] );
304304 if( $destTitle ) {
305305 $revert = '(' . $this->skin->link(
@@ -315,7 +315,7 @@
316316 ) . ')';
317317 }
318318 // Show undelete link
319 - } else if( self::typeAction($row,array('delete','suppress'),'delete','deletedhistory') ) {
 319+ } else if( self::typeAction( $row, array( 'delete', 'suppress' ), 'delete', 'deletedhistory' ) ) {
320320 if( !$wgUser->isAllowed( 'undelete' ) ) {
321321 $viewdeleted = $this->message['undeleteviewlink'];
322322 } else {
@@ -330,7 +330,7 @@
331331 array( 'known', 'noclasses' )
332332 ) . ')';
333333 // Show unblock/change block link
334 - } else if( self::typeAction($row,array('block','suppress'),array('block','reblock'),'block') ) {
 334+ } else if( self::typeAction( $row, array( 'block', 'suppress' ), array( 'block', 'reblock' ), 'block' ) ) {
335335 $revert = '(' .
336336 $this->skin->link(
337337 SpecialPage::getTitleFor( 'Ipblocklist' ),
@@ -353,7 +353,7 @@
354354 ')';
355355 // Show change protection link
356356 } else if( self::typeAction( $row, 'protect', array( 'modify', 'protect', 'unprotect' ) ) ) {
357 - $revert .= ' (' .
 357+ $revert .= ' (' .
358358 $this->skin->link( $title,
359359 $this->message['hist'],
360360 array(),
@@ -372,21 +372,21 @@
373373 }
374374 $revert .= ')';
375375 // Show unmerge link
376 - } else if( self::typeAction($row,'merge','merge','mergehistory') ) {
 376+ } else if( self::typeAction( $row, 'merge', 'merge', 'mergehistory' ) ) {
377377 $merge = SpecialPage::getTitleFor( 'Mergehistory' );
378 - $revert = '(' . $this->skin->link(
 378+ $revert = '(' . $this->skin->link(
379379 $merge,
380380 $this->message['revertmerge'],
381381 array(),
382382 array(
383383 'target' => $paramArray[0],
384 - 'dest' => $title->getPrefixedDBkey(),
 384+ 'dest' => $title->getPrefixedDBkey(),
385385 'mergepoint' => $paramArray[1]
386386 ),
387387 array( 'known', 'noclasses' )
388388 ) . ')';
389389 // If an edit was hidden from a page give a review link to the history
390 - } else if( self::typeAction($row,array('delete','suppress'),'revision','deletedhistory') ) {
 390+ } else if( self::typeAction( $row, array( 'delete', 'suppress' ), 'revision', 'deletedhistory' ) ) {
391391 if( count($paramArray) >= 2 ) {
392392 // Different revision types use different URL params...
393393 $key = $paramArray[0];
@@ -397,10 +397,10 @@
398398 // Diff link for single rev deletions
399399 if( count($Ids) == 1 ) {
400400 // Live revision diffs...
401 - if( in_array($key, array('oldid','revision')) ) {
 401+ if( in_array( $key, array( 'oldid', 'revision' ) ) ) {
402402 $revert[] = $this->skin->link(
403403 $title,
404 - $this->message['diff'],
 404+ $this->message['diff'],
405405 array(),
406406 array(
407407 'diff' => intval( $Ids[0] ),
@@ -409,7 +409,7 @@
410410 array( 'known', 'noclasses' )
411411 );
412412 // Deleted revision diffs...
413 - } else if( in_array($key, array('artimestamp','archive')) ) {
 413+ } else if( in_array( $key, array( 'artimestamp','archive' ) ) ) {
414414 $revert[] = $this->skin->link(
415415 SpecialPage::getTitleFor( 'Undelete' ),
416416 $this->message['diff'],
@@ -439,7 +439,7 @@
440440 $revert = wfMsg( 'parentheses', $wgLang->pipeList( $revert ) );
441441 }
442442 // Hidden log items, give review link
443 - } else if( self::typeAction($row,array('delete','suppress'),'event','deletedhistory') ) {
 443+ } else if( self::typeAction( $row, array( 'delete', 'suppress' ), 'event', 'deletedhistory' ) ) {
444444 if( count($paramArray) >= 1 ) {
445445 $revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
446446 // $paramArray[1] is a CSV of the IDs
@@ -459,7 +459,7 @@
460460 ) . ')';
461461 }
462462 // Self-created users
463 - } else if( self::typeAction($row,'newusers','create2') ) {
 463+ } else if( self::typeAction( $row, 'newusers', 'create2' ) ) {
464464 if( isset( $paramArray[0] ) ) {
465465 $revert = $this->skin->userToolLinks( $paramArray[0], $title->getDBkey(), true );
466466 } else {
@@ -477,15 +477,15 @@
478478 &$comment, &$revert, $row->log_timestamp ) );
479479 }
480480 // Event description
481 - if( self::isDeleted($row,LogPage::DELETED_ACTION) ) {
482 - $action = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
 481+ if( self::isDeleted( $row, LogPage::DELETED_ACTION ) ) {
 482+ $action = '<span class="history-deleted">' . wfMsgHtml( 'rev-deleted-event' ) . '</span>';
483483 } else {
484484 $action = LogPage::actionText( $row->log_type, $row->log_action, $title,
485485 $this->skin, $paramArray, true );
486486 }
487487
488488 // Any tags...
489 - list($tagDisplay, $newClasses) = ChangeTags::formatSummaryRow( $row->ts_tags, 'logevent' );
 489+ list( $tagDisplay, $newClasses ) = ChangeTags::formatSummaryRow( $row->ts_tags, 'logevent' );
490490 $classes = array_merge( $classes, $newClasses );
491491
492492 if( $revert != '' ) {
@@ -506,16 +506,16 @@
507507 // If event was hidden from sysops
508508 if( !self::userCan( $row, LogPage::DELETED_RESTRICTED ) ) {
509509 $del = Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ),
510 - '('.$this->message['rev-delundel'].')' );
 510+ '(' . $this->message['rev-delundel'] . ')' );
511511 } else if( $row->log_type == 'suppress' ) {
512512 $del = ''; // No one should be hiding from the oversight log
513513 } else {
514514 $target = SpecialPage::getTitleFor( 'Log', $row->log_type );
515515 $page = Title::makeTitle( $row->log_namespace, $row->log_title );
516 - $query = array(
 516+ $query = array(
517517 'target' => $target->getPrefixedDBkey(),
518518 'type' => 'logging',
519 - 'ids' => $row->log_id,
 519+ 'ids' => $row->log_id,
520520 );
521521 $del = $this->skin->revDeleteLink( $query,
522522 self::isDeleted( $row, LogPage::DELETED_RESTRICTED ) );
@@ -532,10 +532,10 @@
533533 */
534534 public static function typeAction( $row, $type, $action, $right='' ) {
535535 $match = is_array($type) ?
536 - in_array($row->log_type,$type) : $row->log_type == $type;
 536+ in_array( $row->log_type, $type ) : $row->log_type == $type;
537537 if( $match ) {
538 - $match = is_array($action) ?
539 - in_array($row->log_action,$action) : $row->log_action == $action;
 538+ $match = is_array( $action ) ?
 539+ in_array( $row->log_action, $action ) : $row->log_action == $action;
540540 if( $match && $right ) {
541541 global $wgUser;
542542 $match = $wgUser->isAllowed( $right );
@@ -575,7 +575,7 @@
576576 * @return Boolean
577577 */
578578 public static function isDeleted( $row, $field ) {
579 - return ($row->log_deleted & $field) == $field;
 579+ return ( $row->log_deleted & $field ) == $field;
580580 }
581581
582582 /**
@@ -585,16 +585,15 @@
586586 * @param $page String The page title to show log entries for
587587 * @param $user String The user who made the log entries
588588 * @param $param Associative Array with the following additional options:
589 - * lim Integer Limit of items to show, default is 50
590 - * conds Array Extra conditions for the query (e.g. "log_action != 'revision'")
591 - * showIfEmpty boolean Set to false if you don't want any output in case the loglist is empty
592 - * if set to true (default), "No matching items in log" is displayed if loglist is empty
593 - * msgKey Array If you want a nice box with a message, set this
594 - * to the key of the message. First element is the message
595 - * key, additional optional elements are parameters for the
596 - * key that are processed with wgMsgExt and option 'parse'
597 - * offset Set to overwrite offset parameter in $wgRequest
598 - * set to '' to unset offset
 589+ * - lim Integer Limit of items to show, default is 50
 590+ * - conds Array Extra conditions for the query (e.g. "log_action != 'revision'")
 591+ * - showIfEmpty boolean Set to false if you don't want any output in case the loglist is empty
 592+ * if set to true (default), "No matching items in log" is displayed if loglist is empty
 593+ * - msgKey Array If you want a nice box with a message, set this to the key of the message.
 594+ * First element is the message key, additional optional elements are parameters for the key
 595+ * that are processed with wgMsgExt and option 'parse'
 596+ * - offset Set to overwrite offset parameter in $wgRequest
 597+ * set to '' to unset offset
599598 * @return Integer Number of total log items (not limited by $lim)
600599 */
601600 public static function showLogExtract( &$out, $types=array(), $page='', $user='',
@@ -617,7 +616,7 @@
618617 $conds = $param['conds'];
619618 $showIfEmpty = $param['showIfEmpty'];
620619 $msgKey = $param['msgKey'];
621 - if ( !is_array($msgKey) )
 620+ if ( !is_array( $msgKey ) )
622621 $msgKey = array( $msgKey );
623622 # Insert list of top 50 (or top $lim) items
624623 $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, 0 );
@@ -632,11 +631,11 @@
633632 $s = '<div class="mw-warning-with-logexcerpt">';
634633
635634 if ( count( $msgKey ) == 1 ) {
636 - $s .= wfMsgExt( $msgKey[0], array('parse') );
 635+ $s .= wfMsgExt( $msgKey[0], array( 'parse' ) );
637636 } else { // Process additional arguments
638637 $args = $msgKey;
639638 array_shift( $args );
640 - $s .= wfMsgExt( $msgKey[0], array('parse'), $args );
 639+ $s .= wfMsgExt( $msgKey[0], array( 'parse' ), $args );
641640 }
642641 }
643642 $s .= $loglist->beginLogEventsList() .
@@ -837,7 +836,7 @@
838837 global $wgMiserMode, $wgUser;
839838
840839 $title = Title::newFromText( $page );
841 - if( strlen($page) == 0 || !$title instanceof Title )
 840+ if( strlen( $page ) == 0 || !$title instanceof Title )
842841 return false;
843842
844843 $this->title = $title->getPrefixedText();
@@ -899,7 +898,7 @@
900899 'log_timestamp', 'user_name', 'user_editcount' ),
901900 'conds' => $this->mConds,
902901 'options' => $options,
903 - 'join_conds' => array(
 902+ 'join_conds' => array(
904903 'user' => array( 'INNER JOIN', 'user_id=log_user' ),
905904 'log_search' => array( 'INNER JOIN', 'ls_log_id=log_id' )
906905 )

Status & tagging log