summaryrefslogtreecommitdiff
path: root/modules/tag/helpers
diff options
context:
space:
mode:
authorjhilden <jakobhilden@gmail.com>2009-06-29 16:03:45 -0400
committerjhilden <jakobhilden@gmail.com>2009-06-29 16:03:45 -0400
commitb31b3bd5bff4f8d5b5721e0fdd86579028a5b03a (patch)
tree9baa2a301c1e26dcf872e0bbfbb09be34cb020d5 /modules/tag/helpers
parenteb82f6a64a6b4e0b4e18ca92689bd467cba6e1bd (diff)
parent5de6de6a133c6c906ee63b5a2ab1b08bc14ca17e (diff)
Merge branch 'master' of git@github.com:gallery/gallery3
Diffstat (limited to 'modules/tag/helpers')
-rw-r--r--modules/tag/helpers/tag_event.php7
-rw-r--r--modules/tag/helpers/tag_installer.php35
-rw-r--r--modules/tag/helpers/tag_theme.php7
3 files changed, 27 insertions, 22 deletions
diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php
index 735422b5..946326c0 100644
--- a/modules/tag/helpers/tag_event.php
+++ b/modules/tag/helpers/tag_event.php
@@ -45,7 +45,12 @@ class tag_event_Core {
// @todo figure out how to read the keywords from xmp
foreach(array_keys($tags) as $tag) {
- tag::add($photo, $tag);
+ try {
+ tag::add($photo, $tag);
+ } catch (Exception $e) {
+ Kohana::log("error", "Error adding tag: $tag\n" .
+ $e->getMessage() . "\n" . $e->getTraceAsString());
+ }
}
return;
diff --git a/modules/tag/helpers/tag_installer.php b/modules/tag/helpers/tag_installer.php
index 07544c54..3c16e3f3 100644
--- a/modules/tag/helpers/tag_installer.php
+++ b/modules/tag/helpers/tag_installer.php
@@ -20,26 +20,23 @@
class tag_installer {
static function install() {
$db = Database::instance();
- $version = module::get_version("tag");
- if ($version == 0) {
- $db->query("CREATE TABLE IF NOT EXISTS {tags} (
- `id` int(9) NOT NULL auto_increment,
- `name` varchar(64) NOT NULL,
- `count` int(10) unsigned NOT NULL DEFAULT 0,
- PRIMARY KEY (`id`),
- UNIQUE KEY(`name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ $db->query("CREATE TABLE IF NOT EXISTS {tags} (
+ `id` int(9) NOT NULL auto_increment,
+ `name` varchar(64) NOT NULL,
+ `count` int(10) unsigned NOT NULL DEFAULT 0,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY(`name`))
+ ENGINE=InnoDB DEFAULT CHARSET=utf8;");
- $db->query("CREATE TABLE IF NOT EXISTS {items_tags} (
- `id` int(9) NOT NULL auto_increment,
- `item_id` int(9) NOT NULL,
- `tag_id` int(9) NOT NULL,
- PRIMARY KEY (`id`),
- KEY(`tag_id`, `id`),
- KEY(`item_id`, `id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
- module::set_version("tag", 1);
- }
+ $db->query("CREATE TABLE IF NOT EXISTS {items_tags} (
+ `id` int(9) NOT NULL auto_increment,
+ `item_id` int(9) NOT NULL,
+ `tag_id` int(9) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY(`tag_id`, `id`),
+ KEY(`item_id`, `id`))
+ ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ module::set_version("tag", 1);
}
static function uninstall() {
diff --git a/modules/tag/helpers/tag_theme.php b/modules/tag/helpers/tag_theme.php
index a32d71b6..b48ad178 100644
--- a/modules/tag/helpers/tag_theme.php
+++ b/modules/tag/helpers/tag_theme.php
@@ -19,8 +19,11 @@
*/
class tag_theme_Core {
static function head($theme) {
- $url = url::file("modules/tag/js/tag.js");
- return "<script src=\"$url\" type=\"text/javascript\"></script>";
+ $theme->script("modules/tag/js/tag.js");
+ }
+
+ static function admin_head($theme) {
+ $theme->script("modules/tag/js/tag.js");
}
static function sidebar_blocks($theme) {