@@ -12,21 +12,21 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | class TypeAheadHelper implements ITypeAheadHelper |
| 14 | 14 | { |
| 15 | - private $definedClasses = array(); |
|
| 15 | + private $definedClasses = array(); |
|
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * @param string $class CSS class to apply this typeahead to. |
|
| 19 | - * @param callable $generator Generator function taking no arguments to return an array of strings. |
|
| 20 | - */ |
|
| 21 | - public function defineTypeAheadSource($class, callable $generator) |
|
| 22 | - { |
|
| 23 | - $dataList = ''; |
|
| 24 | - foreach ($generator() as $dataItem) { |
|
| 25 | - $dataList .= '"' . htmlentities($dataItem) . '", '; |
|
| 26 | - } |
|
| 27 | - $dataList = "[" . rtrim($dataList, ", ") . "]"; |
|
| 17 | + /** |
|
| 18 | + * @param string $class CSS class to apply this typeahead to. |
|
| 19 | + * @param callable $generator Generator function taking no arguments to return an array of strings. |
|
| 20 | + */ |
|
| 21 | + public function defineTypeAheadSource($class, callable $generator) |
|
| 22 | + { |
|
| 23 | + $dataList = ''; |
|
| 24 | + foreach ($generator() as $dataItem) { |
|
| 25 | + $dataList .= '"' . htmlentities($dataItem) . '", '; |
|
| 26 | + } |
|
| 27 | + $dataList = "[" . rtrim($dataList, ", ") . "]"; |
|
| 28 | 28 | |
| 29 | - $script = <<<JS |
|
| 29 | + $script = <<<JS |
|
| 30 | 30 | |
| 31 | 31 | $('.{$class}').typeahead({ |
| 32 | 32 | hint: true, |
@@ -39,32 +39,32 @@ discard block |
||
| 39 | 39 | }) |
| 40 | 40 | ; |
| 41 | 41 | JS; |
| 42 | - $this->definedClasses[$class] = $script; |
|
| 43 | - } |
|
| 42 | + $this->definedClasses[$class] = $script; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @return string HTML fragment containing a JS block for typeaheads. |
|
| 47 | - */ |
|
| 48 | - public function getTypeAheadScriptBlock() |
|
| 49 | - { |
|
| 50 | - $jsBlocks = ''; |
|
| 45 | + /** |
|
| 46 | + * @return string HTML fragment containing a JS block for typeaheads. |
|
| 47 | + */ |
|
| 48 | + public function getTypeAheadScriptBlock() |
|
| 49 | + { |
|
| 50 | + $jsBlocks = ''; |
|
| 51 | 51 | |
| 52 | - if (count($this->definedClasses) === 0) { |
|
| 53 | - return ''; |
|
| 54 | - } |
|
| 52 | + if (count($this->definedClasses) === 0) { |
|
| 53 | + return ''; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - foreach ($this->definedClasses as $class => $js) { |
|
| 57 | - $jsBlocks = $js . "\r\n\r\n"; |
|
| 58 | - } |
|
| 56 | + foreach ($this->definedClasses as $class => $js) { |
|
| 57 | + $jsBlocks = $js . "\r\n\r\n"; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - $data = <<<HTML |
|
| 60 | + $data = <<<HTML |
|
| 61 | 61 | <script type="text/javascript"> |
| 62 | 62 | {$jsBlocks} |
| 63 | 63 | </script> |
| 64 | 64 | HTML; |
| 65 | 65 | |
| 66 | - $this->definedClasses = array(); |
|
| 66 | + $this->definedClasses = array(); |
|
| 67 | 67 | |
| 68 | - return $data; |
|
| 69 | - } |
|
| 68 | + return $data; |
|
| 69 | + } |
|
| 70 | 70 | } |
@@ -15,73 +15,73 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | class UserSearchHelper extends SearchHelperBase |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * UserSearchHelper constructor. |
|
| 20 | - * |
|
| 21 | - * @param PdoDatabase $database |
|
| 22 | - */ |
|
| 23 | - public function __construct(PdoDatabase $database) |
|
| 24 | - { |
|
| 25 | - parent::__construct($database, 'user', User::class); |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * Initiates a search for requests |
|
| 30 | - * |
|
| 31 | - * @param PdoDatabase $database |
|
| 32 | - * |
|
| 33 | - * @return UserSearchHelper |
|
| 34 | - */ |
|
| 35 | - public static function get(PdoDatabase $database) |
|
| 36 | - { |
|
| 37 | - $helper = new UserSearchHelper($database); |
|
| 38 | - |
|
| 39 | - return $helper; |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * @param string $status |
|
| 44 | - * |
|
| 45 | - * @return $this |
|
| 46 | - */ |
|
| 47 | - public function byStatus($status) |
|
| 48 | - { |
|
| 49 | - $this->whereClause .= ' AND status = ?'; |
|
| 50 | - $this->parameterList[] = $status; |
|
| 51 | - |
|
| 52 | - return $this; |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - public function statusIn($statuses) |
|
| 56 | - { |
|
| 57 | - $this->inClause('status', $statuses); |
|
| 58 | - |
|
| 59 | - return $this; |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * @param string $role |
|
| 64 | - * |
|
| 65 | - * @return $this |
|
| 66 | - */ |
|
| 67 | - public function byRole($role) |
|
| 68 | - { |
|
| 69 | - $this->joinClause .= ' INNER JOIN userrole r on origin.id = r.user'; |
|
| 70 | - $this->whereClause .= ' AND r.role = ?'; |
|
| 71 | - $this->parameterList[] = $role; |
|
| 72 | - |
|
| 73 | - return $this; |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * @param DateTime $instant |
|
| 78 | - * |
|
| 79 | - * @return $this |
|
| 80 | - */ |
|
| 81 | - public function lastActiveBefore(DateTime $instant) |
|
| 82 | - { |
|
| 83 | - $this->whereClause .= ' AND origin.lastactive < ? AND approvaldate.timestamp < ?'; |
|
| 84 | - $this->joinClause .= <<<'SQLFRAG' |
|
| 18 | + /** |
|
| 19 | + * UserSearchHelper constructor. |
|
| 20 | + * |
|
| 21 | + * @param PdoDatabase $database |
|
| 22 | + */ |
|
| 23 | + public function __construct(PdoDatabase $database) |
|
| 24 | + { |
|
| 25 | + parent::__construct($database, 'user', User::class); |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * Initiates a search for requests |
|
| 30 | + * |
|
| 31 | + * @param PdoDatabase $database |
|
| 32 | + * |
|
| 33 | + * @return UserSearchHelper |
|
| 34 | + */ |
|
| 35 | + public static function get(PdoDatabase $database) |
|
| 36 | + { |
|
| 37 | + $helper = new UserSearchHelper($database); |
|
| 38 | + |
|
| 39 | + return $helper; |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * @param string $status |
|
| 44 | + * |
|
| 45 | + * @return $this |
|
| 46 | + */ |
|
| 47 | + public function byStatus($status) |
|
| 48 | + { |
|
| 49 | + $this->whereClause .= ' AND status = ?'; |
|
| 50 | + $this->parameterList[] = $status; |
|
| 51 | + |
|
| 52 | + return $this; |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + public function statusIn($statuses) |
|
| 56 | + { |
|
| 57 | + $this->inClause('status', $statuses); |
|
| 58 | + |
|
| 59 | + return $this; |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * @param string $role |
|
| 64 | + * |
|
| 65 | + * @return $this |
|
| 66 | + */ |
|
| 67 | + public function byRole($role) |
|
| 68 | + { |
|
| 69 | + $this->joinClause .= ' INNER JOIN userrole r on origin.id = r.user'; |
|
| 70 | + $this->whereClause .= ' AND r.role = ?'; |
|
| 71 | + $this->parameterList[] = $role; |
|
| 72 | + |
|
| 73 | + return $this; |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * @param DateTime $instant |
|
| 78 | + * |
|
| 79 | + * @return $this |
|
| 80 | + */ |
|
| 81 | + public function lastActiveBefore(DateTime $instant) |
|
| 82 | + { |
|
| 83 | + $this->whereClause .= ' AND origin.lastactive < ? AND approvaldate.timestamp < ?'; |
|
| 84 | + $this->joinClause .= <<<'SQLFRAG' |
|
| 85 | 85 | LEFT JOIN ( |
| 86 | 86 | SELECT objectid, MAX(timestamp) timestamp |
| 87 | 87 | FROM log |
@@ -89,16 +89,16 @@ discard block |
||
| 89 | 89 | GROUP BY objectid |
| 90 | 90 | ) approvaldate ON approvaldate.objectid = origin.id |
| 91 | 91 | SQLFRAG; |
| 92 | - $formattedDate = $instant->format("Y-m-d H:i:s"); |
|
| 93 | - $this->parameterList[] = $formattedDate; |
|
| 94 | - $this->parameterList[] = $formattedDate; |
|
| 92 | + $formattedDate = $instant->format("Y-m-d H:i:s"); |
|
| 93 | + $this->parameterList[] = $formattedDate; |
|
| 94 | + $this->parameterList[] = $formattedDate; |
|
| 95 | 95 | |
| 96 | - return $this; |
|
| 97 | - } |
|
| 96 | + return $this; |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - public function getRoleMap(&$roleMap) |
|
| 100 | - { |
|
| 101 | - $query = <<<SQL |
|
| 99 | + public function getRoleMap(&$roleMap) |
|
| 100 | + { |
|
| 101 | + $query = <<<SQL |
|
| 102 | 102 | SELECT /* UserSearchHelper/roleMap */ |
| 103 | 103 | r.user user |
| 104 | 104 | , group_concat(r.role SEPARATOR ', ') roles |
@@ -107,22 +107,22 @@ discard block |
||
| 107 | 107 | GROUP BY r.user |
| 108 | 108 | SQL; |
| 109 | 109 | |
| 110 | - $statement = $this->database->prepare($query); |
|
| 111 | - $statement->execute($this->parameterList); |
|
| 110 | + $statement = $this->database->prepare($query); |
|
| 111 | + $statement->execute($this->parameterList); |
|
| 112 | 112 | |
| 113 | - $roleMap = array(); |
|
| 114 | - foreach ($statement->fetchAll(PDO::FETCH_ASSOC) as $row) { |
|
| 115 | - $roleMap[$row['user']] = $row['roles']; |
|
| 116 | - } |
|
| 113 | + $roleMap = array(); |
|
| 114 | + foreach ($statement->fetchAll(PDO::FETCH_ASSOC) as $row) { |
|
| 115 | + $roleMap[$row['user']] = $row['roles']; |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - return $this; |
|
| 119 | - } |
|
| 118 | + return $this; |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - public function withReservedRequest() |
|
| 122 | - { |
|
| 123 | - $this->joinClause = ' INNER JOIN request req ON req.reserved = origin.id'; |
|
| 124 | - $this->groupByClause = ' GROUP BY origin.id, origin.username'; |
|
| 121 | + public function withReservedRequest() |
|
| 122 | + { |
|
| 123 | + $this->joinClause = ' INNER JOIN request req ON req.reserved = origin.id'; |
|
| 124 | + $this->groupByClause = ' GROUP BY origin.id, origin.username'; |
|
| 125 | 125 | |
| 126 | - return $this->fetchMap('username'); |
|
| 127 | - } |
|
| 126 | + return $this->fetchMap('username'); |
|
| 127 | + } |
|
| 128 | 128 | } |
@@ -10,5 +10,5 @@ |
||
| 10 | 10 | |
| 11 | 11 | interface IMediaWikiClient |
| 12 | 12 | { |
| 13 | - function doApiCall($params, $method); |
|
| 13 | + function doApiCall($params, $method); |
|
| 14 | 14 | } |
| 15 | 15 | \ No newline at end of file |
@@ -12,24 +12,24 @@ |
||
| 12 | 12 | |
| 13 | 13 | abstract class ApiPageBase extends TaskBase implements IRoutedTask, IApiAction |
| 14 | 14 | { |
| 15 | - final public function execute() |
|
| 16 | - { |
|
| 17 | - $this->main(); |
|
| 18 | - } |
|
| 15 | + final public function execute() |
|
| 16 | + { |
|
| 17 | + $this->main(); |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @param string $routeName |
|
| 22 | - */ |
|
| 23 | - public function setRoute($routeName) |
|
| 24 | - { |
|
| 25 | - // no-op |
|
| 26 | - } |
|
| 20 | + /** |
|
| 21 | + * @param string $routeName |
|
| 22 | + */ |
|
| 23 | + public function setRoute($routeName) |
|
| 24 | + { |
|
| 25 | + // no-op |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @return string |
|
| 30 | - */ |
|
| 31 | - public function getRouteName() |
|
| 32 | - { |
|
| 33 | - return 'main'; |
|
| 34 | - } |
|
| 28 | + /** |
|
| 29 | + * @return string |
|
| 30 | + */ |
|
| 31 | + public function getRouteName() |
|
| 32 | + { |
|
| 33 | + return 'main'; |
|
| 34 | + } |
|
| 35 | 35 | } |
@@ -17,77 +17,77 @@ |
||
| 17 | 17 | |
| 18 | 18 | abstract class XmlApiPageBase extends ApiPageBase implements IXmlApiAction |
| 19 | 19 | { |
| 20 | - /** |
|
| 21 | - * API result document |
|
| 22 | - * @var DOMDocument |
|
| 23 | - */ |
|
| 24 | - protected $document; |
|
| 25 | - |
|
| 26 | - public function __construct() |
|
| 27 | - { |
|
| 28 | - $this->document = new DOMDocument('1.0'); |
|
| 29 | - } |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * Main function for this page, when no specific actions are called. |
|
| 33 | - * |
|
| 34 | - * @throws ApiException |
|
| 35 | - * @return void |
|
| 36 | - */ |
|
| 37 | - final protected function main() |
|
| 38 | - { |
|
| 39 | - if (headers_sent()) { |
|
| 40 | - throw new ApiException('Headers have already been sent - this indicates a bug in the application!'); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - header("Content-Type: text/xml"); |
|
| 44 | - |
|
| 45 | - // javascript access control |
|
| 46 | - $httpOrigin = WebRequest::origin(); |
|
| 47 | - |
|
| 48 | - if ($httpOrigin !== null) { |
|
| 49 | - $CORSallowed = $this->getSiteConfiguration()->getCrossOriginResourceSharingHosts(); |
|
| 50 | - |
|
| 51 | - if (in_array($httpOrigin, $CORSallowed)) { |
|
| 52 | - header("Access-Control-Allow-Origin: " . $httpOrigin); |
|
| 53 | - } |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - $responseData = $this->runApiPage(); |
|
| 57 | - |
|
| 58 | - ob_end_clean(); |
|
| 59 | - print($responseData); |
|
| 60 | - ob_start(); |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Method that runs API action |
|
| 65 | - * |
|
| 66 | - * @param DOMElement $apiDocument |
|
| 67 | - * |
|
| 68 | - * @return DOMElement |
|
| 69 | - */ |
|
| 70 | - abstract public function executeApiAction(DOMElement $apiDocument); |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * @return string |
|
| 74 | - */ |
|
| 75 | - final public function runApiPage() |
|
| 76 | - { |
|
| 77 | - $apiDocument = $this->document->createElement("api"); |
|
| 78 | - |
|
| 79 | - try { |
|
| 80 | - $apiDocument = $this->executeApiAction($apiDocument); |
|
| 81 | - } |
|
| 82 | - /** @noinspection PhpRedundantCatchClauseInspection */ |
|
| 83 | - catch (ApiException $ex) { |
|
| 84 | - $exception = $this->document->createElement("error"); |
|
| 85 | - $exception->setAttribute("message", $ex->getMessage()); |
|
| 86 | - $apiDocument->appendChild($exception); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - $this->document->appendChild($apiDocument); |
|
| 90 | - |
|
| 91 | - return $this->document->saveXML(); |
|
| 92 | - } |
|
| 20 | + /** |
|
| 21 | + * API result document |
|
| 22 | + * @var DOMDocument |
|
| 23 | + */ |
|
| 24 | + protected $document; |
|
| 25 | + |
|
| 26 | + public function __construct() |
|
| 27 | + { |
|
| 28 | + $this->document = new DOMDocument('1.0'); |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * Main function for this page, when no specific actions are called. |
|
| 33 | + * |
|
| 34 | + * @throws ApiException |
|
| 35 | + * @return void |
|
| 36 | + */ |
|
| 37 | + final protected function main() |
|
| 38 | + { |
|
| 39 | + if (headers_sent()) { |
|
| 40 | + throw new ApiException('Headers have already been sent - this indicates a bug in the application!'); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + header("Content-Type: text/xml"); |
|
| 44 | + |
|
| 45 | + // javascript access control |
|
| 46 | + $httpOrigin = WebRequest::origin(); |
|
| 47 | + |
|
| 48 | + if ($httpOrigin !== null) { |
|
| 49 | + $CORSallowed = $this->getSiteConfiguration()->getCrossOriginResourceSharingHosts(); |
|
| 50 | + |
|
| 51 | + if (in_array($httpOrigin, $CORSallowed)) { |
|
| 52 | + header("Access-Control-Allow-Origin: " . $httpOrigin); |
|
| 53 | + } |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + $responseData = $this->runApiPage(); |
|
| 57 | + |
|
| 58 | + ob_end_clean(); |
|
| 59 | + print($responseData); |
|
| 60 | + ob_start(); |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Method that runs API action |
|
| 65 | + * |
|
| 66 | + * @param DOMElement $apiDocument |
|
| 67 | + * |
|
| 68 | + * @return DOMElement |
|
| 69 | + */ |
|
| 70 | + abstract public function executeApiAction(DOMElement $apiDocument); |
|
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * @return string |
|
| 74 | + */ |
|
| 75 | + final public function runApiPage() |
|
| 76 | + { |
|
| 77 | + $apiDocument = $this->document->createElement("api"); |
|
| 78 | + |
|
| 79 | + try { |
|
| 80 | + $apiDocument = $this->executeApiAction($apiDocument); |
|
| 81 | + } |
|
| 82 | + /** @noinspection PhpRedundantCatchClauseInspection */ |
|
| 83 | + catch (ApiException $ex) { |
|
| 84 | + $exception = $this->document->createElement("error"); |
|
| 85 | + $exception->setAttribute("message", $ex->getMessage()); |
|
| 86 | + $apiDocument->appendChild($exception); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + $this->document->appendChild($apiDocument); |
|
| 90 | + |
|
| 91 | + return $this->document->saveXML(); |
|
| 92 | + } |
|
| 93 | 93 | } |
@@ -14,30 +14,30 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | class PrecacheGeolocationTask extends ConsoleTaskBase |
| 16 | 16 | { |
| 17 | - public function execute() |
|
| 18 | - { |
|
| 19 | - $database = $this->getDatabase(); |
|
| 20 | - $locationProvider = $this->getLocationProvider(); |
|
| 17 | + public function execute() |
|
| 18 | + { |
|
| 19 | + $database = $this->getDatabase(); |
|
| 20 | + $locationProvider = $this->getLocationProvider(); |
|
| 21 | 21 | |
| 22 | - while (true) { |
|
| 23 | - echo "Beginning txn\n"; |
|
| 24 | - $database->beginTransaction(); |
|
| 22 | + while (true) { |
|
| 23 | + echo "Beginning txn\n"; |
|
| 24 | + $database->beginTransaction(); |
|
| 25 | 25 | |
| 26 | - try { |
|
| 27 | - echo ". Fetching data...\n"; |
|
| 26 | + try { |
|
| 27 | + echo ". Fetching data...\n"; |
|
| 28 | 28 | |
| 29 | - // fetch a bunch of un-geolocated IPs from the database. |
|
| 30 | - // Note we have to parse the forwardedip field in the database so we can test against the geolocation |
|
| 31 | - // table. |
|
| 32 | - // |
|
| 33 | - // This guarantees we get ten unlocated IPs back, unless there actually aren't 10 available. |
|
| 34 | - // |
|
| 35 | - // Alternatives include downloading a small set of forwarded IPs, splitting it in PHP, constructing an |
|
| 36 | - // IN() clause dynamically, sending that back to the database to check if there are geolocation entries, |
|
| 37 | - // then repeating until we have 10 to process - and the fact that we'd have to potentially retrieve all |
|
| 38 | - // IPs from the database before we find any at all. This way keeps all of that legwork in the database, |
|
| 39 | - // at the cost of a more complex query. |
|
| 40 | - $statement = $database->query(<<<SQL |
|
| 29 | + // fetch a bunch of un-geolocated IPs from the database. |
|
| 30 | + // Note we have to parse the forwardedip field in the database so we can test against the geolocation |
|
| 31 | + // table. |
|
| 32 | + // |
|
| 33 | + // This guarantees we get ten unlocated IPs back, unless there actually aren't 10 available. |
|
| 34 | + // |
|
| 35 | + // Alternatives include downloading a small set of forwarded IPs, splitting it in PHP, constructing an |
|
| 36 | + // IN() clause dynamically, sending that back to the database to check if there are geolocation entries, |
|
| 37 | + // then repeating until we have 10 to process - and the fact that we'd have to potentially retrieve all |
|
| 38 | + // IPs from the database before we find any at all. This way keeps all of that legwork in the database, |
|
| 39 | + // at the cost of a more complex query. |
|
| 40 | + $statement = $database->query(<<<SQL |
|
| 41 | 41 | SELECT /* PrecacheGeolocationTask */ p.prox |
| 42 | 42 | FROM ( |
| 43 | 43 | SELECT trim(substring_index(substring_index(r.forwardedip, ',', n.n), ',', -1)) prox |
@@ -54,42 +54,42 @@ discard block |
||
| 54 | 54 | WHERE NOT EXISTS (SELECT 1 FROM geolocation g WHERE g.address = p.prox FOR UPDATE) |
| 55 | 55 | LIMIT 10; |
| 56 | 56 | SQL |
| 57 | - ); |
|
| 57 | + ); |
|
| 58 | 58 | |
| 59 | - $missingIps = $statement->fetchAll(PDO::FETCH_COLUMN); |
|
| 59 | + $missingIps = $statement->fetchAll(PDO::FETCH_COLUMN); |
|
| 60 | 60 | |
| 61 | - $count = count($missingIps); |
|
| 62 | - if ($count === 0) { |
|
| 63 | - echo ". Found nothing to do.\n"; |
|
| 64 | - break; |
|
| 65 | - } |
|
| 61 | + $count = count($missingIps); |
|
| 62 | + if ($count === 0) { |
|
| 63 | + echo ". Found nothing to do.\n"; |
|
| 64 | + break; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - echo ". Picked {$count} IP addresses\n"; |
|
| 67 | + echo ". Picked {$count} IP addresses\n"; |
|
| 68 | 68 | |
| 69 | - foreach ($missingIps as $ip) { |
|
| 70 | - echo ". . Getting location for {$ip}...\n"; |
|
| 71 | - $data = json_encode($locationProvider->getIpLocation($ip)); |
|
| 72 | - echo ". . . {$data}\n"; |
|
| 73 | - } |
|
| 69 | + foreach ($missingIps as $ip) { |
|
| 70 | + echo ". . Getting location for {$ip}...\n"; |
|
| 71 | + $data = json_encode($locationProvider->getIpLocation($ip)); |
|
| 72 | + echo ". . . {$data}\n"; |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - echo ". IP location fetch complete.\n"; |
|
| 76 | - $database->commit(); |
|
| 77 | - echo ". Committed txn.\n"; |
|
| 78 | - } |
|
| 79 | - catch (Exception $ex) { |
|
| 80 | - echo ". Encountered exception: " . $ex->getMessage() . "\n"; |
|
| 81 | - $database->rollBack(); |
|
| 82 | - echo ". Rolled back txn\n"; |
|
| 83 | - throw $ex; |
|
| 84 | - } |
|
| 85 | - finally { |
|
| 86 | - if ($database->hasActiveTransaction()) { |
|
| 87 | - $database->rollBack(); |
|
| 88 | - echo ". Rolled back txn\n"; |
|
| 89 | - } |
|
| 90 | - } |
|
| 91 | - } |
|
| 75 | + echo ". IP location fetch complete.\n"; |
|
| 76 | + $database->commit(); |
|
| 77 | + echo ". Committed txn.\n"; |
|
| 78 | + } |
|
| 79 | + catch (Exception $ex) { |
|
| 80 | + echo ". Encountered exception: " . $ex->getMessage() . "\n"; |
|
| 81 | + $database->rollBack(); |
|
| 82 | + echo ". Rolled back txn\n"; |
|
| 83 | + throw $ex; |
|
| 84 | + } |
|
| 85 | + finally { |
|
| 86 | + if ($database->hasActiveTransaction()) { |
|
| 87 | + $database->rollBack(); |
|
| 88 | + echo ". Rolled back txn\n"; |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - echo "Done.\n"; |
|
| 94 | - } |
|
| 93 | + echo "Done.\n"; |
|
| 94 | + } |
|
| 95 | 95 | } |
| 96 | 96 | \ No newline at end of file |
@@ -12,44 +12,44 @@ |
||
| 12 | 12 | |
| 13 | 13 | class PageTeam extends InternalPageBase |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * Main function for this page, when no specific actions are called. |
|
| 17 | - * @return void |
|
| 18 | - */ |
|
| 19 | - protected function main() |
|
| 20 | - { |
|
| 21 | - $path = $this->getSiteConfiguration()->getFilePath() . '/team.json'; |
|
| 22 | - $json = file_get_contents($path); |
|
| 23 | - |
|
| 24 | - $teamData = json_decode($json, true); |
|
| 25 | - |
|
| 26 | - $active = array(); |
|
| 27 | - $inactive = array(); |
|
| 28 | - |
|
| 29 | - foreach ($teamData as $name => $item) { |
|
| 30 | - if (count($item['Role']) == 0) { |
|
| 31 | - $inactive[$name] = $item; |
|
| 32 | - } |
|
| 33 | - else { |
|
| 34 | - $active[$name] = $item; |
|
| 35 | - } |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - $this->assign('developer', $this->assocArrayShuffle($active)); |
|
| 39 | - $this->assign('inactiveDeveloper', $this->assocArrayShuffle($inactive)); |
|
| 40 | - $this->setTemplate('team/team.tpl'); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - private function assocArrayShuffle($array) |
|
| 44 | - { |
|
| 45 | - $arrayKeys = array_keys($array); |
|
| 46 | - shuffle($arrayKeys); |
|
| 47 | - |
|
| 48 | - $sorted = []; |
|
| 49 | - foreach ($arrayKeys as $k) { |
|
| 50 | - $sorted[$k] = $array[$k]; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - return $sorted; |
|
| 54 | - } |
|
| 15 | + /** |
|
| 16 | + * Main function for this page, when no specific actions are called. |
|
| 17 | + * @return void |
|
| 18 | + */ |
|
| 19 | + protected function main() |
|
| 20 | + { |
|
| 21 | + $path = $this->getSiteConfiguration()->getFilePath() . '/team.json'; |
|
| 22 | + $json = file_get_contents($path); |
|
| 23 | + |
|
| 24 | + $teamData = json_decode($json, true); |
|
| 25 | + |
|
| 26 | + $active = array(); |
|
| 27 | + $inactive = array(); |
|
| 28 | + |
|
| 29 | + foreach ($teamData as $name => $item) { |
|
| 30 | + if (count($item['Role']) == 0) { |
|
| 31 | + $inactive[$name] = $item; |
|
| 32 | + } |
|
| 33 | + else { |
|
| 34 | + $active[$name] = $item; |
|
| 35 | + } |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + $this->assign('developer', $this->assocArrayShuffle($active)); |
|
| 39 | + $this->assign('inactiveDeveloper', $this->assocArrayShuffle($inactive)); |
|
| 40 | + $this->setTemplate('team/team.tpl'); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + private function assocArrayShuffle($array) |
|
| 44 | + { |
|
| 45 | + $arrayKeys = array_keys($array); |
|
| 46 | + shuffle($arrayKeys); |
|
| 47 | + |
|
| 48 | + $sorted = []; |
|
| 49 | + foreach ($arrayKeys as $k) { |
|
| 50 | + $sorted[$k] = $array[$k]; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + return $sorted; |
|
| 54 | + } |
|
| 55 | 55 | } |
@@ -15,53 +15,53 @@ |
||
| 15 | 15 | |
| 16 | 16 | interface IOAuthProtocolHelper |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * @return stdClass |
|
| 20 | - * |
|
| 21 | - * @throws Exception |
|
| 22 | - * @throws CurlException |
|
| 23 | - */ |
|
| 24 | - public function getRequestToken(); |
|
| 18 | + /** |
|
| 19 | + * @return stdClass |
|
| 20 | + * |
|
| 21 | + * @throws Exception |
|
| 22 | + * @throws CurlException |
|
| 23 | + */ |
|
| 24 | + public function getRequestToken(); |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * @param string $requestToken |
|
| 28 | - * |
|
| 29 | - * @return string |
|
| 30 | - */ |
|
| 31 | - public function getAuthoriseUrl($requestToken); |
|
| 26 | + /** |
|
| 27 | + * @param string $requestToken |
|
| 28 | + * |
|
| 29 | + * @return string |
|
| 30 | + */ |
|
| 31 | + public function getAuthoriseUrl($requestToken); |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @param string $oauthRequestToken |
|
| 35 | - * @param string $oauthRequestSecret |
|
| 36 | - * @param string $oauthVerifier |
|
| 37 | - * |
|
| 38 | - * @return stdClass |
|
| 39 | - * @throws CurlException |
|
| 40 | - * @throws Exception |
|
| 41 | - */ |
|
| 42 | - public function callbackCompleted($oauthRequestToken, $oauthRequestSecret, $oauthVerifier); |
|
| 33 | + /** |
|
| 34 | + * @param string $oauthRequestToken |
|
| 35 | + * @param string $oauthRequestSecret |
|
| 36 | + * @param string $oauthVerifier |
|
| 37 | + * |
|
| 38 | + * @return stdClass |
|
| 39 | + * @throws CurlException |
|
| 40 | + * @throws Exception |
|
| 41 | + */ |
|
| 42 | + public function callbackCompleted($oauthRequestToken, $oauthRequestSecret, $oauthVerifier); |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @param string $oauthAccessToken |
|
| 46 | - * @param string $oauthAccessSecret |
|
| 47 | - * |
|
| 48 | - * @return stdClass |
|
| 49 | - * @throws CurlException |
|
| 50 | - * @throws Exception |
|
| 51 | - * @throws \MediaWiki\OAuthClient\Exception |
|
| 52 | - */ |
|
| 53 | - public function getIdentityTicket($oauthAccessToken, $oauthAccessSecret); |
|
| 44 | + /** |
|
| 45 | + * @param string $oauthAccessToken |
|
| 46 | + * @param string $oauthAccessSecret |
|
| 47 | + * |
|
| 48 | + * @return stdClass |
|
| 49 | + * @throws CurlException |
|
| 50 | + * @throws Exception |
|
| 51 | + * @throws \MediaWiki\OAuthClient\Exception |
|
| 52 | + */ |
|
| 53 | + public function getIdentityTicket($oauthAccessToken, $oauthAccessSecret); |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * @param array $apiParams array of parameters to send to the API |
|
| 57 | - * @param string $accessToken user's access token |
|
| 58 | - * @param string $accessSecret user's secret |
|
| 59 | - * @param string $method HTTP method |
|
| 60 | - * |
|
| 61 | - * @return stdClass |
|
| 62 | - * @throws ApplicationLogicException |
|
| 63 | - * @throws CurlException |
|
| 64 | - * @throws Exception |
|
| 65 | - */ |
|
| 66 | - public function apiCall($apiParams, $accessToken, $accessSecret, $method = 'GET'); |
|
| 55 | + /** |
|
| 56 | + * @param array $apiParams array of parameters to send to the API |
|
| 57 | + * @param string $accessToken user's access token |
|
| 58 | + * @param string $accessSecret user's secret |
|
| 59 | + * @param string $method HTTP method |
|
| 60 | + * |
|
| 61 | + * @return stdClass |
|
| 62 | + * @throws ApplicationLogicException |
|
| 63 | + * @throws CurlException |
|
| 64 | + * @throws Exception |
|
| 65 | + */ |
|
| 66 | + public function apiCall($apiParams, $accessToken, $accessSecret, $method = 'GET'); |
|
| 67 | 67 | } |
| 68 | 68 | \ No newline at end of file |
@@ -22,156 +22,156 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | class XffTrustProvider implements IXffTrustProvider |
| 24 | 24 | { |
| 25 | - /** |
|
| 26 | - * Array of IP addresses which are TRUSTED proxies |
|
| 27 | - * @var string[] |
|
| 28 | - */ |
|
| 29 | - private $trustedCache; |
|
| 30 | - /** |
|
| 31 | - * Array of IP addresses which are UNTRUSTED proxies |
|
| 32 | - * @var string[] |
|
| 33 | - */ |
|
| 34 | - private $untrustedCache = array(); |
|
| 35 | - /** @var PDOStatement */ |
|
| 36 | - private $trustedQuery; |
|
| 37 | - /** |
|
| 38 | - * @var PdoDatabase |
|
| 39 | - */ |
|
| 40 | - private $database; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * Creates a new instance of the trust provider |
|
| 44 | - * |
|
| 45 | - * @param string[] $squidIpList List of IP addresses to pre-approve |
|
| 46 | - * @param PdoDatabase $database |
|
| 47 | - */ |
|
| 48 | - public function __construct($squidIpList, PdoDatabase $database) |
|
| 49 | - { |
|
| 50 | - $this->trustedCache = $squidIpList; |
|
| 51 | - $this->database = $database; |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * Returns a value if the IP address is a trusted proxy |
|
| 56 | - * |
|
| 57 | - * @param string $ip |
|
| 58 | - * |
|
| 59 | - * @return bool |
|
| 60 | - */ |
|
| 61 | - public function isTrusted($ip) |
|
| 62 | - { |
|
| 63 | - if (in_array($ip, $this->trustedCache)) { |
|
| 64 | - return true; |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - if (in_array($ip, $this->untrustedCache)) { |
|
| 68 | - return false; |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - if ($this->trustedQuery === null) { |
|
| 72 | - $query = "SELECT COUNT(id) FROM xfftrustcache WHERE ip = :ip;"; |
|
| 73 | - $this->trustedQuery = $this->database->prepare($query); |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - $this->trustedQuery->execute(array(":ip" => $ip)); |
|
| 77 | - $result = $this->trustedQuery->fetchColumn(); |
|
| 78 | - $this->trustedQuery->closeCursor(); |
|
| 79 | - |
|
| 80 | - if ($result == 0) { |
|
| 81 | - $this->untrustedCache[] = $ip; |
|
| 82 | - |
|
| 83 | - return false; |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - if ($result >= 1) { |
|
| 87 | - $this->trustedCache[] = $ip; |
|
| 88 | - |
|
| 89 | - return true; |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - // something weird has happened if we've got here. |
|
| 93 | - // default to untrusted. |
|
| 94 | - return false; |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * Gets the last trusted IP in the proxy chain. |
|
| 99 | - * |
|
| 100 | - * @param string $ip The IP address from REMOTE_ADDR |
|
| 101 | - * @param string $proxyIp The contents of the XFF header. |
|
| 102 | - * |
|
| 103 | - * @return string Trusted source IP address |
|
| 104 | - */ |
|
| 105 | - public function getTrustedClientIp($ip, $proxyIp) |
|
| 106 | - { |
|
| 107 | - $clientIpAddress = $ip; |
|
| 108 | - if ($proxyIp) { |
|
| 109 | - $ipList = explode(",", $proxyIp); |
|
| 110 | - $ipList[] = $clientIpAddress; |
|
| 111 | - $ipList = array_reverse($ipList); |
|
| 112 | - |
|
| 113 | - foreach ($ipList as $ipNumber => $ipAddress) { |
|
| 114 | - if ($this->isTrusted(trim($ipAddress)) && $ipNumber < (count($ipList) - 1)) { |
|
| 115 | - continue; |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - $clientIpAddress = $ipAddress; |
|
| 119 | - break; |
|
| 120 | - } |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - return trim($clientIpAddress); |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * Takes an array( "low" => "high" ) values, and returns true if $needle is in at least one of them. |
|
| 128 | - * |
|
| 129 | - * @param array $haystack |
|
| 130 | - * @param string $ip |
|
| 131 | - * |
|
| 132 | - * @return bool |
|
| 133 | - */ |
|
| 134 | - public function ipInRange($haystack, $ip) |
|
| 135 | - { |
|
| 136 | - $needle = ip2long($ip); |
|
| 137 | - |
|
| 138 | - foreach ($haystack as $low => $high) { |
|
| 139 | - if (ip2long($low) <= $needle && ip2long($high) >= $needle) { |
|
| 140 | - return true; |
|
| 141 | - } |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - return false; |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - /** |
|
| 148 | - * Explodes a CIDR range into an array of addresses |
|
| 149 | - * |
|
| 150 | - * @param string $range A CIDR-format range |
|
| 151 | - * |
|
| 152 | - * @return array An array containing every IP address in the range |
|
| 153 | - */ |
|
| 154 | - public function explodeCidr($range) |
|
| 155 | - { |
|
| 156 | - $cidrData = explode('/', $range); |
|
| 157 | - |
|
| 158 | - if (!isset($cidrData[1])) { |
|
| 159 | - return array($range); |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - $blow = ( |
|
| 163 | - str_pad(decbin(ip2long($cidrData[0])), 32, "0", STR_PAD_LEFT) & |
|
| 164 | - str_pad(str_pad("", $cidrData[1], "1"), 32, "0") |
|
| 165 | - ); |
|
| 166 | - $bhigh = ($blow | str_pad(str_pad("", $cidrData[1], "0"), 32, "1")); |
|
| 167 | - |
|
| 168 | - $list = array(); |
|
| 169 | - |
|
| 170 | - $bindecBHigh = bindec($bhigh); |
|
| 171 | - for ($x = bindec($blow); $x <= $bindecBHigh; $x++) { |
|
| 172 | - $list[] = long2ip($x); |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - return $list; |
|
| 176 | - } |
|
| 25 | + /** |
|
| 26 | + * Array of IP addresses which are TRUSTED proxies |
|
| 27 | + * @var string[] |
|
| 28 | + */ |
|
| 29 | + private $trustedCache; |
|
| 30 | + /** |
|
| 31 | + * Array of IP addresses which are UNTRUSTED proxies |
|
| 32 | + * @var string[] |
|
| 33 | + */ |
|
| 34 | + private $untrustedCache = array(); |
|
| 35 | + /** @var PDOStatement */ |
|
| 36 | + private $trustedQuery; |
|
| 37 | + /** |
|
| 38 | + * @var PdoDatabase |
|
| 39 | + */ |
|
| 40 | + private $database; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * Creates a new instance of the trust provider |
|
| 44 | + * |
|
| 45 | + * @param string[] $squidIpList List of IP addresses to pre-approve |
|
| 46 | + * @param PdoDatabase $database |
|
| 47 | + */ |
|
| 48 | + public function __construct($squidIpList, PdoDatabase $database) |
|
| 49 | + { |
|
| 50 | + $this->trustedCache = $squidIpList; |
|
| 51 | + $this->database = $database; |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * Returns a value if the IP address is a trusted proxy |
|
| 56 | + * |
|
| 57 | + * @param string $ip |
|
| 58 | + * |
|
| 59 | + * @return bool |
|
| 60 | + */ |
|
| 61 | + public function isTrusted($ip) |
|
| 62 | + { |
|
| 63 | + if (in_array($ip, $this->trustedCache)) { |
|
| 64 | + return true; |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + if (in_array($ip, $this->untrustedCache)) { |
|
| 68 | + return false; |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + if ($this->trustedQuery === null) { |
|
| 72 | + $query = "SELECT COUNT(id) FROM xfftrustcache WHERE ip = :ip;"; |
|
| 73 | + $this->trustedQuery = $this->database->prepare($query); |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + $this->trustedQuery->execute(array(":ip" => $ip)); |
|
| 77 | + $result = $this->trustedQuery->fetchColumn(); |
|
| 78 | + $this->trustedQuery->closeCursor(); |
|
| 79 | + |
|
| 80 | + if ($result == 0) { |
|
| 81 | + $this->untrustedCache[] = $ip; |
|
| 82 | + |
|
| 83 | + return false; |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + if ($result >= 1) { |
|
| 87 | + $this->trustedCache[] = $ip; |
|
| 88 | + |
|
| 89 | + return true; |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + // something weird has happened if we've got here. |
|
| 93 | + // default to untrusted. |
|
| 94 | + return false; |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * Gets the last trusted IP in the proxy chain. |
|
| 99 | + * |
|
| 100 | + * @param string $ip The IP address from REMOTE_ADDR |
|
| 101 | + * @param string $proxyIp The contents of the XFF header. |
|
| 102 | + * |
|
| 103 | + * @return string Trusted source IP address |
|
| 104 | + */ |
|
| 105 | + public function getTrustedClientIp($ip, $proxyIp) |
|
| 106 | + { |
|
| 107 | + $clientIpAddress = $ip; |
|
| 108 | + if ($proxyIp) { |
|
| 109 | + $ipList = explode(",", $proxyIp); |
|
| 110 | + $ipList[] = $clientIpAddress; |
|
| 111 | + $ipList = array_reverse($ipList); |
|
| 112 | + |
|
| 113 | + foreach ($ipList as $ipNumber => $ipAddress) { |
|
| 114 | + if ($this->isTrusted(trim($ipAddress)) && $ipNumber < (count($ipList) - 1)) { |
|
| 115 | + continue; |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + $clientIpAddress = $ipAddress; |
|
| 119 | + break; |
|
| 120 | + } |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + return trim($clientIpAddress); |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * Takes an array( "low" => "high" ) values, and returns true if $needle is in at least one of them. |
|
| 128 | + * |
|
| 129 | + * @param array $haystack |
|
| 130 | + * @param string $ip |
|
| 131 | + * |
|
| 132 | + * @return bool |
|
| 133 | + */ |
|
| 134 | + public function ipInRange($haystack, $ip) |
|
| 135 | + { |
|
| 136 | + $needle = ip2long($ip); |
|
| 137 | + |
|
| 138 | + foreach ($haystack as $low => $high) { |
|
| 139 | + if (ip2long($low) <= $needle && ip2long($high) >= $needle) { |
|
| 140 | + return true; |
|
| 141 | + } |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + return false; |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + /** |
|
| 148 | + * Explodes a CIDR range into an array of addresses |
|
| 149 | + * |
|
| 150 | + * @param string $range A CIDR-format range |
|
| 151 | + * |
|
| 152 | + * @return array An array containing every IP address in the range |
|
| 153 | + */ |
|
| 154 | + public function explodeCidr($range) |
|
| 155 | + { |
|
| 156 | + $cidrData = explode('/', $range); |
|
| 157 | + |
|
| 158 | + if (!isset($cidrData[1])) { |
|
| 159 | + return array($range); |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + $blow = ( |
|
| 163 | + str_pad(decbin(ip2long($cidrData[0])), 32, "0", STR_PAD_LEFT) & |
|
| 164 | + str_pad(str_pad("", $cidrData[1], "1"), 32, "0") |
|
| 165 | + ); |
|
| 166 | + $bhigh = ($blow | str_pad(str_pad("", $cidrData[1], "0"), 32, "1")); |
|
| 167 | + |
|
| 168 | + $list = array(); |
|
| 169 | + |
|
| 170 | + $bindecBHigh = bindec($bhigh); |
|
| 171 | + for ($x = bindec($blow); $x <= $bindecBHigh; $x++) { |
|
| 172 | + $list[] = long2ip($x); |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + return $list; |
|
| 176 | + } |
|
| 177 | 177 | } |