41 parent::__construct(
$page->getContext() );
45 static $headers =
null;
47 if ( $headers ===
null ) {
49 'ipb_timestamp' =>
'blocklist-timestamp',
50 'ipb_target' =>
'blocklist-target',
51 'ipb_expiry' =>
'blocklist-expiry',
52 'ipb_by' =>
'blocklist-by',
53 'ipb_params' =>
'blocklist-params',
54 'ipb_reason' =>
'blocklist-reason',
56 foreach ( $headers as $key => $val ) {
57 $headers[$key] = $this->
msg( $val )->text();
66 if ( $msg ===
null ) {
72 'blocklist-nousertalk',
77 foreach (
$keys as $key ) {
78 $msg[$key] = $this->
msg( $key )->text();
89 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
93 $formatted = htmlspecialchars( $language->userTimeAndDate(
$value, $this->getUser() ) );
97 if ( $row->ipb_auto ) {
98 $formatted = $this->
msg(
'autoblockid', $row->ipb_id )->parse();
113 $formatted = htmlspecialchars( $target );
119 $formatted = htmlspecialchars( $language->formatExpiry(
123 if ( $this->
getUser()->isAllowed(
'block' ) ) {
124 if ( $row->ipb_auto ) {
129 [
'wpTarget' =>
"#{$row->ipb_id}" ]
138 $msg[
'change-blocklink']
141 $formatted .=
' ' . Html::rawElement(
143 [
'class' =>
'mw-blocklist-actions' ],
144 $this->
msg(
'parentheses' )->rawParams(
145 $language->pipeList( $links ) )->escaped()
148 if (
$value !==
'infinity' ) {
150 $formatted .=
'<br />' . $this->
msg(
151 'ipb-blocklist-duration-left',
152 $language->formatDuration(
153 $timestamp->getTimestamp() - time(),
167 if ( isset( $row->by_user_name ) ) {
171 $formatted = htmlspecialchars( $row->ipb_by_text );
182 if ( $row->ipb_anon_only ) {
183 $properties[] = htmlspecialchars( $msg[
'anononlyblock'] );
185 if ( $row->ipb_create_account ) {
186 $properties[] = htmlspecialchars( $msg[
'createaccountblock'] );
188 if ( $row->ipb_user && !$row->ipb_enable_autoblock ) {
189 $properties[] = htmlspecialchars( $msg[
'noautoblockblock'] );
192 if ( $row->ipb_block_email ) {
193 $properties[] = htmlspecialchars( $msg[
'emailblock'] );
196 if ( !$row->ipb_allow_usertalk ) {
197 $properties[] = htmlspecialchars( $msg[
'blocklist-nousertalk'] );
200 $formatted = $language->commaList( $properties );
204 $formatted =
"Unable to format $name";
215 'tables' => [
'ipblocks',
'user' ] + $commentQuery[
'tables'],
222 'by_user_name' =>
'user_name',
226 'ipb_create_account',
227 'ipb_enable_autoblock',
233 'ipb_allow_usertalk',
234 ] + $commentQuery[
'fields'],
236 'join_conds' => [
'user' => [
'LEFT JOIN',
'user_id = ipb_by' ] ] + $commentQuery[
'joins']
239 # Filter out any expired blocks
241 $info[
'conds'][] =
'ipb_expiry > ' . $db->addQuotes( $db->timestamp() );
243 # Is the user allowed to see hidden blocks?
244 if ( !$this->
getUser()->isAllowed(
'hideuser' ) ) {
245 $info[
'conds'][
'ipb_deleted'] = 0;
258 $res =
$dbr->selectField(
'ipblocks',
259 [
'COUNT(*) AS totalautoblocks' ],
262 'ipb_expiry >= ' .
$dbr->addQuotes(
$dbr->timestamp() ),
272 return parent::getTableClass() .
' mw-blocklist';
276 return 'ipb_timestamp';
280 return 'ipb_timestamp';
292 # Do a link batch query
296 foreach ( $result as $row ) {
297 $lb->add( NS_USER, $row->ipb_address );
300 if ( isset( $row->by_user_name ) ) {
301 $lb->add( NS_USER, $row->by_user_name );
static parseTarget( $target)
From an existing Block, get the target and the type of target.
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
getUser()
Get the User object.
getLanguage()
Get the Language object.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
setCaller( $caller)
Use ->setCaller( METHOD ) to indicate which code is using this class.
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
const TOOL_LINKS_NOBLOCK
Flags for userToolLinks()
static userToolLinks( $userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null)
Generate standard user tool links (talk, contributions, block link, etc.)
static formatComment( $comment, $title=null, $local=false, $wikiId=null)
This function is called by all recent changes variants, by the page history, and by the user contribu...
Library for creating and parsing MW-style timestamps.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form before processing starts Return false to skip default processing and return $ret $linkRenderer