diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index f37609e6..34fee917 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -26,7 +26,9 @@ class Albums_Controller extends Items_Controller { $page_size = module::get_var("gallery", "page_size", 9); if (!access::can("view", $album)) { if ($album->id == 1) { - print new Theme_View("login_page.html"); + $view = new Theme_View("page.html", "page"); + $view->content = user::get_login_form("login/auth_html"); + print $view; return; } else { access::forbidden(); diff --git a/modules/gallery/controllers/upgrader.php b/modules/gallery/controllers/upgrader.php new file mode 100644 index 00000000..e8798de5 --- /dev/null +++ b/modules/gallery/controllers/upgrader.php @@ -0,0 +1,25 @@ +key; $locale = $message_data->locale; $revision = $message_data->rev; - $translation = serialize(json_decode($message_data->translation)); + $translation = json_decode($message_data->translation); + if (!is_string($translation)) { + // Normalize stdclass to array + $translation = (array) $translation; + } + $translation = serialize($translation); // @todo Should we normalize the incoming_translations table into messages(id, key, message) // and incoming_translations(id, translation, locale, revision)? Or just allow diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php index 2fd5be6c..58f9b20d 100644 --- a/modules/gallery/helpers/module.php +++ b/modules/gallery/helpers/module.php @@ -27,6 +27,7 @@ class module_Core { public static $active = array(); public static $modules = array(); public static $var_cache = null; + public static $available = array(); /** * Set the version of the corresponding Module_Model @@ -74,22 +75,27 @@ class module_Core { * Return the list of available modules, including uninstalled modules. */ static function available() { - $modules = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS); - foreach (glob(MODPATH . "*/module.info") as $file) { - $module_name = basename(dirname($file)); - $modules->$module_name = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS); - $modules->$module_name->installed = self::is_installed($module_name); - $modules->$module_name->active = self::is_active($module_name); - $modules->$module_name->version = self::get_version($module_name); - $modules->$module_name->locked = false; + if (empty(self::$available)) { + $modules = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS); + foreach (glob(MODPATH . "*/module.info") as $file) { + $module_name = basename(dirname($file)); + $modules->$module_name = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS); + $m =& $modules->$module_name; + $m->installed = self::is_installed($module_name); + $m->active = self::is_active($module_name); + $m->code_version = $m->version; + $m->version = self::get_version($module_name); + $m->locked = false; + } + + // Lock certain modules + $modules->gallery->locked = true; + $modules->user->locked = true; + $modules->ksort(); + self::$available = $modules; } - // Lock certain modules - $modules->gallery->locked = true; - $modules->user->locked = true; - $modules->ksort(); - - return $modules; + return self::$available; } /** diff --git a/modules/gallery/views/admin_advanced_settings.html.php b/modules/gallery/views/admin_advanced_settings.html.php index 34abadea..b4dedaef 100644 --- a/modules/gallery/views/admin_advanced_settings.html.php +++ b/modules/gallery/views/admin_advanced_settings.html.php @@ -6,7 +6,7 @@
+ = t("Welcome to the Gallery upgrader. One click and you're done!") ?> +
+| = t("Module name") ?> | += t("Installed version") ?> | += t("Available version") ?> | +
|---|---|---|
| + = $module->name ?> + | ++ = $module->version ?> + | ++ = $module->code_version ?> + | +
+ = t("The following modules are inactive and don't require an upgrade.") ?> +
+