attributes are no longer seperated by modules,
attributes are returned as arrays
This commit is contained in:
parent
0902c105ef
commit
b8f5597679
|
@ -97,14 +97,13 @@ function loadUserProfile($profile) {
|
|||
// search keywords
|
||||
$parts = array();
|
||||
$parts = split(": ", $line);
|
||||
if (sizeof($parts) < 3) continue; // ignore malformed settings
|
||||
if (sizeof($parts) != 2) continue; // ignore malformed settings
|
||||
else {
|
||||
$module = array_shift($parts);
|
||||
$option = array_shift($parts);
|
||||
$values = $parts;
|
||||
$option = $parts[0];
|
||||
$value = $parts[1];
|
||||
// remove line ends
|
||||
for ($i = 0; $i < sizeof($values); $i++) $values[$i] = chop($values[$i]);
|
||||
$settings[$module][$option] = $values;
|
||||
$value = chop($value);
|
||||
$settings[$option] = explode("+::+", $value);
|
||||
}
|
||||
}
|
||||
fclose($file);
|
||||
|
@ -135,14 +134,13 @@ function loadGroupProfile($profile) {
|
|||
// search keywords
|
||||
$parts = array();
|
||||
$parts = split(": ", $line);
|
||||
if (sizeof($parts) < 3) continue; // ignore malformed settings
|
||||
if (sizeof($parts) != 2) continue; // ignore malformed settings
|
||||
else {
|
||||
$module = array_shift($parts);
|
||||
$option = array_shift($parts);
|
||||
$values = $parts;
|
||||
$option = $parts[0];
|
||||
$value = $parts[1];
|
||||
// remove line ends
|
||||
for ($i = 0; $i < sizeof($values); $i++) $values[$i] = chop($values[$i]);
|
||||
$settings[$module][$option] = $values;
|
||||
$value = chop($value);
|
||||
$settings[$option] = explode("+::+", $value);
|
||||
}
|
||||
}
|
||||
fclose($file);
|
||||
|
@ -173,14 +171,13 @@ function loadHostProfile($profile) {
|
|||
// search keywords
|
||||
$parts = array();
|
||||
$parts = split(": ", $line);
|
||||
if (sizeof($parts) < 3) continue; // ignore malformed settings
|
||||
if (sizeof($parts) != 2) continue; // ignore malformed settings
|
||||
else {
|
||||
$module = array_shift($parts);
|
||||
$option = array_shift($parts);
|
||||
$values = $parts;
|
||||
$option = $parts[0];
|
||||
$value = $parts[1];
|
||||
// remove line ends
|
||||
for ($i = 0; $i < sizeof($values); $i++) $values[$i] = chop($values[$i]);
|
||||
$settings[$module][$option] = $values;
|
||||
$value = chop($value);
|
||||
$settings[$option] = explode("+::+", $value);
|
||||
}
|
||||
}
|
||||
fclose($file);
|
||||
|
@ -198,7 +195,7 @@ function loadHostProfile($profile) {
|
|||
// saves an hash array (attribute => value) to an user profile
|
||||
// file is created, if needed
|
||||
// $profile: name of the user profile (without .pru)
|
||||
// $attributes: hash array(module => array(attribute => value))
|
||||
// $attributes: hash array(attribute => value)
|
||||
function saveUserProfile($attributes, $profile) {
|
||||
if (!$_SESSION['loggedIn'] == true) return false;
|
||||
// check profile name
|
||||
|
@ -210,14 +207,11 @@ function saveUserProfile($attributes, $profile) {
|
|||
$file = @fopen($path, "w");
|
||||
if ($file) {
|
||||
// write attributes
|
||||
$modules = array_keys($attributes);
|
||||
for ($m = 0; $m < sizeof($modules); $m++) {
|
||||
$keys = array_keys($attributes[$modules[$m]]);
|
||||
$keys = array_keys($attributes);
|
||||
for ($i = 0; $i < sizeof($keys); $i++) {
|
||||
$line = $modules[$m] . ": " . $keys[$i] . ": " . $attributes[$modules[$m]][$keys[$i]] . "\n";
|
||||
$line = $keys[$i] . ": " . implode("+::+", $attributes[$keys[$i]]) . "\n";
|
||||
fputs($file, $line);
|
||||
}
|
||||
}
|
||||
// close file
|
||||
fclose($file);
|
||||
}
|
||||
|
@ -231,7 +225,7 @@ function saveUserProfile($attributes, $profile) {
|
|||
// saves an hash array (attribute => value) to an group profile
|
||||
// file is created, if needed
|
||||
// $profile: name of the group profile (without .prg)
|
||||
// $attributes: hash array(module => array(attribute => value))
|
||||
// $attributes: hash array(attribute => value)
|
||||
function saveGroupProfile($attributes, $profile) {
|
||||
if (!$_SESSION['loggedIn'] == true) return false;
|
||||
// check profile name
|
||||
|
@ -243,14 +237,11 @@ function saveGroupProfile($attributes, $profile) {
|
|||
$file = @fopen($path, "w");
|
||||
if ($file) {
|
||||
// write attributes
|
||||
$modules = array_keys($attributes);
|
||||
for ($m = 0; $m < sizeof($modules); $m++) {
|
||||
$keys = array_keys($attributes[$modules[$m]]);
|
||||
$keys = array_keys($attributes);
|
||||
for ($i = 0; $i < sizeof($keys); $i++) {
|
||||
$line = $modules[$m] . ": " . $keys[$i] . ": " . $attributes[$modules[$m]][$keys[$i]] . "\n";
|
||||
$line = $keys[$i] . ": " . implode("+::+", $attributes[$keys[$i]]) . "\n";
|
||||
fputs($file, $line);
|
||||
}
|
||||
}
|
||||
// close file
|
||||
fclose($file);
|
||||
}
|
||||
|
@ -264,7 +255,7 @@ function saveGroupProfile($attributes, $profile) {
|
|||
// saves an hash array (attribute => value) to an host profile
|
||||
// file is created, if needed
|
||||
// $profile: name of the host profile (without .prh)
|
||||
// $attributes: hash array(module => array(attribute => value))
|
||||
// $attributes: hash array(attribute => value)
|
||||
function saveHostProfile($attributes, $profile) {
|
||||
if (!$_SESSION['loggedIn'] == true) return false;
|
||||
// check profile name
|
||||
|
@ -276,14 +267,11 @@ function saveHostProfile($attributes, $profile) {
|
|||
$file = @fopen($path, "w");
|
||||
if ($file) {
|
||||
// write attributes
|
||||
$modules = array_keys($attributes);
|
||||
for ($m = 0; $m < sizeof($modules); $m++) {
|
||||
$keys = array_keys($attributes[$modules[$m]]);
|
||||
$keys = array_keys($attributes);
|
||||
for ($i = 0; $i < sizeof($keys); $i++) {
|
||||
$line = $modules[$m] . ": " . $keys[$i] . ": " . $attributes[$modules[$m]][$keys[$i]] . "\n";
|
||||
$line = $keys[$i] . ": " . implode("+::+", $attributes[$keys[$i]]) . "\n";
|
||||
fputs($file, $line);
|
||||
}
|
||||
}
|
||||
// close file
|
||||
fclose($file);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue