diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2013-09-29 23:53:14 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2013-10-17 19:13:14 +0200 |
commit | 8290929aa6fcb1e62e79d7acf8bf310c8d6f94d7 (patch) | |
tree | 5c688ce66b447650c661c97344fcd82f79ec0512 /apps/user_ldap/lib/helper.php | |
parent | 7c60384f20a1f5b9dea2288d8b39c5f556b4348f (diff) | |
download | nextcloud-server-8290929aa6fcb1e62e79d7acf8bf310c8d6f94d7.tar.gz nextcloud-server-8290929aa6fcb1e62e79d7acf8bf310c8d6f94d7.zip |
LDAP Wizard: autodetect base DN
Diffstat (limited to 'apps/user_ldap/lib/helper.php')
-rw-r--r-- | apps/user_ldap/lib/helper.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/apps/user_ldap/lib/helper.php b/apps/user_ldap/lib/helper.php index 4c9dd07a12c..09f646921e3 100644 --- a/apps/user_ldap/lib/helper.php +++ b/apps/user_ldap/lib/helper.php @@ -161,4 +161,25 @@ class Helper { return true; } + + /** + * @brief extractsthe domain from a given URL + * @param $url the URL + * @return mixed, domain as string on success, false otherwise + */ + static public function getDomainFromURL($url) { + $uinfo = parse_url($url); + if(!is_array($uinfo)) { + return false; + } + + $domain = false; + if(isset($uinfo['host'])) { + $domain = $uinfo['host']; + } else if(isset($uinfo['path'])) { + $domain = $uinfo['path']; + } + + return $domain; + } } |