Added dbg_error_log() calls for error msgs

If the ldap driver is not valid, the error messages were not printed.
There was just "Couldn't contact LDAP server for authentication" - But
why?

This commit adds a print loop for all messages from the global
$c->messages message array.
Instance caching added

There was already a variable to cache the ldap driver instance, and a
check if this variable was already set was there, too! But there was no
code to return the cached instance if the function gets called twice!

Maybe this was simply forgotten...
Only set the cached instance if driver is valid

As I could see at other locations in the code, the ldap driver instance
can be invalid. And if the instance is invalid, the getStaticLdap()
function gets called again. Caching would prevent the function from
retrying to initiate the ldapDrivers object.

This commit adds conditional caching: only if the ldap driver instance is
valid, the object gets cached. This ensures that a retry with this function
would really try to create a new ldapDrivers object and not simply
return the (invalid) cached one.
Merge pull request #13 from matthiasbeyer/ldap_error_output

Added dbg_error_log() calls for error msgs
Merge pull request #14 from matthiasbeyer/fix-ldap_driver_caching

Fix ldap driver caching