X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Ffunctions.inc;h=4acc2419e139f5e12f46570541bdad03092454fd;hb=f9e2a15ea3578c6c86efef30a0c8ebededefbb9e;hp=5b35af77fd159449d3be46b205c1a74021d48411;hpb=b537d04af11618f3efcc223cac4c1a3b01be8b67;p=gosa.git diff --git a/include/functions.inc b/include/functions.inc index 5b35af77f..4acc2419e 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -20,6 +20,7 @@ /* Configuration file location */ define ("CONFIG_DIR", "/etc/gosa"); +define ("CONFIG_FILE", "gosa.conf-trunk"); define ("CONFIG_TEMPLATE_DIR", "../contrib/"); define ("HELP_BASEDIR", "/var/www/doc/"); @@ -2148,6 +2149,39 @@ function is_php4() } +function get_base_from_hook($dn, $attrib) +{ + global $config; + + if (isset($config->current['BASE_HOOK'])){ + + /* Call hook script - if present */ + $command= $config->current['BASE_HOOK']; + + if ($command != ""){ + $command.= " '$dn' $attrib"; + if (check_command($command)){ + @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute"); + exec($command, $output); + if (preg_match("/^[0-9]+$/", $output[0])){ + return ($output[0]); + } else { + print_red(_("Warning - base_hook is not avialable. Using default base.")); + return ($config->current['UIDBASE']); + } + } else { + print_red(_("Warning - base_hook is not avialable. Using default base.")); + return ($config->current['UIDBASE']); + } + + } else { + + print_red(_("Warning - no base_hook defined. Using default base.")); + return ($config->current['UIDBASE']); + + } + } +} // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>