31 parent::__construct(
'Log' );
37 $this->
getOutput()->addModules(
'mediawiki.userSuggest' );
41 $opts->
add(
'type',
'' );
42 $opts->add(
'user',
'' );
43 $opts->add(
'page',
'' );
44 $opts->add(
'pattern',
false );
47 $opts->add(
'tagfilter',
'' );
48 $opts->add(
'offset',
'' );
49 $opts->add(
'dir',
'' );
50 $opts->add(
'offender',
'' );
51 $opts->add(
'subtype',
'' );
52 $opts->add(
'logid',
'' );
55 $opts->fetchValuesFromRequest( $this->
getRequest() );
56 if ( $par !==
null ) {
60 # Don't let the user get stuck with a certain date
61 if ( $opts->getValue(
'offset' ) || $opts->getValue(
'dir' ) ==
'prev' ) {
62 $opts->setValue(
'year',
'' );
63 $opts->setValue(
'month',
'' );
69 $logRestrictions = $this->
getConfig()->get(
'LogRestrictions' );
70 $type = $opts->getValue(
'type' );
72 $opts->setValue(
'type',
'' );
73 } elseif ( isset( $logRestrictions[
$type] )
74 && !$this->
getUser()->isAllowed( $logRestrictions[
$type] )
79 # Handle type-specific inputs
81 if ( $opts->getValue(
'type' ) ==
'suppress' ) {
82 $offender = User::newFromName( $opts->getValue(
'offender' ),
false );
83 if ( $offender && $offender->getId() > 0 ) {
84 $qc = [
'ls_field' =>
'target_author_id',
'ls_value' => $offender->getId() ];
85 } elseif ( $offender && IP::isIPAddress( $offender->getName() ) ) {
86 $qc = [
'ls_field' =>
'target_author_ip',
'ls_value' => $offender->getName() ];
91 'SpecialLogAddLogSearchRelations',
92 [ $opts->getValue(
'type' ), $this->getRequest(), &$qc ]
96 # Some log types are only for a 'User:' title but we might have been given
97 # only the username instead of the full title 'User:username'. This part try
98 # to lookup for a user by that name and eventually fix user input. See T3697.
99 if ( in_array( $opts->getValue(
'type' ), self::getLogTypesOnUser() ) ) {
100 # ok we have a type of log which expect a user title.
101 $target = Title::newFromText( $opts->getValue(
'page' ) );
102 if ( $target && $target->getNamespace() ===
NS_MAIN ) {
103 # User forgot to add 'User:', we are adding it for him
104 $opts->setValue(
'page',
105 Title::makeTitleSafe( NS_USER, $opts->getValue(
'page' ) )
110 $this->
show( $opts, $qc );
122 static $types =
null;
123 if ( $types !==
null ) {
132 Hooks::run(
'GetLogTypesOnUser', [ &$types ] );
142 $subpages = $this->
getConfig()->get(
'LogTypes' );
160 $par = $par !==
null ? $par :
'';
161 $parms = explode(
'/', $par );
162 $symsForAll = [
'*',
'all' ];
163 if ( $parms[0] !=
'' &&
164 ( in_array( $par, $this->
getConfig()->
get(
'LogTypes' ) ) || in_array( $par, $symsForAll ) )
167 } elseif ( count( $parms ) == 2 ) {
168 $opts->
setValue(
'type', $parms[0] );
169 $opts->
setValue(
'user', $parms[1] );
170 } elseif ( $par !=
'' ) {
176 # Create a LogPager item to get the results and a LogEventsList item to format them...
200 if ( $pager->getPerformer() ) {
201 $performerUser = User::newFromName( $pager->getPerformer(),
false );
202 $this->
getSkin()->setRelevantUser( $performerUser );
206 $loglist->showOptions(
208 $pager->getPerformer(),
210 $pager->getPattern(),
213 $pager->getFilterParams(),
214 $pager->getTagFilter(),
219 $logBody = $pager->getBody();
222 $pager->getNavigationBar() .
223 $this->getActionButtons(
224 $loglist->beginLogEventsList() .
226 $loglist->endLogEventsList()
228 $pager->getNavigationBar()
231 $this->
getOutput()->addWikiMsg(
'logempty' );
237 $canRevDelete = $user->isAllowedAll(
'deletedhistory',
'deletelogentry' );
239 # If the user doesn't have the ability to delete log entries nor edit tags,
240 # don't bother showing them the button(s).
241 if ( !$canRevDelete && !$showTagEditUI ) {
242 return $formcontents;
245 # Show button to hide log entries and/or edit change tags
246 $s = Html::openElement(
248 [
'action' =>
wfScript(),
'id' =>
'mw-log-deleterevision-submit' ]
250 $s .= Html::hidden(
'action',
'historysubmit' ) .
"\n";
251 $s .= Html::hidden(
'type',
'logging' ) .
"\n";
254 if ( $canRevDelete ) {
255 $buttons .= Html::element(
259 'name' =>
'revisiondelete',
261 'class' =>
"deleterevision-log-submit mw-log-deleterevision-button"
263 $this->
msg(
'showhideselectedlogentries' )->
text()
266 if ( $showTagEditUI ) {
267 $buttons .= Html::element(
271 'name' =>
'editchangetags',
273 'class' =>
"editchangetags-log-submit mw-log-editchangetags-button"
275 $this->
msg(
'log-edit-tags' )->
text()
281 $s .= $buttons . $formcontents . $buttons;
282 $s .= Html::closeElement(
'form' );
294 $this->
getOutput()->setPageTitle( $page->getName() );
295 $this->
getOutput()->addHTML( $page->getDescription()
296 ->setContext( $this->getContext() )->parseAsBlock() );
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
Class for generating clickable toggle links for a list of checkboxes.
Class to simplify the use of log pages.
static isLogType( $type)
Is $type a valid log type.
Show an error when a user tries to do something they do not have the necessary permissions for.
A special page that lists log entries.
getSubpagesForPrefixSearch()
Return an array of subpages that this special page will accept.
execute( $par)
Default execute method Checks user permissions.
static getLogTypesOnUser()
List log type for which the target is a user Thus if the given target is in NS_MAIN we can alter it t...
show(FormOptions $opts, array $extraConds)
parseParams(FormOptions $opts, $par)
Set options based on the subpage title parts:
getActionButtons( $formcontents)
addHeader( $type)
Set page title and show header for this log type.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Parent class for all special pages.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User executing this instance.
getSkin()
Shortcut to get the skin being used for this instance.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
getRequest()
Get the WebRequest being used for this instance.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text