- global $path_to_root, $security_areas, $security_sections;
-
- // Add extension private access levels
- include($path_to_root.'/installed_extensions.php');
- foreach($installed_extensions as $ext) {
- if (isset($ext['acc_file']))
- include_once($path_to_root.'/'.$ext['folder'].'/'.$ext['acc_file']);
- }
- // Add modules private access levels
- include($path_to_root.'/modules/installed_modules.php');
- foreach($installed_modules as $mod) {
- if (isset($mod['acc_file']) && $mod['acc_file'] != '')
- include($path_to_root.'/modules/'.$mod['path'].'/'.$mod['acc_file']);
+ global $security_areas, $security_sections, $installed_extensions;
+
+ foreach($installed_extensions as $extid => $ext) {
+ $scode = 100;
+ $acode = 100;
+ $accext = get_access_extensions($extid);
+ $extsections = $accext[1];
+ $extareas = $accext[0];
+ $extcode = $extid<<16;
+
+ $trans = array();
+ foreach($extsections as $code =>$name) {
+ $trans[$code] = $scode<<8;
+ // reassign section codes
+ $security_sections[$trans[$code]|$extcode] = $name;
+ $scode++;
+ }
+ foreach($extareas as $code => $area) {
+ $section = $area[0]&0xff00;
+ // extension modules:
+ // if area belongs to nonstandard section
+ // use translated section codes and
+ // preserve lower part of area code
+ if (isset($trans[$section])) {
+ $section = $trans[$section];
+ }
+ // otherwise assign next available
+ // area code >99
+ $area[0] = $extcode | $section | ($acode++);
+ $security_areas[$code] = $area;
+ }