renamed config classes

This commit is contained in:
Roland Gruber 2006-09-24 14:19:50 +00:00
parent 47f66d2f81
commit bbd7272c0c
10 changed files with 41 additions and 41 deletions

View File

@ -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();
@ -711,7 +711,7 @@ class Config {
*
* @package configuration
*/
class CfgMain {
class LAMCfgMain {
/** Default profile */
var $default;
@ -738,7 +738,7 @@ class CfgMain {
/**
* Loads preferences from config file
*/
function CfgMain() {
function LAMCfgMain() {
// set default values
$this->sessionTimeout = 30;
$this->logLevel = LOG_NOTICE;

View File

@ -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,7 +152,7 @@ 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

View File

@ -110,7 +110,7 @@ echo $_SESSION['header'];
<?php
if (sizeof($files) > 0) {
echo "<select size=1 name=\"filename\">\n";
$conf = new CfgMain();
$conf = new LAMCfgMain();
$defaultprofile = $conf->default;
for ($i = 0; $i < sizeof($files); $i++) {
if ($files[$i] == $defaultprofile) echo ("<option selected>" . $files[$i] . "</option>\n");

View File

@ -56,7 +56,7 @@ if (! $passwd) {
}
if (!isset($_SESSION['conf_config']) && isset($_POST['filename'])) {
$_SESSION['conf_config'] = new Config($_POST['filename']);
$_SESSION['conf_config'] = new LAMConfig($_POST['filename']);
}
$conf = &$_SESSION['conf_config'];

View File

@ -46,7 +46,7 @@ if (isset($_SESSION["mainconf_password"])) unset($_SESSION["mainconf_password"])
// check if user entered a password
if (isset($_POST['passwd'])) {
$cfgMain = new CfgMain();
$cfgMain = new LAMCfgMain();
if (isset($_POST['passwd']) && ($_POST['passwd'] == $cfgMain->password)) {
$_SESSION["mainconf_password"] = $_POST['passwd'];
metaRefresh("mainmanage.php");

View File

@ -41,7 +41,7 @@ session_save_path("../../sess");
setlanguage();
$cfg = new CfgMain();
$cfg = new LAMCfgMain();
// check if user is logged in
if (!isset($_SESSION["mainconf_password"]) || ($_SESSION["mainconf_password"] != $cfg->password)) {

View File

@ -60,7 +60,7 @@ echo $_SESSION['header'];
<?php
$cfg = new CfgMain();
$cfg = new LAMCfgMain();
// check if submit button was pressed
if ($_POST['submit']) {
// check master password
@ -78,7 +78,7 @@ if ($_POST['submit']) {
$file = is_file("../../config/" . $_POST['addprofile'] . ".conf");
if ($file) {
// load as config and write new password
$conf = new Config($_POST['addprofile']);
$conf = new LAMConfig($_POST['addprofile']);
$conf->Passwd = $_POST['addpassword'];
$conf->save();
$msg = _("Created new profile.");
@ -110,7 +110,7 @@ if ($_POST['submit']) {
// set new profile password
elseif ($_POST['action'] == "setpass") {
if ($_POST['setpassword'] && $_POST['setpassword2'] && ($_POST['setpassword'] == $_POST['setpassword2'])) {
$config = new Config($_POST['setprofile']);
$config = new LAMConfig($_POST['setprofile']);
$config->set_Passwd($_POST['setpassword']);
$config->save();
$msg = _("New password set successfully.");
@ -119,7 +119,7 @@ if ($_POST['submit']) {
}
// set default profile
elseif ($_POST['action'] == "setdefault") {
$config = new CfgMain();
$config = new LAMCfgMain();
$config->default = $_POST['defaultfilename'];
$config->save();
$msg = _("New default profile set successfully.");
@ -314,7 +314,7 @@ if (!isset($cfg->default) && !isset($cfg->password)) {
<select size=1 name="defaultfilename">
<?php
$files = getConfigProfiles();
$conf = new CfgMain();
$conf = new LAMCfgMain();
$defaultprofile = $conf->default;
for ($i = 0; $i < sizeof($files); $i++) {
if ($files[$i] == $defaultprofile) echo ("<option selected>" . $files[$i] . "</option>\n");

View File

@ -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

View File

@ -32,7 +32,7 @@ $Id$
/** configuration interface */
include ("../lib/config.inc");
$conf = new CfgMain();
$conf = new LAMCfgMain();
echo "<html><head><title></title><link rel=\"stylesheet\" type=\"text/css\" href=\"../style/layout.css\"></head><body>";
echo ("<b> Current Values</b><br><br>");
echo "<b>Password: </b>" . $conf->password . "<br>\n";
@ -51,7 +51,7 @@ $conf->save();
echo ("done<br>");
// 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 ("<br><font color=\"#FF0000\">Saving password failed!</font><br>");
if ($conf->default != "lam") echo ("<br><font color=\"#FF0000\">Saving Default failed!</font><br>");
echo ("done<br>");

View File

@ -32,7 +32,7 @@ $Id$
/** access to configuration functions */
include ("../lib/config.inc");
$conf = new Config('test');
$conf = new LAMConfig('test');
echo "<html><head><title></title><link rel=\"stylesheet\" type=\"text/css\" href=\"../style/layout.css\"></head><body>";
echo ("<br><br><big><b> Starting Test...</b></big><br><br>");
// now all preferences are loaded
@ -76,7 +76,7 @@ $conf->save();
echo ("done<br>");
// 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 ("<br><font color=\"#FF0000\">Saving ServerURL failed!</font><br>");
if ($conf2->get_cacheTimeout() != "33") echo ("<br><font color=\"#FF0000\">Saving Cache timeout failed!</font><br>");
if ($conf2->get_Passwd() != "123456abcde") echo ("<br><font color=\"#FF0000\">Saving password failed!</font><br>");