summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/controllers')
-rw-r--r--modules/gallery/controllers/admin_themes.php3
-rw-r--r--modules/gallery/controllers/combined.php33
-rw-r--r--modules/gallery/controllers/upgrader.php11
3 files changed, 32 insertions, 15 deletions
diff --git a/modules/gallery/controllers/admin_themes.php b/modules/gallery/controllers/admin_themes.php
index aef6c2d1..538e5c8d 100644
--- a/modules/gallery/controllers/admin_themes.php
+++ b/modules/gallery/controllers/admin_themes.php
@@ -36,6 +36,9 @@ class Admin_Themes_Controller extends Admin_Controller {
$file = THEMEPATH . "$theme_name/theme.info";
$theme_info = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS);
+ $theme_info->description = t($theme_info->description);
+ $theme_info->name = t($theme_info->name);
+
$themes[$theme_name] = $theme_info;
}
return $themes;
diff --git a/modules/gallery/controllers/combined.php b/modules/gallery/controllers/combined.php
index 9df74638..925d052d 100644
--- a/modules/gallery/controllers/combined.php
+++ b/modules/gallery/controllers/combined.php
@@ -40,9 +40,14 @@ class Combined_Controller extends Controller {
* @param string the key (typically an md5 sum)
*/
private function _emit($type, $key) {
+ $input = Input::instance();
+
// Our data is immutable, so if they already have a copy then it needs no updating.
- if (!empty($_SERVER["HTTP_IF_MODIFIED_SINCE"])) {
+ if ($input->server("HTTP_IF_MODIFIED_SINCE")) {
header('HTTP/1.0 304 Not Modified');
+ header("Expires: Tue, 19 Jan 2038 00:00:00 GMT");
+ header("Cache-Control: max-age=2678400");
+ header('Pragma: public');
return;
}
@@ -54,26 +59,28 @@ class Combined_Controller extends Controller {
Session::abort_save();
$cache = Cache::instance();
- if (strpos($_SERVER["HTTP_ACCEPT_ENCODING"], "gzip") !== false ) {
- $content = $cache->get("{$key}_gz");
- }
-
- if (!$content) {
+ $use_gzip = function_exists("gzencode") &&
+ (strpos($input->server("HTTP_ACCEPT_ENCODING"), "gzip") !== false);
+ if ($use_gzip && $content = $cache->get("{$key}_gz")) {
+ header("Content-Encoding: gzip");
+ } else {
+ // Fall back to non-gzipped if we have to
$content = $cache->get($key);
}
- if (!$content) {
+ if (empty($content)) {
Kohana::show_404();
}
- if (strpos($_SERVER["HTTP_ACCEPT_ENCODING"], "gzip") !== false) {
- header("Content-Encoding: gzip");
- header("Cache-Control: public");
- }
-
// $type is either 'javascript' or 'css'
- header("Content-Type: text/$type; charset=UTF-8");
+ if ($type == "javascript") {
+ header("Content-Type: application/javascript; charset=UTF-8");
+ } else {
+ header("Content-Type: text/css; charset=UTF-8");
+ }
header("Expires: Tue, 19 Jan 2038 00:00:00 GMT");
+ header("Cache-Control: max-age=2678400");
+ header('Pragma: public');
header("Last-Modified: " . gmdate("D, d M Y H:i:s T", time()));
Kohana::close_buffers(false);
diff --git a/modules/gallery/controllers/upgrader.php b/modules/gallery/controllers/upgrader.php
index 91952fa9..0f6cbc2c 100644
--- a/modules/gallery/controllers/upgrader.php
+++ b/modules/gallery/controllers/upgrader.php
@@ -32,11 +32,18 @@ class Upgrader_Controller extends Controller {
@unlink(TMPPATH . $upgrade_token);
}
+ $available_upgrades = 0;
+ foreach (module::available() as $module) {
+ if ($module->version && $module->version != $module->code_version) {
+ $available_upgrades++;
+ }
+ }
+
$view = new View("upgrader.html");
$view->can_upgrade = user::active()->admin || $session->get("can_upgrade");
$view->upgrade_token = $upgrade_token;
$view->available = module::available();
- $view->done = Input::instance()->get("done");
+ $view->done = ($available_upgrades == 0);
print $view;
}
@@ -67,7 +74,7 @@ class Upgrader_Controller extends Controller {
if (php_sapi_name() == "cli") {
print "Upgrade complete\n";
} else {
- url::redirect("upgrader?done=1");
+ url::redirect("upgrader");
}
}
}