renamed cache_timeout to cachetimeout for config update

This commit is contained in:
Roland Gruber 2003-09-19 19:29:02 +00:00
parent f629cbcbfd
commit fcb6f1473b
4 changed files with 17 additions and 17 deletions

View File

@ -133,7 +133,7 @@ class Config {
var $samba3;
// LDAP cache timeout
var $cache_timeout;
var $cachetimeout;
// name of configuration file
var $file;
@ -151,7 +151,7 @@ class Config {
// reloads preferences from config file
function reload() {
// list of all settings in config file
$settings = array("ServerURL", "Passwd", "Admins", "usersuffix", "groupsuffix", "hostsuffix",
$settings = array("ServerURL", "Passwd", "Adminstring", "usersuffix", "groupsuffix", "hostsuffix",
"domainsuffix", "minuid", "maxuid", "mingid", "maxgid", "minmachine", "maxmachine",
"userlistattributes", "grouplistattributes", "hostlistattributes", "maxlistentries",
"defaultlanguage", "scriptpath", "scriptServer", "samba3", "cachetimeout");
@ -249,7 +249,7 @@ class Config {
continue;
}
if (strtolower(substr($line, 0, 14)) == "cachetimeout: ") {
$this->cache_timeout = chop(substr($line, 14, strlen($line)-14));
$this->cachetimeout = chop(substr($line, 14, strlen($line)-14));
continue;
}
}
@ -386,7 +386,7 @@ class Config {
continue;
}
if (strtolower(substr($file_array[$i], 0, 14)) == "cachetimeout: ") {
$file_array[$i] = "cacheTimeout: " . $this->cache_timeout . "\n";
$file_array[$i] = "cacheTimeout: " . $this->cachetimeout . "\n";
$save_cachetime = True;
continue;
}
@ -422,7 +422,7 @@ class Config {
if (!$save_scriptPath == True) array_push($file_array, "\n\n# Path to external Script\n" . "scriptPath: " . $this->scriptPath . "\n");
if (!$save_scriptServer == True) array_push($file_array, "\n\n# Server of external Script\n" . "scriptServer: " . $this->scriptServer . "\n");
if (!$save_samba3 == True) array_push($file_array, "\n\n# Set to \"yes\" only if you use the new Samba 3.x schema.\n" . "samba3: " . $this->samba3 . "\n");
if (!$save_cachetime == True) array_push($file_array, "\n\n# Number of minutes LAM caches LDAP searches.\n" . "cacheTimeout: " . $this->cache_timeout . "\n");
if (!$save_cachetime == True) array_push($file_array, "\n\n# Number of minutes LAM caches LDAP searches.\n" . "cacheTimeout: " . $this->cachetimeout . "\n");
$file = fopen($conffile, "w");
if ($file) {
for ($i = 0; $i < sizeof($file_array); $i++) fputs($file, $file_array[$i]);
@ -438,7 +438,7 @@ class Config {
// prints current preferences
function printconf() {
echo "<b>" . _("Server address") . ": </b>" . $this->ServerURL . "<br>";
echo "<b>" . _("Cache timeout") . ": </b>" . $this->cache_timeout . "<br>";
echo "<b>" . _("Cache timeout") . ": </b>" . $this->cachetimeout . "<br>";
echo "<b>" . _("Samba 3.x schema") . ": </b>" . $this->samba3 . "<br>";
echo "<b>" . _("UserSuffix") . ": </b>" . $this->Suff_users . "<br>";
echo "<b>" . _("GroupSuffix") . ": </b>" . $this->Suff_groups . "<br>";
@ -752,18 +752,18 @@ class Config {
// returns the LDAP cache timeout in minutes
function get_cacheTimeout() {
return $this->cache_timeout;
return $this->cachetimeout;
}
// returns the LDAP cache timeout in seconds
function get_cacheTimeoutSec() {
return $this->cache_timeout * 60;
return $this->cachetimeout * 60;
}
// sets the LDAP cache timeout in minutes
function set_cacheTimeout($value) {
if (is_numeric($value) && ($value > -1)) {
$this->cache_timeout = $value;
$this->cachetimeout = $value;
}
else return false;
return true;

View File

@ -42,7 +42,7 @@ if ($_POST['back'] || $_POST['submitconf']){
if ($_POST['passwd1']) $_SESSION['passwd1'] = $_POST['passwd1'];
if ($_POST['passwd2']) $_SESSION['passwd2'] = $_POST['passwd2'];
if ($_POST['serverurl']) $_SESSION['serverurl'] = $_POST['serverurl'];
if (isset($_POST['cache_timeout'])) $_SESSION['cache_timeout'] = $_POST['cache_timeout'];
if (isset($_POST['cachetimeout'])) $_SESSION['cachetimeout'] = $_POST['cachetimeout'];
if ($_POST['admins']) $_SESSION['admins'] = $_POST['admins'];
if ($_POST['suffusers']) $_SESSION['suffusers'] = $_POST['suffusers'];
if ($_POST['suffgroups']) $_SESSION['suffgroups'] = $_POST['suffgroups'];
@ -148,7 +148,7 @@ echo ("<tr><td colspan=3>&nbsp</td></tr>");
// LDAP cache timeout
echo ("<tr><td align=\"right\"><b>".
_("Cache timeout") . " *: </b></td>".
"<td><select name=\"cache_timeout\">\n<option selected>".$conf->get_cacheTimeout()."</option>\n");
"<td><select name=\"cachetimeout\">\n<option selected>".$conf->get_cacheTimeout()."</option>\n");
if ($conf->get_cacheTimeout() != 0) echo("<option>0</option>\n");
if ($conf->get_cacheTimeout() != 1) echo("<option>1</option>\n");
if ($conf->get_cacheTimeout() != 2) echo("<option>2</option>\n");

View File

@ -38,7 +38,7 @@ if ($_SESSION['passwd']) $passwd = $_SESSION['passwd'];
if ($_SESSION['passwd1']) $passwd1 = $_SESSION['passwd1'];
if ($_SESSION['passwd2']) $passwd2 = $_SESSION['passwd2'];
if ($_SESSION['serverurl']) $serverurl = $_SESSION['serverurl'];
if (isset($_SESSION['cache_timeout'])) $cache_timeout = $_SESSION['cache_timeout'];
if (isset($_SESSION['cachetimeout'])) $cachetimeout = $_SESSION['cachetimeout'];
if ($_SESSION['admins']) $admins = $_SESSION['admins'];
if ($_SESSION['suffusers']) $suffusers = $_SESSION['suffusers'];
if ($_SESSION['suffgroups']) $suffgroups = $_SESSION['suffgroups'];
@ -82,7 +82,7 @@ if (!$serverurl) {
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
exit;
}
if (!isset($cache_timeout) || !(is_numeric($cache_timeout)) || !($cache_timeout > -1)) {
if (!isset($cachetimeout) || !(is_numeric($cachetimeout)) || !($cachetimeout > -1)) {
echo ("<font color=\"red\"><b>" . _("Cache timeout is empty!") . "</b></font>");
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
exit;
@ -189,7 +189,7 @@ if ($scriptserver && !is_string($scriptserver)) {
// set new preferences
$conf->set_ServerURL($serverurl);
$conf->set_cacheTimeout($cache_timeout);
$conf->set_cacheTimeout($cachetimeout);
$conf->set_Adminstring($admins);
$conf->set_UserSuffix($suffusers);
$conf->set_GroupSuffix($suffgroups);
@ -235,7 +235,7 @@ unset($_SESSION['passwd']);
unset($_SESSION['passwd1']);
unset($_SESSION['passwd2']);
unset($_SESSION['serverurl']);
unset($_SESSION['cache_timeout']);
unset($_SESSION['cachetimeout']);
unset($_SESSION['admins']);
unset($_SESSION['suffusers']);
unset($_SESSION['suffgroups']);

View File

@ -32,7 +32,7 @@ echo ("<br><br><big><b> Starting Test...</b></big><br><br>");
// now all prferences are loaded
echo ("Loading preferences...");
$ServerURL = $conf->get_ServerURL();
$cache_timeout = $conf->get_cacheTimeout();
$cachetimeout = $conf->get_cacheTimeout();
$Passwd = $conf->get_Passwd();
$Adminstring = $conf->get_Adminstring();
$Suff_users = $conf->get_UserSuffix();
@ -109,7 +109,7 @@ echo ("done<br>");
// restore old values
echo ("Restoring old preferences...");
$conf2->set_ServerURL($ServerURL);
$conf2->set_cacheTimeout($cache_timeout);
$conf2->set_cacheTimeout($cachetimeout);
$conf2->set_Passwd($Passwd);
$conf2->set_Adminstring($Adminstring);
$conf2->set_UserSuffix($Suff_users);