X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Ffunctions.inc;h=f58ed2a2e60ab73da2d552bd8bbf1711abc85f30;hb=06cc53394cf695b3bc663073e526d7d94e4bb2d6;hp=d648d588dbe6e03b38a59feb6c37f4790ff2cf44;hpb=73aea7fc540b0b72e0177703fef3f47dd35d900f;p=gosa.git diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index d648d588d..f58ed2a2e 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -86,6 +86,7 @@ define ("DEBUG_POST", 16); define ("DEBUG_SESSION",32); define ("DEBUG_CONFIG", 64); define ("DEBUG_ACL", 128); +define ("DEBUG_SI", 256); /* Rewrite german 'umlauts' and spanish 'accents' to get better results */ @@ -192,8 +193,8 @@ function get_browser_language() } /* Check for global language settings in gosa.conf */ - if ($config->get_cfg_value('lang') != ""){ - $lang = $config->get_cfg_value('lang'); + if (isset ($config) && $config->get_cfg_value('language') != ""){ + $lang = $config->get_cfg_value('language'); if(!preg_match("/utf/i",$lang)){ $lang .= ".UTF-8"; } @@ -231,7 +232,11 @@ function get_template_path($filename= '', $plugin= FALSE, $path= "") global $config, $BASE_DIR; /* Set theme */ - $theme= $config->get_cfg_value("theme", "default"); + if (isset ($config)){ + $theme= $config->get_cfg_value("theme", "default"); + } else { + $theme= "default"; + } /* Return path for empty filename */ if ($filename == ''){ @@ -289,6 +294,21 @@ function array_remove_entries($needles, $haystack) } +function array_remove_entries_ics($needles, $haystack) +{ + $tmp= array(); + + /* Loop through entries to be removed */ + foreach ($haystack as $entry){ + if (!in_array_ics($entry, $needles)){ + $tmp[]= $entry; + } + } + + return ($tmp); +} + + function gosa_array_merge($ar1,$ar2) { if(!is_array($ar1) || !is_array($ar2)){ @@ -329,7 +349,9 @@ function ldap_init ($server, $base, $binddn='', $pass='') /* Sadly we've no proper return values here. Use the error message instead. */ if (!$ldap->success()){ - echo sprintf(_("FATAL: Error when connecting the LDAP. Server said '%s'."), $ldap->get_error()); + msg_dialog::display(_("Fatal error"), + sprintf(_("FATAL: Error when connecting the LDAP. Server said '%s'."), $ldap->get_error()), + FATAL_ERROR_DIALOG); exit(); } @@ -355,10 +377,9 @@ function process_htaccess ($username, $kerberos= FALSE) /* Look for entry or realm */ $ldap= $config->get_ldap_link(); if (!$ldap->success()){ - msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), "", LDAP_AUTH, ERROR_DIALOG)); - $smarty= get_smarty(); - $smarty->display(get_template_path('headers.tpl')); - echo "".session::get('errors').""; + msg_dialog::display(_("LDAP error"), + msgPool::ldaperror($ldap->get_error(), "", LDAP_AUTH)."

".session::get('errors'), + FATAL_ERROR_DIALOG); exit(); } $ldap->search("(&(objectClass=gosaAccount)(|(uid=$username)(userPassword={$mode}$username)))", array("uid")); @@ -382,10 +403,9 @@ function ldap_login_user_htaccess ($username) /* Look for entry or realm */ $ldap= $config->get_ldap_link(); if (!$ldap->success()){ - msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), "", LDAP_AUTH, FATAL_ERROR_DIALOG)); - $smarty= get_smarty(); - $smarty->display(get_template_path('headers.tpl')); - echo "".session::get('errors').""; + msg_dialog::display(_("LDAP error"), + msgPool::ldaperror($ldap->get_error(), "", LDAP_AUTH)."

".session::get('errors'), + FATAL_ERROR_DIALOG); exit(); } $ldap->search("(&(objectClass=gosaAccount)(uid=$username))", array("uid")); @@ -420,10 +440,9 @@ function ldap_login_user ($username, $password) /* look through the entire ldap */ $ldap = $config->get_ldap_link(); if (!$ldap->success()){ - msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error()), FATAL_ERROR_DIALOG); - $smarty= get_smarty(); - $smarty->display(get_template_path('headers.tpl')); - echo "".session::get('errors').""; + msg_dialog::display(_("LDAP error"), + msgPool::ldaperror($ldap->get_error(), "", LDAP_AUTH)."

".session::get('errors'), + FATAL_ERROR_DIALOG); exit(); } $ldap->cd($config->current['BASE']); @@ -1131,6 +1150,8 @@ function get_ou($name) { global $config; + $name= strtolower($name); + $map = array( "ogroupou" => "ou=groups,", "applicationou" => "ou=apps,", @@ -1162,7 +1183,7 @@ function get_ou($name) "mimetypeou" => "ou=mime,"); /* Preset ou... */ - if ($config->get_cfg_value($name) != ""){ + if ($config->get_cfg_value($name, "_not_set_") != "_not_set_"){ $ou= $config->get_cfg_value($name); } elseif (isset($map[$name])) { $ou = $map[$name]; @@ -1194,7 +1215,7 @@ function get_ou($name) function get_people_ou() { - return (get_ou("PEOPLE")); + return (get_ou("USERRDN")); } @@ -1230,7 +1251,10 @@ function strict_uid_mode() { global $config; - return ($config->get_cfg_value("strict") == "true"); + if (isset($config)){ + return ($config->get_cfg_value("strict") == "true"); + } + return (TRUE); } @@ -1961,34 +1985,32 @@ function progressbar($percentage,$width=100,$height=15,$showvalue=false) $progress = (int)(($percentage /100)*$width); - /* Abort printing out percentage, if divs are to small */ - - /* If theres a better solution for this, use it... */ - $str = " -
- -
- -
"; - + $str = "\n
"; + + $str.= "\n
"; + + if(($height >10)&&($showvalue)){ + $str.= "\n "; + $str.= "\n ".$percentage."% "; + $str.= "\n "; + } + + $str.= "\n
"; + $str.= "\n
"; + $str.= "\n
"; + $str.= "\n
"; - if(($height >10)&&($showvalue)){ - $str.= " - ".$percentage."% - "; - } - - $str.= "
"; - - return($str); + return($str); } @@ -2571,7 +2593,7 @@ function generate_smb_nt_hash($password) $hash= ""; } } else { - $tmp= $config->get_cfg_value('smbhash')." ".escapeshellarg($password); + $tmp= $config->get_cfg_value('sambaHashHook')." ".escapeshellarg($password); @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $tmp, "Execute"); exec($tmp, $ar); @@ -2610,7 +2632,7 @@ function getEntryCSN($dn) } /* Get attribute that we should use as serial number */ - $attr= $config->get_cfg_value("uniq_identifier"); + $attr= $config->get_cfg_value("modificationDetectionAttribute"); if($attr != ""){ $ldap = $config->get_ldap_link(); $ldap->cat($dn,array($attr)); @@ -2652,7 +2674,7 @@ function remove_objectClass($classes, &$attrs) $tmp= array(); foreach ($attrs['objectClass'] as $oc) { foreach ($list as $class){ - if ($oc != $class){ + if (strtolower($oc) != strtolower($class)){ $tmp[]= $oc; } }