aboutsummaryrefslogtreecommitdiff
path: root/mod/bookmarks
diff options
context:
space:
mode:
Diffstat (limited to 'mod/bookmarks')
-rw-r--r--mod/bookmarks/actions/bookmarks/save.php19
-rw-r--r--mod/bookmarks/languages/en.php5
-rw-r--r--mod/bookmarks/manifest.xml7
-rw-r--r--mod/bookmarks/pages/bookmarks/all.php4
-rw-r--r--mod/bookmarks/pages/bookmarks/friends.php11
-rw-r--r--mod/bookmarks/pages/bookmarks/owner.php3
-rw-r--r--mod/bookmarks/pages/bookmarks/view.php1
-rw-r--r--mod/bookmarks/start.php2
-rw-r--r--mod/bookmarks/views/default/bookmarks/bookmarklet.php9
-rw-r--r--mod/bookmarks/views/default/bookmarks/group_module.php2
-rw-r--r--mod/bookmarks/views/default/bookmarks/js.php2
-rw-r--r--mod/bookmarks/views/default/object/bookmarks.php28
-rw-r--r--mod/bookmarks/views/default/river/object/bookmarks/create.php2
-rw-r--r--mod/bookmarks/views/default/widgets/bookmarks/content.php1
-rw-r--r--mod/bookmarks/views/default/widgets/bookmarks/edit.php8
-rw-r--r--mod/bookmarks/views/rss/object/bookmarks.php36
16 files changed, 95 insertions, 45 deletions
diff --git a/mod/bookmarks/actions/bookmarks/save.php b/mod/bookmarks/actions/bookmarks/save.php
index 19bb3c73a..f240c4b26 100644
--- a/mod/bookmarks/actions/bookmarks/save.php
+++ b/mod/bookmarks/actions/bookmarks/save.php
@@ -24,7 +24,24 @@ if ($address && !preg_match("#^((ht|f)tps?:)?//#i", $address)) {
$address = "http://$address";
}
-if (!$title || !$address || !filter_var($address, FILTER_VALIDATE_URL)) {
+if (!$title || !$address) {
+ register_error(elgg_echo('bookmarks:save:failed'));
+ forward(REFERER);
+}
+
+// see https://bugs.php.net/bug.php?id=51192
+$php_5_2_13_and_below = version_compare(PHP_VERSION, '5.2.14', '<');
+$php_5_3_0_to_5_3_2 = version_compare(PHP_VERSION, '5.3.0', '>=') &&
+ version_compare(PHP_VERSION, '5.3.3', '<');
+
+$validated = false;
+if ($php_5_2_13_and_below || $php_5_3_0_to_5_3_2) {
+ $tmp_address = str_replace("-", "", $address);
+ $validated = filter_var($tmp_address, FILTER_VALIDATE_URL);
+} else {
+ $validated = filter_var($address, FILTER_VALIDATE_URL);
+}
+if (!$validated) {
register_error(elgg_echo('bookmarks:save:failed'));
forward(REFERER);
}
diff --git a/mod/bookmarks/languages/en.php b/mod/bookmarks/languages/en.php
index 1d32a0344..2c589c207 100644
--- a/mod/bookmarks/languages/en.php
+++ b/mod/bookmarks/languages/en.php
@@ -24,7 +24,7 @@ $english = array(
'bookmarks:with' => "Share with",
'bookmarks:new' => "A new bookmark",
'bookmarks:via' => "via bookmarks",
- 'bookmarks:address' => "Address of the resource to bookmark",
+ 'bookmarks:address' => "Address of the bookmark",
'bookmarks:none' => 'No bookmarks',
'bookmarks:delete:confirm' => "Are you sure you want to delete this resource?",
@@ -68,13 +68,14 @@ $english = array(
*/
'bookmarks:save:success' => "Your item was successfully bookmarked.",
- 'bookmarks:delete:success' => "Your bookmarked item was successfully deleted.",
+ 'bookmarks:delete:success' => "Your bookmark was deleted.",
/**
* Error messages
*/
'bookmarks:save:failed' => "Your bookmark could not be saved. Make sure you've entered a title and address and then try again.",
+ 'bookmarks:save:invalid' => "The address of the bookmark is invalid and could not be saved.",
'bookmarks:delete:failed' => "Your bookmark could not be deleted. Please try again.",
);
diff --git a/mod/bookmarks/manifest.xml b/mod/bookmarks/manifest.xml
index 72e9af9b0..b95af87f8 100644
--- a/mod/bookmarks/manifest.xml
+++ b/mod/bookmarks/manifest.xml
@@ -10,11 +10,10 @@
<description>Adds the ability for users to bookmark internal and external sites. Other users can then comment on the bookmarks.</description>
<website>http://www.elgg.org/</website>
<copyright>See COPYRIGHT.txt</copyright>
- <license>GNU Public License version 2</license>
+ <license>GNU General Public License version 2</license>
<requires>
- <type>elgg_version</type>
- <version>2010030101</version>
+ <type>elgg_release</type>
+ <version>1.8</version>
</requires>
<activate_on_install>true</activate_on_install>
- <admin_interface>simple</admin_interface>
</plugin_manifest>
diff --git a/mod/bookmarks/pages/bookmarks/all.php b/mod/bookmarks/pages/bookmarks/all.php
index d9ac2767f..f57776752 100644
--- a/mod/bookmarks/pages/bookmarks/all.php
+++ b/mod/bookmarks/pages/bookmarks/all.php
@@ -20,6 +20,10 @@ $content = elgg_list_entities(array(
'view_toggle_type' => false
));
+if (!$content) {
+ $content = elgg_echo('bookmarks:none');
+}
+
$title = elgg_echo('bookmarks:everyone');
$body = elgg_view_layout('content', array(
diff --git a/mod/bookmarks/pages/bookmarks/friends.php b/mod/bookmarks/pages/bookmarks/friends.php
index 3491090a5..15b1da098 100644
--- a/mod/bookmarks/pages/bookmarks/friends.php
+++ b/mod/bookmarks/pages/bookmarks/friends.php
@@ -5,16 +5,19 @@
* @package ElggBookmarks
*/
-$owner = elgg_get_page_owner_entity();
+$page_owner = elgg_get_page_owner_entity();
+if (!$page_owner) {
+ forward('bookmarks/all');
+}
-elgg_push_breadcrumb($owner->name, "bookmarks/owner/$owner->username");
+elgg_push_breadcrumb($page_owner->name, "bookmarks/owner/$page_owner->username");
elgg_push_breadcrumb(elgg_echo('friends'));
elgg_register_title_button();
$title = elgg_echo('bookmarks:friends');
-$content = list_user_friends_objects($owner->guid, 'bookmarks', 10, false);
+$content = list_user_friends_objects($page_owner->guid, 'bookmarks', 10, false);
if (!$content) {
$content = elgg_echo('bookmarks:none');
}
@@ -27,4 +30,4 @@ $params = array(
$body = elgg_view_layout('content', $params);
-echo elgg_view_page($title, $body); \ No newline at end of file
+echo elgg_view_page($title, $body);
diff --git a/mod/bookmarks/pages/bookmarks/owner.php b/mod/bookmarks/pages/bookmarks/owner.php
index 679c986be..7f55e08de 100644
--- a/mod/bookmarks/pages/bookmarks/owner.php
+++ b/mod/bookmarks/pages/bookmarks/owner.php
@@ -6,6 +6,9 @@
*/
$page_owner = elgg_get_page_owner_entity();
+if (!$page_owner) {
+ forward('bookmarks/all');
+}
elgg_push_breadcrumb($page_owner->name);
diff --git a/mod/bookmarks/pages/bookmarks/view.php b/mod/bookmarks/pages/bookmarks/view.php
index 8e097b090..2439d2ee8 100644
--- a/mod/bookmarks/pages/bookmarks/view.php
+++ b/mod/bookmarks/pages/bookmarks/view.php
@@ -28,7 +28,6 @@ $body = elgg_view_layout('content', array(
'content' => $content,
'title' => $title,
'filter' => '',
- 'header' => '',
));
echo elgg_view_page($title, $body);
diff --git a/mod/bookmarks/start.php b/mod/bookmarks/start.php
index 2a7b44e97..21a2d8940 100644
--- a/mod/bookmarks/start.php
+++ b/mod/bookmarks/start.php
@@ -83,6 +83,7 @@ function bookmarks_init() {
* Title is ignored
*
* @param array $page
+ * @return bool
*/
function bookmarks_page_handler($page) {
elgg_load_library('elgg:bookmarks');
@@ -151,7 +152,6 @@ function bookmarks_page_handler($page) {
}
elgg_pop_context();
-
return true;
}
diff --git a/mod/bookmarks/views/default/bookmarks/bookmarklet.php b/mod/bookmarks/views/default/bookmarks/bookmarklet.php
index 1d0b25498..b3e9737fe 100644
--- a/mod/bookmarks/views/default/bookmarks/bookmarklet.php
+++ b/mod/bookmarks/views/default/bookmarks/bookmarklet.php
@@ -20,13 +20,16 @@ if (!$name && ($user = elgg_get_logged_in_user_entity())) {
}
$url = elgg_get_site_url();
-
+$img = elgg_view('output/img', array(
+ 'src' => 'mod/bookmarks/graphics/bookmarklet.gif',
+ 'alt' => $title,
+));
$bookmarklet = "<a href=\"javascript:location.href='{$url}bookmarks/add/$guid?address='"
. "+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)\">"
- . "<img src=\"{$url}mod/bookmarks/graphics/bookmarklet.gif\" alt=\"$title\" /> </a>";
+ . $img . "</a>";
?>
<p><?php echo elgg_echo("bookmarks:bookmarklet:description"); ?></p>
<p><?php echo $bookmarklet; ?></p>
<p><?php echo elgg_echo("bookmarks:bookmarklet:descriptionie"); ?></p>
-<p><?php echo elgg_echo("bookmarks:bookmarklet:description:conclusion"); ?></p> \ No newline at end of file
+<p><?php echo elgg_echo("bookmarks:bookmarklet:description:conclusion"); ?></p>
diff --git a/mod/bookmarks/views/default/bookmarks/group_module.php b/mod/bookmarks/views/default/bookmarks/group_module.php
index 3797de010..60a727819 100644
--- a/mod/bookmarks/views/default/bookmarks/group_module.php
+++ b/mod/bookmarks/views/default/bookmarks/group_module.php
@@ -14,6 +14,7 @@ if ($group->bookmarks_enable == "no") {
$all_link = elgg_view('output/url', array(
'href' => "bookmarks/group/$group->guid/all",
'text' => elgg_echo('link:view:all'),
+ 'is_trusted' => true,
));
elgg_push_context('widgets');
@@ -35,6 +36,7 @@ if (!$content) {
$new_link = elgg_view('output/url', array(
'href' => "bookmarks/add/$group->guid",
'text' => elgg_echo('bookmarks:add'),
+ 'is_trusted' => true,
));
echo elgg_view('groups/profile/module', array(
diff --git a/mod/bookmarks/views/default/bookmarks/js.php b/mod/bookmarks/views/default/bookmarks/js.php
index 0e55c510a..c36823c09 100644
--- a/mod/bookmarks/views/default/bookmarks/js.php
+++ b/mod/bookmarks/views/default/bookmarks/js.php
@@ -7,6 +7,6 @@ elgg.bookmarks.init = function() {
var e = $('a.elgg-bookmark-page');
var link = e.attr('href') + '&title=' + encodeURIComponent(title);
e.attr('href', link);
-}
+};
elgg.register_hook_handler('init', 'system', elgg.bookmarks.init);
diff --git a/mod/bookmarks/views/default/object/bookmarks.php b/mod/bookmarks/views/default/object/bookmarks.php
index ca1f5d312..89a0d03e0 100644
--- a/mod/bookmarks/views/default/object/bookmarks.php
+++ b/mod/bookmarks/views/default/object/bookmarks.php
@@ -17,12 +17,13 @@ $owner_icon = elgg_view_entity_icon($owner, 'tiny');
$container = $bookmark->getContainerEntity();
$categories = elgg_view('output/categories', $vars);
-$link = filter_tags(elgg_view('output/url', array('href' => $bookmark->address, 'rel' => 'nofollow')));
+$link = elgg_view('output/url', array('href' => $bookmark->address));
$description = elgg_view('output/longtext', array('value' => $bookmark->description, 'class' => 'pbl'));
$owner_link = elgg_view('output/url', array(
'href' => "bookmarks/owner/$owner->username",
'text' => $owner->name,
+ 'is_trusted' => true,
));
$author_text = elgg_echo('byline', array($owner_link));
@@ -36,6 +37,7 @@ if ($comments_count != 0) {
$comments_link = elgg_view('output/url', array(
'href' => $bookmark->getURL() . '#comments',
'text' => $text,
+ 'is_trusted' => true,
));
} else {
$comments_link = '';
@@ -48,7 +50,7 @@ $metadata = elgg_view_menu('entity', array(
'class' => 'elgg-menu-hz',
));
-$subtitle = "$author_text $date $categories $comments_link";
+$subtitle = "$author_text $date $comments_link $categories";
// do not show the metadata and controls in widget view
if (elgg_in_context('widgets')) {
@@ -56,7 +58,6 @@ if (elgg_in_context('widgets')) {
}
if ($full && !elgg_in_context('gallery')) {
- $header = elgg_view_title($bookmark->title);
$params = array(
'entity' => $bookmark,
@@ -66,19 +67,23 @@ if ($full && !elgg_in_context('gallery')) {
'tags' => $tags,
);
$params = $params + $vars;
- $list_body = elgg_view('object/elements/summary', $params);
- $bookmark_info = elgg_view_image_block($owner_icon, $list_body);
+ $summary = elgg_view('object/elements/summary', $params);
$bookmark_icon = elgg_view_icon('push-pin-alt');
- echo <<<HTML
-$header
-$bookmark_info
+ $body = <<<HTML
<div class="bookmark elgg-content mts">
$bookmark_icon<span class="elgg-heading-basic mbs">$link</span>
$description
</div>
HTML;
+ echo elgg_view('object/elements/full', array(
+ 'entity' => $bookmark,
+ 'icon' => $owner_icon,
+ 'summary' => $summary,
+ 'body' => $body,
+ ));
+
} elseif (elgg_in_context('gallery')) {
echo <<<HTML
<div class="bookmarks-gallery-item">
@@ -104,11 +109,10 @@ HTML;
}
}
- $link = filter_tags(elgg_view('output/url', array(
+ $link = elgg_view('output/url', array(
'href' => $bookmark->address,
'text' => $display_text,
- 'rel' => 'nofollow',
- )));
+ ));
$content = elgg_view_icon('push-pin-alt') . "$link{$excerpt}";
@@ -123,4 +127,4 @@ HTML;
$body = elgg_view('object/elements/summary', $params);
echo elgg_view_image_block($owner_icon, $body);
-} \ No newline at end of file
+}
diff --git a/mod/bookmarks/views/default/river/object/bookmarks/create.php b/mod/bookmarks/views/default/river/object/bookmarks/create.php
index 984d109be..388f54ac9 100644
--- a/mod/bookmarks/views/default/river/object/bookmarks/create.php
+++ b/mod/bookmarks/views/default/river/object/bookmarks/create.php
@@ -8,7 +8,7 @@
$object = $vars['item']->getObjectEntity();
$excerpt = elgg_get_excerpt($object->description);
-echo elgg_view('river/item', array(
+echo elgg_view('river/elements/layout', array(
'item' => $vars['item'],
'message' => $excerpt,
'attachments' => elgg_view('output/url', array('href' => $object->address)),
diff --git a/mod/bookmarks/views/default/widgets/bookmarks/content.php b/mod/bookmarks/views/default/widgets/bookmarks/content.php
index ea7816345..0b85017fc 100644
--- a/mod/bookmarks/views/default/widgets/bookmarks/content.php
+++ b/mod/bookmarks/views/default/widgets/bookmarks/content.php
@@ -24,6 +24,7 @@ if ($content) {
$more_link = elgg_view('output/url', array(
'href' => $url,
'text' => elgg_echo('bookmarks:more'),
+ 'is_trusted' => true,
));
echo "<span class=\"elgg-widget-more\">$more_link</span>";
} else {
diff --git a/mod/bookmarks/views/default/widgets/bookmarks/edit.php b/mod/bookmarks/views/default/widgets/bookmarks/edit.php
index 99d65ac8f..ed9c7fd88 100644
--- a/mod/bookmarks/views/default/widgets/bookmarks/edit.php
+++ b/mod/bookmarks/views/default/widgets/bookmarks/edit.php
@@ -6,13 +6,13 @@
*/
// set default value
-if (!isset($vars['entity']->max_display)) {
- $vars['entity']->max_display = 4;
+if (!isset($vars['entity']->num_display)) {
+ $vars['entity']->num_display = 4;
}
$params = array(
- 'name' => 'params[max_display]',
- 'value' => $vars['entity']->max_display,
+ 'name' => 'params[num_display]',
+ 'value' => $vars['entity']->num_display,
'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
);
$dropdown = elgg_view('input/dropdown', $params);
diff --git a/mod/bookmarks/views/rss/object/bookmarks.php b/mod/bookmarks/views/rss/object/bookmarks.php
index 8e88485f1..1abda4710 100644
--- a/mod/bookmarks/views/rss/object/bookmarks.php
+++ b/mod/bookmarks/views/rss/object/bookmarks.php
@@ -1,23 +1,37 @@
<?php
/**
- * Elgg bookmark rss view
- *
+ * Bookmark RSS object view
+ *
* @package ElggBookmarks
*/
$title = $vars['entity']->title;
if (empty($title)) {
- $title = substr($vars['entity']->description,0,32);
- if (strlen($vars['entity']->description) > 32)
- $title .= " ...";
+ $title = strip_tags($vars['entity']->description);
+ $title = elgg_get_excerpt($title, 32);
}
-?>
+$permalink = htmlspecialchars($vars['entity']->getURL(), ENT_NOQUOTES, 'UTF-8');
+$pubdate = date('r', $vars['entity']->getTimeCreated());
+$url_text = elgg_echo('bookmarks:address');
+$link = elgg_view('output/url', array('href' => $vars['entity']->address));
+$description = $vars['entity']->description . "<p>$url_text: $link</p>";
+
+$creator = elgg_view('page/components/creator', $vars);
+$georss = elgg_view('page/components/georss', $vars);
+$extension = elgg_view('extensions/item');
+
+$item = <<<__HTML
<item>
- <guid isPermaLink='true'><?php echo $vars['entity']->getURL(); ?></guid>
- <pubDate><?php echo date("r",$vars['entity']->time_created) ?></pubDate>
- <link><?php echo $vars['entity']->address; ?></link>
- <title><![CDATA[<?php echo $title; ?>]]></title>
- <description><![CDATA[<?php echo (autop($vars['entity']->description)); ?>]]></description>
+ <guid isPermaLink="true">$permalink</guid>
+ <pubDate>$pubdate</pubDate>
+ <link>$permalink</link>
+ <title><![CDATA[$title]]></title>
+ <description><![CDATA[$description]]></description>
+ $creator$georss$extension
</item>
+
+__HTML;
+
+echo $item;