summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.build_number2
-rw-r--r--installer/install.sql8
-rw-r--r--modules/gallery/controllers/admin_modules.php6
-rw-r--r--modules/gallery/css/gallery.css6
-rw-r--r--modules/gallery/helpers/MY_num.php14
-rw-r--r--modules/gallery/helpers/gallery_block.php25
-rw-r--r--modules/gallery/helpers/gallery_installer.php13
-rw-r--r--modules/gallery/helpers/graphics.php21
-rw-r--r--modules/gallery/helpers/module.php2
-rw-r--r--modules/gallery/libraries/Form_Uploadify.php14
-rw-r--r--modules/gallery/module.info2
-rw-r--r--modules/gallery/tests/Num_Helper_Test.php32
-rw-r--r--modules/gallery/views/form_uploadify.html.php36
-rw-r--r--modules/server_add/js/server_add.js125
-rw-r--r--modules/tag/helpers/tag.php1
-rw-r--r--modules/user/controllers/password.php2
-rw-r--r--modules/user/helpers/user_installer.php12
-rw-r--r--modules/user/models/user.php2
-rw-r--r--modules/user/module.info2
19 files changed, 278 insertions, 47 deletions
diff --git a/.build_number b/.build_number
index 05667d5e..c1f820ac 100644
--- a/.build_number
+++ b/.build_number
@@ -3,4 +3,4 @@
; process. You don't need to edit it. In fact..
;
; DO NOT EDIT THIS FILE BY HAND!
-build_number=103
+build_number=113
diff --git a/installer/install.sql b/installer/install.sql
index de5250d1..2b8ec11e 100644
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -244,8 +244,8 @@ CREATE TABLE {modules} (
KEY `weight` (`weight`)
) AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO {modules} VALUES (1,1,'gallery',48,1);
-INSERT INTO {modules} VALUES (2,1,'user',3,2);
+INSERT INTO {modules} VALUES (1,1,'gallery',49,1);
+INSERT INTO {modules} VALUES (2,1,'user',4,2);
INSERT INTO {modules} VALUES (3,1,'comment',4,3);
INSERT INTO {modules} VALUES (4,1,'organize',4,4);
INSERT INTO {modules} VALUES (5,1,'info',2,5);
@@ -413,10 +413,10 @@ INSERT INTO {vars} VALUES (NULL,'gallery','email_line_length','70');
INSERT INTO {vars} VALUES (NULL,'gallery','email_header_separator','s:1:\"\n\";');
INSERT INTO {vars} VALUES (NULL,'gallery','show_user_profiles_to','registered_users');
INSERT INTO {vars} VALUES (NULL,'gallery','extra_binary_paths','/usr/local/bin:/opt/local/bin:/opt/bin');
-INSERT INTO {vars} VALUES (NULL,'gallery','timezone','PST8PDT');
+INSERT INTO {vars} VALUES (NULL,'gallery','timezone',NULL);
INSERT INTO {vars} VALUES (NULL,'gallery','blocks_site_sidebar','a:4:{i:10;a:2:{i:0;s:7:\"gallery\";i:1;s:8:\"language\";}i:11;a:2:{i:0;s:4:\"info\";i:1;s:8:\"metadata\";}i:12;a:2:{i:0;s:3:\"rss\";i:1;s:9:\"rss_feeds\";}i:13;a:2:{i:0;s:3:\"tag\";i:1;s:3:\"tag\";}}');
INSERT INTO {vars} VALUES (NULL,'gallery','identity_provider','user');
-INSERT INTO {vars} VALUES (NULL,'user','mininum_password_length','5');
+INSERT INTO {vars} VALUES (NULL,'user','minimum_password_length','5');
INSERT INTO {vars} VALUES (NULL,'comment','spam_caught','0');
INSERT INTO {vars} VALUES (NULL,'comment','access_permissions','everybody');
INSERT INTO {vars} VALUES (NULL,'info','show_title','1');
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 275a3d7d..97d09454 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: 137px;
- margin: .5em 0;
+ left: 93px;
+ margin: .5em 0;
padding: .4em 1em;
position: absolute;
top: 0;
- width: 175px;
+ width: auto;
}
#g-add-photos-canvas object {
diff --git a/modules/gallery/helpers/MY_num.php b/modules/gallery/helpers/MY_num.php
index 9787044c..842a2ee3 100644
--- a/modules/gallery/helpers/MY_num.php
+++ b/modules/gallery/helpers/MY_num.php
@@ -37,4 +37,18 @@ class num extends num_Core {
return $val;
}
+
+ /**
+ * Convert a size value as accepted by PHP's shorthand to bytes.
+ * ref: http://us2.php.net/manual/en/function.ini-get.php
+ * ref: http://us2.php.net/manual/en/faq.using.php#faq.using.shorthandbytes
+ */
+ static function convert_to_human_readable($num) {
+ foreach (array("G" => 1e9, "M" => 1e6, "K" => 1e3) as $k => $v) {
+ if ($num > $v) {
+ $num = round($num / $v) . $k;
+ }
+ }
+ return $num;
+ }
}
diff --git a/modules/gallery/helpers/gallery_block.php b/modules/gallery/helpers/gallery_block.php
index 0ba7c936..49d16246 100644
--- a/modules/gallery/helpers/gallery_block.php
+++ b/modules/gallery/helpers/gallery_block.php
@@ -82,9 +82,13 @@ class gallery_block_Core {
break;
case "block_adder":
- $block->css_id = "g-block-adder";
- $block->title = t("Dashboard content");
- $block->content = gallery_block::get_add_block_form();
+ if ($form = gallery_block::get_add_block_form()) {
+ $block->css_id = "g-block-adder";
+ $block->title = t("Dashboard content");
+ $block->content = $form;
+ } else {
+ $block = "";
+ }
break;
case "language":
@@ -118,11 +122,22 @@ class gallery_block_Core {
}
static function get_add_block_form() {
+ $available_blocks = block_manager::get_available_admin_blocks();
+
+ $active = array();
+ foreach (array_merge(block_manager::get_active("dashboard_sidebar"),
+ block_manager::get_active("dashboard_center")) as $b) {
+ unset($available_blocks[implode(":", $b)]);
+ }
+
+ if (!$available_blocks) {
+ return;
+ }
+
$form = new Forge("admin/dashboard/add_block", "", "post",
array("id" => "g-add-dashboard-block-form"));
$group = $form->group("add_block")->label(t("Add Block"));
- $group->dropdown("id")->label(t("Available Blocks"))
- ->options(block_manager::get_available_admin_blocks());
+ $group->dropdown("id")->label(t("Available blocks"))->options($available_blocks);
$group->submit("center")->value(t("Add to center"));
$group->submit("sidebar")->value(t("Add to sidebar"));
return $form;
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 04501132..8d8853b0 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -316,7 +316,7 @@ class graphics_Core {
// ImageMagick & GraphicsMagick
$magick_kits = array(
"imagemagick" => array(
- "name" => "ImageMagick", "binary" => "convert", "version" => "convert -v",
+ "name" => "ImageMagick", "binary" => "convert", "version" => "convert -version",
"version_regex" => "/Version: \S+ (\S+)/"),
"graphicsmagick" => array(
"name" => "GraphicsMagick", "binary" => "gm", "version" => "gm version",
@@ -423,4 +423,23 @@ class graphics_Core {
return true;
}
+
+ /**
+ * Return the max file size that this graphics toolkit can handle.
+ */
+ static function max_filesize() {
+ if (module::get_var("gallery", "graphics_toolkit") == "gd") {
+ $memory_limit = trim(ini_get("memory_limit"));
+ $memory_limit_bytes = num::convert_to_bytes($memory_limit);
+
+ // GD expands images in memory and uses 4 bytes of RAM for every byte
+ // in the file.
+ $max_filesize = $memory_limit_bytes / 4;
+ $max_filesize_human_readable = num::convert_to_human_readable($max_filesize);
+ return array($max_filesize, $max_filesize_human_readable);
+ }
+
+ // Some arbitrarily large size
+ return array(1000000000, "1G");
+ }
}
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/Form_Uploadify.php b/modules/gallery/libraries/Form_Uploadify.php
index 27ab9684..3e35e380 100644
--- a/modules/gallery/libraries/Form_Uploadify.php
+++ b/modules/gallery/libraries/Form_Uploadify.php
@@ -48,6 +48,20 @@ class Form_Uploadify_Core extends Form_Input {
$v->simultaneous_upload_limit = module::get_var("gallery", "simultaneous_upload_limit");
$v->movies_allowed = (bool) movie::find_ffmpeg();
$v->suhosin_session_encrypt = (bool) ini_get("suhosin.session.encrypt");
+
+ list ($toolkit_max_filesize_bytes, $toolkit_max_filesize) = graphics::max_filesize();
+
+ $upload_max_filesize = trim(ini_get("upload_max_filesize"));
+ $upload_max_filesize_bytes = num::convert_to_bytes($upload_max_filesize);
+
+ if ($upload_max_filesize_bytes < $toolkit_max_filesize_bytes) {
+ $v->size_limit_bytes = $upload_max_filesize_bytes;
+ $v->size_limit = $upload_max_filesize;
+ } else {
+ $v->size_limit_bytes = $toolkit_max_filesize_bytes;
+ $v->size_limit = $toolkit_max_filesize;
+ }
+
return $v;
}
diff --git a/modules/gallery/module.info b/modules/gallery/module.info
index 807d08fd..74c0658f 100644
--- a/modules/gallery/module.info
+++ b/modules/gallery/module.info
@@ -1,3 +1,3 @@
name = "Gallery 3"
description = "Gallery core application"
-version = 48
+version = 49
diff --git a/modules/gallery/tests/Num_Helper_Test.php b/modules/gallery/tests/Num_Helper_Test.php
new file mode 100644
index 00000000..a22f9359
--- /dev/null
+++ b/modules/gallery/tests/Num_Helper_Test.php
@@ -0,0 +1,32 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2011 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class Num_Helper_Test extends Gallery_Unit_Test_Case {
+ public function convert_to_bytes_test() {
+ $this->assert_equal(5 * 1024, num::convert_to_bytes("5K"));
+ $this->assert_equal(3 * 1024*1024, num::convert_to_bytes("3M"));
+ $this->assert_equal(4 * 1024*1024*1024, num::convert_to_bytes("4G"));
+ }
+
+ public function convert_to_human_readable_test() {
+ $this->assert_equal("6K", num::convert_to_human_readable(5615));
+ $this->assert_equal("1M", num::convert_to_human_readable(1205615));
+ $this->assert_equal("3G", num::convert_to_human_readable(3091205615));
+ }
+} \ No newline at end of file
diff --git a/modules/gallery/views/form_uploadify.html.php b/modules/gallery/views/form_uploadify.html.php
index 77b6d493..83dfcc68 100644
--- a/modules/gallery/views/form_uploadify.html.php
+++ b/modules/gallery/views/form_uploadify.html.php
@@ -32,6 +32,7 @@
fileDesc: <?= t("Photos and movies")->for_js() ?>,
cancelImg: "<?= url::file("lib/uploadify/cancel.png") ?>",
simUploadLimit: <?= $simultaneous_upload_limit ?>,
+ sizeLimit: <?= $size_limit_bytes ?>,
wmode: "transparent",
hideButton: true, /* should be true */
auto: true,
@@ -66,26 +67,30 @@
return true;
},
onError: function(event, queueID, fileObj, errorObj) {
- var msg = " - ";
if (errorObj.type == "HTTP") {
if (errorObj.info == "500") {
- msg += <?= t("Unable to process this file")->for_js() ?>;
- // Server error - check server logs
+ error_msg = <?= t("Unable to process this photo")->for_js() ?>;
} else if (errorObj.info == "404") {
- msg += <?= t("The upload script was not found.")->for_js() ?>;
- // Server script not found
+ error_msg = <?= t("The upload script was not found")->for_js() ?>;
+ } else if (errorObj.info == "400") {
+ error_msg = <?= t("This photo is too large (max is %size bytes)",
+ array("size" => $size_limit))->for_js() ?>;
} else {
- // Server Error: status: errorObj.info
- msg += (<?= t("Server error: __INFO__")->for_js() ?>.replace("__INFO__", errorObj.info));
+ msg += (<?= t("Server error: __INFO__ (__TYPE__)")->for_js() ?>
+ .replace("__INFO__", errorObj.info)
+ .replace("__TYPE__", errorObj.type));
}
} else if (errorObj.type == "File Size") {
- var sizelimit = $("#g-uploadify").uploadifySettings(sizeLimit);
- msg += fileObj.name+' '+errorObj.type+' Limit: '+Math.round(d.sizeLimit/1024)+'KB';
+ error_msg = <?= t("This photo is too large (max is %size bytes)",
+ array("size" => $size_limit))->for_js() ?>;
} else {
- msg += (<?= t("Server error: __INFO__ (__TYPE__)")->for_js() ?>
- .replace("__INFO__", errorObj.info)
- .replace("__TYPE__", errorObj.type));
+ error_msg = <?= t("Server error: __INFO__ (__TYPE__)")->for_js() ?>
+ .replace("__INFO__", errorObj.info)
+ .replace("__TYPE__", errorObj.type);
}
+ msg = " - <a target=\"_blank\" href=\"http://codex.gallery2.org/Gallery3:Troubleshooting:Uploading\">" +
+ error_msg + "</a>";
+
$("#g-add-photos-status ul").append(
"<li id=\"q" + queueID + "\" class=\"g-error\">" + fileObj.name + msg + "</li>");
$("#g-uploadify").uploadifyCancel(queueID);
@@ -131,10 +136,7 @@
<? endif ?>
<div>
- <p>
- <?= t("Photos will be uploaded to album: ") ?>
- </p>
- <ul class="g-breadcrumbs ui-helper-clearfix">
+ <ul class="g-breadcrumbs">
<? foreach ($album->parents() as $i => $parent): ?>
<li<? if ($i == 0) print " class=\"g-first\"" ?>> <?= html::clean($parent->title) ?> </li>
<? endforeach ?>
@@ -143,7 +145,7 @@
</div>
<div id="g-add-photos-canvas">
- <button id="g-add-photos-button" class="g-button ui-state-default ui-corner-all" href="#"><?= t("Select photos...") ?></button>
+ <button id="g-add-photos-button" class="g-button ui-state-default ui-corner-all" href="#"><?= t("Select photos (%size max per file)...", array("size" => $size_limit)) ?></button>
<span id="g-uploadify"></span>
</div>
<div id="g-add-photos-status">
diff --git a/modules/server_add/js/server_add.js b/modules/server_add/js/server_add.js
new file mode 100644
index 00000000..02dda4c0
--- /dev/null
+++ b/modules/server_add/js/server_add.js
@@ -0,0 +1,125 @@
+(function($) {
+ $.widget("ui.gallery_server_add", {
+ _init: function() {
+ var self = this;
+ $("#g-server-add-add-button", this.element).click(function(event) {
+ event.preventDefault();
+ $(".g-progress-bar", this.element).
+ progressbar().
+ progressbar("value", 0);
+ $("#g-server-add-progress", this.element).slideDown("fast", function() { self.start_add(); });
+ });
+ $("#g-server-add-pause-button", this.element).click(function(event) {
+ self.pause = true;
+ $("#g-server-add-pause-button", this.element).hide();
+ $("#g-server-add-continue-button", this.element).show();
+ });
+ $("#g-server-add-continue-button", this.element).click(function(event) {
+ self.pause = false;
+ $("#g-server-add-pause-button", this.element).show();
+ $("#g-server-add-continue-button", this.element).hide();
+ self.run_add();
+ });
+ $("#g-server-add-close-button", this.element).click(function(event) {
+ $("#g-dialog").dialog("close");
+ window.location.reload();
+ });
+ $("#g-server-add-tree span.g-directory", this.element).dblclick(function(event) {
+ self.open_dir(event);
+ });
+ $("#g-server-add-tree span.g-file, #g-server-add-tree span.g-directory", this.element).click(function(event) {
+ self.select_file(event);
+ });
+ $("#g-server-add-tree span.g-directory", this.element).dblclick(function(event) {
+ self.open_dir(event);
+ });
+ $("#g-dialog").bind("dialogclose", function(event, ui) {
+ window.location.reload();
+ });
+ },
+
+ taskURL: null,
+ pause: false,
+
+ start_add: function() {
+ var self = this;
+ var paths = [];
+ $.each($("span.selected", self.element), function () {
+ paths.push($(this).attr("ref"));
+ });
+
+ $("#g-server-add-add-button", this.element).hide();
+ $("#g-server-add-pause-button", this.element).show();
+
+ $.ajax({
+ url: START_URL,
+ type: "POST",
+ async: false,
+ data: { "paths[]": paths },
+ dataType: "json",
+ success: function(data, textStatus) {
+ $("#g-status").html(data.status);
+ $(".g-progress-bar", self.element).progressbar("value", data.percent_complete);
+ self.taskURL = data.url;
+ setTimeout(function() { self.run_add(); }, 25);
+ }
+ });
+ return false;
+ },
+
+ run_add: function () {
+ var self = this;
+ $.ajax({
+ url: self.taskURL,
+ async: false,
+ dataType: "json",
+ success: function(data, textStatus) {
+ $("#g-status").html(data.status);
+ $(".g-progress-bar", self.element).progressbar("value", data.percent_complete);
+ if (data.done) {
+ $("#g-server-add-progress", this.element).slideUp();
+ $("#g-server-add-add-button", this.element).show();
+ $("#g-server-add-pause-button", this.element).hide();
+ $("#g-server-add-continue-button", this.element).hide();
+ } else {
+ if (!self.pause) {
+ setTimeout(function() { self.run_add(); }, 25);
+ }
+ }
+ }
+ });
+ },
+
+ /**
+ * Load a new directory
+ */
+ open_dir: function(event) {
+ var self = this;
+ var path = $(event.target).attr("ref");
+ $.ajax({
+ url: GET_CHILDREN_URL.replace("__PATH__", path),
+ success: function(data, textStatus) {
+ $("#g-server-add-tree", self.element).html(data);
+ $("#g-server-add-tree span.g-directory", self.element).dblclick(function(event) {
+ self.open_dir(event);
+ });
+ $("#g-server-add-tree span.g-file, #g-server-add-tree span.g-directory", this.element).click(function(event) {
+ self.select_file(event);
+ });
+ }
+ });
+ },
+
+ /**
+ * Manage file selection state.
+ */
+ select_file: function (event) {
+ $(event.target).toggleClass("selected");
+ if ($("#g-server-add span.selected").length) {
+ $("#g-server-add-add-button").enable(true).removeClass("ui-state-disabled");
+ } else {
+ $("#g-server-add-add-button").enable(false).addClass("ui-state-disabled");
+ }
+ }
+ });
+})(jQuery);
diff --git a/modules/tag/helpers/tag.php b/modules/tag/helpers/tag.php
index 733215b3..c21104ee 100644
--- a/modules/tag/helpers/tag.php
+++ b/modules/tag/helpers/tag.php
@@ -48,6 +48,7 @@ class tag_Core {
* @return ORM_Iterator of Tag_Model in descending tag count order
*/
static function popular_tags($count) {
+ $count = max($count, 1);
return ORM::factory("tag")
->order_by("count", "DESC")
->limit($count)
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..b7594815 100644
--- a/modules/user/module.info
+++ b/modules/user/module.info
@@ -1,4 +1,4 @@
name = "Users and Groups"
description = "Gallery 3 user and group management"
-version = 3
+version = 4