aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod/bookmarks/lib/bookmarks.php2
-rw-r--r--mod/bookmarks/pages/add.php2
-rw-r--r--mod/bookmarks/pages/edit.php3
-rw-r--r--mod/bookmarks/pages/owner.php20
-rw-r--r--mod/bookmarks/start.php8
5 files changed, 24 insertions, 11 deletions
diff --git a/mod/bookmarks/lib/bookmarks.php b/mod/bookmarks/lib/bookmarks.php
index 3ffda737d..815330e2c 100644
--- a/mod/bookmarks/lib/bookmarks.php
+++ b/mod/bookmarks/lib/bookmarks.php
@@ -6,7 +6,7 @@
*/
/**
- * Prepare the upload/edit form variables
+ * Prepare the add/edit form variables
*
* @param ElggObject $bookmark A bookmark object.
* @return array
diff --git a/mod/bookmarks/pages/add.php b/mod/bookmarks/pages/add.php
index 77b9a0bd0..c748daca5 100644
--- a/mod/bookmarks/pages/add.php
+++ b/mod/bookmarks/pages/add.php
@@ -5,8 +5,6 @@
* @package Bookmarks
*/
-gatekeeper();
-
$bookmark_guid = get_input('guid');
$bookmark = get_entity($bookmark_guid);
$container_guid = (int) get_input('container_guid');
diff --git a/mod/bookmarks/pages/edit.php b/mod/bookmarks/pages/edit.php
index 1c74a592a..7b055e699 100644
--- a/mod/bookmarks/pages/edit.php
+++ b/mod/bookmarks/pages/edit.php
@@ -5,13 +5,12 @@
* @package ElggBookmarks
*/
-gatekeeper();
$bookmark_guid = get_input('guid');
$bookmark = get_entity($bookmark_guid);
$container_guid = (int) get_input('container_guid');
$container = get_entity($container_guid);
-if (!elgg_instanceof($bookmark, 'object', 'bookmarks')) {
+if (!elgg_instanceof($bookmark, 'object', 'bookmarks') || !$bookmark->canEdit()) {
register_error(elgg_echo('bookmarks:unknown_bookmark'));
forward(REFERRER);
}
diff --git a/mod/bookmarks/pages/owner.php b/mod/bookmarks/pages/owner.php
index 2216b593f..c11d6628e 100644
--- a/mod/bookmarks/pages/owner.php
+++ b/mod/bookmarks/pages/owner.php
@@ -5,11 +5,10 @@
* @package Bookmarks
*/
+$guid = get_input('guid');
+
+elgg_set_page_owner_guid($guid);
$page_owner = elgg_get_page_owner_entity();
-if (!$page_owner) {
- $page_owner = elgg_get_logged_in_user_guid();
- elgg_set_page_owner_guid($page_owner);
-}
elgg_push_breadcrumb($page_owner->name);
@@ -17,17 +16,26 @@ $offset = (int)get_input('offset', 0);
$content .= elgg_list_entities(array(
'type' => 'object',
'subtype' => 'bookmarks',
- 'owner_guid' => $page_owner->guid,
+ 'container_guid' => $page_owner->guid,
'limit' => 10,
'offset' => $offset,
'full_view' => false,
'view_toggle_type' => false
));
+if (!$content) {
+ $content = elgg_echo('bookmarks:none');
+}
+
$title = elgg_echo('bookmarks:owner', array($page_owner->name));
+$filter_context = '';
+if ($page_owner->getGUID() == elgg_get_logged_in_user_guid()) {
+ $filter_context = 'mine';
+}
+
$body = elgg_view_layout('content', array(
- 'filter_context' => 'mine',
+ 'filter_context' => $filter_context,
'content' => $content,
'title' => $title
));
diff --git a/mod/bookmarks/start.php b/mod/bookmarks/start.php
index 90dd89f18..00a640644 100644
--- a/mod/bookmarks/start.php
+++ b/mod/bookmarks/start.php
@@ -117,15 +117,23 @@ function bookmarks_page_handler($page) {
break;
case "add":
+ gatekeeper();
set_input('container_guid', $page[1]);
include "$pages/add.php";
break;
case "edit":
+ gatekeeper();
set_input('guid', $page[1]);
include "$pages/edit.php";
break;
+ case 'group':
+ group_gatekeeper();
+ set_input('guid', $page[1]);
+ include "$pages/owner.php";
+ break;
+
case "bookmarklet":
set_input('container_guid', $page[1]);
include "$pages/bookmarklet.php";