make deletion safer
This commit is contained in:
		
							parent
							
								
									6264203373
								
							
						
					
					
						commit
						933d8224b8
					
				|  | @ -51,6 +51,13 @@ foreach ($request['parent'] as $dn) { | |||
| } | ||||
| 
 | ||||
| function pla_rdelete($server,$dn) { | ||||
| 	if (($dn == null) || ($dn == '')) { | ||||
| 		system_message(array( | ||||
| 			'title'=>_('Entry does not exist'), | ||||
| 			'body'=>sprintf('%s (%s)',_('Unable to delete entry, it does not exist'),$dn), | ||||
| 			'type'=>'error')); | ||||
| 		return false; | ||||
| 	} | ||||
| 	# We delete all children, not only the visible children in the tree
 | ||||
| 	$children = $server->getContainerContents($dn,null,0,'(objectClass=*)',LDAP_DEREF_NEVER); | ||||
| 
 | ||||
|  |  | |||
|  | @ -305,6 +305,10 @@ function getChildCount($dn) { | |||
| */ | ||||
| function deleteDN($dn) { | ||||
| 	$errors = array(); | ||||
| 	if (($dn == null) || ($dn == '')) { | ||||
| 		$errors[] = array('ERROR', _('Entry does not exist')); | ||||
| 		return $errors; | ||||
| 	} | ||||
| 	$sr = @ldap_list($_SESSION['ldap']->server(), $dn, 'objectClass=*', array('dn'), 0, 0, 0, LDAP_DEREF_NEVER); | ||||
| 	if ($sr) { | ||||
| 		$entries = ldap_get_entries($_SESSION['ldap']->server(), $sr); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue