|
Last change
on this file was 8, checked in by chronos, 2 years ago |
- Modified: Updated Common package.
- Modified: Form types made as separate FormManager package.
- Fixed: PHP 8.1 support.
|
|
File size:
772 bytes
|
| Line | |
|---|
| 1 | <?php
|
|---|
| 2 |
|
|---|
| 3 | include_once(dirname(__FILE__).'/Base.php');
|
|---|
| 4 |
|
|---|
| 5 | class TypeIPv6Address extends TypeBase
|
|---|
| 6 | {
|
|---|
| 7 | function OnView(array $Item): ?string
|
|---|
| 8 | {
|
|---|
| 9 | $Output = $Item['Value'];
|
|---|
| 10 | return $Output;
|
|---|
| 11 | }
|
|---|
| 12 |
|
|---|
| 13 | function OnEdit(array $Item): string
|
|---|
| 14 | {
|
|---|
| 15 | $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'"/>';
|
|---|
| 16 | return $Output;
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | function OnLoad(array $Item): ?string
|
|---|
| 20 | {
|
|---|
| 21 | return $_POST[$Item['Name']];
|
|---|
| 22 | }
|
|---|
| 23 |
|
|---|
| 24 | function Validate(array $Item): bool
|
|---|
| 25 | {
|
|---|
| 26 | if ($Item['Null'] and ($Item['Value'] == '')) return true;
|
|---|
| 27 | return filter_var($Item['Value'], FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV6));
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | function GetValidationFormat(): string
|
|---|
| 31 | {
|
|---|
| 32 | return 'xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx kde x je hexa hodnota 0..f';
|
|---|
| 33 | }
|
|---|
| 34 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.