summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorChad Kieffer <ckieffer@gmail.com>2011-04-22 12:38:10 -0400
committerChad Kieffer <ckieffer@gmail.com>2011-04-22 12:38:10 -0400
commitfbf02970e1c454ad99b2fc01a897a8de834d7e7c (patch)
treedf6f587fe1ed2635d8becd655d9a9518a5d0bc3a /modules
parent4a9b45c9c3bbd574103e01debcd84cab1a18352a (diff)
parent55da59c942c0f7171b515f0718fea8506ed4b116 (diff)
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules')
-rw-r--r--modules/exif/helpers/exif_event.php6
-rw-r--r--modules/gallery/controllers/admin_themes.php3
-rw-r--r--modules/gallery/helpers/theme.php23
-rw-r--r--modules/gallery/libraries/Gallery_View.php6
-rw-r--r--modules/gallery/views/admin_languages.html.php2
-rw-r--r--modules/gallery/views/admin_modules.html.php2
-rw-r--r--modules/tag/helpers/tag_event.php2
-rw-r--r--modules/tag/models/tag.php2
8 files changed, 42 insertions, 4 deletions
diff --git a/modules/exif/helpers/exif_event.php b/modules/exif/helpers/exif_event.php
index e594c765..72e88041 100644
--- a/modules/exif/helpers/exif_event.php
+++ b/modules/exif/helpers/exif_event.php
@@ -24,6 +24,12 @@ class exif_event_Core {
}
}
+ static function item_updated_data_file($item) {
+ if (!$item->is_album()) {
+ exif::extract($item);
+ }
+ }
+
static function item_deleted($item) {
db::build()
->delete("exif_records")
diff --git a/modules/gallery/controllers/admin_themes.php b/modules/gallery/controllers/admin_themes.php
index cd8a5530..9cdc3db5 100644
--- a/modules/gallery/controllers/admin_themes.php
+++ b/modules/gallery/controllers/admin_themes.php
@@ -25,6 +25,9 @@ class Admin_Themes_Controller extends Admin_Controller {
$view->content->admin = module::get_var("gallery", "active_admin_theme");
$view->content->site = module::get_var("gallery", "active_site_theme");
$view->content->themes = $this->_get_themes();
+
+ site_status::clear("missing_site_theme");
+ site_status::clear("missing_admin_theme");
print $view;
}
diff --git a/modules/gallery/helpers/theme.php b/modules/gallery/helpers/theme.php
index f285834c..37707f28 100644
--- a/modules/gallery/helpers/theme.php
+++ b/modules/gallery/helpers/theme.php
@@ -41,11 +41,34 @@ class theme_Core {
$config = Kohana_Config::instance();
$modules = $config->get("core.modules");
+
+ // Normally Router::find_uri() strips off the url suffix for us, but we're working off of the
+ // PATH_INFO here so we need to strip it off manually
+ if ($suffix = Kohana::config("core.url_suffix")) {
+ $path = preg_replace("#" . preg_quote($suffix) . "$#u", "", $path);
+ }
+
self::$is_admin = $path == "/admin" || !strncmp($path, "/admin/", 7);
self::$site_theme_name = module::get_var("gallery", "active_site_theme");
+
+ // If the site theme doesn't exist, fall back to wind.
+ if (!file_exists(THEMEPATH . self::$site_theme_name . "/theme.info")) {
+ site_status::error(t("Theme '%name' is missing. Falling back to the Wind theme.",
+ array("name" => self::$site_theme_name)), "missing_site_theme");
+ module::set_var("gallery", "active_site_theme", self::$site_theme_name = "wind");
+ }
+
if (self::$is_admin) {
// Load the admin theme
self::$admin_theme_name = module::get_var("gallery", "active_admin_theme");
+
+ // If the admin theme doesn't exist, fall back to admin_wind.
+ if (!file_exists(THEMEPATH . self::$admin_theme_name . "/theme.info")) {
+ site_status::error(t("Admin theme '%name' is missing! Falling back to the Wind theme.",
+ array("name" => self::$admin_theme_name)), "missing_admin_theme");
+ module::set_var("gallery", "active_admin_theme", self::$admin_theme_name = "admin_wind");
+ }
+
array_unshift($modules, THEMEPATH . self::$admin_theme_name);
// If the site theme has an admin subdir, load that as a module so that
diff --git a/modules/gallery/libraries/Gallery_View.php b/modules/gallery/libraries/Gallery_View.php
index 562f7929..77e3d204 100644
--- a/modules/gallery/libraries/Gallery_View.php
+++ b/modules/gallery/libraries/Gallery_View.php
@@ -111,6 +111,8 @@ class Gallery_View_Core extends View {
$contents = $cache->get($key);
if (empty($contents)) {
+ module::event("before_combine", $type, $this->combine_queue[$type][$group]);
+
$contents = "";
foreach (array_keys($this->combine_queue[$type][$group]) as $path) {
if ($type == "css") {
@@ -120,6 +122,8 @@ class Gallery_View_Core extends View {
}
}
+ module::event("after_combine", $type, $contents);
+
$cache->set($key, $contents, array($type), 30 * 84600);
$use_gzip = function_exists("gzencode") &&
@@ -128,6 +132,7 @@ class Gallery_View_Core extends View {
$cache->set("{$key}_gz", gzencode($contents, 9, FORCE_GZIP),
array($type, "gzip"), 30 * 84600);
}
+
}
unset($this->combine_queue[$type][$group]);
@@ -158,6 +163,7 @@ class Gallery_View_Core extends View {
$replace[] = "url('" . url::abs_file($relative) . "')";
} else {
Kohana_Log::add("error", "Missing URL reference '{$match[1]}' in CSS file '$css_file'");
+
}
}
$replace = str_replace(DIRECTORY_SEPARATOR, "/", $replace);
diff --git a/modules/gallery/views/admin_languages.html.php b/modules/gallery/views/admin_languages.html.php
index 01d1ce3f..eef087e1 100644
--- a/modules/gallery/views/admin_languages.html.php
+++ b/modules/gallery/views/admin_languages.html.php
@@ -51,7 +51,7 @@
<? foreach ($available_locales as $code => $display_name): ?>
<? if ($i == (int) (count($available_locales)/2)): ?>
</table>
- <table>
+ <table class="g-left">
<tr>
<th> <?= t("Installed") ?> </th>
<th> <?= t("Language") ?> </th>
diff --git a/modules/gallery/views/admin_modules.html.php b/modules/gallery/views/admin_modules.html.php
index f4ae965c..2cc81b0d 100644
--- a/modules/gallery/views/admin_modules.html.php
+++ b/modules/gallery/views/admin_modules.html.php
@@ -6,7 +6,7 @@
dataType: "json",
success: function(data) {
if (data.reload) {
- window.location.reload();
+ window.location = "<? url::site("/admin/modules") ?>";
} else {
$("body").append('<div id="g-dialog">' + data.dialog + '</div>');
$("#g-dialog").dialog({
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[] = "<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/models/tag.php b/modules/tag/models/tag.php
index 479a7da0..bd665667 100644
--- a/modules/tag/models/tag.php
+++ b/modules/tag/models/tag.php
@@ -132,7 +132,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->id}/{$this->name}");
+ $url = url::site("tag/{$this->id}/" . urlencode($this->name));
if ($query) {
$url .= "?$query";
}