Index: trunk/phase3/includes/LogEventsList.php |
— | — | @@ -77,19 +77,19 @@ |
78 | 78 | $month = '', $filter = null, $tagFilter='' ) |
79 | 79 | { |
80 | 80 | global $wgScript, $wgMiserMode; |
81 | | - |
| 81 | + |
82 | 82 | $action = $wgScript; |
83 | 83 | $title = SpecialPage::getTitleFor( 'Log' ); |
84 | 84 | $special = $title->getPrefixedDBkey(); |
85 | | - |
| 85 | + |
86 | 86 | // For B/C, we take strings, but make sure they are converted... |
87 | 87 | $types = ($types === '') ? array() : (array)$types; |
88 | 88 | |
89 | 89 | $tagSelector = ChangeTags::buildTagFilterSelector( $tagFilter ); |
90 | | - |
| 90 | + |
91 | 91 | $html = ''; |
92 | 92 | $html .= Xml::hidden( 'title', $special ); |
93 | | - |
| 93 | + |
94 | 94 | // Basic selectors |
95 | 95 | $html .= $this->getTypeMenu( $types ) . "\n"; |
96 | 96 | $html .= $this->getUserInput( $user ) . "\n"; |
— | — | @@ -100,32 +100,32 @@ |
101 | 101 | if (!$wgMiserMode) { |
102 | 102 | $html .= $this->getTitlePattern( $pattern ) . "\n"; |
103 | 103 | } |
104 | | - |
| 104 | + |
105 | 105 | // date menu |
106 | 106 | $html .= Xml::tags( 'p', null, Xml::dateMenu( $year, $month ) ); |
107 | | - |
| 107 | + |
108 | 108 | // Tag filter |
109 | 109 | if ($tagSelector) { |
110 | 110 | $html .= Xml::tags( 'p', null, implode( ' ', $tagSelector ) ); |
111 | 111 | } |
112 | | - |
| 112 | + |
113 | 113 | // Filter links |
114 | 114 | if ($filter) { |
115 | 115 | $html .= Xml::tags( 'p', null, $this->getFilterLinks( $filter ) ); |
116 | 116 | } |
117 | | - |
| 117 | + |
118 | 118 | // Submit button |
119 | 119 | $html .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ); |
120 | | - |
| 120 | + |
121 | 121 | // Fieldset |
122 | 122 | $html = Xml::fieldset( wfMsg( 'log' ), $html ); |
123 | | - |
| 123 | + |
124 | 124 | // Form wrapping |
125 | 125 | $html = Xml::tags( 'form', array( 'action' => $action, 'method' => 'get' ), $html ); |
126 | 126 | |
127 | 127 | $this->out->addHTML( $html ); |
128 | 128 | } |
129 | | - |
| 129 | + |
130 | 130 | /** |
131 | 131 | * @param $filter Array |
132 | 132 | * @return String: Formatted HTML |
— | — | @@ -160,7 +160,7 @@ |
161 | 161 | // Build links |
162 | 162 | return '<small>'.$wgLang->pipeList( $links ) . '</small>' . $hiddens; |
163 | 163 | } |
164 | | - |
| 164 | + |
165 | 165 | private function getDefaultQuery() { |
166 | 166 | if ( !isset( $this->mDefaultQuery ) ) { |
167 | 167 | $this->mDefaultQuery = $_GET; |
— | — | @@ -239,7 +239,7 @@ |
240 | 240 | Xml::checkLabel( wfMsg( 'log-title-wildcard' ), 'pattern', 'pattern', $pattern ) . |
241 | 241 | '</span>'; |
242 | 242 | } |
243 | | - |
| 243 | + |
244 | 244 | private function getExtraInputs( $types ) { |
245 | 245 | global $wgRequest; |
246 | 246 | $offender = $wgRequest->getVal('offender'); |
— | — | @@ -271,17 +271,17 @@ |
272 | 272 | |
273 | 273 | $title = Title::makeTitle( $row->log_namespace, $row->log_title ); |
274 | 274 | $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 ); |
276 | 276 | // User links |
277 | | - if( self::isDeleted($row,LogPage::DELETED_USER) ) { |
| 277 | + if( self::isDeleted( $row, LogPage::DELETED_USER ) ) { |
278 | 278 | $userLink = '<span class="history-deleted">' . wfMsgHtml( 'rev-deleted-user' ) . '</span>'; |
279 | 279 | } else { |
280 | 280 | $userLink = $this->skin->userLink( $row->log_user, $row->user_name ) . |
281 | 281 | $this->skin->userToolLinks( $row->log_user, $row->user_name, true, 0, $row->user_editcount ); |
282 | 282 | } |
283 | 283 | // 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>'; |
286 | 286 | } else { |
287 | 287 | $comment = $wgContLang->getDirMark() . $this->skin->commentBlock( $row->log_comment ); |
288 | 288 | } |
— | — | @@ -289,16 +289,16 @@ |
290 | 290 | $paramArray = LogPage::extractParams( $row->log_params ); |
291 | 291 | $revert = $del = ''; |
292 | 292 | // 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' ) ) { |
294 | 294 | // Don't show useless link to people who cannot hide revisions |
295 | 295 | if( $row->log_deleted || $wgUser->isAllowed( 'deleterevision' ) ) { |
296 | 296 | $del = $this->getShowHideLinks( $row ) . ' '; |
297 | 297 | } |
298 | 298 | } |
299 | 299 | // 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 ) ) { |
301 | 301 | // 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] ) ) { |
303 | 303 | $destTitle = Title::newFromText( $paramArray[0] ); |
304 | 304 | if( $destTitle ) { |
305 | 305 | $revert = '(' . $this->skin->link( |
— | — | @@ -315,7 +315,7 @@ |
316 | 316 | ) . ')'; |
317 | 317 | } |
318 | 318 | // 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' ) ) { |
320 | 320 | if( !$wgUser->isAllowed( 'undelete' ) ) { |
321 | 321 | $viewdeleted = $this->message['undeleteviewlink']; |
322 | 322 | } else { |
— | — | @@ -330,7 +330,7 @@ |
331 | 331 | array( 'known', 'noclasses' ) |
332 | 332 | ) . ')'; |
333 | 333 | // 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' ) ) { |
335 | 335 | $revert = '(' . |
336 | 336 | $this->skin->link( |
337 | 337 | SpecialPage::getTitleFor( 'Ipblocklist' ), |
— | — | @@ -353,7 +353,7 @@ |
354 | 354 | ')'; |
355 | 355 | // Show change protection link |
356 | 356 | } else if( self::typeAction( $row, 'protect', array( 'modify', 'protect', 'unprotect' ) ) ) { |
357 | | - $revert .= ' (' . |
| 357 | + $revert .= ' (' . |
358 | 358 | $this->skin->link( $title, |
359 | 359 | $this->message['hist'], |
360 | 360 | array(), |
— | — | @@ -372,21 +372,21 @@ |
373 | 373 | } |
374 | 374 | $revert .= ')'; |
375 | 375 | // Show unmerge link |
376 | | - } else if( self::typeAction($row,'merge','merge','mergehistory') ) { |
| 376 | + } else if( self::typeAction( $row, 'merge', 'merge', 'mergehistory' ) ) { |
377 | 377 | $merge = SpecialPage::getTitleFor( 'Mergehistory' ); |
378 | | - $revert = '(' . $this->skin->link( |
| 378 | + $revert = '(' . $this->skin->link( |
379 | 379 | $merge, |
380 | 380 | $this->message['revertmerge'], |
381 | 381 | array(), |
382 | 382 | array( |
383 | 383 | 'target' => $paramArray[0], |
384 | | - 'dest' => $title->getPrefixedDBkey(), |
| 384 | + 'dest' => $title->getPrefixedDBkey(), |
385 | 385 | 'mergepoint' => $paramArray[1] |
386 | 386 | ), |
387 | 387 | array( 'known', 'noclasses' ) |
388 | 388 | ) . ')'; |
389 | 389 | // 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' ) ) { |
391 | 391 | if( count($paramArray) >= 2 ) { |
392 | 392 | // Different revision types use different URL params... |
393 | 393 | $key = $paramArray[0]; |
— | — | @@ -397,10 +397,10 @@ |
398 | 398 | // Diff link for single rev deletions |
399 | 399 | if( count($Ids) == 1 ) { |
400 | 400 | // Live revision diffs... |
401 | | - if( in_array($key, array('oldid','revision')) ) { |
| 401 | + if( in_array( $key, array( 'oldid', 'revision' ) ) ) { |
402 | 402 | $revert[] = $this->skin->link( |
403 | 403 | $title, |
404 | | - $this->message['diff'], |
| 404 | + $this->message['diff'], |
405 | 405 | array(), |
406 | 406 | array( |
407 | 407 | 'diff' => intval( $Ids[0] ), |
— | — | @@ -409,7 +409,7 @@ |
410 | 410 | array( 'known', 'noclasses' ) |
411 | 411 | ); |
412 | 412 | // Deleted revision diffs... |
413 | | - } else if( in_array($key, array('artimestamp','archive')) ) { |
| 413 | + } else if( in_array( $key, array( 'artimestamp','archive' ) ) ) { |
414 | 414 | $revert[] = $this->skin->link( |
415 | 415 | SpecialPage::getTitleFor( 'Undelete' ), |
416 | 416 | $this->message['diff'], |
— | — | @@ -439,7 +439,7 @@ |
440 | 440 | $revert = wfMsg( 'parentheses', $wgLang->pipeList( $revert ) ); |
441 | 441 | } |
442 | 442 | // 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' ) ) { |
444 | 444 | if( count($paramArray) >= 1 ) { |
445 | 445 | $revdel = SpecialPage::getTitleFor( 'Revisiondelete' ); |
446 | 446 | // $paramArray[1] is a CSV of the IDs |
— | — | @@ -459,7 +459,7 @@ |
460 | 460 | ) . ')'; |
461 | 461 | } |
462 | 462 | // Self-created users |
463 | | - } else if( self::typeAction($row,'newusers','create2') ) { |
| 463 | + } else if( self::typeAction( $row, 'newusers', 'create2' ) ) { |
464 | 464 | if( isset( $paramArray[0] ) ) { |
465 | 465 | $revert = $this->skin->userToolLinks( $paramArray[0], $title->getDBkey(), true ); |
466 | 466 | } else { |
— | — | @@ -477,15 +477,15 @@ |
478 | 478 | &$comment, &$revert, $row->log_timestamp ) ); |
479 | 479 | } |
480 | 480 | // 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>'; |
483 | 483 | } else { |
484 | 484 | $action = LogPage::actionText( $row->log_type, $row->log_action, $title, |
485 | 485 | $this->skin, $paramArray, true ); |
486 | 486 | } |
487 | 487 | |
488 | 488 | // Any tags... |
489 | | - list($tagDisplay, $newClasses) = ChangeTags::formatSummaryRow( $row->ts_tags, 'logevent' ); |
| 489 | + list( $tagDisplay, $newClasses ) = ChangeTags::formatSummaryRow( $row->ts_tags, 'logevent' ); |
490 | 490 | $classes = array_merge( $classes, $newClasses ); |
491 | 491 | |
492 | 492 | if( $revert != '' ) { |
— | — | @@ -506,16 +506,16 @@ |
507 | 507 | // If event was hidden from sysops |
508 | 508 | if( !self::userCan( $row, LogPage::DELETED_RESTRICTED ) ) { |
509 | 509 | $del = Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ), |
510 | | - '('.$this->message['rev-delundel'].')' ); |
| 510 | + '(' . $this->message['rev-delundel'] . ')' ); |
511 | 511 | } else if( $row->log_type == 'suppress' ) { |
512 | 512 | $del = ''; // No one should be hiding from the oversight log |
513 | 513 | } else { |
514 | 514 | $target = SpecialPage::getTitleFor( 'Log', $row->log_type ); |
515 | 515 | $page = Title::makeTitle( $row->log_namespace, $row->log_title ); |
516 | | - $query = array( |
| 516 | + $query = array( |
517 | 517 | 'target' => $target->getPrefixedDBkey(), |
518 | 518 | 'type' => 'logging', |
519 | | - 'ids' => $row->log_id, |
| 519 | + 'ids' => $row->log_id, |
520 | 520 | ); |
521 | 521 | $del = $this->skin->revDeleteLink( $query, |
522 | 522 | self::isDeleted( $row, LogPage::DELETED_RESTRICTED ) ); |
— | — | @@ -532,10 +532,10 @@ |
533 | 533 | */ |
534 | 534 | public static function typeAction( $row, $type, $action, $right='' ) { |
535 | 535 | $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; |
537 | 537 | 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; |
540 | 540 | if( $match && $right ) { |
541 | 541 | global $wgUser; |
542 | 542 | $match = $wgUser->isAllowed( $right ); |
— | — | @@ -575,7 +575,7 @@ |
576 | 576 | * @return Boolean |
577 | 577 | */ |
578 | 578 | public static function isDeleted( $row, $field ) { |
579 | | - return ($row->log_deleted & $field) == $field; |
| 579 | + return ( $row->log_deleted & $field ) == $field; |
580 | 580 | } |
581 | 581 | |
582 | 582 | /** |
— | — | @@ -585,16 +585,15 @@ |
586 | 586 | * @param $page String The page title to show log entries for |
587 | 587 | * @param $user String The user who made the log entries |
588 | 588 | * @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 |
599 | 598 | * @return Integer Number of total log items (not limited by $lim) |
600 | 599 | */ |
601 | 600 | public static function showLogExtract( &$out, $types=array(), $page='', $user='', |
— | — | @@ -617,7 +616,7 @@ |
618 | 617 | $conds = $param['conds']; |
619 | 618 | $showIfEmpty = $param['showIfEmpty']; |
620 | 619 | $msgKey = $param['msgKey']; |
621 | | - if ( !is_array($msgKey) ) |
| 620 | + if ( !is_array( $msgKey ) ) |
622 | 621 | $msgKey = array( $msgKey ); |
623 | 622 | # Insert list of top 50 (or top $lim) items |
624 | 623 | $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, 0 ); |
— | — | @@ -632,11 +631,11 @@ |
633 | 632 | $s = '<div class="mw-warning-with-logexcerpt">'; |
634 | 633 | |
635 | 634 | if ( count( $msgKey ) == 1 ) { |
636 | | - $s .= wfMsgExt( $msgKey[0], array('parse') ); |
| 635 | + $s .= wfMsgExt( $msgKey[0], array( 'parse' ) ); |
637 | 636 | } else { // Process additional arguments |
638 | 637 | $args = $msgKey; |
639 | 638 | array_shift( $args ); |
640 | | - $s .= wfMsgExt( $msgKey[0], array('parse'), $args ); |
| 639 | + $s .= wfMsgExt( $msgKey[0], array( 'parse' ), $args ); |
641 | 640 | } |
642 | 641 | } |
643 | 642 | $s .= $loglist->beginLogEventsList() . |
— | — | @@ -837,7 +836,7 @@ |
838 | 837 | global $wgMiserMode, $wgUser; |
839 | 838 | |
840 | 839 | $title = Title::newFromText( $page ); |
841 | | - if( strlen($page) == 0 || !$title instanceof Title ) |
| 840 | + if( strlen( $page ) == 0 || !$title instanceof Title ) |
842 | 841 | return false; |
843 | 842 | |
844 | 843 | $this->title = $title->getPrefixedText(); |
— | — | @@ -899,7 +898,7 @@ |
900 | 899 | 'log_timestamp', 'user_name', 'user_editcount' ), |
901 | 900 | 'conds' => $this->mConds, |
902 | 901 | 'options' => $options, |
903 | | - 'join_conds' => array( |
| 902 | + 'join_conds' => array( |
904 | 903 | 'user' => array( 'INNER JOIN', 'user_id=log_user' ), |
905 | 904 | 'log_search' => array( 'INNER JOIN', 'ls_log_id=log_id' ) |
906 | 905 | ) |