Commit graph

147 commits

Author SHA1 Message Date
Max Semenik
6e956d55aa Replace call_user_func_array(), part 2
Uses new PHP 5.6 syntax like ...parameter unpacking and
calling anything looking like a callback to make the code more readable.
There are much more occurrences but this commit is intentionally limited
to an easily reviewable size.

In one occurrence, a simple conditional instead of trickery was much more readable.

This patch finishes all the easy stuf in the core, the remainder is either unobvious
or would result in smaller readability gains. It will be carefully dealt with in
further commits.

Change-Id: I79a16c48bfb98b75e5b99f2f6f4fa07b3ae02c5b
2018-06-07 20:19:26 -07:00
David Barratt
3481e3b2e0
Create Expiry Widget with Date Time Selector
Special:Block needs a date time selector for easier selection of expiry. To
accommodate this cleanly, a new Expiry Widget is created that handles this
logic.

Bug: T132220
Change-Id: I2853a2ca0ae6ccead3978f4bb50a77c2baa3a150
2018-04-19 20:24:08 -04:00
Brad Jorsch
ccc1c08089 Update more forms to limit comments by codepoints rather than bytes
This updates the deletion forms, Special:Block, Special:EditTags,
Special:MovePage, Special:RevisionDelete, Special:Undelete, and
Special:UserRights to limit by code point count rather than by byte (or,
in some cases, by UTF-16 code unit).

Bug: T185948
Change-Id: I20d11d7cc4f58902cbcb6dda70af533bce6dd170
2018-02-26 13:16:19 -05:00
Bartosz Dziewoński
b2a0e3aac8 SpecialBlock: Tweaks for OOUI HTMLForm
* Expand both the dropdown and textfield of "Reason" field to the
  usual maximum width and display them on separate lines.
* Fix autohiding of form fields where applicable (checkboxes that only
  apply when blocking a user or an IP address).
* Fix bolding of the "Confirm block" label when blocking yourself.

Follow-up to d56758e134.

Bug: T107036
Change-Id: Ia5c54e518de99a79f5319c42ccf1a9a0e31ad471
2017-10-03 16:21:43 +02:00
Bartosz Dziewoński
d56758e134 SpecialBlock: Switch to OOUI form
* Remove additional wrapper, and the 'blockip-legend' message.
* Replace autocompletion using 'mediawiki.userSuggest' with OOUI,
  by using 'type' => 'user' for the username field

Bug: T107036
Change-Id: Ib8f7e03388073450ecff28ad2c0d3f9161f259d8
2017-09-29 20:38:00 +02:00
Umherirrender
f739a8f368 Improve some parameter docs
Add missing @return and @param to function docs and fixed some @param

Change-Id: I810727961057cfdcc274428b239af5975c57468d
2017-09-10 20:32:31 +02:00
Brad Jorsch
6ec1a31502 Handle comment truncation in CommentStore
Since the caller doesn't (and shouldn't) know whether CommentStore is
using the old or the new schema, it should leave truncation of comments
to CommentStore.

Change-Id: I92954c922514271d774518d6a6c28a01f33c88c2
2017-09-01 15:03:45 -04:00
Umherirrender
a9007e8baf Add missing & to @param documentation to match functon call
Change-Id: I81e68310abcbc59964b22e0e74842d509f6b1fb9
2017-08-11 18:47:46 +02:00
James D. Forrester
232bbccbad includes/specials: Replace implicit Bugzilla bug numbers with Phab ones
It's unreasonable to expect newbies to know that "bug 12345" means "Task T14345"
except where it doesn't, so let's just standardise on the real numbers.

Change-Id: Ic878feaea72893a1c47ea79ac284e581209e1731
2017-02-28 00:18:28 +00:00
Justin Du
f37a6d97b5 Fix tags not being set in Special:Block
Currently, a PHP error is thrown when tags are not set
in Special:Block on line 832. This patch fixes this
by adding an extra isset() check to see if the tags
variable is set.

Bug: T156486
Change-Id: Ib8722bffbcac5953263ded41eceb3d389d0932f0
2017-01-29 18:22:18 +00:00
Florianschmidtwelzow
4b49705613 Revert "Added reason suggestion in block/delete/protect forms"
See the task, this was probably entirely my fault not having
looked at this more carefully. Technically the change is ok,
however, it seems to doesn't make much sense in combination
with the Reason dropdown box.

This reverts commit faab2411c2.

Task: T34950
Change-Id: I1eeb9c68ff0db20d29e7d5f0fb18f0bfa3224416
2017-01-21 20:03:45 +01:00
jenkins-bot
892b17237b Merge "Add parameter to API modules to apply change tags to log entries" 2017-01-13 17:42:04 +00:00
This, that and the other
f3f2df07ec Add parameter to API modules to apply change tags to log entries
Adds support for tagging log entries for the block, import,
managetags, and move API modules, using a 'tags' parameter.

Bug: T97720
Change-Id: I9d75d2cece317a7704c4bc6d734ad3cafe24544e
2017-01-12 16:30:17 -06:00
rlot
8c7095be85 Improved parsing in reason suggests
Bug: T155086
Change-Id: I3a3167b7bfd9b5921df1cf3e4a3cf3e1da4ca001
2017-01-11 19:00:00 +01:00
rlot
faab2411c2 Added reason suggestion in block/delete/protect forms
Bug: T34950
Change-Id: I9778c4992b127c36355949665b4fdf7482e7e0e7
2017-01-10 21:18:51 +00:00
MtDu
d8c56ec84f Replace Linker::link() with LinkRenderer in some special pages
* SpecialAllPages
* SpecialAncientpage
* SpecialBlock
* SpecialBrokenRedirects
* SpecialDoubleRedirects

Bug: T149346
Change-Id: Ib9997ec29b5c0079acb79dc2772196b38665145d
2016-11-30 09:52:23 +00:00
Aaron Schulz
b726f0ddeb Add any prior block to BlockIpComplete hook
Also fixed some $user IDEA warnings.

Bug: T137287
Change-Id: I7c31e71e99dad0296244ced72b1e8949b8a8fa3d
2016-06-09 15:11:33 -07:00
Glaisher
a69c730dbb Make sure OtherBlockLogLink's second parameter is a string
Bug: T132935
Change-Id: I0583d166d8bfc50e6d10a0ac46c18aeadefad068
2016-04-29 22:38:35 +05:00
addshore
fee0afdc8a Move WatchedItem logic to WatchedItemStore
This also removes assumptions that when a page
in one Namespace should be watched / removed
that the page in the talk / subject ns for the
page should have the same action applied

This should maintain all backward compatability
for the WatchedItem class

This also includes tests written by:
 - WMDE-leszek
 - Addshore

Bug: T127956
Change-Id: Iad9abafe4417bb479151a3bfbee6e1c78a3afe3c
2016-03-08 15:41:22 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Aaron Schulz
7798b70e7e Define which SpecialPage classes expect write vs read mode
Bug: T123591
Change-Id: I521ebdd5e8eb8f7f4df927dc38732170aef2ac19
2016-01-14 14:40:37 -08:00
Florian
cdf10cac69 Special:Block: Disallow to add an expiry time in the past
Like the protect action, adding a block with an expiry time in the
past doesn't make any sense and should throw an error message, instead of
creating a useless block.

Bug: T123069
Change-Id: Ib168ace80ada248f0209af896ab8b8ecfac3ef29
2016-01-14 13:38:42 +00:00
jenkins-bot
0e289eae34 Merge "Add largest allowed range as parameter to block form message" 2016-01-06 18:42:17 +00:00
Gergő Tisza
e00fb51c3d Add largest allowed range as parameter to block form message
Change-Id: I17bcd5de01bb301193d849ec060fc3b5be6b14ab
2016-01-02 12:47:34 -08:00
umherirrender
3e0f3cfd43 Show user names as subpages of special pages in autocomplete search
The autocomplete search allows special pages to define the list of
subpages to be excepted. Use user names on the following special pages,
because these special pages can be called with a user name as subpage.

Special:Block
Special:Contributions
Special:DeletedContributions
Special:Emailuser
Special:Listfiles
Special:Unblock
Special:Userrights

This makes it easier to navigate to this special pages with a prefilled
user name field.

Hidden user names are always not shown, because the suggestion is cached
between priviliged user and non-priviliged user.

Change-Id: I7db575bf66caaa5136489ed99f1655673b55adaf
2015-12-29 11:49:58 +01:00
umherirrender
7fc0a99bcf Move some styles of convenience links to mediawiki.special
Moved the style of convenience links for special pages to the
mediawiki.special module to keep it out of shared.css

Change-Id: I57ba598c48f8c1ea4bca978b6bf83d157d9dad1c
2015-10-13 20:20:13 +00:00
Alex Monk
8682b8b90e Purge remaining oversight references from code
i18n change coming in a separate commit

Change-Id: I46b9311cd01e95e524587ce40dcbae62f58dc5a8
2015-09-16 18:21:44 +00:00
Bartosz Dziewoński
ca877c8796 SpecialBlock: Simplify HTMLForm submit callback handling
We can just use onSubmit() instead of our own custom stuff.
The comment stating that we can't is wrong; perhaps it used
to be correct, back when it was written.

Change-Id: Ib18fb7292a67b471e9ad13cf38038287b9bd2bd2
2015-07-27 17:14:32 +00:00
umherirrender
f32e0cdd3a Use Linker::linkKnown for some links to MediaWiki pages from navigation
The title used for Linker::link in all places are mediawiki pages, which
are known to be exists (and blue), because there are definied in en.json

Change-Id: Ib3b6e4f4f6cef059a502aaabfcfc17730b4445a6
2015-06-19 18:55:30 +02:00
jenkins-bot
fd62703d50 Merge "Fix edit link for messages in $wgForceUIMsgAsContentMsg" 2015-05-23 14:27:19 +00:00
umherirrender
e51eaf619f Fix edit link for messages in $wgForceUIMsgAsContentMsg
Some special pages or actions have a link for users with editinterface
rights to edit the message used in scroll down menu.
When the message is parsed for the scroll down menu the config
$wgForceUIMsgAsContentMsg is used, but that was not used for the edit
link.

Add a new function Message::getTitle and use it in all places in core.

Most benefit will have the edit link for MediaWiki:Licenses on
Special:Upload, because commons.wikimedia.org has that message in
$wgForceUIMsgAsContentMsg.

Change-Id: Ib800b9adcc9ae88ef53228b66838bf61d2065f0f
2015-05-15 20:38:32 +02:00
Federico Leva
e928d5bdd0 Allow to customise addHelpLink() target via system message
Method similar to SpecialPage::outputHeader() to avoid registering
tons of system messages and to have -summary and -helppage tidily
listed together in Special:AllMessages by default.

Bug: T45591
Change-Id: Ic849dde00be7379c1909a8486cf20f48c5aea5cf
2015-05-15 10:14:28 +02:00
Brad Jorsch
ac6f81d9ad Clean up handling of 'infinity'
There's a bunch of stuff that probably only works because the database
representation of infinity is actually 'infinity' on all databases
besides Oracle, and Oracle in general isn't maintained.

Generally, we should probably use 'infinity' everywhere except where
directly dealing with the database.

* Many extension callers of Language::formatExpiry() with $format !==
  true are assuming it'll return 'infinity', none are checking for
  $db->getInfinity().
* And Language::formatExpiry() would choke if passed 'infinity', despite
  callers doing this.
* And Language::formatExpiry() could be more useful for the API if we
  can override the string returned for infinity.
* As for core, Title is using Language::formatExpiry() with TS_MW which
  is going to be changing anyway. Extension callers mostly don't exist.
* Block already normalizes its mExpiry field (and ->getExpiry()),
  but some stuff is comparing it with $db->getInfinity() anyway. A few
  external users set mExpiry to $db->getInfinity(), but this is mostly
  because SpecialBlock::parseExpiryInput() returns $db->getInfinity()
  while most callers (including all extensions) are assuming 'infinity'.
* And for that matter, Block should use $db->decodeExpiry() instead of
  manually doing it, once we make that safe to call with 'infinity' for
  all the extensions passing $db->getInfinity() to Block's contructor.
* WikiPage::doUpdateRestrictions() and some of its callers are using
  $db->getInfinity(), when all the inserts using that value are using
  $db->encodeExpiry() which will convert 'infinity'.

This also cleans up a slave-lag issue I noticed in ApiBlock while
testing.

Bug: T92550
Change-Id: I5eb68c1fb6029da8289276ecf7c81330575029ef
2015-03-13 11:19:53 -04:00
JuneHyeon Bae
511525a136 Refactor out 'infinity' variants
Refactor out 'infinity' vartiant values which used in blocking and
protecting actions. This patchset adds GlobalFunction wfIsInfinity.

Bug: T68646
Change-Id: I60cc55a5bbd43c72916a1c2ea3807457d4e33765
2015-03-12 16:38:02 +00:00
jenkins-bot
5907e840cc Merge "Add top help link to MediaWiki.org in several pages via indicator" 2015-03-04 16:15:53 +00:00
Nemo bis
376c0a13df Add top help link to MediaWiki.org in several pages via indicator
All the chosen targets are translatable public domain help pages
on MediaWiki.org. Mostly special pages and actions for privileged
users for now.

Adapted from the Translate extension, credit to Niklas Laxström
(TranslateUtils::addSpecialHelpLink).

Depends on 6f5b29ff4e, whose commit
message has a typo addIndicator() instead of setIndicator().

Bug: T45591
Change-Id: I2934b1708a0d207dcf3d940264f140613646f203
2015-03-04 10:59:03 +01:00
JuneHyeon Bae
3191a0b042 Warn when user trying to block nonexistent user
Now, Special:Block/Some_User and Special:Block/No_Such_User act the
same. So show warning when user opened 'Special:Block/No_such_user'
page.

Bug: T37687
Change-Id: I60292e1016b64224a6146add58106c9028e7914c
2015-02-23 19:14:27 +00:00
umherirrender
c891ff00ed Migrate block log to new log system
This allows use of gender on Special:Log.
Old messages are kept for use in IRC.
A test was added to ensure an unchanged IRC message.

Bug: T57402
Change-Id: Ibc7fcaa5a952ff90d42a6477da4baa429f3de64b
2015-02-07 21:02:10 +01:00
Legoktm
7e27759603 Merge "Make HTMLForm::formatErrors non-static to can parse message in context" 2014-12-19 16:59:27 +00:00
umherirrender
cbdc6e53fe Make HTMLForm::formatErrors non-static to can parse message in context
One call in core already called it non-static

Avoid:
[GlobalTitleFail] MessageCache::parse called by
Message::toString/Message::parseText/MessageCache::parse with no title
set

Change-Id: Ic91e715177c0a4578825640a31ec68ecba3176e0
2014-12-19 16:31:55 +01:00
Niklas Laxström
a8e049e52a Remove double escaping in Special:Block
This function is used in two extensions, which also pass it to
HtmlForm, so no underescaping there either.

Change-Id: I93325051b3a6ef8fc242437a736b5c84bda56b7d
2014-12-18 20:04:27 +00:00
Ricordisamoa
fc5fd5c37a Typo fixes and non-code tweaks
Skipped replacements:
* prefered → preferred
* prolly → probably

Skipped files:
* resources/lib/jquery.ui/jquery.ui.mouse.js
* resources/lib/jquery/jquery.form.js

Change-Id: Ib7923f362ddfca1b892bf5d601785d6b5aa5d44c
2014-12-12 18:31:15 +00:00
Aaron Schulz
e369f66d00 Replace wfRunHooks calls with direct Hooks::run calls
* This avoids the overhead of an extra function call

Change-Id: I8ee996f237fd111873ab51965bded3d91e61e4dd
2014-12-10 12:26:59 -08:00
jenkins-bot
e4b551ca0e Merge "Add mediawiki.userSuggest to Special:Block/Unblock/BlockList" 2014-11-27 05:20:18 +00:00
umherirrender
201702e20c Add mediawiki.userSuggest to Special:Block/Unblock/BlockList
This gives a suggestion list when typing a username

Bug: T50240
Change-Id: Ic76a3e5af22f8764023d005d76dfa563d35e5e4d
2014-11-24 20:34:04 +00:00
umherirrender
b18197dd81 Allow maxlength attribute on HTMLSelectAndOtherField
A reason on a SelectAndOtherField can have two parts, one of the scroll
down box and a free text field. The free text field is actually
unlimited.
This patch allows the maxlength on that field. To respect the concat of
the two parts, also javascript code is added, which adds a dynamic
maxlength to respect also the text from the scroll down box.

The HTMLSelectAndOtherField is only used on Special:Block,
where the maxlength attribute is now set to 255 (length of the database
field ipb_reason).

Change-Id: I5c164b41ab047e7ecf9d92db6eddcc980e2db048
2014-11-16 21:35:51 +01:00
Douglas Gardner
e8943e51ed change [[Special:Block]] to destructive
Bug: 66145
Change-Id: I1ae04e15ea8046d50a58952f627a3e7d8bd941a4
2014-10-08 00:07:58 +01:00
umherirrender
135fcc4dc7 Truncate block reason for whole multibyte characters
This applies to Special:BlockList, or to the block message shown to the
user, or API results. Log is not effected, because it already truncates
on its own.

Change-Id: I0a8bae5f43fd1604034d65e96c9461a9f83c0b0a
2014-07-28 17:37:56 +00:00
umherirrender
768ac15c70 Cleanup some docs (includes/[s-z])
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: Ie419638e909a47aa72a274043604247830ee1a81
2014-07-24 19:43:44 +02:00
umherirrender
4fba87e53d Remove tabindex from Special:Block
There is a autofocus on the Target field, which sets the start of
tabbing and than all the other fields are tabbed in the correct native
order. No need for extra tabindex order.
Tested with IE11 and FF28

Bug: 61257
Change-Id: Ic0d7365447733a23fa87c1d9b91c0f4f0f61bb39
2014-05-10 16:21:37 +00:00