diff --git a/lam/lib/config.inc b/lam/lib/config.inc index 2b420127..cae429cf 100644 --- a/lam/lib/config.inc +++ b/lam/lib/config.inc @@ -120,7 +120,7 @@ function metaRefresh($page) { * * @package configuration */ -class Config { +class LAMConfig { /** Server address (e.g. ldap://127.0.0.1:389) */ var $ServerURL; @@ -182,7 +182,7 @@ class Config { * * @param integer $file Index number in config file array */ - function Config($file = 0) { + function LAMConfig($file = 0) { // load first profile if none is given if (!is_string($file)) { $profiles = getConfigProfiles(); @@ -672,7 +672,7 @@ class Config { if (($this->activeTypes == '') || !isset($this->activeTypes)) return array(); else return explode(",", $this->activeTypes); } - + /** * Sets the list of active types. * @@ -711,34 +711,34 @@ class Config { * * @package configuration */ -class CfgMain { +class LAMCfgMain { /** Default profile */ var $default; /** Password to change config.cfg */ var $password; - + /** Time of inactivity before session times out (minutes) */ var $sessionTimeout; - + /** log level */ var $logLevel; - + /** log destination ("SYSLOG":syslog, "/...":file, "NONE":none) */ var $logDestination; - + /** list of hosts which may access LAM */ var $allowedHosts; - + /** list of data fields to save in config file */ var $settings = array("password", "default", "sessionTimeout", "logLevel", "logDestination", "allowedHosts"); - + /** * Loads preferences from config file */ - function CfgMain() { + function LAMCfgMain() { // set default values $this->sessionTimeout = 30; $this->logLevel = LOG_NOTICE; @@ -825,7 +825,7 @@ class CfgMain { exit; } } - + } ?> diff --git a/lam/lib/security.inc b/lam/lib/security.inc index a331a218..0c7cc684 100644 --- a/lam/lib/security.inc +++ b/lam/lib/security.inc @@ -51,7 +51,7 @@ function startSecureSession() { // check session id if (! isset($_SESSION["sec_session_id"]) || ($_SESSION["sec_session_id"] != session_id())) { // session id is invalid - die(); + die(); } // check if client IP has not changed if (!isset($_SESSION["sec_client_ip"]) || ($_SESSION["sec_client_ip"] != $_SERVER['REMOTE_ADDR'])) { @@ -75,7 +75,7 @@ function startSecureSession() { * */ function checkClientIP() { - $cfg = new CfgMain(); + $cfg = new LAMCfgMain(); $allowedHosts = $cfg->allowedHosts; // skip test if no hosts are defined if ($allowedHosts == "") return; @@ -152,13 +152,13 @@ function logNewMessage($level, $message) { $possibleLevels = array(LOG_NOTICE => 'NOTICE', LOG_WARNING => 'WARNING', LOG_ERR => 'ERROR'); if (!in_array($level, array_keys($possibleLevels))) StatusMessage('ERROR', 'Invalid log level!', $level); if (isset($_SESSION['cfgMain'])) $cfg = $_SESSION['cfgMain']; - else $cfg = new CfgMain(); + else $cfg = new LAMCfgMain(); // check if logging is disabled if ($cfg->logDestination == 'NONE') return; // check if log level is high enough elseif ($cfg->logLevel < $level) return; // ok to log, build log message - $prefix = "LDAP Account Manager - " . $possibleLevels[$level] . ": "; + $prefix = "LDAP Account Manager - " . $possibleLevels[$level] . ": "; $message = $prefix . $message; // Syslog logging if ($cfg->logDestination == 'SYSLOG') { diff --git a/lam/templates/config/conflogin.php b/lam/templates/config/conflogin.php index 0b5bd48c..0046083d 100644 --- a/lam/templates/config/conflogin.php +++ b/lam/templates/config/conflogin.php @@ -110,7 +110,7 @@ echo $_SESSION['header']; 0) { echo " default; for ($i = 0; $i < sizeof($files); $i++) { if ($files[$i] == $defaultprofile) echo ("\n"); diff --git a/lam/templates/login.php b/lam/templates/login.php index 0957370b..32be5c37 100644 --- a/lam/templates/login.php +++ b/lam/templates/login.php @@ -417,16 +417,16 @@ if(!empty($_POST['checklogin'])) } // Reload loginpage after a profile change elseif(!empty($_POST['profileChange'])) { - $_SESSION['config'] = new Config($_POST['profile']); // Recreate the config object with the submited + $_SESSION['config'] = new LAMConfig($_POST['profile']); // Recreate the config object with the submited display_LoginPage($_SESSION['config']); // Load login page } // Load login page else { $_SESSION['loggedIn'] = false; - $default_Config = new CfgMain(); + $default_Config = new LAMCfgMain(); $default_Profile = $default_Config->default; - $_SESSION["config"] = new Config($default_Profile); // Create new Config object + $_SESSION["config"] = new LAMConfig($default_Profile); // Create new Config object $_SESSION["cfgMain"] = $default_Config; // Create new CfgMain object display_LoginPage($_SESSION["config"]); // Load Login page diff --git a/lam/tests/conf-main-test.php b/lam/tests/conf-main-test.php index e3265c5c..9e246f98 100644 --- a/lam/tests/conf-main-test.php +++ b/lam/tests/conf-main-test.php @@ -9,12 +9,12 @@ $Id$ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -32,7 +32,7 @@ $Id$ /** configuration interface */ include ("../lib/config.inc"); -$conf = new CfgMain(); +$conf = new LAMCfgMain(); echo ""; echo (" Current Values

"); echo "Password: " . $conf->password . "
\n"; @@ -51,7 +51,7 @@ $conf->save(); echo ("done
"); // at last all preferences are read from config.cfg and compared echo ("Loading and comparing..."); -$conf = new CfgMain(); +$conf = new LAMCfgMain(); if ($conf->password != "123456") echo ("
Saving password failed!
"); if ($conf->default != "lam") echo ("
Saving Default failed!
"); echo ("done
"); diff --git a/lam/tests/conf-test.php b/lam/tests/conf-test.php index 6831fca3..c03e04f3 100644 --- a/lam/tests/conf-test.php +++ b/lam/tests/conf-test.php @@ -32,7 +32,7 @@ $Id$ /** access to configuration functions */ include ("../lib/config.inc"); -$conf = new Config('test'); +$conf = new LAMConfig('test'); echo ""; echo ("

Starting Test...

"); // now all preferences are loaded @@ -76,7 +76,7 @@ $conf->save(); echo ("done
"); // at last all preferences are read from lam.conf and compared echo ("Loading and comparing..."); -$conf2 = new Config('test'); +$conf2 = new LAMConfig('test'); if ($conf2->get_ServerURL() != "ldap://123.345.678.123:777") echo ("
Saving ServerURL failed!
"); if ($conf2->get_cacheTimeout() != "33") echo ("
Saving Cache timeout failed!
"); if ($conf2->get_Passwd() != "123456abcde") echo ("
Saving password failed!
");