@@ -12,80 +12,80 @@ |
||
| 12 | 12 | |
| 13 | 13 | class Token |
| 14 | 14 | { |
| 15 | - /** @var string */ |
|
| 16 | - private $tokenData; |
|
| 17 | - /** @var string */ |
|
| 18 | - private $context; |
|
| 19 | - /** @var DateTimeImmutable */ |
|
| 20 | - private $generationTimestamp; |
|
| 21 | - /** @var DateTimeImmutable */ |
|
| 22 | - private $usageTimestamp; |
|
| 23 | - /** @var bool */ |
|
| 24 | - private $used; |
|
| 15 | + /** @var string */ |
|
| 16 | + private $tokenData; |
|
| 17 | + /** @var string */ |
|
| 18 | + private $context; |
|
| 19 | + /** @var DateTimeImmutable */ |
|
| 20 | + private $generationTimestamp; |
|
| 21 | + /** @var DateTimeImmutable */ |
|
| 22 | + private $usageTimestamp; |
|
| 23 | + /** @var bool */ |
|
| 24 | + private $used; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Token constructor. |
|
| 28 | - * |
|
| 29 | - * @param string $tokenData |
|
| 30 | - * @param string $context |
|
| 31 | - */ |
|
| 32 | - public function __construct($tokenData, $context) |
|
| 33 | - { |
|
| 34 | - $this->tokenData = $tokenData; |
|
| 35 | - $this->context = $context; |
|
| 36 | - $this->generationTimestamp = new DateTimeImmutable(); |
|
| 37 | - $this->usageTimestamp = null; |
|
| 38 | - $this->used = false; |
|
| 39 | - } |
|
| 26 | + /** |
|
| 27 | + * Token constructor. |
|
| 28 | + * |
|
| 29 | + * @param string $tokenData |
|
| 30 | + * @param string $context |
|
| 31 | + */ |
|
| 32 | + public function __construct($tokenData, $context) |
|
| 33 | + { |
|
| 34 | + $this->tokenData = $tokenData; |
|
| 35 | + $this->context = $context; |
|
| 36 | + $this->generationTimestamp = new DateTimeImmutable(); |
|
| 37 | + $this->usageTimestamp = null; |
|
| 38 | + $this->used = false; |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @return DateTimeImmutable |
|
| 43 | - */ |
|
| 44 | - public function getGenerationTimestamp() |
|
| 45 | - { |
|
| 46 | - return $this->generationTimestamp; |
|
| 47 | - } |
|
| 41 | + /** |
|
| 42 | + * @return DateTimeImmutable |
|
| 43 | + */ |
|
| 44 | + public function getGenerationTimestamp() |
|
| 45 | + { |
|
| 46 | + return $this->generationTimestamp; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @return string |
|
| 51 | - */ |
|
| 52 | - public function getContext() |
|
| 53 | - { |
|
| 54 | - return $this->context; |
|
| 55 | - } |
|
| 49 | + /** |
|
| 50 | + * @return string |
|
| 51 | + */ |
|
| 52 | + public function getContext() |
|
| 53 | + { |
|
| 54 | + return $this->context; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * @return string |
|
| 59 | - */ |
|
| 60 | - public function getTokenData() |
|
| 61 | - { |
|
| 62 | - return $this->tokenData; |
|
| 63 | - } |
|
| 57 | + /** |
|
| 58 | + * @return string |
|
| 59 | + */ |
|
| 60 | + public function getTokenData() |
|
| 61 | + { |
|
| 62 | + return $this->tokenData; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * Returns a value indicating whether the token has already been used or not |
|
| 67 | - * |
|
| 68 | - * @return boolean |
|
| 69 | - */ |
|
| 70 | - public function isUsed() |
|
| 71 | - { |
|
| 72 | - return $this->used; |
|
| 73 | - } |
|
| 65 | + /** |
|
| 66 | + * Returns a value indicating whether the token has already been used or not |
|
| 67 | + * |
|
| 68 | + * @return boolean |
|
| 69 | + */ |
|
| 70 | + public function isUsed() |
|
| 71 | + { |
|
| 72 | + return $this->used; |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * Marks the token as used |
|
| 77 | - */ |
|
| 78 | - public function markAsUsed() |
|
| 79 | - { |
|
| 80 | - $this->used = true; |
|
| 81 | - $this->usageTimestamp = new DateTimeImmutable(); |
|
| 82 | - } |
|
| 75 | + /** |
|
| 76 | + * Marks the token as used |
|
| 77 | + */ |
|
| 78 | + public function markAsUsed() |
|
| 79 | + { |
|
| 80 | + $this->used = true; |
|
| 81 | + $this->usageTimestamp = new DateTimeImmutable(); |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * @return DateTimeImmutable |
|
| 86 | - */ |
|
| 87 | - public function getUsageTimestamp() |
|
| 88 | - { |
|
| 89 | - return $this->usageTimestamp; |
|
| 90 | - } |
|
| 84 | + /** |
|
| 85 | + * @return DateTimeImmutable |
|
| 86 | + */ |
|
| 87 | + public function getUsageTimestamp() |
|
| 88 | + { |
|
| 89 | + return $this->usageTimestamp; |
|
| 90 | + } |
|
| 91 | 91 | } |
| 92 | 92 | \ No newline at end of file |
@@ -13,91 +13,91 @@ |
||
| 13 | 13 | |
| 14 | 14 | class TokenManager |
| 15 | 15 | { |
| 16 | - /** |
|
| 17 | - * Validates a CSRF token |
|
| 18 | - * |
|
| 19 | - * @param string $data The token data string itself |
|
| 20 | - * @param string|null $context Token context for extra validation |
|
| 21 | - * |
|
| 22 | - * @return bool |
|
| 23 | - */ |
|
| 24 | - public function validateToken($data, $context = null) |
|
| 25 | - { |
|
| 26 | - if (!is_string($data) || strlen($data) === 0) { |
|
| 27 | - // Nothing to validate |
|
| 28 | - return false; |
|
| 29 | - } |
|
| 30 | - |
|
| 31 | - $tokens = WebRequest::getSessionTokenData(); |
|
| 32 | - |
|
| 33 | - // if the token doesn't exist, then it's not valid |
|
| 34 | - if (!array_key_exists($data, $tokens)) { |
|
| 35 | - return false; |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - /** @var Token $token */ |
|
| 39 | - $token = unserialize($tokens[$data]); |
|
| 40 | - |
|
| 41 | - if ($token->getTokenData() !== $data) { |
|
| 42 | - return false; |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - if ($token->getContext() !== $context) { |
|
| 46 | - return false; |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - if ($token->isUsed()) { |
|
| 50 | - return false; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - // mark the token as used, and save it back to the session |
|
| 54 | - $token->markAsUsed(); |
|
| 55 | - $this->storeToken($token); |
|
| 56 | - |
|
| 57 | - return true; |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * @param string|null $context An optional context for extra validation |
|
| 62 | - * |
|
| 63 | - * @return Token |
|
| 64 | - */ |
|
| 65 | - public function getNewToken($context = null) |
|
| 66 | - { |
|
| 67 | - $token = new Token($this->generateTokenData(), $context); |
|
| 68 | - $this->storeToken($token); |
|
| 69 | - |
|
| 70 | - return $token; |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * Stores a token in the session data |
|
| 75 | - * |
|
| 76 | - * @param Token $token |
|
| 77 | - */ |
|
| 78 | - private function storeToken(Token $token) |
|
| 79 | - { |
|
| 80 | - $tokens = WebRequest::getSessionTokenData(); |
|
| 81 | - $tokens[$token->getTokenData()] = serialize($token); |
|
| 82 | - WebRequest::setSessionTokenData($tokens); |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * Generates a security token |
|
| 87 | - * |
|
| 88 | - * @return string |
|
| 89 | - * @throws Exception |
|
| 90 | - * |
|
| 91 | - * @category Security-Critical |
|
| 92 | - */ |
|
| 93 | - private function generateTokenData() |
|
| 94 | - { |
|
| 95 | - $genBytes = openssl_random_pseudo_bytes(33); |
|
| 96 | - |
|
| 97 | - if ($genBytes !== false) { |
|
| 98 | - return base64_encode($genBytes); |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - throw new Exception('Unable to generate secure token.'); |
|
| 102 | - } |
|
| 16 | + /** |
|
| 17 | + * Validates a CSRF token |
|
| 18 | + * |
|
| 19 | + * @param string $data The token data string itself |
|
| 20 | + * @param string|null $context Token context for extra validation |
|
| 21 | + * |
|
| 22 | + * @return bool |
|
| 23 | + */ |
|
| 24 | + public function validateToken($data, $context = null) |
|
| 25 | + { |
|
| 26 | + if (!is_string($data) || strlen($data) === 0) { |
|
| 27 | + // Nothing to validate |
|
| 28 | + return false; |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + $tokens = WebRequest::getSessionTokenData(); |
|
| 32 | + |
|
| 33 | + // if the token doesn't exist, then it's not valid |
|
| 34 | + if (!array_key_exists($data, $tokens)) { |
|
| 35 | + return false; |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + /** @var Token $token */ |
|
| 39 | + $token = unserialize($tokens[$data]); |
|
| 40 | + |
|
| 41 | + if ($token->getTokenData() !== $data) { |
|
| 42 | + return false; |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + if ($token->getContext() !== $context) { |
|
| 46 | + return false; |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + if ($token->isUsed()) { |
|
| 50 | + return false; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + // mark the token as used, and save it back to the session |
|
| 54 | + $token->markAsUsed(); |
|
| 55 | + $this->storeToken($token); |
|
| 56 | + |
|
| 57 | + return true; |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * @param string|null $context An optional context for extra validation |
|
| 62 | + * |
|
| 63 | + * @return Token |
|
| 64 | + */ |
|
| 65 | + public function getNewToken($context = null) |
|
| 66 | + { |
|
| 67 | + $token = new Token($this->generateTokenData(), $context); |
|
| 68 | + $this->storeToken($token); |
|
| 69 | + |
|
| 70 | + return $token; |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * Stores a token in the session data |
|
| 75 | + * |
|
| 76 | + * @param Token $token |
|
| 77 | + */ |
|
| 78 | + private function storeToken(Token $token) |
|
| 79 | + { |
|
| 80 | + $tokens = WebRequest::getSessionTokenData(); |
|
| 81 | + $tokens[$token->getTokenData()] = serialize($token); |
|
| 82 | + WebRequest::setSessionTokenData($tokens); |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * Generates a security token |
|
| 87 | + * |
|
| 88 | + * @return string |
|
| 89 | + * @throws Exception |
|
| 90 | + * |
|
| 91 | + * @category Security-Critical |
|
| 92 | + */ |
|
| 93 | + private function generateTokenData() |
|
| 94 | + { |
|
| 95 | + $genBytes = openssl_random_pseudo_bytes(33); |
|
| 96 | + |
|
| 97 | + if ($genBytes !== false) { |
|
| 98 | + return base64_encode($genBytes); |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + throw new Exception('Unable to generate secure token.'); |
|
| 102 | + } |
|
| 103 | 103 | } |
| 104 | 104 | \ No newline at end of file |
@@ -48,8 +48,7 @@ |
||
| 48 | 48 | |
| 49 | 49 | if ($username !== null) { |
| 50 | 50 | $user = User::getByUsername($username, $this->getDatabase()); |
| 51 | - } |
|
| 52 | - else { |
|
| 51 | + } else { |
|
| 53 | 52 | $user = User::getByOnWikiUsername($wikiusername, $this->getDatabase()); |
| 54 | 53 | } |
| 55 | 54 | |
@@ -23,53 +23,53 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | class StatsAction extends XmlApiPageBase implements IXmlApiAction |
| 25 | 25 | { |
| 26 | - /** |
|
| 27 | - * Summary of execute |
|
| 28 | - * |
|
| 29 | - * @param DOMElement $apiDocument |
|
| 30 | - * |
|
| 31 | - * @return DOMElement |
|
| 32 | - * @throws ApiException |
|
| 33 | - * @throws Exception |
|
| 34 | - */ |
|
| 35 | - public function executeApiAction(DOMElement $apiDocument) |
|
| 36 | - { |
|
| 37 | - $username = WebRequest::getString('user'); |
|
| 38 | - $wikiusername = WebRequest::getString('wikiuser'); |
|
| 26 | + /** |
|
| 27 | + * Summary of execute |
|
| 28 | + * |
|
| 29 | + * @param DOMElement $apiDocument |
|
| 30 | + * |
|
| 31 | + * @return DOMElement |
|
| 32 | + * @throws ApiException |
|
| 33 | + * @throws Exception |
|
| 34 | + */ |
|
| 35 | + public function executeApiAction(DOMElement $apiDocument) |
|
| 36 | + { |
|
| 37 | + $username = WebRequest::getString('user'); |
|
| 38 | + $wikiusername = WebRequest::getString('wikiuser'); |
|
| 39 | 39 | |
| 40 | - if ($username === null && $wikiusername === null) { |
|
| 41 | - throw new ApiException("Please specify a username using either user or wikiuser parameters."); |
|
| 42 | - } |
|
| 40 | + if ($username === null && $wikiusername === null) { |
|
| 41 | + throw new ApiException("Please specify a username using either user or wikiuser parameters."); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - $userElement = $this->document->createElement("user"); |
|
| 45 | - $apiDocument->appendChild($userElement); |
|
| 44 | + $userElement = $this->document->createElement("user"); |
|
| 45 | + $apiDocument->appendChild($userElement); |
|
| 46 | 46 | |
| 47 | - if ($username !== null) { |
|
| 48 | - $user = User::getByUsername($username, $this->getDatabase()); |
|
| 49 | - } |
|
| 50 | - else { |
|
| 51 | - $user = User::getByOnWikiUsername($wikiusername, $this->getDatabase()); |
|
| 52 | - } |
|
| 47 | + if ($username !== null) { |
|
| 48 | + $user = User::getByUsername($username, $this->getDatabase()); |
|
| 49 | + } |
|
| 50 | + else { |
|
| 51 | + $user = User::getByOnWikiUsername($wikiusername, $this->getDatabase()); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - if ($user === false) { |
|
| 55 | - $userElement->setAttribute("missing", "true"); |
|
| 54 | + if ($user === false) { |
|
| 55 | + $userElement->setAttribute("missing", "true"); |
|
| 56 | 56 | |
| 57 | - return $apiDocument; |
|
| 58 | - } |
|
| 57 | + return $apiDocument; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - $oauth = new OAuthUserHelper($user, $this->getDatabase(), $this->getOAuthProtocolHelper(), |
|
| 61 | - $this->getSiteConfiguration()); |
|
| 60 | + $oauth = new OAuthUserHelper($user, $this->getDatabase(), $this->getOAuthProtocolHelper(), |
|
| 61 | + $this->getSiteConfiguration()); |
|
| 62 | 62 | |
| 63 | - // FIXME: domains |
|
| 64 | - $prefs = new PreferenceManager($this->getDatabase(), $user->getId(), 1); |
|
| 63 | + // FIXME: domains |
|
| 64 | + $prefs = new PreferenceManager($this->getDatabase(), $user->getId(), 1); |
|
| 65 | 65 | |
| 66 | - $userElement->setAttribute("username", $user->getUsername()); |
|
| 67 | - $userElement->setAttribute("status", $user->getStatus()); |
|
| 68 | - $userElement->setAttribute("lastactive", $user->getLastActive()); |
|
| 69 | - $userElement->setAttribute("welcome_template", $prefs->getPreference(PreferenceManager::PREF_WELCOMETEMPLATE)); |
|
| 70 | - $userElement->setAttribute("onwikiname", $user->getOnWikiName()); |
|
| 71 | - $userElement->setAttribute("oauth", $oauth->isFullyLinked() ? "true" : "false"); |
|
| 66 | + $userElement->setAttribute("username", $user->getUsername()); |
|
| 67 | + $userElement->setAttribute("status", $user->getStatus()); |
|
| 68 | + $userElement->setAttribute("lastactive", $user->getLastActive()); |
|
| 69 | + $userElement->setAttribute("welcome_template", $prefs->getPreference(PreferenceManager::PREF_WELCOMETEMPLATE)); |
|
| 70 | + $userElement->setAttribute("onwikiname", $user->getOnWikiName()); |
|
| 71 | + $userElement->setAttribute("oauth", $oauth->isFullyLinked() ? "true" : "false"); |
|
| 72 | 72 | |
| 73 | - return $apiDocument; |
|
| 74 | - } |
|
| 73 | + return $apiDocument; |
|
| 74 | + } |
|
| 75 | 75 | } |
@@ -15,11 +15,11 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class ApiException extends Exception |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * @param string $message |
|
| 20 | - */ |
|
| 21 | - public function __construct($message) |
|
| 22 | - { |
|
| 23 | - $this->message = $message; |
|
| 24 | - } |
|
| 18 | + /** |
|
| 19 | + * @param string $message |
|
| 20 | + */ |
|
| 21 | + public function __construct($message) |
|
| 22 | + { |
|
| 23 | + $this->message = $message; |
|
| 24 | + } |
|
| 25 | 25 | } |
@@ -78,8 +78,7 @@ |
||
| 78 | 78 | { |
| 79 | 79 | if (ord($string) < 128) { |
| 80 | 80 | return ucfirst($string); |
| 81 | - } |
|
| 82 | - else { |
|
| 81 | + } else { |
|
| 83 | 82 | return mb_strtoupper(mb_substr($string, 0, 1)) . mb_substr($string, 1); |
| 84 | 83 | } |
| 85 | 84 | } |
@@ -10,20 +10,20 @@ |
||
| 10 | 10 | |
| 11 | 11 | class StringFunctions |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * Make a string's first character uppercase |
|
| 15 | - * |
|
| 16 | - * @param string $string |
|
| 17 | - * |
|
| 18 | - * @return string |
|
| 19 | - */ |
|
| 20 | - public function upperCaseFirst($string) |
|
| 21 | - { |
|
| 22 | - if (ord($string) < 128) { |
|
| 23 | - return ucfirst($string); |
|
| 24 | - } |
|
| 25 | - else { |
|
| 26 | - return mb_strtoupper(mb_substr($string, 0, 1)) . mb_substr($string, 1); |
|
| 27 | - } |
|
| 28 | - } |
|
| 13 | + /** |
|
| 14 | + * Make a string's first character uppercase |
|
| 15 | + * |
|
| 16 | + * @param string $string |
|
| 17 | + * |
|
| 18 | + * @return string |
|
| 19 | + */ |
|
| 20 | + public function upperCaseFirst($string) |
|
| 21 | + { |
|
| 22 | + if (ord($string) < 128) { |
|
| 23 | + return ucfirst($string); |
|
| 24 | + } |
|
| 25 | + else { |
|
| 26 | + return mb_strtoupper(mb_substr($string, 0, 1)) . mb_substr($string, 1); |
|
| 27 | + } |
|
| 28 | + } |
|
| 29 | 29 | } |
@@ -15,8 +15,8 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class FakeLocationProvider implements ILocationProvider |
| 17 | 17 | { |
| 18 | - public function getIpLocation($address) |
|
| 19 | - { |
|
| 20 | - return null; |
|
| 21 | - } |
|
| 18 | + public function getIpLocation($address) |
|
| 19 | + { |
|
| 20 | + return null; |
|
| 21 | + } |
|
| 22 | 22 | } |
@@ -13,10 +13,10 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | interface ILocationProvider |
| 15 | 15 | { |
| 16 | - /** |
|
| 17 | - * @param string $address IP address |
|
| 18 | - * |
|
| 19 | - * @return array |
|
| 20 | - */ |
|
| 21 | - public function getIpLocation($address); |
|
| 16 | + /** |
|
| 17 | + * @param string $address IP address |
|
| 18 | + * |
|
| 19 | + * @return array |
|
| 20 | + */ |
|
| 21 | + public function getIpLocation($address); |
|
| 22 | 22 | } |
@@ -19,41 +19,41 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | interface IXffTrustProvider |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * Returns a value if the IP address is a trusted proxy |
|
| 24 | - * |
|
| 25 | - * @param string $ip |
|
| 26 | - * |
|
| 27 | - * @return bool |
|
| 28 | - */ |
|
| 29 | - public function isTrusted($ip); |
|
| 22 | + /** |
|
| 23 | + * Returns a value if the IP address is a trusted proxy |
|
| 24 | + * |
|
| 25 | + * @param string $ip |
|
| 26 | + * |
|
| 27 | + * @return bool |
|
| 28 | + */ |
|
| 29 | + public function isTrusted($ip); |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Gets the last trusted IP in the proxy chain. |
|
| 33 | - * |
|
| 34 | - * @param string $ip The IP address from REMOTE_ADDR |
|
| 35 | - * @param string $proxyIp The contents of the XFF header. |
|
| 36 | - * |
|
| 37 | - * @return string Trusted source IP address |
|
| 38 | - */ |
|
| 39 | - public function getTrustedClientIp($ip, $proxyIp); |
|
| 31 | + /** |
|
| 32 | + * Gets the last trusted IP in the proxy chain. |
|
| 33 | + * |
|
| 34 | + * @param string $ip The IP address from REMOTE_ADDR |
|
| 35 | + * @param string $proxyIp The contents of the XFF header. |
|
| 36 | + * |
|
| 37 | + * @return string Trusted source IP address |
|
| 38 | + */ |
|
| 39 | + public function getTrustedClientIp($ip, $proxyIp); |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Takes an array( "low" => "high" ) values, and returns true if $needle is in at least one of them. |
|
| 43 | - * |
|
| 44 | - * @param array $haystack |
|
| 45 | - * @param string $ip |
|
| 46 | - * |
|
| 47 | - * @return bool |
|
| 48 | - */ |
|
| 49 | - public function ipInRange($haystack, $ip); |
|
| 41 | + /** |
|
| 42 | + * Takes an array( "low" => "high" ) values, and returns true if $needle is in at least one of them. |
|
| 43 | + * |
|
| 44 | + * @param array $haystack |
|
| 45 | + * @param string $ip |
|
| 46 | + * |
|
| 47 | + * @return bool |
|
| 48 | + */ |
|
| 49 | + public function ipInRange($haystack, $ip); |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Explodes a CIDR range into an array of addresses |
|
| 53 | - * |
|
| 54 | - * @param string $range A CIDR-format range |
|
| 55 | - * |
|
| 56 | - * @return array An array containing every IP address in the range |
|
| 57 | - */ |
|
| 58 | - public function explodeCidr($range); |
|
| 51 | + /** |
|
| 52 | + * Explodes a CIDR range into an array of addresses |
|
| 53 | + * |
|
| 54 | + * @param string $range A CIDR-format range |
|
| 55 | + * |
|
| 56 | + * @return array An array containing every IP address in the range |
|
| 57 | + */ |
|
| 58 | + public function explodeCidr($range); |
|
| 59 | 59 | } |
@@ -13,12 +13,12 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | interface IRDnsProvider |
| 15 | 15 | { |
| 16 | - /** |
|
| 17 | - * Gets the reverse DNS address for an IP |
|
| 18 | - * |
|
| 19 | - * @param string $address |
|
| 20 | - * |
|
| 21 | - * @return string |
|
| 22 | - */ |
|
| 23 | - public function getReverseDNS($address); |
|
| 16 | + /** |
|
| 17 | + * Gets the reverse DNS address for an IP |
|
| 18 | + * |
|
| 19 | + * @param string $address |
|
| 20 | + * |
|
| 21 | + * @return string |
|
| 22 | + */ |
|
| 23 | + public function getReverseDNS($address); |
|
| 24 | 24 | } |