";
echo ("
Starting Test...
");
// now all preferences are loaded
echo ("Loading preferences...");
$ServerURL = $conf->get_ServerURL();
$cachetimeout = $conf->get_cacheTimeout();
$Adminstring = $conf->get_Adminstring();
$Suff_users = $conf->get_Suffix('user');
$Suff_groups = $conf->get_Suffix('group');
$Suff_hosts = $conf->get_Suffix('host');
$Suff_domains = $conf->get_Suffix('smbDomain');
$userlistAttributes = $conf->get_listAttributes('user');
$grouplistAttributes = $conf->get_listAttributes('group');
$hostlistAttributes = $conf->get_listAttributes('host');
$maxlistentries = $conf->get_maxlistentries();
$defaultlanguage = $conf->get_defaultlanguage();
$scriptpath = $conf->get_scriptPath();
$scriptServer = $conf->get_scriptServers();
$scriptRights = $conf->get_scriptRights();
$moduleSettings = $conf->get_moduleSettings();
echo ("done
");
// next we modify them and save lam.conf
echo ("Changing preferences...");
$conf->set_ServerURL("ldap://123.345.678.123:777");
$conf->set_cacheTimeout("33");
$conf->set_Passwd("123456abcde");
$conf->set_Adminstring("uid=test,o=test,dc=org;uid=root,o=test2,c=de");
$conf->set_Suffix('user', "ou=test,o=test,c=de");
$conf->set_Suffix('group', "ou=testgrp,o=test,c=de");
$conf->set_Suffix('host', "ou=testhst,o=test,c=de");
$conf->set_Suffix('smbDomain', "ou=testdom,o=test,c=de");
$conf->set_listAttributes("#uid;#cn", 'user');
$conf->set_listAttributes("#gidNumber;#cn;#memberUID", 'group');
$conf->set_listAttributes("#cn;#uid;#description", 'host');
$conf->set_maxlistentries("54");
$conf->set_defaultlanguage("de_AT:iso639_de:Deutsch (Oesterreich)");
$conf->set_scriptPath("/var/www/lam/lib/script");
$conf->set_scriptServers("127.0.0.1");
$conf->set_scriptRights('775');
$conf->set_moduleSettings(array("test1" => array(11), "test2" => array("abc"), 'test3' => array(3)));
$conf->save();
echo ("done
");
// at last all preferences are read from lam.conf and compared
echo ("Loading and comparing...");
$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->check_Passwd("123456abcde")) echo ("
Saving password failed!
");
if ($conf2->get_Adminstring() != "uid=test,o=test,dc=org;uid=root,o=test2,c=de") echo ("
Saving admin string failed!
");
if ($conf2->get_Suffix('user') != "ou=test,o=test,c=de") echo ("
Saving user suffix failed!
");
if ($conf2->get_Suffix('group') != "ou=testgrp,o=test,c=de") echo ("
Saving group suffix failed!
");
if ($conf2->get_Suffix('host') != "ou=testhst,o=test,c=de") echo ("
Saving host suffix failed!
");
if ($conf2->get_Suffix('smbDomain') != "ou=testdom,o=test,c=de") echo ("
Saving domain suffix failed!
");
if ($conf2->get_listAttributes('user') != "#uid;#cn") echo ("
Saving userlistAttributes failed!
");
if ($conf2->get_listAttributes('group') != "#gidNumber;#cn;#memberUID") echo ("
Saving grouplistAttributes failed!
");
if ($conf2->get_listAttributes('host') != "#cn;#uid;#description") echo ("
Saving hostlistAttributes failed!
");
if ($conf2->get_maxlistentries() != "54") echo ("
Saving maxlistentries failed!
");
if ($conf2->get_defaultlanguage() != "de_AT:iso639_de:Deutsch (Oesterreich)") echo ("
Saving default language failed!
");
if ($conf2->get_scriptPath() != "/var/www/lam/lib/script") echo ("
Saving script path failed!
");
if ($conf2->get_scriptServers() != "127.0.0.1") echo ("
Saving script server failed!
");
if ($conf2->get_scriptRights() != '775') echo ("
Saving script rights failed!
");
$msettings = $conf2->get_moduleSettings();
if (($msettings['test1'][0] != 11) || ($msettings['test2'][0] != 'abc') || ($msettings['test3'][0] != '3')) echo ("
Saving module settings failed!
");
echo ("done
");
// restore old values
echo ("Restoring old preferences...");
$conf2->set_ServerURL($ServerURL);
$conf2->set_cacheTimeout($cachetimeout);
$conf2->set_Passwd('lam');
$conf2->set_Adminstring($Adminstring);
$conf2->set_Suffix('user', $Suff_users);
$conf2->set_Suffix('group', $Suff_groups);
$conf2->set_Suffix('host', $Suff_hosts);
$conf2->set_Suffix('smbDomain', $Suff_domains);
$conf2->set_listAttributes($userlistAttributes, 'user');
$conf2->set_listAttributes($grouplistAttributes, 'group');
$conf2->set_listAttributes($hostlistAttributes, 'host');
$conf2->set_maxlistentries($maxlistentries);
$conf2->set_defaultLanguage($defaultlanguage);
$conf2->set_scriptPath($scriptpath);
$conf2->set_scriptServers($scriptServer);
$conf2->set_moduleSettings($moduleSettings);
$conf2->set_scriptRights($scriptRights);
$conf2->save();
echo ("done
");
// finished
echo ("
Test is complete.");
?>