Commit graph

473 commits

Author SHA1 Message Date
Krinkle
2d03eedf8a WatchAction requires token (BREAKING CHANGE)
* (bug 27655) Require token for watching/unwatching pages
* Previously done for API (bug 29070) in r88522
* As with markpatrolled, the tokens are not compatible and made that way on purpose. The API requires the POST method and uses a universal token per-session. Since the front-end is all GET based (also per convention like in markpatrolled and rollback) they are stronger salted (title / action specific)
* ajax.watch used the API already and was switched in r88554.
* The actual watching/unwatching code was moved from WatchAction->onView to WatchAction::doWatch. This was done to allow the API to do the action without needing to generate a token like the front-end needs (or having to duplicate code). It is now similar to RecentChange::markPatrolled (in that it  also a "central" function that does not care about tokens, it's called after the token-handling)
* JavaScript / Gadgets that utilize action=watch in their scripts:
** Effects should be minimal as they should be using the API (see r88522 and wikitech-l)
** If they use index.php and scrap the link from the page, they can continue to do so.

* There are links to the watch action all over the place. I've tried to catch most of them, but there may be some I miss. Migration in most cases is just a matter of adding an array item to the $query for:
 'token' => WatchAction::getWatchToken( $title, $user [, $action] )
or changing:
 Action::factory( 'watch', $article )->execute();
to:
 WatchAction::doWatch( $title, $user );

While replacing the usages in some cases an instance of Article() no longer had to be created, in others $wgUser had to be retrieved from global (which was implied before but needs to be given directly now)

Other notes:
* Article->unwatch() and Article->watch(), which were deprecated as of 1.18 and are no longer used in core, may be broken in scenarios where the Request does not have a 'token' but is making a call to $article->watch()
* Some extensions need to be fixed, I'm currently running a grep search and will fix them a.s.a.p 


[1] http://www.mediawiki.org/wiki/ResourceLoader/Default_modules?mw.user#tokens
2011-06-06 00:09:03 +00:00
Sam Reed
ebef5e723b More documentation tweaks/additions 2011-05-26 19:52:56 +00:00
Alexandre Emsenhuber
4ac963f70f * Simplify message existence checks by using wfMessage() instead of wfMsg() with wfEmptyMsg()
* Fixed one check in Skin::addToSidebarPlain() that used user language for existence and content language for message's content
* Changed SkinTemplate::buildContentNavigationUrls() to use Title::getDefaultMessageText() instead of wfEmptyMsg()
2011-05-23 16:32:52 +00:00
Siebrand Mazeland
75c6696aa8 Use consistent notation for "@todo FIXME". Should update http://svn.wikimedia.org/doc/todo.html nicely. 2011-05-17 22:03:20 +00:00
Sam Reed
89438f89a0 Fix fail attempt at passing string by reference in r87589 2011-05-06 22:17:48 +00:00
Sam Reed
15df9a9d5c Kill off the long deprecated $wgInputEncoding and $wgOutputEncoding globals 2011-05-06 22:09:47 +00:00
Daniel Friesen
8569cc6203 Drop the $out params I added before I added context to Skin, as well deprecate some of the $out params in other methods. 2011-05-04 10:43:40 +00:00
Alexandre Emsenhuber
52fe58784a Moved "printfooter" and debug HTML away from "bodytext" so that they can be easily modified by extensions with the SkinTemplateOutputPageBeforeExec hook; always moved generation of debug HTML just before executing the hook so that it includes more items 2011-05-03 17:23:17 +00:00
Alexandre Emsenhuber
f3e7cac6f9 Removed Skin::$usercss, always false, nothing sets this 2011-05-03 09:43:34 +00:00
Alexandre Emsenhuber
126ceb56d7 Get the revision ID from the OutputPage object instead of making a copy 2011-05-02 15:26:19 +00:00
Roan Kattouw
6520a626bd (bug 26603) Followup r82232: fix double-escaping of returnto and returntoquery. Was caused by using two sources ($this->thisurl and $wgRequest) where one was already escaped and the other wasn't, then unconditionally escaping the result. 2011-04-22 10:47:13 +00:00
Alexandre Emsenhuber
27fafba3e9 Use Profiler::instance() instead of $wgProfiler 2011-04-21 15:53:25 +00:00
Happy-melon
2c9cfd7cce Refactor the factory/i18n/list/etc static methods from SpecialPage into their own class; there's no reason we need to be parsing them in every single SpecialPage subclass. Leave all the methods as stubs in SpecialPage.php; if we required PHP 5.3 they could be replaced by a a __callStatic() magic method, but that doesn't work on PHP 5.2.
Also make a few changes to the functions available.  SpecialPageFactory::resolveAlias() now takes an optional subpage and returns array(<name>,<subpage>).  Similarly merge getPage() and getPageByAlias().  There were many examples of (extensions particularly) making dubious assumptions about the presence or absence of subpages or canonical-ness.

I didn't deprecate SpecialPage::getTitleFor() as it's got over six hundred calls.  I'm rather undecided on the best position of getPage()/executePath().  Although the latter needs cleanup anyway.
2011-04-17 11:31:11 +00:00
Happy-melon
806c6d3cbe Fix some type hints, documentation and potentially-undefined-variables which PhpStorm was complaining about. 2011-04-16 22:05:54 +00:00
Max Semenik
12cb599cb7 Prevent bug 17790 from reappearing on Special:Preferences 2011-04-16 07:39:41 +00:00
Happy-melon
08d460d384 Follow-up r 86041 per CR and IRC:
* Article constructor needs to be called with zero as second parameter
* Run stylize.php over new files
* Add Action::getLang() for consistency with other context accessors
* Fix declaration of FormAction::alterForm(), doesn't need to be passed by reference
* Fix inline use of Credits::getCredits() in SkinTemplate and SkinLegacy
2011-04-14 12:17:24 +00:00
Paul Copperman
efb8c6b899 Fix some Notices:
* LanguageKaa.php: Fix ucfirst and lcfirst for empty strings.
* SkinTemplate.php: Fix undefined array access.
* ProxyTools.php: When running hiphop in cli mode, apache_request_headers() returns null. Fix wfGetForwardedFor() to account for that.
2011-04-11 16:49:36 +00:00
Daniel Friesen
b185adf24f Continue with r85240; Move getSkin from User to RequestContext, do it without globals, strip out the non-functional $title related stuff, and update Skin to use a RequestContext. 2011-04-03 12:46:36 +00:00
Alexandre Emsenhuber
b7f8d0f41d * Moved all <link> definitions in OutputPage::getHeadLinks() instead of having them in a *lot* of different functions
* Also moved there generic <meta> and removed OutputPage::addDefaultMeta() with its $called static local variable which was breaking the output when generating multiple pages on the same request (rebuildFileCache.php, dumpHTML.php) since that function could only be executed completely once for all instances, and not once per instance
* Moved default module from OutputPage::output() to its own function and don't call it when executing a body only request, since it's useless in that case
* Call Skin::setMembers() from Skin::initPage() instead of Skin::outputPage()
2011-04-02 18:38:42 +00:00
Daniel Friesen
31c2d418bf Fix bug 28053. Just move createacount link stuff out of the ipinheader spot to where it should be. 2011-03-15 07:21:44 +00:00
Happy-melon
b2d91f90e4 Follow-up r83786: update references in SpecialPage::getTitleFor() and friends to point to 'Block' rather than 'Blockip'; should fix errors on translatewiki. 2011-03-12 23:22:34 +00:00
Daniel Friesen
bc19677685 Reduce usage of $wgOut inside Skin. 2011-03-03 10:22:46 +00:00
Sam Reed
64be8c7b26 Ununsed variables
Documentation and explicit definitions
2011-02-23 12:35:41 +00:00
Alexandre Emsenhuber
683fb93ee2 * Use appendQueryValue() instead of appendQuery() so that if e.g. printable=no is already present in the URL, it doesn't become printable=no&printable=yes
* Call getLocalURL() on the local Title object instead of $wgTitle in WebRequest
2011-02-18 12:25:22 +00:00
Sam Reed
8b1bdb6e68 Remove unreachable line in DifferenceEngine
Documentation for ObjectCache.php

Remove unused variables from CompareParsers and PreprocessDump
2011-02-18 01:06:04 +00:00
Sam Reed
b7b4f15381 Fixup assignment in conditional 2011-02-18 00:57:39 +00:00
Roan Kattouw
130052e88a (bug 26603) returnto parameter in login link not escaped when viewed on Special:Userlogout 2011-02-16 11:28:58 +00:00
Alexandre Emsenhuber
b2a0cc74d5 Moved wfGetSiteNotice(), wfGetNamespaceNotice() and wfGetCachedNotice() to Skin call to allow passing the Skin object to the SiteNoticeBefore and SiteNoticeAfter hooks.
I didn't left compatibility functions since there's no other call to these functions in core or extensions.
2011-02-12 21:24:05 +00:00
Alexandre Emsenhuber
9ecc4e195e No need to set a new MediaWiki_I18N object, already done when creating a QuickTemplate object 2011-02-12 14:42:20 +00:00
Happy-melon
da36f65433 Follow-up r64670 (bug22929): cleaner implementation of security for script (and potentially CSS) files. ResourceLoader *already* knows where each module has come from, so all we need to do is filter them in OutputPage according to the desired level of 'trustworthiness'.
TODO:
* Are there instances where we might want to restrict CSS as well as JS?
* Would a $wg config option and/or user preference and/or index.php GET parameter to limit inclusion be useful?
* Can we deprecate any of the existing $wg config options?
* What's going on with the duplicated code between OutputPage and SkinTemplate?
2011-02-04 16:39:17 +00:00
Daniel Friesen
8c9a20833e Commit some fixes for comments on r77741 2011-02-03 00:00:58 +00:00
Chad Horohoe
a63aed1aa3 Stupid references, stupid PHP. I blame Nikerabbit (fixing r81254) 2011-01-31 16:23:38 +00:00
Chad Horohoe
a6f2e65151 Remove a bunch of useless $wgOuts. Just pass them like we should. Also make them protected so people don't call them 2011-01-31 15:47:47 +00:00
Chad Horohoe
90fdb46ae5 Last $wgArticle junk in Skin(Template). Just pass the article on hand to lastModified(). Nothing outside of here calls it anyway 2011-01-26 17:06:18 +00:00
Chad Horohoe
d5f770ee4e syntax error, stupid me 2011-01-26 16:58:48 +00:00
Chad Horohoe
8ac435b072 Followup r81034, remove the global statements 2011-01-26 16:56:46 +00:00
Chad Horohoe
c1a29795b4 First round of $wgArticle removals 2011-01-26 16:54:58 +00:00
Daniel Friesen
74ab4ed8de Fix r79383, I used Message->plain() under the impression it was the proper replacement for wfMsg when Message->text() was actually the correct method to use. 2011-01-14 09:28:34 +00:00
Daniel Friesen
2f933fedba Fix bug 14267 by adding support for a MediaWiki:Mainpage-nstab.
Additionally, *cough* *cough*:
* Add a Title::isMainPage helper for the fairly common $title->equals( Title::newMainPage() ); test.
* Update wfMessageFallback to also accept an array of message keys instead of requiring them listed as arguments to the function.
* Move the bulk of wfMessageFallback code into Message.php instead of leaving it in GlobalFunctions.php
* Change the wfMessageFallback implementation so that the Message class handles the fallbacks themselves eliminating any side effects caused by the fact that wfEmptyMsg always used usedb=false, language=userlang when one might actually use a different language or usedb setting in the message object that actually returned the text (this may be considered a wfEmptyMsg regression in 1.18).
* Make blank "" message contents fallback like nonexistant messages do.
* Re use the new tabAction array handling used to support mainpage-nstab in the talk and view tabs instead of making wfEmptyMsg calls directly in SkinTemplate.
2011-01-14 08:32:10 +00:00
Daniel Friesen
060e5b11e8 Support talk page tab messages like MediaWiki:Nstab-user_talk. Like the MediaWiki:Nstab-main MediaWiki:Nstab-user etc... we already support. 2011-01-14 02:15:12 +00:00
Daniel Friesen
7da18d25f6 Fix bug 26034; Make the View / Read tab in content_navigation style tabs (skins like Vector) stay selected when on &action=purge. 2011-01-13 22:42:05 +00:00
Alexandre Emsenhuber
83a2f95f8b Simplify a bit:
* replaced calls to Article::getLatest() by Title::getLatestRevID()
* introduced Skin::isRevisionCurrent()
* made checks on Skin::pageStats() more coherent
2011-01-11 13:04:55 +00:00
Alexandre Emsenhuber
db4edab657 Added QuickTemplate::getSkin(), useful for extensions when executing hooks passing only the template as parameter 2011-01-08 19:42:24 +00:00
Roan Kattouw
c53ccc605f Fix bug 26570 (user CSS preview broken) and bug 26555 (styles added with $out->addStyle() are loaded after site/user CSS)
Did this by moving RL <link> generation from getHeadLinks() to buildCssLinks() (Trevor did this earlier), but did it right this time:
* Updated callers for buildCssLinks() parameter list change so stuff doesn't explode
* Considered making buildCssLinks() tolerant of a missing $sk parameter, but decided against this: it's not used in SVN extensions anywhere
* Changed addInlineStyle() to add styles to $this->mInlineStyles instead of $this->mScripts. This unbreaks addInlineStyle(), which was used for CSS previews
* Added styles added through addStyle()/addInlineStyle() in the right place (right after normal RL styles)
2011-01-06 16:58:29 +00:00
Daniel Friesen
cf228c10de Convert the common bottomscripts, reporttime, and debug boilerplate into a printTrail() helper method.
Note that in vector this does move the fixalpha stuff above bottomscripts while it was after it before, theoretically though this shouldn't cause any trouble.
2011-01-01 16:41:45 +00:00
Daniel Friesen
8a196eb77b *sigh* I wish this were git... Followup r79398, small mistake that slipped through when I was fixing an incorrect method use. 2011-01-01 01:05:39 +00:00
Daniel Friesen
5de2e40379 Implement "relevant" title and user in the skin system and update undelete, log, contributions, blockip, and movepage to use it.
A "Relevant" is used by the skin to determine what title to display tabs for. This setting allows pages like Special:MovePage (which is linked to from the tabs themselves) to retain the tabs specific to the page relevant to it when switching to the special page.
Similaly a "Relevant" user is used by the skin to display things in the toolbox which would usually only be displayed on the user's userpage and talkpage, pages like Special:Contributions which are linked to by the toolbox can use this to retain the toolbox links when switching between the user pages and these special pages.
2011-01-01 01:03:02 +00:00
Daniel Friesen
c510db2665 Merging Vector's navigation_urls and SkinTemplate's content_actions code into content_navigation. content_actions is now built by folding content_navigation and cleaning it up a bit.
content_actions hooks no longer work and have been dropped from the code, the hooks that affected vector before now affect all skins.
A few logic changes were made to make for a clean merge:
- vector was using vector-???-??? messages while SkinTemplate was using '???' messages. So as a side effect of merging that together all skins now support messages like '$skinname-view-history' which will fallback to the standard message if not defined.
- For MediaWiki: pages where the page does not exist but the message does in the i18n system SkinTemplate displayed "Edit" while Vector displayed "Create"; All skins now display "Edit".
- For users without undelete permissions SkinTemplate displayed an "Undelete" tab if the user had deletedhistory and deletedtext permissions. Vector would only display the tab for users with both deletedhistory and undelete permissions; The new behavior in all skins is to always display a tab if you have deletedhistory (since Special:Undelete will always have something to display) but display a "View ... deleted" instead of "Undelete" message if you do not have undelete permissions.
- Skins no longer need to hardcode tests for the &action= to decide if they should ignore the accesskey on some tabs, tabs which should not have an accesskey in the current page now have a "tooltiponly" key set to true.
2010-12-31 23:30:00 +00:00
Daniel Friesen
caae68d19b Followup r79055 c12495 fix undefined index notice. 2010-12-30 10:03:40 +00:00
Daniel Friesen
af5e002d25 Commit getPersonalTools to allow personal bar generation to be simplified. 2010-12-27 12:23:06 +00:00