Subversion Repositories php_utils

Rev

Rev 46 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 46 Rev 51
Line 1... Line 1...
1
<?php
1
<?php
2
 
2
 
3
/*
3
/*
4
 * IPv6 functions for PHP
4
 * IPv6 functions for PHP
5
 * Copyright 2012-2022 Daniel Marschall, ViaThinkSoft
5
 * Copyright 2012-2022 Daniel Marschall, ViaThinkSoft
6
 * Version 2022-09-18
6
 * Version 2022-09-22
7
 *
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this file except in compliance with the License.
9
 * you may not use this file except in compliance with the License.
10
 * You may obtain a copy of the License at
10
 * You may obtain a copy of the License at
11
 *
11
 *
Line 376... Line 376...
376
 
376
 
377
        if (strpos($line, '/') !== false) {
377
        if (strpos($line, '/') !== false) {
378
                $rng = ipv6_cidr2range($line);
378
                $rng = ipv6_cidr2range($line);
379
        } else {
379
        } else {
380
                $rng = explode('-', $line);
380
                $rng = explode('-', $line);
381
                $rng[0] = trim($rng[0]);
-
 
382
                if (isset($rng[1])) $rng[1] = trim($rng[1]);
-
 
383
                $rng[0] = ipv6_normalize($rng[0]);
381
                $rng[0] = ipv6_normalize(trim($rng[0]));
384
                if (!isset($rng[1])) $rng[1] = $rng[0];
382
                $rng[1] = isset($rng[1]) ? ipv6_normalize(trim($rng[1])) : $rng[0];
385
                $rng[1] = ipv6_normalize($rng[1]);
-
 
386
        }
383
        }
387
 
384
 
388
        return $rng;
385
        return $rng;
389
}
386
}
390
 
387