Commit graph

86 commits

Author SHA1 Message Date
Tim Starling 40c7e9c9aa Use the shared parse on API edit
ConfirmEdit was tripling the API save time, because it was parsing the
entire content twice to evaluate whether the addurl trigger is hit.

While I was here, I stopped using the deprecated non-Content hooks. The
new hook, EditEditFilterMergedContent, does not pass an EditPage object,
which means that Title or WikiPage objects need to be passed around
instead. Also, since EditPage::showEditForm() cannot be called with no
EditPage object, use a EditPage::showEditForm:fields hook instead.

If non-wikitext content is edited, assume that the regex trigger is not
hit.

For further architectural details, see the associated core change:
I4b4270dd868a . MW_EDITFILTERMERGED_SUPPORTS_API is a constant
introduced to detect the presence of the associated core change.

Also, in APIGetAllowedParams, set the allowed parameters even if we are
not on the help screen. This allows API users to submit their CAPTCHA
answer without it failing with an "unrecognized parameter" error.

Compatibility with MediaWiki 1.21 is retained, compatibility before that
is dropped.

Change-Id: I9529b7e8d3fc9301c754b28fda185aa3ab36f13e
2014-12-08 10:56:17 +11:00
Siebrand Mazeland aca764a8c2 Migrate to JSON i18n
Procedure per https://www.mediawiki.org/wiki/Manual:GenerateJsonI18n.php
with shim.

Change-Id: I71327ba3a0db3f9a94afcac033f1d2fde0ca4173
2014-03-26 12:58:25 +01:00
Reedy b4e4ee3fca Remove unused/incomplete stale HTMLCaptchaField
Fixup type hint to remove Captcha type

Change-Id: I30cdf2a34dce9f8bf6731c845d7910fad1d42e42
2014-02-18 02:13:12 +00:00
Brion Vibber 78e6f5ec79 Use new hooks in API action=createaccount for Captcha
Hooks used:
* AddNewAccountApiForm
* AddNewAccountApiResult

This adds a 'captcha' section to the results with the same format
as we provide for editing; you'll get this for instance at the
same time as you do a first-request that prompts for a token.

No modification to the result status is included; presence of
the 'captcha' section is assumed to be enough to prompt the client
to fetch and render the captcha prompt.

Failure to pass a captcha will return an API error message; a
subsequent commit fixes problems with that error message being
hard to machine-read.

Note that logic from inside Captcha::confirmUserCreate has been
pulled out to Captcha::needCreateAccountCaptcha so we don't
send captcha information to users who don't need it.

Requires core changes: If5b7dab8

Sample API client: https://github.com/brion/api-createaccount

Bug: 46072

Change-Id: Id628defaeab2bf5979ca8f4284d14fc42d9c3e46
2014-01-17 12:49:23 -08:00
Matthew Flaschen faba9da0c5 Update call to MathRenderer due to changes to Math extension.
Bug: 46132
Change-Id: I8ee3fd1360327e849d4ec217b212608636995d73
2013-04-18 00:08:52 -07:00
Siebrand Mazeland ab86ecf25e (bug 45461) Use email instead of e-mail
Change-Id: Ic9071861e050309523e0f143b18c815d7c136554
2013-02-27 12:35:40 +01:00
Siebrand Mazeland 3ef1ab740a More maintenance for ConfirmEdit extension.
* Replace dirname( __FILE__ ) by __DIR__.
* Replace deprecated method calls. Now requires MediaWiki 1.19 or later.
* Fix some documentation.
* Remove commented out code.
* Remove superfluous newlines.

Change-Id: Ib73e1619aa331c83e375224b6adae4c1e5db3bb9
2012-09-02 14:26:45 +02:00
Sam Reed aec19953f0 Bug 34354 - Move ConfirmEdit into antispam extension group 2012-02-13 14:08:07 +00:00
Siebrand Mazeland f6d4ab758c stylize.php, some indentation fixes and some brackets added. 2012-01-12 08:58:40 +00:00
Siebrand Mazeland 437bc7b2d8 Bye, bye $wgExtensionAliasesFiles (deprecated in 1.16). 2011-12-25 23:09:26 +00:00
John Du Hart a3255b5469 Removing global usage in the global scope 2011-12-23 21:24:12 +00:00
Brion Vibber 3edbac3674 Update a butt-ton of extension about URLs to point to https://www.mediawiki.org/ 2011-12-13 23:49:33 +00:00
Sam Reed 9e4951f262 Fix hook copy paste fail
Move rest of captcha params out of api/ApiEditPage.php
2011-11-23 20:37:13 +00:00
Sam Reed 80e9b337ee Kill the abstract Captcha class
Not used anywhere, everything else uses the SimpleCaptcha class as the base
2011-11-23 19:21:12 +00:00
Sam Reed 0a66fd76f1 MW_SUPPORTS_EDITFILTERMERGED has been in since r27416
Kill the alternate EditFilter hook usage (underlying code still used, probably wants refactoring at somepoint)

Simplify a boolean return
2011-11-23 19:18:30 +00:00
Sam Reed 64b6239348 * (bug 32609) API: Move captchaid/captchaword of action=edit from core to Captcha extension(s)
Left setting of wpCaptchaId and wpCaptchaWord in core. Can't think of a sane way to check and set them via an extension (subclass and override, or a hook). Annoyingly APIEditBeforeSave doesn't pass the params array
2011-11-23 19:09:57 +00:00
Platonides 7a92b816ec Tabs to aligned spaces 2011-09-01 16:54:59 +00:00
Yaron Koren 8a3bc55dd8 Version 1.1: Asirra module added 2011-07-12 17:27:56 +00:00
Happy-melon 86f875a58a Beginnings of a rewrite of the captcha system in a more object-oriented fashion; currently although there are classes for different types of captcha, they don't actually represent a single captcha object, they're just confused frontend/backend messes. With the places captchas are inserted increasingly using HTMLForm, it makes eminent sense to introduce a HTMLCaptchaField, but that needs a more OOP implementation of the actual captcha, which I've started here. This is not finished and isn't actually implemented anywhere, but a) it's harmless, b) I don't want it to bitrot, and c) some feedback would always be appreciated, so here it is. 2011-04-24 11:47:03 +00:00
Happy-melon 54fa154b40 Introduce a CaptchaStore abstract class that CaptchaSessionStore and CaptchaCacheStore can extend. Some tidying, documentation and type hinting. 2011-04-24 11:41:49 +00:00
Happy-melon 1bbd72e5fd Reorganise files in ConfirmEdit 2011-04-23 11:44:47 +00:00
Happy-melon f5ce74f85f Polish off all special-page-by-global-function instances in extensions. The preferred syntax is now exclusively $wgSpecialPages['PageName'] = 'ClassExtendingSpecialPage', where that class has a constructor which calls SpecialPage::__construct('PageName'). 2011-04-14 14:39:57 +00:00
Brion Vibber d1d1b6871f * (bug 27083) Extension info for Special:Version can include '...' as a special value which is turned into the localized 'others' used for Special:Version author lists. 2011-02-05 00:58:07 +00:00
Mark A. Hershberger c75ec400a7 followup r81318 & r81312 so that FIXME and revert can live (somewhat) happily 2011-02-02 01:14:41 +00:00
Raimond Spekking d6adab516d Revert r81312: PHP Fatal error: Call to undefined function wfMsg() in /www/w/extensions/ConfirmEdit/ConfirmEdit.php on line 43 2011-02-01 20:36:34 +00:00
Mark A. Hershberger 2c169ad09f followup r81239 fix FIXME 2011-02-01 18:41:37 +00:00
Sam Reed 1cccda834f Followup r81231, r81229
svn:eol-style native

Fix credits

Fix ?>
2011-01-31 09:50:27 +00:00
Yaron Koren fb60663a5c Improved comments, created a version number ("1.0", for lack of a better number) 2011-01-31 05:30:34 +00:00
Sam Reed 0324318073 Correct the address of the FSF in extension GPL headers
59 Temple Place -> 51 Franklin Street
2010-06-21 13:45:17 +00:00
Siebrand Mazeland 3db4c19909 Replace Title::makeTitle[Safe]( NS_SPECIAL, 'x' ) with SpecialPage::getTitleFor ( 'x' )
And a few other minor changes.
2010-06-08 19:30:48 +00:00
Alexandre Emsenhuber f6b61b4dd6 Big changes to extensions' documentation:
* changed all @addtogroup to @ingroup
* added some @file where needed
* changed some @package/@subpackage to @ingroup
2010-06-06 15:12:22 +00:00
Happy-melon 32102375f8 Implement captchas for sending emails via Special:EmailUser. 2010-04-10 21:26:03 +00:00
Siebrand Mazeland fdc2e20037 * Remove $wgExtensionCredits['description'] where $wgExtensionCredits['descriptionmsg'] present. This feature was introduced in MediaWiki 1.12, and 'description' is not used if 'descriptionmsg' is present.
* Random indentation updates and trailing whitespace removed
2010-02-22 23:41:51 +00:00
Siebrand Mazeland 4a6c4e2bcf * Update messages for QuestyCaptcha
* stylize.php and trailing whitespace removed for ConfirmEdit
* add support for QuestyCaptcha to Translate
* svn execute bits removed
2009-07-19 15:13:01 +00:00
Siebrand Mazeland e43d30d061 Add special page aliases 2009-05-24 09:20:04 +00:00
Shinjiman fb35385650 Follows up r49890, adding file location itself to obtaining the revision number shown in the Special:Version 2009-04-27 03:15:19 +00:00
Chad Horohoe 290c25a814 Big commit. Removing svn-version and svn-date from extensions. Per the list, these versions do not give valuable information and are often wildly inaccurate. 2009-03-26 17:39:49 +00:00
Aryeh Gregor 03da9b6796 * Change $wgCaptchaBadLoginAttempts to be inclusive of the first attempt, so that the old default is 1. 0 now really means that 0 bad logins are tolerated before the captcha is displayed, i.e., it's always displayed even with no bad logins. This seems to make more sense (certainly compared to setting it to -1 to always display the captcha).
* Set the default to 3 instead of 1, to be more forgiving of mistyped passwords.  Unlikely to help bots much; quite likely to help blind people who aren't really really really careful typers.
* Commit some whitespace change I had lying around.
2008-07-02 23:09:26 +00:00
Chad Horohoe 21d725024c (bug 13918), make CAPTCHA less obtrusive. Added a new global $wgCaptchaBadLoginAttempts which can be set to allow 1 (or more) failed attempts before triggering the captcha on login. Default is 0 (current behavior). 2008-07-02 15:00:30 +00:00
Raimond Spekking db3cb5c6c4 Add 'svn-revision' and 'svn-date' to extensionCredits where missing for extensions used on WMF servers 2008-06-16 20:54:29 +00:00
Tim Starling f56e5735c8 * Repopulated the previously deprecated $wgAvailableRights
* In WhiteList: made the names of the rights hard-coded, it doesn't make any sense to have them be configurable anymore
2008-05-14 00:38:28 +00:00
Roan Kattouw c112c24f54 Modifying ConfirmEdit extension to make it API-friendly:
* Hooking into the APIEditBeforeSave hook (which will appear in the ApiEdit_Vodafone branch in the next revision)
* Moved general CAPTCHA generation in SimpleCaptcha to getCaptcha()
* Moved general confirmEdit() functionality to doConfirmEdit() to facilitate differtiating between UI and API handling
* Adding SimpleCaptcha::addCaptchaAPI() method that adds CAPTCHA information to an API result array. Other CAPTCHA implementations should override this method with a function that does the same (did this for FancyCaptcha and MathCaptcha)
2008-02-28 17:42:23 +00:00
Bertrand Grondin 07a8b9c007 Add internationalization extension description message in [[Special:Version]] 2008-02-04 15:04:47 +00:00
Siebrand Mazeland b0bc51855c revert r28340, r28343 to r28349, r28351, r28364 2007-12-16 18:38:50 +00:00
Siebrand Mazeland e014795e44 * complete $wgExtensionCredits
* remove trailing whitespace
2007-12-10 10:01:15 +00:00
Tim Starling 152f5e39e0 * Optimised startup
* Use the new EditFilterMerged hook if available, for faster link finding
2007-11-12 07:42:25 +00:00
Nick Jenkins 0ec1e4e08d eol style native + removing one unused global 2007-10-11 04:38:22 +00:00
Brion Vibber a02a10f239 Add $wgCaptchaWhitelistIP array of IP addresses or ranges allowed to skip the captcha.
From patch http://bugzilla.wikimedia.org/attachment.cgi?id=3868 by andy
2007-07-05 19:48:53 +00:00
Aryeh Gregor def5670e9b Extensions too! 2007-06-29 01:36:09 +00:00
Raimond Spekking 8a7fbce896 Some tweaks per hint of Brion on wikitech-l 2007-06-20 20:54:03 +00:00