From a11bf295078656612603c1c561e9261555d0c40c Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sat, 9 Jan 2010 23:57:16 -0800 Subject: Fix for ticket #972 and more. In Kohana 2.4, ORM::delete_all ignores any where clauses and deletes all the entries in the table unless an array of id's are passed as the parameter. This fix used the Database_builder to specify any where conditions. Thanks psvo for find the first one. :-) --- modules/comment/controllers/admin_comments.php | 5 +++-- modules/gallery/helpers/graphics.php | 5 +++-- modules/gallery/tests/Gallery_I18n_Test.php | 5 +++-- modules/notification/helpers/notification_event.php | 5 +++-- modules/rest/helpers/rest_event.php | 5 +++-- modules/search/helpers/search_event.php | 5 +++-- modules/server_add/controllers/server_add.php | 5 ++++- 7 files changed, 22 insertions(+), 13 deletions(-) (limited to 'modules') diff --git a/modules/comment/controllers/admin_comments.php b/modules/comment/controllers/admin_comments.php index 880c33a7..b7dc5fb3 100644 --- a/modules/comment/controllers/admin_comments.php +++ b/modules/comment/controllers/admin_comments.php @@ -121,9 +121,10 @@ class Admin_Comments_Controller extends Admin_Controller { public function delete_all_spam() { access::verify_csrf(); - ORM::factory("comment") + db::build() + ->delete("comments") ->where("state", "=", "spam") - ->delete_all(); + ->execute(); url::redirect("admin/comments/queue/spam"); } } diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index 7577d7ac..5a290905 100644 --- a/modules/gallery/helpers/graphics.php +++ b/modules/gallery/helpers/graphics.php @@ -60,11 +60,12 @@ class graphics_Core { * @param string $operation the name of the operation(::method) */ static function remove_rule($module_name, $target, $operation) { - ORM::factory("graphics_rule") + db::build() + ->delete("graphics_rules") ->where("module_name", "=", $module_name) ->where("target", "=", $target) ->where("operation", "=", $operation) - ->delete_all(); + ->execute(); self::mark_dirty($target == "thumb", $target == "resize"); } diff --git a/modules/gallery/tests/Gallery_I18n_Test.php b/modules/gallery/tests/Gallery_I18n_Test.php index 895e3051..5d2fd994 100644 --- a/modules/gallery/tests/Gallery_I18n_Test.php +++ b/modules/gallery/tests/Gallery_I18n_Test.php @@ -28,9 +28,10 @@ class Gallery_I18n_Test extends Unit_Test_Case { 'locale_dir' => VARPATH . 'locale/'); $this->i18n = Gallery_I18n::instance($config); - ORM::factory("incoming_translation") + db::build() + ->delete("incoming_translations") ->where("locale", "=", "te_ST") - ->delete_all(); + ->execute(); $messages_te_ST = array( array('Hello world', 'Hallo Welt'), diff --git a/modules/notification/helpers/notification_event.php b/modules/notification/helpers/notification_event.php index 2c7ede27..bc1303f5 100644 --- a/modules/notification/helpers/notification_event.php +++ b/modules/notification/helpers/notification_event.php @@ -89,9 +89,10 @@ class notification_event_Core { static function user_before_delete($user) { try { - ORM::factory("subscription") + db::build() + ->delete("subscriptions") ->where("user_id", "=", $user->id) - ->delete_all(); + ->execute(); } catch (Exception $e) { Kohana_Log::add("error", "@todo notification_event::user_before_delete() failed"); Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString()); diff --git a/modules/rest/helpers/rest_event.php b/modules/rest/helpers/rest_event.php index 00cea7eb..860c8e41 100644 --- a/modules/rest/helpers/rest_event.php +++ b/modules/rest/helpers/rest_event.php @@ -23,9 +23,10 @@ class rest_event { * the user_homes directory. */ static function user_before_delete($user) { - ORM::factory("user_access_token") + db::build() + ->delete("user_access_tokens") ->where("id", "=", $user->id) - ->delete_all(); + ->execute(); } /** diff --git a/modules/search/helpers/search_event.php b/modules/search/helpers/search_event.php index 1add6e5f..97041f8c 100644 --- a/modules/search/helpers/search_event.php +++ b/modules/search/helpers/search_event.php @@ -27,9 +27,10 @@ class search_event_Core { } static function item_deleted($item) { - ORM::factory("search_record") + db::build() + ->delete("search_records") ->where("item_id", "=", $item->id) - ->delete_all(); + ->execute(); } static function item_related_update($item) { diff --git a/modules/server_add/controllers/server_add.php b/modules/server_add/controllers/server_add.php index f6e3a4dd..d7572b52 100644 --- a/modules/server_add/controllers/server_add.php +++ b/modules/server_add/controllers/server_add.php @@ -266,7 +266,10 @@ class Server_Add_Controller extends Admin_Controller { $task->done = true; $task->state = "success"; $task->percent_complete = 100; - ORM::factory("server_add_file")->where("task_id", "=", $task->id)->delete_all(); + db::build() + ->delete("server_add_files") + ->where("task_id", "=", $task->id) + ->execute(); message::info(t2("Successfully added one photo / album", "Successfully added %count photos / albums", $task->get("completed_files"))); -- cgit v1.2.3 From 3ab6c4915aa0c9dbd2061ffcad0af00e2c50136e Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Mon, 11 Jan 2010 10:42:39 -0800 Subject: Fixes ticket #671. In the graphics_rules table height and width set the maximum height and width values and should be equal. Initially, the height on the resize target rule was less than the height, which artificially constrained images in portrait mode. **Note"" this fix requires an upgrade to version 22. All the resizes will be flagged dirty. --- installer/install.sql | 2 +- modules/gallery/helpers/gallery_installer.php | 19 ++++++++++++++++++- modules/gallery/module.info | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/installer/install.sql b/installer/install.sql index 6e7c06a2..95a57d86 100644 --- a/installer/install.sql +++ b/installer/install.sql @@ -89,7 +89,7 @@ CREATE TABLE {graphics_rules} ( ) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; SET character_set_client = @saved_cs_client; INSERT INTO {graphics_rules} VALUES (1,1,'a:3:{s:5:\"width\";i:200;s:6:\"height\";i:200;s:6:\"master\";i:2;}','gallery','gallery_graphics::resize',100,'thumb'); -INSERT INTO {graphics_rules} VALUES (2,1,'a:3:{s:5:\"width\";i:640;s:6:\"height\";i:480;s:6:\"master\";i:2;}','gallery','gallery_graphics::resize',100,'resize'); +INSERT INTO {graphics_rules} VALUES (2,1,'a:3:{s:5:\"width\";i:640;s:6:\"height\";i:640;s:6:\"master\";i:2;}','gallery','gallery_graphics::resize',100,'resize'); DROP TABLE IF EXISTS {groups}; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index 410b6413..02ce1b18 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -240,7 +240,7 @@ class gallery_installer { 100); graphics::add_rule( "gallery", "resize", "gallery_graphics::resize", - array("width" => 640, "height" => 480, "master" => Image::AUTO), + array("width" => 640, "height" => 640, "master" => Image::AUTO), 100); // Instantiate default themes (site and admin) @@ -440,6 +440,23 @@ class gallery_installer { module::set_var("gallery", "simultaneous_upload_limit", 5); module::set_version("gallery", $version = 21); } + + // Update the graphics rules table so that the maximum height for resizes is 640 not 480. + // Fixes ticket #671 + if ( $version == 21) { + $resize_rule = ORM::factory("graphics_rule") + ->where("id", "=", "2") + ->find(); + // make sure it hasn't been changed already + $args = unserialize($resize_rule->args); + if ($args["height"] == 480 && $args["width"] == 640) { + $args["height"] = 640; + $resize_rule->args = serialize($args); + $resize_rule->save(); + graphics::mark_dirty(false, true); + } + module::set_version("gallery", $version = 22); + } } static function uninstall() { diff --git a/modules/gallery/module.info b/modules/gallery/module.info index b3366f7d..107d9a12 100644 --- a/modules/gallery/module.info +++ b/modules/gallery/module.info @@ -1,4 +1,4 @@ name = "Gallery 3" description = "Gallery core application" -version = 21 +version = 22 -- cgit v1.2.3 From 284e14d50e33fb6a1ef0ce00444f216fcdbeb904 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Mon, 11 Jan 2010 10:48:27 -0800 Subject: Remove the automatically marking the resizes dirty line as this could cause alot of pain to some installations --- modules/gallery/helpers/gallery_installer.php | 1 - 1 file changed, 1 deletion(-) (limited to 'modules') diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index 02ce1b18..1e0ad28c 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -453,7 +453,6 @@ class gallery_installer { $args["height"] = 640; $resize_rule->args = serialize($args); $resize_rule->save(); - graphics::mark_dirty(false, true); } module::set_version("gallery", $version = 22); } -- cgit v1.2.3 From 2b283f4d011a7a67f306e11e590b499242a0774b Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Mon, 11 Jan 2010 13:26:10 -0800 Subject: Remove the translation submit button from translation search form. Fixes ticket #975 --- modules/gallery/controllers/l10n_client.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/gallery/controllers/l10n_client.php b/modules/gallery/controllers/l10n_client.php index 71df1cf1..d22b6299 100644 --- a/modules/gallery/controllers/l10n_client.php +++ b/modules/gallery/controllers/l10n_client.php @@ -102,10 +102,9 @@ class L10n_Client_Controller extends Controller { } private static function _l10n_client_search_form() { - $form = new Forge("l10n_client/search", "", "post", array("id" => "g-l10n-search-form")); + $form = new Forge("#", "", "post", array("id" => "g-l10n-search-form")); $group = $form->group("l10n_search"); $group->input("l10n-search")->id("g-l10n-search"); - $group->submit("l10n-search-filter-clear")->value(t("X")); return $form; } -- cgit v1.2.3 From 3b26d87f3a8fdcf4dc0b86e2b2d72476356c411a Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Mon, 11 Jan 2010 14:22:16 -0800 Subject: Reformat the string list so that the search box does not get push off the end of the page. --- modules/gallery/css/l10n_client.css | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'modules') diff --git a/modules/gallery/css/l10n_client.css b/modules/gallery/css/l10n_client.css index 542da8e6..3771c049 100644 --- a/modules/gallery/css/l10n_client.css +++ b/modules/gallery/css/l10n_client.css @@ -86,7 +86,7 @@ } #l10n-client .string-list { - height:17em; + height: 16em; overflow:auto; list-style:none; list-style-image:none; margin:0em; padding:0em;} @@ -129,10 +129,9 @@ font-weight:bold;} #l10n-client #g-l10n-search-form { - background:#eee; - text-align:center; - height:2em; line-height:2em; - margin:0em; padding:.5em .5em; + background: #eee; + margin: 0em; + padding: .25em .25em; } #l10n-client #g-l10n-search-form .form-item, @@ -148,8 +147,14 @@ padding:0em; } -#l10n-client #g-l10n-search-form input.form-text { - width:80%; +#l10n-client #g-l10n-search-form fieldset { + margin-bottom: 0; + padding: .25em .25em; +} + + +#l10n-client #g-l10n-search-form input { + width: 96.75%; } #l10n-client #g-l10n-search-form #search-filter-clear { @@ -164,7 +169,9 @@ #l10n-client-string-editor .source { overflow:hidden; - width:50%; float:left;} + width:50%; + float:left; +} #l10n-client-string-editor .source .source-text { line-height:1.5em; @@ -178,10 +185,13 @@ #l10n-client-string-editor .translation { overflow:hidden; - width:49%; float:right;} + width:49%; + float: right; +} #g-l10n-client-save-form { - padding:0em;} + padding: 0em; +} #l10n-client form ul, #l10n-client form li, -- cgit v1.2.3 From 3dfac5884ff0661d680293f9888f9ab42e9ebd19 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Tue, 12 Jan 2010 08:31:28 -0800 Subject: Add a css id attribute to the i10n-edit-translation element. Fixes ticket #969. --- modules/gallery/views/l10n_client.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/gallery/views/l10n_client.html.php b/modules/gallery/views/l10n_client.html.php index 9d14bbb2..47a45e29 100644 --- a/modules/gallery/views/l10n_client.html.php +++ b/modules/gallery/views/l10n_client.html.php @@ -40,7 +40,7 @@
" id="g-l10n-client-save-form"> - +