Backport of PR #7837 to stable6

LDAP Wizard: when determining objectclasses, we realy do not need to look at every entry. Fixes #7530

Conflicts:
	apps/user_ldap/lib/wizard.php

Fix wildcard handling and check even less DNs per filter, enough will be looked at anyway

Use the LDAP wrapper for checking resources, needs for proper testing

fix potential infinite loop when the DN of the first entry was already read.

add tests for cumulativeSearchOnAttribute

make tests work on systems without php5_ldap

define var

add comment to clearify when a skip in the foreach happens