|
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:
707 bytes
|
| Line | |
|---|
| 1 | <?php
|
|---|
| 2 |
|
|---|
| 3 | include_once(dirname(__FILE__).'/Base.php');
|
|---|
| 4 |
|
|---|
| 5 | class TypeRandomHash extends TypeBase
|
|---|
| 6 | {
|
|---|
| 7 | function __construct($FormManager)
|
|---|
| 8 | {
|
|---|
| 9 | parent::__construct($FormManager);
|
|---|
| 10 | $this->Hidden = true;
|
|---|
| 11 | }
|
|---|
| 12 |
|
|---|
| 13 | function OnView(array $Item): ?string
|
|---|
| 14 | {
|
|---|
| 15 | $Output = $Item['Value'];
|
|---|
| 16 | return $Output;
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | function OnEdit(array $Item): string
|
|---|
| 20 | {
|
|---|
| 21 | if ($Item['Value'] == '')
|
|---|
| 22 | {
|
|---|
| 23 | // Create only once
|
|---|
| 24 | $PasswordHash = new PasswordHash();
|
|---|
| 25 | $Item['Value'] = $PasswordHash->GetSalt();
|
|---|
| 26 | }
|
|---|
| 27 | $Output = '<input type="hidden" name="'.$Item['Name'].'" value="'.$Item['Value'].'" />';
|
|---|
| 28 | return $Output;
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | function OnLoad(array $Item): ?string
|
|---|
| 32 | {
|
|---|
| 33 | return $_POST[$Item['Name']];
|
|---|
| 34 | }
|
|---|
| 35 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.