aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-10 02:31:35 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-10 02:31:35 +0000
commit965d29e1349dd03524eac7960c73e81c4562d1f6 (patch)
tree730e951d2b300552da2e76481cd99c61c17edc86 /engine/lib
parent2c449ba169b5bb342eda70d3c834f7b6a2c32493 (diff)
downloadelgg-965d29e1349dd03524eac7960c73e81c4562d1f6.tar.gz
elgg-965d29e1349dd03524eac7960c73e81c4562d1f6.tar.bz2
fixed page owner setting for sites in a subdirectory
git-svn-id: http://code.elgg.org/elgg/trunk@8645 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/pageowner.php30
1 files changed, 14 insertions, 16 deletions
diff --git a/engine/lib/pageowner.php b/engine/lib/pageowner.php
index c9e85d22f..c7ec0b52b 100644
--- a/engine/lib/pageowner.php
+++ b/engine/lib/pageowner.php
@@ -112,37 +112,35 @@ function default_page_owner_handler($hook, $entity_type, $returnvalue, $params)
}
}
- $uri = $_SERVER['REQUEST_URI'];
- // ignore the query
- $parts = parse_url($uri);
-
- if ($parts && isset($parts['path'])) {
- $path = $parts['path'];
- } else {
- return $returnvalue;
- }
-
- if (strpos($path, '/pg') === 0) {
+ // ignore root and query
+ $uri = current_page_url();
+ $path = str_replace(elgg_get_site_url(), '', $uri);
+ $path = trim($path, "/");
+ if (strpos($path, "?")) {
+ $path = substr($path, 0, strpos($path, "?"));
+ }
+
+ if (strpos($path, 'pg') === 0) {
$segments = explode('/', $path);
- if (isset($segments[3]) && isset($segments[4])) {
- switch ($segments[3]) {
+ if (isset($segments[2]) && isset($segments[3])) {
+ switch ($segments[2]) {
case 'owner':
case 'friends':
- $user = get_user_by_username($segments[4]);
+ $user = get_user_by_username($segments[3]);
if ($user) {
return $user->getGUID();
}
break;
case 'view':
case 'edit':
- $entity = get_entity($segments[4]);
+ $entity = get_entity($segments[3]);
if ($entity) {
return $entity->getContainerGUID();
}
break;
case 'add':
case 'group':
- $entity = get_entity($segments[4]);
+ $entity = get_entity($segments[3]);
if ($entity) {
return $entity->getGUID();
}