From e4bc53c61702b22c845cbbd22ba3335935ee2c9c Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 19 Mar 2011 15:33:06 +0000 Subject: Fixes #3176 replaced usage of index.php where appropriate git-svn-id: http://code.elgg.org/elgg/trunk@8770 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/file/pages/file/index.php | 69 ------------------------------------- mod/file/pages/file/owner.php | 69 +++++++++++++++++++++++++++++++++++++ mod/file/start.php | 2 +- mod/pages/pages/pages/index.php | 49 -------------------------- mod/pages/pages/pages/owner.php | 49 ++++++++++++++++++++++++++ mod/pages/start.php | 2 +- mod/thewire/pages/thewire/owner.php | 33 ++++++++++++++++++ mod/thewire/pages/thewire/user.php | 33 ------------------ mod/thewire/start.php | 18 +++++----- 9 files changed, 163 insertions(+), 161 deletions(-) delete mode 100644 mod/file/pages/file/index.php create mode 100644 mod/file/pages/file/owner.php delete mode 100644 mod/pages/pages/pages/index.php create mode 100644 mod/pages/pages/pages/owner.php create mode 100644 mod/thewire/pages/thewire/owner.php delete mode 100644 mod/thewire/pages/thewire/user.php diff --git a/mod/file/pages/file/index.php b/mod/file/pages/file/index.php deleted file mode 100644 index 617e4c7f4..000000000 --- a/mod/file/pages/file/index.php +++ /dev/null @@ -1,69 +0,0 @@ -name); - -$params = array(); - -if ($owner->guid == elgg_get_logged_in_user_guid()) { - // user looking at own files - $title = elgg_echo('file:yours'); - $params['filter_context'] = 'mine'; -} else if (elgg_instanceof($owner, 'user')) { - // someone else's files - $title = elgg_echo("file:user", array($owner->name)); - // do not show button or select a tab when viewing someone else's posts - $params['filter_context'] = 'none'; - $params['buttons'] = ''; -} else { - // group files - $title = elgg_echo("file:user", array($owner->name)); - $params['filter'] = ''; - if ($owner->isMember(elgg_get_logged_in_user_entity())) { - $url = "file/add/$owner->guid"; - $vars = array( - 'href' => $url, - 'text' => elgg_echo("file:add"), - 'class' => 'elgg-button elgg-button-action', - ); - $button = elgg_view('output/url', $vars); - $params['buttons'] = $button; - } else { - $params['buttons'] = ''; - } -} - -// List files -$content = elgg_list_entities(array( - 'types' => 'object', - 'subtypes' => 'file', - 'container_guid' => $owner->guid, - 'limit' => 10, - 'full_view' => FALSE, -)); -if (!$content) { - $content = elgg_echo("file:none"); -} - -$sidebar = file_get_type_cloud(elgg_get_page_owner_guid()); -if (elgg_instanceof($owner, 'user')) { - $sidebar .= elgg_view_latest_comments(elgg_get_page_owner_guid(), 'object', 'file'); -} - -$params['content'] = $content; -$params['title'] = $title; -$params['sidebar'] = $sidebar; - -$body = elgg_view_layout('content', $params); - -echo elgg_view_page($title, $body); diff --git a/mod/file/pages/file/owner.php b/mod/file/pages/file/owner.php new file mode 100644 index 000000000..617e4c7f4 --- /dev/null +++ b/mod/file/pages/file/owner.php @@ -0,0 +1,69 @@ +name); + +$params = array(); + +if ($owner->guid == elgg_get_logged_in_user_guid()) { + // user looking at own files + $title = elgg_echo('file:yours'); + $params['filter_context'] = 'mine'; +} else if (elgg_instanceof($owner, 'user')) { + // someone else's files + $title = elgg_echo("file:user", array($owner->name)); + // do not show button or select a tab when viewing someone else's posts + $params['filter_context'] = 'none'; + $params['buttons'] = ''; +} else { + // group files + $title = elgg_echo("file:user", array($owner->name)); + $params['filter'] = ''; + if ($owner->isMember(elgg_get_logged_in_user_entity())) { + $url = "file/add/$owner->guid"; + $vars = array( + 'href' => $url, + 'text' => elgg_echo("file:add"), + 'class' => 'elgg-button elgg-button-action', + ); + $button = elgg_view('output/url', $vars); + $params['buttons'] = $button; + } else { + $params['buttons'] = ''; + } +} + +// List files +$content = elgg_list_entities(array( + 'types' => 'object', + 'subtypes' => 'file', + 'container_guid' => $owner->guid, + 'limit' => 10, + 'full_view' => FALSE, +)); +if (!$content) { + $content = elgg_echo("file:none"); +} + +$sidebar = file_get_type_cloud(elgg_get_page_owner_guid()); +if (elgg_instanceof($owner, 'user')) { + $sidebar .= elgg_view_latest_comments(elgg_get_page_owner_guid(), 'object', 'file'); +} + +$params['content'] = $content; +$params['title'] = $title; +$params['sidebar'] = $sidebar; + +$body = elgg_view_layout('content', $params); + +echo elgg_view_page($title, $body); diff --git a/mod/file/start.php b/mod/file/start.php index f49c6fc91..a332b356f 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -91,7 +91,7 @@ function file_page_handler($page) { $page_type = $page[0]; switch ($page_type) { case 'owner': - include "$file_dir/index.php"; + include "$file_dir/owner.php"; break; case 'friends': include "$file_dir/friends.php"; diff --git a/mod/pages/pages/pages/index.php b/mod/pages/pages/pages/index.php deleted file mode 100644 index 6a89e6092..000000000 --- a/mod/pages/pages/pages/index.php +++ /dev/null @@ -1,49 +0,0 @@ -name)); - -elgg_push_breadcrumb($owner->name); - -$content = elgg_list_entities(array( - 'types' => 'object', - 'subtypes' => 'page_top', - 'container_guid' => elgg_get_page_owner_guid(), - 'limit' => $limit, - 'full_view' => false, -)); -if (!$content) { - $content = '

' . elgg_echo('pages:none') . '

'; -} - -$filter_context = ''; -if (elgg_get_page_owner_guid() == elgg_get_logged_in_user_guid()) { - $filter_context = 'mine'; -} - -$params = array( - 'filter_context' => $filter_context, - 'content' => $content, - 'title' => $title, - 'sidebar' => elgg_view('pages/sidebar/navigation'), -); - -if (elgg_instanceof($owner, 'group')) { - $params['filter'] = ''; -} - -$body = elgg_view_layout('content', $params); - -echo elgg_view_page($title, $body); diff --git a/mod/pages/pages/pages/owner.php b/mod/pages/pages/pages/owner.php new file mode 100644 index 000000000..6a89e6092 --- /dev/null +++ b/mod/pages/pages/pages/owner.php @@ -0,0 +1,49 @@ +name)); + +elgg_push_breadcrumb($owner->name); + +$content = elgg_list_entities(array( + 'types' => 'object', + 'subtypes' => 'page_top', + 'container_guid' => elgg_get_page_owner_guid(), + 'limit' => $limit, + 'full_view' => false, +)); +if (!$content) { + $content = '

' . elgg_echo('pages:none') . '

'; +} + +$filter_context = ''; +if (elgg_get_page_owner_guid() == elgg_get_logged_in_user_guid()) { + $filter_context = 'mine'; +} + +$params = array( + 'filter_context' => $filter_context, + 'content' => $content, + 'title' => $title, + 'sidebar' => elgg_view('pages/sidebar/navigation'), +); + +if (elgg_instanceof($owner, 'group')) { + $params['filter'] = ''; +} + +$body = elgg_view_layout('content', $params); + +echo elgg_view_page($title, $body); diff --git a/mod/pages/start.php b/mod/pages/start.php index 7a4df23c4..2ce7d1b0f 100644 --- a/mod/pages/start.php +++ b/mod/pages/start.php @@ -120,7 +120,7 @@ function pages_page_handler($page) { $page_type = $page[0]; switch ($page_type) { case 'owner': - include "$base_dir/index.php"; + include "$base_dir/owner.php"; break; case 'friends': include "$base_dir/friends.php"; diff --git a/mod/thewire/pages/thewire/owner.php b/mod/thewire/pages/thewire/owner.php new file mode 100644 index 000000000..5645b23ba --- /dev/null +++ b/mod/thewire/pages/thewire/owner.php @@ -0,0 +1,33 @@ +name)); + +elgg_push_breadcrumb(elgg_echo('thewire'), "thewire/all"); +elgg_push_breadcrumb($owner->name); + +if (get_loggedin_userid() == $owner->guid) { + $content = elgg_view_form('thewire/add'); + $content .= elgg_view('input/urlshortener'); +} + +$content .= elgg_list_entities(array( + 'type' => 'object', + 'subtype' => 'thewire', + 'owner_guid' => $owner->guid, + 'limit' => 15, +)); + +$body = elgg_view_layout('content', array( + 'filter_context' => 'mine', + 'content' => $content, + 'title' => $title, + 'buttons' => false, +)); + +echo elgg_view_page($title, $body); diff --git a/mod/thewire/pages/thewire/user.php b/mod/thewire/pages/thewire/user.php deleted file mode 100644 index 5645b23ba..000000000 --- a/mod/thewire/pages/thewire/user.php +++ /dev/null @@ -1,33 +0,0 @@ -name)); - -elgg_push_breadcrumb(elgg_echo('thewire'), "thewire/all"); -elgg_push_breadcrumb($owner->name); - -if (get_loggedin_userid() == $owner->guid) { - $content = elgg_view_form('thewire/add'); - $content .= elgg_view('input/urlshortener'); -} - -$content .= elgg_list_entities(array( - 'type' => 'object', - 'subtype' => 'thewire', - 'owner_guid' => $owner->guid, - 'limit' => 15, -)); - -$body = elgg_view_layout('content', array( - 'filter_context' => 'mine', - 'content' => $content, - 'title' => $title, - 'buttons' => false, -)); - -echo elgg_view_page($title, $body); diff --git a/mod/thewire/start.php b/mod/thewire/start.php index 26a1adbec..c87831bee 100644 --- a/mod/thewire/start.php +++ b/mod/thewire/start.php @@ -80,49 +80,51 @@ function thewire_init() { */ function thewire_page_handler($page) { + $base_dir = elgg_get_plugins_path() . 'thewire/pages/thewire'; + // if just /thewire go to global view in the else statement if (isset($page[0]) && $page[0]) { switch ($page[0]) { case "all": - include dirname(__FILE__) . "/pages/thewire/everyone.php"; + include "$base_dir/everyone.php"; break; case "friends": - include dirname(__FILE__) . "/pages/thewire/friends.php"; + include "$base_dir/friends.php"; break; case "owner": - include dirname(__FILE__) . "/pages/thewire/user.php"; + include "$base_dir/owner.php"; break; case "thread": if (isset($page[1])) { set_input('thread_id', $page[1]); } - include dirname(__FILE__) . "/pages/thewire/thread.php"; + include "$base_dir/thread.php"; break; case "reply": if (isset($page[1])) { set_input('guid', $page[1]); } - include dirname(__FILE__) . "/pages/thewire/reply.php"; + include "$base_dir/reply.php"; break; case "tag": if (isset($page[1])) { set_input('tag', $page[1]); } - include dirname(__FILE__) . "/pages/thewire/tag.php"; + include "$base_dir/tag.php"; break; case "previous": if (isset($page[1])) { set_input('guid', $page[1]); } - include dirname(__FILE__) . "/pages/thewire/previous.php"; + include "$base_dir/previous.php"; break; } } else { - include dirname(__FILE__) . "/pages/thewire/everyone.php"; + include "$base_dir/everyone.php"; } return true; -- cgit v1.2.3