refactoring

This commit is contained in:
Roland Gruber 2018-12-26 09:53:58 +01:00
parent 2ce96573c0
commit 57d5e1ce3f
2 changed files with 132 additions and 65 deletions

View File

@ -98,8 +98,12 @@ abstract class baseModule {
$this->scope = $scope; $this->scope = $scope;
// load configuration // load configuration
if ($this->can_manage() || ($scope == 'none')) { if ($this->can_manage() || ($scope == 'none')) {
if (isset($_SESSION['config'])) $this->moduleSettings = $_SESSION['config']->get_moduleSettings(); if (isset($_SESSION['config'])) {
if (isset($_SESSION['selfServiceProfile'])) $this->selfServiceSettings = $_SESSION['selfServiceProfile']; $this->moduleSettings = $_SESSION['config']->get_moduleSettings();
}
if (isset($_SESSION['selfServiceProfile'])) {
$this->selfServiceSettings = $_SESSION['selfServiceProfile'];
}
// initialize module // initialize module
$this->load_Messages(); $this->load_Messages();
$this->meta = $this->get_metaData(); $this->meta = $this->get_metaData();
@ -415,8 +419,7 @@ abstract class baseModule {
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function is_base_module() { public function is_base_module() {
if (isset($this->meta['is_base']) && ($this->meta['is_base'] == true)) return true; return (isset($this->meta['is_base']) && ($this->meta['is_base']));
else return false;
} }
/** /**
@ -436,8 +439,10 @@ abstract class baseModule {
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function get_ldap_filter($typeId) { public function get_ldap_filter($typeId) {
if (isset($this->meta['ldap_filter'])) return $this->meta['ldap_filter']; if (isset($this->meta['ldap_filter'])) {
else return ""; return $this->meta['ldap_filter'];
}
return "";
} }
/** /**
@ -454,8 +459,10 @@ abstract class baseModule {
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function get_alias() { public function get_alias() {
if (isset($this->meta['alias'])) return $this->meta['alias']; if (isset($this->meta['alias'])) {
else return get_class($this); return $this->meta['alias'];
}
return get_class($this);
} }
/** /**
@ -475,8 +482,10 @@ abstract class baseModule {
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function get_RDNAttributes($typeId) { public function get_RDNAttributes($typeId) {
if (isset($this->meta['RDN'])) return $this->meta['RDN']; if (isset($this->meta['RDN'])) {
else return array(); return $this->meta['RDN'];
}
return array();
} }
/** /**
@ -498,9 +507,11 @@ abstract class baseModule {
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function get_dependencies() { public function get_dependencies() {
if (isset($this->meta['dependencies'])) return $this->meta['dependencies']; if (isset($this->meta['dependencies'])) {
else return array('depends' => array(), 'conflicts' => array()); return $this->meta['dependencies'];
} }
return array('depends' => array(), 'conflicts' => array());
}
/** /**
* This function defines what attributes will be used in the account profiles and their appearance in the profile editor. * This function defines what attributes will be used in the account profiles and their appearance in the profile editor.
@ -519,8 +530,10 @@ abstract class baseModule {
* @see htmlElement * @see htmlElement
*/ */
public function get_profileOptions($typeId) { public function get_profileOptions($typeId) {
if (isset($this->meta['profile_options'])) return $this->meta['profile_options']; if (isset($this->meta['profile_options'])) {
else return array(); return $this->meta['profile_options'];
}
return array();
} }
/** /**
@ -557,7 +570,9 @@ abstract class baseModule {
// check by regular expression (from account.inc) // check by regular expression (from account.inc)
case "ext_preg": case "ext_preg":
// ignore empty fileds // ignore empty fileds
if ($options[$identifiers[$i]][0] == '') continue; if ($options[$identifiers[$i]][0] == '') {
continue;
}
if (! get_preg($options[$identifiers[$i]][0], $this->meta['profile_checks'][$identifiers[$i]]['regex'])) { if (! get_preg($options[$identifiers[$i]][0], $this->meta['profile_checks'][$identifiers[$i]]['regex'])) {
$messages[] = $this->meta['profile_checks'][$identifiers[$i]]['error_message']; $messages[] = $this->meta['profile_checks'][$identifiers[$i]]['error_message'];
} }
@ -565,7 +580,9 @@ abstract class baseModule {
// check by regular expression (case insensitive) // check by regular expression (case insensitive)
case 'regex_i': case 'regex_i':
// ignore empty fileds // ignore empty fileds
if ($options[$identifiers[$i]][0] == '') continue; if ($options[$identifiers[$i]][0] == '') {
continue;
}
if (! preg_match('/' . $this->meta['profile_checks'][$identifiers[$i]]['regex'] . '/i', $options[$identifiers[$i]][0])) { if (! preg_match('/' . $this->meta['profile_checks'][$identifiers[$i]]['regex'] . '/i', $options[$identifiers[$i]][0])) {
$messages[] = $this->meta['profile_checks'][$identifiers[$i]]['error_message']; $messages[] = $this->meta['profile_checks'][$identifiers[$i]]['error_message'];
} }
@ -573,7 +590,9 @@ abstract class baseModule {
// check by regular expression (case sensitive) // check by regular expression (case sensitive)
case 'regex': case 'regex':
// ignore empty fileds // ignore empty fileds
if ($options[$identifiers[$i]][0] == '') continue; if ($options[$identifiers[$i]][0] == '') {
continue;
}
if (! preg_match('/' . $this->meta['profile_checks'][$identifiers[$i]]['regex'] . '/', $options[$identifiers[$i]][0])) { if (! preg_match('/' . $this->meta['profile_checks'][$identifiers[$i]]['regex'] . '/', $options[$identifiers[$i]][0])) {
$messages[] = $this->meta['profile_checks'][$identifiers[$i]]['error_message']; $messages[] = $this->meta['profile_checks'][$identifiers[$i]]['error_message'];
} }
@ -581,7 +600,9 @@ abstract class baseModule {
// check by integer comparison (greater) // check by integer comparison (greater)
case 'int_greater': case 'int_greater':
// ignore if both fields are empty // ignore if both fields are empty
if (($options[$this->meta['profile_checks'][$identifiers[$i]]['cmp_name1']][0] == '') && ($options[$this->meta['profile_checks'][$identifiers[$i]]['cmp_name2']][0] == '')) continue; if (($options[$this->meta['profile_checks'][$identifiers[$i]]['cmp_name1']][0] == '') && ($options[$this->meta['profile_checks'][$identifiers[$i]]['cmp_name2']][0] == '')) {
continue;
}
// print error message if only one field is empty // print error message if only one field is empty
if (($options[$this->meta['profile_checks'][$identifiers[$i]]['cmp_name1']][0] == '') || ($options[$this->meta['profile_checks'][$identifiers[$i]]['cmp_name2']][0] == '')) { if (($options[$this->meta['profile_checks'][$identifiers[$i]]['cmp_name1']][0] == '') || ($options[$this->meta['profile_checks'][$identifiers[$i]]['cmp_name2']][0] == '')) {
$messages[] = $this->meta['profile_checks'][$identifiers[$i]]['error_message']; $messages[] = $this->meta['profile_checks'][$identifiers[$i]]['error_message'];
@ -595,7 +616,9 @@ abstract class baseModule {
// check by integer comparison (greater or equal) // check by integer comparison (greater or equal)
case 'int_greaterOrEqual': case 'int_greaterOrEqual':
// ignore if both fields are empty // ignore if both fields are empty
if (($options[$this->meta['profile_checks'][$identifiers[$i]]['cmp_name1']][0] == '') && ($options[$this->meta['profile_checks'][$identifiers[$i]]['cmp_name2']][0] == '')) continue; if (($options[$this->meta['profile_checks'][$identifiers[$i]]['cmp_name1']][0] == '') && ($options[$this->meta['profile_checks'][$identifiers[$i]]['cmp_name2']][0] == '')) {
continue;
}
// print error message if only one field is empty // print error message if only one field is empty
if (($options[$this->meta['profile_checks'][$identifiers[$i]]['cmp_name1']][0] == '') || ($options[$this->meta['profile_checks'][$identifiers[$i]]['cmp_name2']][0] == '')) { if (($options[$this->meta['profile_checks'][$identifiers[$i]]['cmp_name1']][0] == '') || ($options[$this->meta['profile_checks'][$identifiers[$i]]['cmp_name2']][0] == '')) {
$messages[] = $this->meta['profile_checks'][$identifiers[$i]]['error_message']; $messages[] = $this->meta['profile_checks'][$identifiers[$i]]['error_message'];
@ -714,7 +737,9 @@ abstract class baseModule {
// check by regular expression (from account.inc) // check by regular expression (from account.inc)
case "ext_preg": case "ext_preg":
// ignore empty fileds // ignore empty fileds
if ($options[$identifiers[$i]][0] == '') continue; if ($options[$identifiers[$i]][0] == '') {
continue;
}
if (! get_preg($options[$identifiers[$i]][0], $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['regex'])) { if (! get_preg($options[$identifiers[$i]][0], $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['regex'])) {
$messages[] = $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['error_message']; $messages[] = $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['error_message'];
} }
@ -722,7 +747,9 @@ abstract class baseModule {
// check by regular expression (case insensitive) // check by regular expression (case insensitive)
case "regex_i": case "regex_i":
// ignore empty fileds // ignore empty fileds
if ($options[$identifiers[$i]][0] == '') continue; if ($options[$identifiers[$i]][0] == '') {
continue;
}
if (! preg_match('/' . $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['regex'] . '/i', $options[$identifiers[$i]][0])) { if (! preg_match('/' . $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['regex'] . '/i', $options[$identifiers[$i]][0])) {
$messages[] = $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['error_message']; $messages[] = $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['error_message'];
} }
@ -730,7 +757,9 @@ abstract class baseModule {
// check by regular expression (case sensitive) // check by regular expression (case sensitive)
case "regex": case "regex":
// ignore empty fileds // ignore empty fileds
if ($options[$identifiers[$i]][0] == '') continue; if ($options[$identifiers[$i]][0] == '') {
continue;
}
if (! preg_match('/' . $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['regex'] . '/', $options[$identifiers[$i]][0])) { if (! preg_match('/' . $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['regex'] . '/', $options[$identifiers[$i]][0])) {
$messages[] = $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['error_message']; $messages[] = $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['error_message'];
} }
@ -738,7 +767,9 @@ abstract class baseModule {
// check by integer comparison (greater) // check by integer comparison (greater)
case "int_greater": case "int_greater":
// ignore if both fields are empty // ignore if both fields are empty
if (($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name1']][0] == '') && ($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name2']][0] == '')) continue; if (($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name1']][0] == '') && ($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name2']][0] == '')) {
continue;
}
// print error message if only one field is empty // print error message if only one field is empty
if (($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name1']][0] == '') || ($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name2']][0] == '')) { if (($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name1']][0] == '') || ($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name2']][0] == '')) {
$messages[] = $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['error_message']; $messages[] = $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['error_message'];
@ -752,7 +783,9 @@ abstract class baseModule {
// check by integer comparison (greater or equal) // check by integer comparison (greater or equal)
case "int_greaterOrEqual": case "int_greaterOrEqual":
// ignore if both fields are empty // ignore if both fields are empty
if (($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name1']][0] == '') && ($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name2']][0] == '')) continue; if (($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name1']][0] == '') && ($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name2']][0] == '')) {
continue;
}
// print error message if only one field is empty // print error message if only one field is empty
if (($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name1']][0] == '') || ($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name2']][0] == '')) { if (($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name1']][0] == '') || ($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name2']][0] == '')) {
$messages[] = $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['error_message']; $messages[] = $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['error_message'];
@ -889,8 +922,10 @@ abstract class baseModule {
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function get_uploadColumns($selectedModules, &$type) { public function get_uploadColumns($selectedModules, &$type) {
if (isset($this->meta['upload_columns'])) return $this->meta['upload_columns']; if (isset($this->meta['upload_columns'])) {
else return array(); return $this->meta['upload_columns'];
}
return array();
} }
/** /**
@ -905,8 +940,10 @@ abstract class baseModule {
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function get_uploadPreDepends() { public function get_uploadPreDepends() {
if (isset($this->meta['upload_preDepends'])) return $this->meta['upload_preDepends']; if (isset($this->meta['upload_preDepends'])) {
else return array(); return $this->meta['upload_preDepends'];
}
return array();
} }
/** /**
@ -1684,8 +1721,10 @@ abstract class baseModule {
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function getManagedObjectClasses($typeId) { public function getManagedObjectClasses($typeId) {
if (isset($this->meta['objectClasses']) && is_array($this->meta['objectClasses'])) return $this->meta['objectClasses']; if (isset($this->meta['objectClasses']) && is_array($this->meta['objectClasses'])) {
else return array(); return $this->meta['objectClasses'];
}
return array();
} }
/** /**
@ -1701,8 +1740,10 @@ abstract class baseModule {
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function getLDAPAliases($typeId) { public function getLDAPAliases($typeId) {
if (isset($this->meta['LDAPaliases']) && is_array($this->meta['LDAPaliases'])) return $this->meta['LDAPaliases']; if (isset($this->meta['LDAPaliases']) && is_array($this->meta['LDAPaliases'])) {
else return array(); return $this->meta['LDAPaliases'];
}
return array();
} }
/** /**
@ -1715,8 +1756,10 @@ abstract class baseModule {
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function getManagedAttributes($typeId) { public function getManagedAttributes($typeId) {
if (isset($this->meta['attributes']) && is_array($this->meta['attributes'])) return $this->meta['attributes']; if (isset($this->meta['attributes']) && is_array($this->meta['attributes'])) {
else return array(); return $this->meta['attributes'];
}
return array();
} }
/** /**
@ -1728,8 +1771,10 @@ abstract class baseModule {
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function getManagedHiddenAttributes($typeId) { public function getManagedHiddenAttributes($typeId) {
if (isset($this->meta['hiddenAttributes']) && is_array($this->meta['hiddenAttributes'])) return $this->meta['hiddenAttributes']; if (isset($this->meta['hiddenAttributes']) && is_array($this->meta['hiddenAttributes'])) {
else return array(); return $this->meta['hiddenAttributes'];
}
return array();
} }
/** /**
@ -1742,8 +1787,10 @@ abstract class baseModule {
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function getRequiredExtensions() { public function getRequiredExtensions() {
if (isset($this->meta['extensions']) && is_array($this->meta['extensions'])) return $this->meta['extensions']; if (isset($this->meta['extensions']) && is_array($this->meta['extensions'])) {
else return array(); return $this->meta['extensions'];
}
return array();
} }
/** /**
@ -1756,8 +1803,10 @@ abstract class baseModule {
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function getSelfServiceSearchAttributes() { public function getSelfServiceSearchAttributes() {
if (isset($this->meta['selfServiceSearchAttributes']) && is_array($this->meta['selfServiceSearchAttributes'])) return $this->meta['selfServiceSearchAttributes']; if (isset($this->meta['selfServiceSearchAttributes']) && is_array($this->meta['selfServiceSearchAttributes'])) {
else return array(); return $this->meta['selfServiceSearchAttributes'];
}
return array();
} }
/** /**
@ -1772,8 +1821,10 @@ abstract class baseModule {
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function getSelfServiceFields() { public function getSelfServiceFields() {
if (isset($this->meta['selfServiceFieldSettings']) && is_array($this->meta['selfServiceFieldSettings'])) return $this->meta['selfServiceFieldSettings']; if (isset($this->meta['selfServiceFieldSettings']) && is_array($this->meta['selfServiceFieldSettings'])) {
else return array(); return $this->meta['selfServiceFieldSettings'];
}
return array();
} }
/** /**

View File

@ -94,8 +94,8 @@ function setlanguage() {
* @return true, if the chmod $right for $target were set * @return true, if the chmod $right for $target were set
*/ */
function checkChmod($right, $target, $chmod) { function checkChmod($right, $target, $chmod) {
$right_arr=array("read","write","execute"); $right_arr = array("read","write","execute");
$target_arr=array("owner","group","other"); $target_arr = array("owner","group","other");
// Check, if $right and $target has right parameters // Check, if $right and $target has right parameters
if (!in_array($right, $right_arr) ||!in_array($target, $target_arr)) { if (!in_array($right, $right_arr) ||!in_array($target, $target_arr)) {
@ -104,9 +104,15 @@ function checkChmod($right, $target, $chmod) {
$chmod_num = -1; $chmod_num = -1;
// owner: // owner:
if ($target == "owner") $chmod_num = 0; if ($target == "owner") {
if ($target == "group") $chmod_num = 1; $chmod_num = 0;
if ($target == "other") $chmod_num = 2; }
if ($target == "group") {
$chmod_num = 1;
}
if ($target == "other") {
$chmod_num = 2;
}
// Cut the number from the chmod: // Cut the number from the chmod:
$chmod_num = $chmod{$chmod_num}; $chmod_num = $chmod{$chmod_num};
@ -118,10 +124,12 @@ function checkChmod($right, $target, $chmod) {
$write = array(2,3,6,7); $write = array(2,3,6,7);
// What numbers allow "execute" // What numbers allow "execute"
$execute = array(1,3,5,7); $execute = array(1,3,5,7);
if (($right == "read") && in_array($chmod_num, $read)) return true; if ((($right == "read") && in_array($chmod_num, $read))
elseif (($right == "write") && in_array($chmod_num, $write)) return true; || (($right == "write") && in_array($chmod_num, $write))
elseif (($right == "execute") && in_array($chmod_num, $execute)) return true; || (($right == "execute") && in_array($chmod_num, $execute))) {
else return false; return true;
}
return false;
} }
/** /**
@ -219,11 +227,9 @@ function deleteConfigProfile($name) {
if (is_dir($subDirs[$i])) { if (is_dir($subDirs[$i])) {
$dirHandle = @opendir($subDirs[$i]); $dirHandle = @opendir($subDirs[$i]);
while (false !== ($path = readdir($dirHandle))) { while (false !== ($path = readdir($dirHandle))) {
if ($path != '.' && $path != '..') { if (($path != '.') && ($path != '..') && !@unlink($subDirs[$i] . '/' . $path)) {
if (!@unlink($subDirs[$i] . '/' . $path)) { logNewMessage(LOG_ERR, 'Unable to delete ' . $subDirs[$i] . '/' . $path);
logNewMessage(LOG_ERR, 'Unable to delete ' . $subDirs[$i] . '/' . $path); return _("Unable to delete profile!");
return _("Unable to delete profile!");
}
} }
} }
@closedir($dirHandle); @closedir($dirHandle);
@ -283,8 +289,12 @@ function extractConfigOptionsFromPOST($confTypes) {
} }
// checkboxes // checkboxes
elseif ($type == "checkbox") { elseif ($type == "checkbox") {
if (isset($_POST[$element]) && ($_POST[$element] == "on")) $options[$element] = array('true'); if (isset($_POST[$element]) && ($_POST[$element] == "on")) {
else $options[$element] = array('false'); $options[$element] = array('true');
}
else {
$options[$element] = array('false');
}
} }
// dropdownbox // dropdownbox
elseif ($type == "select") { elseif ($type == "select") {
@ -340,7 +350,7 @@ function metaRefresh($page) {
*/ */
function isAccountTypeHidden($type) { function isAccountTypeHidden($type) {
$typeSettings = $_SESSION['config']->get_typeSettings(); $typeSettings = $_SESSION['config']->get_typeSettings();
return isset($typeSettings['hidden_' . $type]) && ($typeSettings['hidden_' . $type] == true); return isset($typeSettings['hidden_' . $type]) && ($typeSettings['hidden_' . $type]);
} }
/** /**
@ -352,11 +362,13 @@ function getLanguages() {
$languages = array(); $languages = array();
// loading available languages from language.conf file // loading available languages from language.conf file
$languagefile = dirname(__FILE__) . "/../config/language"; $languagefile = dirname(__FILE__) . "/../config/language";
if(is_file($languagefile) == true) { if(is_file($languagefile)) {
$file = fopen($languagefile, "r"); $file = fopen($languagefile, "r");
while(!feof($file)) { while(!feof($file)) {
$line = fgets($file, 1024); $line = fgets($file, 1024);
if($line == "" || $line == "\n" || $line[0] == "#") continue; // ignore comment and empty lines if($line == "" || $line == "\n" || $line[0] == "#") {
continue; // ignore comment and empty lines
}
$value = explode(":", $line); $value = explode(":", $line);
$languages[] = new LAMLanguage($value[0], $value[1], $value[2]); $languages[] = new LAMLanguage($value[0], $value[1], $value[2]);
} }
@ -625,9 +637,11 @@ class LAMConfig {
*/ */
private function reload() { private function reload() {
$conffile = $this->getPath(); $conffile = $this->getPath();
if (is_file($conffile) == True) { if (is_file($conffile)) {
$file = @fopen($conffile, "r"); $file = @fopen($conffile, "r");
if (!$file) return false; // abort if file is not readable if (!$file) {
return false; // abort if file is not readable
}
while (!feof($file)) { while (!feof($file)) {
$line = fgets($file, 1000000); $line = fgets($file, 1000000);
$line = trim($line); // remove spaces at the beginning and end $line = trim($line); // remove spaces at the beginning and end
@ -712,7 +726,9 @@ class LAMConfig {
// only return available modules // only return available modules
$ret = array(); $ret = array();
for ($i = 0; $i < sizeof($modules); $i++) { for ($i = 0; $i < sizeof($modules); $i++) {
if (in_array($modules[$i], $available)) $ret[] = $modules[$i]; if (in_array($modules[$i], $available)) {
$ret[] = $modules[$i];
}
} }
$this->typeSettings[$moduleVar] = implode(",", $ret); $this->typeSettings[$moduleVar] = implode(",", $ret);
} }
@ -722,7 +738,7 @@ class LAMConfig {
/** Saves preferences to config file */ /** Saves preferences to config file */
public function save() { public function save() {
$conffile = $this->getPath(); $conffile = $this->getPath();
if (is_file($conffile) == True) { if (is_file($conffile)) {
$file = fopen($conffile, "r"); $file = fopen($conffile, "r");
$file_array = array(); $file_array = array();
// read config file // read config file