diff options
Diffstat (limited to 'modules')
37 files changed, 767 insertions, 741 deletions
diff --git a/modules/akismet/helpers/akismet_installer.php b/modules/akismet/helpers/akismet_installer.php index 920c58b7..5d8c0e07 100644 --- a/modules/akismet/helpers/akismet_installer.php +++ b/modules/akismet/helpers/akismet_installer.php @@ -19,10 +19,7 @@ */ class akismet_installer { static function install() { - $version = module::get_version("akismet"); - if ($version == 0) { - module::set_version("akismet", 1); - } + module::set_version("akismet", 1); } static function activate() { diff --git a/modules/comment/helpers/comment_installer.php b/modules/comment/helpers/comment_installer.php index b1cfcdc0..f54913c3 100644 --- a/modules/comment/helpers/comment_installer.php +++ b/modules/comment/helpers/comment_installer.php @@ -20,38 +20,42 @@ class comment_installer { static function install() { $db = Database::instance(); - $version = module::get_version("comment"); + $db->query("CREATE TABLE IF NOT EXISTS {comments} ( + `author_id` int(9) default NULL, + `created` int(9) NOT NULL, + `guest_email` varchar(128) default NULL, + `guest_name` varchar(128) default NULL, + `guest_url` varchar(255) default NULL, + `id` int(9) NOT NULL auto_increment, + `item_id` int(9) NOT NULL, + `server_http_accept_charset` varchar(64) default NULL, + `server_http_accept_encoding` varchar(64) default NULL, + `server_http_accept_language` varchar(64) default NULL, + `server_http_accept` varchar(128) default NULL, + `server_http_connection` varchar(64) default NULL, + `server_http_host` varchar(64) default NULL, + `server_http_referer` varchar(255) default NULL, + `server_http_user_agent` varchar(128) default NULL, + `server_query_string` varchar(64) default NULL, + `server_remote_addr` varchar(32) default NULL, + `server_remote_host` varchar(64) default NULL, + `server_remote_port` varchar(16) default NULL, + `state` varchar(15) default 'unpublished', + `text` text, + `updated` int(9) NOT NULL, + PRIMARY KEY (`id`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - if ($version == 0) { - $db->query("CREATE TABLE IF NOT EXISTS {comments} ( - `author_id` int(9) default NULL, - `created` int(9) NOT NULL, - `guest_email` varchar(128) default NULL, - `guest_name` varchar(128) default NULL, - `guest_url` varchar(255) default NULL, - `id` int(9) NOT NULL auto_increment, - `item_id` int(9) NOT NULL, - `server_http_accept_charset` varchar(64) default NULL, - `server_http_accept_encoding` varchar(64) default NULL, - `server_http_accept_language` varchar(64) default NULL, - `server_http_accept` varchar(128) default NULL, - `server_http_connection` varchar(64) default NULL, - `server_http_host` varchar(64) default NULL, - `server_http_referer` varchar(255) default NULL, - `server_http_user_agent` varchar(128) default NULL, - `server_query_string` varchar(64) default NULL, - `server_remote_addr` varchar(32) default NULL, - `server_remote_host` varchar(64) default NULL, - `server_remote_port` varchar(16) default NULL, - `state` char(15) default 'unpublished', - `text` text, - `updated` int(9) NOT NULL, - PRIMARY KEY (`id`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + block_manager::add("dashboard_center", "comment", "recent_comments"); + module::set_var("comment", "spam_caught", 0); + module::set_version("comment", 2); + } - block_manager::add("dashboard_center", "comment", "recent_comments"); - module::set_var("comment", "spam_caught", 0); - module::set_version("comment", 1); + static function upgrade($version) { + if ($version == 1) { + $db = Database::instance(); + $db->query("ALTER TABLE {comments} CHANGE `state` `state` varchar(15) default 'unpublished'"); + module::set_version("comment", 2); } } diff --git a/modules/comment/module.info b/modules/comment/module.info index 08a800a6..946f1d39 100644 --- a/modules/comment/module.info +++ b/modules/comment/module.info @@ -1,3 +1,3 @@ name = Comments description = Allows users and guests to leave comments on photos and albums. -version = 1 +version = 2 diff --git a/modules/exif/helpers/exif_installer.php b/modules/exif/helpers/exif_installer.php index da49f649..0233f2bb 100644 --- a/modules/exif/helpers/exif_installer.php +++ b/modules/exif/helpers/exif_installer.php @@ -19,21 +19,17 @@ */ class exif_installer { static function install() { - $version = module::get_version("exif"); - - if ($version == 0) { - $db = Database::instance(); - $db->query("CREATE TABLE IF NOT EXISTS {exif_records} ( - `id` int(9) NOT NULL auto_increment, - `item_id` INTEGER(9) NOT NULL, - `key_count` INTEGER(9) default 0, - `data` TEXT, - `dirty` BOOLEAN default 1, - PRIMARY KEY (`id`), - KEY(`item_id`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - module::set_version("exif", 1); - } + $db = Database::instance(); + $db->query("CREATE TABLE IF NOT EXISTS {exif_records} ( + `id` int(9) NOT NULL auto_increment, + `item_id` INTEGER(9) NOT NULL, + `key_count` INTEGER(9) default 0, + `data` TEXT, + `dirty` BOOLEAN default 1, + PRIMARY KEY (`id`), + KEY(`item_id`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + module::set_version("exif", 1); } static function activate() { diff --git a/modules/g2_import/controllers/admin_g2_import.php b/modules/g2_import/controllers/admin_g2_import.php index f2969f49..18d09363 100644 --- a/modules/g2_import/controllers/admin_g2_import.php +++ b/modules/g2_import/controllers/admin_g2_import.php @@ -21,6 +21,9 @@ class Admin_g2_import_Controller extends Admin_Controller { public function index() { if (g2_import::is_configured()) { g2_import::init(); + } + + if (class_exists("GalleryCoreApi")) { $g2_stats = g2_import::stats(); $g2_sizes = g2_import::common_sizes(); } diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 2eee564a..91ca1e63 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -113,11 +113,13 @@ class g2_import_Core { "require_once(dirname(__FILE__) . '/modules/core/classes/GalleryDataCache.class');", "define('GALLERY_CONFIG_DIR', dirname(__FILE__));", "\$gallery =& new Gallery();", + "\$GLOBALS['gallery'] =& new Gallery();", "\$gallery = new Gallery();"), array("require_once(dirname(__FILE__) . '/Gallery.class');", "require_once('$base_dir/modules/core/classes/GalleryDataCache.class');", "define('GALLERY_CONFIG_DIR', '$config_dir');", "\$gallery =& new G2_Gallery();", + "\$GLOBALS['gallery'] =& new G2_Gallery();", "\$gallery = new G2_Gallery();"), array_merge(array("<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n"), file("$base_dir/bootstrap.inc")))); diff --git a/modules/g2_import/helpers/g2_import_installer.php b/modules/g2_import/helpers/g2_import_installer.php index 5f414d42..0f87da6c 100644 --- a/modules/g2_import/helpers/g2_import_installer.php +++ b/modules/g2_import/helpers/g2_import_installer.php @@ -20,19 +20,16 @@ class g2_import_installer { static function install() { $db = Database::instance(); - $version = module::get_version("g2_import"); - if ($version == 0) { - $db->query("CREATE TABLE IF NOT EXISTS {g2_maps} ( - `id` int(9) NOT NULL auto_increment, - `g2_id` int(9) NOT NULL, - `g3_id` int(9) NOT NULL, - PRIMARY KEY (`id`), - KEY (`g2_id`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + $db->query("CREATE TABLE IF NOT EXISTS {g2_maps} ( + `id` int(9) NOT NULL auto_increment, + `g2_id` int(9) NOT NULL, + `g3_id` int(9) NOT NULL, + PRIMARY KEY (`id`), + KEY (`g2_id`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - module::set_version("g2_import", 1); - mkdir(VARPATH . "modules/g2_import"); - } + module::set_version("g2_import", 1); + mkdir(VARPATH . "modules/g2_import"); } static function uninstall() { diff --git a/modules/g2_import/helpers/g2_import_task.php b/modules/g2_import/helpers/g2_import_task.php index 4cd95581..3961097d 100644 --- a/modules/g2_import/helpers/g2_import_task.php +++ b/modules/g2_import/helpers/g2_import_task.php @@ -21,15 +21,19 @@ class g2_import_task_Core { static function available_tasks() { if (g2_import::is_configured()) { g2_import::init(); + } + + + if (class_exists("GalleryCoreApi")) { return array(Task_Definition::factory() ->callback("g2_import_task::import") ->name(t("Import from Gallery 2")) ->description( t("Gallery %version detected", array("version" => g2_import::version()))) ->severity(log::SUCCESS)); - } else { - return array(); } + + return array(); } static function import($task) { diff --git a/modules/gallery/controllers/admin_modules.php b/modules/gallery/controllers/admin_modules.php index f7dd909d..ed1f7665 100644 --- a/modules/gallery/controllers/admin_modules.php +++ b/modules/gallery/controllers/admin_modules.php @@ -45,7 +45,11 @@ class Admin_Modules_Controller extends Admin_Controller { } else if (!$info->active && $desired && !module::is_active($module_name)) { $changes->activate[] = $module_name; $activated_names[] = $info->name; - module::install($module_name); + if (module::is_installed($module_name)) { + module::upgrade($module_name); + } else { + module::install($module_name); + } module::activate($module_name); } } diff --git a/modules/gallery/controllers/admin_theme_options.php b/modules/gallery/controllers/admin_theme_options.php index 2716ed93..8970c3c9 100644 --- a/modules/gallery/controllers/admin_theme_options.php +++ b/modules/gallery/controllers/admin_theme_options.php @@ -56,6 +56,7 @@ class Admin_Theme_Options_Controller extends Admin_Controller { module::set_var("gallery", "header_text", $form->edit_theme->header_text->value); module::set_var("gallery", "footer_text", $form->edit_theme->footer_text->value); + module::set_var("gallery", "show_credits", $form->edit_theme->show_credits->value); message::success(t("Updated theme details")); url::redirect("admin/theme_options"); diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index 17fdec6b..22f50fb8 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -167,7 +167,8 @@ class Albums_Controller extends Items_Controller { $form = album::get_edit_form($album); if ($valid = $form->validate()) { // Make sure that there's not a conflict - if (Database::instance() + if ($album->id != 1 && + Database::instance() ->from("items") ->where("parent_id", $album->parent_id) ->where("id <>", $album->id) @@ -188,7 +189,9 @@ class Albums_Controller extends Items_Controller { $album->description = $form->edit_album->description->value; $album->sort_column = $form->edit_album->sort_order->column->value; $album->sort_order = $form->edit_album->sort_order->direction->value; - $album->rename($form->edit_album->dirname->value); + if ($album->id != 1) { + $album->rename($form->edit_album->dirname->value); + } $album->save(); module::event("item_updated", $orig, $album); diff --git a/modules/gallery/controllers/upgrader.php b/modules/gallery/controllers/upgrader.php index 5eb96fdd..91952fa9 100644 --- a/modules/gallery/controllers/upgrader.php +++ b/modules/gallery/controllers/upgrader.php @@ -50,8 +50,8 @@ class Upgrader_Controller extends Controller { } // Upgrade gallery and user first - module::install("gallery"); - module::install("user"); + module::upgrade("gallery"); + module::upgrade("user"); // Then upgrade the rest foreach (module::available() as $id => $module) { @@ -60,7 +60,7 @@ class Upgrader_Controller extends Controller { } if ($module->active && $module->code_version != $module->version) { - module::install($id); + module::upgrade($id); } } diff --git a/modules/gallery/css/l10n_client.css b/modules/gallery/css/l10n_client.css index bab1d0ed..ecec859d 100644 --- a/modules/gallery/css/l10n_client.css +++ b/modules/gallery/css/l10n_client.css @@ -5,8 +5,8 @@ /* $Id: l10n_client.css,v 1.6 2008/09/09 10:48:20 goba Exp $ */ /* width percentages add to 99% rather than 100% to prevent float -overflows from occurring in an unnamed browser that can't decide -how it wants to round. */ + overflows from occurring in an unnamed browser that can't decide + how it wants to round. */ /* l10n_client container */ #l10n-client { @@ -19,8 +19,8 @@ how it wants to round. */ bottom:0px; left:0px; overflow:hidden;} - * html #l10n-client { - position:static;} +* html #l10n-client { + position:static;} #l10n-client-string-select .string-list, #l10n-client-string-editor .source, @@ -34,38 +34,38 @@ how it wants to round. */ color:#fff; background:#37a;} - #l10n-client .labels .label { - display:none;} +#l10n-client .labels .label { + display:none;} - /* Panel toggle button (span) */ - #l10n-client .labels .toggle { - cursor:pointer; - display:block; - position:absolute; right:0em; - padding: 0em .75em; height:2em; line-height:2em; - text-transform:uppercase; - text-align:center; background:#000;} +/* Panel toggle button (span) */ +#l10n-client .labels .toggle { + cursor:pointer; + display:block; + position:absolute; right:0em; + padding: 0em .75em; height:2em; line-height:2em; + text-transform:uppercase; + text-align:center; background:#000;} - /* Panel labels */ - #l10n-client h2 { - border-left:1px solid #fff; - height:1em; line-height:1em; - padding: .5em; margin:0px; - font-size:1em; - text-transform:uppercase;} +/* Panel labels */ +#l10n-client h2 { + border-left:1px solid #fff; + height:1em; line-height:1em; + padding: .5em; margin:0px; + font-size:1em; + text-transform:uppercase;} - #l10n-client .strings h2 { - border:0px;} +#l10n-client .strings h2 { + border:0px;} - /* 25 + 37 + 37 = 99 */ - #l10n-client .strings { - width:25%; float:left;} +/* 25 + 37 + 37 = 99 */ +#l10n-client .strings { + width:25%; float:left;} - #l10n-client .source { - width:37%; float:left;} +#l10n-client .source { + width:37%; float:left;} - #l10n-client .translation { - width:37%; float:left;} +#l10n-client .translation { + width:37%; float:left;} /* Translatable string list */ #l10n-client-string-select { @@ -75,77 +75,77 @@ how it wants to round. */ direction: ltr; } - #l10n-client .string-list { - height:17em; - overflow:auto; - list-style:none; list-style-image:none; - margin:0em; padding:0em;} - - #l10n-client .string-list li { - font-size:.9em; - line-height:1.5em; - cursor:default; - background:transparent; - list-style:none; list-style-image:none; - border-bottom:1px solid #ddd; - padding:.25em .5em; - margin:0em;} - - /* Green for translated */ - #l10n-client .string-list li.translated { - border-bottom-color:#9c3; - background:#cf6; color:#360;} - - #l10n-client .string-list li.translated:hover { - background: #df8;} - - #l10n-client .string-list li.translated:active { - background: #9c3;} - - #l10n-client .string-list li.hidden { - display:none;} - - /* Gray + Blue hover for untranslated */ - #l10n-client .string-list li.untranslated {} - - #l10n-client .string-list li.untranslated:hover { - background: #ace;} - - #l10n-client .string-list li.untranslated:active { - background: #8ac;} - - /* Selected string is indicated by bold text */ - #l10n-client .string-list li.active { - font-weight:bold;} - - #l10n-client #gL10nSearchForm { - background:#eee; - text-align:center; - height:2em; line-height:2em; - margin:0em; padding:.5em .5em; - } - - #l10n-client #gL10nSearchForm .form-item, - #l10n-client #gL10nSearchForm input.form-text, - #l10n-client #gL10nSearchForm #search-filter-go, - #l10n-client #gL10nSearchForm #search-filter-clear { - display:inline; - vertical-align:middle; - } - - #l10n-client #gL10nSearchForm .form-item { - margin:0em; - padding:0em; - } - - #l10n-client #gL10nSearchForm input.form-text { - width:80%; - } - - #l10n-client #gL10nSearchForm #search-filter-clear { - width:10%; - margin:0em; - } +#l10n-client .string-list { + height:17em; + overflow:auto; + list-style:none; list-style-image:none; + margin:0em; padding:0em;} + +#l10n-client .string-list li { + font-size:.9em; + line-height:1.5em; + cursor:default; + background:transparent; + list-style:none; list-style-image:none; + border-bottom:1px solid #ddd; + padding:.25em .5em; + margin:0em;} + +/* Green for translated */ +#l10n-client .string-list li.translated { + border-bottom-color:#9c3; + background:#cf6; color:#360;} + +#l10n-client .string-list li.translated:hover { + background: #df8;} + +#l10n-client .string-list li.translated:active { + background: #9c3;} + +#l10n-client .string-list li.hidden { + display:none;} + +/* Gray + Blue hover for untranslated */ +#l10n-client .string-list li.untranslated {} + +#l10n-client .string-list li.untranslated:hover { + background: #ace;} + +#l10n-client .string-list li.untranslated:active { + background: #8ac;} + +/* Selected string is indicated by bold text */ +#l10n-client .string-list li.active { + font-weight:bold;} + +#l10n-client #gL10nSearchForm { + background:#eee; + text-align:center; + height:2em; line-height:2em; + margin:0em; padding:.5em .5em; +} + +#l10n-client #gL10nSearchForm .form-item, +#l10n-client #gL10nSearchForm input.form-text, +#l10n-client #gL10nSearchForm #search-filter-go, +#l10n-client #gL10nSearchForm #search-filter-clear { + display:inline; + vertical-align:middle; +} + +#l10n-client #gL10nSearchForm .form-item { + margin:0em; + padding:0em; +} + +#l10n-client #gL10nSearchForm input.form-text { + width:80%; +} + +#l10n-client #gL10nSearchForm #search-filter-clear { + width:10%; + margin:0em; +} #l10n-client-string-editor { display:none; @@ -153,22 +153,22 @@ how it wants to round. */ width:74%;} #l10n-client-string-editor .source { - overflow:hidden; - width:50%; float:left;} + overflow:hidden; + width:50%; float:left;} #l10n-client-string-editor .source .source-text { - line-height:1.5em; - background:#eee; - font-family: monospace; - text-align: left; - height:16em; margin:1em; padding:1em; - overflow:auto; - direction: ltr; + line-height:1.5em; + background:#eee; + font-family: monospace; + text-align: left; + height:16em; margin:1em; padding:1em; + overflow:auto; + direction: ltr; } - #l10n-client-string-editor .translation { - overflow:hidden; - width:49%; float:right;} +#l10n-client-string-editor .translation { + overflow:hidden; + width:49%; float:right;} #gL10nClientSaveForm { padding:0em;} diff --git a/modules/gallery/css/upgrader.css b/modules/gallery/css/upgrader.css index 6bd16064..b877df49 100644 --- a/modules/gallery/css/upgrader.css +++ b/modules/gallery/css/upgrader.css @@ -1,117 +1,117 @@ body { - background: #eee; - font-family: Trebuchet MS; - font-size: 1.1em; + background: #eee; + font-family: Trebuchet MS; + font-size: 1.1em; } h1 { - font-size: 1.4em; + font-size: 1.4em; } div#outer { - width: 650px; - background: white; - border: 1px solid #999; - margin: 0 auto; - padding: -10px; + width: 650px; + background: white; + border: 1px solid #999; + margin: 0 auto; + padding: -10px; } div#inner { - padding: 0 1em 0 1em; - margin: 0px; + padding: 0 1em 0 1em; + margin: 0px; } div#footer { - border-top: 1px solid #ccc; - margin: 1em; + border-top: 1px solid #ccc; + margin: 1em; } td.name { - text-align: left; - padding-left: 30px; + text-align: left; + padding-left: 30px; } td { - text-align: center; - border-bottom: 1px solid #eee; + text-align: center; + border-bottom: 1px solid #eee; } tr.current td { - color: #999; - font-style: italic; + color: #999; + font-style: italic; } tr.current td.gallery { - color: #00d; + color: #00d; } tr.upgradeable td { - font-weight: bold; + font-weight: bold; } tr.upgradeable td.gallery { - color: #00d; + color: #00d; } table { - width: 600px; - margin-bottom: 10px; + width: 600px; + margin-bottom: 10px; } p { - font-size: .9em; + font-size: .9em; } ul { - font-size: .9em; - list-style: none; + font-size: .9em; + list-style: none; } li { - display: inline; + display: inline; } li:before { - content: "\00BB \0020"; + content: "\00BB \0020"; } div.button { - margin: 0 auto; - width: 120px; - text-align: center; - border: 1px solid #999; - background: #eee; + margin: 0 auto; + width: 120px; + text-align: center; + border: 1px solid #999; + background: #eee; } div.button a { - text-decoration: none; + text-decoration: none; } div.button:hover { - background: #ccc; + background: #ccc; } div#confirmation { - position: absolute; - background: blue; - z-index: 1000; - margin: 10px; - text-align: center; + position: absolute; + background: blue; + z-index: 1000; + margin: 10px; + text-align: center; } div#confirmation div { - margin: 2px; - padding: 20px; - border: 2px solid #999; - background: #eee; + margin: 2px; + padding: 20px; + border: 2px solid #999; + background: #eee; } .gray_on_done { - opacity: <?= $done ? "0.5" : "1" ?>; + opacity: <?= $done ? "0.5" : "1" ?>; } pre { - display: inline; - margin: 0px; - padding: 0px; + display: inline; + margin: 0px; + padding: 0px; } diff --git a/modules/gallery/helpers/gallery_block.php b/modules/gallery/helpers/gallery_block.php index c3837f54..a10f2bbf 100644 --- a/modules/gallery/helpers/gallery_block.php +++ b/modules/gallery/helpers/gallery_block.php @@ -49,8 +49,9 @@ class gallery_block_Core { $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; + $block->content->entries = ORM::factory("log") + ->orderby(array("timestamp" => "DESC", "id" => "DESC"))->find_all(5); + break; case "stats": $block->css_id = "gStats"; diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index cd871c17..df555d52 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -18,244 +18,241 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class gallery_installer { - static function install($initial_install=false) { + static function install() { $db = Database::instance(); - if ($initial_install) { - $version = 0; - } else { - $version = module::get_version("gallery"); - } - - if ($version == 0) { - $db->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 {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 {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 {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 {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 {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 {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 {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 {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 {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 {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 {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 {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 {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 {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 {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 {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 {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 {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 {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 {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 {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;"); + $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;"); - foreach (array("albums", "logs", "modules", "resizes", "thumbs", "tmp", "uploads") as $dir) { - @mkdir(VARPATH . $dir); - } + $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;"); - access::register_permission("view", "View"); - access::register_permission("view_full", "View Full Size"); - access::register_permission("edit", "Edit"); - access::register_permission("add", "Add"); + foreach (array("albums", "logs", "modules", "resizes", "thumbs", "tmp", "uploads") as $dir) { + @mkdir(VARPATH . $dir); + } - $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); + access::register_permission("view", "View"); + access::register_permission("view_full", "View Full Size"); + access::register_permission("edit", "Edit"); + access::register_permission("add", "Add"); - 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); + $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); - // 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); + 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); - // 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(); - } + // 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); - 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"); + // 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(); + } - module::set_version("gallery", $version = 1); - module::set_var("gallery", "version", "3.0 beta 1"); - module::set_var("gallery", "choose_default_tookit", 1); + 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"); - // @todo this string needs to be picked up by l10n_scanner - module::set_var("gallery", "credits", "Powered by <a href=\"%url\">Gallery %version</a>"); - } + module::set_var("gallery", "version", "3.0 pre beta 2 (git)"); + module::set_var("gallery", "choose_default_tookit", 1); + module::set_var("gallery", "date_format", "Y-M-d"); + module::set_var("gallery", "date_time_format", "Y-M-d H:i:s"); + module::set_var("gallery", "time_format", "H:i:s"); + module::set_var("gallery", "show_credits", 1); + // @todo this string needs to be picked up by l10n_scanner + module::set_var("gallery", "credits", "Powered by <a href=\"%url\">Gallery %version</a>"); + module::set_version("gallery", 3); + } + static function upgrade($version) { if ($version == 1) { module::set_var("gallery", "date_format", "Y-M-d"); module::set_var("gallery", "date_time_format", "Y-M-d H:i:s"); @@ -263,6 +260,11 @@ class gallery_installer { module::set_var("gallery", "version", "3.0 pre beta 2 (git)"); module::set_version("gallery", $version = 2); } + + if ($version == 2) { + module::set_var("gallery", "show_credits", 1); + module::set_version("gallery", $version = 3); + } } static function uninstall() { diff --git a/modules/gallery/helpers/gallery_quick.php b/modules/gallery/helpers/gallery_quick.php index bb791c33..d0ffc584 100644 --- a/modules/gallery/helpers/gallery_quick.php +++ b/modules/gallery/helpers/gallery_quick.php @@ -83,19 +83,20 @@ class gallery_quick_Core { "class" => "gDialogLink gButtonLink", "icon" => "ui-icon-pencil", "href" => url::site("quick/form_edit/$item->id?page_type=$page_type")); + if ($item->is_photo() && graphics::can("rotate")) { $elements["left"][] = (object)array( "title" => t("Rotate 90 degrees counter clockwise"), "class" => "gButtonLink", "icon" => "ui-icon-rotate-ccw", - "href" => url::site("quick/form_edit/$item->id/ccw?csrf=$csrf&?page_type=$page_type")); + "href" => url::site("quick/rotate/$item->id/ccw?csrf=$csrf&page_type=$page_type")); $elements["left"][] = (object)array( "title" => t("Rotate 90 degrees clockwise"), "class" => "gButtonLink", "icon" => "ui-icon-rotate-cw", - "href" => url::site("quick/form_edit/$item->id/cw?csrf=$csrf&page_type=$page_type")); + "href" => url::site("quick/rotate/$item->id/cw?csrf=$csrf&page_type=$page_type")); } // Don't move photos from the photo page; we don't yet have a good way of redirecting after move @@ -118,7 +119,7 @@ class gallery_quick_Core { $elements["right"][] = (object)array( "title" => $delete_title, - "class" => "gButtonLink", + "class" => "gDialogLink gButtonLink", "icon" => "ui-icon-trash", "id" => "gQuickDelete", "href" => url::site("quick/form_delete/$item->id?csrf=$csrf&page_type=$page_type")); diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php index dea8e22c..0d483206 100644 --- a/modules/gallery/helpers/module.php +++ b/modules/gallery/helpers/module.php @@ -107,7 +107,7 @@ class module_Core { /** * Install a module. This will call <module>_installer::install(), which is responsible for - * creating database tables, setting module variables and and calling module::set_version(). + * creating database tables, setting module variables and calling module::set_version(). * Note that after installing, the module must be activated before it is available for use. * @param string $module_name */ @@ -131,6 +131,38 @@ class module_Core { } /** + * Upgrade a module. This will call <module>_installer::upgrade(), which is responsible for + * modifying database tables, changing module variables and calling module::set_version(). + * Note that after upgrading, the module must be activated before it is available for use. + * @param string $module_name + */ + static function upgrade($module_name) { + $kohana_modules = Kohana::config("core.modules"); + array_unshift($kohana_modules, MODPATH . $module_name); + Kohana::config_set("core.modules", $kohana_modules); + + $version_before = module::get_version($module_name); + $installer_class = "{$module_name}_installer"; + if (method_exists($installer_class, "upgrade")) { + call_user_func_array(array($installer_class, "upgrade"), array($version_before)); + } + module::load_modules(); + + // Now the module is upgraded but inactive, so don't leave it in the active path + array_shift($kohana_modules); + Kohana::config_set("core.modules", $kohana_modules); + + $version_after = module::get_version($module_name); + if ($version_before != $version_after) { + log::success( + "module", t("Upgraded module %module_name from %version_before to %version_after", + array("module_name" => $module_name, + "version_before" => $version_before, + "version_after" => $version_after))); + } + } + + /** * Activate an installed module. This will call <module>_installer::activate() which should take * any steps to make sure that the module is ready for use. This will also activate any * existing graphics rules for this module. diff --git a/modules/gallery/helpers/theme.php b/modules/gallery/helpers/theme.php index 0a43f25c..b46a2c14 100644 --- a/modules/gallery/helpers/theme.php +++ b/modules/gallery/helpers/theme.php @@ -55,6 +55,8 @@ class theme_Core { ->value(module::get_var("gallery", "header_text")); $group->textarea("footer_text")->label(t("Footer text"))->id("gFooterText") ->value(module::get_var("gallery", "footer_text")); + $group->checkbox("show_credits")->label(t("Show site credits"))->id("gFooterText") + ->checked(module::get_var("gallery", "show_credits")); $group->submit("")->value(t("Save")); return $form; } diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index 7dce9e51..430119b5 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -378,14 +378,41 @@ class Item_Model extends ORM_MPTT { * the first child in the album is at position 1. */ public function get_position($child_id) { - $result = Database::instance()->query(" + if ($this->sort_order == "DESC") { + $comp = ">"; + } else { + $comp = "<"; + } + + $db = Database::instance(); + $position = $db->query(" SELECT COUNT(*) AS position FROM {items} - WHERE parent_id = {$this->id} - AND {$this->sort_column} <= (SELECT {$this->sort_column} - FROM {items} WHERE id = $child_id) - ORDER BY {$this->sort_column} {$this->sort_order}"); + WHERE parent_id = {$this->id} + AND `{$this->sort_column}` $comp (SELECT `{$this->sort_column}` + FROM {items} WHERE id = $child_id) + ORDER BY `{$this->sort_column}` {$this->sort_order}")->current()->position; + + // We stopped short of our target value in the sort (notice that we're using a < comparator + // above) because it's possible that we have duplicate values in the sort column. An + // equality check would just arbitrarily pick one of those multiple possible equivalent + // columns, which would mean that if you choose a sort order that has duplicates, it'd pick + // any one of them as the child's "position". + // + // Fix this by doing a 2nd query where we iterate over the equivalent columns and add them to + // our base value. + $result = $db->query(" + SELECT id FROM {items} + WHERE parent_id = {$this->id} + AND `{$this->sort_column}` = (SELECT `{$this->sort_column}` + FROM {items} WHERE id = $child_id)"); + foreach ($result as $row) { + $position++; + if ($row->id == $child_id) { + break; + } + } - return $result->current()->position; + return $position; } /** diff --git a/modules/gallery/module.info b/modules/gallery/module.info index 3a5dd593..e5b1f809 100644 --- a/modules/gallery/module.info +++ b/modules/gallery/module.info @@ -1,3 +1,3 @@ name = Gallery 3 description = Gallery core application -version = 2 +version = 3 diff --git a/modules/gallery/tests/Gallery_Installer_Test.php b/modules/gallery/tests/Gallery_Installer_Test.php index 24d24b38..001b7d26 100644 --- a/modules/gallery/tests/Gallery_Installer_Test.php +++ b/modules/gallery/tests/Gallery_Installer_Test.php @@ -33,7 +33,7 @@ class Gallery_Installer_Test extends Unit_Test_Case { $this->assert_equal("gallery", $gallery->name); // This is probably too volatile to keep for long - $this->assert_equal(1, $gallery->version); + $this->assert_equal(2, $gallery->version); } public function install_creates_root_item_test() { diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt index f47ae0dc..6133b025 100644 --- a/modules/gallery/tests/xss_data.txt +++ b/modules/gallery/tests/xss_data.txt @@ -37,9 +37,26 @@ modules/comment/views/admin_comments.html.php 194 DIRTY $pager modules/comment/views/comment.html.php 2 DIRTY $comment->id modules/comment/views/comment.html.php 5 DIRTY $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) modules/comment/views/comment.html.php 7 $comment->author_name() -modules/comment/views/comment.html.php 11 DIRTY $comment->created -modules/comment/views/comment.html.php 12 $comment->author_name() -modules/comment/views/comment.html.php 15 $comment->text +modules/comment/views/comment.html.php 12 DIRTY $comment->created +modules/comment/views/comment.html.php 13 $comment->author_name() +modules/comment/views/comment.html.php 16 $comment->text +modules/comment/views/comment.mrss.php 9 $feed->title +modules/comment/views/comment.mrss.php 10 DIRTY $feed->uri +modules/comment/views/comment.mrss.php 11 $feed->description +modules/comment/views/comment.mrss.php 13 DIRTY $feed->uri +modules/comment/views/comment.mrss.php 16 DIRTY $feed->previous_page_uri +modules/comment/views/comment.mrss.php 19 DIRTY $feed->next_page_uri +modules/comment/views/comment.mrss.php 21 DIRTY $pub_date +modules/comment/views/comment.mrss.php 22 DIRTY $pub_date +modules/comment/views/comment.mrss.php 25 $child->title +modules/comment/views/comment.mrss.php 26 $child->item_uri +modules/comment/views/comment.mrss.php 27 $child->author +modules/comment/views/comment.mrss.php 28 DIRTY $child->item_uri +modules/comment/views/comment.mrss.php 29 DIRTY $child->pub_date +modules/comment/views/comment.mrss.php 32 $child->text +modules/comment/views/comment.mrss.php 34 DIRTY $child->thumb_url +modules/comment/views/comment.mrss.php 35 DIRTY $child->thumb_height +modules/comment/views/comment.mrss.php 35 DIRTY $child->thumb_width modules/comment/views/comments.html.php 10 DIRTY $comment->id modules/comment/views/comments.html.php 13 DIRTY $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) modules/comment/views/comments.html.php 15 $comment->author_name() @@ -55,18 +72,19 @@ modules/exif/views/exif_dialog.html.php 21 DIRTY $i modules/exif/views/exif_dialog.html.php 24 $details modules/exif/views/exif_dialog.html.php 24 $i modules/exif/views/exif_sidebar.html.php 2 DIRTY $item->id -modules/g2_import/views/admin_g2_import.html.php 8 DIRTY $form -modules/g2_import/views/admin_g2_import.html.php 26 DIRTY $g2_stats -modules/g2_import/views/admin_g2_import.html.php 29 DIRTY $g2_stats -modules/g2_import/views/admin_g2_import.html.php 32 DIRTY $g2_stats -modules/g2_import/views/admin_g2_import.html.php 35 DIRTY $g2_stats -modules/g2_import/views/admin_g2_import.html.php 38 DIRTY $g2_stats -modules/g2_import/views/admin_g2_import.html.php 41 DIRTY $g2_stats -modules/g2_import/views/admin_g2_import.html.php 45 DIRTY $g2_stats -modules/g2_import/views/admin_g2_import.html.php 53 DIRTY $g2_sizes -modules/g2_import/views/admin_g2_import.html.php 54 DIRTY $thumb_size -modules/g2_import/views/admin_g2_import.html.php 62 DIRTY $g2_sizes -modules/g2_import/views/admin_g2_import.html.php 63 DIRTY $resize_size +modules/g2_import/views/admin_g2_import.html.php 28 DIRTY $form +modules/g2_import/views/admin_g2_import.html.php 40 DIRTY $g2_sizes +modules/g2_import/views/admin_g2_import.html.php 41 DIRTY $thumb_size +modules/g2_import/views/admin_g2_import.html.php 49 DIRTY $g2_sizes +modules/g2_import/views/admin_g2_import.html.php 50 DIRTY $resize_size +modules/g2_import/views/admin_g2_import.html.php 62 DIRTY $g2_stats +modules/g2_import/views/admin_g2_import.html.php 65 DIRTY $g2_stats +modules/g2_import/views/admin_g2_import.html.php 68 DIRTY $g2_stats +modules/g2_import/views/admin_g2_import.html.php 71 DIRTY $g2_stats +modules/g2_import/views/admin_g2_import.html.php 74 DIRTY $g2_stats +modules/g2_import/views/admin_g2_import.html.php 77 DIRTY $g2_stats +modules/g2_import/views/admin_g2_import.html.php 81 DIRTY $g2_stats +modules/g2_import/views/admin_g2_import.html.php 88 DIRTY $csrf modules/gallery/views/admin_advanced_settings.html.php 22 DIRTY $var->module_name modules/gallery/views/admin_advanced_settings.html.php 23 $var->name modules/gallery/views/admin_advanced_settings.html.php 25 DIRTY $var->module_name @@ -140,13 +158,14 @@ modules/gallery/views/admin_maintenance.html.php 171 DIRTY $task->id modules/gallery/views/admin_maintenance.html.php 171 DIRTY $csrf modules/gallery/views/admin_maintenance_task.html.php 5 DIRTY $task->id modules/gallery/views/admin_maintenance_task.html.php 5 DIRTY $csrf +modules/gallery/views/admin_maintenance_task.html.php 26 DIRTY $task->name modules/gallery/views/admin_modules.html.php 19 DIRTY $i modules/gallery/views/admin_modules.html.php 22 DIRTY $data modules/gallery/views/admin_modules.html.php 22 DIRTY $module_name modules/gallery/views/admin_modules.html.php 23 DIRTY $module_info->name modules/gallery/views/admin_modules.html.php 24 DIRTY $module_info->version modules/gallery/views/admin_modules.html.php 25 DIRTY $module_info->description -modules/gallery/views/admin_theme_details.html.php 5 DIRTY $form +modules/gallery/views/admin_theme_options.html.php 5 DIRTY $form modules/gallery/views/admin_themes.html.php 5 DIRTY $csrf modules/gallery/views/admin_themes.html.php 18 DIRTY $site modules/gallery/views/admin_themes.html.php 19 DIRTY $themes @@ -187,13 +206,13 @@ modules/gallery/views/kohana_error_page.php 100 DIRTY $line modules/gallery/views/kohana_error_page.php 112 DIRTY $trace modules/gallery/views/kohana_profiler.php 32 DIRTY $profile->render() modules/gallery/views/kohana_profiler.php 34 DIRTY $execution_time -modules/gallery/views/l10n_client.html.php 13 DIRTY $string -modules/gallery/views/l10n_client.html.php 15 DIRTY $string -modules/gallery/views/l10n_client.html.php 16 DIRTY $string -modules/gallery/views/l10n_client.html.php 18 DIRTY $string -modules/gallery/views/l10n_client.html.php 24 DIRTY $l10n_search_form -modules/gallery/views/l10n_client.html.php 65 DIRTY $string_list -modules/gallery/views/l10n_client.html.php 66 DIRTY $plural_forms +modules/gallery/views/l10n_client.html.php 17 DIRTY $string +modules/gallery/views/l10n_client.html.php 19 DIRTY $string +modules/gallery/views/l10n_client.html.php 20 DIRTY $string +modules/gallery/views/l10n_client.html.php 22 DIRTY $string +modules/gallery/views/l10n_client.html.php 28 DIRTY $l10n_search_form +modules/gallery/views/l10n_client.html.php 70 DIRTY $string_list +modules/gallery/views/l10n_client.html.php 71 DIRTY $plural_forms modules/gallery/views/move_browse.html.php 4 DIRTY $source->id modules/gallery/views/move_browse.html.php 39 DIRTY $tree modules/gallery/views/move_browse.html.php 42 DIRTY $source->id @@ -244,48 +263,29 @@ modules/gallery/views/permissions_form.html.php 74 DIRTY $item->id modules/gallery/views/permissions_form.html.php 79 DIRTY $group->id modules/gallery/views/permissions_form.html.php 79 DIRTY $permission->id modules/gallery/views/permissions_form.html.php 79 DIRTY $item->id -modules/gallery/views/quick_pane.html.php 9 DIRTY $item->id -modules/gallery/views/quick_pane.html.php 9 DIRTY $page_type -modules/gallery/views/quick_pane.html.php 10 DIRTY $title -modules/gallery/views/quick_pane.html.php 12 DIRTY $title -modules/gallery/views/quick_pane.html.php 17 DIRTY $item->id -modules/gallery/views/quick_pane.html.php 17 DIRTY $csrf -modules/gallery/views/quick_pane.html.php 17 DIRTY $page_type -modules/gallery/views/quick_pane.html.php 24 DIRTY $item->id -modules/gallery/views/quick_pane.html.php 24 DIRTY $csrf -modules/gallery/views/quick_pane.html.php 24 DIRTY $page_type -modules/gallery/views/quick_pane.html.php 41 DIRTY $item->id -modules/gallery/views/quick_pane.html.php 42 DIRTY $title -modules/gallery/views/quick_pane.html.php 44 DIRTY $title -modules/gallery/views/quick_pane.html.php 61 DIRTY $disabledState -modules/gallery/views/quick_pane.html.php 61 DIRTY $item->id -modules/gallery/views/quick_pane.html.php 61 DIRTY $csrf -modules/gallery/views/quick_pane.html.php 61 DIRTY $page_type -modules/gallery/views/quick_pane.html.php 62 DIRTY $title -modules/gallery/views/quick_pane.html.php 64 DIRTY $title -modules/gallery/views/quick_pane.html.php 78 DIRTY $item->id -modules/gallery/views/quick_pane.html.php 78 DIRTY $csrf -modules/gallery/views/quick_pane.html.php 78 DIRTY $page_type -modules/gallery/views/quick_pane.html.php 78 DIRTY $message -modules/gallery/views/quick_pane.html.php 78 DIRTY $title -modules/gallery/views/quick_pane.html.php 80 DIRTY $title -modules/gallery/views/quick_pane.html.php 93 DIRTY $item->id -modules/gallery/views/quick_pane.html.php 98 DIRTY $item->id -modules/gallery/views/quick_pane.html.php 103 DIRTY $item->id +modules/gallery/views/quick_pane.html.php 3 DIRTY $button->class +modules/gallery/views/quick_pane.html.php 3 DIRTY $button->href +modules/gallery/views/quick_pane.html.php 4 DIRTY $button->title +modules/gallery/views/quick_pane.html.php 5 DIRTY $button->icon +modules/gallery/views/quick_pane.html.php 6 DIRTY $button->title +modules/gallery/views/quick_pane.html.php 20 DIRTY $button->class +modules/gallery/views/quick_pane.html.php 20 DIRTY $button->href +modules/gallery/views/quick_pane.html.php 21 DIRTY $button->title +modules/gallery/views/quick_pane.html.php 22 DIRTY $button->title modules/gallery/views/simple_uploader.html.php 6 DIRTY $csrf modules/gallery/views/simple_uploader.html.php 8 $item->title modules/gallery/views/simple_uploader.html.php 28 $parent->title modules/gallery/views/simple_uploader.html.php 30 $item->title modules/gallery/views/simple_uploader.html.php 77 DIRTY $item->id modules/gallery/views/simple_uploader.html.php 81 DIRTY $csrf -modules/gallery/views/upgrader.html.php 94 DIRTY $done -modules/gallery/views/upgrader.html.php 124 DIRTY $module->version -modules/gallery/views/upgrader.html.php 124 DIRTY $module->code_version -modules/gallery/views/upgrader.html.php 125 DIRTY $id -modules/gallery/views/upgrader.html.php 126 DIRTY $module->name -modules/gallery/views/upgrader.html.php 129 DIRTY $module->version -modules/gallery/views/upgrader.html.php 132 DIRTY $module->code_version -modules/gallery/views/upgrader.html.php 155 DIRTY $module->name +modules/gallery/views/upgrader.html.php 43 DIRTY $module->version +modules/gallery/views/upgrader.html.php 43 DIRTY $module->code_version +modules/gallery/views/upgrader.html.php 44 DIRTY $id +modules/gallery/views/upgrader.html.php 45 DIRTY $module->name +modules/gallery/views/upgrader.html.php 48 DIRTY $module->version +modules/gallery/views/upgrader.html.php 51 DIRTY $module->code_version +modules/gallery/views/upgrader.html.php 74 DIRTY $module->name +modules/gallery/views/upgrader.html.php 83 DIRTY $upgrade_token modules/image_block/views/image_block_block.html.php 3 DIRTY $item->url() modules/image_block/views/image_block_block.html.php 4 DIRTY $item->thumb_img(array("class" => "gThumbnail")) modules/info/views/info_block.html.php 6 $item->title @@ -354,29 +354,12 @@ modules/recaptcha/views/admin_recaptcha.html.php 6 DIRTY $form->ge modules/recaptcha/views/admin_recaptcha.html.php 10 DIRTY $form modules/recaptcha/views/admin_recaptcha.html.php 23 DIRTY $public_key modules/recaptcha/views/form_recaptcha.html.php 7 DIRTY $public_key -modules/rss/views/comment.mrss.php 9 $title -modules/rss/views/comment.mrss.php 10 DIRTY $link -modules/rss/views/comment.mrss.php 11 $description -modules/rss/views/comment.mrss.php 13 DIRTY $feed_link -modules/rss/views/comment.mrss.php 16 DIRTY $previous_page_link -modules/rss/views/comment.mrss.php 19 DIRTY $next_page_link -modules/rss/views/comment.mrss.php 21 DIRTY $pub_date -modules/rss/views/comment.mrss.php 22 DIRTY $pub_date -modules/rss/views/comment.mrss.php 25 $child -modules/rss/views/comment.mrss.php 26 $child -modules/rss/views/comment.mrss.php 27 $child -modules/rss/views/comment.mrss.php 28 DIRTY $child -modules/rss/views/comment.mrss.php 29 DIRTY $child -modules/rss/views/comment.mrss.php 32 $child -modules/rss/views/comment.mrss.php 34 DIRTY $child -modules/rss/views/comment.mrss.php 35 DIRTY $child -modules/rss/views/comment.mrss.php 35 DIRTY $child -modules/rss/views/feed.mrss.php 9 $title -modules/rss/views/feed.mrss.php 10 DIRTY $link -modules/rss/views/feed.mrss.php 11 $description -modules/rss/views/feed.mrss.php 13 DIRTY $feed_link -modules/rss/views/feed.mrss.php 16 DIRTY $previous_page_link -modules/rss/views/feed.mrss.php 19 DIRTY $next_page_link +modules/rss/views/feed.mrss.php 9 $feed->title +modules/rss/views/feed.mrss.php 10 DIRTY $feed->uri +modules/rss/views/feed.mrss.php 11 $feed->description +modules/rss/views/feed.mrss.php 13 DIRTY $feed->uri +modules/rss/views/feed.mrss.php 16 DIRTY $feed->previous_page_uri +modules/rss/views/feed.mrss.php 19 DIRTY $feed->next_page_uri modules/rss/views/feed.mrss.php 21 DIRTY $pub_date modules/rss/views/feed.mrss.php 22 DIRTY $pub_date modules/rss/views/feed.mrss.php 25 $child->title @@ -519,14 +502,14 @@ themes/admin_default/views/block.html.php 5 DIRTY $id themes/admin_default/views/block.html.php 5 DIRTY $csrf themes/admin_default/views/block.html.php 10 DIRTY $title themes/admin_default/views/block.html.php 13 DIRTY $content -themes/admin_default/views/pager.html.php 9 DIRTY $from_to_msg themes/admin_default/views/pager.html.php 11 DIRTY $url -themes/admin_default/views/pager.html.php 16 DIRTY $previous_page -themes/admin_default/views/pager.html.php 16 DIRTY $url -themes/admin_default/views/pager.html.php 21 DIRTY $next_page -themes/admin_default/views/pager.html.php 21 DIRTY $url -themes/admin_default/views/pager.html.php 26 DIRTY $last_page -themes/admin_default/views/pager.html.php 26 DIRTY $url +themes/admin_default/views/pager.html.php 18 DIRTY $previous_page +themes/admin_default/views/pager.html.php 18 DIRTY $url +themes/admin_default/views/pager.html.php 25 DIRTY $from_to_msg +themes/admin_default/views/pager.html.php 28 DIRTY $next_page +themes/admin_default/views/pager.html.php 28 DIRTY $url +themes/admin_default/views/pager.html.php 35 DIRTY $last_page +themes/admin_default/views/pager.html.php 35 DIRTY $url themes/default/views/album.html.php 4 DIRTY $theme->album_top() themes/default/views/album.html.php 5 $item->title themes/default/views/album.html.php 6 $item->description @@ -584,29 +567,29 @@ themes/default/views/movie.html.php 18 DIRTY $item->he themes/default/views/movie.html.php 21 DIRTY $item->id themes/default/views/movie.html.php 35 $item->title themes/default/views/movie.html.php 36 $item->description -themes/default/views/movie.html.php 39 DIRTY $theme->photo_bottom() -themes/default/views/page.html.php 11 $item->title -themes/default/views/page.html.php 14 DIRTY $page_title -themes/default/views/page.html.php 16 DIRTY $theme->page_type -themes/default/views/page.html.php 18 DIRTY $theme->url("images/favicon.ico") -themes/default/views/page.html.php 25 DIRTY $theme->url("css/screen.css") -themes/default/views/page.html.php 28 DIRTY $theme->url("css/fix-ie.css") -themes/default/views/page.html.php 37 DIRTY $new_width -themes/default/views/page.html.php 38 DIRTY $new_height -themes/default/views/page.html.php 39 DIRTY $thumb_proportion -themes/default/views/page.html.php 51 DIRTY $theme->url("js/jquery.scrollTo.js") -themes/default/views/page.html.php 52 DIRTY $theme->url("js/jquery.localscroll.js") -themes/default/views/page.html.php 53 DIRTY $theme->url("js/ui.init.js") -themes/default/views/page.html.php 54 DIRTY $theme->head() -themes/default/views/page.html.php 57 DIRTY $theme->body_attributes() -themes/default/views/page.html.php 58 DIRTY $theme->page_top() -themes/default/views/page.html.php 60 DIRTY $theme->site_status() -themes/default/views/page.html.php 62 DIRTY $theme->display("header.html") -themes/default/views/page.html.php 68 DIRTY $theme->messages() -themes/default/views/page.html.php 69 DIRTY $content -themes/default/views/page.html.php 74 DIRTY $theme->display("sidebar.html") -themes/default/views/page.html.php 78 DIRTY $theme->display("footer.html") -themes/default/views/page.html.php 81 DIRTY $theme->page_bottom() +themes/default/views/movie.html.php 42 DIRTY $theme->photo_bottom() +themes/default/views/page.html.php 9 DIRTY $page_title +themes/default/views/page.html.php 13 $theme->item()->title +themes/default/views/page.html.php 15 $theme->item()->title +themes/default/views/page.html.php 17 $theme->item()->title +themes/default/views/page.html.php 20 $theme->tag()->name +themes/default/views/page.html.php 26 DIRTY $theme->url("images/favicon.ico") +themes/default/views/page.html.php 33 DIRTY $theme->url("css/screen.css") +themes/default/views/page.html.php 36 DIRTY $theme->url("css/fix-ie.css") +themes/default/views/page.html.php 45 DIRTY $new_width +themes/default/views/page.html.php 46 DIRTY $new_height +themes/default/views/page.html.php 47 DIRTY $thumb_proportion +themes/default/views/page.html.php 63 DIRTY $theme->url("js/ui.init.js") +themes/default/views/page.html.php 64 DIRTY $theme->head() +themes/default/views/page.html.php 67 DIRTY $theme->body_attributes() +themes/default/views/page.html.php 68 DIRTY $theme->page_top() +themes/default/views/page.html.php 70 DIRTY $theme->site_status() +themes/default/views/page.html.php 72 DIRTY $theme->display("header.html") +themes/default/views/page.html.php 78 DIRTY $theme->messages() +themes/default/views/page.html.php 79 DIRTY $content +themes/default/views/page.html.php 85 DIRTY $theme->display("sidebar.html") +themes/default/views/page.html.php 90 DIRTY $theme->display("footer.html") +themes/default/views/page.html.php 93 DIRTY $theme->page_bottom() themes/default/views/pager.html.php 11 DIRTY $url themes/default/views/pager.html.php 18 DIRTY $previous_page themes/default/views/pager.html.php 18 DIRTY $url @@ -615,19 +598,24 @@ themes/default/views/pager.html.php 28 DIRTY $next_pag themes/default/views/pager.html.php 28 DIRTY $url themes/default/views/pager.html.php 35 DIRTY $last_page themes/default/views/pager.html.php 35 DIRTY $url -themes/default/views/photo.html.php 3 DIRTY $theme->photo_top() -themes/default/views/photo.html.php 8 DIRTY $previous_item->url() -themes/default/views/photo.html.php 15 DIRTY $position -themes/default/views/photo.html.php 15 DIRTY $sibling_count -themes/default/views/photo.html.php 18 DIRTY $next_item->url() -themes/default/views/photo.html.php 28 DIRTY $theme->resize_top($item) -themes/default/views/photo.html.php 32 DIRTY $item->resize_img(array("id" => "gPhotoId-{$item->id}", "class" => "gResize")) -themes/default/views/photo.html.php 36 DIRTY $theme->resize_bottom($item) -themes/default/views/photo.html.php 40 $item->title -themes/default/views/photo.html.php 41 $item->description -themes/default/views/photo.html.php 47 DIRTY $theme->photo_bottom() +themes/default/views/photo.html.php 9 DIRTY $theme->item()->file_url() +themes/default/views/photo.html.php 9 DIRTY $theme->item()->width +themes/default/views/photo.html.php 9 DIRTY $theme->item()->height +themes/default/views/photo.html.php 17 DIRTY $theme->photo_top() +themes/default/views/photo.html.php 22 DIRTY $previous_item->url() +themes/default/views/photo.html.php 29 DIRTY $position +themes/default/views/photo.html.php 29 DIRTY $sibling_count +themes/default/views/photo.html.php 32 DIRTY $next_item->url() +themes/default/views/photo.html.php 42 DIRTY $theme->resize_top($item) +themes/default/views/photo.html.php 44 DIRTY $item->file_url() +themes/default/views/photo.html.php 46 DIRTY $item->resize_img(array("id" => "gPhotoId-{$item->id}", "class" => "gResize")) +themes/default/views/photo.html.php 50 DIRTY $theme->resize_bottom($item) +themes/default/views/photo.html.php 54 $item->title +themes/default/views/photo.html.php 55 $item->description +themes/default/views/photo.html.php 61 DIRTY $theme->photo_bottom() themes/default/views/sidebar.html.php 2 DIRTY $theme->sidebar_top() themes/default/views/sidebar.html.php 6 DIRTY $theme->album_menu() themes/default/views/sidebar.html.php 8 DIRTY $theme->photo_menu() -themes/default/views/sidebar.html.php 13 DIRTY $theme->sidebar_blocks() -themes/default/views/sidebar.html.php 14 DIRTY $theme->sidebar_bottom() +themes/default/views/sidebar.html.php 10 DIRTY $theme->tag_menu() +themes/default/views/sidebar.html.php 15 DIRTY $theme->sidebar_blocks() +themes/default/views/sidebar.html.php 16 DIRTY $theme->sidebar_bottom() diff --git a/modules/image_block/helpers/image_block_installer.php b/modules/image_block/helpers/image_block_installer.php index 57279d05..7ea6a229 100644 --- a/modules/image_block/helpers/image_block_installer.php +++ b/modules/image_block/helpers/image_block_installer.php @@ -19,8 +19,6 @@ */ class image_block_installer { static function install() { - if (module::get_version("image_block") == 0) { - module::set_version("image_block", 1); - } + module::set_version("image_block", 1); } } diff --git a/modules/info/helpers/info_installer.php b/modules/info/helpers/info_installer.php index 94fc22d0..e3e78b90 100644 --- a/modules/info/helpers/info_installer.php +++ b/modules/info/helpers/info_installer.php @@ -19,9 +19,6 @@ */ class info_installer { static function install() { - $version = module::get_version("info"); - if ($version == 0) { - module::set_version("info", 1); - } + module::set_version("info", 1); } } diff --git a/modules/notification/helpers/notification_installer.php b/modules/notification/helpers/notification_installer.php index ad10184b..3d450258 100644 --- a/modules/notification/helpers/notification_installer.php +++ b/modules/notification/helpers/notification_installer.php @@ -20,27 +20,23 @@ class notification_installer { static function install() { $db = Database::instance(); - $version = module::get_version("notification"); + $db->query("CREATE TABLE IF NOT EXISTS {subscriptions} ( + `id` int(9) NOT NULL auto_increment, + `item_id` int(9) NOT NULL, + `user_id` int(9) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY (`item_id`, `user_id`), + UNIQUE KEY (`user_id`, `item_id`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + $db->query("CREATE TABLE IF NOT EXISTS {pending_notifications} ( + `id` int(9) NOT NULL auto_increment, + `email` varchar(128) NOT NULL, + `subject` varchar(255) NOT NULL, + `text` text, + PRIMARY KEY (`id`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - if ($version == 0) { - $db->query("CREATE TABLE IF NOT EXISTS {subscriptions} ( - `id` int(9) NOT NULL auto_increment, - `item_id` int(9) NOT NULL, - `user_id` int(9) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY (`item_id`, `user_id`), - UNIQUE KEY (`user_id`, `item_id`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - $db->query("CREATE TABLE IF NOT EXISTS {pending_notifications} ( - `id` int(9) NOT NULL auto_increment, - `email` varchar(128) NOT NULL, - `subject` varchar(255) NOT NULL, - `text` text, - PRIMARY KEY (`id`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - - module::set_version("notification", 1); - } + module::set_version("notification", 1); } static function uninstall() { diff --git a/modules/organize/css/organize.css b/modules/organize/css/organize.css index 0fdf5aef..1e608beb 100644 --- a/modules/organize/css/organize.css +++ b/modules/organize/css/organize.css @@ -222,7 +222,7 @@ #gOrganizeEditForm { float: right; width: 79%; -// height: 100px; + // height: 100px; } #gOrganizeFormThumbs { diff --git a/modules/organize/helpers/organize_installer.php b/modules/organize/helpers/organize_installer.php index ea0f4e3d..22ca1793 100644 --- a/modules/organize/helpers/organize_installer.php +++ b/modules/organize/helpers/organize_installer.php @@ -19,9 +19,6 @@ */ class organize_installer { static function install() { - $version = module::get_version("organize"); - if ($version == 0) { - module::set_version("organize", 1); - } + module::set_version("organize", 1); } } diff --git a/modules/recaptcha/helpers/recaptcha_installer.php b/modules/recaptcha/helpers/recaptcha_installer.php index f74bf558..12044a1b 100644 --- a/modules/recaptcha/helpers/recaptcha_installer.php +++ b/modules/recaptcha/helpers/recaptcha_installer.php @@ -19,10 +19,7 @@ */ class recaptcha_installer { static function install() { - $version = module::get_version("recaptcha"); - if ($version == 0) { - module::set_version("recaptcha", 1); - } + module::set_version("recaptcha", 1); } static function activate() { diff --git a/modules/rss/helpers/rss_installer.php b/modules/rss/helpers/rss_installer.php index 2beafb33..7766fdfa 100644 --- a/modules/rss/helpers/rss_installer.php +++ b/modules/rss/helpers/rss_installer.php @@ -19,9 +19,6 @@ */ class rss_installer { static function install() { - $version = module::get_version("rss"); - if ($version == 0) { - module::set_version("rss", 1); - } + module::set_version("rss", 1); } } diff --git a/modules/search/helpers/search.php b/modules/search/helpers/search.php index 15efa3b2..ea8dad81 100644 --- a/modules/search/helpers/search.php +++ b/modules/search/helpers/search.php @@ -34,18 +34,18 @@ class search_Core { // Count the total number of rows. We can't do this with our regular query because of the // limit statement. It's possible that if we get rid of the limit (but keep the offset) on // the 2nd query and combine the two, it might be faster than making 2 separate queries. - $count_query = "SELECT COUNT(*) AS C " . + $count_query = "SELECT COUNT(*) AS c " . "FROM {items} JOIN {search_records} ON ({items}.`id` = {search_records}.`item_id`) " . "WHERE MATCH({search_records}.`data`) AGAINST ('$q' IN BOOLEAN MODE) " . $access_sql; - $count = $db->query($count_query)->current()->C; + $count = $db->query($count_query)->current()->c; $query = "SELECT {items}.*, MATCH({search_records}.`data`) AGAINST ('$q') AS `score` " . "FROM {items} JOIN {search_records} ON ({items}.`id` = {search_records}.`item_id`) " . "WHERE MATCH({search_records}.`data`) AGAINST ('$q' IN BOOLEAN MODE) " . $access_sql . "ORDER BY `score` DESC " . - "LIMIT $offset, $limit"; + "LIMIT $limit OFFSET $offset"; return array($count, new ORM_Iterator(ORM::factory("item"), $db->query($query))); } diff --git a/modules/search/helpers/search_installer.php b/modules/search/helpers/search_installer.php index ed4a3a90..cd253be4 100644 --- a/modules/search/helpers/search_installer.php +++ b/modules/search/helpers/search_installer.php @@ -19,20 +19,17 @@ */ class search_installer { static function install() { - $version = module::get_version("search"); $db = Database::instance(); - if ($version == 0) { - $db->query("CREATE TABLE {search_records} ( - `id` int(9) NOT NULL auto_increment, - `item_id` int(9), - `dirty` boolean default 1, - `data` LONGTEXT default NULL, - PRIMARY KEY (`id`), - KEY(`item_id`), - FULLTEXT INDEX (`data`)) - ENGINE=MyISAM DEFAULT CHARSET=utf8;"); - module::set_version("search", 1); - } + $db->query("CREATE TABLE {search_records} ( + `id` int(9) NOT NULL auto_increment, + `item_id` int(9), + `dirty` boolean default 1, + `data` LONGTEXT default NULL, + PRIMARY KEY (`id`), + KEY(`item_id`), + FULLTEXT INDEX (`data`)) + ENGINE=MyISAM DEFAULT CHARSET=utf8;"); + module::set_version("search", 1); } static function activate() { diff --git a/modules/server_add/helpers/server_add_installer.php b/modules/server_add/helpers/server_add_installer.php index f8773a2e..c9d92e69 100644 --- a/modules/server_add/helpers/server_add_installer.php +++ b/modules/server_add/helpers/server_add_installer.php @@ -19,11 +19,7 @@ */ class server_add_installer { static function install() { - $db = Database::instance(); - $version = module::get_version("server_add"); - if ($version == 0) { - module::set_version("server_add", 1); - } + module::set_version("server_add", 1); server_add::check_config(); } diff --git a/modules/slideshow/helpers/slideshow_installer.php b/modules/slideshow/helpers/slideshow_installer.php index b46f5471..cd1c6e05 100644 --- a/modules/slideshow/helpers/slideshow_installer.php +++ b/modules/slideshow/helpers/slideshow_installer.php @@ -19,10 +19,7 @@ */ class slideshow_installer { static function install() { - $version = module::get_version("slideshow"); - if ($version == 0) { - module::set_version("slideshow", 1); - } + module::set_version("slideshow", 1); } static function deactivate() { diff --git a/modules/tag/helpers/tag_installer.php b/modules/tag/helpers/tag_installer.php index 07544c54..3c16e3f3 100644 --- a/modules/tag/helpers/tag_installer.php +++ b/modules/tag/helpers/tag_installer.php @@ -20,26 +20,23 @@ class tag_installer { static function install() { $db = Database::instance(); - $version = module::get_version("tag"); - if ($version == 0) { - $db->query("CREATE TABLE IF NOT EXISTS {tags} ( - `id` int(9) NOT NULL auto_increment, - `name` varchar(64) NOT NULL, - `count` int(10) unsigned NOT NULL DEFAULT 0, - PRIMARY KEY (`id`), - UNIQUE KEY(`name`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + $db->query("CREATE TABLE IF NOT EXISTS {tags} ( + `id` int(9) NOT NULL auto_increment, + `name` varchar(64) NOT NULL, + `count` int(10) unsigned NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + UNIQUE KEY(`name`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - $db->query("CREATE TABLE IF NOT EXISTS {items_tags} ( - `id` int(9) NOT NULL auto_increment, - `item_id` int(9) NOT NULL, - `tag_id` int(9) NOT NULL, - PRIMARY KEY (`id`), - KEY(`tag_id`, `id`), - KEY(`item_id`, `id`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - module::set_version("tag", 1); - } + $db->query("CREATE TABLE IF NOT EXISTS {items_tags} ( + `id` int(9) NOT NULL auto_increment, + `item_id` int(9) NOT NULL, + `tag_id` int(9) NOT NULL, + PRIMARY KEY (`id`), + KEY(`tag_id`, `id`), + KEY(`item_id`, `id`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + module::set_version("tag", 1); } static function uninstall() { diff --git a/modules/user/helpers/user_installer.php b/modules/user/helpers/user_installer.php index 68868fc1..1959d038 100644 --- a/modules/user/helpers/user_installer.php +++ b/modules/user/helpers/user_installer.php @@ -20,70 +20,66 @@ class user_installer { static function install() { $db = Database::instance(); - $version = module::get_version("user"); + $db->query("CREATE TABLE IF NOT EXISTS {users} ( + `id` int(9) NOT NULL auto_increment, + `name` varchar(32) NOT NULL, + `full_name` varchar(255) NOT NULL, + `password` varchar(64) NOT NULL, + `login_count` int(10) unsigned NOT NULL DEFAULT 0, + `last_login` int(10) unsigned NOT NULL DEFAULT 0, + `email` varchar(64) default NULL, + `admin` BOOLEAN default 0, + `guest` BOOLEAN default 0, + `hash` char(32) default NULL, + `url` varchar(255) default NULL, + `locale` char(10) default NULL, + PRIMARY KEY (`id`), + UNIQUE KEY(`hash`), + UNIQUE KEY(`name`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - if ($version == 0) { - $db->query("CREATE TABLE IF NOT EXISTS {users} ( - `id` int(9) NOT NULL auto_increment, - `name` varchar(32) NOT NULL, - `full_name` varchar(255) NOT NULL, - `password` varchar(64) NOT NULL, - `login_count` int(10) unsigned NOT NULL DEFAULT 0, - `last_login` int(10) unsigned NOT NULL DEFAULT 0, - `email` varchar(64) default NULL, - `admin` BOOLEAN default 0, - `guest` BOOLEAN default 0, - `hash` char(32) default NULL, - `url` varchar(255) default NULL, - `locale` char(10) default NULL, - PRIMARY KEY (`id`), - UNIQUE KEY(`hash`), - UNIQUE KEY(`name`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + $db->query("CREATE TABLE IF NOT EXISTS {groups} ( + `id` int(9) NOT NULL auto_increment, + `name` char(64) default NULL, + `special` BOOLEAN default 0, + PRIMARY KEY (`id`), + UNIQUE KEY(`name`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - $db->query("CREATE TABLE IF NOT EXISTS {groups} ( - `id` int(9) NOT NULL auto_increment, - `name` char(64) default NULL, - `special` BOOLEAN default 0, - PRIMARY KEY (`id`), - UNIQUE KEY(`name`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + $db->query("CREATE TABLE IF NOT EXISTS {groups_users} ( + `group_id` int(9) NOT NULL, + `user_id` int(9) NOT NULL, + PRIMARY KEY (`group_id`, `user_id`), + UNIQUE KEY(`user_id`, `group_id`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - $db->query("CREATE TABLE IF NOT EXISTS {groups_users} ( - `group_id` int(9) NOT NULL, - `user_id` int(9) NOT NULL, - PRIMARY KEY (`group_id`, `user_id`), - UNIQUE KEY(`user_id`, `group_id`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + $everybody = group::create("Everybody"); + $everybody->special = true; + $everybody->save(); - $everybody = group::create("Everybody"); - $everybody->special = true; - $everybody->save(); + $registered = group::create("Registered Users"); + $registered->special = true; + $registered->save(); - $registered = group::create("Registered Users"); - $registered->special = true; - $registered->save(); + $guest = user::create("guest", "Guest User", ""); + $guest->guest = true; + $guest->remove($registered); + $guest->save(); - $guest = user::create("guest", "Guest User", ""); - $guest->guest = true; - $guest->remove($registered); - $guest->save(); + $admin = user::create("admin", "Gallery Administrator", "admin"); + $admin->admin = true; + $admin->save(); - $admin = user::create("admin", "Gallery Administrator", "admin"); - $admin->admin = true; - $admin->save(); + // Let the admin own everything + $db->update("items", array("owner_id" => $admin->id), array("owner_id" => "IS NULL")); + module::set_version("user", 1); - // Let the admin own everything - $db->update("items", array("owner_id" => $admin->id), array("owner_id" => "IS NULL")); - module::set_version("user", 1); + $root = ORM::factory("item", 1); + access::allow($everybody, "view", $root); + access::allow($everybody, "view_full", $root); - $root = ORM::factory("item", 1); - access::allow($everybody, "view", $root); - access::allow($everybody, "view_full", $root); - - access::allow($registered, "view", $root); - access::allow($registered, "view_full", $root); - } + access::allow($registered, "view", $root); + access::allow($registered, "view_full", $root); } static function uninstall() { diff --git a/modules/watermark/helpers/watermark_installer.php b/modules/watermark/helpers/watermark_installer.php index ed4265ec..705b89d4 100644 --- a/modules/watermark/helpers/watermark_installer.php +++ b/modules/watermark/helpers/watermark_installer.php @@ -20,23 +20,20 @@ class watermark_installer { static function install() { $db = Database::instance(); - $version = module::get_version("watermark"); - if ($version == 0) { - $db->query("CREATE TABLE IF NOT EXISTS {watermarks} ( - `id` int(9) NOT NULL auto_increment, - `name` varchar(32) NOT NULL, - `width` int(9) NOT NULL, - `height` int(9) NOT NULL, - `active` boolean default 0, - `position` boolean default 0, - `mime_type` varchar(64) default NULL, - PRIMARY KEY (`id`), - UNIQUE KEY(`name`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + $db->query("CREATE TABLE IF NOT EXISTS {watermarks} ( + `id` int(9) NOT NULL auto_increment, + `name` varchar(32) NOT NULL, + `width` int(9) NOT NULL, + `height` int(9) NOT NULL, + `active` boolean default 0, + `position` boolean default 0, + `mime_type` varchar(64) default NULL, + PRIMARY KEY (`id`), + UNIQUE KEY(`name`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - @mkdir(VARPATH . "modules/watermark"); - module::set_version("watermark", 1); - } + @mkdir(VARPATH . "modules/watermark"); + module::set_version("watermark", 1); } static function uninstall() { |