From fa6f233603267505c216abc4f12663d245cd23e7 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 27 Mar 2011 11:31:34 -0700 Subject: Centralize our encoding code into a new helpers and use mb_convert_encoding if possible. Build on the work in c791ae96d5bb28f39b26a0e556e10e636f97436c by momo-i. Fixes #1660. --- modules/tag/helpers/tag_event.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'modules/tag/helpers') diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php index cd79f734..efef916f 100644 --- a/modules/tag/helpers/tag_event.php +++ b/modules/tag/helpers/tag_event.php @@ -36,10 +36,7 @@ class tag_event_Core { $tag = str_replace("\0", "", $tag); foreach (explode(",", $tag) as $word) { $word = trim($word); - if (function_exists("mb_detect_encoding") && - mb_detect_encoding($word, "ISO-8859-1, UTF-8") != "UTF-8") { - $word = utf8_encode($word); - } + $word = encoding::convert_to_utf8($word); $tags[$word] = 1; } } -- cgit v1.2.3 From 074f801acdd7d7b1a0a0a5e4ac8c5badfc253cad Mon Sep 17 00:00:00 2001 From: Joe7 Date: Sat, 2 Apr 2011 18:52:54 +0200 Subject: Fix against Ticket #1666 --- modules/tag/helpers/tag_event.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'modules/tag/helpers') diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php index efef916f..df81ae65 100644 --- a/modules/tag/helpers/tag_event.php +++ b/modules/tag/helpers/tag_event.php @@ -110,11 +110,11 @@ class tag_event_Core { } static function add_photos_form($album, $form) { - if (!isset($group->uploadify)) { + $group = $form->add_photos; + if (!is_object($group->uploadify)) { return; } - $group = $form->add_photos; $group->input("tags") ->label(t("Add tags to all uploaded files")) ->value(""); @@ -133,7 +133,8 @@ class tag_event_Core { } static function add_photos_form_completed($album, $form) { - if (!isset($group->uploadify)) { + $group = $form->add_photos; + if (!is_object($group->uploadify)) { return; } -- cgit v1.2.3 From 5b927a7083c8886a42519f9199666431bac0b650 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 4 Apr 2011 17:45:09 -0700 Subject: Guard against registered users removing tags from items they don't own. Fixes #1671. --- modules/tag/helpers/tag_item_rest.php | 1 + modules/tag/helpers/tag_items_rest.php | 1 + 2 files changed, 2 insertions(+) (limited to 'modules/tag/helpers') diff --git a/modules/tag/helpers/tag_item_rest.php b/modules/tag/helpers/tag_item_rest.php index a8d3d0bc..be1fa653 100644 --- a/modules/tag/helpers/tag_item_rest.php +++ b/modules/tag/helpers/tag_item_rest.php @@ -29,6 +29,7 @@ class tag_item_rest_Core { static function delete($request) { list ($tag, $item) = rest::resolve($request->url); + access::required("edit", $item); $tag->remove($item); $tag->save(); } diff --git a/modules/tag/helpers/tag_items_rest.php b/modules/tag/helpers/tag_items_rest.php index 535ab513..8ed07276 100644 --- a/modules/tag/helpers/tag_items_rest.php +++ b/modules/tag/helpers/tag_items_rest.php @@ -51,6 +51,7 @@ class tag_items_rest_Core { static function delete($request) { list ($tag, $item) = rest::resolve($request->url); + access::required("edit", $item); $tag->remove($item); $tag->save(); } -- cgit v1.2.3 From 8cf066b838a98ace3cfa81e02ccc7a8570d1ba7f Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 21 Apr 2011 15:43:48 -0700 Subject: Use Tag_Model::url() instead of hand creating tag urls, since the API changed and that broke. Fixe #1680. --- modules/tag/helpers/tag_event.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/tag/helpers') diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php index df81ae65..b415b42d 100644 --- a/modules/tag/helpers/tag_event.php +++ b/modules/tag/helpers/tag_event.php @@ -149,7 +149,7 @@ class tag_event_Core { static function info_block_get_metadata($block, $item) { $tags = array(); foreach (tag::item_tags($item) as $tag) { - $tags[] = "name}") . "\">{$tag->name}"; + $tags[] = "url()}\">{$tag->name}"; } if ($tags) { $info = $block->content->metadata; -- cgit v1.2.3