Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5577699dae | ||
|
|
eb8175fb7c | ||
|
|
3e803f65a2 | ||
|
|
ad97f4bfd0 | ||
|
|
181ac6b27c | ||
|
|
ae7b905824 | ||
|
|
5aed4c9947 | ||
|
|
46eba62185 | ||
|
|
ca790d72de | ||
|
|
af54e4b099 | ||
|
|
da17fb896b | ||
|
|
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 |
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
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +1,2 @@
|
||||
*.swp
|
||||
.idea
|
||||
.vscode
|
||||
@@ -32,6 +32,6 @@ This plugin allows users to switch between different accounts (including remote)
|
||||
* 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 upcoming 1.4.
|
||||
* 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.
|
||||
|
||||
@@ -1,40 +1,54 @@
|
||||
CREATE TABLE IF NOT EXISTS ident_switch
|
||||
CREATE TABLE IF NOT EXISTS `ident_switch`
|
||||
(
|
||||
id
|
||||
`id`
|
||||
int(10) UNSIGNED
|
||||
NOT NULL
|
||||
AUTO_INCREMENT,
|
||||
user_id
|
||||
`user_id`
|
||||
int(10) UNSIGNED
|
||||
NOT NULL,
|
||||
iid
|
||||
`iid`
|
||||
int(10) UNSIGNED
|
||||
NOT NULL,
|
||||
username
|
||||
`username`
|
||||
varchar(64),
|
||||
password
|
||||
`password`
|
||||
varchar(64),
|
||||
imap_host
|
||||
`imap_host`
|
||||
varchar(64),
|
||||
imap_port
|
||||
`imap_port`
|
||||
int
|
||||
CHECK(port > 0 AND port <= 65535),
|
||||
label
|
||||
CHECK(`imap_port` > 0 AND `imap_port` <= 65535),
|
||||
`imap_delimiter`
|
||||
char(1),
|
||||
`label`
|
||||
varchar(32),
|
||||
flags
|
||||
`flags`
|
||||
int
|
||||
NOT NULL
|
||||
DEFAULT 0,
|
||||
smtp_host
|
||||
varchar(64),
|
||||
smtp_port
|
||||
int
|
||||
CHECK(port > 0 AND port <= 65535),
|
||||
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)
|
||||
`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`)
|
||||
);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
ALTER TABLE
|
||||
ident_switch
|
||||
`ident_switch`
|
||||
MODIFY
|
||||
username
|
||||
`username`
|
||||
varchar(64);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
ALTER TABLE
|
||||
ident_switch
|
||||
`ident_switch`
|
||||
MODIFY
|
||||
username
|
||||
varchar(64)
|
||||
NULL;
|
||||
`username`
|
||||
varchar(64)
|
||||
NULL;
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
ALTER TABLE
|
||||
ident_switch
|
||||
`ident_switch`
|
||||
CHANGE
|
||||
host
|
||||
imap_host varchar(64);
|
||||
`host`
|
||||
`imap_host` varchar(64);
|
||||
|
||||
ALTER TABLE
|
||||
ident_switch
|
||||
`ident_switch`
|
||||
CHANGE
|
||||
port
|
||||
imap_port int;
|
||||
`port`
|
||||
`imap_port` int;
|
||||
|
||||
ALTER TABLE
|
||||
ident_switch
|
||||
`ident_switch`
|
||||
ADD COLUMN
|
||||
smtp_host
|
||||
`smtp_host`
|
||||
varchar(64);
|
||||
|
||||
ALTER TABLE
|
||||
ident_switch
|
||||
`ident_switch`
|
||||
ADD COLUMN
|
||||
smtp_port
|
||||
`smtp_port`
|
||||
int
|
||||
CHECK(smtp_port > 0 AND smtp_port <= 65535);
|
||||
CHECK(`smtp_port` > 0 AND `smtp_port` <= 65535);
|
||||
|
||||
ALTER TABLE
|
||||
ident_switch
|
||||
`ident_switch`
|
||||
DROP COLUMN
|
||||
delimiter;
|
||||
`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 +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(port > 0 AND port <= 65535),
|
||||
label
|
||||
varchar(32),
|
||||
flags
|
||||
integer
|
||||
NOT NULL
|
||||
DEFAULT(0),
|
||||
smtp_host
|
||||
varchar(64),
|
||||
smtp_port
|
||||
integer
|
||||
CHECK(port > 0 AND port <= 65535),
|
||||
UNIQUE (user_id, label)
|
||||
);
|
||||
|
||||
CREATE INDEX
|
||||
IX_ident_switch_user_id
|
||||
ON
|
||||
ident_switch(user_id);
|
||||
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);
|
||||
|
||||
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);
|
||||
@@ -21,17 +21,31 @@ CREATE TABLE ident_switch
|
||||
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_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);
|
||||
|
||||
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;
|
||||
@@ -8,7 +8,7 @@
|
||||
"authors": [
|
||||
{
|
||||
"name": "Boris Gulay",
|
||||
"email": "boris@boressoft.ru",
|
||||
"email": "boris@gulay.name",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
|
||||
374
ident_switch.php
374
ident_switch.php
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* This plugin allows fast switching between accounts.
|
||||
*
|
||||
* @version 1.0
|
||||
* @version 4.4.2
|
||||
* @author Boris Gulay
|
||||
* @url
|
||||
*/
|
||||
@@ -20,6 +20,10 @@ class ident_switch extends rcube_plugin
|
||||
//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()
|
||||
{
|
||||
$this->add_hook('startup', array($this, 'on_startup'));
|
||||
@@ -31,8 +35,18 @@ class ident_switch extends rcube_plugin
|
||||
$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('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'));
|
||||
|
||||
$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)
|
||||
@@ -51,6 +65,14 @@ 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 = isset($_SESSION[$otherKey]) ? $_SESSION[$otherKey] : $_SESSION[$defaultKey];
|
||||
$rc->config->set($type . '_mbox', $val);
|
||||
}
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
@@ -84,80 +106,77 @@ class ident_switch extends rcube_plugin
|
||||
$iid = -1;
|
||||
elseif (ctype_digit($iid_s))
|
||||
$iid = intval($iid_s);
|
||||
|
||||
$accNames = array(isset($_SESSION['global_alias']) ? $_SESSION['global_alias'] : $rc->user->data['username']);
|
||||
$accValues = array(-1);
|
||||
$accSelected = -1;
|
||||
|
||||
// Get list of alternative accounts
|
||||
$sOpt = '';
|
||||
$sql = 'SELECT id, iid, label, username FROM ' . $rc->db->table_name(self::TABLE) . ' WHERE user_id = ? AND flags & ? > 0';
|
||||
$sql = "SELECT "
|
||||
. "isw.id, isw.iid, isw.label, isw.username, ii.email"
|
||||
. " FROM"
|
||||
. " {$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 ($iid == $r['iid'])
|
||||
$opts['selected'] = 'selected';
|
||||
$accSelected = $r['id'];
|
||||
|
||||
// Make label
|
||||
$lbl = $r['label'];
|
||||
if (!$lbl)
|
||||
{
|
||||
if (!$r['username'])
|
||||
{ // Load email from identity
|
||||
$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);
|
||||
|
||||
$r['username'] = $rIid['email'];
|
||||
}
|
||||
$r['username'] = $r['email'];
|
||||
|
||||
if (strpos($r['username'], '@') === false)
|
||||
$lbl = $r['username'] . '@' . ($r['host'] ? $r['host'] : 'localhost');
|
||||
else
|
||||
$lbl = $r['username'];
|
||||
}
|
||||
|
||||
$sOpt .= html::tag(
|
||||
'option',
|
||||
$opts,
|
||||
rcube::Q($lbl)
|
||||
);
|
||||
$accNames[] = rcube::Q($lbl);
|
||||
}
|
||||
|
||||
// Render UI if user has extra accounts
|
||||
if (!empty($sOpt))
|
||||
if (count($accValues) > 1)
|
||||
{
|
||||
// Add main account
|
||||
$opts = array('value' => -1);
|
||||
if ($iid <= 0)
|
||||
$opts['selected'] = 'selected';
|
||||
|
||||
$sOpt = html::tag(
|
||||
'option',
|
||||
$opts,
|
||||
$_SESSION['global_alias'] ? $_SESSION['global_alias'] : $rc->user->data['username']
|
||||
) . $sOpt;
|
||||
|
||||
$this->include_script('ident_switch-switch.js');
|
||||
$sw = html::tag(
|
||||
'select',
|
||||
array(
|
||||
'id' => 'plugin-ident_switch-account',
|
||||
'style' => 'display: none; padding: 0;',
|
||||
'onchange' => 'plugin_switchIdent_switch(this.value);',
|
||||
),
|
||||
$sOpt
|
||||
);
|
||||
$rc->output->add_footer($sw);
|
||||
|
||||
$select = new html_select(array(
|
||||
'id' => 'plugin-ident_switch-account',
|
||||
'style' => 'display: none; padding: 0;',
|
||||
'onchange' => 'plugin_switchIdent_switch(this.value);',
|
||||
));
|
||||
$select->add($accNames, $accValues);
|
||||
$rc->output->add_footer($select->show(array($accSelected)));
|
||||
}
|
||||
}
|
||||
|
||||
function on_smtp_connect($args)
|
||||
{
|
||||
$iid = $_SESSION['iid' . self::MY_POSTFIX];
|
||||
if (!is_integer($iid) || $iid == -1)
|
||||
return $args;
|
||||
if (!is_numeric($iid) || $iid == -1)
|
||||
{
|
||||
self::write_log('no identity switch is selected... trying to find related smtp server from the from header');
|
||||
$requestFrom = rcube_utils::get_input_value('_from', rcube_utils::INPUT_POST);
|
||||
if (empty($requestFrom)) {
|
||||
self::write_log('no _from post parameter found... falling back to original default config');
|
||||
return $args;
|
||||
} else {
|
||||
$iid = intval($requestFrom);
|
||||
if ($iid == 0) {
|
||||
self::write_log('falling back to original default config as _from post field is no integer: ' . $_POST['_from']);
|
||||
return $args;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$rc = rcmail::get_instance();
|
||||
|
||||
$sql = 'SELECT smtp_host, flags, smtp_port, username, password FROM ' . $rc->db->table_name(self::TABLE) . ' WHERE iid = ? AND user_id = ?';
|
||||
$sql = 'SELECT smtp_host, flags, smtp_port, username, smtp_auth, password FROM ' . $rc->db->table_name(self::TABLE) . ' WHERE iid = ? AND user_id = ?';
|
||||
$q = $rc->db->query($sql, $iid ,$rc->user->ID);
|
||||
$r = $rc->db->fetch_assoc($q);
|
||||
if (is_array($r))
|
||||
@@ -172,19 +191,33 @@ class ident_switch extends rcube_plugin
|
||||
}
|
||||
|
||||
$args['smtp_user'] = $r['username'];
|
||||
$args['smtp_pass'] = $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
|
||||
$args['smtp_pass'] = $r['smtp_auth'] == self::SMTP_AUTH_IMAP ? $rc->decrypt($r['password']) : '';
|
||||
|
||||
# In 1.6 smtp_server was renamed to smtp_host and includes port. smtp_port was depricated.
|
||||
$verParts = explode('.', RCMAIL_VERSION, 3);
|
||||
$paramSmtpHost = 'smtp_host';
|
||||
$paramSmtpPort = null;
|
||||
if (intval($verParts[0]) <= 1 && intval($verParts[1]) < 6)
|
||||
{
|
||||
$paramSmtpHost = 'smtp_server';
|
||||
$paramSmtpPort = 'smtp_port';
|
||||
}
|
||||
|
||||
$args[$paramSmtpHost] = $r['smtp_host'] ? $r['smtp_host'] : 'localhost'; // Default SMTP host here
|
||||
|
||||
if ($r['flags'] & self::DB_SECURE_IMAP_TLS)
|
||||
{
|
||||
if (strpos($args['smtp_server'], ':') !== false)
|
||||
if (strpos($args[$paramSmtpHost], ':') !== false)
|
||||
self::write_log('SMTP server already contains protocol, ignoring TLS flag.');
|
||||
else
|
||||
$args['smtp_server'] = 'tls://' . $args['smtp_server'];
|
||||
$args[$paramSmtpHost] = 'tls://' . $args[$paramSmtpHost];
|
||||
}
|
||||
|
||||
self::write_log(print_r($args, true));
|
||||
$smtpPort = $r['smtp_port'] ? $r['smtp_port'] : 587; // Default SMTP port here
|
||||
if ($paramSmtpPort)
|
||||
$args[$paramSmtpPort] = $smtpPort;
|
||||
else
|
||||
$args[$paramSmtpHost] .= ':' . $smtpPort;
|
||||
}
|
||||
|
||||
return $args;
|
||||
@@ -209,15 +242,22 @@ class ident_switch extends rcube_plugin
|
||||
$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' => '.'),
|
||||
);
|
||||
}
|
||||
|
||||
private static function get_smtp_form(&$record)
|
||||
private function get_smtp_form(&$record)
|
||||
{
|
||||
$prefix = 'ident_switch.form.smtp.';
|
||||
|
||||
$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']))),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -248,10 +288,12 @@ class ident_switch extends rcube_plugin
|
||||
'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_port' => 'smtp.port',
|
||||
'smtp_auth' => 'smtp.auth',
|
||||
|
||||
);
|
||||
foreach ($row as $k => $v)
|
||||
@@ -283,7 +325,7 @@ class ident_switch extends rcube_plugin
|
||||
);
|
||||
$args['form']['ident_switch.smtp'] = array(
|
||||
'name' => $this->gettext('form.smtp.caption'),
|
||||
'content' => ident_switch::get_smtp_form($record)
|
||||
'content' => $this->get_smtp_form($record)
|
||||
);
|
||||
|
||||
return $args;
|
||||
@@ -355,7 +397,7 @@ class ident_switch extends rcube_plugin
|
||||
|
||||
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'] . '.');
|
||||
self::write_log("Object with ident_switch values not found in session for ID = {$args['id']}.");
|
||||
else
|
||||
{
|
||||
$data['id'] = $args['id'];
|
||||
@@ -373,7 +415,7 @@ class ident_switch extends rcube_plugin
|
||||
$q = $rc->db->query($sql, $args['id'], $rc->user->ID);
|
||||
|
||||
if ($rc->db->affected_rows($q))
|
||||
self::write_log('Deleted associated information for identity with ID = ' . $args['id'] . '.');
|
||||
self::write_log("Deleted associated information for identity with ID = {$args['id']}.");
|
||||
|
||||
return $args;
|
||||
}
|
||||
@@ -386,13 +428,106 @@ class ident_switch extends rcube_plugin
|
||||
if (strcasecmp($_SESSION['username'], $rc->user->data['username']) !== 0)
|
||||
{
|
||||
if (isset($_SESSION['iid' . self::MY_POSTFIX]))
|
||||
$rc->output->add_script('plugin_switchIdent_fixIdent(' . $_SESSION['iid' . self::MY_POSTFIX] . ');', 'docready');
|
||||
{
|
||||
$iid = $_SESSION['iid' . self::MY_POSTFIX];
|
||||
$rc->output->add_script("plugin_switchIdent_fixIdent({$iid});", 'docready');
|
||||
}
|
||||
else
|
||||
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()
|
||||
{
|
||||
@@ -417,23 +552,35 @@ class ident_switch extends rcube_plugin
|
||||
$retVal['err'] = 'port.range';
|
||||
else
|
||||
{
|
||||
$retVal['imap.user'] = self::get_field_value('imap', 'username');
|
||||
if (strlen($retVal['imap.user']) > 64)
|
||||
$retVal['err'] = 'user.long';
|
||||
$retVal['imap.delimiter'] = self::get_field_value('imap', 'delimiter');
|
||||
if (strlen($retVal['imap.delimiter']) > 1)
|
||||
$retVal['err'] = 'delim.long';
|
||||
else
|
||||
{
|
||||
$retVal['smtp.host'] = self::get_field_value('smtp', 'host');
|
||||
if (strlen($retVal['smtp.host']) > 64)
|
||||
$retVal['err'] = 'host.long';
|
||||
$retVal['imap.user'] = self::get_field_value('imap', 'username');
|
||||
if (strlen($retVal['imap.user']) > 64)
|
||||
$retVal['err'] = 'user.long';
|
||||
else
|
||||
{
|
||||
$retVal['smtp.port'] = self::get_field_value('smtp', 'port');
|
||||
if ($retVal['smtp.port'] && !ctype_digit($retVal['smtp.port']))
|
||||
$retVal['err'] = 'port.num';
|
||||
$retVal['smtp.host'] = self::get_field_value('smtp', 'host');
|
||||
if (strlen($retVal['smtp.host']) > 64)
|
||||
$retVal['err'] = 'host.long';
|
||||
else
|
||||
{
|
||||
if ($retVal['smtp.port'] && ($retVal['smtp.port'] <= 0 || $retVal['smtp.port'] > 65535))
|
||||
$retVal['err'] = 'port.range';
|
||||
$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';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -443,7 +590,7 @@ class ident_switch extends rcube_plugin
|
||||
}
|
||||
|
||||
// Get also password
|
||||
$retVal['imap.pass'] = self::get_field_value('imap', 'password', false);
|
||||
$retVal['imap.pass'] = self::get_field_value('imap', 'password', false, true);
|
||||
|
||||
// Parse secure settings
|
||||
$retVal['flags'] = self::DB_ENABLED;
|
||||
@@ -455,11 +602,12 @@ class ident_switch extends rcube_plugin
|
||||
return $retVal;
|
||||
}
|
||||
|
||||
private static function get_field_value($section, $field, $trim = true)
|
||||
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
|
||||
"_ident_switch_form_{$section}_{$field}",
|
||||
rcube_utils::INPUT_POST,
|
||||
$html
|
||||
);
|
||||
if (!$trim)
|
||||
return $retVal;
|
||||
@@ -476,14 +624,14 @@ class ident_switch extends rcube_plugin
|
||||
{ // Record already exists, will update it
|
||||
$sql = 'UPDATE ' .
|
||||
$rc->db->table_name(self::TABLE) .
|
||||
' SET flags = ?, label = ?, imap_host = ?, imap_port = ?, username = ?, password = ?, smtp_host = ?, smtp_port = ?, user_id = ?, iid = ?' .
|
||||
' 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, username, password, smtp_host, smtp_port, user_id, iid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
|
||||
'(flags, label, imap_host, imap_port, imap_delimiter, username, password, smtp_host, smtp_port, smtp_auth, user_id, iid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
|
||||
}
|
||||
|
||||
if ($sql)
|
||||
@@ -498,10 +646,12 @@ class ident_switch extends rcube_plugin
|
||||
$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']
|
||||
@@ -520,6 +670,9 @@ class ident_switch extends rcube_plugin
|
||||
$my_postfix_len = strlen(self::MY_POSTFIX);
|
||||
$identId = rcube_utils::get_input_value('_ident-id', rcube_utils::INPUT_POST);
|
||||
|
||||
$rc->session->remove('folders');
|
||||
$rc->session->remove('unseen_count');
|
||||
|
||||
if (-1 == $identId)
|
||||
{ // Switch to main account
|
||||
self::write_log('Switching mailbox back to default.');
|
||||
@@ -534,13 +687,22 @@ class ident_switch extends rcube_plugin
|
||||
$rc->session->remove($k);
|
||||
}
|
||||
}
|
||||
$delimiter = isset($config['imap_delimiter']) ? $config['imap_delimiter']:'.';
|
||||
$_SESSION['imap_delimiter'] = $delimiter;
|
||||
$_SESSION['username'] = $rc->user->data['username'];
|
||||
$_SESSION['password'] = $_SESSION['password' . self::MY_POSTFIX];
|
||||
$_SESSION['iid' . self::MY_POSTFIX] = -1;
|
||||
|
||||
foreach (rcube_storage::$folder_types as $type)
|
||||
{
|
||||
$otherKey = $type . '_mbox' . self::MY_POSTFIX;
|
||||
if (isset($_SESSION[$otherKey]))
|
||||
$rc->session->remove($otherKey);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'SELECT imap_host, flags, imap_port, username, password, iid FROM ' . $rc->db->table_name(self::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);
|
||||
$r = $rc->db->fetch_assoc($q);
|
||||
if (is_array($r))
|
||||
@@ -554,7 +716,30 @@ class ident_switch extends rcube_plugin
|
||||
$r['username'] = $rIid['email'];
|
||||
}
|
||||
|
||||
self::write_log('Switching mailbox to one for identity with ID = ' . $r['iid'] . ' (username = \'' . $r['username'] . '\').');
|
||||
self::write_log("Switching mailbox to one for identity with ID = {$r['iid']} (username = '{$r['username']}').");
|
||||
|
||||
if ($_SESSION['username'] == $rc->user->data['username'])
|
||||
{ // If we are in default account now - save values
|
||||
foreach ($_SESSION as $k => $v)
|
||||
{
|
||||
if (strncasecmp($k, 'storage', 7) === 0 && substr_compare($k, self::MY_POSTFIX, -$my_postfix_len, $my_postfix_len) !== 0)
|
||||
{
|
||||
if (!isset($_SESSION[$k . self::MY_POSTFIX]))
|
||||
$_SESSION[$k . self::MY_POSTFIX] = $_SESSION[$k];
|
||||
|
||||
$rc->session->remove($k);
|
||||
}
|
||||
}
|
||||
|
||||
$moreToSave = array('password', 'imap_delimiter');
|
||||
foreach ($moreToSave as $k)
|
||||
{
|
||||
if (!isset($_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;
|
||||
@@ -565,36 +750,33 @@ class ident_switch extends rcube_plugin
|
||||
}
|
||||
$port = $r['imap_port'] ? $r['imap_port'] : $def_port;
|
||||
|
||||
// If we are in default account now
|
||||
// save everything with STORAGE
|
||||
if ($_SESSION['username'] == $rc->user->data['username'])
|
||||
{
|
||||
foreach ($_SESSION as $k => $v)
|
||||
{
|
||||
if (strncasecmp($k, 'storage', 7) === 0 && substr_compare($k, self::MY_POSTFIX, -$my_postfix_len, $my_postfix_len) !== 0)
|
||||
{
|
||||
if (!$_SESSION[$k . self::MY_POSTFIX])
|
||||
$_SESSION[$k . self::MY_POSTFIX] = $_SESSION[$k];
|
||||
$rc->session->remove($k);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$_SESSION['password' . self::MY_POSTFIX])
|
||||
$_SESSION['password' . self::MY_POSTFIX] = $_SESSION['password'];
|
||||
$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;
|
||||
|
||||
$_SESSION['storage_host'] = $r['imap_host'] ? $r['imap_host'] : 'localhost'; // Default IMAP host here!
|
||||
$delimiter = isset($r['imap_delimiter']) ? $r['imap_delimiter'] : '.'; // Default delimiter here
|
||||
|
||||
$_SESSION['storage_host'] = $host;
|
||||
$_SESSION['storage_ssl'] = $ssl;
|
||||
$_SESSION['storage_port'] = $port;
|
||||
$_SESSION['imap_delimiter'] = $delimiter;
|
||||
$_SESSION['username'] = $r['username'];
|
||||
$_SESSION['password'] = $r['password'];
|
||||
$_SESSION['iid' . self::MY_POSTFIX] = $r['iid'];
|
||||
|
||||
$rc->session->remove('folders');
|
||||
foreach (rcube_storage::$folder_types as $type)
|
||||
{
|
||||
if (isset($r[$type . '_mbox'])) {
|
||||
$otherKey = $type . '_mbox' . self::MY_POSTFIX;
|
||||
$_SESSION[$otherKey] = $r[$type . '_mbox'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Show message in browser
|
||||
self::write_log('Requested remote mailbox with ID = ' . $identId . ' not found.');
|
||||
self::write_log("Requested remote mailbox with ID = {$identId} not found.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -640,14 +822,14 @@ class ident_switch extends rcube_plugin
|
||||
$cfg = $this->get_preconfig($email);
|
||||
if (is_array($cfg))
|
||||
{
|
||||
self::write_log('Applying predefined configuration for \'' . $email . '\'.');
|
||||
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'] = $urlArr['host'] ? rcube::Q($urlArr['host'], 'url') : '';
|
||||
$record['ident_switch.form.imap.port'] = $urlArr['port'] ? intval($urlArr['port']) : '';
|
||||
$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;
|
||||
|
||||
@@ -64,4 +64,4 @@ $labels['err.host.long'] = 'Der Wert in Feld \'Servername\' ist zu lang (max. 64
|
||||
$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 1 und 65535 liegen.';
|
||||
$labels['err.port.range'] = 'Der Wert in Feld \'Port\' muss zwischen 1 und 65535 liegen.';
|
||||
|
||||
@@ -29,6 +29,9 @@ $labels['form.imap.tls'] = 'Secure connection (TLS)';
|
||||
// Port
|
||||
$labels['form.imap.port'] = 'Port';
|
||||
|
||||
// Folder hierarchy delimiter
|
||||
$labels['form.imap.delimiter'] = 'Folder hierarchy delimiter';
|
||||
|
||||
// Username
|
||||
$labels['form.imap.username'] = 'Username';
|
||||
|
||||
@@ -51,8 +54,14 @@ $labels['form.smtp.tls'] = 'Secure connection (TLS)';
|
||||
// Port
|
||||
$labels['form.smtp.port'] = 'Port';
|
||||
|
||||
// Authorization required
|
||||
$labels['form.smtp.auth'] = 'Authorization required';
|
||||
// Authorization
|
||||
$labels['form.smtp.auth'] = 'Authorization';
|
||||
|
||||
// As IMAP
|
||||
$labels['form.smtp.auth.imap'] = 'As IMAP';
|
||||
|
||||
// None
|
||||
$labels['form.smtp.auth.none'] = 'None';
|
||||
|
||||
|
||||
// Errors
|
||||
|
||||
@@ -4,47 +4,64 @@
|
||||
*/
|
||||
$labels = array();
|
||||
|
||||
// IMAP
|
||||
$labels['form.caption'] = 'IMAP';
|
||||
// Plugin ident_switch
|
||||
$labels['form.common.caption'] = 'Plugin ident_switch';
|
||||
|
||||
// Enabled
|
||||
$labels['form.enabled'] = 'Activé';
|
||||
$labels['form.common.enabled'] = 'Activer';
|
||||
|
||||
// Label
|
||||
$labels['form.label'] = 'Nom d\'affichage';
|
||||
$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.host']='Nom d\'hôte du serveur';
|
||||
$labels['form.imap.host'] = 'Serveur';
|
||||
|
||||
// Secure connection (SSL/TLS)
|
||||
$labels['form.secure']='Sécurité de la connexion';
|
||||
// Secure connection (TLS)
|
||||
$labels['form.imap.tls'] = 'Connexion sécurisée (TLS)';
|
||||
|
||||
// Port
|
||||
$labels['form.port']='Port';
|
||||
$labels['form.imap.port'] = 'Port';
|
||||
|
||||
// Username
|
||||
$labels['form.username'] = 'Nom d\'utilisateur';
|
||||
$labels['form.imap.username'] = 'Nom d\'utilisateur';
|
||||
|
||||
// Password
|
||||
$labels['form.password'] = 'Mot de passe';
|
||||
|
||||
// Folder hierarchy delimiter
|
||||
$labels['form.delimiter'] = 'Délimiteur de la hiérarchie des dossiers';
|
||||
|
||||
// Value in \'Label\' field of IMAP section is too long (32 chars max).
|
||||
$labels['err.label.long'] = 'La valeur du champ \'Nom d\'affichage\' de la section IMAP est trop longue (32 car. max).';
|
||||
|
||||
// Value in \'Server host name\' field of IMAP section is too long (64 chars max).
|
||||
$labels['err.host.long'] = 'La valeur du champ \'Nom d\'hôte du serveur\' de la section IMAP est trop longue (64 car. max).';
|
||||
$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 car. max).';
|
||||
$labels['err.user.long'] = 'La valeur du champ \'Nom d\'utilisateur\' de la section IMAP est trop longue (64 caractères max).';
|
||||
|
||||
// Value in \'Folder hierarchy delimiter\' field of IMAP section is too long (1 char max).
|
||||
$labels['err.delim.long'] = 'La valeur du champ \'Délimiteur de la hiérarchie des dossiers\' de la section IMAP est trop longue (1 car. max).';
|
||||
|
||||
// Value in \'Port\' field of IMAP section must be a number.
|
||||
$labels['err.port.num'] = 'La valeur du champ \'Port\' de la section IMAP doit être un nombre.';
|
||||
// SMTP
|
||||
$labels['form.smtp.caption'] = 'SMTP';
|
||||
|
||||
// Value in \'Port\' field of IMAP section must be between 1 and 65535.
|
||||
$labels['err.port.range'] = 'La valeur du champ \'Port\' de la section IMAP doit être comprise entre 1 et 65535.';
|
||||
// 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.';
|
||||
|
||||
@@ -29,6 +29,9 @@ $labels['form.imap.tls'] = 'Безопасное подключение (TLS)';
|
||||
// Port
|
||||
$labels['form.imap.port'] = 'Порт';
|
||||
|
||||
// Folder hierarchy delimiter
|
||||
$labels['form.imap.delimiter'] = 'Разделитель в иерархии папок';
|
||||
|
||||
// Username
|
||||
$labels['form.imap.username'] = 'Имя пользователя';
|
||||
|
||||
@@ -51,8 +54,14 @@ $labels['form.smtp.tls'] = 'Безопасное подключение (TLS)';
|
||||
// Port
|
||||
$labels['form.smtp.port'] = 'Порт';
|
||||
|
||||
// Authorization required
|
||||
$labels['form.smtp.auth'] = 'Требуется авторизация';
|
||||
// Authorization
|
||||
$labels['form.smtp.auth'] = 'Авторизация';
|
||||
|
||||
// As IMAP
|
||||
$labels['form.smtp.auth.imap'] = 'Как IMAP';
|
||||
|
||||
// None
|
||||
$labels['form.smtp.auth.none'] = 'Нет';
|
||||
|
||||
|
||||
// Errors
|
||||
|
||||
76
localization/sl_SI.inc
Normal file
76
localization/sl_SI.inc
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/*
|
||||
* Localization file for ident_switch plugin
|
||||
*/
|
||||
$labels = array();
|
||||
|
||||
// Plugin ident_switch
|
||||
$labels['form.common.caption'] = 'Razširitev ident_switch';
|
||||
|
||||
// Enabled
|
||||
$labels['form.common.enabled'] = 'Omogočeno';
|
||||
|
||||
// Label
|
||||
$labels['form.common.label'] = 'Oznaka';
|
||||
|
||||
// Value in \'Label\' field is too long (32 chars max).
|
||||
$labels['err.label.long'] = 'Število znakov v polju \'Oznaka\' presega maksimalno število znakov (max 32 znakov).';
|
||||
|
||||
|
||||
// IMAP
|
||||
$labels['form.imap.caption'] = 'IMAP';
|
||||
|
||||
// Server host name
|
||||
$labels['form.imap.host'] = 'Ime oz. naslov IMAP strežnika';
|
||||
|
||||
// Secure connection (TLS)
|
||||
$labels['form.imap.tls'] = 'Varna povezava (TLS)';
|
||||
|
||||
// Port
|
||||
$labels['form.imap.port'] = 'Vrata';
|
||||
|
||||
// Folder hierarchy delimiter
|
||||
$labels['form.imap.delimiter'] = 'Ločilo hierarhije map';
|
||||
|
||||
// Username
|
||||
$labels['form.imap.username'] = 'Uporabniško ime';
|
||||
|
||||
// Password
|
||||
$labels['form.imap.password'] = 'Geslo';
|
||||
|
||||
// Value in \'Username\' field is too long (64 chars max).
|
||||
$labels['err.user.long'] = 'Število znakov v polju \'Uporabniško ime\' presega maksimalno število znakov (max 64 znakov).';
|
||||
|
||||
|
||||
// SMTP
|
||||
$labels['form.smtp.caption'] = 'SMTP';
|
||||
|
||||
// Server host name
|
||||
$labels['form.smtp.host'] = 'Ime oz. naslov SMTP strežnika';
|
||||
|
||||
// Secure connection (TLS)
|
||||
$labels['form.smtp.tls'] = 'Varna povezava (TLS)';
|
||||
|
||||
// Port
|
||||
$labels['form.smtp.port'] = 'Vrata';
|
||||
|
||||
// Authorization
|
||||
$labels['form.smtp.auth'] = 'Avtorizacija';
|
||||
|
||||
// As IMAP
|
||||
$labels['form.smtp.auth.imap'] = 'Tako kot IMAP';
|
||||
|
||||
// None
|
||||
$labels['form.smtp.auth.none'] = 'Brez';
|
||||
|
||||
|
||||
// Errors
|
||||
|
||||
// Value in \'Server host name\' field is too long (64 chars max).
|
||||
$labels['err.host.long'] = 'Število znakov v polju \'Ime oz. naslov IMAP strežnika\' presega maksimalno število znakov (max 64 znakov).';
|
||||
|
||||
// Value in \'Port\' field must be a number.
|
||||
$labels['err.port.num'] = 'Vrednost \'Vrata\' mora biti številka.';
|
||||
|
||||
// Value in \'Port\' field must be between 1 and 65535.
|
||||
$labels['err.port.range'] = 'Vrednost v polju \'Vrata\' mora biti med 1 in 65535.';
|
||||
Reference in New Issue
Block a user