X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Ffunctions.inc;h=4acc2419e139f5e12f46570541bdad03092454fd;hb=f9e2a15ea3578c6c86efef30a0c8ebededefbb9e;hp=2cc2e8cf35697805698481b76cbeaa208e96684e;hpb=786e9477badbb3f06604a41569fe5ab354472280;p=gosa.git
diff --git a/include/functions.inc b/include/functions.inc
index 2cc2e8cf3..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/");
@@ -291,7 +292,8 @@ function ldap_init ($server, $base, $binddn='', $pass='')
{
global $config;
- $ldap = new LDAP ($binddn, $pass, $server, isset($config->current['RECURSIVE']) && $config->current['RECURSIVE'] == "true",
+ $ldap = new LDAP ($binddn, $pass, $server,
+ isset($config->current['RECURSIVE']) && $config->current['RECURSIVE'] == "true",
isset($config->current['TLS']) && $config->current['TLS'] == "true");
/* Sadly we've no proper return values here. Use the error message instead. */
@@ -462,7 +464,6 @@ function ldap_expired_account($config, $userdn, $username)
function add_lock ($object, $user)
{
global $config;
- echo "ADDING.. -> ".$object."
";
/* Just a sanity check... */
if ($object == "" || $user == ""){
@@ -503,13 +504,6 @@ function del_lock ($object)
{
global $config;
- if(isset($_POST['delete_lock'])){
- echo "REMOVING -> ".$object."
";
- }else{
- echo "SKIP REMOVING -> ".$object."
";
- return;
- }
-
/* Sanity check */
if ($object == ""){
return;
@@ -2133,5 +2127,61 @@ function gosa_ldap_explode_dn($dn,$config = NULL,$verify_in_ldap=false)
return($ret);
}
+function is_php4()
+{
+ return (preg_match('/^4/', phpversion()));
+}
+
+/* Add "str_split" if this function is missing.
+ * This function is only available in PHP5
+ */
+ if(!function_exists("str_split")){
+ function str_split($str,$length =1)
+ {
+ if($length < 1 ) $length =1;
+
+ $ret = array();
+ for($i = 0 ; $i < strlen($str); $i = $i +$length){
+ $ret[] = substr($str,$i ,$length);
+ }
+ return($ret);
+ }
+ }
+
+
+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:
?>