Index: trunk/phase3/includes/User.php |
— | — | @@ -168,7 +168,8 @@ |
169 | 169 | //@{ |
170 | 170 | var $mId, $mName, $mRealName, $mPassword, $mNewpassword, $mNewpassTime, |
171 | 171 | $mEmail, $mTouched, $mToken, $mEmailAuthenticated, |
172 | | - $mEmailToken, $mEmailTokenExpires, $mRegistration, $mGroups, $mOptionOverrides; |
| 172 | + $mEmailToken, $mEmailTokenExpires, $mRegistration, $mGroups, $mOptionOverrides, |
| 173 | + $mCookiePassword; |
173 | 174 | //@} |
174 | 175 | |
175 | 176 | /** |
— | — | @@ -235,7 +236,7 @@ |
236 | 237 | /** |
237 | 238 | * Load the user table data for this object from the source given by mFrom. |
238 | 239 | */ |
239 | | - function load() { |
| 240 | + public function load() { |
240 | 241 | if ( $this->mLoadedItems === true ) { |
241 | 242 | return; |
242 | 243 | } |
— | — | @@ -273,9 +274,8 @@ |
274 | 275 | /** |
275 | 276 | * Load user table data, given mId has already been set. |
276 | 277 | * @return Bool false if the ID does not exist, true otherwise |
277 | | - * @private |
278 | 278 | */ |
279 | | - function loadFromId() { |
| 279 | + private function loadFromId() { |
280 | 280 | global $wgMemc; |
281 | 281 | if ( $this->mId == 0 ) { |
282 | 282 | $this->loadDefaults(); |
— | — | @@ -311,7 +311,7 @@ |
312 | 312 | /** |
313 | 313 | * Save user data to the shared cache |
314 | 314 | */ |
315 | | - function saveToCache() { |
| 315 | + public function saveToCache() { |
316 | 316 | $this->load(); |
317 | 317 | $this->loadGroups(); |
318 | 318 | $this->loadOptions(); |
— | — | @@ -329,7 +329,6 @@ |
330 | 330 | $wgMemc->set( $key, $data ); |
331 | 331 | } |
332 | 332 | |
333 | | - |
334 | 333 | /** @name newFrom*() static factory methods */ |
335 | 334 | //@{ |
336 | 335 | |
— | — | @@ -349,7 +348,7 @@ |
350 | 349 | * username is not present in the database, the result will be a user object |
351 | 350 | * with a name, zero user ID and default settings. |
352 | 351 | */ |
353 | | - static function newFromName( $name, $validate = 'valid' ) { |
| 352 | + public static function newFromName( $name, $validate = 'valid' ) { |
354 | 353 | if ( $validate === true ) { |
355 | 354 | $validate = 'valid'; |
356 | 355 | } |
— | — | @@ -372,7 +371,7 @@ |
373 | 372 | * @param $id Int Valid user ID |
374 | 373 | * @return User The corresponding User object |
375 | 374 | */ |
376 | | - static function newFromId( $id ) { |
| 375 | + public static function newFromId( $id ) { |
377 | 376 | $u = new User; |
378 | 377 | $u->mId = $id; |
379 | 378 | $u->mFrom = 'id'; |
— | — | @@ -390,7 +389,7 @@ |
391 | 390 | * @param $code String Confirmation code |
392 | 391 | * @return User |
393 | 392 | */ |
394 | | - static function newFromConfirmationCode( $code ) { |
| 393 | + public static function newFromConfirmationCode( $code ) { |
395 | 394 | $dbr = wfGetDB( DB_SLAVE ); |
396 | 395 | $id = $dbr->selectField( 'user', 'user_id', array( |
397 | 396 | 'user_email_token' => md5( $code ), |
— | — | @@ -411,7 +410,7 @@ |
412 | 411 | * ommited. |
413 | 412 | * @return User |
414 | 413 | */ |
415 | | - static function newFromSession( WebRequest $request = null ) { |
| 414 | + public static function newFromSession( WebRequest $request = null ) { |
416 | 415 | $user = new User; |
417 | 416 | $user->mFrom = 'session'; |
418 | 417 | $user->mRequest = $request; |
— | — | @@ -431,7 +430,7 @@ |
432 | 431 | * @param $row Array A row from the user table |
433 | 432 | * @return User |
434 | 433 | */ |
435 | | - static function newFromRow( $row ) { |
| 434 | + public static function newFromRow( $row ) { |
436 | 435 | $user = new User; |
437 | 436 | $user->loadFromRow( $row ); |
438 | 437 | return $user; |
— | — | @@ -456,7 +455,7 @@ |
457 | 456 | * @param $id Int User ID |
458 | 457 | * @return String The corresponding user's real name |
459 | 458 | */ |
460 | | - static function whoIsReal( $id ) { |
| 459 | + public static function whoIsReal( $id ) { |
461 | 460 | $dbr = wfGetDB( DB_SLAVE ); |
462 | 461 | return $dbr->selectField( 'user', 'user_real_name', array( 'user_id' => $id ), __METHOD__ ); |
463 | 462 | } |
— | — | @@ -466,7 +465,7 @@ |
467 | 466 | * @param $name String Username |
468 | 467 | * @return Int|Null The corresponding user's ID, or null if user is nonexistent |
469 | 468 | */ |
470 | | - static function idFromName( $name ) { |
| 469 | + public static function idFromName( $name ) { |
471 | 470 | $nt = Title::makeTitleSafe( NS_USER, $name ); |
472 | 471 | if( is_null( $nt ) ) { |
473 | 472 | # Illegal name |
— | — | @@ -518,7 +517,7 @@ |
519 | 518 | * @param $name String to match |
520 | 519 | * @return Bool |
521 | 520 | */ |
522 | | - static function isIP( $name ) { |
| 521 | + public static function isIP( $name ) { |
523 | 522 | return preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.(?:xxx|\d{1,3})$/',$name) || IP::isIPv6($name); |
524 | 523 | } |
525 | 524 | |
— | — | @@ -533,7 +532,7 @@ |
534 | 533 | * @param $name String to match |
535 | 534 | * @return Bool |
536 | 535 | */ |
537 | | - static function isValidUserName( $name ) { |
| 536 | + public static function isValidUserName( $name ) { |
538 | 537 | global $wgContLang, $wgMaxNameChars; |
539 | 538 | |
540 | 539 | if ( $name == '' |
— | — | @@ -587,7 +586,7 @@ |
588 | 587 | * @param $name String to match |
589 | 588 | * @return Bool |
590 | 589 | */ |
591 | | - static function isUsableName( $name ) { |
| 590 | + public static function isUsableName( $name ) { |
592 | 591 | global $wgReservedUsernames; |
593 | 592 | // Must be a valid username, obviously ;) |
594 | 593 | if ( !self::isValidUserName( $name ) ) { |
— | — | @@ -624,7 +623,7 @@ |
625 | 624 | * @param $name String to match |
626 | 625 | * @return Bool |
627 | 626 | */ |
628 | | - static function isCreatableName( $name ) { |
| 627 | + public static function isCreatableName( $name ) { |
629 | 628 | global $wgInvalidUsernameCharacters; |
630 | 629 | |
631 | 630 | // Ensure that the username isn't longer than 235 bytes, so that |
— | — | @@ -654,7 +653,7 @@ |
655 | 654 | * @param $password String Desired password |
656 | 655 | * @return Bool |
657 | 656 | */ |
658 | | - function isValidPassword( $password ) { |
| 657 | + public function isValidPassword( $password ) { |
659 | 658 | //simple boolean wrapper for getPasswordValidity |
660 | 659 | return $this->getPasswordValidity( $password ) === true; |
661 | 660 | } |
— | — | @@ -665,7 +664,7 @@ |
666 | 665 | * @param $password String Desired password |
667 | 666 | * @return mixed: true on success, string or array of error message on failure |
668 | 667 | */ |
669 | | - function getPasswordValidity( $password ) { |
| 668 | + public function getPasswordValidity( $password ) { |
670 | 669 | global $wgMinimalPasswordLength, $wgContLang; |
671 | 670 | |
672 | 671 | static $blockedLogins = array( |
— | — | @@ -740,7 +739,7 @@ |
741 | 740 | * - 'usable' Valid for batch processes and login |
742 | 741 | * - 'creatable' Valid for batch processes, login and account creation |
743 | 742 | */ |
744 | | - static function getCanonicalName( $name, $validate = 'valid' ) { |
| 743 | + public static function getCanonicalName( $name, $validate = 'valid' ) { |
745 | 744 | # Force usernames to capital |
746 | 745 | global $wgContLang; |
747 | 746 | $name = $wgContLang->ucfirst( $name ); |
— | — | @@ -794,7 +793,7 @@ |
795 | 794 | * @param $uid Int User ID to check |
796 | 795 | * @return Int the user's edit count |
797 | 796 | */ |
798 | | - static function edits( $uid ) { |
| 797 | + public static function edits( $uid ) { |
799 | 798 | wfProfileIn( __METHOD__ ); |
800 | 799 | $dbr = wfGetDB( DB_SLAVE ); |
801 | 800 | // check if the user_editcount field has been initialized |
— | — | @@ -830,7 +829,7 @@ |
831 | 830 | * |
832 | 831 | * @return String new random password |
833 | 832 | */ |
834 | | - static function randomPassword() { |
| 833 | + public static function randomPassword() { |
835 | 834 | global $wgMinimalPasswordLength; |
836 | 835 | $pwchars = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz'; |
837 | 836 | $l = strlen( $pwchars ) - 1; |
— | — | @@ -849,9 +848,8 @@ |
850 | 849 | * |
851 | 850 | * @note This no longer clears uncached lazy-initialised properties; |
852 | 851 | * the constructor does that instead. |
853 | | - * @private |
854 | 852 | */ |
855 | | - function loadDefaults( $name = false ) { |
| 853 | + private function loadDefaults( $name = false ) { |
856 | 854 | wfProfileIn( __METHOD__ ); |
857 | 855 | |
858 | 856 | $this->mId = 0; |
— | — | @@ -1007,9 +1005,8 @@ |
1008 | 1006 | * $this->mId must be set, this is how the user is identified. |
1009 | 1007 | * |
1010 | 1008 | * @return Bool True if the user exists, false if the user is anonymous |
1011 | | - * @private |
1012 | 1009 | */ |
1013 | | - function loadFromDatabase() { |
| 1010 | + private function loadFromDatabase() { |
1014 | 1011 | # Paranoia |
1015 | 1012 | $this->mId = intval( $this->mId ); |
1016 | 1013 | |
— | — | @@ -1043,7 +1040,7 @@ |
1044 | 1041 | * |
1045 | 1042 | * @param $row Array Row from the user table to load. |
1046 | 1043 | */ |
1047 | | - function loadFromRow( $row ) { |
| 1044 | + public function loadFromRow( $row ) { |
1048 | 1045 | $all = true; |
1049 | 1046 | |
1050 | 1047 | if ( isset( $row->user_name ) ) { |
— | — | @@ -1107,9 +1104,8 @@ |
1108 | 1105 | |
1109 | 1106 | /** |
1110 | 1107 | * Load the groups from the database if they aren't already loaded. |
1111 | | - * @private |
1112 | 1108 | */ |
1113 | | - function loadGroups() { |
| 1109 | + private function loadGroups() { |
1114 | 1110 | if ( is_null( $this->mGroups ) ) { |
1115 | 1111 | $dbr = wfGetDB( DB_MASTER ); |
1116 | 1112 | $res = $dbr->select( 'user_groups', |
— | — | @@ -1167,7 +1163,7 @@ |
1168 | 1164 | * given source. May be "name", "id", "defaults", "session", or false for |
1169 | 1165 | * no reload. |
1170 | 1166 | */ |
1171 | | - function clearInstanceCache( $reloadFrom = false ) { |
| 1167 | + public function clearInstanceCache( $reloadFrom = false ) { |
1172 | 1168 | $this->mNewtalk = -1; |
1173 | 1169 | $this->mDatePreference = null; |
1174 | 1170 | $this->mBlockedby = -1; # Unset |
— | — | @@ -1188,7 +1184,7 @@ |
1189 | 1185 | * |
1190 | 1186 | * @return Array of String options |
1191 | 1187 | */ |
1192 | | - static function getDefaultOptions() { |
| 1188 | + public static function getDefaultOptions() { |
1193 | 1189 | global $wgNamespacesToBeSearchedDefault, $wgDefaultUserOptions, $wgContLang, $wgDefaultSkin; |
1194 | 1190 | |
1195 | 1191 | $defOpt = $wgDefaultUserOptions; |
— | — | @@ -1222,13 +1218,12 @@ |
1223 | 1219 | |
1224 | 1220 | /** |
1225 | 1221 | * Get blocking information |
1226 | | - * @private |
1227 | 1222 | * @param $bFromSlave Bool Whether to check the slave database first. To |
1228 | 1223 | * improve performance, non-critical checks are done |
1229 | 1224 | * against slaves. Check when actually saving should be |
1230 | 1225 | * done against master. |
1231 | 1226 | */ |
1232 | | - function getBlockedStatus( $bFromSlave = true ) { |
| 1227 | + private function getBlockedStatus( $bFromSlave = true ) { |
1233 | 1228 | global $wgProxyWhitelist, $wgUser; |
1234 | 1229 | |
1235 | 1230 | if ( -1 != $this->mBlockedby ) { |
— | — | @@ -1301,7 +1296,7 @@ |
1302 | 1297 | * @param $checkWhitelist Bool: whether to check the whitelist first |
1303 | 1298 | * @return Bool True if blacklisted. |
1304 | 1299 | */ |
1305 | | - function isDnsBlacklisted( $ip, $checkWhitelist = false ) { |
| 1300 | + public function isDnsBlacklisted( $ip, $checkWhitelist = false ) { |
1306 | 1301 | global $wgEnableSorbs, $wgEnableDnsBlacklist, |
1307 | 1302 | $wgSorbsUrl, $wgDnsBlacklistUrls, $wgProxyWhitelist; |
1308 | 1303 | |
— | — | @@ -1322,7 +1317,7 @@ |
1323 | 1318 | * @param $bases String|Array of Strings: URL of the DNS blacklist |
1324 | 1319 | * @return Bool True if blacklisted. |
1325 | 1320 | */ |
1326 | | - function inDnsBlacklist( $ip, $bases ) { |
| 1321 | + public function inDnsBlacklist( $ip, $bases ) { |
1327 | 1322 | wfProfileIn( __METHOD__ ); |
1328 | 1323 | |
1329 | 1324 | $found = false; |
— | — | @@ -1409,7 +1404,7 @@ |
1410 | 1405 | * @param $action String Action to enforce; 'edit' if unspecified |
1411 | 1406 | * @return Bool True if a rate limiter was tripped |
1412 | 1407 | */ |
1413 | | - function pingLimiter( $action = 'edit' ) { |
| 1408 | + public function pingLimiter( $action = 'edit' ) { |
1414 | 1409 | # Call the 'PingLimiter' hook |
1415 | 1410 | $result = false; |
1416 | 1411 | if( !wfRunHooks( 'PingLimiter', array( &$this, $action, $result ) ) ) { |
— | — | @@ -1504,7 +1499,7 @@ |
1505 | 1500 | * @param $bFromSlave Bool Whether to check the slave database instead of the master |
1506 | 1501 | * @return Bool True if blocked, false otherwise |
1507 | 1502 | */ |
1508 | | - function isBlocked( $bFromSlave = true ) { // hacked from false due to horrible probs on site |
| 1503 | + public function isBlocked( $bFromSlave = true ) { // hacked from false due to horrible probs on site |
1509 | 1504 | $this->getBlockedStatus( $bFromSlave ); |
1510 | 1505 | return $this->mBlock instanceof Block && $this->mBlock->prevents( 'edit' ); |
1511 | 1506 | } |
— | — | @@ -1539,7 +1534,7 @@ |
1540 | 1535 | * If user is blocked, return the name of the user who placed the block |
1541 | 1536 | * @return String name of blocker |
1542 | 1537 | */ |
1543 | | - function blockedBy() { |
| 1538 | + public function blockedBy() { |
1544 | 1539 | $this->getBlockedStatus(); |
1545 | 1540 | return $this->mBlockedby; |
1546 | 1541 | } |
— | — | @@ -1548,7 +1543,7 @@ |
1549 | 1544 | * If user is blocked, return the specified reason for the block |
1550 | 1545 | * @return String Blocking reason |
1551 | 1546 | */ |
1552 | | - function blockedFor() { |
| 1547 | + public function blockedFor() { |
1553 | 1548 | $this->getBlockedStatus(); |
1554 | 1549 | return $this->mBlockreason; |
1555 | 1550 | } |
— | — | @@ -1557,7 +1552,7 @@ |
1558 | 1553 | * If user is blocked, return the ID for the block |
1559 | 1554 | * @return Int Block ID |
1560 | 1555 | */ |
1561 | | - function getBlockId() { |
| 1556 | + public function getBlockId() { |
1562 | 1557 | $this->getBlockedStatus(); |
1563 | 1558 | return ( $this->mBlock ? $this->mBlock->getId() : false ); |
1564 | 1559 | } |
— | — | @@ -1570,7 +1565,7 @@ |
1571 | 1566 | * @param $ip String IP address, uses current client if none given |
1572 | 1567 | * @return Bool True if blocked, false otherwise |
1573 | 1568 | */ |
1574 | | - function isBlockedGlobally( $ip = '' ) { |
| 1569 | + public function isBlockedGlobally( $ip = '' ) { |
1575 | 1570 | if( $this->mBlockedGlobally !== null ) { |
1576 | 1571 | return $this->mBlockedGlobally; |
1577 | 1572 | } |
— | — | @@ -1591,7 +1586,7 @@ |
1592 | 1587 | * |
1593 | 1588 | * @return Bool True if locked, false otherwise |
1594 | 1589 | */ |
1595 | | - function isLocked() { |
| 1590 | + public function isLocked() { |
1596 | 1591 | if( $this->mLocked !== null ) { |
1597 | 1592 | return $this->mLocked; |
1598 | 1593 | } |
— | — | @@ -1606,7 +1601,7 @@ |
1607 | 1602 | * |
1608 | 1603 | * @return Bool True if hidden, false otherwise |
1609 | 1604 | */ |
1610 | | - function isHidden() { |
| 1605 | + public function isHidden() { |
1611 | 1606 | if( $this->mHideName !== null ) { |
1612 | 1607 | return $this->mHideName; |
1613 | 1608 | } |
— | — | @@ -1623,7 +1618,7 @@ |
1624 | 1619 | * Get the user's ID. |
1625 | 1620 | * @return Int The user's ID; 0 if the user is anonymous or nonexistent |
1626 | 1621 | */ |
1627 | | - function getId() { |
| 1622 | + public function getId() { |
1628 | 1623 | if( $this->mId === null && $this->mName !== null |
1629 | 1624 | && User::isIP( $this->mName ) ) { |
1630 | 1625 | // Special case, we know the user is anonymous |
— | — | @@ -1639,7 +1634,7 @@ |
1640 | 1635 | * Set the user and reload all fields according to a given ID |
1641 | 1636 | * @param $v Int User ID to reload |
1642 | 1637 | */ |
1643 | | - function setId( $v ) { |
| 1638 | + public function setId( $v ) { |
1644 | 1639 | $this->mId = $v; |
1645 | 1640 | $this->clearInstanceCache( 'id' ); |
1646 | 1641 | } |
— | — | @@ -1648,7 +1643,7 @@ |
1649 | 1644 | * Get the user name, or the IP of an anonymous user |
1650 | 1645 | * @return String User's name or IP address |
1651 | 1646 | */ |
1652 | | - function getName() { |
| 1647 | + public function getName() { |
1653 | 1648 | if ( $this->isItemLoaded( 'name', 'only' ) ) { |
1654 | 1649 | # Special case optimisation |
1655 | 1650 | return $this->mName; |
— | — | @@ -1675,7 +1670,7 @@ |
1676 | 1671 | * does not exist. |
1677 | 1672 | * @param $str String New user name to set |
1678 | 1673 | */ |
1679 | | - function setName( $str ) { |
| 1674 | + public function setName( $str ) { |
1680 | 1675 | $this->load(); |
1681 | 1676 | $this->mName = $str; |
1682 | 1677 | } |
— | — | @@ -1684,7 +1679,7 @@ |
1685 | 1680 | * Get the user's name escaped by underscores. |
1686 | 1681 | * @return String Username escaped by underscores. |
1687 | 1682 | */ |
1688 | | - function getTitleKey() { |
| 1683 | + public function getTitleKey() { |
1689 | 1684 | return str_replace( ' ', '_', $this->getName() ); |
1690 | 1685 | } |
1691 | 1686 | |
— | — | @@ -1692,7 +1687,7 @@ |
1693 | 1688 | * Check if the user has new messages. |
1694 | 1689 | * @return Bool True if the user has new messages |
1695 | 1690 | */ |
1696 | | - function getNewtalk() { |
| 1691 | + public function getNewtalk() { |
1697 | 1692 | $this->load(); |
1698 | 1693 | |
1699 | 1694 | # Load the newtalk status if it is unloaded (mNewtalk=-1) |
— | — | @@ -1725,7 +1720,7 @@ |
1726 | 1721 | * Return the talk page(s) this user has new messages on. |
1727 | 1722 | * @return Array of String page URLs |
1728 | 1723 | */ |
1729 | | - function getNewMessageLinks() { |
| 1724 | + public function getNewMessageLinks() { |
1730 | 1725 | $talks = array(); |
1731 | 1726 | if( !wfRunHooks( 'UserRetrieveNewTalks', array( &$this, &$talks ) ) ) |
1732 | 1727 | return $talks; |
— | — | @@ -1802,7 +1797,7 @@ |
1803 | 1798 | * Update the 'You have new messages!' status. |
1804 | 1799 | * @param $val Bool Whether the user has new messages |
1805 | 1800 | */ |
1806 | | - function setNewtalk( $val ) { |
| 1801 | + public function setNewtalk( $val ) { |
1807 | 1802 | if( wfReadOnly() ) { |
1808 | 1803 | return; |
1809 | 1804 | } |
— | — | @@ -1866,7 +1861,7 @@ |
1867 | 1862 | * Updates user_touched field, and removes account data from memcached |
1868 | 1863 | * for reload on the next hit. |
1869 | 1864 | */ |
1870 | | - function invalidateCache() { |
| 1865 | + public function invalidateCache() { |
1871 | 1866 | if( wfReadOnly() ) { |
1872 | 1867 | return; |
1873 | 1868 | } |
— | — | @@ -1888,7 +1883,7 @@ |
1889 | 1884 | * Validate the cache for this account. |
1890 | 1885 | * @param $timestamp String A timestamp in TS_MW format |
1891 | 1886 | */ |
1892 | | - function validateCache( $timestamp ) { |
| 1887 | + public function validateCache( $timestamp ) { |
1893 | 1888 | $this->load(); |
1894 | 1889 | return ( $timestamp >= $this->mTouched ); |
1895 | 1890 | } |
— | — | @@ -1897,7 +1892,7 @@ |
1898 | 1893 | * Get the user touched timestamp |
1899 | 1894 | * @return String timestamp |
1900 | 1895 | */ |
1901 | | - function getTouched() { |
| 1896 | + public function getTouched() { |
1902 | 1897 | $this->load(); |
1903 | 1898 | return $this->mTouched; |
1904 | 1899 | } |
— | — | @@ -1916,7 +1911,7 @@ |
1917 | 1912 | * @param $str String New password to set |
1918 | 1913 | * @throws PasswordError on failure |
1919 | 1914 | */ |
1920 | | - function setPassword( $str ) { |
| 1915 | + public function setPassword( $str ) { |
1921 | 1916 | global $wgAuth; |
1922 | 1917 | |
1923 | 1918 | if( $str !== null ) { |
— | — | @@ -1952,7 +1947,7 @@ |
1953 | 1948 | * |
1954 | 1949 | * @param $str String New password to set |
1955 | 1950 | */ |
1956 | | - function setInternalPassword( $str ) { |
| 1951 | + public function setInternalPassword( $str ) { |
1957 | 1952 | $this->load(); |
1958 | 1953 | $this->setToken(); |
1959 | 1954 | |
— | — | @@ -1970,7 +1965,7 @@ |
1971 | 1966 | * Get the user's current token. |
1972 | 1967 | * @return String Token |
1973 | 1968 | */ |
1974 | | - function getToken() { |
| 1969 | + public function getToken() { |
1975 | 1970 | $this->load(); |
1976 | 1971 | return $this->mToken; |
1977 | 1972 | } |
— | — | @@ -1980,9 +1975,8 @@ |
1981 | 1976 | * Called from loadDefaults() among other places. |
1982 | 1977 | * |
1983 | 1978 | * @param $token String If specified, set the token to this value |
1984 | | - * @private |
1985 | 1979 | */ |
1986 | | - function setToken( $token = false ) { |
| 1980 | + public function setToken( $token = false ) { |
1987 | 1981 | global $wgSecretKey, $wgProxyKey; |
1988 | 1982 | $this->load(); |
1989 | 1983 | if ( !$token ) { |
— | — | @@ -2003,9 +1997,8 @@ |
2004 | 1998 | * Set the cookie password |
2005 | 1999 | * |
2006 | 2000 | * @param $str String New cookie password |
2007 | | - * @private |
2008 | 2001 | */ |
2009 | | - function setCookiePassword( $str ) { |
| 2002 | + private function setCookiePassword( $str ) { |
2010 | 2003 | $this->load(); |
2011 | 2004 | $this->mCookiePassword = md5( $str ); |
2012 | 2005 | } |
— | — | @@ -2016,7 +2009,7 @@ |
2017 | 2010 | * @param $str String New password to set |
2018 | 2011 | * @param $throttle Bool If true, reset the throttle timestamp to the present |
2019 | 2012 | */ |
2020 | | - function setNewpassword( $str, $throttle = true ) { |
| 2013 | + public function setNewpassword( $str, $throttle = true ) { |
2021 | 2014 | $this->load(); |
2022 | 2015 | $this->mNewpassword = self::crypt( $str ); |
2023 | 2016 | if ( $throttle ) { |
— | — | @@ -2029,7 +2022,7 @@ |
2030 | 2023 | * $wgPasswordReminderResendTime hours? |
2031 | 2024 | * @return Bool |
2032 | 2025 | */ |
2033 | | - function isPasswordReminderThrottled() { |
| 2026 | + public function isPasswordReminderThrottled() { |
2034 | 2027 | global $wgPasswordReminderResendTime; |
2035 | 2028 | $this->load(); |
2036 | 2029 | if ( !$this->mNewpassTime || !$wgPasswordReminderResendTime ) { |
— | — | @@ -2043,7 +2036,7 @@ |
2044 | 2037 | * Get the user's e-mail address |
2045 | 2038 | * @return String User's email address |
2046 | 2039 | */ |
2047 | | - function getEmail() { |
| 2040 | + public function getEmail() { |
2048 | 2041 | $this->load(); |
2049 | 2042 | wfRunHooks( 'UserGetEmail', array( $this, &$this->mEmail ) ); |
2050 | 2043 | return $this->mEmail; |
— | — | @@ -2053,7 +2046,7 @@ |
2054 | 2047 | * Get the timestamp of the user's e-mail authentication |
2055 | 2048 | * @return String TS_MW timestamp |
2056 | 2049 | */ |
2057 | | - function getEmailAuthenticationTimestamp() { |
| 2050 | + public function getEmailAuthenticationTimestamp() { |
2058 | 2051 | $this->load(); |
2059 | 2052 | wfRunHooks( 'UserGetEmailAuthenticationTimestamp', array( $this, &$this->mEmailAuthenticated ) ); |
2060 | 2053 | return $this->mEmailAuthenticated; |
— | — | @@ -2063,7 +2056,7 @@ |
2064 | 2057 | * Set the user's e-mail address |
2065 | 2058 | * @param $str String New e-mail address |
2066 | 2059 | */ |
2067 | | - function setEmail( $str ) { |
| 2060 | + public function setEmail( $str ) { |
2068 | 2061 | $this->load(); |
2069 | 2062 | $this->mEmail = $str; |
2070 | 2063 | wfRunHooks( 'UserSetEmail', array( $this, &$this->mEmail ) ); |
— | — | @@ -2073,7 +2066,7 @@ |
2074 | 2067 | * Get the user's real name |
2075 | 2068 | * @return String User's real name |
2076 | 2069 | */ |
2077 | | - function getRealName() { |
| 2070 | + public function getRealName() { |
2078 | 2071 | if ( !$this->isItemLoaded( 'realname' ) ) { |
2079 | 2072 | $this->load(); |
2080 | 2073 | } |
— | — | @@ -2085,7 +2078,7 @@ |
2086 | 2079 | * Set the user's real name |
2087 | 2080 | * @param $str String New real name |
2088 | 2081 | */ |
2089 | | - function setRealName( $str ) { |
| 2082 | + public function setRealName( $str ) { |
2090 | 2083 | $this->load(); |
2091 | 2084 | $this->mRealName = $str; |
2092 | 2085 | } |
— | — | @@ -2100,7 +2093,7 @@ |
2101 | 2094 | * @see getBoolOption() |
2102 | 2095 | * @see getIntOption() |
2103 | 2096 | */ |
2104 | | - function getOption( $oname, $defaultOverride = null, $ignoreHidden = false ) { |
| 2097 | + public function getOption( $oname, $defaultOverride = null, $ignoreHidden = false ) { |
2105 | 2098 | global $wgHiddenPrefs; |
2106 | 2099 | $this->loadOptions(); |
2107 | 2100 | |
— | — | @@ -2159,11 +2152,10 @@ |
2160 | 2153 | * @return Bool User's current value for the option |
2161 | 2154 | * @see getOption() |
2162 | 2155 | */ |
2163 | | - function getBoolOption( $oname ) { |
| 2156 | + public function getBoolOption( $oname ) { |
2164 | 2157 | return (bool)$this->getOption( $oname ); |
2165 | 2158 | } |
2166 | 2159 | |
2167 | | - |
2168 | 2160 | /** |
2169 | 2161 | * Get the user's current setting for a given option, as a boolean value. |
2170 | 2162 | * |
— | — | @@ -2172,7 +2164,7 @@ |
2173 | 2165 | * @return Int User's current value for the option |
2174 | 2166 | * @see getOption() |
2175 | 2167 | */ |
2176 | | - function getIntOption( $oname, $defaultOverride=0 ) { |
| 2168 | + public function getIntOption( $oname, $defaultOverride=0 ) { |
2177 | 2169 | $val = $this->getOption( $oname ); |
2178 | 2170 | if( $val == '' ) { |
2179 | 2171 | $val = $defaultOverride; |
— | — | @@ -2186,7 +2178,7 @@ |
2187 | 2179 | * @param $oname String The option to set |
2188 | 2180 | * @param $val mixed New value to set |
2189 | 2181 | */ |
2190 | | - function setOption( $oname, $val ) { |
| 2182 | + public function setOption( $oname, $val ) { |
2191 | 2183 | $this->load(); |
2192 | 2184 | $this->loadOptions(); |
2193 | 2185 | |
— | — | @@ -2202,7 +2194,7 @@ |
2203 | 2195 | /** |
2204 | 2196 | * Reset all options to the site defaults |
2205 | 2197 | */ |
2206 | | - function resetOptions() { |
| 2198 | + public function resetOptions() { |
2207 | 2199 | $this->mOptions = self::getDefaultOptions(); |
2208 | 2200 | } |
2209 | 2201 | |
— | — | @@ -2210,7 +2202,7 @@ |
2211 | 2203 | * Get the user's preferred date format. |
2212 | 2204 | * @return String User's preferred date format |
2213 | 2205 | */ |
2214 | | - function getDatePreference() { |
| 2206 | + public function getDatePreference() { |
2215 | 2207 | // Important migration for old data rows |
2216 | 2208 | if ( is_null( $this->mDatePreference ) ) { |
2217 | 2209 | global $wgLang; |
— | — | @@ -2227,7 +2219,7 @@ |
2228 | 2220 | /** |
2229 | 2221 | * Get the user preferred stub threshold |
2230 | 2222 | */ |
2231 | | - function getStubThreshold() { |
| 2223 | + public function getStubThreshold() { |
2232 | 2224 | global $wgMaxArticleSize; # Maximum article size, in Kb |
2233 | 2225 | $threshold = intval( $this->getOption( 'stubthreshold' ) ); |
2234 | 2226 | if ( $threshold > $wgMaxArticleSize * 1024 ) { |
— | — | @@ -2243,13 +2235,13 @@ |
2244 | 2236 | * @param $ns int If numeric, get permissions for this namespace |
2245 | 2237 | * @return Array of String permission names |
2246 | 2238 | */ |
2247 | | - function getRights( $ns = null ) { |
| 2239 | + public function getRights( $ns = null ) { |
2248 | 2240 | $key = is_null( $ns ) ? '*' : intval( $ns ); |
2249 | | - |
| 2241 | + |
2250 | 2242 | if ( is_null( $this->mRights ) ) { |
2251 | 2243 | $this->mRights = array(); |
2252 | 2244 | } |
2253 | | - |
| 2245 | + |
2254 | 2246 | if ( !isset( $this->mRights[$key] ) ) { |
2255 | 2247 | $this->mRights[$key] = self::getGroupPermissions( $this->getEffectiveGroups(), $ns ); |
2256 | 2248 | wfRunHooks( 'UserGetRights', array( $this, &$this->mRights[$key], $ns ) ); |
— | — | @@ -2262,7 +2254,7 @@ |
2263 | 2255 | // Merge non namespace specific rights |
2264 | 2256 | return array_merge( $this->mRights[$key], $this->getRights() ); |
2265 | 2257 | } |
2266 | | - |
| 2258 | + |
2267 | 2259 | } |
2268 | 2260 | |
2269 | 2261 | /** |
— | — | @@ -2270,7 +2262,7 @@ |
2271 | 2263 | * The implicit * and user groups are not included. |
2272 | 2264 | * @return Array of String internal group names |
2273 | 2265 | */ |
2274 | | - function getGroups() { |
| 2266 | + public function getGroups() { |
2275 | 2267 | $this->load(); |
2276 | 2268 | return $this->mGroups; |
2277 | 2269 | } |
— | — | @@ -2282,7 +2274,7 @@ |
2283 | 2275 | * @param $recache Bool Whether to avoid the cache |
2284 | 2276 | * @return Array of String internal group names |
2285 | 2277 | */ |
2286 | | - function getEffectiveGroups( $recache = false ) { |
| 2278 | + public function getEffectiveGroups( $recache = false ) { |
2287 | 2279 | if ( $recache || is_null( $this->mEffectiveGroups ) ) { |
2288 | 2280 | wfProfileIn( __METHOD__ ); |
2289 | 2281 | $this->mEffectiveGroups = $this->getGroups(); |
— | — | @@ -2312,7 +2304,7 @@ |
2313 | 2305 | * |
2314 | 2306 | * @return array Names of the groups the user has belonged to. |
2315 | 2307 | */ |
2316 | | - function getFormerGroups() { |
| 2308 | + public function getFormerGroups() { |
2317 | 2309 | if( is_null( $this->mFormerGroups ) ) { |
2318 | 2310 | $dbr = wfGetDB( DB_MASTER ); |
2319 | 2311 | $res = $dbr->select( 'user_former_groups', |
— | — | @@ -2331,7 +2323,7 @@ |
2332 | 2324 | * Get the user's edit count. |
2333 | 2325 | * @return Int |
2334 | 2326 | */ |
2335 | | - function getEditCount() { |
| 2327 | + public function getEditCount() { |
2336 | 2328 | if( $this->getId() ) { |
2337 | 2329 | if ( !isset( $this->mEditCount ) ) { |
2338 | 2330 | /* Populate the count, if it has not been populated yet */ |
— | — | @@ -2349,7 +2341,7 @@ |
2350 | 2342 | * This takes immediate effect. |
2351 | 2343 | * @param $group String Name of the group to add |
2352 | 2344 | */ |
2353 | | - function addGroup( $group ) { |
| 2345 | + public function addGroup( $group ) { |
2354 | 2346 | if( wfRunHooks( 'UserAddGroup', array( $this, &$group ) ) ) { |
2355 | 2347 | $dbw = wfGetDB( DB_MASTER ); |
2356 | 2348 | if( $this->getId() ) { |
— | — | @@ -2374,7 +2366,7 @@ |
2375 | 2367 | * This takes immediate effect. |
2376 | 2368 | * @param $group String Name of the group to remove |
2377 | 2369 | */ |
2378 | | - function removeGroup( $group ) { |
| 2370 | + public function removeGroup( $group ) { |
2379 | 2371 | $this->load(); |
2380 | 2372 | if( wfRunHooks( 'UserRemoveGroup', array( $this, &$group ) ) ) { |
2381 | 2373 | $dbw = wfGetDB( DB_MASTER ); |
— | — | @@ -2403,7 +2395,7 @@ |
2404 | 2396 | * Get whether the user is logged in |
2405 | 2397 | * @return Bool |
2406 | 2398 | */ |
2407 | | - function isLoggedIn() { |
| 2399 | + public function isLoggedIn() { |
2408 | 2400 | return $this->getID() != 0; |
2409 | 2401 | } |
2410 | 2402 | |
— | — | @@ -2411,7 +2403,7 @@ |
2412 | 2404 | * Get whether the user is anonymous |
2413 | 2405 | * @return Bool |
2414 | 2406 | */ |
2415 | | - function isAnon() { |
| 2407 | + public function isAnon() { |
2416 | 2408 | return !$this->isLoggedIn(); |
2417 | 2409 | } |
2418 | 2410 | |
— | — | @@ -2503,7 +2495,7 @@ |
2504 | 2496 | * @todo FIXME: Need to check the old failback system [AV] |
2505 | 2497 | * @deprecated since 1.18 Use ->getSkin() in the most relevant outputting context you have |
2506 | 2498 | */ |
2507 | | - function getSkin() { |
| 2499 | + public function getSkin() { |
2508 | 2500 | return RequestContext::getMain()->getSkin(); |
2509 | 2501 | } |
2510 | 2502 | |
— | — | @@ -2512,7 +2504,7 @@ |
2513 | 2505 | * @param $title Title of the article to look at |
2514 | 2506 | * @return Bool |
2515 | 2507 | */ |
2516 | | - function isWatched( $title ) { |
| 2508 | + public function isWatched( $title ) { |
2517 | 2509 | $wl = WatchedItem::fromUserTitle( $this, $title ); |
2518 | 2510 | return $wl->isWatched(); |
2519 | 2511 | } |
— | — | @@ -2521,7 +2513,7 @@ |
2522 | 2514 | * Watch an article. |
2523 | 2515 | * @param $title Title of the article to look at |
2524 | 2516 | */ |
2525 | | - function addWatch( $title ) { |
| 2517 | + public function addWatch( $title ) { |
2526 | 2518 | $wl = WatchedItem::fromUserTitle( $this, $title ); |
2527 | 2519 | $wl->addWatch(); |
2528 | 2520 | $this->invalidateCache(); |
— | — | @@ -2531,7 +2523,7 @@ |
2532 | 2524 | * Stop watching an article. |
2533 | 2525 | * @param $title Title of the article to look at |
2534 | 2526 | */ |
2535 | | - function removeWatch( $title ) { |
| 2527 | + public function removeWatch( $title ) { |
2536 | 2528 | $wl = WatchedItem::fromUserTitle( $this, $title ); |
2537 | 2529 | $wl->removeWatch(); |
2538 | 2530 | $this->invalidateCache(); |
— | — | @@ -2543,7 +2535,7 @@ |
2544 | 2536 | * the next change of the page if it's watched etc. |
2545 | 2537 | * @param $title Title of the article to look at |
2546 | 2538 | */ |
2547 | | - function clearNotification( &$title ) { |
| 2539 | + public function clearNotification( &$title ) { |
2548 | 2540 | global $wgUseEnotif, $wgShowUpdatedMarker; |
2549 | 2541 | |
2550 | 2542 | # Do nothing if the database is locked to writes |
— | — | @@ -2600,7 +2592,7 @@ |
2601 | 2593 | * If e-notif e-mails are on, they will receive notification mails on |
2602 | 2594 | * the next change of any watched page. |
2603 | 2595 | */ |
2604 | | - function clearAllNotifications() { |
| 2596 | + public function clearAllNotifications() { |
2605 | 2597 | global $wgUseEnotif, $wgShowUpdatedMarker; |
2606 | 2598 | if ( !$wgUseEnotif && !$wgShowUpdatedMarker ) { |
2607 | 2599 | $this->setNewtalk( false ); |
— | — | @@ -2624,9 +2616,8 @@ |
2625 | 2617 | /** |
2626 | 2618 | * Set this user's options from an encoded string |
2627 | 2619 | * @param $str String Encoded options to import |
2628 | | - * @private |
2629 | 2620 | */ |
2630 | | - function decodeOptions( $str ) { |
| 2621 | + private function decodeOptions( $str ) { |
2631 | 2622 | if( !$str ) |
2632 | 2623 | return; |
2633 | 2624 | |
— | — | @@ -2672,7 +2663,7 @@ |
2673 | 2664 | * @param $request WebRequest object to use; $wgRequest will be used if null |
2674 | 2665 | * is passed. |
2675 | 2666 | */ |
2676 | | - function setCookies( $request = null ) { |
| 2667 | + public function setCookies( $request = null ) { |
2677 | 2668 | if ( $request === null ) { |
2678 | 2669 | $request = $this->getRequest(); |
2679 | 2670 | } |
— | — | @@ -2711,7 +2702,7 @@ |
2712 | 2703 | /** |
2713 | 2704 | * Log this user out. |
2714 | 2705 | */ |
2715 | | - function logout() { |
| 2706 | + public function logout() { |
2716 | 2707 | if( wfRunHooks( 'UserLogout', array( &$this ) ) ) { |
2717 | 2708 | $this->doLogout(); |
2718 | 2709 | } |
— | — | @@ -2719,10 +2710,9 @@ |
2720 | 2711 | |
2721 | 2712 | /** |
2722 | 2713 | * Clear the user's cookies and session, and reset the instance cache. |
2723 | | - * @private |
2724 | 2714 | * @see logout() |
2725 | 2715 | */ |
2726 | | - function doLogout() { |
| 2716 | + private function doLogout() { |
2727 | 2717 | $this->clearInstanceCache( 'defaults' ); |
2728 | 2718 | |
2729 | 2719 | $this->getRequest()->setSessionData( 'wsUserID', 0 ); |
— | — | @@ -2738,7 +2728,7 @@ |
2739 | 2729 | * Save this user's settings into the database. |
2740 | 2730 | * @todo Only rarely do all these fields need to be set! |
2741 | 2731 | */ |
2742 | | - function saveSettings() { |
| 2732 | + public function saveSettings() { |
2743 | 2733 | $this->load(); |
2744 | 2734 | if ( wfReadOnly() ) { return; } |
2745 | 2735 | if ( 0 == $this->mId ) { return; } |
— | — | @@ -2776,7 +2766,7 @@ |
2777 | 2767 | * If only this user's username is known, and it exists, return the user ID. |
2778 | 2768 | * @return Int |
2779 | 2769 | */ |
2780 | | - function idForName() { |
| 2770 | + public function idForName() { |
2781 | 2771 | $s = trim( $this->getName() ); |
2782 | 2772 | if ( $s === '' ) return 0; |
2783 | 2773 | |
— | — | @@ -2804,7 +2794,7 @@ |
2805 | 2795 | * |
2806 | 2796 | * @return User object, or null if the username already exists |
2807 | 2797 | */ |
2808 | | - static function createNew( $name, $params = array() ) { |
| 2798 | + public static function createNew( $name, $params = array() ) { |
2809 | 2799 | $user = new User; |
2810 | 2800 | $user->load(); |
2811 | 2801 | if ( isset( $params['options'] ) ) { |
— | — | @@ -2843,7 +2833,7 @@ |
2844 | 2834 | /** |
2845 | 2835 | * Add this existing user object to the database |
2846 | 2836 | */ |
2847 | | - function addToDatabase() { |
| 2837 | + public function addToDatabase() { |
2848 | 2838 | $this->load(); |
2849 | 2839 | $dbw = wfGetDB( DB_MASTER ); |
2850 | 2840 | $seqVal = $dbw->nextSequenceValue( 'user_user_id_seq' ); |
— | — | @@ -2875,7 +2865,7 @@ |
2876 | 2866 | * If this (non-anonymous) user is blocked, block any IP address |
2877 | 2867 | * they've successfully logged in from. |
2878 | 2868 | */ |
2879 | | - function spreadBlock() { |
| 2869 | + public function spreadBlock() { |
2880 | 2870 | wfDebug( __METHOD__ . "()\n" ); |
2881 | 2871 | $this->load(); |
2882 | 2872 | if ( $this->mId == 0 ) { |
— | — | @@ -2904,7 +2894,7 @@ |
2905 | 2895 | * @deprecated since 1.17 use the ParserOptions object to get the relevant options |
2906 | 2896 | * @return String Page rendering hash |
2907 | 2897 | */ |
2908 | | - function getPageRenderingHash() { |
| 2898 | + public function getPageRenderingHash() { |
2909 | 2899 | global $wgUseDynamicDates, $wgRenderHashAppend, $wgLang, $wgContLang; |
2910 | 2900 | if( $this->mHash ){ |
2911 | 2901 | return $this->mHash; |
— | — | @@ -2946,7 +2936,7 @@ |
2947 | 2937 | * Get whether the user is explicitly blocked from account creation. |
2948 | 2938 | * @return Bool|Block |
2949 | 2939 | */ |
2950 | | - function isBlockedFromCreateAccount() { |
| 2940 | + public function isBlockedFromCreateAccount() { |
2951 | 2941 | $this->getBlockedStatus(); |
2952 | 2942 | if( $this->mBlock && $this->mBlock->prevents( 'createaccount' ) ){ |
2953 | 2943 | return $this->mBlock; |
— | — | @@ -2967,7 +2957,7 @@ |
2968 | 2958 | * Get whether the user is blocked from using Special:Emailuser. |
2969 | 2959 | * @return Bool |
2970 | 2960 | */ |
2971 | | - function isBlockedFromEmailuser() { |
| 2961 | + public function isBlockedFromEmailuser() { |
2972 | 2962 | $this->getBlockedStatus(); |
2973 | 2963 | return $this->mBlock && $this->mBlock->prevents( 'sendemail' ); |
2974 | 2964 | } |
— | — | @@ -2985,7 +2975,7 @@ |
2986 | 2976 | * |
2987 | 2977 | * @return Title: User's personal page title |
2988 | 2978 | */ |
2989 | | - function getUserPage() { |
| 2979 | + public function getUserPage() { |
2990 | 2980 | return Title::makeTitle( NS_USER, $this->getName() ); |
2991 | 2981 | } |
2992 | 2982 | |
— | — | @@ -2994,7 +2984,7 @@ |
2995 | 2985 | * |
2996 | 2986 | * @return Title: User's talk page title |
2997 | 2987 | */ |
2998 | | - function getTalkPage() { |
| 2988 | + public function getTalkPage() { |
2999 | 2989 | $title = $this->getUserPage(); |
3000 | 2990 | return $title->getTalkPage(); |
3001 | 2991 | } |
— | — | @@ -3004,7 +2994,7 @@ |
3005 | 2995 | * anonymous IPs, or the most recently created accounts. |
3006 | 2996 | * @return Bool |
3007 | 2997 | */ |
3008 | | - function isNewbie() { |
| 2998 | + public function isNewbie() { |
3009 | 2999 | return !$this->isAllowed( 'autoconfirmed' ); |
3010 | 3000 | } |
3011 | 3001 | |
— | — | @@ -3013,7 +3003,7 @@ |
3014 | 3004 | * @param $password String: user password. |
3015 | 3005 | * @return Boolean: True if the given password is correct, otherwise False. |
3016 | 3006 | */ |
3017 | | - function checkPassword( $password ) { |
| 3007 | + public function checkPassword( $password ) { |
3018 | 3008 | global $wgAuth, $wgLegacyEncoding; |
3019 | 3009 | $this->load(); |
3020 | 3010 | |
— | — | @@ -3055,7 +3045,7 @@ |
3056 | 3046 | * sent by e-mail for password reset operations. |
3057 | 3047 | * @return Boolean: True if matches, false otherwise |
3058 | 3048 | */ |
3059 | | - function checkTemporaryPassword( $plaintext ) { |
| 3049 | + public function checkTemporaryPassword( $plaintext ) { |
3060 | 3050 | global $wgNewPasswordExpiry; |
3061 | 3051 | |
3062 | 3052 | $this->load(); |
— | — | @@ -3080,7 +3070,7 @@ |
3081 | 3071 | * @param $request WebRequest object to use or null to use $wgRequest |
3082 | 3072 | * @return String The new edit token |
3083 | 3073 | */ |
3084 | | - function editToken( $salt = '', $request = null ) { |
| 3074 | + public function editToken( $salt = '', $request = null ) { |
3085 | 3075 | if ( $request == null ) { |
3086 | 3076 | $request = $this->getRequest(); |
3087 | 3077 | } |
— | — | @@ -3122,7 +3112,7 @@ |
3123 | 3113 | * @param $request WebRequest object to use or null to use $wgRequest |
3124 | 3114 | * @return Boolean: Whether the token matches |
3125 | 3115 | */ |
3126 | | - function matchEditToken( $val, $salt = '', $request = null ) { |
| 3116 | + public function matchEditToken( $val, $salt = '', $request = null ) { |
3127 | 3117 | $sessionToken = $this->editToken( $salt, $request ); |
3128 | 3118 | if ( $val != $sessionToken ) { |
3129 | 3119 | wfDebug( "User::matchEditToken: broken session data\n" ); |
— | — | @@ -3139,7 +3129,7 @@ |
3140 | 3130 | * @param $request WebRequest object to use or null to use $wgRequest |
3141 | 3131 | * @return Boolean: Whether the token matches |
3142 | 3132 | */ |
3143 | | - function matchEditTokenNoSuffix( $val, $salt = '', $request = null ) { |
| 3133 | + public function matchEditTokenNoSuffix( $val, $salt = '', $request = null ) { |
3144 | 3134 | $sessionToken = $this->editToken( $salt, $request ); |
3145 | 3135 | return substr( $sessionToken, 0, 32 ) == substr( $val, 0, 32 ); |
3146 | 3136 | } |
— | — | @@ -3151,7 +3141,7 @@ |
3152 | 3142 | * @param $type String: message to send, either "created", "changed" or "set" |
3153 | 3143 | * @return Status object |
3154 | 3144 | */ |
3155 | | - function sendConfirmationMail( $type = 'created' ) { |
| 3145 | + public function sendConfirmationMail( $type = 'created' ) { |
3156 | 3146 | global $wgLang; |
3157 | 3147 | $expiration = null; // gets passed-by-ref and defined in next line. |
3158 | 3148 | $token = $this->confirmationToken( $expiration ); |
— | — | @@ -3188,7 +3178,7 @@ |
3189 | 3179 | * @param $replyto String Reply-To address |
3190 | 3180 | * @return Status |
3191 | 3181 | */ |
3192 | | - function sendMail( $subject, $body, $from = null, $replyto = null ) { |
| 3182 | + public function sendMail( $subject, $body, $from = null, $replyto = null ) { |
3193 | 3183 | if( is_null( $from ) ) { |
3194 | 3184 | global $wgPasswordSender, $wgPasswordSenderName; |
3195 | 3185 | $sender = new MailAddress( $wgPasswordSender, $wgPasswordSenderName ); |
— | — | @@ -3209,9 +3199,8 @@ |
3210 | 3200 | * |
3211 | 3201 | * @param[out] &$expiration \mixed Accepts the expiration time |
3212 | 3202 | * @return String New token |
3213 | | - * @private |
3214 | 3203 | */ |
3215 | | - function confirmationToken( &$expiration ) { |
| 3204 | + private function confirmationToken( &$expiration ) { |
3216 | 3205 | global $wgUserEmailConfirmationTokenExpiry; |
3217 | 3206 | $now = time(); |
3218 | 3207 | $expires = $now + $wgUserEmailConfirmationTokenExpiry; |
— | — | @@ -3228,9 +3217,8 @@ |
3229 | 3218 | * Return a URL the user can use to confirm their email address. |
3230 | 3219 | * @param $token String Accepts the email confirmation token |
3231 | 3220 | * @return String New token URL |
3232 | | - * @private |
3233 | 3221 | */ |
3234 | | - function confirmationTokenUrl( $token ) { |
| 3222 | + private function confirmationTokenUrl( $token ) { |
3235 | 3223 | return $this->getTokenUrl( 'ConfirmEmail', $token ); |
3236 | 3224 | } |
3237 | 3225 | |
— | — | @@ -3238,9 +3226,8 @@ |
3239 | 3227 | * Return a URL the user can use to invalidate their email address. |
3240 | 3228 | * @param $token String Accepts the email confirmation token |
3241 | 3229 | * @return String New token URL |
3242 | | - * @private |
3243 | 3230 | */ |
3244 | | - function invalidationTokenUrl( $token ) { |
| 3231 | + private function invalidationTokenUrl( $token ) { |
3245 | 3232 | return $this->getTokenUrl( 'Invalidateemail', $token ); |
3246 | 3233 | } |
3247 | 3234 | |
— | — | @@ -3272,7 +3259,7 @@ |
3273 | 3260 | * |
3274 | 3261 | * @note Call saveSettings() after calling this function to commit the change. |
3275 | 3262 | */ |
3276 | | - function confirmEmail() { |
| 3263 | + public function confirmEmail() { |
3277 | 3264 | $this->setEmailAuthenticationTimestamp( wfTimestampNow() ); |
3278 | 3265 | wfRunHooks( 'ConfirmEmailComplete', array( $this ) ); |
3279 | 3266 | return true; |
— | — | @@ -3283,6 +3270,7 @@ |
3284 | 3271 | * address if it was already confirmed. |
3285 | 3272 | * |
3286 | 3273 | * @note Call saveSettings() after calling this function to commit the change. |
| 3274 | + * @return true |
3287 | 3275 | */ |
3288 | 3276 | function invalidateEmail() { |
3289 | 3277 | $this->load(); |
— | — | @@ -3308,7 +3296,7 @@ |
3309 | 3297 | * site configuration? |
3310 | 3298 | * @return Bool |
3311 | 3299 | */ |
3312 | | - function canSendEmail() { |
| 3300 | + public function canSendEmail() { |
3313 | 3301 | global $wgEnableEmail, $wgEnableUserEmail; |
3314 | 3302 | if( !$wgEnableEmail || !$wgEnableUserEmail || !$this->isAllowed( 'sendemail' ) ) { |
3315 | 3303 | return false; |
— | — | @@ -3323,7 +3311,7 @@ |
3324 | 3312 | * site configuration? |
3325 | 3313 | * @return Bool |
3326 | 3314 | */ |
3327 | | - function canReceiveEmail() { |
| 3315 | + public function canReceiveEmail() { |
3328 | 3316 | return $this->isEmailConfirmed() && !$this->getOption( 'disablemail' ); |
3329 | 3317 | } |
3330 | 3318 | |
— | — | @@ -3337,7 +3325,7 @@ |
3338 | 3326 | * |
3339 | 3327 | * @return Bool |
3340 | 3328 | */ |
3341 | | - function isEmailConfirmed() { |
| 3329 | + public function isEmailConfirmed() { |
3342 | 3330 | global $wgEmailAuthentication; |
3343 | 3331 | $this->load(); |
3344 | 3332 | $confirmed = true; |
— | — | @@ -3361,7 +3349,7 @@ |
3362 | 3350 | * Check whether there is an outstanding request for e-mail confirmation. |
3363 | 3351 | * @return Bool |
3364 | 3352 | */ |
3365 | | - function isEmailConfirmationPending() { |
| 3353 | + public function isEmailConfirmationPending() { |
3366 | 3354 | global $wgEmailAuthentication; |
3367 | 3355 | return $wgEmailAuthentication && |
3368 | 3356 | !$this->isEmailConfirmed() && |
— | — | @@ -3411,10 +3399,10 @@ |
3412 | 3400 | * @param $groups Array of Strings List of internal group names |
3413 | 3401 | * @return Array of Strings List of permission key names for given groups combined |
3414 | 3402 | */ |
3415 | | - static function getGroupPermissions( $groups, $ns = null ) { |
| 3403 | + public static function getGroupPermissions( $groups, $ns = null ) { |
3416 | 3404 | global $wgGroupPermissions, $wgRevokePermissions; |
3417 | 3405 | $rights = array(); |
3418 | | - |
| 3406 | + |
3419 | 3407 | // Grant every granted permission first |
3420 | 3408 | foreach( $groups as $group ) { |
3421 | 3409 | if( isset( $wgGroupPermissions[$group] ) ) { |
— | — | @@ -3422,17 +3410,17 @@ |
3423 | 3411 | $wgGroupPermissions[$group], $ns ) ); |
3424 | 3412 | } |
3425 | 3413 | } |
3426 | | - |
| 3414 | + |
3427 | 3415 | // Revoke the revoked permissions |
3428 | 3416 | foreach( $groups as $group ) { |
3429 | 3417 | if( isset( $wgRevokePermissions[$group] ) ) { |
3430 | | - $rights = array_diff( $rights, self::extractRights( |
| 3418 | + $rights = array_diff( $rights, self::extractRights( |
3431 | 3419 | $wgRevokePermissions[$group], $ns ) ); |
3432 | 3420 | } |
3433 | 3421 | } |
3434 | 3422 | return array_unique( $rights ); |
3435 | 3423 | } |
3436 | | - |
| 3424 | + |
3437 | 3425 | /** |
3438 | 3426 | * Helper for User::getGroupPermissions |
3439 | 3427 | * @param array $list |
— | — | @@ -3454,7 +3442,7 @@ |
3455 | 3443 | } |
3456 | 3444 | } |
3457 | 3445 | } |
3458 | | - return $rights; |
| 3446 | + return $rights; |
3459 | 3447 | } |
3460 | 3448 | |
3461 | 3449 | /** |
— | — | @@ -3463,7 +3451,7 @@ |
3464 | 3452 | * @param $role String Role to check |
3465 | 3453 | * @return Array of Strings List of internal group names with the given permission |
3466 | 3454 | */ |
3467 | | - static function getGroupsWithPermission( $role, $ns = null ) { |
| 3455 | + public static function getGroupsWithPermission( $role, $ns = null ) { |
3468 | 3456 | global $wgGroupPermissions; |
3469 | 3457 | $allowedGroups = array(); |
3470 | 3458 | foreach ( $wgGroupPermissions as $group => $rights ) { |
— | — | @@ -3480,7 +3468,7 @@ |
3481 | 3469 | * @param $group String Internal group name |
3482 | 3470 | * @return String Localized descriptive group name |
3483 | 3471 | */ |
3484 | | - static function getGroupName( $group ) { |
| 3472 | + public static function getGroupName( $group ) { |
3485 | 3473 | $msg = wfMessage( "group-$group" ); |
3486 | 3474 | return $msg->isBlank() ? $group : $msg->text(); |
3487 | 3475 | } |
— | — | @@ -3491,7 +3479,7 @@ |
3492 | 3480 | * @param $group String Internal group name |
3493 | 3481 | * @return String Localized name for group member |
3494 | 3482 | */ |
3495 | | - static function getGroupMember( $group ) { |
| 3483 | + public static function getGroupMember( $group ) { |
3496 | 3484 | $msg = wfMessage( "group-$group-member" ); |
3497 | 3485 | return $msg->isBlank() ? $group : $msg->text(); |
3498 | 3486 | } |
— | — | @@ -3502,7 +3490,7 @@ |
3503 | 3491 | * are not included, as they are defined automatically, not in the database. |
3504 | 3492 | * @return Array of internal group names |
3505 | 3493 | */ |
3506 | | - static function getAllGroups() { |
| 3494 | + public static function getAllGroups() { |
3507 | 3495 | global $wgGroupPermissions, $wgRevokePermissions; |
3508 | 3496 | return array_diff( |
3509 | 3497 | array_merge( array_keys( $wgGroupPermissions ), array_keys( $wgRevokePermissions ) ), |
— | — | @@ -3514,7 +3502,7 @@ |
3515 | 3503 | * Get a list of all available permissions. |
3516 | 3504 | * @return Array of permission names |
3517 | 3505 | */ |
3518 | | - static function getAllRights() { |
| 3506 | + public static function getAllRights() { |
3519 | 3507 | if ( self::$mAllRights === false ) { |
3520 | 3508 | global $wgAvailableRights; |
3521 | 3509 | if ( count( $wgAvailableRights ) ) { |
— | — | @@ -3544,7 +3532,7 @@ |
3545 | 3533 | * @param $group String Internal group name |
3546 | 3534 | * @return Title|Bool Title of the page if it exists, false otherwise |
3547 | 3535 | */ |
3548 | | - static function getGroupPage( $group ) { |
| 3536 | + public static function getGroupPage( $group ) { |
3549 | 3537 | $msg = wfMessage( 'grouppage-' . $group )->inContentLanguage(); |
3550 | 3538 | if( $msg->exists() ) { |
3551 | 3539 | $title = Title::newFromText( $msg->text() ); |
— | — | @@ -3562,7 +3550,7 @@ |
3563 | 3551 | * @param $text String The text of the link |
3564 | 3552 | * @return String HTML link to the group |
3565 | 3553 | */ |
3566 | | - static function makeGroupLinkHTML( $group, $text = '' ) { |
| 3554 | + public static function makeGroupLinkHTML( $group, $text = '' ) { |
3567 | 3555 | if( $text == '' ) { |
3568 | 3556 | $text = self::getGroupName( $group ); |
3569 | 3557 | } |
— | — | @@ -3582,7 +3570,7 @@ |
3583 | 3571 | * @param $text String The text of the link |
3584 | 3572 | * @return String Wikilink to the group |
3585 | 3573 | */ |
3586 | | - static function makeGroupLinkWiki( $group, $text = '' ) { |
| 3574 | + public static function makeGroupLinkWiki( $group, $text = '' ) { |
3587 | 3575 | if( $text == '' ) { |
3588 | 3576 | $text = self::getGroupName( $group ); |
3589 | 3577 | } |
— | — | @@ -3604,7 +3592,7 @@ |
3605 | 3593 | * 'add-self' => array( addablegroups to self), |
3606 | 3594 | * 'remove-self' => array( removable groups from self) ) |
3607 | 3595 | */ |
3608 | | - static function changeableByGroup( $group ) { |
| 3596 | + public static function changeableByGroup( $group ) { |
3609 | 3597 | global $wgAddGroups, $wgRemoveGroups, $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf; |
3610 | 3598 | |
3611 | 3599 | $groups = array( 'add' => array(), 'remove' => array(), 'add-self' => array(), 'remove-self' => array() ); |
— | — | @@ -3668,7 +3656,7 @@ |
3669 | 3657 | * 'add-self' => array( addablegroups to self), |
3670 | 3658 | * 'remove-self' => array( removable groups from self) ) |
3671 | 3659 | */ |
3672 | | - function changeableGroups() { |
| 3660 | + public function changeableGroups() { |
3673 | 3661 | if( $this->isAllowed( 'userrights' ) ) { |
3674 | 3662 | // This group gives the right to modify everything (reverse- |
3675 | 3663 | // compatibility with old "userrights lets you change |
— | — | @@ -3708,7 +3696,7 @@ |
3709 | 3697 | * Increment the user's edit-count field. |
3710 | 3698 | * Will have no effect for anonymous users. |
3711 | 3699 | */ |
3712 | | - function incEditCount() { |
| 3700 | + public function incEditCount() { |
3713 | 3701 | if( !$this->isAnon() ) { |
3714 | 3702 | $dbw = wfGetDB( DB_MASTER ); |
3715 | 3703 | $dbw->update( 'user', |
— | — | @@ -3754,7 +3742,7 @@ |
3755 | 3743 | * @param $right String Right to query |
3756 | 3744 | * @return String Localized description of the right |
3757 | 3745 | */ |
3758 | | - static function getRightDescription( $right ) { |
| 3746 | + public static function getRightDescription( $right ) { |
3759 | 3747 | $key = "right-$right"; |
3760 | 3748 | $msg = wfMessage( $key ); |
3761 | 3749 | return $msg->isBlank() ? $right : $msg->text(); |
— | — | @@ -3767,7 +3755,7 @@ |
3768 | 3756 | * @param $userId String User ID |
3769 | 3757 | * @return String Password hash |
3770 | 3758 | */ |
3771 | | - static function oldCrypt( $password, $userId ) { |
| 3759 | + public static function oldCrypt( $password, $userId ) { |
3772 | 3760 | global $wgPasswordSalt; |
3773 | 3761 | if ( $wgPasswordSalt ) { |
3774 | 3762 | return md5( $userId . '-' . md5( $password ) ); |
— | — | @@ -3784,7 +3772,7 @@ |
3785 | 3773 | * If unspecified or false, will generate one automatically |
3786 | 3774 | * @return String Password hash |
3787 | 3775 | */ |
3788 | | - static function crypt( $password, $salt = false ) { |
| 3776 | + public static function crypt( $password, $salt = false ) { |
3789 | 3777 | global $wgPasswordSalt; |
3790 | 3778 | |
3791 | 3779 | $hash = ''; |
— | — | @@ -3811,7 +3799,7 @@ |
3812 | 3800 | * @param $userId String User ID for old-style password salt |
3813 | 3801 | * @return Boolean: |
3814 | 3802 | */ |
3815 | | - static function comparePasswords( $hash, $password, $userId = false ) { |
| 3803 | + public static function comparePasswords( $hash, $password, $userId = false ) { |
3816 | 3804 | $type = substr( $hash, 0, 3 ); |
3817 | 3805 | |
3818 | 3806 | $result = false; |