require_once('inc/init.php');
ldap_login();
+if ($conf['userlogreq'] && !isset($_SESSION['ldapab']['username'])){
+ header('Location: login.php');
+ exit();
+}
+
$users = get_users();
//select template to use
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);
$now = time();
$newdn = 'uid='.$now;
if (empty($_REQUEST['type'])) { $_REQUEST['type']='public'; }
- if($_REQUEST['type'] == 'private'){
+ if($_REQUEST['type'] == 'private' && $conf['privatebook']){
$newdn .= ', '.$conf['privatebook'].', '.$_SESSION['ldapab']['binddn'];
}else{
$newdn .= ', '.$conf['publicbook'];
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;
}
}
* gets the binary data from an uploaded file
*/
function _getUploadData(){
+ global $smarty;
+ global $lang;
$file = $_FILES['photoupload'];
if (is_uploaded_file($file['tmp_name'])) {
fclose($fh);
unlink($file['tmp_name']);
return $data;
+ } else {
+ $smarty->assign('jpegError',$lang['err_wrongFileType']);
}
+ } else {
+ $smarty->assign('jpegError',$lang['err_fileNotUploaded']);
}
return '';
}