From 88a3d43ba9b9377ba6bbe21a4547220ae3a37276 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 27 May 2009 16:15:00 -0700 Subject: Update all references to the core application to now point to the gallery module. This type of mass update is prone to some small bugs. --- installer/installer.php | 2 +- installer/views/install.html.php | 2 +- modules/g2_import/controllers/admin_g2_import.php | 4 +- modules/g2_import/helpers/g2_import.php | 4 +- modules/gallery/controllers/admin_dashboard.php | 2 +- modules/gallery/controllers/admin_graphics.php | 8 +- modules/gallery/controllers/admin_languages.php | 6 +- .../gallery/controllers/admin_theme_details.php | 22 +- modules/gallery/controllers/admin_themes.php | 8 +- modules/gallery/controllers/albums.php | 6 +- modules/gallery/controllers/scaffold.php | 8 +- modules/gallery/helpers/access.php | 4 +- modules/gallery/helpers/block_manager.php | 4 +- modules/gallery/helpers/core.php | 52 ---- modules/gallery/helpers/core_block.php | 100 -------- modules/gallery/helpers/core_event.php | 46 ---- modules/gallery/helpers/core_installer.php | 278 --------------------- modules/gallery/helpers/core_menu.php | 162 ------------ modules/gallery/helpers/core_search.php | 24 -- modules/gallery/helpers/core_task.php | 166 ------------ modules/gallery/helpers/core_theme.php | 137 ---------- modules/gallery/helpers/gallery.php | 52 ++++ modules/gallery/helpers/gallery_block.php | 100 ++++++++ modules/gallery/helpers/gallery_event.php | 46 ++++ modules/gallery/helpers/gallery_installer.php | 278 +++++++++++++++++++++ modules/gallery/helpers/gallery_menu.php | 162 ++++++++++++ modules/gallery/helpers/gallery_search.php | 24 ++ modules/gallery/helpers/gallery_task.php | 166 ++++++++++++ modules/gallery/helpers/gallery_theme.php | 137 ++++++++++ modules/gallery/helpers/graphics.php | 28 +-- modules/gallery/helpers/l10n_client.php | 4 +- modules/gallery/helpers/locale.php | 8 +- modules/gallery/helpers/module.php | 28 +-- modules/gallery/helpers/movie.php | 4 +- modules/gallery/helpers/theme.php | 15 +- modules/gallery/hooks/init_gallery.php | 6 +- modules/gallery/libraries/Admin_View.php | 10 +- modules/gallery/libraries/I18n.php | 2 +- modules/gallery/libraries/Theme_View.php | 20 +- modules/gallery/tests/Core_Installer_Test.php | 12 +- modules/gallery/tests/File_Structure_Test.php | 2 +- modules/gallery/tests/Movie_Helper_Test.php | 4 +- modules/gallery/tests/Photo_Helper_Test.php | 14 +- modules/gallery/tests/Photos_Controller_Test.php | 4 +- modules/gallery/tests/Var_Test.php | 32 +-- .../gallery/views/admin_advanced_settings.html.php | 2 +- modules/gallery/views/admin_block_stats.html.php | 2 +- modules/gallery/views/admin_graphics_gd.html.php | 2 +- .../views/admin_graphics_graphicsmagick.html.php | 2 +- .../views/admin_graphics_imagemagick.html.php | 2 +- modules/gallery/views/admin_languages.html.php | 2 +- modules/gallery/views/kohana_error_page.php | 5 +- modules/gallery/views/permissions_browse.html.php | 2 +- modules/gallery/views/scaffold.html.php | 2 +- .../controllers/gallery_unit_test.php | 6 +- modules/organize/controllers/organize.php | 2 +- modules/search/controllers/search.php | 2 +- modules/tag/controllers/tags.php | 2 +- themes/default/views/footer.html.php | 2 +- themes/default/views/header.html.php | 2 +- 60 files changed, 1121 insertions(+), 1119 deletions(-) delete mode 100644 modules/gallery/helpers/core.php delete mode 100644 modules/gallery/helpers/core_block.php delete mode 100644 modules/gallery/helpers/core_event.php delete mode 100644 modules/gallery/helpers/core_installer.php delete mode 100644 modules/gallery/helpers/core_menu.php delete mode 100644 modules/gallery/helpers/core_search.php delete mode 100644 modules/gallery/helpers/core_task.php delete mode 100644 modules/gallery/helpers/core_theme.php create mode 100644 modules/gallery/helpers/gallery.php create mode 100644 modules/gallery/helpers/gallery_block.php create mode 100644 modules/gallery/helpers/gallery_event.php create mode 100644 modules/gallery/helpers/gallery_installer.php create mode 100644 modules/gallery/helpers/gallery_menu.php create mode 100644 modules/gallery/helpers/gallery_search.php create mode 100644 modules/gallery/helpers/gallery_task.php create mode 100644 modules/gallery/helpers/gallery_theme.php diff --git a/installer/installer.php b/installer/installer.php index 84adc5f9..38fde1fe 100644 --- a/installer/installer.php +++ b/installer/installer.php @@ -122,7 +122,7 @@ class installer { static function create_private_key($config) { $key = md5(uniqid(mt_rand(), true)) . md5(uniqid(mt_rand(), true)); $sql = self::prepend_prefix($config["prefix"], - "INSERT INTO {vars} VALUES(NULL, 'core', 'private_key', '$key')"); + "INSERT INTO {vars} VALUES(NULL, 'gallery', 'private_key', '$key')"); if (mysql_query($sql)) { } else { throw new Exception(mysql_error()); diff --git a/installer/views/install.html.php b/installer/views/install.html.php index c3b9686d..18060219 100644 --- a/installer/views/install.html.php +++ b/installer/views/install.html.php @@ -6,7 +6,7 @@
- +
diff --git a/modules/g2_import/controllers/admin_g2_import.php b/modules/g2_import/controllers/admin_g2_import.php index f17660ae..25894291 100644 --- a/modules/g2_import/controllers/admin_g2_import.php +++ b/modules/g2_import/controllers/admin_g2_import.php @@ -32,8 +32,8 @@ class Admin_g2_import_Controller extends Admin_Controller { if (g2_import::is_initialized()) { $view->content->g2_stats = $g2_stats; $view->content->g2_sizes = $g2_sizes; - $view->content->thumb_size = module::get_var("core", "thumb_size"); - $view->content->resize_size = module::get_var("core", "resize_size"); + $view->content->thumb_size = module::get_var("gallery", "thumb_size"); + $view->content->resize_size = module::get_var("gallery", "resize_size"); } print $view; } diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 37efcad0..dd23d7a0 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -481,8 +481,8 @@ class g2_import_Core { $g2_item_id = self::$current_g2_item->getId(); $derivatives = g2(GalleryCoreApi::fetchDerivativesByItemIds(array($g2_item_id))); - $target_thumb_size = module::get_var("core", "thumb_size"); - $target_resize_size = module::get_var("core", "resize_size"); + $target_thumb_size = module::get_var("gallery", "thumb_size"); + $target_resize_size = module::get_var("gallery", "resize_size"); foreach ($derivatives[$g2_item_id] as $derivative) { if ($derivative->getPostFilterOperations()) { // Let's assume for now that this is a watermark operation, which we can't handle. diff --git a/modules/gallery/controllers/admin_dashboard.php b/modules/gallery/controllers/admin_dashboard.php index d2d2f79b..a1090a6d 100644 --- a/modules/gallery/controllers/admin_dashboard.php +++ b/modules/gallery/controllers/admin_dashboard.php @@ -29,7 +29,7 @@ class Admin_Dashboard_Controller extends Admin_Controller { } public function add_block() { - $form = core_block::get_add_block_form(); + $form = gallery_block::get_add_block_form(); if ($form->validate()) { list ($module_name, $id) = explode(":", $form->add_block->id->value); $available = block_manager::get_available(); diff --git a/modules/gallery/controllers/admin_graphics.php b/modules/gallery/controllers/admin_graphics.php index 0b3014f0..7e8ef47c 100644 --- a/modules/gallery/controllers/admin_graphics.php +++ b/modules/gallery/controllers/admin_graphics.php @@ -24,7 +24,7 @@ class Admin_Graphics_Controller extends Admin_Controller { $view->content->available = ""; $tk = new ArrayObject(graphics::detect_toolkits(), ArrayObject::ARRAY_AS_PROPS); - $active = module::get_var("core", "graphics_toolkit", "none"); + $active = module::get_var("gallery", "graphics_toolkit", "none"); foreach (array("gd", "imagemagick", "graphicsmagick", "none") as $id) { if ($id == $active) { $view->content->active = new View("admin_graphics_$id.html"); @@ -43,12 +43,12 @@ class Admin_Graphics_Controller extends Admin_Controller { public function choose($toolkit) { access::verify_csrf(); - if ($toolkit != module::get_var("core", "graphics_toolkit")) { - module::set_var("core", "graphics_toolkit", $toolkit); + if ($toolkit != module::get_var("gallery", "graphics_toolkit")) { + module::set_var("gallery", "graphics_toolkit", $toolkit); $toolkit_info = graphics::detect_toolkits(); if ($toolkit == "graphicsmagick" || $toolkit == "imagemagick") { - module::set_var("core", "graphics_toolkit_path", $toolkit_info[$toolkit]); + module::set_var("gallery", "graphics_toolkit_path", $toolkit_info[$toolkit]); } site_status::clear("missing_graphics_toolkit"); diff --git a/modules/gallery/controllers/admin_languages.php b/modules/gallery/controllers/admin_languages.php index 37d335a3..1dea733c 100644 --- a/modules/gallery/controllers/admin_languages.php +++ b/modules/gallery/controllers/admin_languages.php @@ -33,7 +33,7 @@ class Admin_Languages_Controller extends Admin_Controller { public function save() { $form = $this->_languages_form(); if ($form->validate()) { - module::set_var("core", "default_locale", $form->choose_language->locale->value); + module::set_var("gallery", "default_locale", $form->choose_language->locale->value); locale::update_installed($form->choose_language->installed_locales->value); message::success(t("Settings saved")); } @@ -76,7 +76,7 @@ class Admin_Languages_Controller extends Admin_Controller { message::success(t("Your API key has been saved.")); } - log::success(t("core"), t("l10n_client API key changed.")); + log::success(t("gallery"), t("l10n_client API key changed.")); url::redirect("admin/languages"); } else { // Show the page with form errors @@ -92,7 +92,7 @@ class Admin_Languages_Controller extends Admin_Controller { ->label(t("Language settings")); $group->dropdown("locale") ->options($installed_locales) - ->selected(module::get_var("core", "default_locale")) + ->selected(module::get_var("gallery", "default_locale")) ->label(t("Default language")) ->rules('required'); diff --git a/modules/gallery/controllers/admin_theme_details.php b/modules/gallery/controllers/admin_theme_details.php index 542ec31c..fec1311b 100644 --- a/modules/gallery/controllers/admin_theme_details.php +++ b/modules/gallery/controllers/admin_theme_details.php @@ -28,32 +28,32 @@ class Admin_Theme_Details_Controller extends Admin_Controller { public function save() { $form = theme::get_edit_form_admin(); if ($form->validate()) { - module::set_var("core", "page_size", $form->edit_theme->page_size->value); + module::set_var("gallery", "page_size", $form->edit_theme->page_size->value); $thumb_size = $form->edit_theme->thumb_size->value; $thumb_dirty = false; - if (module::get_var("core", "thumb_size") != $thumb_size) { - graphics::remove_rule("core", "thumb", "resize"); + if (module::get_var("gallery", "thumb_size") != $thumb_size) { + graphics::remove_rule("gallery", "thumb", "resize"); graphics::add_rule( - "core", "thumb", "resize", + "gallery", "thumb", "resize", array("width" => $thumb_size, "height" => $thumb_size, "master" => Image::AUTO), 100); - module::set_var("core", "thumb_size", $thumb_size); + module::set_var("gallery", "thumb_size", $thumb_size); } $resize_size = $form->edit_theme->resize_size->value; $resize_dirty = false; - if (module::get_var("core", "resize_size") != $resize_size) { - graphics::remove_rule("core", "resize", "resize"); + if (module::get_var("gallery", "resize_size") != $resize_size) { + graphics::remove_rule("gallery", "resize", "resize"); graphics::add_rule( - "core", "resize", "resize", + "gallery", "resize", "resize", array("width" => $resize_size, "height" => $resize_size, "master" => Image::AUTO), 100); - module::set_var("core", "resize_size", $resize_size); + module::set_var("gallery", "resize_size", $resize_size); } - module::set_var("core", "header_text", $form->edit_theme->header_text->value); - module::set_var("core", "footer_text", $form->edit_theme->footer_text->value); + module::set_var("gallery", "header_text", $form->edit_theme->header_text->value); + module::set_var("gallery", "footer_text", $form->edit_theme->footer_text->value); message::success(t("Updated theme details")); url::redirect("admin/theme_details"); diff --git a/modules/gallery/controllers/admin_themes.php b/modules/gallery/controllers/admin_themes.php index 05c134d1..aef6c2d1 100644 --- a/modules/gallery/controllers/admin_themes.php +++ b/modules/gallery/controllers/admin_themes.php @@ -21,8 +21,8 @@ class Admin_Themes_Controller extends Admin_Controller { public function index() { $view = new Admin_View("admin.html"); $view->content = new View("admin_themes.html"); - $view->content->admin = module::get_var("core", "active_admin_theme"); - $view->content->site = module::get_var("core", "active_site_theme"); + $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(); print $view; } @@ -64,11 +64,11 @@ class Admin_Themes_Controller extends Admin_Controller { parse_ini_file(THEMEPATH . "$theme_name/theme.info"), ArrayObject::ARRAY_AS_PROPS); if ($type == "admin" && $info->admin) { - module::set_var("core", "active_admin_theme", $theme_name); + module::set_var("gallery", "active_admin_theme", $theme_name); message::success(t("Successfully changed your admin theme to %theme_name", array("theme_name" => $info->name))); } else if ($type == "site" && $info->site) { - module::set_var("core", "active_site_theme", $theme_name); + module::set_var("gallery", "active_site_theme", $theme_name); message::success(t("Successfully changed your Gallery theme to %theme_name", array("theme_name" => $info->name))); } diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index 5b4d5979..03a64f43 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -32,7 +32,7 @@ class Albums_Controller extends Items_Controller { } } - $page_size = module::get_var("core", "page_size", 9); + $page_size = module::get_var("gallery", "page_size", 9); $show = $this->input->get("show"); if ($show) { @@ -114,7 +114,7 @@ class Albums_Controller extends Items_Controller { } else { print json_encode( array("result" => "error", - "form" => $form->__toString() . html::script("core/js/albums_form_add.js"))); + "form" => $form->__toString() . html::script("gallery/js/albums_form_add.js"))); } } @@ -206,7 +206,7 @@ class Albums_Controller extends Items_Controller { switch ($this->input->get("type")) { case "album": print album::get_add_form($album) . - html::script("core/js/albums_form_add.js"); + html::script("gallery/js/albums_form_add.js"); break; case "photo": diff --git a/modules/gallery/controllers/scaffold.php b/modules/gallery/controllers/scaffold.php index f0063725..8ec1663a 100644 --- a/modules/gallery/controllers/scaffold.php +++ b/modules/gallery/controllers/scaffold.php @@ -94,7 +94,7 @@ class Scaffold_Controller extends Template_Controller { $type = rand(0, 10) ? "photo" : "album"; } if ($type == "album") { - $thumb_size = module::get_var("core", "thumb_size"); + $thumb_size = module::get_var("gallery", "thumb_size"); $parents[] = album::create( $parent, "rnd_" . rand(), "Rnd $i", "random album $i", $owner_id) ->save(); @@ -262,7 +262,7 @@ class Scaffold_Controller extends Template_Controller { } foreach ($to_install as $module_name) { - if ($module_name != "core") { + if ($module_name != "gallery") { require_once(DOCROOT . "modules/${module_name}/helpers/${module_name}_installer.php"); } module::install($module_name); @@ -300,7 +300,7 @@ class Scaffold_Controller extends Template_Controller { srand(0); try { - core_installer::install(true); + gallery_installer::install(true); module::load_modules(); foreach (array("user", "comment", "organize", "info", "rss", @@ -325,7 +325,7 @@ class Scaffold_Controller extends Template_Controller { $db = Database::instance(); $db->query("TRUNCATE {sessions}"); $db->query("TRUNCATE {logs}"); - $db->query("DELETE FROM {vars} WHERE `module_name` = 'core' AND `name` = '_cache'"); + $db->query("DELETE FROM {vars} WHERE `module_name` = 'gallery' AND `name` = '_cache'"); $db->update("users", array("password" => ""), array("id" => 1)); $db->update("users", array("password" => ""), array("id" => 2)); diff --git a/modules/gallery/helpers/access.php b/modules/gallery/helpers/access.php index 64ce91fa..c48f0b79 100644 --- a/modules/gallery/helpers/access.php +++ b/modules/gallery/helpers/access.php @@ -389,7 +389,7 @@ class access_Core { * @return ORM_Iterator */ private static function _get_all_groups() { - // When we build the core package, it's possible that the user module is not installed yet. + // When we build the gallery package, it's possible that the user module is not installed yet. // This is ok at packaging time, so work around it. if (module::is_active("user")) { return ORM::factory("group")->find_all(); @@ -595,7 +595,7 @@ class access_Core { } static function private_key() { - return module::get_var("core", "private_key"); + return module::get_var("gallery", "private_key"); } /** diff --git a/modules/gallery/helpers/block_manager.php b/modules/gallery/helpers/block_manager.php index 022626e5..20b641d4 100644 --- a/modules/gallery/helpers/block_manager.php +++ b/modules/gallery/helpers/block_manager.php @@ -19,11 +19,11 @@ */ class block_manager_Core { static function get_active($location) { - return unserialize(module::get_var("core", "blocks_$location", "a:0:{}")); + return unserialize(module::get_var("gallery", "blocks_$location", "a:0:{}")); } static function set_active($location, $blocks) { - module::set_var("core", "blocks_$location", serialize($blocks)); + module::set_var("gallery", "blocks_$location", serialize($blocks)); } static function add($location, $module_name, $block_id) { diff --git a/modules/gallery/helpers/core.php b/modules/gallery/helpers/core.php deleted file mode 100644 index 63f51f86..00000000 --- a/modules/gallery/helpers/core.php +++ /dev/null @@ -1,52 +0,0 @@ -admin) { - Router::$controller = "maintenance"; - Router::$controller_path = APPPATH . "controllers/maintenance.php"; - Router::$method = "index"; - } - } - - /** - * This function is called when the Gallery is fully initialized. We relay it to modules as the - * "gallery_ready" event. Any module that wants to perform an action at the start of every - * request should implement the _event::gallery_ready() handler. - */ - static function ready() { - module::event("gallery_ready"); - } - - /** - * This function is called right before the Kohana framework shuts down. We relay it to modules - * as the "gallery_shutdown" event. Any module that wants to perform an action at the start of - * every request should implement the _event::gallery_shutdown() handler. - */ - static function shutdown() { - module::event("gallery_shutdown"); - } -} \ No newline at end of file diff --git a/modules/gallery/helpers/core_block.php b/modules/gallery/helpers/core_block.php deleted file mode 100644 index 0e2e9c54..00000000 --- a/modules/gallery/helpers/core_block.php +++ /dev/null @@ -1,100 +0,0 @@ - t("Welcome to Gallery 3!"), - "photo_stream" => t("Photo Stream"), - "log_entries" => t("Log Entries"), - "stats" => t("Gallery Stats"), - "platform_info" => t("Platform Information"), - "project_news" => t("Gallery Project News")); - } - - static function get($block_id) { - $block = new Block(); - switch($block_id) { - case "welcome": - $block->css_id = "gWelcome"; - $block->title = t("Welcome to Gallery3"); - $block->content = new View("admin_block_welcome.html"); - break; - - case "photo_stream": - $block->css_id = "gPhotoStream"; - $block->title = t("Photo Stream"); - $block->content = new View("admin_block_photo_stream.html"); - $block->content->photos = - ORM::factory("item")->where("type", "photo")->orderby("created", "DESC")->find_all(10); - break; - - case "log_entries": - $block->css_id = "gLogEntries"; - $block->title = t("Log Entries"); - $block->content = new View("admin_block_log_entries.html"); - $block->content->entries = ORM::factory("log")->orderby("timestamp", "DESC")->find_all(5); - break; - - case "stats": - $block->css_id = "gStats"; - $block->title = t("Gallery Stats"); - $block->content = new View("admin_block_stats.html"); - $block->content->album_count = ORM::factory("item")->where("type", "album")->count_all(); - $block->content->photo_count = ORM::factory("item")->where("type", "photo")->count_all(); - break; - - case "platform_info": - $block->css_id = "gPlatform"; - $block->title = t("Platform Information"); - $block->content = new View("admin_block_platform.html"); - if (is_readable("/proc/loadavg")) { - $block->content->load_average = - join(" ", array_slice(split(" ", array_shift(file("/proc/loadavg"))), 0, 3)); - } else { - $block->content->load_average = t("Unavailable"); - } - break; - - case "project_news": - $block->css_id = "gProjectNews"; - $block->title = t("Gallery Project News"); - $block->content = new View("admin_block_news.html"); - $block->content->feed = feed::parse("http://gallery.menalto.com/node/feed", 3); - break; - - case "block_adder": - $block->css_id = "gBlockAdder"; - $block->title = t("Dashboard Content"); - $block->content = self::get_add_block_form(); - } - - return $block; - } - - static function get_add_block_form() { - $form = new Forge("admin/dashboard/add_block", "", "post", - array("id" => "gAddDashboardBlockForm")); - $group = $form->group("add_block")->label(t("Add Block")); - $group->dropdown("id")->label("Available Blocks")->options(block_manager::get_available()); - $group->submit("center")->value(t("Add to center")); - $group->submit("sidebar")->value(t("Add to sidebar")); - return $form; - } -} \ No newline at end of file diff --git a/modules/gallery/helpers/core_event.php b/modules/gallery/helpers/core_event.php deleted file mode 100644 index bbb53cc9..00000000 --- a/modules/gallery/helpers/core_event.php +++ /dev/null @@ -1,46 +0,0 @@ -admin && module::get_var("core", "choose_default_tookit", null)) { - graphics::choose_default_toolkit(); - module::clear_var("core", "choose_default_tookit"); - } - } -} diff --git a/modules/gallery/helpers/core_installer.php b/modules/gallery/helpers/core_installer.php deleted file mode 100644 index cffcbedb..00000000 --- a/modules/gallery/helpers/core_installer.php +++ /dev/null @@ -1,278 +0,0 @@ -query("CREATE TABLE {access_caches} ( - `id` int(9) NOT NULL auto_increment, - `item_id` int(9), - PRIMARY KEY (`id`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - - $db->query("CREATE TABLE {access_intents} ( - `id` int(9) NOT NULL auto_increment, - `item_id` int(9), - PRIMARY KEY (`id`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - - $db->query("CREATE TABLE {graphics_rules} ( - `id` int(9) NOT NULL auto_increment, - `active` BOOLEAN default 0, - `args` varchar(255) default NULL, - `module_name` varchar(64) NOT NULL, - `operation` varchar(64) NOT NULL, - `priority` int(9) NOT NULL, - `target` varchar(32) NOT NULL, - PRIMARY KEY (`id`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - - $db->query("CREATE TABLE {items} ( - `id` int(9) NOT NULL auto_increment, - `album_cover_item_id` int(9) default NULL, - `captured` int(9) default NULL, - `created` int(9) default NULL, - `description` varchar(2048) default NULL, - `height` int(9) default NULL, - `left` int(9) NOT NULL, - `level` int(9) NOT NULL, - `mime_type` varchar(64) default NULL, - `name` varchar(255) default NULL, - `owner_id` int(9) default NULL, - `parent_id` int(9) NOT NULL, - `rand_key` float default NULL, - `relative_path_cache` varchar(255) default NULL, - `resize_dirty` boolean default 1, - `resize_height` int(9) default NULL, - `resize_width` int(9) default NULL, - `right` int(9) NOT NULL, - `sort_column` varchar(64) default NULL, - `sort_order` char(4) default 'ASC', - `thumb_dirty` boolean default 1, - `thumb_height` int(9) default NULL, - `thumb_width` int(9) default NULL, - `title` varchar(255) default NULL, - `type` varchar(32) NOT NULL, - `updated` int(9) default NULL, - `view_count` int(9) default 0, - `weight` int(9) NOT NULL default 0, - `width` int(9) default NULL, - PRIMARY KEY (`id`), - KEY `parent_id` (`parent_id`), - KEY `type` (`type`), - KEY `random` (`rand_key`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - - $db->query("CREATE TABLE {logs} ( - `id` int(9) NOT NULL auto_increment, - `category` varchar(64) default NULL, - `html` varchar(255) default NULL, - `message` text default NULL, - `referer` varchar(255) default NULL, - `severity` int(9) default 0, - `timestamp` int(9) default 0, - `url` varchar(255) default NULL, - `user_id` int(9) default 0, - PRIMARY KEY (`id`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - - $db->query("CREATE TABLE {messages} ( - `id` int(9) NOT NULL auto_increment, - `key` varchar(255) default NULL, - `severity` varchar(32) default NULL, - `value` varchar(255) default NULL, - PRIMARY KEY (`id`), - UNIQUE KEY(`key`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - - $db->query("CREATE TABLE {modules} ( - `id` int(9) NOT NULL auto_increment, - `active` BOOLEAN default 0, - `name` varchar(64) default NULL, - `version` int(9) default NULL, - PRIMARY KEY (`id`), - UNIQUE KEY(`name`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - - $db->query("CREATE TABLE {themes} ( - `id` int(9) NOT NULL auto_increment, - `name` varchar(64) default NULL, - `version` int(9) default NULL, - PRIMARY KEY (`id`), - UNIQUE KEY(`name`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - - $db->query("CREATE TABLE {permissions} ( - `id` int(9) NOT NULL auto_increment, - `display_name` varchar(64) default NULL, - `name` varchar(64) default NULL, - PRIMARY KEY (`id`), - UNIQUE KEY(`name`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - - $db->query("CREATE TABLE {incoming_translations} ( - `id` int(9) NOT NULL auto_increment, - `key` char(32) NOT NULL, - `locale` char(10) NOT NULL, - `message` text NOT NULL, - `revision` int(9) DEFAULT NULL, - `translation` text, - PRIMARY KEY (`id`), - UNIQUE KEY(`key`, `locale`), - KEY `locale_key` (`locale`, `key`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - - $db->query("CREATE TABLE {outgoing_translations} ( - `id` int(9) NOT NULL auto_increment, - `base_revision` int(9) DEFAULT NULL, - `key` char(32) NOT NULL, - `locale` char(10) NOT NULL, - `message` text NOT NULL, - `translation` text, - PRIMARY KEY (`id`), - UNIQUE KEY(`key`, `locale`), - KEY `locale_key` (`locale`, `key`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - - $db->query("CREATE TABLE {sessions} ( - `session_id` varchar(127) NOT NULL, - `data` text NOT NULL, - `last_activity` int(10) UNSIGNED NOT NULL, - PRIMARY KEY (`session_id`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - - $db->query("CREATE TABLE {tasks} ( - `id` int(9) NOT NULL auto_increment, - `callback` varchar(128) default NULL, - `context` text NOT NULL, - `done` boolean default 0, - `name` varchar(128) default NULL, - `owner_id` int(9) default NULL, - `percent_complete` int(9) default 0, - `state` varchar(32) default NULL, - `status` varchar(255) default NULL, - `updated` int(9) default NULL, - PRIMARY KEY (`id`), - KEY (`owner_id`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - - $db->query("CREATE TABLE {vars} ( - `id` int(9) NOT NULL auto_increment, - `module_name` varchar(64) NOT NULL, - `name` varchar(64) NOT NULL, - `value` text, - PRIMARY KEY (`id`), - UNIQUE KEY(`module_name`, `name`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - - foreach (array("albums", "logs", "modules", "resizes", "thumbs", "tmp", "uploads") as $dir) { - @mkdir(VARPATH . $dir); - } - - access::register_permission("view", "View"); - access::register_permission("view_full", "View Full Size"); - access::register_permission("edit", "Edit"); - access::register_permission("add", "Add"); - - $root = ORM::factory("item"); - $root->type = "album"; - $root->title = "Gallery"; - $root->description = ""; - $root->left = 1; - $root->right = 2; - $root->parent_id = 0; - $root->level = 1; - $root->thumb_dirty = 1; - $root->resize_dirty = 1; - $root->sort_column = "weight"; - $root->sort_order = "ASC"; - $root->save(); - access::add_item($root); - - module::set_var("core", "active_site_theme", "default"); - module::set_var("core", "active_admin_theme", "admin_default"); - module::set_var("core", "page_size", 9); - module::set_var("core", "thumb_size", 200); - module::set_var("core", "resize_size", 640); - module::set_var("core", "default_locale", "en_US"); - module::set_var("core", "image_quality", 75); - - // Add rules for generating our thumbnails and resizes - graphics::add_rule( - "core", "thumb", "resize", - array("width" => 200, "height" => 200, "master" => Image::AUTO), - 100); - graphics::add_rule( - "core", "resize", "resize", - array("width" => 640, "height" => 480, "master" => Image::AUTO), - 100); - - // Instantiate default themes (site and admin) - foreach (array("default", "admin_default") as $theme_name) { - $theme_info = new ArrayObject(parse_ini_file(THEMEPATH . $theme_name . "/theme.info"), - ArrayObject::ARRAY_AS_PROPS); - $theme = ORM::factory("theme"); - $theme->name = $theme_name; - $theme->version = $theme_info->version; - $theme->save(); - } - - block_manager::add("dashboard_sidebar", "core", "block_adder"); - block_manager::add("dashboard_sidebar", "core", "stats"); - block_manager::add("dashboard_sidebar", "core", "platform_info"); - block_manager::add("dashboard_sidebar", "core", "project_news"); - block_manager::add("dashboard_center", "core", "welcome"); - block_manager::add("dashboard_center", "core", "photo_stream"); - block_manager::add("dashboard_center", "core", "log_entries"); - - module::set_version("core", 1); - module::set_var("core", "version", "3.0 pre-beta svn"); - module::set_var("core", "choose_default_tookit", 1); - } - } - - static function uninstall() { - $db = Database::instance(); - $db->query("DROP TABLE IF EXISTS {access_caches}"); - $db->query("DROP TABLE IF EXISTS {access_intents}"); - $db->query("DROP TABLE IF EXISTS {graphics_rules}"); - $db->query("DROP TABLE IF EXISTS {items}"); - $db->query("DROP TABLE IF EXISTS {logs}"); - $db->query("DROP TABLE IF EXISTS {messages}"); - $db->query("DROP TABLE IF EXISTS {modules}"); - $db->query("DROP TABLE IF EXISTS {themes}"); - $db->query("DROP TABLE IF EXISTS {incoming_translations}"); - $db->query("DROP TABLE IF EXISTS {outgoing_translations}"); - $db->query("DROP TABLE IF EXISTS {permissions}"); - $db->query("DROP TABLE IF EXISTS {sessions}"); - $db->query("DROP TABLE IF EXISTS {tasks}"); - $db->query("DROP TABLE IF EXISTS {vars}"); - foreach (array("albums", "resizes", "thumbs", "uploads", - "modules", "logs", "database.php") as $entry) { - system("/bin/rm -rf " . VARPATH . $entry); - } - } -} diff --git a/modules/gallery/helpers/core_menu.php b/modules/gallery/helpers/core_menu.php deleted file mode 100644 index eb208560..00000000 --- a/modules/gallery/helpers/core_menu.php +++ /dev/null @@ -1,162 +0,0 @@ -admin) { - $menu->append($scaffold_menu = Menu::factory("submenu") - ->id("scaffold") - ->label("Scaffold")); - $scaffold_menu->append(Menu::factory("link") - ->id("scaffold_home") - ->label("Dashboard") - ->url(url::site("scaffold"))); - } - - $menu->append(Menu::factory("link") - ->id("home") - ->label(t("Home")) - ->url(url::site("albums/1"))); - - $item = $theme->item(); - - if (user::active()->admin || ($item && access::can("edit", $item))) { - $menu->append($options_menu = Menu::factory("submenu") - ->id("options_menu") - ->label(t("Options"))); - - if ($item && access::can("edit", $item)) { - $options_menu - ->append(Menu::factory("dialog") - ->id("edit_item") - ->label($item->is_album() ? t("Edit album") : t("Edit photo")) - ->url(url::site("form/edit/{$item->type}s/$item->id"))); - - // @todo Move album options menu to the album quick edit pane - // @todo Create resized item quick edit pane menu - if ($item->is_album()) { - $options_menu - ->append(Menu::factory("dialog") - ->id("add_item") - ->label(t("Add a photo")) - ->url(url::site("simple_uploader/app/$item->id"))) - ->append(Menu::factory("dialog") - ->id("add_album") - ->label(t("Add an album")) - ->url(url::site("form/add/albums/$item->id?type=album"))) - ->append(Menu::factory("dialog") - ->id("edit_permissions") - ->label(t("Edit permissions")) - ->url(url::site("permissions/browse/$item->id"))); - } - } - } - - if (user::active()->admin) { - $menu->append($admin_menu = Menu::factory("submenu") - ->id("admin_menu") - ->label(t("Admin"))); - self::admin($admin_menu, $theme); - foreach (module::active() as $module) { - if ($module->name == "core") { - continue; - } - $class = "{$module->name}_menu"; - if (method_exists($class, "admin")) { - call_user_func_array(array($class, "admin"), array(&$admin_menu, $theme)); - } - } - } - } - - static function album($menu, $theme) { - } - - static function photo($menu, $theme) { - if (access::can("view_full", $theme->item())) { - $menu - ->append(Menu::factory("link") - ->id("fullsize") - ->label(t("View full size")) - ->url("#") - ->css_class("gFullSizeLink")); - } - $menu - ->append(Menu::factory("link") - ->id("album") - ->label(t("Return to album")) - ->url($theme->item()->parent()->url("show={$theme->item->id}")) - ->css_id("gAlbumLink")); - } - - static function admin($menu, $theme) { - $menu - ->append(Menu::factory("link") - ->id("dashboard") - ->label(t("Dashboard")) - ->url(url::site("admin"))) - ->append(Menu::factory("submenu") - ->id("settings_menu") - ->label(t("Settings")) - ->append(Menu::factory("link") - ->id("graphics_toolkits") - ->label(t("Graphics")) - ->url(url::site("admin/graphics"))) - ->append(Menu::factory("link") - ->id("languages") - ->label(t("Languages")) - ->url(url::site("admin/languages"))) - ->append(Menu::factory("link") - ->id("l10n_mode") - ->label(Session::instance()->get("l10n_mode", false) - ? t("Stop translating") : t("Start translating")) - ->url(url::site("l10n_client/toggle_l10n_mode?csrf=" . - access::csrf_token()))) - ->append(Menu::factory("link") - ->id("advanced") - ->label("Advanced") - ->url(url::site("admin/advanced_settings")))) - ->append(Menu::factory("link") - ->id("modules") - ->label(t("Modules")) - ->url(url::site("admin/modules"))) - ->append(Menu::factory("submenu") - ->id("content_menu") - ->label(t("Content"))) - ->append(Menu::factory("submenu") - ->id("appearance_menu") - ->label(t("Appearance")) - ->append(Menu::factory("link") - ->id("themes") - ->label(t("Theme Choice")) - ->url(url::site("admin/themes"))) - ->append(Menu::factory("link") - ->id("theme_details") - ->label(t("Theme Options")) - ->url(url::site("admin/theme_details")))) - ->append(Menu::factory("link") - ->id("maintenance") - ->label(t("Maintenance")) - ->url(url::site("admin/maintenance"))) - ->append(Menu::factory("submenu") - ->id("statistics_menu") - ->label(t("Statistics")) - ->url("#")); - } -} diff --git a/modules/gallery/helpers/core_search.php b/modules/gallery/helpers/core_search.php deleted file mode 100644 index 9957a493..00000000 --- a/modules/gallery/helpers/core_search.php +++ /dev/null @@ -1,24 +0,0 @@ -description, $item->name, $item->title)); - } -} diff --git a/modules/gallery/helpers/core_task.php b/modules/gallery/helpers/core_task.php deleted file mode 100644 index e078192c..00000000 --- a/modules/gallery/helpers/core_task.php +++ /dev/null @@ -1,166 +0,0 @@ -count(); - $tasks = array(); - $tasks[] = Task_Definition::factory() - ->callback("core_task::rebuild_dirty_images") - ->name(t("Rebuild Images")) - ->description($dirty_count ? - t2("You have one out of date photo", - "You have %count out of date photos", - $dirty_count) - : t("All your photos are up to date")) - ->severity($dirty_count ? log::WARNING : log::SUCCESS); - - $tasks[] = Task_Definition::factory() - ->callback("core_task::update_l10n") - ->name(t("Update translations")) - ->description(t("Download new and updated translated strings")) - ->severity(log::SUCCESS); - - return $tasks; - } - - /** - * Task that rebuilds all dirty images. - * @param Task_Model the task - */ - static function rebuild_dirty_images($task) { - $result = graphics::find_dirty_images_query(); - $remaining = $result->count(); - $completed = $task->get("completed", 0); - - $i = 0; - foreach ($result as $row) { - $item = ORM::factory("item", $row->id); - if ($item->loaded) { - graphics::generate($item); - } - - $completed++; - $remaining--; - - if (++$i == 2) { - break; - } - } - - $task->status = t2("Updated: 1 image. Total: %total_count.", - "Updated: %count images. Total: %total_count.", - $completed, - array("total_count" => ($remaining + $completed))); - - if ($completed + $remaining > 0) { - $task->percent_complete = (int)(100 * $completed / ($completed + $remaining)); - } else { - $task->percent_complete = 100; - } - - $task->set("completed", $completed); - if ($remaining == 0) { - $task->done = true; - $task->state = "success"; - site_status::clear("graphics_dirty"); - } - } - - static function update_l10n(&$task) { - $start = microtime(true); - $dirs = $task->get("dirs"); - $files = $task->get("files"); - $cache = $task->get("cache", array()); - $i = 0; - - switch ($task->get("mode", "init")) { - case "init": // 0% - $dirs = array("core", "modules", "themes", "installer"); - $files = array(); - $task->set("mode", "find_files"); - $task->status = t("Finding files"); - break; - - case "find_files": // 0% - 10% - while (($dir = array_pop($dirs)) && microtime(true) - $start < 0.5) { - if (basename($dir) == "tests") { - continue; - } - - foreach (glob(DOCROOT . "$dir/*") as $path) { - $relative_path = str_replace(DOCROOT, "", $path); - if (is_dir($path)) { - $dirs[] = $relative_path; - } else { - $files[] = $relative_path; - } - } - } - - $task->status = t2("Finding files: found 1 file", - "Finding files: found %count files", count($files)); - - if (!$dirs) { - $task->set("mode", "scan_files"); - $task->set("total_files", count($files)); - $task->status = t("Scanning files"); - $task->percent_complete = 10; - } - break; - - case "scan_files": // 10% - 90% - while (($file = array_pop($files)) && microtime(true) - $start < 0.5) { - $file = DOCROOT . $file; - switch (pathinfo($file, PATHINFO_EXTENSION)) { - case "php": - l10n_scanner::scan_php_file($file, $cache); - break; - - case "info": - l10n_scanner::scan_info_file($file, $cache); - break; - } - } - - $total_files = $task->get("total_files"); - $task->status = t2("Scanning files: scanned 1 file", - "Scanning files: scanned %count files", $total_files - count($files)); - - $task->percent_complete = 10 + 80 * ($total_files - count($files)) / $total_files; - if (empty($files)) { - $task->set("mode", "fetch_updates"); - $task->status = t("Fetching updates"); - $task->percent_complete = 90; - } - break; - - case "fetch_updates": // 90% - 100% - l10n_client::fetch_updates(); - $task->done = true; - $task->state = "success"; - $task->status = t("Translations installed/updated"); - $task->percent_complete = 100; - } - - $task->set("files", $files); - $task->set("dirs", $dirs); - $task->set("cache", $cache); - } -} \ No newline at end of file diff --git a/modules/gallery/helpers/core_theme.php b/modules/gallery/helpers/core_theme.php deleted file mode 100644 index 28f544a1..00000000 --- a/modules/gallery/helpers/core_theme.php +++ /dev/null @@ -1,137 +0,0 @@ -get("debug")) { - $buf .= ""; - } - if (($theme->page_type == "album" || $theme->page_type == "photo") - && access::can("edit", $theme->item())) { - $buf .= ""; - $buf .= html::script("core/js/quick.js"); - } - if ($theme->page_type == "photo" && access::can("view_full", $theme->item())) { - $buf .= ""; - $buf .= html::script("core/js/fullsize.js"); - } - - if ($session->get("l10n_mode", false)) { - $buf .= ""; - $buf .= html::script("lib/jquery.cookie.js"); - $buf .= html::script("core/js/l10n_client.js"); - } - - return $buf; - } - - static function resize_top($theme, $item) { - if (access::can("edit", $item)) { - $edit_link = url::site("quick/pane/$item->id?page_type=photo"); - return "
"; - } - } - - static function resize_bottom($theme, $item) { - if (access::can("edit", $item)) { - return "
"; - } - } - - static function thumb_top($theme, $child) { - if (access::can("edit", $child)) { - $edit_link = url::site("quick/pane/$child->id?page_type=album"); - return "
"; - } - } - - static function thumb_bottom($theme, $child) { - if (access::can("edit", $child)) { - return "
"; - } - } - - static function admin_head($theme) { - $session = Session::instance(); - $buf = ""; - if ($session->get("debug")) { - $buf .= ""; - } - - if ($session->get("l10n_mode", false)) { - $buf .= ""; - $buf .= html::script("lib/jquery.cookie.js"); - $buf .= html::script("core/js/l10n_client.js"); - } - - return $buf; - } - - static function page_bottom($theme) { - $session = Session::instance(); - if ($session->get("profiler", false)) { - $profiler = new Profiler(); - $profiler->render(); - } - if ($session->get("l10n_mode", false)) { - return L10n_Client_Controller::l10n_form(); - } - - if ($session->get("after_install")) { - $session->delete("after_install"); - return new View("after_install_loader.html"); - } - } - - static function admin_page_bottom($theme) { - $session = Session::instance(); - if ($session->get("profiler", false)) { - $profiler = new Profiler(); - $profiler->render(); - } - if ($session->get("l10n_mode", false)) { - return L10n_Client_Controller::l10n_form(); - } - } - - static function credits() { - return "
  • " . - t("Powered by Gallery %version", - array("url" => "http://gallery.menalto.com", - "version" => module::get_var("core", "version"))) . - "
  • "; - } - - static function admin_credits() { - return core_theme::credits(); - } -} \ No newline at end of file diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php new file mode 100644 index 00000000..bf33fa2b --- /dev/null +++ b/modules/gallery/helpers/gallery.php @@ -0,0 +1,52 @@ +admin) { + Router::$controller = "maintenance"; + Router::$controller_path = APPPATH . "controllers/maintenance.php"; + Router::$method = "index"; + } + } + + /** + * This function is called when the Gallery is fully initialized. We relay it to modules as the + * "gallery_ready" event. Any module that wants to perform an action at the start of every + * request should implement the _event::gallery_ready() handler. + */ + static function ready() { + module::event("gallery_ready"); + } + + /** + * This function is called right before the Kohana framework shuts down. We relay it to modules + * as the "gallery_shutdown" event. Any module that wants to perform an action at the start of + * every request should implement the _event::gallery_shutdown() handler. + */ + static function shutdown() { + module::event("gallery_shutdown"); + } +} \ No newline at end of file diff --git a/modules/gallery/helpers/gallery_block.php b/modules/gallery/helpers/gallery_block.php new file mode 100644 index 00000000..abc8a195 --- /dev/null +++ b/modules/gallery/helpers/gallery_block.php @@ -0,0 +1,100 @@ + t("Welcome to Gallery 3!"), + "photo_stream" => t("Photo Stream"), + "log_entries" => t("Log Entries"), + "stats" => t("Gallery Stats"), + "platform_info" => t("Platform Information"), + "project_news" => t("Gallery Project News")); + } + + static function get($block_id) { + $block = new Block(); + switch($block_id) { + case "welcome": + $block->css_id = "gWelcome"; + $block->title = t("Welcome to Gallery3"); + $block->content = new View("admin_block_welcome.html"); + break; + + case "photo_stream": + $block->css_id = "gPhotoStream"; + $block->title = t("Photo Stream"); + $block->content = new View("admin_block_photo_stream.html"); + $block->content->photos = + ORM::factory("item")->where("type", "photo")->orderby("created", "DESC")->find_all(10); + break; + + case "log_entries": + $block->css_id = "gLogEntries"; + $block->title = t("Log Entries"); + $block->content = new View("admin_block_log_entries.html"); + $block->content->entries = ORM::factory("log")->orderby("timestamp", "DESC")->find_all(5); + break; + + case "stats": + $block->css_id = "gStats"; + $block->title = t("Gallery Stats"); + $block->content = new View("admin_block_stats.html"); + $block->content->album_count = ORM::factory("item")->where("type", "album")->count_all(); + $block->content->photo_count = ORM::factory("item")->where("type", "photo")->count_all(); + break; + + case "platform_info": + $block->css_id = "gPlatform"; + $block->title = t("Platform Information"); + $block->content = new View("admin_block_platform.html"); + if (is_readable("/proc/loadavg")) { + $block->content->load_average = + join(" ", array_slice(split(" ", array_shift(file("/proc/loadavg"))), 0, 3)); + } else { + $block->content->load_average = t("Unavailable"); + } + break; + + case "project_news": + $block->css_id = "gProjectNews"; + $block->title = t("Gallery Project News"); + $block->content = new View("admin_block_news.html"); + $block->content->feed = feed::parse("http://gallery.menalto.com/node/feed", 3); + break; + + case "block_adder": + $block->css_id = "gBlockAdder"; + $block->title = t("Dashboard Content"); + $block->content = self::get_add_block_form(); + } + + return $block; + } + + static function get_add_block_form() { + $form = new Forge("admin/dashboard/add_block", "", "post", + array("id" => "gAddDashboardBlockForm")); + $group = $form->group("add_block")->label(t("Add Block")); + $group->dropdown("id")->label("Available Blocks")->options(block_manager::get_available()); + $group->submit("center")->value(t("Add to center")); + $group->submit("sidebar")->value(t("Add to sidebar")); + return $form; + } +} \ No newline at end of file diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php new file mode 100644 index 00000000..aa11b7c0 --- /dev/null +++ b/modules/gallery/helpers/gallery_event.php @@ -0,0 +1,46 @@ +admin && module::get_var("gallery", "choose_default_tookit", null)) { + graphics::choose_default_toolkit(); + module::clear_var("gallery", "choose_default_tookit"); + } + } +} diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php new file mode 100644 index 00000000..e3aa403f --- /dev/null +++ b/modules/gallery/helpers/gallery_installer.php @@ -0,0 +1,278 @@ +query("CREATE TABLE {access_caches} ( + `id` int(9) NOT NULL auto_increment, + `item_id` int(9), + PRIMARY KEY (`id`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + + $db->query("CREATE TABLE {access_intents} ( + `id` int(9) NOT NULL auto_increment, + `item_id` int(9), + PRIMARY KEY (`id`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + + $db->query("CREATE TABLE {graphics_rules} ( + `id` int(9) NOT NULL auto_increment, + `active` BOOLEAN default 0, + `args` varchar(255) default NULL, + `module_name` varchar(64) NOT NULL, + `operation` varchar(64) NOT NULL, + `priority` int(9) NOT NULL, + `target` varchar(32) NOT NULL, + PRIMARY KEY (`id`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + + $db->query("CREATE TABLE {items} ( + `id` int(9) NOT NULL auto_increment, + `album_cover_item_id` int(9) default NULL, + `captured` int(9) default NULL, + `created` int(9) default NULL, + `description` varchar(2048) default NULL, + `height` int(9) default NULL, + `left` int(9) NOT NULL, + `level` int(9) NOT NULL, + `mime_type` varchar(64) default NULL, + `name` varchar(255) default NULL, + `owner_id` int(9) default NULL, + `parent_id` int(9) NOT NULL, + `rand_key` float default NULL, + `relative_path_cache` varchar(255) default NULL, + `resize_dirty` boolean default 1, + `resize_height` int(9) default NULL, + `resize_width` int(9) default NULL, + `right` int(9) NOT NULL, + `sort_column` varchar(64) default NULL, + `sort_order` char(4) default 'ASC', + `thumb_dirty` boolean default 1, + `thumb_height` int(9) default NULL, + `thumb_width` int(9) default NULL, + `title` varchar(255) default NULL, + `type` varchar(32) NOT NULL, + `updated` int(9) default NULL, + `view_count` int(9) default 0, + `weight` int(9) NOT NULL default 0, + `width` int(9) default NULL, + PRIMARY KEY (`id`), + KEY `parent_id` (`parent_id`), + KEY `type` (`type`), + KEY `random` (`rand_key`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + + $db->query("CREATE TABLE {logs} ( + `id` int(9) NOT NULL auto_increment, + `category` varchar(64) default NULL, + `html` varchar(255) default NULL, + `message` text default NULL, + `referer` varchar(255) default NULL, + `severity` int(9) default 0, + `timestamp` int(9) default 0, + `url` varchar(255) default NULL, + `user_id` int(9) default 0, + PRIMARY KEY (`id`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + + $db->query("CREATE TABLE {messages} ( + `id` int(9) NOT NULL auto_increment, + `key` varchar(255) default NULL, + `severity` varchar(32) default NULL, + `value` varchar(255) default NULL, + PRIMARY KEY (`id`), + UNIQUE KEY(`key`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + + $db->query("CREATE TABLE {modules} ( + `id` int(9) NOT NULL auto_increment, + `active` BOOLEAN default 0, + `name` varchar(64) default NULL, + `version` int(9) default NULL, + PRIMARY KEY (`id`), + UNIQUE KEY(`name`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + + $db->query("CREATE TABLE {themes} ( + `id` int(9) NOT NULL auto_increment, + `name` varchar(64) default NULL, + `version` int(9) default NULL, + PRIMARY KEY (`id`), + UNIQUE KEY(`name`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + + $db->query("CREATE TABLE {permissions} ( + `id` int(9) NOT NULL auto_increment, + `display_name` varchar(64) default NULL, + `name` varchar(64) default NULL, + PRIMARY KEY (`id`), + UNIQUE KEY(`name`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + + $db->query("CREATE TABLE {incoming_translations} ( + `id` int(9) NOT NULL auto_increment, + `key` char(32) NOT NULL, + `locale` char(10) NOT NULL, + `message` text NOT NULL, + `revision` int(9) DEFAULT NULL, + `translation` text, + PRIMARY KEY (`id`), + UNIQUE KEY(`key`, `locale`), + KEY `locale_key` (`locale`, `key`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + + $db->query("CREATE TABLE {outgoing_translations} ( + `id` int(9) NOT NULL auto_increment, + `base_revision` int(9) DEFAULT NULL, + `key` char(32) NOT NULL, + `locale` char(10) NOT NULL, + `message` text NOT NULL, + `translation` text, + PRIMARY KEY (`id`), + UNIQUE KEY(`key`, `locale`), + KEY `locale_key` (`locale`, `key`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + + $db->query("CREATE TABLE {sessions} ( + `session_id` varchar(127) NOT NULL, + `data` text NOT NULL, + `last_activity` int(10) UNSIGNED NOT NULL, + PRIMARY KEY (`session_id`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + + $db->query("CREATE TABLE {tasks} ( + `id` int(9) NOT NULL auto_increment, + `callback` varchar(128) default NULL, + `context` text NOT NULL, + `done` boolean default 0, + `name` varchar(128) default NULL, + `owner_id` int(9) default NULL, + `percent_complete` int(9) default 0, + `state` varchar(32) default NULL, + `status` varchar(255) default NULL, + `updated` int(9) default NULL, + PRIMARY KEY (`id`), + KEY (`owner_id`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + + $db->query("CREATE TABLE {vars} ( + `id` int(9) NOT NULL auto_increment, + `module_name` varchar(64) NOT NULL, + `name` varchar(64) NOT NULL, + `value` text, + PRIMARY KEY (`id`), + UNIQUE KEY(`module_name`, `name`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + + foreach (array("albums", "logs", "modules", "resizes", "thumbs", "tmp", "uploads") as $dir) { + @mkdir(VARPATH . $dir); + } + + access::register_permission("view", "View"); + access::register_permission("view_full", "View Full Size"); + access::register_permission("edit", "Edit"); + access::register_permission("add", "Add"); + + $root = ORM::factory("item"); + $root->type = "album"; + $root->title = "Gallery"; + $root->description = ""; + $root->left = 1; + $root->right = 2; + $root->parent_id = 0; + $root->level = 1; + $root->thumb_dirty = 1; + $root->resize_dirty = 1; + $root->sort_column = "weight"; + $root->sort_order = "ASC"; + $root->save(); + access::add_item($root); + + module::set_var("gallery", "active_site_theme", "default"); + module::set_var("gallery", "active_admin_theme", "admin_default"); + module::set_var("gallery", "page_size", 9); + module::set_var("gallery", "thumb_size", 200); + module::set_var("gallery", "resize_size", 640); + module::set_var("gallery", "default_locale", "en_US"); + module::set_var("gallery", "image_quality", 75); + + // Add rules for generating our thumbnails and resizes + graphics::add_rule( + "gallery", "thumb", "resize", + array("width" => 200, "height" => 200, "master" => Image::AUTO), + 100); + graphics::add_rule( + "gallery", "resize", "resize", + array("width" => 640, "height" => 480, "master" => Image::AUTO), + 100); + + // Instantiate default themes (site and admin) + foreach (array("default", "admin_default") as $theme_name) { + $theme_info = new ArrayObject(parse_ini_file(THEMEPATH . $theme_name . "/theme.info"), + ArrayObject::ARRAY_AS_PROPS); + $theme = ORM::factory("theme"); + $theme->name = $theme_name; + $theme->version = $theme_info->version; + $theme->save(); + } + + block_manager::add("dashboard_sidebar", "gallery", "block_adder"); + block_manager::add("dashboard_sidebar", "gallery", "stats"); + block_manager::add("dashboard_sidebar", "gallery", "platform_info"); + block_manager::add("dashboard_sidebar", "gallery", "project_news"); + block_manager::add("dashboard_center", "gallery", "welcome"); + block_manager::add("dashboard_center", "gallery", "photo_stream"); + block_manager::add("dashboard_center", "gallery", "log_entries"); + + module::set_version("gallery", 1); + module::set_var("gallery", "version", "3.0 pre-beta git"); + module::set_var("gallery", "choose_default_tookit", 1); + } + } + + static function uninstall() { + $db = Database::instance(); + $db->query("DROP TABLE IF EXISTS {access_caches}"); + $db->query("DROP TABLE IF EXISTS {access_intents}"); + $db->query("DROP TABLE IF EXISTS {graphics_rules}"); + $db->query("DROP TABLE IF EXISTS {items}"); + $db->query("DROP TABLE IF EXISTS {logs}"); + $db->query("DROP TABLE IF EXISTS {messages}"); + $db->query("DROP TABLE IF EXISTS {modules}"); + $db->query("DROP TABLE IF EXISTS {themes}"); + $db->query("DROP TABLE IF EXISTS {incoming_translations}"); + $db->query("DROP TABLE IF EXISTS {outgoing_translations}"); + $db->query("DROP TABLE IF EXISTS {permissions}"); + $db->query("DROP TABLE IF EXISTS {sessions}"); + $db->query("DROP TABLE IF EXISTS {tasks}"); + $db->query("DROP TABLE IF EXISTS {vars}"); + foreach (array("albums", "resizes", "thumbs", "uploads", + "modules", "logs", "database.php") as $entry) { + system("/bin/rm -rf " . VARPATH . $entry); + } + } +} diff --git a/modules/gallery/helpers/gallery_menu.php b/modules/gallery/helpers/gallery_menu.php new file mode 100644 index 00000000..215fc420 --- /dev/null +++ b/modules/gallery/helpers/gallery_menu.php @@ -0,0 +1,162 @@ +admin) { + $menu->append($scaffold_menu = Menu::factory("submenu") + ->id("scaffold") + ->label("Scaffold")); + $scaffold_menu->append(Menu::factory("link") + ->id("scaffold_home") + ->label("Dashboard") + ->url(url::site("scaffold"))); + } + + $menu->append(Menu::factory("link") + ->id("home") + ->label(t("Home")) + ->url(url::site("albums/1"))); + + $item = $theme->item(); + + if (user::active()->admin || ($item && access::can("edit", $item))) { + $menu->append($options_menu = Menu::factory("submenu") + ->id("options_menu") + ->label(t("Options"))); + + if ($item && access::can("edit", $item)) { + $options_menu + ->append(Menu::factory("dialog") + ->id("edit_item") + ->label($item->is_album() ? t("Edit album") : t("Edit photo")) + ->url(url::site("form/edit/{$item->type}s/$item->id"))); + + // @todo Move album options menu to the album quick edit pane + // @todo Create resized item quick edit pane menu + if ($item->is_album()) { + $options_menu + ->append(Menu::factory("dialog") + ->id("add_item") + ->label(t("Add a photo")) + ->url(url::site("simple_uploader/app/$item->id"))) + ->append(Menu::factory("dialog") + ->id("add_album") + ->label(t("Add an album")) + ->url(url::site("form/add/albums/$item->id?type=album"))) + ->append(Menu::factory("dialog") + ->id("edit_permissions") + ->label(t("Edit permissions")) + ->url(url::site("permissions/browse/$item->id"))); + } + } + } + + if (user::active()->admin) { + $menu->append($admin_menu = Menu::factory("submenu") + ->id("admin_menu") + ->label(t("Admin"))); + self::admin($admin_menu, $theme); + foreach (module::active() as $module) { + if ($module->name == "gallery") { + continue; + } + $class = "{$module->name}_menu"; + if (method_exists($class, "admin")) { + call_user_func_array(array($class, "admin"), array(&$admin_menu, $theme)); + } + } + } + } + + static function album($menu, $theme) { + } + + static function photo($menu, $theme) { + if (access::can("view_full", $theme->item())) { + $menu + ->append(Menu::factory("link") + ->id("fullsize") + ->label(t("View full size")) + ->url("#") + ->css_class("gFullSizeLink")); + } + $menu + ->append(Menu::factory("link") + ->id("album") + ->label(t("Return to album")) + ->url($theme->item()->parent()->url("show={$theme->item->id}")) + ->css_id("gAlbumLink")); + } + + static function admin($menu, $theme) { + $menu + ->append(Menu::factory("link") + ->id("dashboard") + ->label(t("Dashboard")) + ->url(url::site("admin"))) + ->append(Menu::factory("submenu") + ->id("settings_menu") + ->label(t("Settings")) + ->append(Menu::factory("link") + ->id("graphics_toolkits") + ->label(t("Graphics")) + ->url(url::site("admin/graphics"))) + ->append(Menu::factory("link") + ->id("languages") + ->label(t("Languages")) + ->url(url::site("admin/languages"))) + ->append(Menu::factory("link") + ->id("l10n_mode") + ->label(Session::instance()->get("l10n_mode", false) + ? t("Stop translating") : t("Start translating")) + ->url(url::site("l10n_client/toggle_l10n_mode?csrf=" . + access::csrf_token()))) + ->append(Menu::factory("link") + ->id("advanced") + ->label("Advanced") + ->url(url::site("admin/advanced_settings")))) + ->append(Menu::factory("link") + ->id("modules") + ->label(t("Modules")) + ->url(url::site("admin/modules"))) + ->append(Menu::factory("submenu") + ->id("content_menu") + ->label(t("Content"))) + ->append(Menu::factory("submenu") + ->id("appearance_menu") + ->label(t("Appearance")) + ->append(Menu::factory("link") + ->id("themes") + ->label(t("Theme Choice")) + ->url(url::site("admin/themes"))) + ->append(Menu::factory("link") + ->id("theme_details") + ->label(t("Theme Options")) + ->url(url::site("admin/theme_details")))) + ->append(Menu::factory("link") + ->id("maintenance") + ->label(t("Maintenance")) + ->url(url::site("admin/maintenance"))) + ->append(Menu::factory("submenu") + ->id("statistics_menu") + ->label(t("Statistics")) + ->url("#")); + } +} diff --git a/modules/gallery/helpers/gallery_search.php b/modules/gallery/helpers/gallery_search.php new file mode 100644 index 00000000..2a4029d3 --- /dev/null +++ b/modules/gallery/helpers/gallery_search.php @@ -0,0 +1,24 @@ +description, $item->name, $item->title)); + } +} diff --git a/modules/gallery/helpers/gallery_task.php b/modules/gallery/helpers/gallery_task.php new file mode 100644 index 00000000..6046bfc4 --- /dev/null +++ b/modules/gallery/helpers/gallery_task.php @@ -0,0 +1,166 @@ +count(); + $tasks = array(); + $tasks[] = Task_Definition::factory() + ->callback("gallery_task::rebuild_dirty_images") + ->name(t("Rebuild Images")) + ->description($dirty_count ? + t2("You have one out of date photo", + "You have %count out of date photos", + $dirty_count) + : t("All your photos are up to date")) + ->severity($dirty_count ? log::WARNING : log::SUCCESS); + + $tasks[] = Task_Definition::factory() + ->callback("gallery_task::update_l10n") + ->name(t("Update translations")) + ->description(t("Download new and updated translated strings")) + ->severity(log::SUCCESS); + + return $tasks; + } + + /** + * Task that rebuilds all dirty images. + * @param Task_Model the task + */ + static function rebuild_dirty_images($task) { + $result = graphics::find_dirty_images_query(); + $remaining = $result->count(); + $completed = $task->get("completed", 0); + + $i = 0; + foreach ($result as $row) { + $item = ORM::factory("item", $row->id); + if ($item->loaded) { + graphics::generate($item); + } + + $completed++; + $remaining--; + + if (++$i == 2) { + break; + } + } + + $task->status = t2("Updated: 1 image. Total: %total_count.", + "Updated: %count images. Total: %total_count.", + $completed, + array("total_count" => ($remaining + $completed))); + + if ($completed + $remaining > 0) { + $task->percent_complete = (int)(100 * $completed / ($completed + $remaining)); + } else { + $task->percent_complete = 100; + } + + $task->set("completed", $completed); + if ($remaining == 0) { + $task->done = true; + $task->state = "success"; + site_status::clear("graphics_dirty"); + } + } + + static function update_l10n(&$task) { + $start = microtime(true); + $dirs = $task->get("dirs"); + $files = $task->get("files"); + $cache = $task->get("cache", array()); + $i = 0; + + switch ($task->get("mode", "init")) { + case "init": // 0% + $dirs = array("gallery", "modules", "themes", "installer"); + $files = array(); + $task->set("mode", "find_files"); + $task->status = t("Finding files"); + break; + + case "find_files": // 0% - 10% + while (($dir = array_pop($dirs)) && microtime(true) - $start < 0.5) { + if (basename($dir) == "tests") { + continue; + } + + foreach (glob(DOCROOT . "$dir/*") as $path) { + $relative_path = str_replace(DOCROOT, "", $path); + if (is_dir($path)) { + $dirs[] = $relative_path; + } else { + $files[] = $relative_path; + } + } + } + + $task->status = t2("Finding files: found 1 file", + "Finding files: found %count files", count($files)); + + if (!$dirs) { + $task->set("mode", "scan_files"); + $task->set("total_files", count($files)); + $task->status = t("Scanning files"); + $task->percent_complete = 10; + } + break; + + case "scan_files": // 10% - 90% + while (($file = array_pop($files)) && microtime(true) - $start < 0.5) { + $file = DOCROOT . $file; + switch (pathinfo($file, PATHINFO_EXTENSION)) { + case "php": + l10n_scanner::scan_php_file($file, $cache); + break; + + case "info": + l10n_scanner::scan_info_file($file, $cache); + break; + } + } + + $total_files = $task->get("total_files"); + $task->status = t2("Scanning files: scanned 1 file", + "Scanning files: scanned %count files", $total_files - count($files)); + + $task->percent_complete = 10 + 80 * ($total_files - count($files)) / $total_files; + if (empty($files)) { + $task->set("mode", "fetch_updates"); + $task->status = t("Fetching updates"); + $task->percent_complete = 90; + } + break; + + case "fetch_updates": // 90% - 100% + l10n_client::fetch_updates(); + $task->done = true; + $task->state = "success"; + $task->status = t("Translations installed/updated"); + $task->percent_complete = 100; + } + + $task->set("files", $files); + $task->set("dirs", $dirs); + $task->set("cache", $cache); + } +} \ No newline at end of file diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php new file mode 100644 index 00000000..0acccb45 --- /dev/null +++ b/modules/gallery/helpers/gallery_theme.php @@ -0,0 +1,137 @@ +get("debug")) { + $buf .= ""; + } + if (($theme->page_type == "album" || $theme->page_type == "photo") + && access::can("edit", $theme->item())) { + $buf .= ""; + $buf .= html::script("gallery/js/quick.js"); + } + if ($theme->page_type == "photo" && access::can("view_full", $theme->item())) { + $buf .= ""; + $buf .= html::script("gallery/js/fullsize.js"); + } + + if ($session->get("l10n_mode", false)) { + $buf .= ""; + $buf .= html::script("lib/jquery.cookie.js"); + $buf .= html::script("gallery/js/l10n_client.js"); + } + + return $buf; + } + + static function resize_top($theme, $item) { + if (access::can("edit", $item)) { + $edit_link = url::site("quick/pane/$item->id?page_type=photo"); + return "
    "; + } + } + + static function resize_bottom($theme, $item) { + if (access::can("edit", $item)) { + return "
    "; + } + } + + static function thumb_top($theme, $child) { + if (access::can("edit", $child)) { + $edit_link = url::site("quick/pane/$child->id?page_type=album"); + return "
    "; + } + } + + static function thumb_bottom($theme, $child) { + if (access::can("edit", $child)) { + return "
    "; + } + } + + static function admin_head($theme) { + $session = Session::instance(); + $buf = ""; + if ($session->get("debug")) { + $buf .= ""; + } + + if ($session->get("l10n_mode", false)) { + $buf .= ""; + $buf .= html::script("lib/jquery.cookie.js"); + $buf .= html::script("gallery/js/l10n_client.js"); + } + + return $buf; + } + + static function page_bottom($theme) { + $session = Session::instance(); + if ($session->get("profiler", false)) { + $profiler = new Profiler(); + $profiler->render(); + } + if ($session->get("l10n_mode", false)) { + return L10n_Client_Controller::l10n_form(); + } + + if ($session->get("after_install")) { + $session->delete("after_install"); + return new View("after_install_loader.html"); + } + } + + static function admin_page_bottom($theme) { + $session = Session::instance(); + if ($session->get("profiler", false)) { + $profiler = new Profiler(); + $profiler->render(); + } + if ($session->get("l10n_mode", false)) { + return L10n_Client_Controller::l10n_form(); + } + } + + static function credits() { + return "
  • " . + t("Powered by Gallery %version", + array("url" => "http://gallery.menalto.com", + "version" => module::get_var("gallery", "version"))) . + "
  • "; + } + + static function admin_credits() { + return gallery_theme::credits(); + } +} \ No newline at end of file diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index 805a95c0..605b9ff8 100644 --- a/modules/gallery/helpers/graphics.php +++ b/modules/gallery/helpers/graphics.php @@ -26,11 +26,11 @@ class graphics_Core { * Rules are applied to targets (thumbnails and resizes) in priority order. Rules are functions * in the graphics class. So for example, the following rule: * - * graphics::add_rule("core", "thumb", "resize", + * graphics::add_rule("gallery", "thumb", "resize", * array("width" => 200, "height" => 200, "master" => Image::AUTO), 100); * - * Specifies that "core" is adding a rule to resize thumbnails down to a max of 200px on - * the longest side. The core module adds default rules at a priority of 100. You can set + * Specifies that "gallery" is adding a rule to resize thumbnails down to a max of 200px on + * the longest side. The gallery module adds default rules at a priority of 100. You can set * higher and lower priorities to perform operations before or after this fires. * * @param string $module_name the module that added the rule @@ -194,7 +194,7 @@ class graphics_Core { } else { Image::factory($input_file) ->resize($options["width"], $options["height"], $options["master"]) - ->quality(module::get_var("core", "image_quality")) + ->quality(module::get_var("gallery", "image_quality")) ->save($output_file); } } @@ -212,7 +212,7 @@ class graphics_Core { } Image::factory($input_file) - ->quality(module::get_var("core", "image_quality")) + ->quality(module::get_var("gallery", "image_quality")) ->rotate($options["degrees"]) ->save($output_file); } @@ -262,7 +262,7 @@ class graphics_Core { Image::factory($input_file) ->composite($options["file"], $x, $y, $options["transparency"]) - ->quality(module::get_var("core", "image_quality")) + ->quality(module::get_var("gallery", "image_quality")) ->save($output_file); } @@ -302,7 +302,7 @@ class graphics_Core { $count, array("attrs" => sprintf( 'href="%s" class="gDialogLink"', - url::site("admin/maintenance/start/core_task::rebuild_dirty_images?csrf=__CSRF__")))), + url::site("admin/maintenance/start/gallery_task::rebuild_dirty_images?csrf=__CSRF__")))), "graphics_dirty"); } } @@ -332,12 +332,12 @@ class graphics_Core { $toolkits = graphics::detect_toolkits(); foreach (array("imagemagick", "graphicsmagick", "gd") as $tk) { if ($toolkits[$tk]) { - module::set_var("core", "graphics_toolkit", $tk); - module::set_var("core", "graphics_toolkit_path", $tk == "gd" ? "" : $toolkits[$tk]); + module::set_var("gallery", "graphics_toolkit", $tk); + module::set_var("gallery", "graphics_toolkit_path", $tk == "gd" ? "" : $toolkits[$tk]); break; } } - if (!module::get_var("core", "graphics_toolkit")) { + if (!module::get_var("gallery", "graphics_toolkit")) { site_status::warning( t("Graphics toolkit missing! Please choose a toolkit", array("url" => url::site("admin/graphics"))), @@ -349,7 +349,7 @@ class graphics_Core { * Choose which driver the Kohana Image library uses. */ static function init_toolkit() { - switch(module::get_var("core", "graphics_toolkit")) { + switch(module::get_var("gallery", "graphics_toolkit")) { case "gd": Kohana::config_set("image.driver", "GD"); break; @@ -357,13 +357,13 @@ class graphics_Core { case "imagemagick": Kohana::config_set("image.driver", "ImageMagick"); Kohana::config_set( - "image.params.directory", module::get_var("core", "graphics_toolkit_path")); + "image.params.directory", module::get_var("gallery", "graphics_toolkit_path")); break; case "graphicsmagick": Kohana::config_set("image.driver", "GraphicsMagick"); Kohana::config_set( - "image.params.directory", module::get_var("core", "graphics_toolkit_path")); + "image.params.directory", module::get_var("gallery", "graphics_toolkit_path")); break; } @@ -376,7 +376,7 @@ class graphics_Core { * @return boolean */ static function can($func) { - if (module::get_var("core", "graphics_toolkit") == "gd" && + if (module::get_var("gallery", "graphics_toolkit") == "gd" && $func == "rotate" && !function_exists("imagerotate")) { return false; diff --git a/modules/gallery/helpers/l10n_client.php b/modules/gallery/helpers/l10n_client.php index ec4c5429..d26739f5 100644 --- a/modules/gallery/helpers/l10n_client.php +++ b/modules/gallery/helpers/l10n_client.php @@ -35,9 +35,9 @@ class l10n_client_Core { static function api_key($api_key=null) { if ($api_key !== null) { - module::set_var("core", "l10n_client_key", $api_key); + module::set_var("gallery", "l10n_client_key", $api_key); } - return module::get_var("core", "l10n_client_key", ""); + return module::get_var("gallery", "l10n_client_key", ""); } static function server_uid($api_key=null) { diff --git a/modules/gallery/helpers/locale.php b/modules/gallery/helpers/locale.php index b707637f..2ba0f255 100644 --- a/modules/gallery/helpers/locale.php +++ b/modules/gallery/helpers/locale.php @@ -37,8 +37,8 @@ class locale_Core { static function installed() { $available = self::available(); - $default = module::get_var("core", "default_locale"); - $codes = explode("|", module::get_var("core", "installed_locales", $default)); + $default = module::get_var("gallery", "default_locale"); + $codes = explode("|", module::get_var("gallery", "installed_locales", $default)); foreach ($codes as $code) { if (isset($available->$code)) { $installed[$code] = $available[$code]; @@ -49,10 +49,10 @@ class locale_Core { static function update_installed($locales) { // Ensure that the default is included... - $default = module::get_var("core", "default_locale"); + $default = module::get_var("gallery", "default_locale"); $locales = array_merge($locales, array($default)); - module::set_var("core", "installed_locales", join("|", $locales)); + module::set_var("gallery", "installed_locales", join("|", $locales)); } // @todo Might want to add a localizable language name as well. diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php index a48c89ed..a6cc87ac 100644 --- a/modules/gallery/helpers/module.php +++ b/modules/gallery/helpers/module.php @@ -37,7 +37,7 @@ class module_Core { $module = self::get($module_name); if (!$module->loaded) { $module->name = $module_name; - $module->active = $module_name == "core"; // only core is active by default + $module->active = $module_name == "gallery"; // only gallery is active by default } $module->version = 1; $module->save(); @@ -75,7 +75,7 @@ class module_Core { */ static function available() { $modules = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS); - foreach (array_merge(array("core/module.info"), glob(MODPATH . "*/module.info")) as $file) { + foreach (array_merge(array("gallery/module.info"), 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); @@ -85,7 +85,7 @@ class module_Core { } // Lock certain modules - $modules->core->locked = true; + $modules->gallery->locked = true; $modules->user->locked = true; $modules->ksort(); @@ -215,10 +215,10 @@ class module_Core { if ($module->active) { self::$active[] = $module; } - if ($module->name != "core") { - $kohana_modules[] = MODPATH . $module->name; - } + $kohana_modules[] = MODPATH . $module->name; + // @todo: force 'gallery' to be at the end } + Kohana::config_set("core.modules", $kohana_modules); } @@ -252,32 +252,32 @@ class module_Core { * @return the value */ static function get_var($module_name, $name, $default_value=null) { - // We cache all vars in core._cache so that we can load all vars at once for + // We cache all vars in gallery._cache so that we can load all vars at once for // performance. if (empty(self::$var_cache)) { $row = Database::instance() ->select("value") ->from("vars") - ->where(array("module_name" => "core", "name" => "_cache")) + ->where(array("module_name" => "gallery", "name" => "_cache")) ->get() ->current(); if ($row) { self::$var_cache = unserialize($row->value); } else { - // core._cache doesn't exist. Create it now. + // gallery._cache doesn't exist. Create it now. foreach (Database::instance() ->select("module_name", "name", "value") ->from("vars") ->orderby("module_name", "name") ->get() as $row) { - if ($row->module_name == "core" && $row->name == "_cache") { + if ($row->module_name == "gallery" && $row->name == "_cache") { // This could happen if there's a race condition continue; } self::$var_cache->{$row->module_name}->{$row->name} = $row->value; } $cache = ORM::factory("var"); - $cache->module_name = "core"; + $cache->module_name = "gallery"; $cache->name = "_cache"; $cache->value = serialize(self::$var_cache); $cache->save(); @@ -309,7 +309,7 @@ class module_Core { $var->value = $value; $var->save(); - Database::instance()->delete("vars", array("module_name" => "core", "name" => "_cache")); + Database::instance()->delete("vars", array("module_name" => "gallery", "name" => "_cache")); self::$var_cache = null; } @@ -325,7 +325,7 @@ class module_Core { "WHERE `module_name` = '$module_name' " . "AND `name` = '$name'"); - Database::instance()->delete("vars", array("module_name" => "core", "name" => "_cache")); + Database::instance()->delete("vars", array("module_name" => "gallery", "name" => "_cache")); self::$var_cache = null; } @@ -343,7 +343,7 @@ class module_Core { $var->delete(); } - Database::instance()->delete("vars", array("module_name" => "core", "name" => "_cache")); + Database::instance()->delete("vars", array("module_name" => "gallery", "name" => "_cache")); self::$var_cache = null; } diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php index 3293d4ac..15225fe7 100644 --- a/modules/gallery/helpers/movie.php +++ b/modules/gallery/helpers/movie.php @@ -140,11 +140,11 @@ class movie_Core { } static function find_ffmpeg() { - if (!$ffmpeg_path = module::get_var("core", "ffmpeg_path")) { + if (!$ffmpeg_path = module::get_var("gallery", "ffmpeg_path")) { if (function_exists("exec")) { $ffmpeg_path = exec("which ffmpeg"); if ($ffmpeg_path) { - module::set_var("core", "ffmpeg_path", $ffmpeg_path); + module::set_var("gallery", "ffmpeg_path", $ffmpeg_path); } } } diff --git a/modules/gallery/helpers/theme.php b/modules/gallery/helpers/theme.php index cbe224db..af340db6 100644 --- a/modules/gallery/helpers/theme.php +++ b/modules/gallery/helpers/theme.php @@ -31,10 +31,11 @@ class theme_Core { static function load_themes() { $modules = Kohana::config("core.modules"); if (Router::$controller == "admin") { - array_unshift($modules, THEMEPATH . module::get_var("core", "active_admin_theme")); + array_unshift($modules, THEMEPATH . module::get_var("gallery", "active_admin_theme")); } else { - array_unshift($modules, THEMEPATH . module::get_var("core", "active_site_theme")); + array_unshift($modules, THEMEPATH . module::get_var("gallery", "active_site_theme")); } + Kohana::config_set("core.modules", $modules); } @@ -43,17 +44,17 @@ class theme_Core { $group = $form->group("edit_theme"); $group->input("page_size")->label(t("Items per page"))->id("gPageSize") ->rules("required|valid_digit") - ->value(module::get_var("core", "page_size")); + ->value(module::get_var("gallery", "page_size")); $group->input("thumb_size")->label(t("Thumbnail size (in pixels)"))->id("gThumbSize") ->rules("required|valid_digit") - ->value(module::get_var("core", "thumb_size")); + ->value(module::get_var("gallery", "thumb_size")); $group->input("resize_size")->label(t("Resized image size (in pixels)"))->id("gResizeSize") ->rules("required|valid_digit") - ->value(module::get_var("core", "resize_size")); + ->value(module::get_var("gallery", "resize_size")); $group->textarea("header_text")->label(t("Header text"))->id("gHeaderText") - ->value(module::get_var("core", "header_text")); + ->value(module::get_var("gallery", "header_text")); $group->textarea("footer_text")->label(t("Footer text"))->id("gFooterText") - ->value(module::get_var("core", "footer_text")); + ->value(module::get_var("gallery", "footer_text")); $group->submit("")->value(t("Save")); return $form; } diff --git a/modules/gallery/hooks/init_gallery.php b/modules/gallery/hooks/init_gallery.php index 2c36795a..5735e7dc 100644 --- a/modules/gallery/hooks/init_gallery.php +++ b/modules/gallery/hooks/init_gallery.php @@ -26,11 +26,11 @@ if (!file_exists(VARPATH . "database.php")) { Event::add("system.ready", array("I18n", "instance")); Event::add("system.ready", array("module", "load_modules")); -Event::add("system.ready", array("core", "ready")); +Event::add("system.ready", array("gallery", "ready")); Event::add("system.post_routing", array("theme", "load_themes")); Event::add("system.post_routing", array("url", "parse_url")); -Event::add("system.post_routing", array("core", "maintenance_mode")); -Event::add("system.shutdown", array("core", "shutdown")); +Event::add("system.post_routing", array("gallery", "maintenance_mode")); +Event::add("system.shutdown", array("gallery", "shutdown")); // Override the cookie if we have a session id in the URL. // @todo This should probably be an event callback diff --git a/modules/gallery/libraries/Admin_View.php b/modules/gallery/libraries/Admin_View.php index acc3f8ec..1f976871 100644 --- a/modules/gallery/libraries/Admin_View.php +++ b/modules/gallery/libraries/Admin_View.php @@ -29,15 +29,15 @@ class Admin_View_Core extends View { * @return void */ public function __construct($name) { - $theme_name = module::get_var("core", "active_site_theme"); + $theme_name = module::get_var("gallery", "active_site_theme"); if (!file_exists("themes/$theme_name")) { - module::set_var("core", "active_site_theme", "admin_default"); + module::set_var("gallery", "active_site_theme", "admin_default"); theme::load_themes(); Kohana::log("error", "Unable to locate theme '$theme_name', switching to default theme."); } parent::__construct($name); - $this->theme_name = module::get_var("core", "active_admin_theme"); + $this->theme_name = module::get_var("gallery", "active_admin_theme"); if (user::active()->admin) { $this->theme_name = Input::instance()->get("theme", $this->theme_name); } @@ -57,10 +57,10 @@ class Admin_View_Core extends View { public function admin_menu() { $menu = Menu::factory("root"); - core_menu::admin($menu, $this); + gallery_menu::admin($menu, $this); foreach (module::active() as $module) { - if ($module->name == "core") { + if ($module->name == "gallery") { continue; } $class = "{$module->name}_menu"; diff --git a/modules/gallery/libraries/I18n.php b/modules/gallery/libraries/I18n.php index c936be88..f2801169 100644 --- a/modules/gallery/libraries/I18n.php +++ b/modules/gallery/libraries/I18n.php @@ -62,7 +62,7 @@ class I18n_Core { if (self::$_instance == NULL || isset($config)) { $config = isset($config) ? $config : Kohana::config('locale'); if (empty($config['default_locale'])) { - $config['default_locale'] = module::get_var('core', 'default_locale'); + $config['default_locale'] = module::get_var('gallery', 'default_locale'); } self::$_instance = new I18n_Core($config); } diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index b5b97666..5fcc2943 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -30,15 +30,15 @@ class Theme_View_Core extends View { * @return void */ public function __construct($name, $page_type) { - $theme_name = module::get_var("core", "active_site_theme"); + $theme_name = module::get_var("gallery", "active_site_theme"); if (!file_exists("themes/$theme_name")) { - module::set_var("core", "active_site_theme", "default"); + module::set_var("gallery", "active_site_theme", "default"); theme::load_themes(); Kohana::log("error", "Unable to locate theme '$theme_name', switching to default theme."); } parent::__construct($name); - $this->theme_name = module::get_var("core", "active_site_theme"); + $this->theme_name = module::get_var("gallery", "active_site_theme"); if (user::active()->admin) { $this->theme_name = Input::instance()->get("theme", $this->theme_name); } @@ -64,7 +64,7 @@ class Theme_View_Core extends View { public function thumb_proportion() { // @TODO change the 200 to a theme supplied value when and if we come up with an // API to allow the theme to set defaults. - return module::get_var("core", "thumb_size", 200) / 200; + return module::get_var("gallery", "thumb_size", 200) / 200; } public function url($path, $absolute_url=false) { @@ -91,10 +91,10 @@ class Theme_View_Core extends View { public function site_menu() { $menu = Menu::factory("root"); if ($this->page_type != "login") { - core_menu::site($menu, $this); + gallery_menu::site($menu, $this); foreach (module::active() as $module) { - if ($module->name == "core") { + if ($module->name == "gallery") { continue; } $class = "{$module->name}_menu"; @@ -109,10 +109,10 @@ class Theme_View_Core extends View { public function album_menu() { $menu = Menu::factory("root"); - core_menu::album($menu, $this); + gallery_menu::album($menu, $this); foreach (module::active() as $module) { - if ($module->name == "core") { + if ($module->name == "gallery") { continue; } $class = "{$module->name}_menu"; @@ -126,10 +126,10 @@ class Theme_View_Core extends View { public function photo_menu() { $menu = Menu::factory("root"); - core_menu::photo($menu, $this); + gallery_menu::photo($menu, $this); foreach (module::active() as $module) { - if ($module->name == "core") { + if ($module->name == "gallery") { continue; } $class = "{$module->name}_menu"; diff --git a/modules/gallery/tests/Core_Installer_Test.php b/modules/gallery/tests/Core_Installer_Test.php index f7036286..24d24b38 100644 --- a/modules/gallery/tests/Core_Installer_Test.php +++ b/modules/gallery/tests/Core_Installer_Test.php @@ -19,21 +19,21 @@ */ /** - * This test case operates under the assumption that core_installer::install() is called by the + * This test case operates under the assumption that gallery_installer::install() is called by the * test controller before it starts. */ -class Core_Installer_Test extends Unit_Test_Case { +class Gallery_Installer_Test extends Unit_Test_Case { public function install_creates_dirs_test() { $this->assert_true(file_exists(VARPATH . "albums")); $this->assert_true(file_exists(VARPATH . "resizes")); } - public function install_registers_core_module_test() { - $core = ORM::factory("module")->where("name", "core")->find(); - $this->assert_equal("core", $core->name); + public function install_registers_gallery_module_test() { + $gallery = ORM::factory("module")->where("name", "gallery")->find(); + $this->assert_equal("gallery", $gallery->name); // This is probably too volatile to keep for long - $this->assert_equal(1, $core->version); + $this->assert_equal(1, $gallery->version); } public function install_creates_root_item_test() { diff --git a/modules/gallery/tests/File_Structure_Test.php b/modules/gallery/tests/File_Structure_Test.php index 1caa82ba..3b8c754f 100644 --- a/modules/gallery/tests/File_Structure_Test.php +++ b/modules/gallery/tests/File_Structure_Test.php @@ -218,11 +218,11 @@ class GalleryCodeFilterIterator extends FilterIterator { $path_name = $this->getInnerIterator()->getPathName(); return !( strpos($path_name, ".svn") || - strpos($path_name, "core/views/kohana_profiler.php") !== false || strpos($path_name, DOCROOT . "test") !== false || strpos($path_name, DOCROOT . "var") !== false || strpos($path_name, MODPATH . "forge") !== false || strpos($path_name, APPPATH . "views/kohana_error_page.php") !== false || + strpos($path_name, MODPATH . "gallery/views/kohana_profiler.php") !== false || strpos($path_name, MODPATH . "gallery_unit_test/views/kohana_error_page.php") !== false || strpos($path_name, MODPATH . "gallery_unit_test/views/kohana_unit_test_cli.php") !== false || strpos($path_name, MODPATH . "unit_test") !== false || diff --git a/modules/gallery/tests/Movie_Helper_Test.php b/modules/gallery/tests/Movie_Helper_Test.php index b92ef3f8..627651bb 100644 --- a/modules/gallery/tests/Movie_Helper_Test.php +++ b/modules/gallery/tests/Movie_Helper_Test.php @@ -22,7 +22,7 @@ class Movie_Helper_Test extends Unit_Test_Case { $rand = rand(); $root = ORM::factory("item", 1); try { - $movie = movie::create($root, DOCROOT . "core/tests/test.jpg", "$rand/.jpg", $rand, $rand); + $movie = movie::create($root, MODPATH . "gallery/tests/test.jpg", "$rand/.jpg", $rand, $rand); } catch (Exception $e) { // pass return; @@ -35,7 +35,7 @@ class Movie_Helper_Test extends Unit_Test_Case { $rand = rand(); $root = ORM::factory("item", 1); try { - $movie = movie::create($root, DOCROOT . "core/tests/test.jpg", "$rand.jpg.", $rand, $rand); + $movie = movie::create($root, MODPATH . "gallery/tests/test.jpg", "$rand.jpg.", $rand, $rand); } catch (Exception $e) { $this->assert_equal("@todo NAME_CANNOT_END_IN_PERIOD", $e->getMessage()); return; diff --git a/modules/gallery/tests/Photo_Helper_Test.php b/modules/gallery/tests/Photo_Helper_Test.php index deb11bb9..2a6693e1 100644 --- a/modules/gallery/tests/Photo_Helper_Test.php +++ b/modules/gallery/tests/Photo_Helper_Test.php @@ -21,7 +21,7 @@ class Photo_Helper_Test extends Unit_Test_Case { public function create_photo_test() { $rand = rand(); - $filename = DOCROOT . "core/tests/test.jpg"; + $filename = MODPATH . "gallery/tests/test.jpg"; $image_info = getimagesize($filename); $root = ORM::factory("item", 1); @@ -50,8 +50,8 @@ class Photo_Helper_Test extends Unit_Test_Case { public function create_conflicting_photo_test() { $rand = rand(); $root = ORM::factory("item", 1); - $photo1 = photo::create($root, DOCROOT . "core/tests/test.jpg", "$rand.jpg", $rand, $rand); - $photo2 = photo::create($root, DOCROOT . "core/tests/test.jpg", "$rand.jpg", $rand, $rand); + $photo1 = photo::create($root, MODPATH . "gallery/tests/test.jpg", "$rand.jpg", $rand, $rand); + $photo2 = photo::create($root, MODPATH . "gallery/tests/test.jpg", "$rand.jpg", $rand, $rand); $this->assert_true($photo1->name != $photo2->name); } @@ -68,7 +68,7 @@ class Photo_Helper_Test extends Unit_Test_Case { public function thumb_url_test() { $rand = rand(); $root = ORM::factory("item", 1); - $photo = photo::create($root, DOCROOT . "core/tests/test.jpg", "$rand.jpg", $rand, $rand); + $photo = photo::create($root, MODPATH . "gallery/tests/test.jpg", "$rand.jpg", $rand, $rand); $this->assert_equal("http://./var/thumbs/{$rand}.jpg", $photo->thumb_url()); } @@ -76,7 +76,7 @@ class Photo_Helper_Test extends Unit_Test_Case { $rand = rand(); $root = ORM::factory("item", 1); $album = album::create($root, $rand, $rand, $rand); - $photo = photo::create($album, DOCROOT . "core/tests/test.jpg", "$rand.jpg", $rand, $rand); + $photo = photo::create($album, MODPATH . "gallery/tests/test.jpg", "$rand.jpg", $rand, $rand); $this->assert_equal("http://./var/resizes/{$rand}/{$rand}.jpg", $photo->resize_url()); } @@ -85,7 +85,7 @@ class Photo_Helper_Test extends Unit_Test_Case { $rand = rand(); $root = ORM::factory("item", 1); try { - $photo = photo::create($root, DOCROOT . "core/tests/test.jpg", "$rand/.jpg", $rand, $rand); + $photo = photo::create($root, MODPATH . "gallery/tests/test.jpg", "$rand/.jpg", $rand, $rand); } catch (Exception $e) { // pass return; @@ -98,7 +98,7 @@ class Photo_Helper_Test extends Unit_Test_Case { $rand = rand(); $root = ORM::factory("item", 1); try { - $photo = photo::create($root, DOCROOT . "core/tests/test.jpg", "$rand.jpg.", $rand, $rand); + $photo = photo::create($root, MODPATH . "gallery/tests/test.jpg", "$rand.jpg.", $rand, $rand); } catch (Exception $e) { $this->assert_equal("@todo NAME_CANNOT_END_IN_PERIOD", $e->getMessage()); return; diff --git a/modules/gallery/tests/Photos_Controller_Test.php b/modules/gallery/tests/Photos_Controller_Test.php index 71319315..771cc90d 100644 --- a/modules/gallery/tests/Photos_Controller_Test.php +++ b/modules/gallery/tests/Photos_Controller_Test.php @@ -29,7 +29,7 @@ class Photos_Controller_Test extends Unit_Test_Case { public function change_photo_test() { $controller = new Photos_Controller(); $root = ORM::factory("item", 1); - $photo = photo::create($root, DOCROOT . "core/tests/test.jpg", "test.jpeg", "test", "test"); + $photo = photo::create($root, MODPATH . "gallery/tests/test.jpg", "test.jpeg", "test", "test"); $orig_name = $photo->name; $_POST["filename"] = "test.jpeg"; @@ -58,7 +58,7 @@ class Photos_Controller_Test extends Unit_Test_Case { public function change_photo_no_csrf_fails_test() { $controller = new Photos_Controller(); $root = ORM::factory("item", 1); - $photo = photo::create($root, DOCROOT . "core/tests/test.jpg", "test", "test", "test"); + $photo = photo::create($root, MODPATH . "gallery/tests/test.jpg", "test", "test", "test"); $_POST["name"] = "new name"; $_POST["title"] = "new title"; $_POST["description"] = "new description"; diff --git a/modules/gallery/tests/Var_Test.php b/modules/gallery/tests/Var_Test.php index 82370631..355d94a7 100644 --- a/modules/gallery/tests/Var_Test.php +++ b/modules/gallery/tests/Var_Test.php @@ -19,31 +19,31 @@ */ class Var_Test extends Unit_Test_Case { public function add_parameter_test() { - module::set_var("core", "Parameter", "original value"); - $this->assert_equal("original value", module::get_var("core", "Parameter")); + module::set_var("gallery", "Parameter", "original value"); + $this->assert_equal("original value", module::get_var("gallery", "Parameter")); - module::set_var("core", "Parameter", "updated value"); - $this->assert_equal("updated value", module::get_var("core", "Parameter")); + module::set_var("gallery", "Parameter", "updated value"); + $this->assert_equal("updated value", module::get_var("gallery", "Parameter")); } public function clear_parameter_test() { - module::set_var("core", "Parameter", "original value"); - $this->assert_equal("original value", module::get_var("core", "Parameter")); + module::set_var("gallery", "Parameter", "original value"); + $this->assert_equal("original value", module::get_var("gallery", "Parameter")); - module::clear_var("core", "Parameter"); - $this->assert_equal(null, module::get_var("core", "Parameter")); + module::clear_var("gallery", "Parameter"); + $this->assert_equal(null, module::get_var("gallery", "Parameter")); } public function incr_parameter_test() { - module::set_var("core", "Parameter", "original value"); - module::incr_var("core", "Parameter"); - $this->assert_equal("1", module::get_var("core", "Parameter")); + module::set_var("gallery", "Parameter", "original value"); + module::incr_var("gallery", "Parameter"); + $this->assert_equal("1", module::get_var("gallery", "Parameter")); - module::set_var("core", "Parameter", "2"); - module::incr_var("core", "Parameter", "9"); - $this->assert_equal("11", module::get_var("core", "Parameter")); + module::set_var("gallery", "Parameter", "2"); + module::incr_var("gallery", "Parameter", "9"); + $this->assert_equal("11", module::get_var("gallery", "Parameter")); - module::incr_var("core", "NonExistent", "9"); - $this->assert_equal(null, module::get_var("core", "NonExistent")); + module::incr_var("gallery", "NonExistent", "9"); + $this->assert_equal(null, module::get_var("gallery", "NonExistent")); } } \ No newline at end of file diff --git a/modules/gallery/views/admin_advanced_settings.html.php b/modules/gallery/views/admin_advanced_settings.html.php index 1f3825bd..9f90d671 100644 --- a/modules/gallery/views/admin_advanced_settings.html.php +++ b/modules/gallery/views/admin_advanced_settings.html.php @@ -17,7 +17,7 @@ - module_name == "core" && $var->name == "_cache") continue ?> + module_name == "gallery" && $var->name == "_cache") continue ?> module_name ?> name ?> diff --git a/modules/gallery/views/admin_block_stats.html.php b/modules/gallery/views/admin_block_stats.html.php index 2d975073..395ed71d 100644 --- a/modules/gallery/views/admin_block_stats.html.php +++ b/modules/gallery/views/admin_block_stats.html.php @@ -1,7 +1,7 @@
    • - module::get_var("core", "version"))) ?> + module::get_var("gallery", "version"))) ?>
    • $album_count)) ?> diff --git a/modules/gallery/views/admin_graphics_gd.html.php b/modules/gallery/views/admin_graphics_gd.html.php index cae68b74..b77da8e3 100644 --- a/modules/gallery/views/admin_graphics_gd.html.php +++ b/modules/gallery/views/admin_graphics_gd.html.php @@ -1,6 +1,6 @@
      gd["GD Version"] ? " gInstalledToolkit" : " gUnavailable" ?>"> - " alt="" /> + " alt="" />

      GD website for more information.", diff --git a/modules/gallery/views/admin_graphics_graphicsmagick.html.php b/modules/gallery/views/admin_graphics_graphicsmagick.html.php index 720a9459..e2cd0777 100644 --- a/modules/gallery/views/admin_graphics_graphicsmagick.html.php +++ b/modules/gallery/views/admin_graphics_graphicsmagick.html.php @@ -1,7 +1,7 @@

      graphicsmagick ? " gInstalledToolkit" : " gUnavailable" ?>">

      - " alt="" /> + " alt="" />

      GraphicsMagick website for more information.", array("url" => "http://www.graphicsmagick.org")) ?> diff --git a/modules/gallery/views/admin_graphics_imagemagick.html.php b/modules/gallery/views/admin_graphics_imagemagick.html.php index c7468eed..081ddc15 100644 --- a/modules/gallery/views/admin_graphics_imagemagick.html.php +++ b/modules/gallery/views/admin_graphics_imagemagick.html.php @@ -1,7 +1,7 @@

      imagemagick ? " gInstalledToolkit" : " gUnavailable" ?>">

      - " alt="" /> + " alt="" />

      ImageMagick website for more information.", array("url" => "http://www.imagemagick.org")) ?> diff --git a/modules/gallery/views/admin_languages.html.php b/modules/gallery/views/admin_languages.html.php index 2b43f1b4..f41694b4 100644 --- a/modules/gallery/views/admin_languages.html.php +++ b/modules/gallery/views/admin_languages.html.php @@ -5,7 +5,7 @@

      - " + " class="gDialogLink"> diff --git a/modules/gallery/views/kohana_error_page.php b/modules/gallery/views/kohana_error_page.php index d9bf9698..a091bca3 100644 --- a/modules/gallery/views/kohana_error_page.php +++ b/modules/gallery/views/kohana_error_page.php @@ -58,8 +58,9 @@ <?= t("Something went wrong!") ?> - - admin ?> + +admin ?> +

      diff --git a/modules/gallery/views/permissions_browse.html.php b/modules/gallery/views/permissions_browse.html.php index afd87c2b..749bee4f 100644 --- a/modules/gallery/views/permissions_browse.html.php +++ b/modules/gallery/views/permissions_browse.html.php @@ -27,7 +27,7 @@
      • - AllowOverride FileInfo Options to fix this.", array("url" => "http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride")) ?> + AllowOverride FileInfo Options to fix this.", array("url" => "http://httpd.apache.org/docs/2.0/mod/gallery.html#allowoverride")) ?>
      diff --git a/modules/gallery/views/scaffold.html.php b/modules/gallery/views/scaffold.html.php index 765464b5..60ce0b57 100644 --- a/modules/gallery/views/scaffold.html.php +++ b/modules/gallery/views/scaffold.html.php @@ -102,7 +102,7 @@
      - "/> + "/>

      Gallery3 Scaffold

      diff --git a/modules/gallery_unit_test/controllers/gallery_unit_test.php b/modules/gallery_unit_test/controllers/gallery_unit_test.php index 5206f9fb..c9aa0ddc 100644 --- a/modules/gallery_unit_test/controllers/gallery_unit_test.php +++ b/modules/gallery_unit_test/controllers/gallery_unit_test.php @@ -96,15 +96,15 @@ class Gallery_Unit_Test_Controller extends Controller { $db->clear_cache(); // Install all modules - // Force core and user to be installed first to resolve dependencies. - core_installer::install(true); + // Force gallery and user to be installed first to resolve dependencies. + gallery_installer::install(true); module::load_modules(); module::install("user"); module::activate("user"); $modules = array(); foreach (glob(MODPATH . "*/helpers/*_installer.php") as $file) { $module_name = basename(dirname(dirname($file))); - if (in_array($module_name, array("core", "user"))) { + if (in_array($module_name, array("gallery", "user"))) { continue; } module::install($module_name); diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php index 7df7d52f..1c4792b2 100644 --- a/modules/organize/controllers/organize.php +++ b/modules/organize/controllers/organize.php @@ -235,7 +235,7 @@ class Organize_Controller extends Controller { print $v->render(); } - // Handlers for the album/photo edit. Probably should be in core + // Handlers for the album/photo edit. Probably should be in modules/gallery public function general() { access::verify_csrf(); diff --git a/modules/search/controllers/search.php b/modules/search/controllers/search.php index cdd66174..08128ae8 100644 --- a/modules/search/controllers/search.php +++ b/modules/search/controllers/search.php @@ -19,7 +19,7 @@ */ class Search_Controller extends Controller { public function index() { - $page_size = module::get_var("core", "page_size", 9); + $page_size = module::get_var("gallery", "page_size", 9); $q = $this->input->get("q"); $page = $this->input->get("page", 1); $offset = ($page - 1) * $page_size; diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php index 9090e51d..aecd1db7 100644 --- a/modules/tag/controllers/tags.php +++ b/modules/tag/controllers/tags.php @@ -21,7 +21,7 @@ class Tags_Controller extends REST_Controller { protected $resource_type = "tag"; public function _show($tag) { - $page_size = module::get_var("core", "page_size", 9); + $page_size = module::get_var("gallery", "page_size", 9); $page = $this->input->get("page", "1"); $children_count = $tag->items_count(); $offset = ($page-1) * $page_size; diff --git a/themes/default/views/footer.html.php b/themes/default/views/footer.html.php index bd17a634..d7111922 100644 --- a/themes/default/views/footer.html.php +++ b/themes/default/views/footer.html.php @@ -1,6 +1,6 @@ footer() ?> - +
        diff --git a/themes/default/views/header.html.php b/themes/default/views/header.html.php index c70c8a4d..9d058e35 100644 --- a/themes/default/views/header.html.php +++ b/themes/default/views/header.html.php @@ -1,6 +1,6 @@ header_top() ?> - + "> -- cgit v1.2.3