Commit graph

83 commits

Author SHA1 Message Date
Happy-melon
99f39a4779 Move Block::normaliseRange() to IP.php, then reduce it to 4 lines by using the existing functionality in that class. 2011-03-18 23:28:23 +00:00
Aaron Schulz
7fe32a2fa2 Follow-up r82093: fixed comment :) 2011-02-13 23:30:26 +00:00
Aaron Schulz
f65ce02ff9 * (bug 27353) IPv6 address ending in "::WORD" was not recognized
* Moved down 'contains no "::"' alternative for clarity (and possibly use frequency too)
* Added more IPv6 tests
2011-02-13 23:24:48 +00:00
Mark A. Hershberger
a465346c6e random w/s cleanup 2010-12-01 20:22:45 +00:00
Aaron Schulz
fb574da0ab *(bug 25920) Moved forward ref to a back ref to really get v6 regex to compile on older PCRE versions. Works around PCRE 8 nested named ref bug that killed r76928.
* Added another simple v6 assertion
2010-11-21 10:49:54 +00:00
Sam Reed
9a301f1636 Reverting r76928, causes segfault 2010-11-18 02:32:58 +00:00
Aaron Schulz
d0977b26a3 (bug 25920) Moved forward ref to a nested ref to really get v6 regex to compile on older PCRE versions 2010-11-18 00:25:58 +00:00
Aaron Schulz
52a79f37a1 * Reduced some pointless regex capture overhead
* Made preg_replace calls easier to verify w.r.t. captures
* (bug 25920) Made RE_IPV6_ADD avoid conditions on whether a named group matched anything, which requires PCRE 6.7+ (not bundled with PHP 5.1.0)
2010-11-17 09:12:18 +00:00
Alexandre Emsenhuber
386b748ca2 Fixed some doxygen warnings 2010-11-16 20:14:13 +00:00
Aaron Schulz
a34cccd8b1 Removed weird unused "IPv4toIPv6" function 2010-11-15 23:20:23 +00:00
Aaron Schulz
d7f0e354dd typo: RE_IPV4_BLOCK -> RE_IP_BLOCK 2010-11-15 20:37:11 +00:00
Aaron Schulz
3994a3b2e3 Minor cleanups 2010-11-13 23:31:13 +00:00
Aaron Schulz
21e317191b * parseCIDR() should use parseCIDR6() for IPv6 (plus the later is private since r76560...)
* Made parseRange() work for IPv6 "x - y" style ranges
* Added MWException to IPv4toIPv6()
2010-11-12 20:08:27 +00:00
Aaron Schulz
426f30bcfe * Removed redundant check in toUnsigned6().
* MW requires PHP 5.1+, so the -1/false ip2long annoyance is gone. Also, ip2long("255.255.255.255") is -1 so no special case code is needed anymore.
* Removed toSigned() (not used outside IP.php). Due to the above points, ip2long() is totally equilivant.
* Moved some functions and consts around.
* Comment tweaks.
2010-11-12 19:37:37 +00:00
Aaron Schulz
ff84f68f6a * Changes in IP.php:
** Fixed hexToOctet()/toOctet() padding (pad left not right)
** Made hexToQuad() left-pad input (e.g. C -> 0000000C)
** Added isPublic6() function (checked as needed by isPublic())
** Rewrote isValidBlock() to not do flaky and roundabout isArray() check. Works for v6 now.
** Removed toArray(), unused outside IP.php and broken for v6
** Removed toOctet() duplication
** Added new private IPv6ToRawHex() function. Used to make toHex() faster.
** Made some functions private
** Reverted r20435, pointless
** Updated credits
* Changes in IPTests:
** Added a bunch of tests (mostly v6)
** Removed weird array test (especially with toArray() gone) after r76514
** Padding *no* longer needed for hexToX functions - assertion flipped
* CheckUser: removed parseRange6() reference (now private)
2010-11-12 01:33:46 +00:00
Aaron Schulz
1a058cafed * Return type cleanup (int -> bool)
* Improved doc comments
2010-11-11 13:45:24 +00:00
Aaron Schulz
cd9108e37f * Followed-up r76267:
** Made RE_IPV6_ADD and sanitizeIP() hande '::'.
** RE_IPV6_ADD is no longer over-inclusive (# of octets and '::' must be valid)
* Removed weird debugging code
* Broke long line
2010-11-11 12:18:28 +00:00
Aaron Schulz
8090e523a2 Made sanitizeIP() handle CIDR IPs in IPv6 (fixes server-side stuff for bug 24293) 2010-11-07 21:53:26 +00:00
Aaron Schulz
521d3c4676 * Fixed RE_IPV6_ADD for IP networks ending in "::", like "abcd::/y" or "a::/y"
* Fixed formatHex() for IPv6 by handling prefix properly
* hextoOctet -> hexToOctet
* Assorted code cleanups (mostly with $bits/$network)
* Improved various code comments/docs
2010-11-07 20:31:48 +00:00
Alexandre Emsenhuber
85e0c158ee * Standardised file description headers
* added @file where needed
* added file description headers where needed
2010-10-23 14:16:26 +00:00
Antoine Musso
9e3b90a94d update my personal email address altern.org -> free.fr 2010-09-26 15:52:51 +00:00
Jack Phoenix
92ef4ae4e8 coding style tweaks 2010-08-08 16:57:31 +00:00
Alexandre Emsenhuber
5be509b0c1 * Standardised file description headers
* Added some descriptions
* Added @file where needed
2010-08-08 14:23:14 +00:00
Alexandre Emsenhuber
ef9787a85f * Fixed some doxygen warnings
* Removed some useless spaces in the begining of lines
2010-03-09 21:51:05 +00:00
OverlordQ
a989843cd0 Code cleanup, covert leading spaces into tabs per coding style 2009-11-14 21:27:13 +00:00
Aaron Schulz
2e89016676 Take the IPv4 part of mapped addresses rather than broken '.'->':' replace 2009-08-08 01:22:15 +00:00
Aaron Schulz
418e7767b4 IPv6 padding cleanup - removed trailing ':' 2009-07-27 07:03:36 +00:00
Aaron Schulz
c0a1b76624 * IPv6 validation check fix for bug 19003
* Made regexps a bit more readable by breaking lines
2009-07-27 06:08:41 +00:00
Roan Kattouw
d99df49ed7 Fixes for r51236 per CR comments 2009-05-31 15:02:43 +00:00
Roan Kattouw
e7f76a6e77 Fix weird bug that caused IP::isInRange("80.0.0.0", "94.0.0.0/24") to return true because "52000000" >= "5E000000" (52000000 >= 5). Thanks, PHP. 2009-05-31 14:52:16 +00:00
Tim Starling
c954755878 Changes required by the current version of SecurePoll:
* Add IP::formatHex(), the inverse of IP::toHex(). So that you don't have to guess if it's IPv4 or IPv6.
* Rewrite IP::hexToQuad() so it actually works.
2009-04-01 08:54:17 +00:00
Aaron Schulz
3337669b0c * Fix comment
* Rename HexToIP -> HexToQuad
2008-11-02 18:35:58 +00:00
Aryeh Gregor
565fe1cac3 Use MediaWiki whitespace standards, please.
This file is really a mess, though.  We need a unified system of
functions that will autodetect any IP address format and convert to any
desired format, not this hodgepodge of inconsistently-named and
inconsistently-operating hacks.
2008-11-02 17:17:19 +00:00
Roan Kattouw
db6d1ed1dc API: Move ApiQueryBlocks::convertHexIP() to IP::hexToIP() per Werdna's comment on r43040 2008-11-02 16:50:59 +00:00
Siebrand Mazeland
798f535951 * Fix common spelling error (seperate -> separate) 2008-09-15 20:38:27 +00:00
Aaron Schulz
bf388f2ee3 remove extra parenthesis 2008-08-24 22:50:12 +00:00
Aaron Schulz
67430027dc update comment 2008-08-13 23:34:56 +00:00
Aaron Schulz
6e15e8506e add HexToOct() 2008-08-13 16:51:37 +00:00
Brion Vibber
a31753e542 * (bug 15049) Fix for CheckUser extension's log search: usernames containing
a "-" were incorrectly turned into bogus IP range searches.
  Patch by Max Semenik.
2008-08-06 20:54:27 +00:00
Siebrand Mazeland
79d5225c0e * remove end of line whitespace
* remove empty lines at end of file
* remove "?>" where still present
2008-04-14 07:45:50 +00:00
Aaron Schulz
71b3ec988e *Convert '.' to ':' for IPs that have both (like '::eff:1.4.0.3')
*Expand IP dbkeys like "::fff:3e" rather than complain about the double colons
2007-09-03 16:36:25 +00:00
Brion Vibber
977977e314 * Fixed regression in blocking of username '0'
IP::sanitizeIP() for some reason is used to return IP-or-something-that's-not-an-IP, but was incorrectly checking for empties. Thus for '0' input it returned NULL instead of '0'.
2007-08-03 08:51:55 +00:00
Aryeh Gregor
a15c419b3d Remove ?>'s from files. They're pointless, and just asking for people to mess with the files and add trailing whitespace. (Yes, I looked over every one and reverted those that were bogus. Slash-enter a million times in less worked well enough, although it was a bit mind-numbing.) 2007-06-29 01:19:14 +00:00
Brion Vibber
d5a8cc2dd1 * (bug 10247) Fix IP address regex to avoid false positive IPv6 matches
Regex fragment IP_ADDRESS_STRING was not parenthesized properly, causing the preg_match in IP::isIPAddress() to get false positives on strings which _ended_ in IPv6 subsequences.
2007-06-13 19:47:44 +00:00
Tim Starling
f79522aa34 debugging 2007-04-25 07:40:00 +00:00
Nick Jenkins
9648f3b4d0 Some small doc tweaks to reduce Doxygen warnings, namely:
* @link. You might think @link would surely mean "here comes a web URL" ... but @link is a valid command 
  in Doxygen, which means an entirely different kind of link (an internal link to somewhere, so that you can separate 
  documentation and implementation). The result is a mess, and the best solution I can see is to use "@see" instead of "@link".
* Warning: argument `nourl' of command @param is not found in the argument list of Linker::makeMediaLinkObj($title,$text='')
* Moving few class descriptions to right above classes, and/or formatting into Javadoc style.
* "@addtogroup Special Pages" --> "@addtogroup SpecialPage" so that all special pages have the same @addtogroup tag.
* @fixme --> @todo (must have missed these before)
* "@param $specialPage @see" remove the "@" in the "@see" to stop warning.
* @throws wants type, then a brief description, to stop warning.

This last one is for PHPdocumentor only, but it fixes something for PHPDocumentor, and should be neutral for Doxygen:
* WARNING in includes/api/ApiFormatYaml_spyc.php on line 860: docblock template never terminated with /**#@-*/
2007-04-18 09:50:10 +00:00
Aaron Schulz
7a1682f7a5 *fix ipv6 prefix consistency 2007-04-08 01:41:41 +00:00
Nick Jenkins
113bb1c772 Documentation tweaks to help documentation systems (Doxygen + PHPDocumentor)
pick up the appropriate tags, and documentation blobs for classes. This is 
the same as per r20769, but with the grouping changes (e.g. removing "@{{") omitted.
Please be advised that more related documentation tweaks may follow later - e.g. 
Doxygen generates a log file of warnings that is 574 Kb in size, when run over 
the just the trunk/phase3 code ... eek! Thankfully, much of that is just 
whining about functions without documentation   ;-)
2007-04-04 05:22:37 +00:00
Aaron Schulz
fa85cc3420 *comment typo 2007-04-04 05:19:33 +00:00
Brion Vibber
3a6ac5a3c3 Revert r20769: we don't use PHPDocumentor anymore, we use doxygen.
If making mass changes to tweak to its preferences, probably better to do it for the tool we actually generate docs with. :)
2007-03-28 14:16:43 +00:00