Commit graph

720 commits

Author SHA1 Message Date
Alexandre Emsenhuber
4207ab0c63 * (bug 28511) Use [] syntax instead of {} for string offset access 2011-04-17 07:59:58 +00:00
Sam Reed
488f7a375c Revert r85783, it seems to brake random stuff in random places #fail 2011-04-11 18:29:18 +00:00
Sam Reed
834d6618ac * (bug 20468) User::invalidateCache throws 1205: Lock wait timeout exceeded 2011-04-11 12:56:23 +00:00
Tim Starling
7bb50c630a The beginnings of HipHop compiled mode support. It works now for parser cache hits.
* Work around HipHop issue 314 (volatile broken) and issue 308 (no compilation detection) by adding some large and ugly compilation detection code to WebStart.php and doMaintenance.php.
* Provide an MW_COMPILED constant which can be used to detect compiled mode throughout the codebase.
* Introduced wfIsHipHop(), which detects either compiled or interpreted mode. Used this to work around unusual eval() return value in eval.php.
* Work around lack of ini_get() in Maintenance.php, by duplicating wfIsHipHop(). 
* In Maintenance::shouldExecute(), accept "include" as an inclusion function name, since all kinds of inclusion give this string in HipHop.
* Introduced new class MWInit, which provides some static functions in the pre-autoloader environment.
* Introduced MWInit::compiledPath(), which provides a relative path for invoking a compiled file, and MWInit::interpretedPath(), which provides an absolute path for interpreting a PHP file. Used these new functions in the appropriate places.
* When we are running compiled code, don't include files which would generate duplicate class, function or constant definitions. Documented the new requirements on the contents of Defines.php and UtfNormalDefines.php.
* In HipHop compiled mode, it's not possible to have executable code in the same file as a class definition. 
  ** Moved MimeMagic initialisation to the constructor.
  ** Moved Namespace.php global variable initialisation to Setup.php.
  ** Moved MemcachedSessions.php initialisation to the caller in GlobalFunctions.php.
  ** Moved Sanitizer.php constants and global variables to static class members. Introduced an accessor function for the attribs regex, as a new place to put code formerly at file level. 
  ** Moved Language.php initialisation of $wgLanguageNames to Language::getLanguageNames(). Removed the global variable, marked "private" since forever.

* In two places: don't use error_log() with type=3 to append to a file, HipHop doesn't support it. Use file_put_contents() with FILE_APPEND instead.
* Work around the terrible breakage of class_exists() by using MWInit::classExists() instead in various places. In WebInstaller::getPageByName(), the class_exists() was marked with a fixme comment already, so I replaced it with an autoloader solution.
2011-04-04 12:59:55 +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
Chad Horohoe
583e3487b8 Revert r64853 (add $wgLogAutocreatedAccounts to enable/disable account autocreation logging, bug 19161). Per the *extremely lengthy* discussion that is still ongoing, this fails to solve the underlying problem and has undesired side-effects.
I don't know what the proper solution is (other than introducing user preferences, like bug 28369 suggests, is not the answer)...but the status quo of what we had is better than this half-assed solution that *nobody* likes.
2011-04-01 15:57:20 +00:00
Brion Vibber
c76698c16c Tweak doc comment per bug 28340 2011-03-31 23:02:38 +00:00
Sam Reed
d193b03c81 Swap 2 "and" for "&&" 2011-03-27 17:09:26 +00:00
Happy-melon
6dbcdc1be0 Blame hashar for this giant commit; he teased me for making so many smaller ones earlier... :D
* Internalise $mAddress/$mUser, $mBy/$mByName, $mEnableAutoblock, $mId as getTarget(), getBlockers(), isAutoblocking(), getId().  
* This required editing AbuseFilter and CheckUser backwards-incompatibly, so push the rest of the changes out to those extensions.
* Attack the evil 14-parameter constructor and gratuitously-confusing newFromDB( $notVeryImportantParameter, $moreImportantParameter)
* Reimplement the hack for bug 13611 in a slightly less fragile fashion; could still do with further cleanup, but then again the login frontend is its own can of worms... :S
* Remove transitionary getTargetAndType() and newFromTargetAndType() methods
* Some optimisation in parseTarget()
* Fix the broken phpunit test mentioned in r84251
2011-03-21 19:12:41 +00:00
Happy-melon
b61f104042 Follow-up r84358 CR: rename 'editusertalk' to 'editownusertalk', private --> protected, and run stylize.php over Block.php 2011-03-20 17:43:17 +00:00
Happy-melon
7eac649e6d * Implement an extensible Block::prevents( <action> ) function to replace the plethora of direct member variable accesses This pushes the historic *disable*-createaccount-vs-*allow* usertalk-edit wierdness down to the database layer
* Implement accessors for isHardblock() and getRangeStart()/getRangeEnd() in the same fashion.
* Make the corresponding variables private, removing external accessors.  This required updating AbuseFilter with non-B/C code, so I also implemented the rest of the changes I've made to the blocking backend in that extension.
* Move the "get an IP range which encompasses the given IP/range" logic to Block.php; will be needed later... :D
2011-03-19 23:47:08 +00:00
Happy-melon
374d7e7278 Fix borked r84266. 2011-03-18 21:31:11 +00:00
Happy-melon
ac5751ee48 Follow-up r84249: reimplement isAllowedAny(), and restore isAllowed() to only-accepting-one-parameter mode for the time being. 2011-03-18 21:07:05 +00:00
Happy-melon
81852ea1a6 Allow User::isAllowed() to take varargs. "is allowed X or Y" is by far the more common multiple permission check in core, so this is now the behaviour of isAllowed( X, Y ); also add isAllowedAll(...) for testing "is allowed X and Y". Has the nice side effect of adding visibility to a very old function. 2011-03-18 14:48:21 +00:00
Happy-melon
4d302b466e Follow-up r84233: fix documentation format 2011-03-18 13:23:05 +00:00
Happy-melon
e6e9b7fc9c (bug 27403) saved user preferences which are subsequently disabled with $wgHiddenPrefs are not used in output, but are retained in the database in case the preference is subsequently re-enabled. 2011-03-18 13:03:26 +00:00
Mark A. Hershberger
2828702889 Fix Bug #28082, Add Hooks to User::addGroup and User::removeGroup
I propose to add two new hooks, one should be called when adding a
    group to a user, one when a group is removed. This allows
    MediaWiki for example to add/remove groups from a remote
    authentication/authorization service.

Adapted provided patch.
2011-03-16 23:13:38 +00:00
Happy-melon
3d161feebf Follow-up r83755: @deprecated @since is wrong, doesn't have the expected semantic meaning. 2011-03-12 18:14:33 +00:00
Happy-melon
cc941ed637 add __toString() call for User objects, returning User->getName(). Now that we require PHP 5.2+, we can do this with all our major classes... :D 2011-03-11 23:42:53 +00:00
Alexandre Emsenhuber
77b2dc77c9 Follow-up r83080: make ApiUploadTest really work this time 2011-03-11 20:04:17 +00:00
Mark A. Hershberger
b3df4babc2 misc w/s cleanups, “svn diff -x-w” clean 2011-03-08 18:12:17 +00:00
Antoine Musso
8a3dcccbda Remove second parameters from wfEmptyMsg() calls
The second parameter was removed in r64178 and is now useless.
There is probably no need to backport this in 1.17.
2011-03-07 17:10:22 +00:00
Sam Reed
0e38c2cdce Documentation and explicit variable definitions
Followup r80069, swap private to protected
2011-03-07 14:45:11 +00:00
Alexandre Emsenhuber
a17b065156 Follow-up r83080: forogt to commit this (oops) 2011-03-02 13:13:51 +00:00
Alexandre Emsenhuber
60f1302644 Per Platonides, fix for r82686: make ApiUploadTest work again
Added option request parameter to User::editToken() and User::matchEditToken() and use them where possible from the api.
Also removed $_SESSION usage since it's no longer needed
2011-03-02 12:52:47 +00:00
Platonides
36999e2bf9 Disable the old conversion from Windows-1252 unless the wiki has $wgLegacyEncoding set.
Has been done since r6920 (code added in r4438).
Also skipping the hashing if the windows-1252 password is the same we already probed.
The function_exists is not needed, since in such case GlobalFunctions would make it a wrapper to Fallback::iconv()
2011-02-26 22:30:41 +00:00
Alexandre Emsenhuber
be4f26f8da Don't even try to get user's IP address if he has 'ipblock-exempt' right 2011-02-26 13:28:02 +00:00
Alexandre Emsenhuber
3381453178 Use $wgRequest to get and set session items instead of $_SESSION (as for cookies) 2011-02-23 17:54:02 +00:00
Happy-melon
ef6041d750 revert r82283, loads of unrelated changes 2011-02-16 19:51:25 +00:00
Happy-melon
d64cd26a7c Create a user.groups module in ResourceLoader, which bundles a CSS and JS page for each usergroup the user is a member of (MediaWiki:Sysop.js, MediaWiki:Autoconfirmed.css, etc). Groups '*' and 'user' are not included. 2011-02-16 19:49:37 +00:00
Niklas Laxström
31971c6eba Use self:: when it's possible 2011-02-11 19:03:05 +00:00
Sam Reed
6dc7225794 *(bug 27159) make email confirmation code expiration time configurable
Added "$wgUserEmailConfirmationTokenExpiry"
2011-02-10 02:32:34 +00:00
Alexandre Emsenhuber
ebcd89f35b Fix for r81675: Skin::getTitle() will return null when $wgTitle is null and $wgOut->setTitle() not called, resulting in the following when passing a non-null parameter to User::getSkin():
Catchable fatal error: Argument 1 passed to Title::equals() must be an instance of Title, null given, called in includes/User.php on line 2255 and defined in includes/Title.php on line 3689
2011-02-09 17:05:52 +00:00
Chad Horohoe
4abff25966 Followup r81812: per CR, this could be 0 2011-02-09 14:59:44 +00:00
Chad Horohoe
670b92b065 preg_match() yells about undefined offsets when $wgInvalidUsernameCharacters is empty. Noticed by wolog on IRC 2011-02-09 13:42:02 +00:00
Chad Horohoe
9ff0216ee2 Cleanup to r70900, r72481: don't construct new skin objects just because the Title is passed. Use the skin object we already have if the titles are the same 2011-02-08 01:08:06 +00:00
Bryan Tong Minh
e942dc69fc Per CR r66438 and IRC, revert User::leaveNewMessage for now. Copied the function and stripped it down for use in NewUserMessage. Could probably need some cleanup. 2011-02-06 22:44:01 +00:00
Roan Kattouw
4b8d8353bb Followup r81446: and mergehistory too 2011-02-03 13:21:25 +00:00
Roan Kattouw
621f231154 Add editusercss and edituserjs rights to User::$mCoreRights. Pointed out by Scalable on IRC 2011-02-03 13:20:14 +00:00
Alexandre Emsenhuber
c96c0d9553 * (bug 22606) Follow-up r63059: don't send the "someone registred an account" message when setting email address (i.e. old one empty) in user preferences 2011-01-29 09:32:02 +00:00
Antoine Musso
ff5fb5ea3e Bug 26948 - hyphens incorrectly interpreted as range
This is the kind of easy to fix, hard to review bug. Email validation
make uses of strings listing characters, those strings are then
enclosed between brackets "[]". Inside brackets, the hyphen is used
to describe a range of character [a-d] being a b c d.
The string containing an unescaped hyphen, made JS/PHP validation
to match the incorrect comma ",".

* Backslash hyphen
* JS,PHP: add tests for commas and hyphens in username or domain
* JS: add var to rfc_1034_ldh_str
* JS: minor code cleanup

TESTS:

php phpunit.php -c suite.xml --filter ValidEmail
OK (13 tests, 32 assertions)

Special:BlankPage?action=mwutiltest&debug=true
Ran 66 tests. 66 passed test(s). 0 error(s). 0 partially passed test(s).
2011-01-27 20:52:12 +00:00
Mark A. Hershberger
23ad60e630 * Whitespace fixups
* followup r66675 - Robla caught a problem with the parameter munging
2011-01-26 17:48:58 +00:00
Alexandre Emsenhuber
de4a9c6b9a Reset the cache used in User::idFromName(), otherwise tests will try to add the user '127.0.0.1' multiple times, resulting in a database error (duplicate key for user_name field) 2011-01-25 16:32:43 +00:00
Alexandre Emsenhuber
bc650e89e7 Allow the $result parameter of the isValidPassword hook to be an array if the message requires parameters 2011-01-25 15:36:36 +00:00
Brion Vibber
794bc9a816 Tweak comments on User::isValidEmailAddr to replace the old @todo for RFC 2822 validation with a brief explanation of why we're using this instead. (followup r80913) 2011-01-24 21:18:47 +00:00
Antoine Musso
e1be34e477 User::isValidEmailAddr comment update
Follow up r75682
2011-01-24 20:31:16 +00:00
Antoine Musso
4868ccbf3d Hack invalid w3 spec to validate @localhost email
In r75682, I have implemented a PHP function to validate email address
based on bug 22449.  Siebrand pointed a w3.org specification which I
implemented. The spec is bugged since it requires a domain and a top
level domain!

I could either make the first part optional or alter the second part
to require 0 to x elements.  I choose the later: s/+/*/

Should fix bug 22449 for good.

TESTS:

Added testEmailDoesNotNeedATopLevelDomain:

Made following emails valid:
  user.@localdaomin
  .@localdomain
  user@a

Test output (please add more):
$ php phpunit.php -c suite.xml --filter alidEmail --tap
TAP version 13
ok 1 - UserIsValidEmailAddrTest::testEmailWellKnownUserAtHostDotTldAreValid
ok 2 - UserIsValidEmailAddrTest::testEmailWithUpperCaseCharactersAreValid
ok 3 - UserIsValidEmailAddrTest::testEmailWithAPlusInUserName
ok 4 - UserIsValidEmailAddrTest::testEmailDoesNotNeedATopLevelDomain
ok 5 - UserIsValidEmailAddrTest::testEmailWithWhiteSpacesBeforeOrAfterAreInvalids
ok 6 - UserIsValidEmailAddrTest::testEmailWithWhiteSpacesAreInvalids
ok 7 - UserIsValidEmailAddrTest::testEmailDomainCanNotBeginWithDot
ok 8 - UserIsValidEmailAddrTest::testEmailWithFunnyCharacters
ok 9 - UserIsValidEmailAddrTest::testEmailTopLevelDomainCanBeNumerical
ok 10 - UserIsValidEmailAddrTest::testEmailWithoutAtSignIsInvalid
ok 11 - UserIsValidEmailAddrTest::testEmailWithOneCharacterDomainIsValid
1..11
2011-01-21 18:01:47 +00:00
Daniel Friesen
f5cbd0c5c2 Fix another bad boolean from r80248. 2011-01-16 02:29:53 +00:00
Daniel Friesen
39ab3cfc9f Implement Message::isBlank and Message::isDisabled.
And while we're at it... update a random assortment of code using wfEmptyMsg to use the new wfMessage class and our exists/isBlank/isDisabled methods.
2011-01-14 10:51:05 +00:00
Antoine Musso
73b63cc778 Fix RFC 5322 'atext'
An additional character was introducted in the RFC 5322 atext fragment.
Spotted with r79924 which send the file as latin1 encoding.
2011-01-10 19:55:30 +00:00