Fix double HTML escaping in switcher and harden JS edge cases
This commit is contained in:
@@ -162,6 +162,8 @@ Database migrations are applied automatically by the Roundcube plugin installer.
|
|||||||
|
|
||||||
If you are upgrading from `boressoft/ident_switch`, `toteph42/identity_switch`, or another fork:
|
If you are upgrading from `boressoft/ident_switch`, `toteph42/identity_switch`, or another fork:
|
||||||
|
|
||||||
|
> **Important:** This version (5.x) requires a **v4.x database schema** as its starting point. If you are running v1.x–v3.x, you must first upgrade to v4.x (`boressoft/ident_switch`) before migrating to this fork. This applies to all supported databases (MySQL, PostgreSQL, SQLite).
|
||||||
|
|
||||||
### With Composer
|
### With Composer
|
||||||
|
|
||||||
1. Replace the old package in `composer.json` with `gecka/roundcube-ident_switch` and run `composer update`
|
1. Replace the old package in `composer.json` with `gecka/roundcube-ident_switch` and run `composer update`
|
||||||
@@ -202,7 +204,7 @@ Original code by Boris Gulay licensed under GPL-3.0+. New contributions licensed
|
|||||||
- **Boris Gulay** — Original developer (2016–2022)
|
- **Boris Gulay** — Original developer (2016–2022)
|
||||||
- **Christian Landvogt** — Special folders support
|
- **Christian Landvogt** — Special folders support
|
||||||
- **Gergely Papp** — Bug fixes
|
- **Gergely Papp** — Bug fixes
|
||||||
- **Laurent Dinclaux - Gecka** — Current maintainer ([Gecka](https://gecka.nc))
|
- **Laurent Dinclaux** — Current maintainer ([Gecka](https://gecka.nc))
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
ALTER TABLE
|
|
||||||
`ident_switch`
|
|
||||||
MODIFY
|
|
||||||
`username`
|
|
||||||
varchar(64);
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
ALTER TABLE
|
|
||||||
`ident_switch`
|
|
||||||
MODIFY
|
|
||||||
`username`
|
|
||||||
varchar(64)
|
|
||||||
NULL;
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
ALTER TABLE
|
|
||||||
`ident_switch`
|
|
||||||
CHANGE
|
|
||||||
`host`
|
|
||||||
`imap_host` varchar(64);
|
|
||||||
|
|
||||||
ALTER TABLE
|
|
||||||
`ident_switch`
|
|
||||||
CHANGE
|
|
||||||
`port`
|
|
||||||
`imap_port` int;
|
|
||||||
|
|
||||||
ALTER TABLE
|
|
||||||
`ident_switch`
|
|
||||||
ADD COLUMN
|
|
||||||
`smtp_host`
|
|
||||||
varchar(64);
|
|
||||||
|
|
||||||
ALTER TABLE
|
|
||||||
`ident_switch`
|
|
||||||
ADD COLUMN
|
|
||||||
`smtp_port`
|
|
||||||
int
|
|
||||||
CHECK(`smtp_port` > 0 AND `smtp_port` <= 65535);
|
|
||||||
|
|
||||||
ALTER TABLE
|
|
||||||
`ident_switch`
|
|
||||||
DROP COLUMN
|
|
||||||
`delimiter`;
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
ALTER TABLE
|
|
||||||
`ident_switch`
|
|
||||||
ADD COLUMN
|
|
||||||
`imap_delimiter`
|
|
||||||
char(1);
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
ALTER TABLE
|
|
||||||
`ident_switch`
|
|
||||||
ADD COLUMN
|
|
||||||
`drafts_mbox`
|
|
||||||
varchar(64),
|
|
||||||
ADD COLUMN
|
|
||||||
`sent_mbox`
|
|
||||||
varchar(64),
|
|
||||||
ADD COLUMN
|
|
||||||
`junk_mbox`
|
|
||||||
varchar(64),
|
|
||||||
ADD COLUMN
|
|
||||||
`trash_mbox`
|
|
||||||
varchar(64);
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
ALTER TABLE
|
|
||||||
`ident_switch`
|
|
||||||
ADD COLUMN
|
|
||||||
`smtp_auth`
|
|
||||||
smallint
|
|
||||||
NOT NULL
|
|
||||||
DEFAULT 1;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
ALTER TABLE
|
|
||||||
ident_switch
|
|
||||||
ALTER COLUMN
|
|
||||||
host
|
|
||||||
DROP NOT NULL;
|
|
||||||
|
|
||||||
ALTER TABLE
|
|
||||||
ident_switch
|
|
||||||
ALTER COLUMN
|
|
||||||
label
|
|
||||||
DROP NOT NULL;
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
ALTER TABLE
|
|
||||||
ident_switch
|
|
||||||
ALTER COLUMN
|
|
||||||
username
|
|
||||||
DROP NOT NULL;
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
ALTER TABLE
|
|
||||||
ident_switch
|
|
||||||
ALTER COLUMN
|
|
||||||
username
|
|
||||||
DROP NOT NULL;
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
ALTER TABLE
|
|
||||||
ident_switch
|
|
||||||
RENAME COLUMN
|
|
||||||
host
|
|
||||||
TO
|
|
||||||
imap_host;
|
|
||||||
|
|
||||||
ALTER TABLE
|
|
||||||
ident_switch
|
|
||||||
RENAME COLUMN
|
|
||||||
port
|
|
||||||
TO
|
|
||||||
imap_port;
|
|
||||||
|
|
||||||
ALTER TABLE
|
|
||||||
ident_switch
|
|
||||||
ADD COLUMN
|
|
||||||
smtp_host
|
|
||||||
varchar(64);
|
|
||||||
|
|
||||||
ALTER TABLE
|
|
||||||
ident_switch
|
|
||||||
ADD COLUMN
|
|
||||||
smtp_port
|
|
||||||
integer
|
|
||||||
CHECK(smtp_port > 0 AND smtp_port <= 65535);
|
|
||||||
|
|
||||||
ALTER TABLE
|
|
||||||
ident_switch
|
|
||||||
DROP COLUMN
|
|
||||||
delimiter;
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
ALTER TABLE
|
|
||||||
ident_switch
|
|
||||||
ADD COLUMN
|
|
||||||
imap_delimiter
|
|
||||||
char(1);
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
ALTER TABLE
|
|
||||||
ident_switch
|
|
||||||
ADD COLUMN
|
|
||||||
drafts_mbox
|
|
||||||
varchar(64),
|
|
||||||
ADD COLUMN
|
|
||||||
sent_mbox
|
|
||||||
varchar(64),
|
|
||||||
ADD COLUMN
|
|
||||||
junk_mbox
|
|
||||||
varchar(64),
|
|
||||||
ADD COLUMN
|
|
||||||
trash_mbox
|
|
||||||
varchar(64);
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
ALTER TABLE
|
|
||||||
ident_switch
|
|
||||||
ADD COLUMN
|
|
||||||
smtp_auth
|
|
||||||
smallint
|
|
||||||
NOT NULL
|
|
||||||
DEFAULT(1);
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
PRAGMA foreign_keys=off;
|
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
ALTER TABLE ident_switch RENAME TO ident_switch_old;
|
|
||||||
|
|
||||||
CREATE TABLE ident_switch
|
|
||||||
(
|
|
||||||
id
|
|
||||||
integer
|
|
||||||
PRIMARY KEY,
|
|
||||||
user_id
|
|
||||||
integer
|
|
||||||
NOT NULL
|
|
||||||
REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE,
|
|
||||||
iid
|
|
||||||
integer
|
|
||||||
NOT NULL
|
|
||||||
REFERENCES identities(identity_id) ON DELETE CASCADE ON UPDATE CASCADE
|
|
||||||
UNIQUE,
|
|
||||||
username
|
|
||||||
varchar(64),
|
|
||||||
password
|
|
||||||
varchar(64),
|
|
||||||
imap_host
|
|
||||||
varchar(64),
|
|
||||||
imap_port
|
|
||||||
integer
|
|
||||||
CHECK(imap_port > 0 AND imap_port <= 65535),
|
|
||||||
label
|
|
||||||
varchar(32),
|
|
||||||
flags
|
|
||||||
integer
|
|
||||||
NOT NULL
|
|
||||||
DEFAULT(0),
|
|
||||||
smtp_host
|
|
||||||
varchar(64),
|
|
||||||
smtp_port
|
|
||||||
integer
|
|
||||||
CHECK(smtp_port > 0 AND smtp_port <= 65535),
|
|
||||||
UNIQUE (user_id, label)
|
|
||||||
);
|
|
||||||
CREATE INDEX IX_ident_switch_user_id ON ident_switch(user_id);
|
|
||||||
CREATE INDEX IX_ident_switch_iid on ident_switch(iid);
|
|
||||||
|
|
||||||
INSERT OR ROLLBACK INTO
|
|
||||||
ident_switch (
|
|
||||||
id,
|
|
||||||
user_id,
|
|
||||||
iid,
|
|
||||||
username,
|
|
||||||
password,
|
|
||||||
imap_host,
|
|
||||||
imap_port,
|
|
||||||
label,
|
|
||||||
flags,
|
|
||||||
smtp_host
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
id,
|
|
||||||
user_id,
|
|
||||||
iid,
|
|
||||||
username,
|
|
||||||
password,
|
|
||||||
host,
|
|
||||||
port,
|
|
||||||
label,
|
|
||||||
flags,
|
|
||||||
host
|
|
||||||
FROM
|
|
||||||
ident_switch_old;
|
|
||||||
|
|
||||||
DROP TABLE
|
|
||||||
ident_switch_old;
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
PRAGMA foreign_keys=on;
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
PRAGMA foreign_keys=off;
|
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
ALTER TABLE ident_switch RENAME TO ident_switch_old;
|
|
||||||
|
|
||||||
CREATE TABLE ident_switch
|
|
||||||
(
|
|
||||||
id
|
|
||||||
integer
|
|
||||||
PRIMARY KEY,
|
|
||||||
user_id
|
|
||||||
integer
|
|
||||||
NOT NULL
|
|
||||||
REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE,
|
|
||||||
iid
|
|
||||||
integer
|
|
||||||
NOT NULL
|
|
||||||
REFERENCES identities(identity_id) ON DELETE CASCADE ON UPDATE CASCADE
|
|
||||||
UNIQUE,
|
|
||||||
username
|
|
||||||
varchar(64),
|
|
||||||
password
|
|
||||||
varchar(64),
|
|
||||||
imap_host
|
|
||||||
varchar(64),
|
|
||||||
imap_port
|
|
||||||
integer
|
|
||||||
CHECK(imap_port > 0 AND imap_port <= 65535),
|
|
||||||
imap_delimiter
|
|
||||||
char(1),
|
|
||||||
label
|
|
||||||
varchar(32),
|
|
||||||
flags
|
|
||||||
integer
|
|
||||||
NOT NULL
|
|
||||||
DEFAULT(0),
|
|
||||||
smtp_host
|
|
||||||
varchar(64),
|
|
||||||
smtp_port
|
|
||||||
integer
|
|
||||||
CHECK(smtp_port > 0 AND smtp_port <= 65535),
|
|
||||||
smtp_auth
|
|
||||||
smallint
|
|
||||||
NOT NULL
|
|
||||||
DEFAULT 1,
|
|
||||||
drafts_mbox
|
|
||||||
varchar(64),
|
|
||||||
sent_mbox
|
|
||||||
varchar(64),
|
|
||||||
junk_mbox
|
|
||||||
varchar(64),
|
|
||||||
trash_mbox
|
|
||||||
varchar(64),
|
|
||||||
UNIQUE (user_id, label)
|
|
||||||
);
|
|
||||||
CREATE INDEX IX_ident_switch_user_id ON ident_switch(user_id);
|
|
||||||
CREATE INDEX IX_ident_switch_iid on ident_switch(iid);
|
|
||||||
|
|
||||||
INSERT OR ROLLBACK INTO
|
|
||||||
ident_switch (
|
|
||||||
id,
|
|
||||||
user_id,
|
|
||||||
iid,
|
|
||||||
username,
|
|
||||||
password,
|
|
||||||
imap_host,
|
|
||||||
imap_port,
|
|
||||||
label,
|
|
||||||
flags,
|
|
||||||
smtp_host,
|
|
||||||
smtp_port
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
id,
|
|
||||||
user_id,
|
|
||||||
iid,
|
|
||||||
username,
|
|
||||||
password,
|
|
||||||
imap_host,
|
|
||||||
imap_port,
|
|
||||||
label,
|
|
||||||
flags,
|
|
||||||
smtp_host,
|
|
||||||
smtp_port
|
|
||||||
FROM
|
|
||||||
ident_switch_old;
|
|
||||||
|
|
||||||
DROP TABLE
|
|
||||||
ident_switch_old;
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
PRAGMA foreign_keys=on;
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "gecka/roundcube-ident_switch",
|
"name": "gecka/roundcube-ident_switch",
|
||||||
"type": "roundcube-plugin",
|
"type": "roundcube-plugin",
|
||||||
"description": "This plugin allows users to switch between different accounts (including remote) in single Roundcube session.",
|
"description": "This plugin allows users to switch between different accounts (including remote) in single Roundcube session.",
|
||||||
"homepage": "https://github.com/Gecka-apps/ident_switch",
|
"homepage": "https://github.com/Gecka-Apps/roundcube-ident_switch",
|
||||||
"keywords": ["identity", "imap", "mail", "switch"],
|
"keywords": ["identity", "imap", "mail", "switch"],
|
||||||
"license": "AGPL-3.0+",
|
"license": "AGPL-3.0+",
|
||||||
"authors": [
|
"authors": [
|
||||||
@@ -47,10 +47,11 @@
|
|||||||
"toteph42/identity_switch": "*"
|
"toteph42/identity_switch": "*"
|
||||||
},
|
},
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/Gecka-apps/ident_switch/issues"
|
"issues": "https://github.com/Gecka-Apps/roundcube-ident_switch/issues"
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"roundcube": {
|
"roundcube": {
|
||||||
|
"plugin-name": "ident_switch",
|
||||||
"min-version": "1.6",
|
"min-version": "1.6",
|
||||||
"sql-dir": "SQL"
|
"sql-dir": "SQL"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,11 @@ function plugin_switchIdent_addCbElastic($wrapper, $sw) {
|
|||||||
/**
|
/**
|
||||||
* Perform account switch via AJAX (called from <select> onchange).
|
* Perform account switch via AJAX (called from <select> onchange).
|
||||||
*/
|
*/
|
||||||
|
var ident_switch_switching = false;
|
||||||
|
|
||||||
function plugin_switchIdent_switch(val) {
|
function plugin_switchIdent_switch(val) {
|
||||||
|
if (ident_switch_switching) return;
|
||||||
|
ident_switch_switching = true;
|
||||||
rcmail.env.unread_counts = {};
|
rcmail.env.unread_counts = {};
|
||||||
rcmail.http_post('plugin.ident_switch.switch', {
|
rcmail.http_post('plugin.ident_switch.switch', {
|
||||||
'_ident-id': val,
|
'_ident-id': val,
|
||||||
@@ -167,7 +171,7 @@ function ident_switch_updateCounts(data) {
|
|||||||
|
|
||||||
if (map[iid] === undefined) continue;
|
if (map[iid] === undefined) continue;
|
||||||
var selectVal = '' + map[iid];
|
var selectVal = '' + map[iid];
|
||||||
var $opt = $select.find('option[value="' + selectVal + '"]');
|
var $opt = $select.find('option').filter(function() { return $(this).val() === selectVal; });
|
||||||
if (!$opt.length) continue;
|
if (!$opt.length) continue;
|
||||||
|
|
||||||
// Skip active account on mail task
|
// Skip active account on mail task
|
||||||
@@ -295,8 +299,9 @@ function plugin_switchIdent_filterFrom() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// If selected option was removed, select the first remaining
|
// If selected option was removed, select the first remaining
|
||||||
if (allowed.indexOf(currentVal) === -1) {
|
var $remaining = $from.find('option:first');
|
||||||
$from.val($from.find('option:first').val()).trigger('change');
|
if (allowed.indexOf(currentVal) === -1 && $remaining.length) {
|
||||||
|
$from.val($remaining.val()).trigger('change');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ class ident_switch extends rcube_plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
$lbl = $r['label'] ?: $r['username'] ?: $r['email'];
|
$lbl = $r['label'] ?: $r['username'] ?: $r['email'];
|
||||||
$accNames[] = rcube::Q($lbl);
|
$accNames[] = $lbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($accValues) <= 1) {
|
if (count($accValues) <= 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user