From be431441cb06de48b01fde2baf3ccf04094c0273 Mon Sep 17 00:00:00 2001 From: alecpl Date: Thu, 12 Jan 2012 07:29:48 +0000 Subject: - Applied fixes from trunk up to r5756 --- CHANGELOG | 4 ++++ SQL/mysql.initial.sql | 2 +- SQL/mysql.update.sql | 6 +++++- installer/rcube_install.php | 2 +- plugins/acl/acl.js | 28 +++++++++++++++++++--------- plugins/acl/acl.php | 40 ++++++++++++++++++++++++++-------------- program/js/list.js | 8 ++++++-- 7 files changed, 62 insertions(+), 28 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2bb7e5704..8140e2e9f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,10 @@ CHANGELOG Roundcube Webmail =========================== +- Fix failure on MySQL database upgrade from 0.7 - text column can't have default value (#1488300) + +RELEASE 0.7.1 +------------- - Fix bug in handling of base href and inline content (#1488290) - Fix SQL Error when saving a contact with many email addresses (#1488286) - Fix strict email address searching if contact has more than one address diff --git a/SQL/mysql.initial.sql b/SQL/mysql.initial.sql index f66bb1eee..b0a7ee7a9 100644 --- a/SQL/mysql.initial.sql +++ b/SQL/mysql.initial.sql @@ -101,7 +101,7 @@ CREATE TABLE `contacts` ( `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', `del` tinyint(1) NOT NULL DEFAULT '0', `name` varchar(128) NOT NULL DEFAULT '', - `email` text NOT NULL DEFAULT '', + `email` text NOT NULL, `firstname` varchar(128) NOT NULL DEFAULT '', `surname` varchar(128) NOT NULL DEFAULT '', `vcard` longtext NULL, diff --git a/SQL/mysql.update.sql b/SQL/mysql.update.sql index 3e6b955fc..177ba936b 100644 --- a/SQL/mysql.update.sql +++ b/SQL/mysql.update.sql @@ -215,9 +215,11 @@ ALTER TABLE `session` CHANGE `sess_id` `sess_id` varchar(128) NOT NULL; -- Updates from version 0.7 +/*!40014 SET FOREIGN_KEY_CHECKS=0 */; + ALTER TABLE `contacts` DROP FOREIGN KEY `user_id_fk_contacts`; ALTER TABLE `contacts` DROP INDEX `user_contacts_index`; -ALTER TABLE `contacts` MODIFY `email` text NOT NULL DEFAULT ''; +ALTER TABLE `contacts` MODIFY `email` text NOT NULL; ALTER TABLE `contacts` ADD INDEX `user_contacts_index` (`user_id`,`del`); ALTER TABLE `contacts` ADD CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`) REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE; @@ -231,3 +233,5 @@ ALTER TABLE `contactgroups` ALTER `user_id` DROP DEFAULT; ALTER TABLE `contactgroupmembers` ALTER `contact_id` DROP DEFAULT; ALTER TABLE `identities` ALTER `user_id` DROP DEFAULT; ALTER TABLE `searches` ALTER `user_id` DROP DEFAULT; + +/*!40014 SET FOREIGN_KEY_CHECKS=1 */; diff --git a/installer/rcube_install.php b/installer/rcube_install.php index 737972b93..f23009de0 100644 --- a/installer/rcube_install.php +++ b/installer/rcube_install.php @@ -518,7 +518,7 @@ class rcube_install '0.4-beta', '0.4.2', '0.5-beta', '0.5', '0.5.1', '0.6-beta', '0.6', - '0.7-beta', '0.7', + '0.7-beta', '0.7', '0.7.1' )); return $select; } diff --git a/plugins/acl/acl.js b/plugins/acl/acl.js index c4011a81c..aa9e06d3d 100644 --- a/plugins/acl/acl.js +++ b/plugins/acl/acl.js @@ -1,7 +1,7 @@ /** * ACL plugin script * - * @version 0.6.3 + * @version @package_version@ * @author Aleksander Machniak */ @@ -179,9 +179,8 @@ rcube_webmail.prototype.acl_get_usernames = function() if (this.env.acl_specials.length && $.inArray(selection[n], this.env.acl_specials) >= 0) { users.push(selection[n]); } - else { - row = list.rows[selection[n]].obj; - cell = $('td.user', row); + else if (row = list.rows[selection[n]]) { + cell = $('td.user', row.obj); if (cell.length == 1) users.push(cell.text()); } @@ -193,10 +192,17 @@ rcube_webmail.prototype.acl_get_usernames = function() // Removes ACL table row rcube_webmail.prototype.acl_remove_row = function(id) { - this.acl_list.remove_row(id); + var list = this.acl_list; + + list.remove_row(id); + list.clear_selection(); + // we don't need it anymore (remove id conflict) $('#rcmrow'+id).remove(); this.env.acl[id] = null; + + this.enable_command('acl-delete', list.selection.length > 0); + this.enable_command('acl-edit', list.selection.length == 1); } // Adds ACL table row @@ -259,7 +265,7 @@ rcube_webmail.prototype.acl_add_row = function(o, sel) // Initializes and shows ACL create/edit form rcube_webmail.prototype.acl_init_form = function(id) { - var ul, row, val = '', type = 'user', li_elements, body = $('body'), + var ul, row, td, val = '', type = 'user', li_elements, body = $('body'), adv_ul = $('#advancedrights'), sim_ul = $('#simplerights'), name_input = $('#acluser'); @@ -286,10 +292,11 @@ rcube_webmail.prototype.acl_init_form = function(id) li_elements = $(':checkbox', ul); li_elements.attr('checked', false); - if (id) { - row = this.acl_list.rows[id].obj; + if (id && (row = this.acl_list.rows[id])) { + row = row.obj; li_elements.map(function() { - var val = this.value, td = $('td.'+this.id, row); + val = this.value; + td = $('td.'+this.id, row); if (td && td.hasClass('enabled')) this.checked = true; }); @@ -299,6 +306,9 @@ rcube_webmail.prototype.acl_init_form = function(id) else type = id; } + // mark read (lrs) rights by default + else + li_elements.filter(function() { return this.id.match(/^acl([lrs]|read)$/); }).prop('checked', true); name_input.val(val); $('input[value='+type+']').prop('checked', true); diff --git a/plugins/acl/acl.php b/plugins/acl/acl.php index 3a5fd1ac1..b2e5b8d47 100644 --- a/plugins/acl/acl.php +++ b/plugins/acl/acl.php @@ -441,26 +441,37 @@ class acl extends rcube_plugin $acl = trim(get_input_value('_acl', RCUBE_INPUT_GPC)); $oldid = trim(get_input_value('_old', RCUBE_INPUT_GPC)); - $acl = array_intersect(str_split($acl), $this->rights_supported()); + $acl = array_intersect(str_split($acl), $this->rights_supported()); + $users = $oldid ? array($user) : explode(',', $user); - if (!empty($this->specials) && in_array($user, $this->specials)) { - $username = $this->gettext($user); - } - else { - if (!strpos($user, '@') && ($realm = $this->get_realm())) { - $user .= '@' . rcube_idn_to_ascii(preg_replace('/^@/', '', $realm)); + foreach ($users as $user) { + $user = trim($user); + + if (!empty($this->specials) && in_array($user, $this->specials)) { + $username = $this->gettext($user); + } + else { + if (!strpos($user, '@') && ($realm = $this->get_realm())) { + $user .= '@' . rcube_idn_to_ascii(preg_replace('/^@/', '', $realm)); + } + $username = $user; + } + + if (!$acl || !$user || !strlen($mbox)) { + continue; } - $username = $user; - } - if ($acl && $user && $user != $_SESSION['username'] && strlen($mbox)) { - $result = $this->rc->imap->set_acl($mbox, $user, $acl); + if ($user != $_SESSION['username'] && $username != $_SESSION['username']) { + if ($this->rc->imap->set_acl($mbox, $user, $acl)) { + $ret = array('id' => html_identifier($user), + 'username' => $username, 'acl' => implode($acl), 'old' => $oldid); + $this->rc->output->command('acl_update', $ret); + $result++; + } + } } if ($result) { - $ret = array('id' => html_identifier($user), - 'username' => $username, 'acl' => implode($acl), 'old' => $oldid); - $this->rc->output->command('acl_update', $ret); $this->rc->output->show_message($oldid ? 'acl.updatesuccess' : 'acl.createsuccess', 'confirmation'); } else { @@ -479,6 +490,7 @@ class acl extends rcube_plugin $user = explode(',', $user); foreach ($user as $u) { + $u = trim($u); if ($this->rc->imap->delete_acl($mbox, $u)) { $this->rc->output->command('acl_remove_row', html_identifier($u)); } diff --git a/program/js/list.js b/program/js/list.js index 0d124ac7c..f6380ad2c 100644 --- a/program/js/list.js +++ b/program/js/list.js @@ -182,8 +182,12 @@ clear: function(sel) */ remove_row: function(uid, sel_next) { - if (this.rows[uid].obj) - this.rows[uid].obj.style.display = 'none'; + var obj = this.rows[uid] ? this.rows[uid].obj : null; + + if (!obj) + return; + + obj.style.display = 'none'; if (sel_next) this.select_next(); -- cgit v1.2.3