X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=entry.php;h=a19888ec24375478b608470981bd258629cc6d91;hb=2bdafc359ef325594664ffb76eddabec43afb4fc;hp=75c6b87c17ea2026c59c26923a68cf7e7938a6c7;hpb=55e57dc0b0041d58c671cfdcb9fb183f0b868969;p=contagged diff --git a/entry.php b/entry.php index 75c6b87..a19888e 100644 --- a/entry.php +++ b/entry.php @@ -2,6 +2,11 @@ require_once('inc/init.php'); ldap_login(); +if ($conf['userlogreq'] && $user == ''){ + header('Location: login.php'); + exit(); +} + $users = get_users(); //select template to use @@ -28,7 +33,8 @@ if (empty($_REQUEST['dn'])) { if($_SESSION['ldapab']['username'] && !empty($_REQUEST['save']) && $_REQUEST['save']){ // prepare special data $_REQUEST['entry']['photo'] = _getUploadData(); - $_REQUEST['entry']['marker'] = explode(',',$_REQUEST['entry']['markers']); + if($_REQUEST['entry']['markers']) + $_REQUEST['entry']['marker'] = explode(',',$_REQUEST['entry']['markers']); unset($_REQUEST['entry']['markers']); foreach(array_keys($_REQUEST['entry']) as $field){ @@ -83,8 +89,9 @@ function _fetchData($dn){ global $smarty; global $users; //contains the users for manager role - $sr = ldap_search($LDAP_CON,$dn,'(objectClass=inetOrgPerson)'); - if(!ldap_count_entries($LDAP_CON,$sr)){ + $sr = @ldap_search($LDAP_CON,$dn,'(objectClass=inetOrgPerson)'); + tpl_ldaperror(); + if(!@ldap_count_entries($LDAP_CON,$sr)){ return false; } $result = ldap_get_binentries($LDAP_CON, $sr); @@ -172,6 +179,27 @@ print ''; tpl_ldaperror("mod $key"); } } + + // special tag handling for Thunderbird + if($conf['tbtaghack'] && in_array('contactPerson',$OCLASSES)){ + for($i=1;$i<5;$i++){ + if(empty($entry["custom$i"])){ + // deletion + unset($del); + $del["custom$i"]=array(); + $r = @ldap_mod_replace($LDAP_CON,$dn,$del); + tpl_ldaperror("del custom$i"); + }else{ + // modification + unset($add); + $add["custom$i"]=$entry["custom$i"]; + $r = @ldap_mod_replace($LDAP_CON,$dn,$add); + tpl_ldaperror("mod custom$i"); + } + } + } + + return $dn; } } @@ -191,6 +219,8 @@ function _delEntry($dn){ * gets the binary data from an uploaded file */ function _getUploadData(){ + global $smarty; + global $lang; $file = $_FILES['photoupload']; if (is_uploaded_file($file['tmp_name'])) { @@ -200,7 +230,11 @@ function _getUploadData(){ fclose($fh); unlink($file['tmp_name']); return $data; + } else { + $smarty->assign('jpegError',$lang['err_wrongFileType']); } + } else { + $smarty->assign('jpegError',$lang['err_fileNotUploaded']); } return ''; }