diff options
Diffstat (limited to 'modules')
36 files changed, 282 insertions, 51 deletions
diff --git a/modules/akismet/module.info b/modules/akismet/module.info index b61ed107..63473468 100644 --- a/modules/akismet/module.info +++ b/modules/akismet/module.info @@ -1,3 +1,7 @@ name = "Akismet" description = "Filter comments through the Akismet web service to detect and eliminate spam (http://akismet.com). You'll need a WordPress.com API key to use it." version = 1 +author_name = "Gallery Team" +author_url = "http://codex.gallery2.org/Gallery:Team" +info_url = "http://codex.gallery2.org/Gallery3:Modules:akismet" +discuss_url = "http://gallery.menalto.com/forum_module_akismet" diff --git a/modules/comment/module.info b/modules/comment/module.info index e5aa454d..4e7df6f1 100644 --- a/modules/comment/module.info +++ b/modules/comment/module.info @@ -1,3 +1,7 @@ name = "Comments" description = "Allows users and guests to leave comments on photos and albums." version = 4 +author_name = "Gallery Team" +author_url = "http://codex.gallery2.org/Gallery:Team" +info_url = "http://codex.gallery2.org/Gallery3:Modules:comment" +discuss_url = "http://gallery.menalto.com/forum_module_comment" diff --git a/modules/digibug/module.info b/modules/digibug/module.info index be4e880a..781d5f01 100644 --- a/modules/digibug/module.info +++ b/modules/digibug/module.info @@ -1,3 +1,7 @@ name = "Digibug" description = "Digibug Photo Printing Module" version = 2 +author_name = "Gallery Team" +author_url = "http://codex.gallery2.org/Gallery:Team" +info_url = "http://codex.gallery2.org/Gallery3:Modules:digibug" +discuss_url = "http://gallery.menalto.com/forum_module_digibug" diff --git a/modules/exif/module.info b/modules/exif/module.info index c8ae688e..e266e20e 100644 --- a/modules/exif/module.info +++ b/modules/exif/module.info @@ -1,3 +1,7 @@ name = "Exif Data" description = "Extract Exif data and display it on photo pages." version = 1 +author_name = "Gallery Team" +author_url = "http://codex.gallery2.org/Gallery:Team" +info_url = "http://codex.gallery2.org/Gallery3:Modules:exif" +discuss_url = "http://gallery.menalto.com/forum_module_exif" diff --git a/modules/g2_import/module.info b/modules/g2_import/module.info index 977af251..30fb46d4 100644 --- a/modules/g2_import/module.info +++ b/modules/g2_import/module.info @@ -1,3 +1,7 @@ name = "Gallery2 Import" description = "Import your Gallery 2 content into Gallery 3" version = 2 +author_name = "Gallery Team" +author_url = "http://codex.gallery2.org/Gallery:Team" +info_url = "http://codex.gallery2.org/Gallery3:Modules:g2_import" +discuss_url = "http://gallery.menalto.com/forum_module_g2_import" diff --git a/modules/gallery/controllers/admin_modules.php b/modules/gallery/controllers/admin_modules.php index 787785ea..b712d14f 100644 --- a/modules/gallery/controllers/admin_modules.php +++ b/modules/gallery/controllers/admin_modules.php @@ -19,6 +19,9 @@ */ class Admin_Modules_Controller extends Admin_Controller { public function index() { + // If modules need upgrading, this will get recreated in module::available() + site_status::clear("upgrade_now"); + $view = new Admin_View("admin.html"); $view->page_title = t("Modules"); $view->content = new View("admin_modules.html"); @@ -103,9 +106,6 @@ class Admin_Modules_Controller extends Admin_Controller { module::event("module_change", $changes); - // If modules need upgrading, this will get recreated - site_status::clear("upgrade_now"); - // @todo this type of collation is questionable from an i18n perspective if ($activated_names) { message::success(t("Activated: %names", array("names" => join(", ", $activated_names)))); diff --git a/modules/gallery/css/gallery.css b/modules/gallery/css/gallery.css index 97d09454..ecf89565 100644 --- a/modules/gallery/css/gallery.css +++ b/modules/gallery/css/gallery.css @@ -29,12 +29,12 @@ #g-add-photos-canvas object, #g-add-photos-button { - left: 93px; + left: 90px; margin: .5em 0; padding: .4em 1em; position: absolute; top: 0; - width: auto; + width: 300px; } #g-add-photos-canvas object { diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index 83c5ed71..7a9af402 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -311,9 +311,9 @@ class gallery_installer { module::set_var("gallery", "email_header_separator", serialize("\n")); module::set_var("gallery", "show_user_profiles_to", "registered_users"); module::set_var("gallery", "extra_binary_paths", "/usr/local/bin:/opt/local/bin:/opt/bin"); - module::set_var("gallery", "timezone", Kohana::config("locale.timezone")); + module::set_var("gallery", "timezone", null); - module::set_version("gallery", 48); + module::set_version("gallery", 49); } static function upgrade($version) { @@ -685,11 +685,12 @@ class gallery_installer { module::set_version("gallery", $version = 47); } - if ($version == 47) { + if ($version == 47 || $version == 48) { // Add configuration variable to set timezone. Defaults to the currently - // used timezone (from PHP configuration). - module::set_var("gallery", "timezone", Kohana::config("locale.timezone")); - module::set_version("gallery", $version = 48); + // used timezone (from PHP configuration). Note that in v48 we werew + // setting this value incorrectly, so we're going to stomp this value for v49. + module::set_var("gallery", "timezone", null); + module::set_version("gallery", $version = 49); } } diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index 8d8853b0..acb11bfb 100644 --- a/modules/gallery/helpers/graphics.php +++ b/modules/gallery/helpers/graphics.php @@ -316,10 +316,10 @@ class graphics_Core { // ImageMagick & GraphicsMagick $magick_kits = array( "imagemagick" => array( - "name" => "ImageMagick", "binary" => "convert", "version" => "convert -version", + "name" => "ImageMagick", "binary" => "convert", "version_arg" => "-v", "version_regex" => "/Version: \S+ (\S+)/"), "graphicsmagick" => array( - "name" => "GraphicsMagick", "binary" => "gm", "version" => "gm version", + "name" => "GraphicsMagick", "binary" => "gm", "version_arg" => "version", "version_regex" => "/\S+ (\S+)/")); // Loop through the kits foreach ($magick_kits as $index => $settings) { @@ -328,7 +328,8 @@ class graphics_Core { $toolkits->$index->name = $settings["name"]; if ($path) { if (@is_file($path) && - preg_match($settings["version_regex"], shell_exec($settings["version"]), $matches)) { + preg_match( + $settings["version_regex"], shell_exec($path . " " . $settings["version_arg"]), $matches)) { $version = $matches[1]; $toolkits->$index->installed = true; diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php index 37f7f68a..4b7d4a5f 100644 --- a/modules/gallery/helpers/module.php +++ b/modules/gallery/helpers/module.php @@ -101,7 +101,7 @@ class module_Core { $m->locked = false; if ($m->active && $m->version != $m->code_version) { - site_status::warning(t("Some of your modules are out of date. <a href=\"%upgrader_url\">Upgrade now!</a>", array("upgrader_url" => url::site("upgrader"))), "upgrade_now"); + site_status::warning(t("Some of your modules are out of date. <a href=\"%upgrader_url\">Upgrade now!</a>", array("upgrader_url" => url::abs_site("upgrader"))), "upgrade_now"); } } diff --git a/modules/gallery/libraries/InPlaceEdit.php b/modules/gallery/libraries/InPlaceEdit.php index 88c30494..739cbb61 100644 --- a/modules/gallery/libraries/InPlaceEdit.php +++ b/modules/gallery/libraries/InPlaceEdit.php @@ -56,8 +56,12 @@ class InPlaceEdit_Core { } public function validate() { - $post = Validation::factory($_POST) - ->add_callbacks("input", $this->callback); + $post = Validation::factory($_POST); + + if (!empty($this->callback)) { + $post->add_callbacks("input", $this->callback); + } + foreach ($this->rules as $rule) { $post->add_rules("input", $rule); } diff --git a/modules/gallery/module.info b/modules/gallery/module.info index 807d08fd..42345531 100644 --- a/modules/gallery/module.info +++ b/modules/gallery/module.info @@ -1,3 +1,7 @@ name = "Gallery 3" description = "Gallery core application" -version = 48 +version = 49 +author_name = "Gallery Team" +author_url = "http://codex.gallery2.org/Gallery:Team" +info_url = "http://codex.gallery2.org/Gallery3:Modules:gallery" +discuss_url = "http://gallery.menalto.com/forum_module_gallery" diff --git a/modules/gallery/views/admin_modules.html.php b/modules/gallery/views/admin_modules.html.php index 2cc81b0d..03993bb2 100644 --- a/modules/gallery/views/admin_modules.html.php +++ b/modules/gallery/views/admin_modules.html.php @@ -43,7 +43,7 @@ </script> <h1> <?= t("Gallery Modules") ?> </h1> <p> - <?= t("Power up your Gallery by adding more modules! Each module provides new cool features.") ?> + <?= t("Power up your Gallery by <a href=\"%url\">adding more modules</a>! Each module provides new cool features.", array("url" => "http://codex.gallery2.org/Category:Gallery_3:Modules")) ?> </p> <div class="g-block-content"> @@ -55,6 +55,7 @@ <th style="width: 8em"> <?= t("Name") ?> </th> <th> <?= t("Version") ?> </th> <th> <?= t("Description") ?> </th> + <th style="width: 60px"> <?= t("Details") ?> </th> </tr> <? foreach ($available as $module_name => $module_info): ?> <tr class="<?= text::alternate("g-odd", "g-even") ?>"> @@ -64,6 +65,55 @@ <td> <?= t($module_info->name) ?> </td> <td> <?= $module_info->version ?> </td> <td> <?= t($module_info->description) ?> </td> + <td style="white-space: nowrap"> + <ul class="g-buttonset"> + <li> + <a target="_blank" + <? if (isset($module_info->author_url)): ?> + class="ui-state-default ui-icon ui-icon-person ui-corner-left" + href="<?= $module_info->author_url ?>" + <? else: ?> + class="ui-state-disabled ui-icon ui-icon-person ui-corner-left" + href="#" + <? endif ?> + + <? if (isset($module_info->author_name)): ?> + title="<?= $module_info->author_name ?>" + <? endif ?> + > + <? if (isset($module_info->author_name)): ?> + <?= $module_info->author_name ?> + <? endif ?> + </a> + </li> + <li> + <a target="_blank" + <? if (isset($module_info->info_url)): ?> + class="ui-state-default ui-icon ui-icon-info" + href="<?= $module_info->info_url ?>" + <? else: ?> + class="ui-state-disabled ui-icon ui-icon-info" + href="#" + <? endif ?> + > + <?= t("info") ?> + </a> + </li> + <li> + <a target="_blank" + <? if (isset($module_info->discuss_url)): ?> + class="ui-state-default ui-icon ui-icon-comment ui-corner-right" + href="<?= $module_info->discuss_url ?>" + <? else: ?> + class="ui-state-disabled ui-icon ui-icon-comment ui-corner-right" + href="#" + <? endif ?> + > + <?= t("discuss") ?> + </a> + </li> + </ul> + </td> </tr> <? endforeach ?> </table> diff --git a/modules/gallery/views/admin_themes.html.php b/modules/gallery/views/admin_themes.html.php index d14e8bd4..7d947b28 100644 --- a/modules/gallery/views/admin_themes.html.php +++ b/modules/gallery/views/admin_themes.html.php @@ -10,7 +10,7 @@ <div class="g-block ui-helper-clearfix"> <h1> <?= t("Theme choice") ?> </h1> <p> - <?= t("Gallery allows you to choose a theme for browsing your Gallery, as well as a special theme for the administration interface. Click a theme to preview and activate it.") ?> + <?= t("Make your Gallery beautiful <a href=\"%url\">with a new theme</a>! There are separate themes for the regular site and for the administration interface. Click a theme below to preview and activate it.", array("url" => "http://codex.gallery2.org/Category:Gallery_3:Themes")) ?> </p> <div class="g-block-content"> @@ -23,6 +23,7 @@ <p> <?= $themes[$site]->description ?> </p> + <? $v = new View("admin_themes_buttonset.html"); $v->info = $themes[$site]; print $v; ?> </div> <h2> <?= t("Available Gallery themes") ?> </h2> @@ -40,13 +41,14 @@ <?= $info->description ?> </p> </a> + <? $v = new View("admin_themes_buttonset.html"); $v->info = $info; print $v; ?> </div> <? $count++ ?> <? endforeach ?> <? if (!$count): ?> <p> - <?= t("There are no other site themes available.") ?> + <?= t("There are no other site themes available. <a href=\"%url\">Download one now!</a>", array("url" => "http://codex.gallery2.org/Category:Gallery_3:Modules")) ?> </p> <? endif ?> </div> @@ -61,6 +63,7 @@ <p> <?= $themes[$admin]->description ?> </p> + <? $v = new View("admin_themes_buttonset.html"); $v->info = $themes[$admin]; print $v; ?> </div> <h2> <?= t("Available admin themes") ?> </h2> @@ -78,17 +81,18 @@ <?= $info->description ?> </p> </a> + <? $v = new View("admin_themes_buttonset.html"); $v->info = $info; print $v; ?> </div> <? $count++ ?> <? endforeach ?> <? if (!$count): ?> <p> - <?= t("There are no other admin themes available.") ?> + <?= t("There are no other admin themes available. <a href=\"%url\">Download one now!</a>", array("url" => "http://codex.gallery2.org/Category:Gallery_3:Modules")) ?> </p> <? endif ?> </div> </div> </div> -</div>
\ No newline at end of file +</div> diff --git a/modules/gallery/views/admin_themes_buttonset.html.php b/modules/gallery/views/admin_themes_buttonset.html.php new file mode 100644 index 00000000..5166f36c --- /dev/null +++ b/modules/gallery/views/admin_themes_buttonset.html.php @@ -0,0 +1,47 @@ + <ul class="g-buttonset"> + <li> + <a target="_blank" + <? if (isset($info['author_url'])): ?> + class="ui-state-default ui-icon ui-icon-person ui-corner-left" + href="<?= $info['author_url'] ?>" + <? else: ?> + class="ui-state-disabled ui-icon ui-icon-person ui-corner-left" + href="#" + <? endif ?> + + <? if (isset($info['author_name'])): ?> + title="<?= $info['author_name'] ?>" + <? endif ?> + > + <? if (isset($info['author_name'])): ?> + <?= $info['author_name'] ?> + <? endif ?> + </a> + </li> + <li> + <a target="_blank" + <? if (isset($info['info_url'])): ?> + class="ui-state-default ui-icon ui-icon-info" + href="<?= $info['info_url'] ?>" + <? else: ?> + class="ui-state-disabled ui-icon ui-icon-info" + href="#" + <? endif ?> + > + <?= t("info") ?> + </a> + </li> + <li> + <a target="_blank" + <? if (isset($info['discuss_url'])): ?> + class="ui-state-default ui-icon ui-icon-comment ui-corner-right" + href="<?= $info['discuss_url'] ?>" + <? else: ?> + class="ui-state-disabled ui-icon ui-icon-comment ui-corner-right" + href="#" + <? endif ?> + > + <?= t("discuss") ?> + </a> + </li> + </ul> diff --git a/modules/gallery/views/movieplayer.html.php b/modules/gallery/views/movieplayer.html.php index 5c280a36..96d6532c 100644 --- a/modules/gallery/views/movieplayer.html.php +++ b/modules/gallery/views/movieplayer.html.php @@ -22,5 +22,5 @@ } } } - ) + ).ipad(); </script> diff --git a/modules/gallery/views/upgrader.html.php b/modules/gallery/views/upgrader.html.php index ad2e3421..70d37dd1 100644 --- a/modules/gallery/views/upgrader.html.php +++ b/modules/gallery/views/upgrader.html.php @@ -27,7 +27,7 @@ <div id="done" style="display: none"> <h1> <?= t("That's it!") ?> </h1> <p> - <?= t("Your <a href=\"%url\">Gallery</a> is up to date.", + <?= t("Your Gallery is up to date.<br/><a href=\"%url\">Return to your Gallery</a>", array("url" => html::mark_clean(url::base()))) ?> </p> </div> diff --git a/modules/image_block/module.info b/modules/image_block/module.info index 6836fabc..6722cc8f 100644 --- a/modules/image_block/module.info +++ b/modules/image_block/module.info @@ -1,3 +1,7 @@ name = "Image Block" description = "Display a random image in the sidebar" version = 3 +author_name = "Gallery Team" +author_url = "http://codex.gallery2.org/Gallery:Team" +info_url = "http://codex.gallery2.org/Gallery3:Modules:image_block" +discuss_url = "http://gallery.menalto.com/forum_module_image_block" diff --git a/modules/info/module.info b/modules/info/module.info index 5f84cbb9..f8964a78 100644 --- a/modules/info/module.info +++ b/modules/info/module.info @@ -1,3 +1,7 @@ name = "Info" description = "Display extra information about photos and albums" version = 2 +author_name = "Gallery Team" +author_url = "http://codex.gallery2.org/Gallery:Team" +info_url = "http://codex.gallery2.org/Gallery3:Modules:info" +discuss_url = "http://gallery.menalto.com/forum_module_info" diff --git a/modules/notification/module.info b/modules/notification/module.info index 8c5e1162..84be8f99 100644 --- a/modules/notification/module.info +++ b/modules/notification/module.info @@ -1,3 +1,7 @@ name = "Notification" description = "Send notifications to users when changes are made to watched albums." version = 2 +author_name = "Gallery Team" +author_url = "http://codex.gallery2.org/Gallery:Team" +info_url = "http://codex.gallery2.org/Gallery3:Modules:notification" +discuss_url = "http://gallery.menalto.com/forum_module_notification" diff --git a/modules/organize/module.info b/modules/organize/module.info index 0d16144d..07b9dc38 100644 --- a/modules/organize/module.info +++ b/modules/organize/module.info @@ -1,3 +1,7 @@ name = "Organize" description = "Visually rearrange and move photos in your gallery" version = 4 +author_name = "Gallery Team" +author_url = "http://codex.gallery2.org/Gallery:Team" +info_url = "http://codex.gallery2.org/Gallery3:Modules:organize" +discuss_url = "http://gallery.menalto.com/forum_module_organize" diff --git a/modules/recaptcha/module.info b/modules/recaptcha/module.info index cfa1bf7a..ebaff7de 100644 --- a/modules/recaptcha/module.info +++ b/modules/recaptcha/module.info @@ -1,3 +1,7 @@ name = "reCAPTCHA" description = "reCAPTCHA displays a graphical verification that protects the input form from abuse from 'bots,' or automated programs usually written to generate spam (http://recaptcha.net)." version = 1 +author_name = "Gallery Team" +author_url = "http://codex.gallery2.org/Gallery:Team" +info_url = "http://codex.gallery2.org/Gallery3:Modules:recaptcha" +discuss_url = "http://gallery.menalto.com/forum_module_recaptcha" diff --git a/modules/rest/module.info b/modules/rest/module.info index 5aaffc28..33c9f1cf 100644 --- a/modules/rest/module.info +++ b/modules/rest/module.info @@ -2,3 +2,7 @@ name = "REST API Module" description = "A REST-based API that allows desktop clients and other apps to interact with Gallery 3" version = 3 +author_name = "Gallery Team" +author_url = "http://codex.gallery2.org/Gallery:Team" +info_url = "http://codex.gallery2.org/Gallery3:Modules:rest" +discuss_url = "http://gallery.menalto.com/forum_module_rest" diff --git a/modules/rss/module.info b/modules/rss/module.info index 48375da1..cd13c1b0 100644 --- a/modules/rss/module.info +++ b/modules/rss/module.info @@ -1,3 +1,7 @@ name = "RSS" description = "Provides RSS feeds" version = 1 +author_name = "Gallery Team" +author_url = "http://codex.gallery2.org/Gallery:Team" +info_url = "http://codex.gallery2.org/Gallery3:Modules:rss" +discuss_url = "http://gallery.menalto.com/forum_module_rss" diff --git a/modules/search/module.info b/modules/search/module.info index f417c4fa..1389798d 100644 --- a/modules/search/module.info +++ b/modules/search/module.info @@ -1,3 +1,7 @@ name = "Search" description = "Allows users to search their Gallery" version = 1 +author_name = "Gallery Team" +author_url = "http://codex.gallery2.org/Gallery:Team" +info_url = "http://codex.gallery2.org/Gallery3:Modules:search" +discuss_url = "http://gallery.menalto.com/forum_module_search" diff --git a/modules/server_add/module.info b/modules/server_add/module.info index 87b317b1..4ce0a97d 100644 --- a/modules/server_add/module.info +++ b/modules/server_add/module.info @@ -1,3 +1,7 @@ name = "Server Add" description = "Allows authorized users to load images directly from your web server" version = 4 +author_name = "Gallery Team" +author_url = "http://codex.gallery2.org/Gallery:Team" +info_url = "http://codex.gallery2.org/Gallery3:Modules:server_add" +discuss_url = "http://gallery.menalto.com/forum_module_server_add" diff --git a/modules/slideshow/module.info b/modules/slideshow/module.info index b56eac81..8c9a3176 100644 --- a/modules/slideshow/module.info +++ b/modules/slideshow/module.info @@ -1,3 +1,7 @@ name = "Slideshow" description = "Allows users to view a slideshow of photos" version = 2 +author_name = "Gallery Team" +author_url = "http://codex.gallery2.org/Gallery:Team" +info_url = "http://codex.gallery2.org/Gallery3:Modules:slideshow" +discuss_url = "http://gallery.menalto.com/forum_module_slideshow" diff --git a/modules/tag/controllers/admin_tags.php b/modules/tag/controllers/admin_tags.php index 73042a55..fd82bc92 100644 --- a/modules/tag/controllers/admin_tags.php +++ b/modules/tag/controllers/admin_tags.php @@ -81,9 +81,7 @@ class Admin_Tags_Controller extends Admin_Controller { $in_place_edit = InPlaceEdit::factory($tag->name) ->action("admin/tags/rename/$tag->id") - ->rules(array("required", "length[1,64]")) - ->messages(array("in_use" => t("There is already a tag with that name"))) - ->callback(array($this, "check_for_duplicate")); + ->rules(array("required", "length[1,64]")); if ($in_place_edit->validate()) { $old_name = $tag->name; @@ -101,12 +99,5 @@ class Admin_Tags_Controller extends Admin_Controller { } } - public function check_for_duplicate(Validation $post_data, $field) { - $tag_exists = ORM::factory("tag")->where("name", "=", $post_data[$field])->count_all(); - if ($tag_exists) { - $post_data->add_error($field, "in_use"); - } - } - } diff --git a/modules/tag/models/tag.php b/modules/tag/models/tag.php index bd665667..13e253ba 100644 --- a/modules/tag/models/tag.php +++ b/modules/tag/models/tag.php @@ -69,15 +69,22 @@ class Tag_Model_Core extends ORM { * to this tag. */ public function save() { - $related_item_ids = array(); - foreach (db::build() - ->select("item_id") - ->from("items_tags") - ->where("tag_id", "=", $this->id) - ->execute() as $row) { - $related_item_ids[$row->item_id] = 1; + // Check to see if another tag exists with the same name + $duplicate_tag = ORM::factory("tag") + ->where("name", "=", $this->name) + ->where("id", "!=", $this->id) + ->find(); + if ($duplicate_tag->loaded()) { + // If so, tag its items with this tag so as to merge it. + foreach ($duplicate_tag->items() as $item) { + $this->add($item); + } + + // ... and remove the duplicate tag + $duplicate_tag->delete(); } + // Figure out what items have changed in this tag for our item_related_update event below if (isset($this->object_relations["items"])) { $added = array_diff($this->changed_relations["items"], $this->object_relations["items"]); $removed = array_diff($this->object_relations["items"], $this->changed_relations["items"]); diff --git a/modules/tag/module.info b/modules/tag/module.info index d9d34386..75d16bf0 100644 --- a/modules/tag/module.info +++ b/modules/tag/module.info @@ -1,3 +1,7 @@ name = "Tags" description = "Allows users to tag photos and albums" version = 3 +author_name = "Gallery Team" +author_url = "http://codex.gallery2.org/Gallery:Team" +info_url = "http://codex.gallery2.org/Gallery3:Modules:tag" +discuss_url = "http://gallery.menalto.com/forum_module_tag" diff --git a/modules/tag/tests/Tag_Test.php b/modules/tag/tests/Tag_Test.php index f5ccb3a2..9e10fa4a 100644 --- a/modules/tag/tests/Tag_Test.php +++ b/modules/tag/tests/Tag_Test.php @@ -18,18 +18,60 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class Tag_Test extends Gallery_Unit_Test_Case { + public function teardown() { + ORM::factory("tag")->delete_all(); + } + public function create_tag_test() { $album = test::random_album(); tag::add($album, "tag1"); $tag = ORM::factory("tag")->where("name", "=", "tag1")->find(); - $this->assert_true(1, $tag->count); + $this->assert_equal(1, $tag->count); // Make sure adding the tag again doesn't increase the count tag::add($album, "tag1"); - $this->assert_true(1, $tag->reload()->count); + $this->assert_equal(1, $tag->reload()->count); tag::add(test::random_album(), "tag1"); - $this->assert_true(2, $tag->reload()->count); + $this->assert_equal(2, $tag->reload()->count); + } + + public function rename_merge_tag_test() { + $album1 = test::random_album(); + $album2 = test::random_album(); + + tag::add($album1, "tag1"); + tag::add($album2, "tag2"); + + $tag1 = ORM::factory("tag")->where("name", "=", "tag1")->find(); + $tag1->name = "tag2"; + $tag1->save(); + + // Tags should be merged; $tag2 should be deleted + $tag1->reload(); + + $this->assert_equal(2, $tag1->count); + $this->assert_true($tag1->has($album1)); + $this->assert_true($tag1->has($album2)); + $this->assert_equal(1, ORM::factory("tag")->count_all()); + } + + public function rename_merge_tag_with_same_items_test() { + $album = test::random_album(); + + tag::add($album, "tag1"); + tag::add($album, "tag2"); + + $tag1 = ORM::factory("tag")->where("name", "=", "tag1")->find(); + $tag1->name = "tag2"; + $tag1->save(); + + // Tags should be merged + $tag1->reload(); + + $this->assert_equal(1, $tag1->count); + $this->assert_true($tag1->has($album)); + $this->assert_equal(1, ORM::factory("tag")->count_all()); } -}
\ No newline at end of file +} diff --git a/modules/user/controllers/password.php b/modules/user/controllers/password.php index 4e93d5ce..cd46bbed 100644 --- a/modules/user/controllers/password.php +++ b/modules/user/controllers/password.php @@ -105,7 +105,7 @@ class Password_Controller extends Controller { if (!empty($hash)) { $hidden->value($hash); } - $minimum_length = module::get_var("user", "mininum_password_length", 5); + $minimum_length = module::get_var("user", "minimum_password_length", 5); $input_password = $group->password("password")->label(t("Password"))->id("g-password") ->rules($minimum_length ? "required|length[$minimum_length, 40]" : "length[40]"); $group->password("password2")->label(t("Confirm Password"))->id("g-password2") diff --git a/modules/user/helpers/user_installer.php b/modules/user/helpers/user_installer.php index b889af49..9b582773 100644 --- a/modules/user/helpers/user_installer.php +++ b/modules/user/helpers/user_installer.php @@ -24,6 +24,7 @@ class user_installer { static function install() { IdentityProvider::change_provider("user"); + // Set the latest version in initialize() below } static function upgrade($version) { @@ -44,6 +45,13 @@ class user_installer { ->execute(); module::set_version("user", $version = 3); } + + if ($version == 3) { + $password_length = module::get_var("user", "mininum_password_length", 5); + module::set_var("user", "minimum_password_length", $password_length); + module::clear_var("user", "mininum_password_length"); + module::set_version("user", $version = 4); + } } static function uninstall() { @@ -129,7 +137,7 @@ class user_installer { access::allow($registered, "view", $root); access::allow($registered, "view_full", $root); - module::set_var("user", "mininum_password_length", 5); - module::set_version("user", 3); + module::set_var("user", "minimum_password_length", 5); + module::set_version("user", 4); } }
\ No newline at end of file diff --git a/modules/user/models/user.php b/modules/user/models/user.php index 145738ca..a8a3a0e7 100644 --- a/modules/user/models/user.php +++ b/modules/user/models/user.php @@ -147,7 +147,7 @@ class User_Model_Core extends ORM implements User_Definition { } if (!$this->loaded() || isset($this->password_length)) { - $minimum_length = module::get_var("user", "mininum_password_length", 5); + $minimum_length = module::get_var("user", "minimum_password_length", 5); if ($this->password_length < $minimum_length) { $v->add_error("password", "min_length"); } diff --git a/modules/user/module.info b/modules/user/module.info index 185a3e3a..503bcd0d 100644 --- a/modules/user/module.info +++ b/modules/user/module.info @@ -1,4 +1,8 @@ name = "Users and Groups" description = "Gallery 3 user and group management" -version = 3 +version = 4 +author_name = "Gallery Team" +author_url = "http://codex.gallery2.org/Gallery:Team" +info_url = "http://codex.gallery2.org/Gallery3:Modules:user" +discuss_url = "http://gallery.menalto.com/forum_module_user" diff --git a/modules/watermark/module.info b/modules/watermark/module.info index 41a871bd..58efa43f 100644 --- a/modules/watermark/module.info +++ b/modules/watermark/module.info @@ -1,3 +1,7 @@ name = "Watermarks" description = "Allows users to watermark their photos" version = 2 +author_name = "Gallery Team" +author_url = "http://codex.gallery2.org/Gallery:Team" +info_url = "http://codex.gallery2.org/Gallery3:Modules:watermark" +discuss_url = "http://gallery.menalto.com/forum_module_watermark" |