]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #2598: Added elgg_get_site_url()
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 30 Oct 2010 22:13:41 +0000 (22:13 +0000)
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 30 Oct 2010 22:13:41 +0000 (22:13 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7144 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/elgglib.php

index 60c4e11ad346c65aeb57068795a05a2b10af9dae..fe4f4ea03396232de9e0cd55e0a29c6e199cd8fb 100644 (file)
@@ -1259,6 +1259,27 @@ function callpath_gatekeeper($path, $include_subdirs = true, $strict_mode = fals
        return false;
 }
 
+/**
+ * Get the URL for the current (or specified) site
+ * 
+ * @param int $site_guid The GUID of the site whose URL we want to grab
+ * @return string
+ */
+function elgg_get_site_url($site_guid = 0) {
+       if ($site_guid == 0) {
+               global $CONFIG;
+               return $CONFIG->wwwroot;
+       }
+       
+       $site = get_entity($site_guid);
+       
+       if (!$site instanceof ElggSite) {
+               return false;
+       }
+       
+       return $site->url;
+}
+
 /**
  * Returns the current page's complete URL.
  *
@@ -1271,7 +1292,7 @@ function callpath_gatekeeper($path, $include_subdirs = true, $strict_mode = fals
 function current_page_url() {
        global $CONFIG;
 
-       $url = parse_url($CONFIG->wwwroot);
+       $url = parse_url(elgg_get_site_url());
 
        $page = $url['scheme'] . "://";