Compare commits
110 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
afc4f54594 | ||
|
|
7795a0fbf9 | ||
|
|
6fa82d6ba5 | ||
|
|
fff6c6b95a | ||
|
|
92d0f40e3c | ||
|
|
33555a94d4 | ||
|
|
5f6f2eb095 | ||
|
|
2e09a92bc3 | ||
|
|
072ef65fdf | ||
|
|
cb7936bf71 | ||
|
|
46f58d694f | ||
|
|
07d1366825 | ||
|
|
b8a751c4ff | ||
|
|
312026b059 | ||
|
|
f54d9c9618 | ||
|
|
8176ab9c26 | ||
|
|
dbb50903d9 | ||
|
|
fa0d0c1684 | ||
|
|
0342dd4975 | ||
|
|
98e0f16836 | ||
|
|
f1d2e3193a | ||
|
|
f30f72099b | ||
|
|
67fc6b8b66 | ||
|
|
abc3c9ea5f | ||
|
|
148052a6d0 | ||
|
|
7bb10e55d7 | ||
|
|
ac32196fc0 | ||
|
|
ebc4324ecd | ||
|
|
c0a92bb436 | ||
|
|
652d1aaa1f | ||
|
|
6f86e64442 | ||
|
|
080a2ee591 | ||
|
|
4a20b77edb | ||
|
|
89791e1f49 | ||
|
|
c2380e630b | ||
|
|
a062f5ebb5 | ||
|
|
f164ccfd05 | ||
|
|
34fd9ca6f6 | ||
|
|
6ba63dfe50 | ||
|
|
e79ec4e45b | ||
|
|
f1bd9679da | ||
|
|
68164414c2 | ||
|
|
d8ea3d5539 | ||
|
|
a4dc73c6a7 | ||
|
|
f796334126 | ||
|
|
d65ad79709 | ||
|
|
43a9ed178e | ||
|
|
cc68ab1521 | ||
|
|
ea21509f2a | ||
|
|
24a9584d6f | ||
|
|
bcea012af0 | ||
|
|
a437a107ba | ||
|
|
8b2798e412 | ||
|
|
c28305509f | ||
|
|
8a8bca1ae5 | ||
|
|
28d7841af5 | ||
|
|
707abf2a81 | ||
|
|
c90efaa00b | ||
|
|
e4aeef2e07 | ||
|
|
e19b33a842 | ||
|
|
d540de77ff | ||
|
|
913065548b | ||
|
|
683b02027b | ||
|
|
7111e9e759 | ||
|
|
f5f3fbdf90 | ||
|
|
fcdff0ccc7 | ||
|
|
0e0b00dea2 | ||
|
|
c76942a6cd | ||
|
|
17044fe501 | ||
|
|
f644b80c0e | ||
|
|
dd2d8e10a4 | ||
|
|
8ca4d3bf56 | ||
|
|
829615ec5d | ||
|
|
6285d0bffd | ||
|
|
a3ccfb5a8f | ||
|
|
08f6c86773 | ||
|
|
8b527820e9 | ||
|
|
b3adf0842f | ||
|
|
deac908a77 | ||
|
|
f1874e3fe7 | ||
|
|
5096826621 | ||
|
|
7a97816d1c | ||
|
|
6849c47fd9 | ||
|
|
ecbadcd866 | ||
|
|
9ebacf0d61 | ||
|
|
ab7bae56b5 | ||
|
|
d93dd2be03 | ||
|
|
f7b650db3e | ||
|
|
4da9b48776 | ||
|
|
d667518d1f | ||
|
|
5ad75ce989 | ||
|
|
dbadde3333 | ||
|
|
b499688318 | ||
|
|
6cfbeab7f0 | ||
|
|
b10f3625c2 | ||
|
|
f28fb5bb58 | ||
|
|
1b424b4348 | ||
|
|
6705312240 | ||
|
|
05ea494fa6 | ||
|
|
5a704f2717 | ||
|
|
01edffa66b | ||
|
|
9367409f36 | ||
|
|
bbf28eed57 | ||
|
|
ec71910156 | ||
|
|
f700593730 | ||
|
|
9db4f48593 | ||
|
|
2b9c43858e | ||
|
|
95716183d7 | ||
|
|
40e7f5664e | ||
|
|
ea62869891 |
8
.gitattributes
vendored
Normal file
8
.gitattributes
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
* text=auto
|
||||||
|
|
||||||
|
*.sql text
|
||||||
|
*.php text
|
||||||
|
*.inc text
|
||||||
|
*.js text
|
||||||
|
*.md text
|
||||||
|
*.php.dist text
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
*.swp
|
*.swp
|
||||||
|
.vscode
|
||||||
33
README.md
33
README.md
@@ -1,6 +1,37 @@
|
|||||||
# ident_switch
|
# ident_switch
|
||||||
ident_switch plugin for Roundcube
|
ident_switch plugin for Roundcube
|
||||||
|
|
||||||
This plugin allows users to switch between different accounts (including remote) in single Roundcube session.
|
This plugin allows users to switch between different accounts (including remote) in single Roundcube session like this:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
*Inspired by identities_imap plugin that is no longer supported.*
|
*Inspired by identities_imap plugin that is no longer supported.*
|
||||||
|
|
||||||
|
### Where to start ###
|
||||||
|
* In settings interface create new identity.
|
||||||
|
* For all identities except default you will see new section of settings - "Plugin ident_switch" (see screenshot below). Enter data required to connect to remote server. Don't forget to check Enabled check box.
|
||||||
|
* After you have created at least one identity with active plugin you will see combobox in the top right corner instead of plain text field with account name. It will allows you to switch to another account.
|
||||||
|
|
||||||
|
### Settings ###
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
* **Enabled** - enables plugin (i.e. account switcing) for this identity.
|
||||||
|
* **Label** - text that will be displayed in drop down list for this identity. If left blank email will be used.
|
||||||
|
* **IMAP**
|
||||||
|
* **Server host name** - host name for imap server. If left blank 'localhost' will be used.
|
||||||
|
* **Port** - port on server to connect to. If left blank 143 will be used.
|
||||||
|
* **Secure connection** - enabled secure connection (TLS) *for both IMAP and SMTP*.
|
||||||
|
* **Username** - login used *for IMAP and SMTP servers*.
|
||||||
|
* **Password** - password used *for IMAP and SMTP servers*. It's stored encrypted in database.
|
||||||
|
* **SMTP**
|
||||||
|
* **Server host name** - host name for imap server. If left blank 'localhost' will be used.
|
||||||
|
* **Port** - port on server to connect to. If left blank 587 will be used.
|
||||||
|
|
||||||
|
### Version compatibility ###
|
||||||
|
* Versions 1.X (not supported any more) - for Roundcube v1.1
|
||||||
|
* Versions 2.X (not supported any more) - for Roundcube v1.2
|
||||||
|
* Versions 3.X (not supported any more) - for Roundcube v1.3
|
||||||
|
* Versions 4.x - for Roundcube v1.3 and 1.4.
|
||||||
|
|
||||||
|
Please specify version like "~2.0" in your composer.json file for ident_switch requirement. In this case you will stay inside compatible branch until you manually update your Roundcube installation.
|
||||||
|
|||||||
54
SQL/mysql.initial.sql
Normal file
54
SQL/mysql.initial.sql
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS `ident_switch`
|
||||||
|
(
|
||||||
|
`id`
|
||||||
|
int(10) UNSIGNED
|
||||||
|
NOT NULL
|
||||||
|
AUTO_INCREMENT,
|
||||||
|
`user_id`
|
||||||
|
int(10) UNSIGNED
|
||||||
|
NOT NULL,
|
||||||
|
`iid`
|
||||||
|
int(10) UNSIGNED
|
||||||
|
NOT NULL,
|
||||||
|
`username`
|
||||||
|
varchar(64),
|
||||||
|
`password`
|
||||||
|
varchar(64),
|
||||||
|
`imap_host`
|
||||||
|
varchar(64),
|
||||||
|
`imap_port`
|
||||||
|
int
|
||||||
|
CHECK(`imap_port` > 0 AND `imap_port` <= 65535),
|
||||||
|
`imap_delimiter`
|
||||||
|
char(1),
|
||||||
|
`label`
|
||||||
|
varchar(32),
|
||||||
|
`flags`
|
||||||
|
int
|
||||||
|
NOT NULL
|
||||||
|
DEFAULT 0,
|
||||||
|
`smtp_host`
|
||||||
|
varchar(64),
|
||||||
|
`smtp_port`
|
||||||
|
int
|
||||||
|
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 KEY `user_id_label` (`user_id`, `label`),
|
||||||
|
CONSTRAINT `fk_user_id` FOREIGN KEY (`user_id`) REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT `fk_identity_id` FOREIGN KEY (`iid`) REFERENCES `identities`(`identity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
|
PRIMARY KEY(`id`),
|
||||||
|
INDEX `IX_ident_switch_user_id`(`user_id`),
|
||||||
|
INDEX `IX_ident_switch_iid`(`iid`)
|
||||||
|
);
|
||||||
|
|
||||||
5
SQL/mysql/2016060200.sql
Normal file
5
SQL/mysql/2016060200.sql
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
ALTER TABLE
|
||||||
|
`ident_switch`
|
||||||
|
MODIFY
|
||||||
|
`username`
|
||||||
|
varchar(64);
|
||||||
6
SQL/mysql/2018071600.sql
Normal file
6
SQL/mysql/2018071600.sql
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
ALTER TABLE
|
||||||
|
`ident_switch`
|
||||||
|
MODIFY
|
||||||
|
`username`
|
||||||
|
varchar(64)
|
||||||
|
NULL;
|
||||||
29
SQL/mysql/2018121800.sql
Normal file
29
SQL/mysql/2018121800.sql
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
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`;
|
||||||
5
SQL/mysql/2019112000.sql
Normal file
5
SQL/mysql/2019112000.sql
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
ALTER TABLE
|
||||||
|
`ident_switch`
|
||||||
|
ADD COLUMN
|
||||||
|
`imap_delimiter`
|
||||||
|
char(1);
|
||||||
14
SQL/mysql/2019121300.sql
Normal file
14
SQL/mysql/2019121300.sql
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
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);
|
||||||
7
SQL/mysql/2020060100.sql
Normal file
7
SQL/mysql/2020060100.sql
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
ALTER TABLE
|
||||||
|
`ident_switch`
|
||||||
|
ADD COLUMN
|
||||||
|
`smtp_auth`
|
||||||
|
smallint
|
||||||
|
NOT NULL
|
||||||
|
DEFAULT 1;
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
CREATE TABLE ident_switch
|
|
||||||
(
|
|
||||||
id
|
|
||||||
serial
|
|
||||||
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)
|
|
||||||
NOT NULL,
|
|
||||||
password
|
|
||||||
varchar(64),
|
|
||||||
host
|
|
||||||
varchar(64)
|
|
||||||
NOT NULL,
|
|
||||||
port
|
|
||||||
integer
|
|
||||||
CHECK(port > 0 AND port <= 65535),
|
|
||||||
delimiter
|
|
||||||
char(1),
|
|
||||||
label
|
|
||||||
varchar(32)
|
|
||||||
NOT NULL,
|
|
||||||
flags
|
|
||||||
integer
|
|
||||||
NOT NULL
|
|
||||||
DEFAULT(0),
|
|
||||||
UNIQUE (user_id, label)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE INDEX
|
|
||||||
IX_ident_switch_user_id
|
|
||||||
ON
|
|
||||||
ident_switch(user_id);
|
|
||||||
55
SQL/postgres.initial.sql
Normal file
55
SQL/postgres.initial.sql
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
CREATE TABLE ident_switch
|
||||||
|
(
|
||||||
|
id
|
||||||
|
serial
|
||||||
|
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);
|
||||||
11
SQL/postgres/2016052000.sql
Normal file
11
SQL/postgres/2016052000.sql
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
ALTER TABLE
|
||||||
|
ident_switch
|
||||||
|
ALTER COLUMN
|
||||||
|
host
|
||||||
|
DROP NOT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE
|
||||||
|
ident_switch
|
||||||
|
ALTER COLUMN
|
||||||
|
label
|
||||||
|
DROP NOT NULL;
|
||||||
5
SQL/postgres/2016060200.sql
Normal file
5
SQL/postgres/2016060200.sql
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
ALTER TABLE
|
||||||
|
ident_switch
|
||||||
|
ALTER COLUMN
|
||||||
|
username
|
||||||
|
DROP NOT NULL;
|
||||||
5
SQL/postgres/2018081600.sql
Normal file
5
SQL/postgres/2018081600.sql
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
ALTER TABLE
|
||||||
|
ident_switch
|
||||||
|
ALTER COLUMN
|
||||||
|
username
|
||||||
|
DROP NOT NULL;
|
||||||
31
SQL/postgres/2018121800.sql
Normal file
31
SQL/postgres/2018121800.sql
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
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;
|
||||||
5
SQL/postgres/2019112000.sql
Normal file
5
SQL/postgres/2019112000.sql
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
ALTER TABLE
|
||||||
|
ident_switch
|
||||||
|
ADD COLUMN
|
||||||
|
imap_delimiter
|
||||||
|
char(1);
|
||||||
14
SQL/postgres/2019121300.sql
Normal file
14
SQL/postgres/2019121300.sql
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
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);
|
||||||
7
SQL/postgres/2020060100.sql
Normal file
7
SQL/postgres/2020060100.sql
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
ALTER TABLE
|
||||||
|
ident_switch
|
||||||
|
ADD COLUMN
|
||||||
|
smtp_auth
|
||||||
|
smallint
|
||||||
|
NOT NULL
|
||||||
|
DEFAULT(1);
|
||||||
52
SQL/sqlite.initial.sql
Normal file
52
SQL/sqlite.initial.sql
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
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);
|
||||||
76
SQL/sqlite/2018121800.sql
Normal file
76
SQL/sqlite/2018121800.sql
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
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;
|
||||||
92
SQL/sqlite/2020121600.sql
Normal file
92
SQL/sqlite/2020121600.sql
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
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;
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
"homepage": "https://bitbucket.org/BoresExpress/ident_switch",
|
"homepage": "https://bitbucket.org/BoresExpress/ident_switch",
|
||||||
"keywords": ["identity", "imap", "mail", "switch"],
|
"keywords": ["identity", "imap", "mail", "switch"],
|
||||||
"license": "GPL-3.0+",
|
"license": "GPL-3.0+",
|
||||||
|
"version": "4.3",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Boris Gulay",
|
"name": "Boris Gulay",
|
||||||
@@ -19,8 +20,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3.0",
|
"php": ">=5.3.0",
|
||||||
"roundcube/plugin-installer": ">=0.1.3"
|
"roundcube/plugin-installer": ">=0.1.3",
|
||||||
|
"ext-ctype": "*"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"elm/identity_smtp": "*"
|
"elm/identity_smtp": "*"
|
||||||
@@ -30,7 +32,7 @@
|
|||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"roundcube": {
|
"roundcube": {
|
||||||
"min-version": "1.1",
|
"min-version": "1.3",
|
||||||
"sql-dir": "SQL"
|
"sql-dir": "SQL"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +1,29 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Preconfigured settings for different mail domains.
|
||||||
|
* Appropriate set of values is searched by mapping domain of email (from identity) to array key.
|
||||||
|
*/
|
||||||
|
$rcmail_config['ident_switch.preconfig'] = array(
|
||||||
|
|
||||||
|
# Domain part of email address
|
||||||
|
'domain.tld' => array(
|
||||||
|
|
||||||
|
# Hostname, use ssl:// or tls:// notation if needed, for no security use imap:// (must always start with scheme).
|
||||||
|
# Required.
|
||||||
|
'host' => 'imap://mail.domain.tld',
|
||||||
|
|
||||||
|
# Login name, can be 'email' (full address from identity), 'mbox' (only mailbox part).
|
||||||
|
# Any other value is threated ad 'not specified' (default).
|
||||||
|
'user' => 'email',
|
||||||
|
|
||||||
|
# Are specified settings locked in interface or not.
|
||||||
|
# Default - false.
|
||||||
|
'readonly' => true
|
||||||
|
),
|
||||||
|
|
||||||
|
'another.tld' => array(
|
||||||
|
'host' => 'tls://mail.another.tld',
|
||||||
|
'user' => 'mbox',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|||||||
35
ident_switch-form.js
Normal file
35
ident_switch-form.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* This is part of identity_imap plugin
|
||||||
|
*/
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
$("INPUT[name='_ident_switch.form.common.enabled']").change();
|
||||||
|
plugin_switchIdent_processPreconfig();
|
||||||
|
});
|
||||||
|
|
||||||
|
function plugin_switchIdent_processPreconfig() {
|
||||||
|
var disFld = $("INPUT[name='_ident_switch.form.common.readonly']");
|
||||||
|
disFld.parentsUntil("TABLE", "TR").hide();
|
||||||
|
|
||||||
|
var disVal = disFld.val();
|
||||||
|
if (disVal > 0) {
|
||||||
|
$("INPUT[name='_ident_switch.form.imap.host']").prop("disabled", true);
|
||||||
|
$("SELECT[name='_ident_switch.form.imap.tls']").prop("disabled", true);
|
||||||
|
$("INPUT[name='_ident_switch.form.imap.port']").prop("disabled", true);
|
||||||
|
|
||||||
|
$("INPUT[name='_ident_switch.form.smtp.host']").prop("disabled", true);
|
||||||
|
$("SELECT[name='_ident_switch.form.smtp.tls']").prop("disabled", true);
|
||||||
|
$("INPUT[name='_ident_switch.form.smtp.port']").prop("disabled", true);
|
||||||
|
}
|
||||||
|
if (2 == disVal) {
|
||||||
|
$("INPUT[name='_ident_switch.form.imap.username']").prop("disabled", true);
|
||||||
|
$("INPUT[name='_ident_switch.form.smtp.username']").prop("disabled", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function plugin_switchIdent_enabled_onChange(e) {
|
||||||
|
var $enFld = $("INPUT[name='_ident_switch.form.common.enabled'], INPUT[name='_ident_switch.form.imap.host'], INPUT[name='_ident_switch.form.smtp.host']");
|
||||||
|
$("INPUT[name!='_ident_switch.form.common.enabled']", $enFld.parents("FIELDSET")).prop("disabled", !$enFld.is(":checked"));
|
||||||
|
plugin_switchIdent_processPreconfig();
|
||||||
|
}
|
||||||
1
ident_switch-form.min.js
vendored
Normal file
1
ident_switch-form.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
$(function(){$("INPUT[name='_ident_switch.form.common.enabled']").change();plugin_switchIdent_processPreconfig()});function plugin_switchIdent_processPreconfig(){var a=$("INPUT[name='_ident_switch.form.common.readonly']");a.parentsUntil("TABLE","TR").hide();var b=a.val();if(b>0){$("INPUT[name='_ident_switch.form.imap.host']").prop("disabled",true);$("SELECT[name='_ident_switch.form.imap.tls']").prop("disabled",true);$("INPUT[name='_ident_switch.form.imap.port']").prop("disabled",true);$("INPUT[name='_ident_switch.form.smtp.host']").prop("disabled",true);$("SELECT[name='_ident_switch.form.smtp.tls']").prop("disabled",true);$("INPUT[name='_ident_switch.form.smtp.port']").prop("disabled",true)}if(2==b){$("INPUT[name='_ident_switch.form.imap.username']").prop("disabled",true);$("INPUT[name='_ident_switch.form.smtp.username']").prop("disabled",true)}}function plugin_switchIdent_enabled_onChange(a){var b=$("INPUT[name='_ident_switch.form.common.enabled'], INPUT[name='_ident_switch.form.imap.host'], INPUT[name='_ident_switch.form.smtp.host']");$("INPUT[name!='_ident_switch.form.common.enabled']",b.parents("FIELDSET")).prop("disabled",!b.is(":checked"));plugin_switchIdent_processPreconfig()};
|
||||||
71
ident_switch-switch.js
Normal file
71
ident_switch-switch.js
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* This is part of identity_imap plugin
|
||||||
|
*/
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
$sw = $('#plugin-ident_switch-account');
|
||||||
|
isOk = false;
|
||||||
|
|
||||||
|
switch (rcmail.env['skin']) {
|
||||||
|
case 'larry':
|
||||||
|
isOk = plugin_switchIdent_addCbLarry($sw);
|
||||||
|
break;
|
||||||
|
case 'classic':
|
||||||
|
isOk = plugin_switchIdent_addCbClassic($sw);
|
||||||
|
break;
|
||||||
|
case 'elastic':
|
||||||
|
isOk = plugin_switchIdent_addCbElastic($sw);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isOk)
|
||||||
|
$sw.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
function plugin_switchIdent_addCbLarry($sw) {
|
||||||
|
var $truName = $('.topright .username');
|
||||||
|
if ($truName.length > 0) {
|
||||||
|
if ($sw.length > 0) {
|
||||||
|
$sw.prependTo('.topright');
|
||||||
|
$truName.hide();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function plugin_switchIdent_addCbClassic($sw) {
|
||||||
|
var $taskBar = $('#taskbar');
|
||||||
|
if ($taskBar.length > 0) {
|
||||||
|
$taskBar.prepend($sw);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function plugin_switchIdent_addCbElastic($sw) {
|
||||||
|
var $taskBar = $('.header-title.username');
|
||||||
|
$sw.css("background-color", "transparent").css("border","none");
|
||||||
|
$sw.css("background-position-x","left 0.75rem").css("padding","0 0 0 2rem");
|
||||||
|
$sw.css("font-weight","bold").css("box-shadow","none");
|
||||||
|
if ($taskBar.length > 0) {
|
||||||
|
$taskBar.prepend($sw);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function plugin_switchIdent_switch(val) {
|
||||||
|
rcmail.env.unread_counts = {};
|
||||||
|
console.log(rcmail.env.unread_counts);
|
||||||
|
rcmail.http_post('plugin.ident_switch.switch', { '_ident-id': val, '_mbox': rcmail.env.mailbox });
|
||||||
|
}
|
||||||
|
|
||||||
|
function plugin_switchIdent_fixIdent(iid) {
|
||||||
|
if (parseInt(iid) > 0)
|
||||||
|
$("#_from").val(iid);
|
||||||
|
}
|
||||||
1
ident_switch-switch.min.js
vendored
Normal file
1
ident_switch-switch.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
$(function(){$sw=$("#plugin-ident_switch-account");isOk=false;switch(rcmail.env.skin){case"larry":isOk=plugin_switchIdent_addCbLarry($sw);break;case"classic":isOk=plugin_switchIdent_addCbClassic($sw);break;case"elastic":isOk=plugin_switchIdent_addCbElastic($sw);break}if(isOk){$sw.show()}});function plugin_switchIdent_addCbLarry(b){var a=$(".topright .username");if(a.length>0){if(b.length>0){b.prependTo(".topright");a.hide();return true}}return false}function plugin_switchIdent_addCbClassic(b){var a=$("#taskbar");if(a.length>0){a.prepend(b);return true}return false}function plugin_switchIdent_addCbElastic(b){var a=$(".header-title.username");b.css("background-color","transparent").css("border","none");b.css("background-position-x","left 0.75rem").css("padding","0 0 0 2rem");b.css("font-weight","bold").css("box-shadow","none");if(a.length>0){a.prepend(b);return true}return false}function plugin_switchIdent_switch(a){rcmail.env.unread_counts={};console.log(rcmail.env.unread_counts);rcmail.http_post("plugin.ident_switch.switch",{"_ident-id":a,_mbox:rcmail.env.mailbox})}function plugin_switchIdent_fixIdent(a){if(parseInt(a)>0){$("#_from").val(a)}};
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
/*
|
|
||||||
* This is part of identity_imap plugin
|
|
||||||
*/
|
|
||||||
$(function() {
|
|
||||||
if ($('#plugin-ident_switch-account').size() > 0) {
|
|
||||||
$('#plugin-ident_switch-account').prependTo('.topright');
|
|
||||||
$('.topright .username').hide();
|
|
||||||
$('#plugin-ident_switch-account').show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function plugin_switchIdent_switch(val) {
|
|
||||||
console.log("qwe1");
|
|
||||||
rcmail.http_post('plugin.ident_switch.switch', { '_ident-id': val });
|
|
||||||
}
|
|
||||||
|
|
||||||
function plugin_switchIdent_fixIdent(iid) {
|
|
||||||
if (parseInt(iid) > 0)
|
|
||||||
$("#_from").val(iid);
|
|
||||||
}
|
|
||||||
831
ident_switch.php
831
ident_switch.php
@@ -12,12 +12,17 @@ class ident_switch extends rcube_plugin
|
|||||||
{
|
{
|
||||||
public $task='?(?!login|logout).*';
|
public $task='?(?!login|logout).*';
|
||||||
|
|
||||||
private $table = 'ident_switch';
|
const TABLE = 'ident_switch';
|
||||||
private $my_postfix = '_iswitch';
|
const MY_POSTFIX = '_iswitch';
|
||||||
|
|
||||||
// Flags user in database
|
// Flags user in database
|
||||||
private $db_enabled = 1;
|
const DB_ENABLED = 1;
|
||||||
private $db_secure = 2;
|
//const DB_SECURE_SSL = 2; // Not supported any more
|
||||||
|
const DB_SECURE_IMAP_TLS = 4;
|
||||||
|
|
||||||
|
// SMTP auth values
|
||||||
|
const SMTP_AUTH_IMAP = 1;
|
||||||
|
const SMTP_AUTH_NONE = 2;
|
||||||
|
|
||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
@@ -26,18 +31,29 @@ class ident_switch extends rcube_plugin
|
|||||||
$this->add_hook('smtp_connect', array($this, 'on_smtp_connect'));
|
$this->add_hook('smtp_connect', array($this, 'on_smtp_connect'));
|
||||||
$this->add_hook('identity_form', array($this, 'on_identity_form'));
|
$this->add_hook('identity_form', array($this, 'on_identity_form'));
|
||||||
$this->add_hook('identity_update', array($this, 'on_identity_update'));
|
$this->add_hook('identity_update', array($this, 'on_identity_update'));
|
||||||
|
$this->add_hook('identity_create', array($this, 'on_identity_create'));
|
||||||
|
$this->add_hook('identity_create_after', array($this, 'on_identity_create_after'));
|
||||||
$this->add_hook('identity_delete', array($this, 'on_identity_delete'));
|
$this->add_hook('identity_delete', array($this, 'on_identity_delete'));
|
||||||
$this->add_hook('template_object_composeheaders', array($this, 'on_template_object_composeheaders'));
|
$this->add_hook('template_object_composeheaders', array($this, 'on_template_object_composeheaders'));
|
||||||
|
$this->add_hook('preferences_list', array($this, 'on_special_folders_form'));
|
||||||
|
$this->add_hook('preferences_save', array($this, 'on_special_folders_update'));
|
||||||
|
|
||||||
$this->register_action('plugin.ident_switch.switch', array($this, 'on_switch'));
|
$this->register_action('plugin.ident_switch.switch', array($this, 'on_switch'));
|
||||||
|
|
||||||
|
$rc = rcmail::get_instance();
|
||||||
|
foreach (rcube_storage::$folder_types as $type)
|
||||||
|
{
|
||||||
|
$key = $type . '_mbox_default' . self::MY_POSTFIX;
|
||||||
|
if (!$_SESSION[$key])
|
||||||
|
$_SESSION[$key] = $rc->config->get($type . '_mbox');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function on_startup($args)
|
function on_startup($args)
|
||||||
{
|
{
|
||||||
$rc = rcmail::get_instance();
|
$rc = rcmail::get_instance();
|
||||||
error_log('Task: ' . $args['task'] . ', action: ' . $args['action']);
|
|
||||||
|
|
||||||
if (strcasecmp($rc->user->data['username'], $_SESSION['username']) !== 1)
|
if (strcasecmp($rc->user->data['username'], $_SESSION['username']) !== 0)
|
||||||
{ // We are impersonating
|
{ // We are impersonating
|
||||||
$rc->config->set('imap_cache', null);
|
$rc->config->set('imap_cache', null);
|
||||||
$rc->config->set('messages_cache', false);
|
$rc->config->set('messages_cache', false);
|
||||||
@@ -49,117 +65,239 @@ class ident_switch extends rcube_plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (rcube_storage::$folder_types as $type)
|
||||||
|
{
|
||||||
|
$defaultKey = $type . '_mbox_default' . self::MY_POSTFIX;
|
||||||
|
$otherKey = $type . '_mbox' . self::MY_POSTFIX;
|
||||||
|
$val = $_SESSION[$otherKey] ? $_SESSION[$otherKey] : $_SESSION[$defaultKey];
|
||||||
|
$rc->config->set($type . '_mbox', $val);
|
||||||
|
}
|
||||||
|
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
|
|
||||||
function on_render_page($args)
|
function on_render_page($args)
|
||||||
{
|
{
|
||||||
$rc = rcmail::get_instance();
|
$rc = rcmail::get_instance();
|
||||||
error_log('Template: ' . $args['template']);
|
|
||||||
|
switch ($rc->task)
|
||||||
|
{
|
||||||
|
case 'mail':
|
||||||
|
$this->render_switch($rc, $args);
|
||||||
|
break;
|
||||||
|
case 'settings':
|
||||||
|
$this->include_script('ident_switch-form.js');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $args;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function render_switch($rc, $args)
|
||||||
|
{
|
||||||
|
// Currently selected identity
|
||||||
|
$iid_s = $_SESSION['iid' . self::MY_POSTFIX];
|
||||||
|
|
||||||
|
$iid = 0;
|
||||||
|
if (is_int($iid_s))
|
||||||
|
$iid = $iid_s;
|
||||||
|
elseif ($iid_s === '-1')
|
||||||
|
$iid = -1;
|
||||||
|
elseif (ctype_digit($iid_s))
|
||||||
|
$iid = intval($iid_s);
|
||||||
|
|
||||||
|
$accNames = array($_SESSION['global_alias'] ? $_SESSION['global_alias'] : $rc->user->data['username']);
|
||||||
|
$accValues = array(-1);
|
||||||
|
$accSelected = -1;
|
||||||
|
|
||||||
// Get list of alternative accounts
|
// Get list of alternative accounts
|
||||||
$sOpt = '';
|
$sql = "SELECT "
|
||||||
$sql = 'SELECT id, label, username FROM ' . $rc->db->table_name($this->table) . ' WHERE user_id = ? AND flags & ? > 0';
|
. "isw.id, isw.iid, isw.label, isw.username, ii.email"
|
||||||
$q = $rc->db->query($sql, $rc->user->data['user_id'], $this->db_enabled);
|
. " FROM"
|
||||||
while ($r = $rc->db->fetch_assoc($q))
|
. " {$rc->db->table_name(self::TABLE)} isw"
|
||||||
|
. " INNER JOIN {$rc->db->table_name('identities')} ii ON isw.iid=ii.identity_id"
|
||||||
|
. " WHERE isw.user_id = ? AND isw.flags & ? > 0";
|
||||||
|
$qRec = $rc->db->query($sql, $rc->user->data['user_id'], self::DB_ENABLED);
|
||||||
|
while ($r = $rc->db->fetch_assoc($qRec))
|
||||||
{
|
{
|
||||||
$opts = array('value' => $r['id']);
|
$accValues[] = $r['id'];
|
||||||
if (strcasecmp($_SESSION['username'], $r['username']) === 0)
|
if ($iid == $r['iid'])
|
||||||
$opts['selected'] = 'selected';
|
$accSelected = $r['id'];
|
||||||
|
|
||||||
$sOpt .= html::tag(
|
// Make label
|
||||||
'option',
|
$lbl = $r['label'];
|
||||||
$opts,
|
if (!$lbl)
|
||||||
$r['label']
|
{
|
||||||
);
|
if (!$r['username'])
|
||||||
|
$r['username'] = $r['email'];
|
||||||
|
|
||||||
|
if (strpos($r['username'], '@') === false)
|
||||||
|
$lbl = $r['username'] . '@' . ($r['host'] ? $r['host'] : 'localhost');
|
||||||
|
else
|
||||||
|
$lbl = $r['username'];
|
||||||
|
}
|
||||||
|
$accNames[] = rcube::Q($lbl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render UI if user has extra accounts
|
// Render UI if user has extra accounts
|
||||||
if (!empty($sOpt))
|
if (count($accValues) > 1)
|
||||||
{
|
{
|
||||||
|
$this->include_script('ident_switch-switch.js');
|
||||||
|
|
||||||
// Add main account
|
$select = new html_select(array(
|
||||||
$opts = array('value' => -1);
|
'id' => 'plugin-ident_switch-account',
|
||||||
if (strcasecmp($_SESSION['username'], $rc->user->data['username']) === 0)
|
'style' => 'display: none; padding: 0;',
|
||||||
$opts['selected'] = 'selected';
|
'onchange' => 'plugin_switchIdent_switch(this.value);',
|
||||||
|
));
|
||||||
|
$select->add($accNames, $accValues);
|
||||||
|
$rc->output->add_footer($select->show(array($accSelected)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$sOpt = html::tag(
|
function on_smtp_connect($args)
|
||||||
'option',
|
{
|
||||||
$opts,
|
$iid = $_SESSION['iid' . self::MY_POSTFIX];
|
||||||
$_SESSION['global_alias'] ? $_SESSION['global_alias'] : $rc->user->data['username']
|
if (!is_numeric($iid) || $iid == -1)
|
||||||
) . $sOpt;
|
return $args;
|
||||||
|
|
||||||
$this->include_script('ident_switch.js');
|
$rc = rcmail::get_instance();
|
||||||
$sw = html::tag(
|
|
||||||
'select',
|
$sql = 'SELECT smtp_host, flags, smtp_port, username, smtp_auth, password FROM ' . $rc->db->table_name(self::TABLE) . ' WHERE iid = ? AND user_id = ?';
|
||||||
array(
|
$q = $rc->db->query($sql, $iid ,$rc->user->ID);
|
||||||
'id' => 'plugin-ident_switch-account',
|
$r = $rc->db->fetch_assoc($q);
|
||||||
'style' => 'display: none;',
|
if (is_array($r))
|
||||||
'onchange' => 'plugin_switchIdent_switch(this.value);',
|
{
|
||||||
),
|
if (!$r['username'])
|
||||||
$sOpt
|
{ // Load email from identity
|
||||||
);
|
$sql = 'SELECT email FROM ' . $rc->db->table_name('identities') . ' WHERE identity_id = ?';
|
||||||
$rc->output->add_footer($sw);
|
$q = $rc->db->query($sql, $iid);
|
||||||
|
$rIid = $rc->db->fetch_assoc($q);
|
||||||
|
|
||||||
|
$r['username'] = $rIid['email'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$args['smtp_user'] = $r['username'];
|
||||||
|
$args['smtp_pass'] = $r['smtp_auth'] == self::SMTP_AUTH_IMAP ? $rc->decrypt($r['password']) : '';
|
||||||
|
$args['smtp_server'] = $r['smtp_host'] ? $r['smtp_host'] : 'localhost'; // Default SMTP host here
|
||||||
|
$args['smtp_port'] = $r['smtp_port'] ? $r['smtp_port'] : 587; // Default SMTP port here
|
||||||
|
|
||||||
|
if ($r['flags'] & self::DB_SECURE_IMAP_TLS)
|
||||||
|
{
|
||||||
|
if (strpos($args['smtp_server'], ':') !== false)
|
||||||
|
self::write_log('SMTP server already contains protocol, ignoring TLS flag.');
|
||||||
|
else
|
||||||
|
$args['smtp_server'] = 'tls://' . $args['smtp_server'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
|
|
||||||
function on_smtp_connect($args)
|
private static function get_common_form(&$record)
|
||||||
{
|
{
|
||||||
$rc = rcmail::get_instance();
|
$prefix = 'ident_switch.form.common.';
|
||||||
|
return array(
|
||||||
|
$prefix . 'enabled' => array('type' => 'checkbox', 'onchange' => 'plugin_switchIdent_enabled_onChange();'),
|
||||||
|
$prefix . 'label' => array('type' => 'text', 'size' => 32, 'placeholder' => $record['email']),
|
||||||
|
$prefix . 'readonly' => array('type' => 'hidden'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Rewrite with full settings!
|
private static function get_imap_form(&$record)
|
||||||
|
{
|
||||||
|
$prefix = 'ident_switch.form.imap.';
|
||||||
|
return array(
|
||||||
|
$prefix . 'host' => array('type' => 'text', 'size' => 64, 'placeholder' => 'localhost'),
|
||||||
|
$prefix . 'port' => array('type' => 'text', 'size' => 5, 'placeholder' => 143),
|
||||||
|
$prefix . 'tls' => array('type' => 'checkbox'),
|
||||||
|
$prefix . 'username' => array('type' => 'text', 'size' => 64, 'placeholder' => $record['email']),
|
||||||
|
$prefix . 'password' => array('type' => 'password', 'size' => 64),
|
||||||
|
$prefix . 'delimiter' => array('type' => 'text', 'size' => 1, 'placeholder' => '.'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (strcasecmp($rc->user->data['username'], $_SESSION['username']) !== 1)
|
private function get_smtp_form(&$record)
|
||||||
{
|
{
|
||||||
if ($args['smtp_user'] == '%u')
|
$prefix = 'ident_switch.form.smtp.';
|
||||||
$args['smtp_user'] = $rc->user->data['username'];
|
|
||||||
if ($args['smtp_pass'] == '%p')
|
|
||||||
$args['smtp_pass'] = $rc->decrypt($_SESSION['password' . $this->my_postfix]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $args;
|
$authType = new html_select(array('name' => "_{$prefix}auth"));
|
||||||
|
$authType->add($this->gettext('form.smtp.auth.imap'), self::SMTP_AUTH_IMAP);
|
||||||
|
$authType->add($this->gettext('form.smtp.auth.none'), self::SMTP_AUTH_NONE);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
$prefix . 'host' => array('type' => 'text', 'size' => 64, 'placeholder' => 'localhost'),
|
||||||
|
$prefix . 'port' => array('type' => 'text', 'size' => 5, 'placeholder' => 587),
|
||||||
|
$prefix . 'auth' => array('value' => $authType->show(array($record['ident_switch.form.smtp.auth']))),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function on_identity_form($args)
|
function on_identity_form($args)
|
||||||
{
|
{
|
||||||
$rc = rcmail::get_instance();
|
$rc = rcmail::get_instance();
|
||||||
|
|
||||||
|
// Do not show options for default identity
|
||||||
|
if (strcasecmp($args['record']['email'], $rc->user->data['username']) === 0)
|
||||||
|
return $args;
|
||||||
|
|
||||||
$this->add_texts('localization');
|
$this->add_texts('localization');
|
||||||
|
|
||||||
// Create our field set
|
$row = null;
|
||||||
$args['form']['ident_switch'] = array(
|
|
||||||
'name' => $this->gettext('form.caption'),
|
|
||||||
'content' => array(
|
|
||||||
'ident_switch.form.enabled' => array('type' => 'checkbox'),
|
|
||||||
'ident_switch.form.label' => array('type' => 'text', 'size' => 32),
|
|
||||||
'ident_switch.form.host' => array('type' => 'text', 'size' => 64),
|
|
||||||
'ident_switch.form.secure' => array('type' => 'checkbox'),
|
|
||||||
'ident_switch.form.port' => array('type' => 'text', 'size' => 5),
|
|
||||||
'ident_switch.form.username' => array('type' => 'text', 'size' => 64),
|
|
||||||
'ident_switch.form.password' => array('type' => 'password', 'size' => 64),
|
|
||||||
'ident_switch.form.delimiter' => array('type' => 'text', 'size' => 1),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Load data if exists
|
|
||||||
if (isset($args['record']['identity_id']))
|
if (isset($args['record']['identity_id']))
|
||||||
{
|
{
|
||||||
$sql = 'SELECT * FROM ' . $rc->db->table_name($this->table) . ' WHERE iid = ? AND user_id = ?';
|
$sql = 'SELECT * FROM ' . $rc->db->table_name(self::TABLE) . ' WHERE iid = ? AND user_id = ?';
|
||||||
$q = $rc->db->query($sql, $args['record']['identity_id'], $rc->user->ID);
|
$q = $rc->db->query($sql, $args['record']['identity_id'], $rc->user->ID);
|
||||||
$r = $rc->db->fetch_assoc($q);
|
$row = $rc->db->fetch_assoc($q);
|
||||||
if ($r)
|
}
|
||||||
{
|
|
||||||
foreach ($r as $k => $v)
|
|
||||||
$args['record']['ident_switch.form.' . $k] = $v;
|
|
||||||
|
|
||||||
// Parse flags
|
$record = &$args['record'];
|
||||||
if ($r['flags'] & $this->db_enabled)
|
|
||||||
$args['record']['ident_switch.form.enabled'] = true;
|
// Load data if exists
|
||||||
if ($r['flags'] & $this->db_secure)
|
if ($row)
|
||||||
$args['record']['ident_switch.form.secure'] = true;
|
{
|
||||||
|
$dbToForm = array(
|
||||||
|
'label' => 'common.label',
|
||||||
|
'imap_host' => 'imap.host',
|
||||||
|
'imap_port' => 'imap.port',
|
||||||
|
'imap_delimiter' => 'imap.delimiter',
|
||||||
|
'username' => 'imap.username',
|
||||||
|
'password' => 'imap.password',
|
||||||
|
'smtp_host' => 'smtp.host',
|
||||||
|
'smtp_port' => 'smtp.port',
|
||||||
|
'smtp_auth' => 'smtp.auth',
|
||||||
|
|
||||||
|
);
|
||||||
|
foreach ($row as $k => $v)
|
||||||
|
$record['ident_switch.form.' . $dbToForm[$k]] = $v;
|
||||||
|
|
||||||
|
// Parse flags
|
||||||
|
$record['ident_switch.form.common.enabled'] = !!($row['flags'] & self::DB_ENABLED);
|
||||||
|
$record['ident_switch.form.imap.tls'] = !!($row['flags'] & self::DB_SECURE_IMAP_TLS);
|
||||||
|
|
||||||
|
// Set readonly if needed
|
||||||
|
$cfg = $this->get_preconfig($record['email']);
|
||||||
|
if (is_array($cfg) && $cfg['readonly'])
|
||||||
|
{
|
||||||
|
$record['ident_switch.form.common.readonly'] = 1;
|
||||||
|
if (in_array(strtoupper($cfg['user']), array('EMAIL', 'MBOX')))
|
||||||
|
$record['ident_switch.form.common.readonly'] = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
$this->apply_preconfig($record);
|
||||||
|
|
||||||
|
$args['form']['ident_switch.common'] = array(
|
||||||
|
'name' => $this->gettext('form.common.caption'),
|
||||||
|
'content' => ident_switch::get_common_form($record)
|
||||||
|
);
|
||||||
|
$args['form']['ident_switch.imap'] = array(
|
||||||
|
'name' => $this->gettext('form.imap.caption'),
|
||||||
|
'content' => ident_switch::get_imap_form($record)
|
||||||
|
);
|
||||||
|
$args['form']['ident_switch.smtp'] = array(
|
||||||
|
'name' => $this->gettext('form.smtp.caption'),
|
||||||
|
'content' => $this->get_smtp_form($record)
|
||||||
|
);
|
||||||
|
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
@@ -168,44 +306,75 @@ class ident_switch extends rcube_plugin
|
|||||||
{
|
{
|
||||||
$rc = rcmail::get_instance();
|
$rc = rcmail::get_instance();
|
||||||
|
|
||||||
// TODO: check field values
|
// Do not do anything for default identity
|
||||||
|
if (strcasecmp($args['record']['email'], $rc->user->data['username']) === 0)
|
||||||
|
return $args;
|
||||||
|
|
||||||
$sql = 'SELECT NULL FROM ' . $rc->db->table_name($this->table) . ' WHERE iid = ? AND user_id = ?';
|
if (!self::get_field_value('common', 'enabled', false))
|
||||||
$q = $rc->db->query($sql, $args['id'], $rc->user->ID);
|
{
|
||||||
$r = $rc->db->fetch_assoc($q);
|
self::sw_imap_off($args['id']);
|
||||||
if ($r)
|
return $args;
|
||||||
{ // Record already exists, will update it
|
|
||||||
$sql = 'UPDATE ' .
|
|
||||||
$rc->db->table_name($this->table) .
|
|
||||||
' SET flags = ?, label = ?, host = ?, port = ?, username = ?, password = ?, delimiter = ?, user_id = ?, iid = ?';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data = self::check_field_values();
|
||||||
|
if ($data['err'])
|
||||||
|
{
|
||||||
|
$this->add_texts('localization');
|
||||||
|
$args['abort'] = true;
|
||||||
|
$args['message'] = 'ident_switch.err.' . $data['err'];
|
||||||
|
return $args;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['id'] = $args['id'];
|
||||||
|
self::save_field_values($rc, $data);
|
||||||
|
|
||||||
|
return $args;
|
||||||
|
}
|
||||||
|
|
||||||
|
function on_identity_create($args)
|
||||||
|
{
|
||||||
|
$rc = rcmail::get_instance();
|
||||||
|
|
||||||
|
// Do not do anything for default identity
|
||||||
|
if (strcasecmp($args['record']['email'], $rc->user->data['username']) === 0)
|
||||||
|
return $args;
|
||||||
|
|
||||||
|
if (!self::get_field_value('common', 'enabled', false))
|
||||||
|
return $args;
|
||||||
|
|
||||||
|
$data = self::check_field_values();
|
||||||
|
if ($data['err'])
|
||||||
|
{
|
||||||
|
$this->add_texts('localization');
|
||||||
|
$args['abort'] = true;
|
||||||
|
$args['message'] = 'ident_switch.err.' . $data['err'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save data for _after (cannot pass with $args)
|
||||||
|
$_SESSION['createData' . self::MY_POSTFIX] = $data;
|
||||||
|
|
||||||
|
return $args;
|
||||||
|
}
|
||||||
|
|
||||||
|
function on_identity_create_after($args)
|
||||||
|
{
|
||||||
|
$rc = rcmail::get_instance();
|
||||||
|
|
||||||
|
// Do not do anything for default identity
|
||||||
|
if (strcasecmp($args['record']['email'], $rc->user->data['username']) === 0)
|
||||||
|
return $args;
|
||||||
|
|
||||||
|
$data = $_SESSION['createData' . self::MY_POSTFIX];
|
||||||
|
|
||||||
|
unset($_SESSION['createData' . self::MY_POSTFIX]);
|
||||||
|
if (!$data || count($data) == 0)
|
||||||
|
self::write_log("Object with ident_switch values not found in session for ID = {$args['id']}.");
|
||||||
else
|
else
|
||||||
{ // No record exists, create new one
|
{
|
||||||
$sql = 'INSERT INTO ' .
|
$data['id'] = $args['id'];
|
||||||
$rc->db->table_name($this->table) .
|
self::save_field_values($rc, $data);
|
||||||
'(flags, label, host, port, username, password, delimiter, user_id, iid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process boolean fields
|
|
||||||
$flags = 0;
|
|
||||||
if (get_input_value('_ident_switch_form_enabled', RCUBE_INPUT_POST))
|
|
||||||
$flags |= $this->db_enabled;
|
|
||||||
if (get_input_value('_ident_switch_form_secure', RCUBE_INPUT_POST))
|
|
||||||
$flags |= $this->db_secure;
|
|
||||||
|
|
||||||
$rc->db->query(
|
|
||||||
$sql,
|
|
||||||
$flags,
|
|
||||||
get_input_value('_ident_switch_form_label', RCUBE_INPUT_POST),
|
|
||||||
get_input_value('_ident_switch_form_host', RCUBE_INPUT_POST),
|
|
||||||
get_input_value('_ident_switch_form_port', RCUBE_INPUT_POST),
|
|
||||||
get_input_value('_ident_switch_form_username', RCUBE_INPUT_POST),
|
|
||||||
$rc->encrypt(get_input_value('_ident_switch_form_password', RCUBE_INPUT_POST)),
|
|
||||||
get_input_value('_ident_switch_form_delimiter', RCUBE_INPUT_POST),
|
|
||||||
$rc->user->ID,
|
|
||||||
$args['id']
|
|
||||||
);
|
|
||||||
|
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,11 +382,11 @@ class ident_switch extends rcube_plugin
|
|||||||
{
|
{
|
||||||
$rc = rcmail::get_instance();
|
$rc = rcmail::get_instance();
|
||||||
|
|
||||||
$sql = 'DELETE FROM ' . $rc->db->table_name($this->table) . ' WHERE iid = ? AND user_id = ?';
|
$sql = 'DELETE FROM ' . $rc->db->table_name(self::TABLE) . ' WHERE iid = ? AND user_id = ?';
|
||||||
$q = $rc->db->query($sql, $args['id'], $rc->user->ID);
|
$q = $rc->db->query($sql, $args['id'], $rc->user->ID);
|
||||||
|
|
||||||
if ($rc->db->affected_rows($q))
|
if ($rc->db->affected_rows($q))
|
||||||
$rc->write_log($this->my_log, 'Deleted associated information for identity with ID = ' . $args['id'] . '.');
|
self::write_log("Deleted associated information for identity with ID = {$args['id']}.");
|
||||||
|
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
@@ -229,88 +398,354 @@ class ident_switch extends rcube_plugin
|
|||||||
$rc = rcmail::get_instance();
|
$rc = rcmail::get_instance();
|
||||||
if (strcasecmp($_SESSION['username'], $rc->user->data['username']) !== 0)
|
if (strcasecmp($_SESSION['username'], $rc->user->data['username']) !== 0)
|
||||||
{
|
{
|
||||||
if (isset($_SESSION['iid' . $this->my_postfix]))
|
if (isset($_SESSION['iid' . self::MY_POSTFIX]))
|
||||||
$rc->output->add_script('plugin_switchIdent_fixIdent(' . $_SESSION['iid' . $this->my_postfix] . ');', 'docready');
|
{
|
||||||
|
$iid = $_SESSION['iid' . self::MY_POSTFIX];
|
||||||
|
$rc->output->add_script("plugin_switchIdent_fixIdent({$iid});", 'docready');
|
||||||
|
}
|
||||||
else
|
else
|
||||||
$rc->write_log($this->my_log, 'Special session variable with active identity ID not found.');
|
self::write_log('Special session variable with active identity ID not found.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function on_special_folders_form($args)
|
||||||
|
{
|
||||||
|
$rc = rcmail::get_instance();
|
||||||
|
|
||||||
|
if (($args['section'] == 'folders') &&
|
||||||
|
(strcasecmp($rc->user->data['username'], $_SESSION['username']) !== 0))
|
||||||
|
{
|
||||||
|
$no_override = array_flip((array)$rc->config->get('dont_override'));
|
||||||
|
$onchange = "if ($(this).val() == 'INBOX') $(this).val('')";
|
||||||
|
$select = $rc->folder_selector(array('noselection' => '---',
|
||||||
|
'realnames' => true,
|
||||||
|
'maxlength' => 30,
|
||||||
|
'folder_filter' => 'mail',
|
||||||
|
'folder_rights' => 'w'));
|
||||||
|
|
||||||
|
$sql = 'SELECT label FROM ' . $rc->db->table_name(self::TABLE) . ' WHERE iid = ? AND user_id = ?';
|
||||||
|
$q = $rc->db->query($sql, $_SESSION['iid' . self::MY_POSTFIX], $rc->user->ID);
|
||||||
|
$r = $rc->db->fetch_assoc($q);
|
||||||
|
$args['blocks']['main']['name'] .= ' (' . ($r['label'] ? rcube::Q($rc->gettext('server')) . ': ' . $r['label'] : 'remote') . ')';
|
||||||
|
|
||||||
|
foreach (rcube_storage::$folder_types as $type)
|
||||||
|
{
|
||||||
|
if (isset($no_override[$type . '_mbox']))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$defaultKey = $type . '_mbox_default' . self::MY_POSTFIX;
|
||||||
|
$otherKey = $type . '_mbox' . self::MY_POSTFIX;
|
||||||
|
$selected = $_SESSION[$otherKey] ? $_SESSION[$otherKey] : $_SESSION[$defaultKey];
|
||||||
|
$attr = array('id' => '_' . $type . '_mbox', 'name' => '_' . $type . '_mbox', 'onchange' => $onchange);
|
||||||
|
$args['blocks']['main']['options'][$type . '_mbox']['content'] = $select->show($selected, $attr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $args;
|
||||||
|
}
|
||||||
|
|
||||||
|
function on_special_folders_update($args)
|
||||||
|
{
|
||||||
|
$rc = rcmail::get_instance();
|
||||||
|
|
||||||
|
if (($args['section'] == 'folders') &&
|
||||||
|
(strcasecmp($rc->user->data['username'], $_SESSION['username']) !== 0))
|
||||||
|
{
|
||||||
|
$sql = 'SELECT id FROM ' . $rc->db->table_name(self::TABLE) . ' WHERE iid = ? AND user_id = ?';
|
||||||
|
$q = $rc->db->query($sql, $_SESSION['iid' . self::MY_POSTFIX], $rc->user->ID);
|
||||||
|
$r = $rc->db->fetch_assoc($q);
|
||||||
|
if ($r)
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' .
|
||||||
|
$rc->db->table_name(self::TABLE) .
|
||||||
|
' SET drafts_mbox = ?, sent_mbox = ?, junk_mbox = ?, trash_mbox = ?' .
|
||||||
|
' WHERE id = ?';
|
||||||
|
|
||||||
|
$rc->db->query(
|
||||||
|
$sql,
|
||||||
|
$args['prefs']['drafts_mbox'],
|
||||||
|
$args['prefs']['sent_mbox'],
|
||||||
|
$args['prefs']['junk_mbox'],
|
||||||
|
$args['prefs']['trash_mbox'],
|
||||||
|
$r['id']
|
||||||
|
);
|
||||||
|
|
||||||
|
//abuse $plugin['abort'] to prevent RC main from saving prefs
|
||||||
|
$args['abort'] = true;
|
||||||
|
$args['result'] = true;
|
||||||
|
|
||||||
|
foreach (rcube_storage::$folder_types as $type)
|
||||||
|
{
|
||||||
|
if ($args['prefs'][$type . '_mbox']) {
|
||||||
|
$otherKey = $type . '_mbox' . self::MY_POSTFIX;
|
||||||
|
$_SESSION[$otherKey] = $args['prefs'][$type . '_mbox'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $args;
|
||||||
|
}
|
||||||
|
|
||||||
|
$args['abort'] = true;
|
||||||
|
$args['result'] = false;
|
||||||
|
return $args;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (rcube_storage::$folder_types as $type)
|
||||||
|
{
|
||||||
|
if ($args['prefs'][$type . '_mbox']) {
|
||||||
|
$key = $type . '_mbox_default' . self::MY_POSTFIX;
|
||||||
|
$_SESSION[$key] = $args['prefs'][$type . '_mbox'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $args;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function check_field_values()
|
||||||
|
{
|
||||||
|
$retVal = array();
|
||||||
|
|
||||||
|
$retVal['label'] = self::get_field_value('common', 'label');
|
||||||
|
if (strlen($retVal['label']) > 32)
|
||||||
|
$retVal['err'] = 'label.long';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$retVal['imap.host'] = self::get_field_value('imap', 'host');
|
||||||
|
if (strlen($retVal['imap.host']) > 64)
|
||||||
|
$retVal['err'] = 'host.long';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$retVal['imap.port'] = self::get_field_value('imap', 'port');
|
||||||
|
if ($retVal['imap.port'] && !ctype_digit($retVal['imap.port']))
|
||||||
|
$retVal['err'] = 'port.num';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($retVal['imap.port'] && ($retVal['imap.port'] <= 0 || $retVal['imap.port'] > 65535))
|
||||||
|
$retVal['err'] = 'port.range';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$retVal['imap.delimiter'] = self::get_field_value('imap', 'delimiter');
|
||||||
|
if (strlen($retVal['imap.delimiter']) > 1)
|
||||||
|
$retVal['err'] = 'delim.long';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$retVal['imap.user'] = self::get_field_value('imap', 'username');
|
||||||
|
if (strlen($retVal['imap.user']) > 64)
|
||||||
|
$retVal['err'] = 'user.long';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$retVal['smtp.host'] = self::get_field_value('smtp', 'host');
|
||||||
|
if (strlen($retVal['smtp.host']) > 64)
|
||||||
|
$retVal['err'] = 'host.long';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$retVal['smtp.port'] = self::get_field_value('smtp', 'port');
|
||||||
|
if ($retVal['smtp.port'] && !ctype_digit($retVal['smtp.port']))
|
||||||
|
$retVal['err'] = 'port.num';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($retVal['smtp.port'] && ($retVal['smtp.port'] <= 0 || $retVal['smtp.port'] > 65535))
|
||||||
|
$retVal['err'] = 'port.range';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$retVal['smtp.auth'] = self::get_field_value('smtp', 'auth');
|
||||||
|
if (!ctype_digit($retVal['smtp.auth']))
|
||||||
|
$retVal['err'] = 'auth.num';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get also password
|
||||||
|
$retVal['imap.pass'] = self::get_field_value('imap', 'password', false, true);
|
||||||
|
|
||||||
|
// Parse secure settings
|
||||||
|
$retVal['flags'] = self::DB_ENABLED;
|
||||||
|
|
||||||
|
$tls = self::get_field_value('imap', 'tls', false);
|
||||||
|
if ($tls)
|
||||||
|
$retVal['flags'] |= self::DB_SECURE_IMAP_TLS;
|
||||||
|
|
||||||
|
return $retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function get_field_value($section, $field, $trim = true, $html = false)
|
||||||
|
{
|
||||||
|
$retVal = rcube_utils::get_input_value(
|
||||||
|
"_ident_switch_form_{$section}_{$field}",
|
||||||
|
rcube_utils::INPUT_POST,
|
||||||
|
$html
|
||||||
|
);
|
||||||
|
if (!$trim)
|
||||||
|
return $retVal;
|
||||||
|
|
||||||
|
return self::ntrim($retVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function save_field_values($rc, $data)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT id, password FROM ' . $rc->db->table_name(self::TABLE) . ' WHERE iid = ? AND user_id = ?';
|
||||||
|
$q = $rc->db->query($sql, $data['id'], $rc->user->ID);
|
||||||
|
$r = $rc->db->fetch_assoc($q);
|
||||||
|
if ($r)
|
||||||
|
{ // Record already exists, will update it
|
||||||
|
$sql = 'UPDATE ' .
|
||||||
|
$rc->db->table_name(self::TABLE) .
|
||||||
|
' SET flags = ?, label = ?, imap_host = ?, imap_port = ?, imap_delimiter = ?, username = ?, password = ?, smtp_host = ?, smtp_port = ?, smtp_auth = ?, user_id = ?, iid = ?' .
|
||||||
|
' WHERE id = ?';
|
||||||
|
}
|
||||||
|
else if ($data['flags'] & self::DB_ENABLED)
|
||||||
|
{ // No record exists, create new one
|
||||||
|
$sql = 'INSERT INTO ' .
|
||||||
|
$rc->db->table_name(self::TABLE) .
|
||||||
|
'(flags, label, imap_host, imap_port, imap_delimiter, username, password, smtp_host, smtp_port, smtp_auth, user_id, iid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sql)
|
||||||
|
{
|
||||||
|
// Do we need to update pwd?
|
||||||
|
if ($data['imap.pass'] != $r['password'])
|
||||||
|
$data['imap.pass'] = $rc->encrypt($data['imap.pass']);
|
||||||
|
|
||||||
|
$rc->db->query(
|
||||||
|
$sql,
|
||||||
|
$data['flags'],
|
||||||
|
$data['label'],
|
||||||
|
$data['imap.host'],
|
||||||
|
$data['imap.port'],
|
||||||
|
$data['imap.delimiter'],
|
||||||
|
$data['imap.user'],
|
||||||
|
$data['imap.pass'],
|
||||||
|
$data['smtp.host'],
|
||||||
|
$data['smtp.port'],
|
||||||
|
$data['smtp.auth'],
|
||||||
|
$rc->user->ID,
|
||||||
|
$data['id'],
|
||||||
|
$r['id']
|
||||||
|
);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function on_switch()
|
function on_switch()
|
||||||
{
|
{
|
||||||
$rc = rcmail::get_instance();
|
$rc = rcmail::get_instance();
|
||||||
|
|
||||||
$my_postfix_len = strlen($this->my_postfix);
|
$my_postfix_len = strlen(self::MY_POSTFIX);
|
||||||
$identId = rcube_utils::get_input_value('_ident-id', RCUBE_INPUT_POST);
|
$identId = rcube_utils::get_input_value('_ident-id', rcube_utils::INPUT_POST);
|
||||||
|
|
||||||
|
$rc->session->remove('folders');
|
||||||
|
$rc->session->remove('unseen_count');
|
||||||
|
|
||||||
if (-1 == $identId)
|
if (-1 == $identId)
|
||||||
{ // Switch to main account
|
{ // Switch to main account
|
||||||
$rc->write_log($this->my_log, 'Switching mailbox back to default.');
|
self::write_log('Switching mailbox back to default.');
|
||||||
|
|
||||||
|
// Restore everything with STORAGE*my_postfix
|
||||||
foreach ($_SESSION as $k => $v)
|
foreach ($_SESSION as $k => $v)
|
||||||
{
|
{
|
||||||
if (strncasecmp($k, 'storage', 7) === 0 && substr_compare($k, $this->my_postfix, -$my_postfix_len, $my_postfix_len) === 0)
|
if (strncasecmp($k, 'storage', 7) === 0 && substr_compare($k, self::MY_POSTFIX, -$my_postfix_len, $my_postfix_len) === 0)
|
||||||
{
|
{
|
||||||
$_SESSION[$k] = $_SESSION[$k . $this->my_postfix];
|
$realKey = substr($k, 0, -$my_postfix_len);
|
||||||
$rc->session->remove($k . $this->my_postfix);
|
$_SESSION[$realKey] = $_SESSION[$k];
|
||||||
|
$rc->session->remove($k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$_SESSION['username'] = $rc->user->data['username'];
|
$_SESSION['username'] = $rc->user->data['username'];
|
||||||
$_SESSION['password'] = $_SESSION['password' . $this->my_postfix];
|
$_SESSION['password'] = $_SESSION['password' . self::MY_POSTFIX];
|
||||||
$_SESSION['iid' . $this->my_postfix] = -1;
|
$_SESSION['iid' . self::MY_POSTFIX] = -1;
|
||||||
|
|
||||||
|
foreach (rcube_storage::$folder_types as $type)
|
||||||
|
{
|
||||||
|
$otherKey = $type . '_mbox' . self::MY_POSTFIX;
|
||||||
|
if ($_SESSION[$otherKey])
|
||||||
|
$rc->session->remove($otherKey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = 'SELECT host, flags, port, username, password, iid FROM ' . $rc->db->table_name($this->table) . ' WHERE id = ? AND user_id = ?';
|
$sql = 'SELECT imap_host, flags, imap_port, imap_delimiter, drafts_mbox, sent_mbox, junk_mbox, trash_mbox, username, password, iid FROM ' . $rc->db->table_name(self::TABLE) . ' WHERE id = ? AND user_id = ?';
|
||||||
$q = $rc->db->query($sql, $identId ,$rc->user->ID);
|
$q = $rc->db->query($sql, $identId ,$rc->user->ID);
|
||||||
$r = $rc->db->fetch_assoc($q);
|
$r = $rc->db->fetch_assoc($q);
|
||||||
if (is_array($r))
|
if (is_array($r))
|
||||||
{
|
{
|
||||||
$rc->write_log(
|
if (!$r['username'])
|
||||||
$this->my_log,
|
{ // Load email from identity
|
||||||
'Switching mailbox to one for identity with ID = ' . $r['iid'] . ' (username = \'' . $r['username'] . '\').'
|
$sql = 'SELECT email FROM ' . $rc->db->table_name('identities') . ' WHERE identity_id = ?';
|
||||||
);
|
$q = $rc->db->query($sql, $r['iid']);
|
||||||
|
$rIid = $rc->db->fetch_assoc($q);
|
||||||
|
|
||||||
$port = $r['port'];
|
$r['username'] = $rIid['email'];
|
||||||
$ssl = false;
|
|
||||||
if ($r['flags'] & $this->db_secure)
|
|
||||||
{
|
|
||||||
$ssl = true;
|
|
||||||
if (!$port)
|
|
||||||
$port = 993; // Default SSL/TLS port here!
|
|
||||||
}
|
}
|
||||||
if (!$port)
|
|
||||||
$port = 143; // Default port here!
|
|
||||||
|
|
||||||
// If we are in default account now
|
self::write_log("Switching mailbox to one for identity with ID = {$r['iid']} (username = '{$r['username']}').");
|
||||||
// save everything with STORAGE
|
|
||||||
if ($_SESSION['username'] == $rc->user->data['username'])
|
if ($_SESSION['username'] == $rc->user->data['username'])
|
||||||
{
|
{ // If we are in default account now - save values
|
||||||
foreach ($_SESSION as $k => $v)
|
foreach ($_SESSION as $k => $v)
|
||||||
{
|
{
|
||||||
if (strncasecmp($k, 'storage', 7) === 0 && substr_compare($k, $this->my_postfix, -$my_postfix_len, $my_postfix_len) !== 0)
|
if (strncasecmp($k, 'storage', 7) === 0 && substr_compare($k, self::MY_POSTFIX, -$my_postfix_len, $my_postfix_len) !== 0)
|
||||||
{
|
{
|
||||||
$_SESSION[$k . $this->my_postfix] = $_SESSION[$k];
|
if (!$_SESSION[$k . self::MY_POSTFIX])
|
||||||
$rc->session->remove($k);
|
$_SESSION[$k . self::MY_POSTFIX] = $_SESSION[$k];
|
||||||
|
|
||||||
|
$rc->session->remove($k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$_SESSION['password' . $this->my_postfix] = $_SESSION['password'];
|
|
||||||
|
|
||||||
$_SESSION['storage_host'] = $r['host'];
|
$moreToSave = array('password', 'imap_delimiter');
|
||||||
|
foreach ($moreToSave as $k)
|
||||||
|
{
|
||||||
|
if (!$_SESSION[$k . self::MY_POSTFIX])
|
||||||
|
$_SESSION[$k . self::MY_POSTFIX] = $_SESSION[$k];
|
||||||
|
|
||||||
|
$rc->session->remove($k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$def_port = 143; // Default IMAP port here!
|
||||||
|
$ssl = null;
|
||||||
|
if ($r['flags'] & self::DB_SECURE_IMAP_TLS)
|
||||||
|
{
|
||||||
|
$ssl = 'tls';
|
||||||
|
$def_port = 143; // Default IMAP TLS port here!
|
||||||
|
}
|
||||||
|
$port = $r['imap_port'] ? $r['imap_port'] : $def_port;
|
||||||
|
|
||||||
|
$host = $r['imap_host'] ? $r['imap_host'] : 'localhost'; // Default IMAP host here!
|
||||||
|
$hostProtocol = "{$ssl}://";
|
||||||
|
if ($ssl && strncasecmp($host, $hostProtocol, strlen($hostProtocol)) !== 0)
|
||||||
|
$host = $hostProtocol . $host;
|
||||||
|
|
||||||
|
$delimiter = $r['imap_delimiter'] ? $r['imap_delimiter'] : '.'; // Default delimiter here
|
||||||
|
|
||||||
|
$_SESSION['storage_host'] = $host;
|
||||||
$_SESSION['storage_ssl'] = $ssl;
|
$_SESSION['storage_ssl'] = $ssl;
|
||||||
$_SESSION['storage_port'] = $port;
|
$_SESSION['storage_port'] = $port;
|
||||||
|
$_SESSION['imap_delimiter'] = $delimiter;
|
||||||
$_SESSION['username'] = $r['username'];
|
$_SESSION['username'] = $r['username'];
|
||||||
$_SESSION['password'] = $r['password'];
|
$_SESSION['password'] = $r['password'];
|
||||||
$_SESSION['iid' . $this->my_postfix] = $r['iid'];
|
$_SESSION['iid' . self::MY_POSTFIX] = $r['iid'];
|
||||||
|
|
||||||
$rc->session->remove('folders');
|
foreach (rcube_storage::$folder_types as $type)
|
||||||
|
{
|
||||||
|
if ($r[$type . '_mbox']) {
|
||||||
|
$otherKey = $type . '_mbox' . self::MY_POSTFIX;
|
||||||
|
$_SESSION[$otherKey] = $r[$type . '_mbox'];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO: Show message in browser
|
// TODO: Show message in browser
|
||||||
$rc->write_log($this->my_log, 'Requested remote mailbox with ID = ' . $identId . ' not found.');
|
self::write_log("Requested remote mailbox with ID = {$identId} not found.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -318,8 +753,102 @@ class ident_switch extends rcube_plugin
|
|||||||
$rc->output->redirect(
|
$rc->output->redirect(
|
||||||
array(
|
array(
|
||||||
'_task' => 'mail',
|
'_task' => 'mail',
|
||||||
'_mbox' => rcube_utils::get_input_value('_mbox', RCUBE_INPUT_GET),
|
'_mbox' => 'INBOX',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static function sw_imap_off($iid)
|
||||||
|
{
|
||||||
|
$rc = rcmail::get_instance();
|
||||||
|
|
||||||
|
$sql = 'UPDATE ' . $rc->db->table_name(self::TABLE) . ' SET flags = flags & ? WHERE iid = ? AND user_id = ?';
|
||||||
|
$rc->db->query($sql, ~self::DB_ENABLED, $iid, $rc->user->ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function get_preconfig($email)
|
||||||
|
{
|
||||||
|
$dom = substr(strstr($email, '@'), 1);
|
||||||
|
if (!$dom)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
$this->load_config(); // config.inc.php
|
||||||
|
|
||||||
|
$cfg = rcmail::get_instance()->config->get('ident_switch.preconfig', array());
|
||||||
|
$cfg = $cfg[$dom];
|
||||||
|
|
||||||
|
if ($cfg)
|
||||||
|
{
|
||||||
|
if (!$cfg['host'])
|
||||||
|
return false; # Host must be specified!
|
||||||
|
}
|
||||||
|
return $cfg;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function apply_preconfig(&$record)
|
||||||
|
{
|
||||||
|
$email = $record['email'];
|
||||||
|
$cfg = $this->get_preconfig($email);
|
||||||
|
if (is_array($cfg))
|
||||||
|
{
|
||||||
|
self::write_log("Applying predefined configuration for '{$email}'.");
|
||||||
|
|
||||||
|
if ($cfg['host'])
|
||||||
|
{ // Parse and set host and related
|
||||||
|
$urlArr = parse_url($cfg['host']);
|
||||||
|
|
||||||
|
$record['ident_switch.form.imap.host'] = $record['ident_switch.form.smtp.host'] = $urlArr['host'] ? rcube::Q($urlArr['host'], 'url') : '';
|
||||||
|
$record['ident_switch.form.imap.port'] = $record['ident_switch.form.smtp.port'] = $urlArr['port'] ? intval($urlArr['port']) : '';
|
||||||
|
|
||||||
|
if (strcasecmp('tls', $urlArr['scheme']) === 0)
|
||||||
|
$record['ident_switch.form.imap.tls'] = true;
|
||||||
|
else
|
||||||
|
$record['ident_switch.form.imap.rls'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$loginSet = false;
|
||||||
|
if ($cfg['user'])
|
||||||
|
{ // Set up user name
|
||||||
|
switch (strtoupper($cfg['user']))
|
||||||
|
{
|
||||||
|
case 'EMAIL':
|
||||||
|
$record['ident_switch.form.imap.username'] = $email;
|
||||||
|
$loginSet = true;
|
||||||
|
break;
|
||||||
|
case 'MBOX':
|
||||||
|
$record['ident_switch.form.imap.username'] = strstr($email, '@', true);
|
||||||
|
$loginSet = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($cfg['readonly'])
|
||||||
|
{
|
||||||
|
$record['ident_switch.form.common.readonly'] = 1;
|
||||||
|
if ($loginSet)
|
||||||
|
$record['ident_switch.form.common.readonly'] = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $cfg['readonly'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function ntrim($str)
|
||||||
|
{
|
||||||
|
if (is_null($str))
|
||||||
|
return $str;
|
||||||
|
|
||||||
|
$s = trim($str);
|
||||||
|
if (!$s)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return $s;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function write_log($txt)
|
||||||
|
{
|
||||||
|
rcmail::get_instance()->write_log('ident_switch', $txt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
67
localization/de_DE.inc
Normal file
67
localization/de_DE.inc
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Localization file for ident_switch plugin
|
||||||
|
*/
|
||||||
|
$labels = array();
|
||||||
|
|
||||||
|
// Plugin ident_switch
|
||||||
|
$labels['form.common.caption'] = 'Plugin ident_switch';
|
||||||
|
|
||||||
|
// Enabled
|
||||||
|
$labels['form.common.enabled'] = 'Aktiviert';
|
||||||
|
|
||||||
|
// Label
|
||||||
|
$labels['form.common.label'] = 'Bezeichnung';
|
||||||
|
|
||||||
|
// Value in \'Label\' field is too long (32 chars max).
|
||||||
|
$labels['err.label.long'] = 'Der Wert in Feld \'Bezeichnung\' ist zu lang (max. 32 Zeichen).';
|
||||||
|
|
||||||
|
|
||||||
|
// IMAP
|
||||||
|
$labels['form.imap.caption'] = 'IMAP';
|
||||||
|
|
||||||
|
// Server host name
|
||||||
|
$labels['form.imap.host'] = 'Servername';
|
||||||
|
|
||||||
|
// Secure connection (TLS)
|
||||||
|
$labels['form.imap.tls'] = 'Sichere Verbindung (TLS)';
|
||||||
|
|
||||||
|
// Port
|
||||||
|
$labels['form.imap.port'] = 'Port';
|
||||||
|
|
||||||
|
// Username
|
||||||
|
$labels['form.imap.username'] = 'Benutzername';
|
||||||
|
|
||||||
|
// Password
|
||||||
|
$labels['form.imap.password'] = 'Passwort';
|
||||||
|
|
||||||
|
// Value in \'Username\' field is too long (64 chars max).
|
||||||
|
$labels['err.user.long'] = 'Der Wert in Feld \'Benutzername\' ist zu lang (max. 64 Zeichen).';
|
||||||
|
|
||||||
|
|
||||||
|
// SMTP
|
||||||
|
$labels['form.smtp.caption'] = 'SMTP';
|
||||||
|
|
||||||
|
// Server host name
|
||||||
|
$labels['form.smtp.host'] = 'Servername';
|
||||||
|
|
||||||
|
// Secure connection (TLS)
|
||||||
|
$labels['form.smtp.tls'] = 'Sichere Verbindung (TLS)';
|
||||||
|
|
||||||
|
// Port
|
||||||
|
$labels['form.smtp.port'] = 'Port';
|
||||||
|
|
||||||
|
// Authorization required
|
||||||
|
$labels['form.smtp.auth'] = 'Genehmigung benötigt';
|
||||||
|
|
||||||
|
|
||||||
|
// Errors
|
||||||
|
|
||||||
|
// Value in \'Server host name\' field is too long (64 chars max).
|
||||||
|
$labels['err.host.long'] = 'Der Wert in Feld \'Servername\' ist zu lang (max. 64 Zeichen).';
|
||||||
|
|
||||||
|
// Value in \'Port\' field must be a number.
|
||||||
|
$labels['err.port.num'] = 'Der Wert in Feld \'Port\' muss eine Zahl sein.';
|
||||||
|
|
||||||
|
// Value in \'Port\' field must be between 1 and 65535.
|
||||||
|
$labels['err.port.range'] = 'Der Wert in Feld \'Port\' muss zwischen 1 und 65535 liegen.';
|
||||||
@@ -4,23 +4,73 @@
|
|||||||
*/
|
*/
|
||||||
$labels = array();
|
$labels = array();
|
||||||
|
|
||||||
// IMAP
|
// Plugin ident_switch
|
||||||
$labels['form.caption'] = 'IMAP';
|
$labels['form.common.caption'] = 'Plugin ident_switch';
|
||||||
|
|
||||||
// Enabled
|
// Enabled
|
||||||
$labels['form.enabled'] = 'Enabled';
|
$labels['form.common.enabled'] = 'Enabled';
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
$labels['form.label'] = 'Label';
|
$labels['form.common.label'] = 'Label';
|
||||||
|
|
||||||
// Server URI
|
// Value in \'Label\' field is too long (32 chars max).
|
||||||
$labels['form.server']='Server URI';
|
$labels['err.label.long'] = 'Value in \'Label\' field is too long (32 chars max).';
|
||||||
|
|
||||||
// Username
|
|
||||||
$labels['form.username'] = 'Username';
|
|
||||||
|
|
||||||
// Passwotrd
|
// IMAP
|
||||||
$labels['form.password'] = 'Password';
|
$labels['form.imap.caption'] = 'IMAP';
|
||||||
|
|
||||||
|
// Server host name
|
||||||
|
$labels['form.imap.host'] = 'Server host name';
|
||||||
|
|
||||||
|
// Secure connection (TLS)
|
||||||
|
$labels['form.imap.tls'] = 'Secure connection (TLS)';
|
||||||
|
|
||||||
|
// Port
|
||||||
|
$labels['form.imap.port'] = 'Port';
|
||||||
|
|
||||||
// Folder hierarchy delimiter
|
// Folder hierarchy delimiter
|
||||||
$labels['form.delimiter'] = 'Folder hierarchy delimiter';
|
$labels['form.imap.delimiter'] = 'Folder hierarchy delimiter';
|
||||||
|
|
||||||
|
// Username
|
||||||
|
$labels['form.imap.username'] = 'Username';
|
||||||
|
|
||||||
|
// Password
|
||||||
|
$labels['form.imap.password'] = 'Password';
|
||||||
|
|
||||||
|
// Value in \'Username\' field is too long (64 chars max).
|
||||||
|
$labels['err.user.long'] = 'Value in \'Username\' field is too long (64 chars max).';
|
||||||
|
|
||||||
|
|
||||||
|
// SMTP
|
||||||
|
$labels['form.smtp.caption'] = 'SMTP';
|
||||||
|
|
||||||
|
// Server host name
|
||||||
|
$labels['form.smtp.host'] = 'Server host name';
|
||||||
|
|
||||||
|
// Secure connection (TLS)
|
||||||
|
$labels['form.smtp.tls'] = 'Secure connection (TLS)';
|
||||||
|
|
||||||
|
// Port
|
||||||
|
$labels['form.smtp.port'] = 'Port';
|
||||||
|
|
||||||
|
// Authorization
|
||||||
|
$labels['form.smtp.auth'] = 'Authorization';
|
||||||
|
|
||||||
|
// As IMAP
|
||||||
|
$labels['form.smtp.auth.imap'] = 'As IMAP';
|
||||||
|
|
||||||
|
// None
|
||||||
|
$labels['form.smtp.auth.none'] = 'None';
|
||||||
|
|
||||||
|
|
||||||
|
// Errors
|
||||||
|
|
||||||
|
// Value in \'Server host name\' field is too long (64 chars max).
|
||||||
|
$labels['err.host.long'] = 'Value in \'Server host name\' field is too long (64 chars max).';
|
||||||
|
|
||||||
|
// Value in \'Port\' field must be a number.
|
||||||
|
$labels['err.port.num'] = 'Value in \'Port\' field must be a number.';
|
||||||
|
|
||||||
|
// Value in \'Port\' field must be between 1 and 65535.
|
||||||
|
$labels['err.port.range'] = 'Value in \'Port\' field must be between 1 and 65535.';
|
||||||
|
|||||||
67
localization/fr_FR.inc
Normal file
67
localization/fr_FR.inc
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Localization file for ident_switch plugin
|
||||||
|
*/
|
||||||
|
$labels = array();
|
||||||
|
|
||||||
|
// Plugin ident_switch
|
||||||
|
$labels['form.common.caption'] = 'Plugin ident_switch';
|
||||||
|
|
||||||
|
// Enabled
|
||||||
|
$labels['form.common.enabled'] = 'Activer';
|
||||||
|
|
||||||
|
// Label
|
||||||
|
$labels['form.common.label'] = 'Nom à afficher';
|
||||||
|
|
||||||
|
// Value in \'Label\' field is too long (32 chars max).
|
||||||
|
$labels['err.label.long'] = 'La valeur du champ \'Nom à afficher\' est trop longue (32 caractères max).';
|
||||||
|
|
||||||
|
|
||||||
|
// IMAP
|
||||||
|
$labels['form.imap.caption'] = 'IMAP';
|
||||||
|
|
||||||
|
// Server host name
|
||||||
|
$labels['form.imap.host'] = 'Serveur';
|
||||||
|
|
||||||
|
// Secure connection (TLS)
|
||||||
|
$labels['form.imap.tls'] = 'Connexion sécurisée (TLS)';
|
||||||
|
|
||||||
|
// Port
|
||||||
|
$labels['form.imap.port'] = 'Port';
|
||||||
|
|
||||||
|
// Username
|
||||||
|
$labels['form.imap.username'] = 'Nom d\'utilisateur';
|
||||||
|
|
||||||
|
// Password
|
||||||
|
$labels['form.imap.password'] = 'Mot de passe';
|
||||||
|
|
||||||
|
// Value in \'Username\' field of IMAP section is too long (64 chars max).
|
||||||
|
$labels['err.user.long'] = 'La valeur du champ \'Nom d\'utilisateur\' de la section IMAP est trop longue (64 caractères max).';
|
||||||
|
|
||||||
|
|
||||||
|
// SMTP
|
||||||
|
$labels['form.smtp.caption'] = 'SMTP';
|
||||||
|
|
||||||
|
// Server host name
|
||||||
|
$labels['form.smtp.host'] = 'Serveur';
|
||||||
|
|
||||||
|
// Secure connection (TLS)
|
||||||
|
$labels['form.smtp.tls'] = 'Connexion sécurisée (TLS)';
|
||||||
|
|
||||||
|
// Port
|
||||||
|
$labels['form.smtp.port'] = 'Port';
|
||||||
|
|
||||||
|
// Authorization required
|
||||||
|
$labels['form.smtp.auth'] = 'Autorisation requise';
|
||||||
|
|
||||||
|
|
||||||
|
// Errors
|
||||||
|
|
||||||
|
// Value in \'Server host name\' field is too long (64 chars max).
|
||||||
|
$labels['err.host.long'] = 'La valeur du champ \'Serveur\' est trop longue (64 caractères max).';
|
||||||
|
|
||||||
|
// Value in \'Port\' field must be a number.
|
||||||
|
$labels['err.port.num'] = 'La valeur du champ \'Port\' doit être un nombre.';
|
||||||
|
|
||||||
|
// Value in \'Port\' field must be between 1 and 65535.
|
||||||
|
$labels['err.port.range'] = 'La valeur du champ \'Port\' doit être comprise entre 1 et 65535.';
|
||||||
50
localization/it_IT.inc
Normal file
50
localization/it_IT.inc
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Localization file for ident_switch plugin
|
||||||
|
*/
|
||||||
|
$labels = array();
|
||||||
|
|
||||||
|
// IMAP
|
||||||
|
$labels['form.caption'] = 'IMAP';
|
||||||
|
|
||||||
|
// Enabled
|
||||||
|
$labels['form.enabled'] = 'Abilita';
|
||||||
|
|
||||||
|
// Label
|
||||||
|
$labels['form.label'] = 'Nome visualizzato';
|
||||||
|
|
||||||
|
// Server host name
|
||||||
|
$labels['form.host']='Nome del server';
|
||||||
|
|
||||||
|
// Secure connection (SSL/TLS)
|
||||||
|
$labels['form.secure']='Sicurezza della connessione';
|
||||||
|
|
||||||
|
// Port
|
||||||
|
$labels['form.port']='Porta';
|
||||||
|
|
||||||
|
// Username
|
||||||
|
$labels['form.username'] = 'Username';
|
||||||
|
|
||||||
|
// Password
|
||||||
|
$labels['form.password'] = 'Password';
|
||||||
|
|
||||||
|
// Folder hierarchy delimiter
|
||||||
|
$labels['form.delimiter'] = 'Delimitatore gerarchico delle cartelle';
|
||||||
|
|
||||||
|
// Value in \'Label\' field of IMAP section is too long (32 chars max).
|
||||||
|
$labels['err.label.long'] = 'Il valore del campo \' Nome Visualizzato\' è troppo lungo. (massimo 32 caratteri).';
|
||||||
|
|
||||||
|
// Value in \'Server host name\' field of IMAP section is too long (64 chars max).
|
||||||
|
$labels['err.host.long'] = 'Il valore del campo \'Nome del server\' della sezione IMAP è troppo lungo (massimo 64 caratteri).';
|
||||||
|
|
||||||
|
// Value in \'Username\' field of IMAP section is too long (64 chars max).
|
||||||
|
$labels['err.user.long'] = 'Il valore del campo \'Username\' della sezione IMAP è troppo lungo (massimo 64 caratteri).';
|
||||||
|
|
||||||
|
// Value in \'Folder hierarchy delimiter\' field of IMAP section is too long (1 char max).
|
||||||
|
$labels['err.delim.long'] = 'Il valore del campo \'Delimitatore gerarchico delle cartelle\' è troppo lungo (massimo 1 carattere).';
|
||||||
|
|
||||||
|
// Value in \'Port\' field of IMAP section must be a number.
|
||||||
|
$labels['err.port.num'] = 'Il valore del campo \'Porta\' nella sezione IMAP deve essere un numero.';
|
||||||
|
|
||||||
|
// Value in \'Port\' field of IMAP section must be between 1 and 65535.
|
||||||
|
$labels['err.port.range'] = 'Il valore del campo \'Porta\' nella sezione IMAP deve essere compreso tra i valori 1 e 65535.';
|
||||||
50
localization/nl_NL.inc
Normal file
50
localization/nl_NL.inc
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Localization file for ident_switch plugin
|
||||||
|
*/
|
||||||
|
$labels = array();
|
||||||
|
|
||||||
|
// IMAP
|
||||||
|
$labels['form.caption'] = 'IMAP';
|
||||||
|
|
||||||
|
// Enabled
|
||||||
|
$labels['form.enabled'] = 'Inschakelen';
|
||||||
|
|
||||||
|
// Label
|
||||||
|
$labels['form.label'] = 'Label';
|
||||||
|
|
||||||
|
// Server host name
|
||||||
|
$labels['form.host']='Servernaam';
|
||||||
|
|
||||||
|
// Secure connection (SSL/TLS)
|
||||||
|
$labels['form.secure']='Beveiligingstype';
|
||||||
|
|
||||||
|
// Port
|
||||||
|
$labels['form.port']='Poortnummer';
|
||||||
|
|
||||||
|
// Username
|
||||||
|
$labels['form.username'] = 'Gebruikersnaam';
|
||||||
|
|
||||||
|
// Password
|
||||||
|
$labels['form.password'] = 'Wachtwoord';
|
||||||
|
|
||||||
|
// Folder hierarchy delimiter
|
||||||
|
$labels['form.delimiter'] = 'Map hiërarchie scheidingsteken';
|
||||||
|
|
||||||
|
// Value in \'Label\' field of IMAP section is too long (32 chars max).
|
||||||
|
$labels['err.label.long'] = 'De waarde in het veld \'Label\' is te lang! (maximaal 32 karakter is toegestaan).';
|
||||||
|
|
||||||
|
// Value in \'Server host name\' field of IMAP section is too long (64 chars max).
|
||||||
|
$labels['err.host.long'] = 'De waarde in het veld \'Servernaam\' is te lang (maximaal 64 karakter is toegestaan).';
|
||||||
|
|
||||||
|
// Value in \'Username\' field of IMAP section is too long (64 chars max).
|
||||||
|
$labels['err.user.long'] = 'De waarde in het veld \'Gebruikersnaam\' is te lang! (maximaal 64 karakter is toegestaan).';
|
||||||
|
|
||||||
|
// Value in \'Folder hierarchy delimiter\' field of IMAP section is too long (1 char max).
|
||||||
|
$labels['err.delim.long'] = 'De waarde in het veld \'Map hiërarchie scheidingsteken\' is te lang! (maximaal 1 karakter is toegestaan).';
|
||||||
|
|
||||||
|
// Value in \'Port\' field of IMAP section must be a number.
|
||||||
|
$labels['err.port.num'] = 'De waarde in het veld \'Poortnummer\' moet een nummer zijn.';
|
||||||
|
|
||||||
|
// Value in \'Port\' field of IMAP section must be between 1 and 65535.
|
||||||
|
$labels['err.port.range'] = 'De waarde in het veld \'Poortnummer\' moet tussen de 1 en 65535 zijn.';
|
||||||
76
localization/ru_RU.inc
Normal file
76
localization/ru_RU.inc
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Localization file for ident_switch plugin
|
||||||
|
*/
|
||||||
|
$labels = array();
|
||||||
|
|
||||||
|
// Plugin ident_switch
|
||||||
|
$labels['form.common.caption'] = 'Плагин ident_switch';
|
||||||
|
|
||||||
|
// Enabled
|
||||||
|
$labels['form.common.enabled'] = 'Включено';
|
||||||
|
|
||||||
|
// Label
|
||||||
|
$labels['form.common.label'] = 'Название';
|
||||||
|
|
||||||
|
// Value in \'Label\' field is too long (32 chars max).
|
||||||
|
$labels['err.label.long'] = '\'Название\' должно быть не длинее 32 символов.';
|
||||||
|
|
||||||
|
|
||||||
|
// IMAP
|
||||||
|
$labels['form.imap.caption'] = 'IMAP';
|
||||||
|
|
||||||
|
// Server host name
|
||||||
|
$labels['form.imap.host'] = 'Адрес сервера';
|
||||||
|
|
||||||
|
// Secure connection (TLS)
|
||||||
|
$labels['form.imap.tls'] = 'Безопасное подключение (TLS)';
|
||||||
|
|
||||||
|
// Port
|
||||||
|
$labels['form.imap.port'] = 'Порт';
|
||||||
|
|
||||||
|
// Folder hierarchy delimiter
|
||||||
|
$labels['form.imap.delimiter'] = 'Разделитель в иерархии папок';
|
||||||
|
|
||||||
|
// Username
|
||||||
|
$labels['form.imap.username'] = 'Имя пользователя';
|
||||||
|
|
||||||
|
// Password
|
||||||
|
$labels['form.imap.password'] = 'Пароль';
|
||||||
|
|
||||||
|
// Value in \'Username\' field is too long (64 chars max).
|
||||||
|
$labels['err.user.long'] = '\'Имя пользователя\' должно быть не длинее 64 символов.';
|
||||||
|
|
||||||
|
|
||||||
|
// SMTP
|
||||||
|
$labels['form.smtp.caption'] = 'SMTP';
|
||||||
|
|
||||||
|
// Server host name
|
||||||
|
$labels['form.smtp.host'] = 'Адрес сервера';
|
||||||
|
|
||||||
|
// Secure connection (TLS)
|
||||||
|
$labels['form.smtp.tls'] = 'Безопасное подключение (TLS)';
|
||||||
|
|
||||||
|
// Port
|
||||||
|
$labels['form.smtp.port'] = 'Порт';
|
||||||
|
|
||||||
|
// Authorization
|
||||||
|
$labels['form.smtp.auth'] = 'Авторизация';
|
||||||
|
|
||||||
|
// As IMAP
|
||||||
|
$labels['form.smtp.auth.imap'] = 'Как IMAP';
|
||||||
|
|
||||||
|
// None
|
||||||
|
$labels['form.smtp.auth.none'] = 'Нет';
|
||||||
|
|
||||||
|
|
||||||
|
// Errors
|
||||||
|
|
||||||
|
// Value in \'Server host name\' field is too long (64 chars max).
|
||||||
|
$labels['err.host.long'] = '\'Адрес сервера\' должен быть не длинее 64 символов.';
|
||||||
|
|
||||||
|
// Value in \'Port\' field must be a number.
|
||||||
|
$labels['err.port.num'] = '\'Порт\' должен быть числом.';
|
||||||
|
|
||||||
|
// Value in \'Port\' field must be between 1 and 65535.
|
||||||
|
$labels['err.port.range'] = '\'Порт\' должен быть в диапазоне от 1 до 65535.';
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of Roundcube "identities_imap" plugin.
|
|
||||||
*
|
|
||||||
* Your are not allowed to distribute this file or parts of it.
|
|
||||||
*
|
|
||||||
* This file 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.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2012 - 2014 Roland 'Rosali' Liebl - all rights reserved
|
|
||||||
* dev-team [at] myroundcube [dot] com
|
|
||||||
* http://myroundcube.com
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#accounts{position:absolute; top:63px; left:18px;}.remotehint{z-index:-1; position:absolute; top:7px; margin-left:auto; left:210px; width:400px; border-radius:5px; padding:4px; -moz-border-radius:5px; border:1px solid #DEEEFC; background:#F2F9FF; text-align:center; color:#3F70BA; display:inline;}.classic{top:2px;}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of Roundcube "identities_imap" plugin.
|
|
||||||
*
|
|
||||||
* Your are not allowed to distribute this file or parts of it.
|
|
||||||
*
|
|
||||||
* This file 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.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2012 - 2014 Roland 'Rosali' Liebl - all rights reserved
|
|
||||||
* dev-team [at] myroundcube [dot] com
|
|
||||||
* http://myroundcube.com
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
select.deco{height:18px; font-size:12px; border-radius:3px; -moz-border-radius:3px; -webkit-border-radius:3px; color:#fff; background:#444; border:1px solid #ababab;}.remotehint{z-index:1; position:absolute; top:1px; margin-left:auto; left:50%; margin-left:-200px; width:400px; border-radius:5px; padding:4px; -moz-border-radius:5px; border:1px solid #DEEEFC; background:#F2F9FF; text-align:center; color:#3F70BA; display:inline;}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of Roundcube "##PLUGIN##" plugin.
|
|
||||||
*
|
|
||||||
* Your are not allowed to distribute this file or parts of it.
|
|
||||||
*
|
|
||||||
* This file 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.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2012 - ##YEAR## Roland 'Rosali' Liebl - all rights reserved
|
|
||||||
* dev-team [at] myroundcube [dot] com
|
|
||||||
* http://myroundcube.com
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
select.deco{}#taskbar .remotehint{position:absolute; top:52px; left:50%; margin-left:-200px; width:400px; padding:0px; border:1px solid #DEEEFC; background-color:#F2F9FF; text-align:center; font-size:10px; color:#3F70BA;}
|
|
||||||
Reference in New Issue
Block a user