summaryrefslogtreecommitdiff
path: root/modules/tag
diff options
context:
space:
mode:
authorNathan Kinkade <nath@nkinka.de>2011-04-22 16:54:55 +0000
committerNathan Kinkade <nath@nkinka.de>2011-04-22 16:54:55 +0000
commit1f7c1f18c651c58048e92d615c71ac0fe6691c10 (patch)
tree4527c4bc08000a07c180cd1fe81792d71195d58b /modules/tag
parentde6f3fce9110b777d61dec97f2a3a61d887a5ccd (diff)
parent55da59c942c0f7171b515f0718fea8506ed4b116 (diff)
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/tag')
-rw-r--r--modules/tag/controllers/tag.php4
-rw-r--r--modules/tag/helpers/tag_event.php14
-rw-r--r--modules/tag/helpers/tag_item_rest.php1
-rw-r--r--modules/tag/helpers/tag_items_rest.php1
-rw-r--r--modules/tag/models/tag.php2
5 files changed, 11 insertions, 11 deletions
diff --git a/modules/tag/controllers/tag.php b/modules/tag/controllers/tag.php
index 7aa038c6..8f885dea 100644
--- a/modules/tag/controllers/tag.php
+++ b/modules/tag/controllers/tag.php
@@ -19,8 +19,8 @@
*/
class Tag_Controller extends Controller {
public function __call($function, $args) {
- $tag_name = $function;
- $tag = ORM::factory("tag")->where("name", "=", $tag_name)->find();
+ $tag_id = $function;
+ $tag = ORM::factory("tag")->where("id", "=", $tag_id)->find();
$page_size = module::get_var("gallery", "page_size", 9);
$page = (int) Input::instance()->get("page", "1");
$children_count = $tag->items_count();
diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php
index cd79f734..b415b42d 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;
}
}
@@ -113,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("");
@@ -136,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;
}
@@ -151,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[] = "<a href=\"" . url::site("tag/{$tag->name}") . "\">{$tag->name}</a>";
+ $tags[] = "<a href=\"{$tag->url()}\">{$tag->name}</a>";
}
if ($tags) {
$info = $block->content->metadata;
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();
}
diff --git a/modules/tag/models/tag.php b/modules/tag/models/tag.php
index 1f233038..6bc5350a 100644
--- a/modules/tag/models/tag.php
+++ b/modules/tag/models/tag.php
@@ -133,7 +133,7 @@ class Tag_Model_Core extends ORM {
* @param string $query the query string (eg "page=3")
*/
public function url($query=null) {
- $url = url::site("tag/{$this->name}");
+ $url = url::site("tag/{$this->id}/" . urlencode($this->name));
if ($query) {
$url .= "?$query";
}