35 var $config_found = FALSE;
38 var $currentLocation =
'';
46 protected $ldapLink = NULL;
62 protected $departmentList;
63 protected $departmentTree;
64 protected $departmentInfo;
67 var $last_modified = 0;
78 $this->basedir = $basedir;
81 if ($filename !=
'') {
82 $this->
parse($filename);
99 && ($tmp[
'mtime'] !=
session::get(
'class_location.inc:timestamp'))) {
102 session::set(
'class_location.inc:timestamp', $tmp[
'mtime']);
104 if (($this->filename !=
'') && ((filemtime($this->filename) != $this->last_modified) || $force)) {
105 $this->config_found = FALSE;
108 $this->currentLocation =
'';
110 $this->
parse($this->filename);
125 $this->last_modified = filemtime($filename);
126 $this->filename = $filename;
127 $fh = fopen($filename,
'r');
128 $xmldata = fread($fh, 100000);
130 $this->parse_data($xmldata);
133 function parse_data ($xmldata)
141 $this->parser = xml_parser_create();
142 xml_set_object($this->parser, $this);
143 xml_set_element_handler($this->parser,
"tag_open",
"tag_close");
145 if (!xml_parse($this->parser, chop($xmldata))) {
146 $msg = sprintf(_(
'XML error in fusiondirectory.conf: %s at line %d'),
147 xml_error_string(xml_get_error_code($this->parser)),
148 xml_get_current_line_number($this->parser));
151 xml_parser_free($this->parser);
166 $this->tags[$this->level] = $tag;
170 if ($tag ==
'CONF') {
171 $this->config_found = TRUE;
175 if (!$this->config_found) {
180 foreach ($attrs as $name => $value) {
181 if (preg_match(
"/^(true|yes)$/i", $value)) {
182 $attrs[$name] =
"TRUE";
183 } elseif (preg_match(
"/^(false|no)$/i", $value)) {
184 $attrs[$name] =
"FALSE";
189 switch ($this->tags[$this->level - 1]) {
192 if ($this->tags[$this->level - 2] ==
'MAIN') {
193 $attrs[
'NAME'] = preg_replace(
'/[<>"\']/',
'', $attrs[
'NAME']);
195 $this->currentLocation = $attrs[
'NAME'];
198 $this->data[
'LOCATIONS'][$attrs[
'NAME']] = $attrs;
204 if ($this->tags[$this->level - 2] ==
'LOCATION') {
205 if (isset($attrs[
'BASE'])) {
206 $server = $attrs[
'URI'];
207 } elseif (isset($this->data[
'LOCATIONS'][$this->currentLocation][
'BASE'])) {
209 $server = $attrs[
'URI'];
210 $attrs[
'BASE'] = $this->data[
'LOCATIONS'][$this->currentLocation][
'BASE'];
213 $server = preg_replace(
'!^([^:]+://[^/]+)/.*$!',
'\\1', $attrs[
'URI']);
214 $attrs[
'BASE'] = preg_replace(
'!^[^:]+://[^/]+/(.*)$!',
'\\1', $attrs[
'URI']);
215 $attrs[
'URI'] = $server;
219 if (!isset($this->data[
'LOCATIONS'][$this->currentLocation][
'REFERRAL'])) {
220 $this->data[
'LOCATIONS'][$this->currentLocation][
'REFERRAL'] = [];
223 $this->data[
'LOCATIONS'][$this->currentLocation][
'REFERRAL'][$server] = $attrs;
229 $this->data[
'MAIN'] = array_merge($this->data[
'MAIN'], $attrs);
248 if ($tag ==
'CONF') {
249 $this->config_found = FALSE;
266 if (isset($_SERVER[
'HTTP_FDKEY'])) {
271 if (!isset($cache[$creds])) {
273 $cache[$creds] =
cred_decrypt($creds, $_SERVER[
'HTTP_FDKEY']);
277 _(
'It seems you are trying to decode something which is not encoded : %s'.
"\n".
278 'Please check you are not using a fusiondirectory.secrets file while your passwords are not encrypted.'),
284 return $cache[$creds];
311 if (($this->ldapLink === NULL) || ($this->ldapLink->cid === FALSE)) {
313 $this->ldapLink =
LDAP::init($this->current[
'SERVER'], $this->current[
'BASE'],
314 $this->current[
'ADMINDN'], $this->
get_credentials($this->current[
'ADMINPASSWORD']));
317 if (is_null($this->ldapLink) || (is_int($this->ldapLink) && $this->ldapLink == 0)) {
318 throw new FatalError(
htmlescape(_(
'Cannot bind to LDAP. Please contact the system administrator.')));
322 if (!isset($this->current[
'REFERRAL'])) {
323 $this->ldapLink->referrals = [];
325 $this->ldapLink->referrals = $this->current[
'REFERRAL'];
331 $obj->set_size_limit($ui->getSizeLimitHandler()->getSizeLimit());
333 $obj->set_size_limit(0);
347 if (!isset($this->data[
'LOCATIONS'][$name])) {
348 throw new FatalError(
htmlescape(sprintf(_(
'Location "%s" could not be found in the configuration file'), $name)));
350 $this->current = $this->data[
'LOCATIONS'][$name];
352 if (isset($this->current[
'INITIAL_BASE']) && isset($ui)) {
353 $ui->setCurrentBase($this->current[
'INITIAL_BASE']);
357 if (isset($this->current[
'REFERRAL'])) {
359 foreach ($this->current[
'REFERRAL'] as $server => $ref) {
360 $servers[$server] = strlen($ref[
'BASE']);
366 if (!isset($this->current[
'SERVER'])) {
367 $this->current[
'SERVER'] = key($servers);
373 if (!isset($this->current[
'ADMINDN']) || !isset($this->current[
'ADMINPASSWORD'])) {
374 $this->current[
'BASE'] = $this->current[
'REFERRAL'][$this->current[
'SERVER']][
'BASE'];
375 $this->current[
'ADMINDN'] = $this->current[
'REFERRAL'][$this->current[
'SERVER']][
'ADMINDN'];
376 $this->current[
'ADMINPASSWORD'] = $this->current[
'REFERRAL'][$this->current[
'SERVER']][
'ADMINPASSWORD'];
380 $this->load_inldap_config();
383 $this->loadManagementConfig();
390 if (isset($this->data[
'MAIN'][
'DEBUGLEVEL'])) {
391 $debugLevel |= $this->data[
'MAIN'][
'DEBUGLEVEL'];
395 IconTheme::loadThemes(
'themes');
397 timezone::setDefaultTimezoneFromConfig();
403 function checkLdapConfig ($forceReload = FALSE)
410 $ldap->cat($dn, [
'fusionConfigMd5']);
411 if (($attrs = $ldap->fetch()) && isset($attrs[
'fusionConfigMd5'][0])
419 $config_plugin->update();
420 $config_plugin->save();
424 function load_inldap_config ()
427 $ldap->cat(
CONFIGRDN.$this->current[
'BASE']);
428 if ($attrs = $ldap->fetch()) {
429 for ($i = 0; $i < $attrs[
'count']; $i++) {
431 if (preg_match(
'/^fdTabHook$/i', $key)) {
432 for ($j = 0; $j < $attrs[$key][
'count']; ++$j) {
433 $parts = explode(
'|', $attrs[$key][$j], 3);
434 $class = strtoupper($parts[0]);
435 $mode = strtoupper($parts[1]);
437 if (!isset($cmd[0]) || ($cmd[0] ==
'#')) {
441 if (!isset($this->data[
'HOOKS'][$class])) {
442 $this->data[
'HOOKS'][$class] = [
'CLASS' => $parts[0]];
444 if (!isset($this->data[
'HOOKS'][$class][$mode])) {
445 $this->data[
'HOOKS'][$class][$mode] = [];
447 $this->data[
'HOOKS'][$class][$mode][] = $cmd;
449 } elseif (preg_match(
'/^fd/', $key)) {
450 if (isset($attrs[$key][
'count']) && ($attrs[$key][
'count'] > 1)) {
451 $value = $attrs[$key];
452 unset($value[
'count']);
454 $value = $attrs[$key][0];
456 $key = strtoupper(preg_replace(
'/^fd/',
'', $key));
457 $this->current[$key] = $value;
466 private function loadManagementConfig ()
468 if (isset($this->current[
'MANAGEMENTCONFIG'])) {
469 if (!is_array($this->current[
'MANAGEMENTCONFIG'])) {
470 $this->current[
'MANAGEMENTCONFIG'] = [$this->current[
'MANAGEMENTCONFIG']];
473 foreach ($this->current[
'MANAGEMENTCONFIG'] as $config) {
474 list($class, $json) = explode(
':', $config, 2);
475 $value[$class] = $json;
477 $this->current[
'MANAGEMENTCONFIG'] = $value;
479 if (isset($this->current[
'MANAGEMENTUSERCONFIG'])) {
480 if (!is_array($this->current[
'MANAGEMENTUSERCONFIG'])) {
481 $this->current[
'MANAGEMENTUSERCONFIG'] = [$this->current[
'MANAGEMENTUSERCONFIG']];
484 foreach ($this->current[
'MANAGEMENTUSERCONFIG'] as $config) {
485 list($user, $class, $json) = explode(
':', $config, 3);
486 $value[$user][$class] = $json;
488 $this->current[
'MANAGEMENTUSERCONFIG'] = $value;
501 if (!isset($this->current[
'MANAGEMENTUSERCONFIG'][$ui->dn])) {
502 $this->current[
'MANAGEMENTUSERCONFIG'][$ui->dn] = [];
504 $currentConfig =& $this->current[
'MANAGEMENTUSERCONFIG'][$ui->dn];
505 $attrib =
'fdManagementUserConfig';
506 $prefix = $ui->dn.
':'.$managementClass;
508 if (!isset($this->current[
'MANAGEMENTCONFIG'])) {
509 $this->current[
'MANAGEMENTCONFIG'] = [];
511 $currentConfig =& $this->current[
'MANAGEMENTCONFIG'];
512 $attrib =
'fdManagementConfig';
513 $prefix = $managementClass;
516 if ($managementConfig !== NULL) {
517 $managementConfig = json_encode($managementConfig);
520 if (isset($currentConfig[$managementClass])) {
522 if ($currentConfig[$managementClass] === $managementConfig) {
528 'modtype' => LDAP_MODIFY_BATCH_REMOVE,
529 'values' => [$prefix.
':'.$currentConfig[$managementClass]],
533 if ($managementConfig !== NULL) {
537 'modtype' => LDAP_MODIFY_BATCH_ADD,
538 'values' => [$prefix.
':'.$managementConfig],
542 $ldap->cd(
CONFIGRDN.$this->current[
'BASE']);
543 if (!$ldap->modify_batch($changes)) {
544 return [$ldap->get_error()];
547 if ($managementConfig !== NULL) {
548 $currentConfig[$managementClass] = $managementConfig;
550 unset($currentConfig[$managementClass]);
564 return isset($this->current[
'MANAGEMENTUSERCONFIG'][$ui->dn][$managementClass]);
566 return isset($this->current[
'MANAGEMENTCONFIG'][$managementClass]);
577 if (isset($this->current[
'MANAGEMENTUSERCONFIG'][$ui->dn][$managementClass])) {
578 return json_decode($this->current[
'MANAGEMENTUSERCONFIG'][$ui->dn][$managementClass], TRUE);
579 } elseif (isset($this->current[
'MANAGEMENTCONFIG'][$managementClass])) {
580 return json_decode($this->current[
'MANAGEMENTCONFIG'][$managementClass], TRUE);
586 function getDepartmentList (): array
588 if (!isset($this->departmentList)) {
591 return $this->departmentList;
594 function getDepartmentTree (): array
596 if (!isset($this->departmentTree)) {
599 return $this->departmentTree;
602 function getDepartmentInfo (): array
604 if (!isset($this->departmentInfo)) {
607 return $this->departmentInfo;
610 function resetDepartmentCache ()
612 unset($this->departmentList);
613 unset($this->departmentTree);
614 unset($this->departmentInfo);
623 $result = [
'/' => $this->current[
'BASE']];
625 $this->departmentInfo = [];
632 $types = departmentManagement::getDepartmentTypes();
636 $ldap_values = [
'objectClass',
'description'];
637 foreach ($types as $type) {
638 $i = objects::infos($type);
639 $filter .= $i[
'filter'];
641 $ldap_values[] = $i[
'mainAttr'];
643 $filter =
'(|'.$filter.
')';
647 $ldap->cd($this->current[
'BASE']);
648 $ldap->search($filter, $ldap_values);
649 while ($attrs = $ldap->fetch()) {
653 foreach ($types as $type) {
654 if (objects::isOfType($attrs, $type)) {
666 $infos = objects::infos($oc);
667 $this->departmentInfo[$dn] = [
668 'img' => $infos[
'icon'],
669 'description' => (isset($attrs[
'description'][0]) ? $attrs[
'description'][0] :
''),
670 'name' => $attrs[$infos[
'mainAttr']][0]
674 if ($dn != $result[
'/']) {
676 $result[$c_dn] = $dn;
680 $this->departmentList = $result;
688 if (!isset($this->departmentList)) {
692 $base = $this->current[
'BASE'];
693 $qbase = preg_quote($base,
'/');
698 foreach ($this->departmentList as $val) {
701 $elements = array_reverse(explode(
',', preg_replace(
"/$qbase$/",
'', $val)));
705 foreach ($elements as $key => $ele) {
712 $elestr = trim(preg_replace(
'/^[^=]*+=/',
'', $ele),
',');
713 $nameA = trim(preg_replace(
'/=.*$/',
'', $ele),
',');
714 if ($nameA !=
'ou') {
715 $nameA =
" ($nameA)";
721 if ($key == (count($elements) - 1)) {
722 $last[$elestr.$nameA][
'ENTRY'] = $val;
726 $last = &$last[$elestr.$nameA][
'SUB'];
737 $this->departmentTree = $this->generateDepartmentArray($ret, -1, 28);
749 protected function generateDepartmentArray ($arr, $depth, $max_size)
756 foreach ($arr as $name => $entries) {
758 $name = preg_replace(
'/\\\\,/',
',', $name);
761 if (mb_strlen($name,
'UTF-8') > $max_size) {
762 $name = mb_substr($name, 0, ($max_size - 3),
'UTF-8').
" ...";
766 if (isset($entries[
'ENTRY'])) {
768 for ($i = 0; $i < $depth; $i++) {
771 $ret[$entries[
'ENTRY']] = $a.
" ".$name;
775 if (!empty($entries[
'SUB'])) {
776 $ret = array_merge($ret, $this->generateDepartmentArray($entries[
'SUB'], $depth, $max_size));
799 $class = strtoupper($class);
800 $value = strtoupper($value);
801 return (isset($this->data[
'HOOKS'][$class][$value]) ? $this->data[
'HOOKS'][$class][$value] : []);
823 $name = strtoupper($name);
827 if (isset($this->current[$name])) {
828 $res = $this->current[$name];
829 } elseif (isset($this->data[
'MAIN'][$name])) {
831 $res = $this->data[
'MAIN'][$name];
834 if (is_array($default) && !is_array($res)) {
857 if ($cfg_lifetime > 0) {
858 $ini_lifetime = ini_get(
'session.gc_maxlifetime');
859 $deb_system = file_exists(
'/etc/debian_version');
860 return !($deb_system && ($ini_lifetime < $cfg_lifetime));
884 _(
'The snapshot functionality is enabled, but the required variable "%s" is not set.'),
894 if (!is_callable(
'gzcompress')) {
900 _(
'The snapshot functionality is enabled, but the required compression module is missing. Please install "%s".'),
911 function loadPlist (
pluglist $plist)
913 $this->data[
'OBJECTS'] = [];
914 $this->data[
'SECTIONS'] = [];
915 $this->data[
'CATEGORIES'] = [];
916 $this->data[
'MENU'] = [];
917 $this->data[
'TABS'] = [];
918 foreach ($plist->info as $class => &$plInfo) {
919 if (isset($plInfo[
'plObjectType'])) {
920 $entry = [
'CLASS' => $class,
'NAME' => $plInfo[
'plShortName']];
921 if (isset($plInfo[
'plSubTabs'])) {
922 $entry[
'SUBTABS'] = strtoupper($plInfo[
'plSubTabs']);
924 foreach ($plInfo[
'plObjectType'] as $key => $value) {
925 if (is_numeric($key)) {
927 $tabclass = strtoupper($value).
'TABS';
929 $tabclass =
'OGROUP-USERTABS';
931 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $tabclass,
"Adding $class to tab list");
932 if (!isset($this->data[
'TABS'][$tabclass])) {
933 $this->data[
'TABS'][$tabclass] = [];
935 $this->data[
'TABS'][$tabclass][] = $entry;
938 if (isset($this->data[
'OBJECTS'][strtoupper($key)])) {
939 die(
"duplicated object type ".strtoupper($key).
" in ".$this->data[
'OBJECTS'][strtoupper($key)][
'mainTab'].
" and $class");
941 $tabclass = strtoupper($key).
"TABS";
942 $value[
'tabGroup'] = $tabclass;
943 $value[
'mainTab'] = $class;
944 $value[
'templateActive'] = FALSE;
945 $value[
'snapshotActive'] = FALSE;
946 foreach ([
'ou',
'tabClass'] as $i) {
947 if (!isset($value[$i])) {
951 if (!isset($value[
'aclCategory'])) {
952 $value[
'aclCategory'] = $key;
954 if (isset($value[
'filter'])) {
955 if (!preg_match(
'/^\(.*\)$/', $value[
'filter'])) {
956 $value[
'filter'] =
'('.$value[
'filter'].
')';
958 } elseif (isset($plInfo[
'plFilter'])) {
959 $value[
'filter'] = $plInfo[
'plFilter'];
961 $value[
'filter'] = NULL;
963 if (!isset($value[
'mainAttr'])) {
964 $value[
'mainAttr'] =
'cn';
966 if (!isset($value[
'nameAttr'])) {
967 $value[
'nameAttr'] = $value[
'mainAttr'];
969 if (!isset($value[
'tabClass'])) {
970 $value[
'tabClass'] =
'simpleTabs';
972 $this->data[
'OBJECTS'][strtoupper($key)] = $value;
973 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $tabclass,
"Adding $class as main tab of");
974 if (!isset($this->data[
'TABS'][$tabclass])) {
975 $this->data[
'TABS'][$tabclass] = [];
977 array_unshift($this->data[
'TABS'][$tabclass], $entry);
980 } elseif (
class_available($class) && is_subclass_of($class,
'simpleService')) {
981 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $class,
"Adding service");
982 if (!isset($this->data[
'TABS'][
'SERVERSERVICE'])) {
983 $this->data[
'TABS'][
'SERVERSERVICE'] = [];
985 $this->data[
'TABS'][
'SERVERSERVICE'][] = [
987 'NAME' => $plInfo[
'plShortName']
992 $this->data[
'CATEGORIES'][
'all'] = [
993 'classes' => [
'all'],
994 'description' =>
'* '._(
'All categories'),
998 foreach ($this->data[
'OBJECTS'] as $key => $infos) {
999 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $infos[
'aclCategory'],
"ObjectType $key category");
1000 if (strtoupper($infos[
'aclCategory']) == $key) {
1001 $cat = $infos[
'aclCategory'];
1002 if (!isset($this->data[
'CATEGORIES'][$cat])) {
1003 $this->data[
'CATEGORIES'][$cat] = [
'classes' => [
'0']];
1005 if (!isset($this->data[
'CATEGORIES'][$cat][
'description'])) {
1006 $this->data[
'CATEGORIES'][$cat][
'description'] = $infos[
'name'];
1007 preg_match_all(
'/objectClass=([^= \)\(]+)/', $infos[
'filter'], $m);
1008 $this->data[
'CATEGORIES'][$cat][
'objectClass'] = $m[1];
1013 foreach ($plist->info as $class => &$plInfo) {
1016 if (isset($plInfo[
'plCategory'])) {
1019 foreach ($plInfo[
'plCategory'] as $idx => $infos) {
1020 $cat = (is_numeric($idx) ? $infos : $idx);
1022 if (!isset($this->data[
'CATEGORIES'][$cat])) {
1023 $this->data[
'CATEGORIES'][$cat] = [
'classes' => [
'0'] ];
1025 if (!empty($plInfo[
'plProvidedAcls'])) {
1026 $this->data[
'CATEGORIES'][$cat][
'classes'][] = $class;
1028 if (!is_numeric($idx)) {
1030 $this->data[
'CATEGORIES'][$cat][
'description'] = $infos[
'description'];
1031 if (!is_array($infos[
'objectClass'])) {
1032 $infos[
'objectClass'] = [$infos[
'objectClass']];
1034 $this->data[
'CATEGORIES'][$cat][
'objectClass'] = $infos[
'objectClass'];
1037 $plInfo[
'plCategory'] = $acl;
1039 if (isset($plInfo[
'plObjectType'])) {
1040 foreach ($plInfo[
'plObjectType'] as $key => $value) {
1041 if (is_numeric($key)) {
1043 $obj = strtoupper($value);
1046 $obj = strtoupper($key);
1048 if (strpos($obj,
'OGROUP-') === 0) {
1052 if (isset($this->data[
'OBJECTS'][$obj])) {
1053 $cat = $this->data[
'OBJECTS'][$obj][
'aclCategory'];
1056 if (!empty($plInfo[
'plProvidedAcls'])) {
1057 $this->data[
'CATEGORIES'][$cat][
'classes'][] = $class;
1059 if (!in_array($cat, $plInfo[
'plCategory'])) {
1060 $plInfo[
'plCategory'][] = $cat;
1066 if (isset($plInfo[
'plManages'])) {
1067 foreach ($plInfo[
'plManages'] as $type) {
1068 $obj = strtoupper($type);
1069 if (!isset($this->data[
'OBJECTS'][$obj])) {
1072 $cat = $this->data[
'OBJECTS'][$obj][
'aclCategory'];
1075 if (!empty($plInfo[
'plProvidedAcls'])) {
1076 $this->data[
'CATEGORIES'][$cat][
'classes'][] = $class;
1078 if (!in_array($cat, $plInfo[
'plCategory'])) {
1079 $plInfo[
'plCategory'][] = $cat;
1082 if (isset($this->data[
'OBJECTS'][$obj])) {
1083 $this->data[
'OBJECTS'][$obj][
'management'] = $class;
1084 if (isset($class::$skipTemplates) && !$class::$skipTemplates) {
1085 $this->data[
'OBJECTS'][$obj][
'templateActive'] = TRUE;
1086 $this->data[
'CATEGORIES'][$cat][
'classes'][] =
'template';
1088 if (isset($class::$skipSnapshots) && !$class::$skipSnapshots) {
1089 $this->data[
'OBJECTS'][$obj][
'snapshotActive'] = TRUE;
1090 $this->data[
'CATEGORIES'][$cat][
'classes'][] =
'SnapshotHandler';
1092 if (
class_available(
'archivedObject') && archivedObject::isArchiveActive($obj)) {
1093 $this->data[
'OBJECTS'][$obj][
'archiveActive'] = TRUE;
1094 $this->data[
'CATEGORIES'][$cat][
'classes'][] =
'archivedObject';
1099 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, join(
',', array_unique($acl)),
"Class $class categories");
1101 if (isset($plInfo[
'plSection'])) {
1102 $section = $plInfo[
'plSection'];
1103 if (!is_array($acl)) {
1106 if (!is_numeric(key($acl))) {
1107 $acl = array_keys($acl);
1109 if (isset($plInfo[
'plSelfModify']) && $plInfo[
'plSelfModify']) {
1110 $acl[] = $acl[0].
'/'.$class.
':self';
1112 $acl = join(
',', array_unique($acl));
1114 if (is_array($section)) {
1115 $section = key($section);
1116 if (is_numeric($section)) {
1117 trigger_error(
"$class have wrong setting in plInfo/plSection");
1120 $this->data[
'SECTIONS'][$section] = array_change_key_case($plInfo[
'plSection'][$section], CASE_UPPER);
1122 if (!isset($this->data[
'MENU'][$section])) {
1123 $this->data[
'MENU'][$section] = [];
1125 $attrs = [
'CLASS' => $class];
1127 $attrs[
'ACL'] = $acl;
1129 $this->data[
'MENU'][$section][] = $attrs;
1131 if (isset($plInfo[
'plMenuProvider']) && $plInfo[
'plMenuProvider']) {
1132 list($sections, $entries) = $class::getMenuEntries();
1133 foreach ($sections as $section => $infos) {
1134 if (!isset($this->data[
'SECTIONS'][$section])) {
1135 $this->data[
'SECTIONS'][$section] = array_change_key_case($infos, CASE_UPPER);
1137 if (!isset($this->data[
'MENU'][$section])) {
1138 $this->data[
'MENU'][$section] = [];
1141 foreach ($entries as $section => $section_entries) {
1142 foreach ($section_entries as $entry) {
1143 $this->data[
'MENU'][$section][] = $entry;
1149 ksort($this->data[
'CATEGORIES']);
1150 foreach ($this->data[
'CATEGORIES'] as $name => &$infos) {
1151 $infos[
'classes'] = array_unique($infos[
'classes']);
1152 if (!isset($infos[
'description'])) {
1153 $infos[
'description'] = $name;
1154 $infos[
'objectClass'] = [];
1158 $this->data[
'SECTIONS'][
'personal'] = [
'NAME' => _(
'My account'),
'PRIORITY' => 60];
1160 foreach ($this->data[
'TABS'][
'USERTABS'] as $tab) {
1161 if ($plist->info[$tab[
'CLASS']][
'plSelfModify']) {
1162 $personal[] = [
'CLASS' => $tab[
'CLASS'],
'ACL' =>
'user/'.$tab[
'CLASS'].
':self'];
1165 if (!isset($this->data[
'MENU'][
'personal'])) {
1166 $this->data[
'MENU'][
'personal'] = $personal;
1168 $this->data[
'MENU'][
'personal'] = array_merge($personal, $this->data[
'MENU'][
'personal']);
1170 uasort($this->data[
'SECTIONS'],
1173 if ($a[
'PRIORITY'] == $b[
'PRIORITY']) {
1176 return (($a[
'PRIORITY'] < $b[
'PRIORITY']) ? -1 : 1);
const CACHE_DIR
Global cache dir.
cred_decrypt($input, $password)
Decrypt a string with RIJNDAEL_128.
updateManagementConfig(string $managementClass, $managementConfig, bool $userConfig=FALSE)
Update the management config in the LDAP and the cache.
__construct($filename, $basedir='')
Class constructor of the config class.
htmlescape(string $str)
Escape string for HTML output.
const CLASS_CACHE
name of the class.cache file
hasManagementConfig(string $managementClass, bool $userConfig=FALSE)
Test if there is a stored management config.
static get($name)
Accessor of a session var.
set_current($name)
Set the current location.
This class contains all the function needed to make list of plugin and manage them.
get_ldap_link(bool $sizelimit=FALSE)
Get a LDAP link object.
const CONFIGRDN
FusionDirectory config object RDN.
tag_open($parser, $tag, $attrs)
Open xml tag when parsing the xml config.
static set($name, $value)
Set a value in a session.
static add($object, string $user=NULL)
Add a lock for object(s)
static init($lang=NULL)
Initialize language configuration.
getManagementConfig($managementClass)
Returns the config for a management class, or NULL.
get_credentials($creds)
Get the password when needed from the config file.
static open(string $dn, string $type)
Create the tab object for the given dn.
static debug(int $level, int $line, string $function, string $file, $data, string $info='')
Debug output method.
Parent class for all exceptions thrown in FusionDirectory.
static deleteByObject($object)
Remove a lock for object(s)
Fatal error class. Does not extend FusionDirectoryError.
static un_set($name)
Unset a session.
check_and_reload($force=FALSE)
Check and reload the configuration.
check_session_lifetime()
Check if session lifetime matches session.gc_maxlifetime.
static init(string $server, string $base, string $binddn='', string $pass='')
Initialize a LDAP connection.
storeDepartmentTree()
Store the tree render for departments in $this->departmentTree.
Parent class for all errors in FusionDirectory.
convert_department_dn($dn, $base=NULL)
Convert a department DN to a sub-directory style list.
$current
Store configuration for current location.
searchHooks($class, $value)
Search for hooks.
This class is responsible for parsing and querying the fusiondirectory configuration file...
static is_set($name)
Check if the name of the session is set.
snapshotEnabled()
Check if snapshot are enabled.
storeDepartmentList()
Store the departments from ldap in $this->departmentList.
tag_close($parser, $tag)
Close xml tag when parsing the xml config.
get_cfg_value($name, $default='')
Get a configuration value from the config.
class_available($name)
Checks if a class is available.
parse($filename)
Parse the given configuration file.