X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FLogEventsList.php;h=e8d437910ee8a1fd27482c36ae11fe6287559944;hb=004b81ff4eb72d26b3515c4461aac36db8b95f6d;hp=1bf4ec09095c628c46d2a8ccd3d0b16a2a08780d;hpb=62732def2bdcd3803605046ae99b9f2327062354;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/LogEventsList.php b/includes/LogEventsList.php index 1bf4ec0909..e8d437910e 100644 --- a/includes/LogEventsList.php +++ b/includes/LogEventsList.php @@ -41,7 +41,7 @@ class LogEventsList { $messages = array( 'revertmerge', 'protect_change', 'unblocklink', 'change-blocklink', 'revertmove', 'undeletelink', 'revdel-restore', 'rev-delundel', 'hist', 'pipe-separator' ); foreach( $messages as $msg ) { - $this->message[$msg] = wfMsgExt( $msg, array( 'escape' ) ); + $this->message[$msg] = wfMsgExt( $msg, array( 'escapenoentities' ) ); } } } @@ -65,10 +65,11 @@ class LogEventsList { * @param $pattern String * @param $year Integer: year * @param $month Integer: month - * @param $filter Boolean + * @param $filter: array + * @param $tagFilter: array? */ public function showOptions( $type = '', $user = '', $page = '', $pattern = '', $year = '', - $month = '', $filter = null, $tagFilter='' ) + $month = '', $filter = null, $tagFilter='' ) { global $wgScript, $wgMiserMode; $action = htmlspecialchars( $wgScript ); @@ -84,7 +85,7 @@ class LogEventsList { $this->getUserInput( $user ) . "\n" . $this->getTitleInput( $page ) . "\n" . ( !$wgMiserMode ? ($this->getTitlePattern( $pattern )."\n") : "" ) . - "

" . $this->getDateMenu( $year, $month ) . "\n" . + "

" . Xml::dateMenu( $year, $month ) . "\n" . ( $tagSelector ? Xml::tags( 'p', null, implode( ' ', $tagSelector ) ) :'' ). "\n" . ( $filter ? "

".$this->getFilterLinks( $type, $filter )."\n" : "" ) . "\n" . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "

\n" . @@ -93,20 +94,22 @@ class LogEventsList { } private function getFilterLinks( $logType, $filter ) { - global $wgTitle; + global $wgTitle, $wgLang; // show/hide links $messages = array( wfMsgHtml( 'show' ), wfMsgHtml( 'hide' ) ); // Option value -> message mapping $links = array(); + $hiddens = ''; // keep track for "go" button foreach( $filter as $type => $val ) { $hideVal = 1 - intval($val); $link = $this->skin->makeKnownLinkObj( $wgTitle, $messages[$hideVal], wfArrayToCGI( array( "hide_{$type}_log" => $hideVal ), $this->getDefaultQuery() ) ); $links[$type] = wfMsgHtml( "log-show-hide-{$type}", $link ); + $hiddens .= Xml::hidden( "hide_{$type}_log", $val ) . "\n"; } // Build links - return implode( ' | ', $links ); + return ''.$wgLang->pipeList( $links ) . '' . $hiddens; } private function getDefaultQuery() { @@ -177,37 +180,6 @@ class LogEventsList { return Xml::inputLabel( wfMsg( 'speciallogtitlelabel' ), 'page', 'page', 20, $title ); } - /** - * @param $year Integer - * @param $month Integer - * @return string Formatted HTML - */ - private function getDateMenu( $year, $month ) { - # Offset overrides year/month selection - if( $month && $month !== -1 ) { - $encMonth = intval( $month ); - } else { - $encMonth = ''; - } - if ( $year ) { - $encYear = intval( $year ); - } else if( $encMonth ) { - $thisMonth = intval( gmdate( 'n' ) ); - $thisYear = intval( gmdate( 'Y' ) ); - if( intval($encMonth) > $thisMonth ) { - $thisYear--; - } - $encYear = $thisYear; - } else { - $encYear = ''; - } - return Xml::label( wfMsg( 'year' ), 'year' ) . ' '. - Xml::input( 'year', 4, $encYear, array('id' => 'year', 'maxlength' => 4) ) . - ' '. - Xml::label( wfMsg( 'month' ), 'month' ) . ' '. - Xml::monthSelector( $encMonth, -1 ); - } - /** * @return boolean Checkbox */ @@ -280,7 +252,7 @@ class LogEventsList { array(), array( 'action' => 'unblock', 'ip' => $row->log_title ), 'known' ) - . ' ' . $this->message['pipe-separator'] . ' ' . + . $this->message['pipe-separator'] . $this->skin->link( SpecialPage::getTitleFor( 'Blockip', $row->log_title ), $this->message['change-blocklink'], array(), array(), 'known' ) . @@ -293,7 +265,7 @@ class LogEventsList { array(), array( 'action' => 'history', 'offset' => $row->log_timestamp ) ); if( $wgUser->isAllowed( 'protect' ) ) { - $revert .= ' ' . $this->message['pipe-separator'] . ' ' . + $revert .= $this->message['pipe-separator'] . $this->skin->link( $title, $this->message['protect_change'], array(), @@ -523,7 +495,7 @@ class LogPager extends ReverseChronologicalPager { $this->mLogEventsList = $list; - $this->limitType( $type ); + $this->limitType( $type ); // also excludes hidden types $this->limitUser( $user ); $this->limitTitle( $title, $pattern ); $this->getDateCond( $year, $month ); @@ -600,6 +572,8 @@ class LogPager extends ReverseChronologicalPager { $this->mConds[] = "NULL"; } else { $this->mConds['log_user'] = $userid; + // Paranoia: avoid brute force searches (bug 17342) + $this->mConds[] = 'log_deleted & ' . LogPage::DELETED_USER . ' = 0'; $this->user = $usertitle->getText(); } } @@ -640,6 +614,8 @@ class LogPager extends ReverseChronologicalPager { $this->mConds['log_namespace'] = $ns; $this->mConds['log_title'] = $title->getDBkey(); } + // Paranoia: avoid brute force searches (bug 17342) + $this->mConds[] = 'log_deleted & ' . LogPage::DELETED_ACTION . ' = 0'; } public function getQueryInfo() {