-
- //prepare templates
- $smarty->assign('dn',$dn);
- $smarty->assign('managers',$users);
- tpl_std();
- tpl_orgs();
- tpl_markers();
- tpl_categories();
- tpl_timezone();
- tpl_country();
- //display templates
- if($_REQUEST[mode]=='vcf'){
- $entry = $smarty->get_template_vars('entry');
- $filename = $entry[givenname].'_'.$entry[name].'.vcf';
- header("Content-Disposition: attachment; filename=\"$filename\"");
- header("Content-type: text/x-vcard; name=\"$filename\"; charset=utf-8");
- $smarty->display($template);
- }else{
- header('Content-Type: text/html; charset=utf-8');
- $smarty->display($template);
+}elseif(!empty($_REQUEST['del']) && $_REQUEST['del']){
+ _delEntry($dn);
+}elseif(!_fetchData($dn)){
+ $smarty->assign('error',"The requested entry '$dn' was not found");
+ $template = 'error.tpl';
+}
+
+//prepare templates
+$smarty->assign('dn',$dn);
+$smarty->assign('managers',$users);
+tpl_std();
+//display templates
+if($_REQUEST['mode']=='vcf'){
+ $entry = $smarty->get_template_vars('entry');
+ $filename = $entry['givenname'].'_'.$entry['name'].'.vcf';
+ header("Content-Disposition: attachment; filename=\"$filename\"");
+ header("Content-type: text/x-vcard; name=\"$filename\"; charset=utf-8");
+ $smarty->display($template);
+}else{
+ header('Content-Type: text/html; charset=utf-8');
+ $smarty->display($template);
+}
+
+//--------------------------------------------------------------
+
+/**
+ * fetches the Data from the LDAP directory and assigns it to
+ * the global smarty object using tpl_entry()
+ */
+function _fetchData($dn){
+ global $LDAP_CON;
+ global $conf;
+ 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)){
+ return false;