summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/helper.php
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2013-09-29 23:53:14 +0200
committerArthur Schiwon <blizzz@owncloud.com>2013-10-17 19:13:14 +0200
commit8290929aa6fcb1e62e79d7acf8bf310c8d6f94d7 (patch)
tree5c688ce66b447650c661c97344fcd82f79ec0512 /apps/user_ldap/lib/helper.php
parent7c60384f20a1f5b9dea2288d8b39c5f556b4348f (diff)
downloadnextcloud-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.php21
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;
+ }
}