Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
NetworkFilter.php
01 <?php
02
03 /**
04 * @package s9e\TextFormatter
05 * @copyright Copyright (c) 2010-2022 The s9e authors
06 * @license http://www.opensource.org/licenses/mit-license.php The MIT License
07 */
08 namespace s9e\TextFormatter\Parser\AttributeFilters;
09
10 class NetworkFilter
11 {
12 /**
13 * Filter an IP value (includes IPv4 and IPv6)
14 *
15 * @param string $attrValue Original value
16 * @return mixed Filtered value, or FALSE if invalid
17 */
18 public static function filterIp($attrValue)
19 {
20 return filter_var($attrValue, FILTER_VALIDATE_IP);
21 }
22
23 /**
24 * Filter an IP:port value (includes IPv4 and IPv6)
25 *
26 * @param string $attrValue Original value
27 * @return mixed Filtered value, or FALSE if invalid
28 */
29 public static function filterIpport($attrValue)
30 {
31 if (preg_match('/^\\[([^\\]]+)(\\]:[1-9][0-9]*)$/D', $attrValue, $m))
32 {
33 $ip = self::filterIpv6($m[1]);
34
35 if ($ip === false)
36 {
37 return false;
38 }
39
40 return '[' . $ip . $m[2];
41 }
42
43 if (preg_match('/^([^:]+)(:[1-9][0-9]*)$/D', $attrValue, $m))
44 {
45 $ip = self::filterIpv4($m[1]);
46
47 if ($ip === false)
48 {
49 return false;
50 }
51
52 return $ip . $m[2];
53 }
54
55 return false;
56 }
57
58 /**
59 * Filter an IPv4 value
60 *
61 * @param string $attrValue Original value
62 * @return mixed Filtered value, or FALSE if invalid
63 */
64 public static function filterIpv4($attrValue)
65 {
66 return filter_var($attrValue, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
67 }
68
69 /**
70 * Filter an IPv6 value
71 *
72 * @param string $attrValue Original value
73 * @return mixed Filtered value, or FALSE if invalid
74 */
75 public static function filterIpv6($attrValue)
76 {
77 return filter_var($attrValue, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
78 }
79 }