aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoricewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-05-20 11:04:57 +0000
committericewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-05-20 11:04:57 +0000
commit81ce05a964142f77539b11926d4638b085201daf (patch)
tree3f1a16ff965468232f8297818dd5552ced29b47c
parent68d0553cc7bee69a859e5be2fad99362d5b8b917 (diff)
downloadelgg-81ce05a964142f77539b11926d4638b085201daf.tar.gz
elgg-81ce05a964142f77539b11926d4638b085201daf.tar.bz2
Marcus Povey <marcus@dushka.co.uk>
* Introducing: current_page_url() git-svn-id: https://code.elgg.org/elgg/trunk@654 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/elgglib.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 9005cf010..7e785ce07 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -38,6 +38,30 @@
return false;
}
+
+ /**
+ * Return the current page URL.
+ */
+ function current_page_url()
+ {
+ global $CONFIG;
+
+ $url = parse_url($CONFIG->wwwroot);
+
+ $page = $url['scheme'] . "://";
+
+ // user/pass
+ if ($url['user']) $page .= $url['user'];
+ if ($url['pass']) $page .= ":".$url['pass'];
+ if (($url['user']) || $url['pass']) $page .="@";
+
+ $page .= $url['host'];
+ $page = trim($page, "/"); $page.="/";
+
+ $page .= $_SERVER['REQUEST_URI'];
+
+ return $page;
+ }
/**
* Templating