diff --git a/include/functions.inc b/include/functions.inc
index cc724f8a62807467cc5b295ac272ba36fa7dbcac..e83805413ea93da35bb4f1171bef0653a685d113 100644 (file)
--- a/include/functions.inc
+++ b/include/functions.inc
/* Try to use users primary language */
global $config;
$ui= get_userinfo();
- if ($ui != NULL){
+ if (isset($ui) && $ui !== NULL){
if ($ui->language != ""){
return ($ui->language.".UTF-8");
}
}
- /* Try to use users primary language */
- if ($ui != NULL){
- if ($ui->language != ""){
- return ($ui->language.".UTF-8");
+ /* Check for global language settings in gosa.conf */
+ if(isset($config->data['MAIN']['LANG']) && !empty($config->data['MAIN']['LANG'])) {
+ $lang = $config->data['MAIN']['LANG'];
+ if(!preg_match("/utf/i",$lang)){
+ $lang .= ".UTF-8";
}
+ return($lang);
}
/* Load supported languages */
/* Check if mail address is also a valid auth name */
$auth_mail = FALSE;
- if(isset($config->current['AUTH_MAIL']) && preg_match("/true/",$config->current['AUTH_MAIL'])){
+ if(isset($config->current['AUTH_MAIL']) && preg_match("/^true$/i",$config->current['AUTH_MAIL'])){
$auth_mail = TRUE;
}
/* LDAP schema is not case sensitive. Perform additional check. */
$attrs= $ldap->fetch();
if($auth_mail){
- if ($attrs['uid'][0] != $username && $attrs['mail'][0] != $username){
+ if ($attrs['uid'][0] != $username && strcasecmp($attrs['mail'][0], $username) != 0){
return(NULL);
}
}else{
$command= $config->current['BASE_HOOK'];
if ($command != ""){
- $command.= " '$dn' $attrib";
+ $command.= " '".LDAP::fix($dn)."' $attrib";
if (check_command($command)){
@DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute");
exec($command, $output);
}
-function prepare4mailbody($string)
-{
- $string = html_entity_decode($string);
-
- $from = array(
- "/%/",
- "/ /",
- "/\n/",
- "/\r/",
- "/!/",
- "/#/",
- "/\*/",
- "/\//",
- "/</",
- "/>/",
- "/\?/",
- "/\&/",
- "/\(/",
- "/\)/",
- "/\"/");
-
- $to = array(
- "%25",
- "%20",
- "%0A",
- "%0D",
- "%21",
- "%23",
- "%2A",
- "%2F",
- "%3C",
- "%3E",
- "%3F",
- "%38",
- "%28",
- "%29",
- "%22");
-
- $string = preg_replace($from,$to,$string);
-
- return($string);
-}
function mac2company($mac)