configurable license warning
This commit is contained in:
parent
028f8adcfd
commit
394cbedb2a
|
@ -237,6 +237,12 @@ $helpArray = array (
|
|||
"Text" => _('Password to unlock SSH key file.')),
|
||||
'287' => array ("Headline" => _('Licence'),
|
||||
"Text" => _('Please enter your licence key.')),
|
||||
'288' => array ("Headline" => _('Expiration warning'),
|
||||
"Text" => _('Please select how to be warned before your license expires.')),
|
||||
'289' => array ("Headline" => _('From address'),
|
||||
"Text" => _('This email address will be set as sender address of all mails.')),
|
||||
'290' => array ("Headline" => _('TO address'),
|
||||
"Text" => _('This email address will be set as TO address for the mails.')),
|
||||
// 300 - 399
|
||||
// profile editor, file upload
|
||||
"301" => array ("Headline" => _("RDN identifier"),
|
||||
|
|
|
@ -106,6 +106,17 @@ if (isset($_POST['submitFormData'])) {
|
|||
$licenseLines = explode("\n", $_POST['license']);
|
||||
$licenseLines = array_map('trim', $licenseLines);
|
||||
$cfg->setLicenseLines($licenseLines);
|
||||
$cfg->licenseWarningType = $_POST['licenseWarningType'];
|
||||
$cfg->licenseEmailFrom = $_POST['licenseEmailFrom'];
|
||||
$cfg->licenseEmailTo = $_POST['licenseEmailTo'];
|
||||
if ((($cfg->licenseWarningType === LAMCfgMain::LICENSE_WARNING_EMAIL) || ($cfg->licenseWarningType === LAMCfgMain::LICENSE_WARNING_ALL))
|
||||
&& !get_preg($cfg->licenseEmailFrom, 'email')) {
|
||||
$errors[] = _('License') . ': ' . _('From address') . ' - ' . _('Please enter a valid email address!');
|
||||
}
|
||||
if ((($cfg->licenseWarningType === LAMCfgMain::LICENSE_WARNING_EMAIL) || ($cfg->licenseWarningType === LAMCfgMain::LICENSE_WARNING_ALL))
|
||||
&& !get_preg($cfg->licenseEmailTo, 'email')) {
|
||||
$errors[] = _('License') . ': ' . _('TO address') . ' - ' . _('Please enter a valid email address!');
|
||||
}
|
||||
}
|
||||
// set session timeout
|
||||
$cfg->sessionTimeout = $_POST['sessionTimeout'];
|
||||
|
@ -307,6 +318,30 @@ printHeaderContents(_("Edit general settings"), '../..');
|
|||
if (isLAMProVersion()) {
|
||||
$row->add(new htmlSubTitle(_('Licence')), 12);
|
||||
$row->add(new htmlResponsiveInputTextarea('license', implode("\n", $cfg->getLicenseLines()), null, 10, _('Licence'), '287'), 12);
|
||||
$warningOptions = array(
|
||||
_('Screen') => LAMCfgMain::LICENSE_WARNING_SCREEN,
|
||||
_('Email') => LAMCfgMain::LICENSE_WARNING_EMAIL,
|
||||
_('Both') => LAMCfgMain::LICENSE_WARNING_ALL,
|
||||
_('None') => LAMCfgMain::LICENSE_WARNING_NONE,
|
||||
);
|
||||
$warningTypeSelect = new htmlResponsiveSelect('licenseWarningType', $warningOptions, array($cfg->getLicenseWarningType()), _('Expiration warning'), '288');
|
||||
$warningTypeSelect->setHasDescriptiveElements(true);
|
||||
$warningTypeSelect->setSortElements(false);
|
||||
$warningTypeSelect->setTableRowsToHide(array(
|
||||
LAMCfgMain::LICENSE_WARNING_SCREEN => array('licenseEmailFrom', 'licenseEmailTo'),
|
||||
LAMCfgMain::LICENSE_WARNING_NONE => array('licenseEmailFrom', 'licenseEmailTo'),
|
||||
));
|
||||
$warningTypeSelect->setTableRowsToShow(array(
|
||||
LAMCfgMain::LICENSE_WARNING_EMAIL => array('licenseEmailFrom', 'licenseEmailTo'),
|
||||
LAMCfgMain::LICENSE_WARNING_ALL => array('licenseEmailFrom', 'licenseEmailTo'),
|
||||
));
|
||||
$row->add($warningTypeSelect, 12);
|
||||
$licenseFrom = new htmlResponsiveInputField(_('From address'), 'licenseEmailFrom', $cfg->licenseEmailFrom, '289');
|
||||
$licenseFrom->setRequired(true);
|
||||
$row->add($licenseFrom, 12);
|
||||
$licenseTo = new htmlResponsiveInputField(_('TO address'), 'licenseEmailTo', $cfg->licenseEmailTo, '290');
|
||||
$licenseTo->setRequired(true);
|
||||
$row->add($licenseTo, 12);
|
||||
|
||||
$row->add(new htmlSpacer(null, '1rem'), true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue