added license key
This commit is contained in:
parent
619b715a60
commit
08a329eb7d
|
@ -217,6 +217,8 @@ $helpArray = array (
|
|||
"Text" => _('Path to SSH key file to connect to lamdaemon server. If empty then password authentication with the person\'s password who is logged into LAM will be used.')),
|
||||
'286' => array ("Headline" => _('SSH key password'),
|
||||
"Text" => _('Password to unlock SSH key file.')),
|
||||
'287' => array ("Headline" => _('License'),
|
||||
"Text" => _('Please enter your license key.')),
|
||||
// 300 - 399
|
||||
// profile editor, file upload
|
||||
"301" => array ("Headline" => _("RDN identifier"),
|
||||
|
|
|
@ -2113,13 +2113,18 @@ class LAMCfgMain {
|
|||
/** error reporting */
|
||||
public $errorReporting = self::ERROR_REPORTING_DEFAULT;
|
||||
|
||||
/** license data */
|
||||
private $license = '';
|
||||
|
||||
/** list of data fields to save in config file */
|
||||
private $settings = array("password", "default", "sessionTimeout",
|
||||
"logLevel", "logDestination", "allowedHosts", "passwordMinLength",
|
||||
"passwordMinUpper", "passwordMinLower", "passwordMinNumeric",
|
||||
"passwordMinClasses", "passwordMinSymbol", 'checkedRulesCount',
|
||||
'passwordMustNotContainUser', 'passwordMustNotContain3Chars',
|
||||
"mailEOL", 'errorReporting', 'encryptSession', 'allowedHostsSelfService');
|
||||
"mailEOL", 'errorReporting', 'encryptSession', 'allowedHostsSelfService',
|
||||
'license'
|
||||
);
|
||||
|
||||
/**
|
||||
* Loads preferences from config file
|
||||
|
@ -2213,6 +2218,7 @@ class LAMCfgMain {
|
|||
if (!in_array("passwordMustNotContainUser", $saved)) array_push($file_array, "\n\n# Password: must not contain user name\n" . "passwordMustNotContainUser: " . $this->passwordMustNotContainUser);
|
||||
if (!in_array("mailEOL", $saved)) array_push($file_array, "\n\n# Email format (default/unix)\n" . "mailEOL: " . $this->mailEOL);
|
||||
if (!in_array("errorReporting", $saved)) array_push($file_array, "\n\n# PHP error reporting (default/system)\n" . "errorReporting: " . $this->errorReporting);
|
||||
if (!in_array("license", $saved)) array_push($file_array, "\n\n# License\n" . "license: " . $this->license);
|
||||
$file = @fopen($this->conffile, "w");
|
||||
if ($file) {
|
||||
for ($i = 0; $i < sizeof($file_array); $i++) fputs($file, $file_array[$i]);
|
||||
|
@ -2492,6 +2498,24 @@ class LAMCfgMain {
|
|||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the license key as multiple lines.
|
||||
*
|
||||
* @return String license
|
||||
*/
|
||||
public function getLicenseLines() {
|
||||
return explode(LAMConfig::LINE_SEPARATOR, $this->license);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the license key as multiple lines.
|
||||
*
|
||||
* @param String $license license
|
||||
*/
|
||||
public function setLicenseLines($licenseLines) {
|
||||
$this->license = implode(LAMConfig::LINE_SEPARATOR, $licenseLines);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -519,6 +519,11 @@ div.confModList {
|
|||
overflow-y: auto;
|
||||
}
|
||||
|
||||
div.licenseInfo {
|
||||
display: inline-block;
|
||||
padding: 20px;
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
/* schema browser */
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
$Id$
|
||||
|
||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||
Copyright (C) 2003 - 2015 Roland Gruber
|
||||
Copyright (C) 2003 - 2016 Roland Gruber
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -34,6 +34,9 @@ $Id$
|
|||
include_once('../../lib/config.inc');
|
||||
/** Used to print status messages */
|
||||
include_once('../../lib/status.inc');
|
||||
if (isLAMProVersion()) {
|
||||
include_once("../../lib/env.inc");
|
||||
}
|
||||
|
||||
// start session
|
||||
if (strtolower(session_module_name()) == 'files') {
|
||||
|
@ -63,7 +66,6 @@ if (isset($_POST['passwd'])) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
echo $_SESSION['header'];
|
||||
|
||||
?>
|
||||
|
@ -132,6 +134,9 @@ echo $_SESSION['header'];
|
|||
if (!$cfgMain->isWritable()) {
|
||||
StatusMessage('WARN', 'The config file is not writable.', 'Your changes cannot be saved until you make the file writable for the webserver user.');
|
||||
}
|
||||
if (!empty($_GET['invalidLicense'])) {
|
||||
StatusMessage('WARN', _('Invalid license'), _('Please setup your license data.'));
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
<!-- form to change main options -->
|
||||
|
@ -181,8 +186,14 @@ echo $_SESSION['header'];
|
|||
</table>
|
||||
</form>
|
||||
|
||||
<p><br><br></p>
|
||||
<?php
|
||||
if (isLAMProVersion()) {
|
||||
$printer = new \LAM\ENV\LAMLicenseInfoPrinter();
|
||||
$printer->printLicenseInfo();
|
||||
}
|
||||
?>
|
||||
|
||||
<p><br><br></p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
$Id$
|
||||
|
||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||
Copyright (C) 2003 - 2014 Roland Gruber
|
||||
Copyright (C) 2003 - 2016 Roland Gruber
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -34,6 +34,8 @@ $Id$
|
|||
include_once('../../lib/config.inc');
|
||||
/** Used to print status messages */
|
||||
include_once('../../lib/status.inc');
|
||||
/** LAM Pro */
|
||||
include_once('../../lib/selfService.inc');
|
||||
|
||||
// start session
|
||||
if (strtolower(session_module_name()) == 'files') {
|
||||
|
@ -81,6 +83,12 @@ if (isset($_POST['submitFormData'])) {
|
|||
}
|
||||
else $errors[] = _("Master passwords are different or empty!");
|
||||
}
|
||||
// set license
|
||||
if (isLAMProVersion()) {
|
||||
$licenseLines = explode("\n", $_POST['license']);
|
||||
$licenseLines = array_map('trim', $licenseLines);
|
||||
$cfg->setLicenseLines($licenseLines);
|
||||
}
|
||||
// set session timeout
|
||||
$cfg->sessionTimeout = $_POST['sessionTimeout'];
|
||||
// set allowed hosts
|
||||
|
@ -291,6 +299,16 @@ if (!$cfg->isWritable()) {
|
|||
$container->addElement(new htmlStatusMessage('WARN', 'The config file is not writable.', 'Your changes cannot be saved until you make the file writable for the webserver user.'), true);
|
||||
}
|
||||
|
||||
// license
|
||||
if (isLAMProVersion()) {
|
||||
$container->addElement(new htmlSubTitle(_('License')), true);
|
||||
$licenseTable = new htmlTable();
|
||||
$licenseTable->addElement(new htmlTableExtendedInputTextarea('license', implode("\n", $cfg->getLicenseLines()), 50, 10, _('License'), '287'));
|
||||
$container->addElement($licenseTable, true);
|
||||
|
||||
$container->addElement(new htmlSpacer(null, '10px'), true);
|
||||
}
|
||||
|
||||
// security settings
|
||||
$container->addElement(new htmlSubTitle(_("Security settings")), true);
|
||||
$securityTable = new htmlTable();
|
||||
|
|
|
@ -41,7 +41,12 @@ include_once("../lib/security.inc");
|
|||
/** self service functions */
|
||||
include_once("../lib/selfService.inc");
|
||||
/** access to configuration options */
|
||||
include_once("../lib/config.inc"); // Include config.inc which provides Config class
|
||||
include_once("../lib/config.inc");
|
||||
if (isLAMProVersion()) {
|
||||
include_once("../lib/env.inc");
|
||||
$validator = new \LAM\ENV\LAMLicenseValidator();
|
||||
$validator->validateAndRedirect();
|
||||
}
|
||||
|
||||
/** Upgrade functions */
|
||||
include_once("../lib/upgrade.inc");
|
||||
|
|
Loading…
Reference in New Issue