Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a97816d1c | ||
|
|
6849c47fd9 | ||
|
|
ecbadcd866 | ||
|
|
9ebacf0d61 | ||
|
|
ab7bae56b5 | ||
|
|
d93dd2be03 | ||
|
|
f7b650db3e | ||
|
|
4da9b48776 | ||
|
|
d667518d1f | ||
|
|
5ad75ce989 | ||
|
|
dbadde3333 | ||
|
|
b499688318 | ||
|
|
6cfbeab7f0 | ||
|
|
b10f3625c2 | ||
|
|
f28fb5bb58 |
38
SQL/mysql.initial.sql
Normal file
38
SQL/mysql.initial.sql
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
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)
|
||||||
|
NOT NULL,
|
||||||
|
password
|
||||||
|
varchar(64),
|
||||||
|
host
|
||||||
|
varchar(64),
|
||||||
|
port
|
||||||
|
int
|
||||||
|
CHECK(port > 0 AND port <= 65535),
|
||||||
|
delimiter
|
||||||
|
char(1),
|
||||||
|
label
|
||||||
|
varchar(32),
|
||||||
|
flags
|
||||||
|
int
|
||||||
|
NOT NULL
|
||||||
|
DEFAULT 0,
|
||||||
|
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);
|
||||||
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;
|
||||||
@@ -14,14 +14,23 @@ $(function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var $enFld = $("INPUT[name='_ident_switch.form.enabled']");
|
$("INPUT[name='_ident_switch.form.enabled']").change();
|
||||||
if ($enFld.size() == 1)
|
$("SELECT[name='_ident_switch.form.secure']").change();
|
||||||
$enFld.change();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function plugin_switchIdent_enabled_onChange(e) {
|
function plugin_switchIdent_enabled_onChange(e) {
|
||||||
var $enFld = $("INPUT[name='_ident_switch.form.enabled']");
|
var $enFld = $("INPUT[name='_ident_switch.form.enabled']");
|
||||||
$("INPUT[name!='_ident_switch.form.enabled']", $enFld.parents("FIELDSET")).prop("disabled", !$enFld.is(":checked"));
|
$("INPUT[name!='_ident_switch.form.enabled'], SELECT", $enFld.parents("FIELDSET")).prop("disabled", !$enFld.is(":checked"));
|
||||||
|
}
|
||||||
|
|
||||||
|
function plugin_switchIdent_secure_onChange(e) {
|
||||||
|
var $secSel = $("SELECT[name='_ident_switch.form.secure']");
|
||||||
|
var $portFld = $("INPUT[name='_ident_switch.form.port']");
|
||||||
|
|
||||||
|
if ('SSL' === $secSel.val().toUpperCase())
|
||||||
|
$portFld.attr("placeholder", 993);
|
||||||
|
else
|
||||||
|
$portFld.attr("placeholder", 143);
|
||||||
}
|
}
|
||||||
|
|
||||||
function plugin_switchIdent_switch(val) {
|
function plugin_switchIdent_switch(val) {
|
||||||
|
|||||||
161
ident_switch.php
161
ident_switch.php
@@ -14,10 +14,12 @@ class ident_switch extends rcube_plugin
|
|||||||
|
|
||||||
private $table = 'ident_switch';
|
private $table = 'ident_switch';
|
||||||
private $my_postfix = '_iswitch';
|
private $my_postfix = '_iswitch';
|
||||||
|
private $my_log = 'ident_switch';
|
||||||
|
|
||||||
// Flags user in database
|
// Flags user in database
|
||||||
private $db_enabled = 1;
|
private $db_enabled = 1;
|
||||||
private $db_secure = 2;
|
private $db_secure_ssl = 2;
|
||||||
|
private $db_secure_tls = 4;
|
||||||
|
|
||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
@@ -57,20 +59,40 @@ class ident_switch extends rcube_plugin
|
|||||||
$rc = rcmail::get_instance();
|
$rc = rcmail::get_instance();
|
||||||
error_log('Template: ' . $args['template']);
|
error_log('Template: ' . $args['template']);
|
||||||
|
|
||||||
|
// Currently selected identity
|
||||||
|
$iid = $_SESSION['iid' . $this->my_postfix];
|
||||||
|
|
||||||
|
$iid_int = 0;
|
||||||
|
if (is_int($iid))
|
||||||
|
$iid_int = $iid;
|
||||||
|
elseif ($iid === '-1')
|
||||||
|
$iid_int = -1;
|
||||||
|
elseif (ctype_digit($iid))
|
||||||
|
$iid_int = intval($iid);
|
||||||
|
|
||||||
// Get list of alternative accounts
|
// Get list of alternative accounts
|
||||||
$sOpt = '';
|
$sOpt = '';
|
||||||
$sql = 'SELECT id, label, username FROM ' . $rc->db->table_name($this->table) . ' WHERE user_id = ? AND flags & ? > 0';
|
$sql = 'SELECT id, iid, label, username FROM ' . $rc->db->table_name($this->table) . ' WHERE user_id = ? AND flags & ? > 0';
|
||||||
$q = $rc->db->query($sql, $rc->user->data['user_id'], $this->db_enabled);
|
$q = $rc->db->query($sql, $rc->user->data['user_id'], $this->db_enabled);
|
||||||
while ($r = $rc->db->fetch_assoc($q))
|
while ($r = $rc->db->fetch_assoc($q))
|
||||||
{
|
{
|
||||||
$opts = array('value' => $r['id']);
|
$opts = array('value' => $r['id']);
|
||||||
if (strcasecmp($_SESSION['username'], $r['username']) === 0)
|
if ($iid_int == $r['iid'])
|
||||||
$opts['selected'] = 'selected';
|
$opts['selected'] = 'selected';
|
||||||
|
|
||||||
// Make label
|
// Make label
|
||||||
$lbl = $r['label'];
|
$lbl = $r['label'];
|
||||||
if (!$lbl)
|
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'];
|
||||||
|
}
|
||||||
|
|
||||||
if (strpos($r['username'], '@') === false)
|
if (strpos($r['username'], '@') === false)
|
||||||
$lbl = $r['username'] . '@' . ($r['host'] ? $r['host'] : 'localhost');
|
$lbl = $r['username'] . '@' . ($r['host'] ? $r['host'] : 'localhost');
|
||||||
else
|
else
|
||||||
@@ -89,7 +111,7 @@ class ident_switch extends rcube_plugin
|
|||||||
{
|
{
|
||||||
// Add main account
|
// Add main account
|
||||||
$opts = array('value' => -1);
|
$opts = array('value' => -1);
|
||||||
if (strcasecmp($_SESSION['username'], $rc->user->data['username']) === 0)
|
if (!$iid || $iid_int == -1)
|
||||||
$opts['selected'] = 'selected';
|
$opts['selected'] = 'selected';
|
||||||
|
|
||||||
$sOpt = html::tag(
|
$sOpt = html::tag(
|
||||||
@@ -120,7 +142,7 @@ class ident_switch extends rcube_plugin
|
|||||||
|
|
||||||
// TODO: Rewrite with full settings!
|
// TODO: Rewrite with full settings!
|
||||||
|
|
||||||
if (strcasecmp($rc->user->data['username'], $_SESSION['username']) !== 1)
|
if (strcasecmp($rc->user->data['username'], $_SESSION['username']) !== 0)
|
||||||
{
|
{
|
||||||
if ($args['smtp_user'] == '%u')
|
if ($args['smtp_user'] == '%u')
|
||||||
$args['smtp_user'] = $rc->user->data['username'];
|
$args['smtp_user'] = $rc->user->data['username'];
|
||||||
@@ -135,7 +157,7 @@ class ident_switch extends rcube_plugin
|
|||||||
{
|
{
|
||||||
$rc = rcmail::get_instance();
|
$rc = rcmail::get_instance();
|
||||||
|
|
||||||
// Do now show options for default identity
|
// Do not show options for default identity
|
||||||
if (strcasecmp($args['record']['email'], $rc->user->data['username']) === 0)
|
if (strcasecmp($args['record']['email'], $rc->user->data['username']) === 0)
|
||||||
return $args;
|
return $args;
|
||||||
|
|
||||||
@@ -146,13 +168,17 @@ class ident_switch extends rcube_plugin
|
|||||||
'name' => $this->gettext('form.caption'),
|
'name' => $this->gettext('form.caption'),
|
||||||
'content' => array(
|
'content' => array(
|
||||||
'ident_switch.form.enabled' => array('type' => 'checkbox', 'onchange' => 'plugin_switchIdent_enabled_onChange();'),
|
'ident_switch.form.enabled' => array('type' => 'checkbox', 'onchange' => 'plugin_switchIdent_enabled_onChange();'),
|
||||||
'ident_switch.form.label' => array('type' => 'text', 'size' => 32),
|
'ident_switch.form.label' => array('type' => 'text', 'size' => 32, 'placeholder' => $args['record']['email']),
|
||||||
'ident_switch.form.host' => array('type' => 'text', 'size' => 64),
|
'ident_switch.form.host' => array('type' => 'text', 'size' => 64, 'placeholder' => 'localhost'),
|
||||||
'ident_switch.form.secure' => array('type' => 'checkbox'),
|
'ident_switch.form.secure' => array(
|
||||||
|
'type' => 'select',
|
||||||
|
'options' => array('ssl' => 'SSL', 'tls' => 'TLS'),
|
||||||
|
'onchange' => 'plugin_switchIdent_secure_onChange();'
|
||||||
|
),
|
||||||
'ident_switch.form.port' => array('type' => 'text', 'size' => 5),
|
'ident_switch.form.port' => array('type' => 'text', 'size' => 5),
|
||||||
'ident_switch.form.username' => array('type' => 'text', 'size' => 64),
|
'ident_switch.form.username' => array('type' => 'text', 'size' => 64, 'placeholder' => $args['record']['email']),
|
||||||
'ident_switch.form.password' => array('type' => 'password', 'size' => 64),
|
'ident_switch.form.password' => array('type' => 'password', 'size' => 64),
|
||||||
'ident_switch.form.delimiter' => array('type' => 'text', 'size' => 1),
|
'ident_switch.form.delimiter' => array('type' => 'text', 'size' => 1, 'placeholder' => '.'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -170,8 +196,10 @@ class ident_switch extends rcube_plugin
|
|||||||
// Parse flags
|
// Parse flags
|
||||||
if ($r['flags'] & $this->db_enabled)
|
if ($r['flags'] & $this->db_enabled)
|
||||||
$args['record']['ident_switch.form.enabled'] = true;
|
$args['record']['ident_switch.form.enabled'] = true;
|
||||||
if ($r['flags'] & $this->db_secure)
|
if ($r['flags'] & $this->db_secure_tls) // TLS has priority
|
||||||
$args['record']['ident_switch.form.secure'] = true;
|
$args['record']['ident_switch.form.secure'] = 'tls';
|
||||||
|
elseif ($r['flags'] & $this->db_secure_ssl)
|
||||||
|
$args['record']['ident_switch.form.secure'] = 'ssl';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,79 +210,91 @@ class ident_switch extends rcube_plugin
|
|||||||
{
|
{
|
||||||
$rc = rcmail::get_instance();
|
$rc = rcmail::get_instance();
|
||||||
|
|
||||||
|
// Do not do anything for default identity
|
||||||
|
if (strcasecmp($args['record']['email'], $rc->user->data['username']) === 0)
|
||||||
|
return $args;
|
||||||
|
|
||||||
|
// Process boolean fields
|
||||||
|
$flags = 0;
|
||||||
|
if (get_input_value('_ident_switch_form_enabled', RCUBE_INPUT_POST))
|
||||||
|
$flags |= $this->db_enabled;
|
||||||
|
|
||||||
|
if (!($flags & $this->db_enabled))
|
||||||
|
{
|
||||||
|
$this->sw_imap_off($args['iid']);
|
||||||
|
return $args;
|
||||||
|
}
|
||||||
|
|
||||||
// Check field values
|
// Check field values
|
||||||
$noErrors = false;
|
$errMsg = '';
|
||||||
|
|
||||||
$fLabel = self::ntrim(get_input_value('_ident_switch_form_label', RCUBE_INPUT_POST));
|
$fLabel = self::ntrim(get_input_value('_ident_switch_form_label', RCUBE_INPUT_POST));
|
||||||
if (strlen($fLabel) > 32)
|
if (strlen($fLabel) > 32)
|
||||||
$rc->output->show_message('err.label.long', 'error');
|
$errMsg = 'label.long';
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$fHost = self::ntrim(get_input_value('_ident_switch_form_host', RCUBE_INPUT_POST));
|
$fHost = self::ntrim(get_input_value('_ident_switch_form_host', RCUBE_INPUT_POST));
|
||||||
if (strlen($fHost) > 64)
|
if (strlen($fHost) > 64)
|
||||||
$rc->output->show_message('err.host.long', 'error');
|
$errMsg = 'host.long';
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$fPort = self::ntrim(get_input_value('_ident_switch_form_port', RCUBE_INPUT_POST));
|
$fPort = self::ntrim(get_input_value('_ident_switch_form_port', RCUBE_INPUT_POST));
|
||||||
if ($fPort && !ctype_digit($fPort))
|
if ($fPort && !ctype_digit($fPort))
|
||||||
$rc->output->show_message('err.port.num', 'error');
|
$errMsg = 'port.num';
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($fPort && ($fPort <= 0 || $fPort > 65535))
|
if ($fPort && ($fPort <= 0 || $fPort > 65535))
|
||||||
$rc->output->show_message('err.port.num', 'error');
|
$errMsg = 'port.range';
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$fUser = self::ntrim(get_input_value('_ident_switch_form_username', RCUBE_INPUT_POST));
|
$fUser = self::ntrim(get_input_value('_ident_switch_form_username', RCUBE_INPUT_POST));
|
||||||
if (strlen($fUser) > 64)
|
if (strlen($fUser) > 64)
|
||||||
$rc->output->show_message('err.user.long', 'error');
|
$errMsg = 'user.long';
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!$fUser)
|
|
||||||
$rc->output->show_message('err.user.empty', 'error');
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$fDelim = self::ntrim(get_input_value('_ident_switch_form_delimiter', RCUBE_INPUT_POST));
|
$fDelim = self::ntrim(get_input_value('_ident_switch_form_delimiter', RCUBE_INPUT_POST));
|
||||||
if (strlen($fDelim) > 1)
|
if (strlen($fDelim) > 1)
|
||||||
$rc->output->show_message('err.delim.long', 'error');
|
$errMsg = 'delim.long';
|
||||||
else
|
|
||||||
$noErrors = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$noErrors)
|
if ($errMsg)
|
||||||
{
|
{
|
||||||
//$rc->output->send();
|
$this->add_texts('localization');
|
||||||
|
$rc->output->show_message('ident_switch.err.' . $errMsg, 'error');
|
||||||
$args['abort'] = true;
|
$args['abort'] = true;
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT password FROM ' . $rc->db->table_name($this->table) . ' WHERE iid = ? AND user_id = ?';
|
// Parse secure settings
|
||||||
|
$ssl = get_input_value('_ident_switch_form_secure', RCUBE_INPUT_POST);
|
||||||
|
if (strcasecmp($ssl, 'tls') === 0)
|
||||||
|
$flags |= $this->db_secure_tls;
|
||||||
|
elseif (strcasecmp($ssl, 'ssl') === 0)
|
||||||
|
$flags |= $this->db_secure_ssl;
|
||||||
|
|
||||||
|
$sql = 'SELECT id, password FROM ' . $rc->db->table_name($this->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);
|
||||||
$r = $rc->db->fetch_assoc($q);
|
$r = $rc->db->fetch_assoc($q);
|
||||||
if ($r)
|
if ($r)
|
||||||
{ // Record already exists, will update it
|
{ // Record already exists, will update it
|
||||||
$sql = 'UPDATE ' .
|
$sql = 'UPDATE ' .
|
||||||
$rc->db->table_name($this->table) .
|
$rc->db->table_name($this->table) .
|
||||||
' SET flags = ?, label = ?, host = ?, port = ?, username = ?, password = ?, delimiter = ?, user_id = ?, iid = ?';
|
' SET flags = ?, label = ?, host = ?, port = ?, username = ?, password = ?, delimiter = ?, user_id = ?, iid = ?' .
|
||||||
|
' WHERE id = ?';
|
||||||
}
|
}
|
||||||
else
|
else if ($flags & $this->db_enabled)
|
||||||
{ // No record exists, create new one
|
{ // No record exists, create new one
|
||||||
$sql = 'INSERT INTO ' .
|
$sql = 'INSERT INTO ' .
|
||||||
$rc->db->table_name($this->table) .
|
$rc->db->table_name($this->table) .
|
||||||
'(flags, label, host, port, username, password, delimiter, user_id, iid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)';
|
'(flags, label, host, port, username, password, delimiter, user_id, iid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process boolean fields
|
if ($sql)
|
||||||
$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;
|
|
||||||
|
|
||||||
// Do we need to update pwd?
|
// Do we need to update pwd?
|
||||||
$fPass = get_input_value('_ident_switch_form_password', RCUBE_INPUT_POST);
|
$fPass = get_input_value('_ident_switch_form_password', RCUBE_INPUT_POST);
|
||||||
if ($fPass != $r['password'])
|
if ($fPass != $r['password'])
|
||||||
@@ -270,8 +310,10 @@ class ident_switch extends rcube_plugin
|
|||||||
$fPass,
|
$fPass,
|
||||||
$fDelim,
|
$fDelim,
|
||||||
$rc->user->ID,
|
$rc->user->ID,
|
||||||
$args['id']
|
$args['id'],
|
||||||
|
$r['id']
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
@@ -334,21 +376,36 @@ class ident_switch extends rcube_plugin
|
|||||||
$r = $rc->db->fetch_assoc($q);
|
$r = $rc->db->fetch_assoc($q);
|
||||||
if (is_array($r))
|
if (is_array($r))
|
||||||
{
|
{
|
||||||
|
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'];
|
||||||
|
}
|
||||||
|
|
||||||
$rc->write_log(
|
$rc->write_log(
|
||||||
$this->my_log,
|
$this->my_log,
|
||||||
'Switching mailbox to one for identity with ID = ' . $r['iid'] . ' (username = \'' . $r['username'] . '\').'
|
'Switching mailbox to one for identity with ID = ' . $r['iid'] . ' (username = \'' . $r['username'] . '\').'
|
||||||
);
|
);
|
||||||
|
|
||||||
$port = $r['port'];
|
$def_port = 143; // Default port here!
|
||||||
$ssl = false;
|
$ssl = null;
|
||||||
if ($r['flags'] & $this->db_secure)
|
if ($r['flags'] & $this->db_secure_tls)
|
||||||
{
|
{
|
||||||
$ssl = true;
|
$ssl = 'tls';
|
||||||
if (!$port)
|
$def_port = 143; // Default TLS port here!
|
||||||
$port = 993; // Default SSL/TLS port here!
|
|
||||||
}
|
}
|
||||||
|
elseif ($r['flags'] & $this->db_secure_ssl)
|
||||||
|
{
|
||||||
|
$ssl = 'ssl';
|
||||||
|
$def_port = 993; // Default SSL port here!
|
||||||
|
}
|
||||||
|
|
||||||
|
$port = $r['port'];
|
||||||
if (!$port)
|
if (!$port)
|
||||||
$port = 143; // Default port here!
|
$port = $def_port;
|
||||||
|
|
||||||
// If we are in default account now
|
// If we are in default account now
|
||||||
// save everything with STORAGE
|
// save everything with STORAGE
|
||||||
@@ -358,11 +415,13 @@ class ident_switch extends rcube_plugin
|
|||||||
{
|
{
|
||||||
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, $this->my_postfix, -$my_postfix_len, $my_postfix_len) !== 0)
|
||||||
{
|
{
|
||||||
|
if (!$_SESSION[$k . $this->my_postfix])
|
||||||
$_SESSION[$k . $this->my_postfix] = $_SESSION[$k];
|
$_SESSION[$k . $this->my_postfix] = $_SESSION[$k];
|
||||||
$rc->session->remove($k);
|
$rc->session->remove($k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!$_SESSION['password' . $this->my_postfix])
|
||||||
$_SESSION['password' . $this->my_postfix] = $_SESSION['password'];
|
$_SESSION['password' . $this->my_postfix] = $_SESSION['password'];
|
||||||
|
|
||||||
$_SESSION['storage_host'] = $r['host'] ? $r['host'] : 'localhost'; // Default host here!
|
$_SESSION['storage_host'] = $r['host'] ? $r['host'] : 'localhost'; // Default host here!
|
||||||
@@ -390,6 +449,14 @@ class ident_switch extends rcube_plugin
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function sw_imap_off($iid)
|
||||||
|
{
|
||||||
|
$rc = rcmail::get_instance();
|
||||||
|
|
||||||
|
$sql = 'UPDATE ' . $rc->db->table_name($this->table) . ' SET flags = flags & ? WHERE iid = ? AND user_id = ?';
|
||||||
|
$rc->db->query($sql, ~$this->db_enabled, $iid, $rc->user->ID);
|
||||||
|
}
|
||||||
|
|
||||||
protected static function ntrim($str)
|
protected static function ntrim($str)
|
||||||
{
|
{
|
||||||
if (is_null($str))
|
if (is_null($str))
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ $labels['form.label'] = 'Label';
|
|||||||
$labels['form.host']='Server host name';
|
$labels['form.host']='Server host name';
|
||||||
|
|
||||||
// Secure connection (SSL/TLS)
|
// Secure connection (SSL/TLS)
|
||||||
$labels['form.secure']='Secure connection (SSL/TLS)';
|
$labels['form.secure']='Connection security';
|
||||||
|
|
||||||
// Port
|
// Port
|
||||||
$labels['form.port']='Port';
|
$labels['form.port']='Port';
|
||||||
@@ -30,3 +30,21 @@ $labels['form.password'] = 'Password';
|
|||||||
|
|
||||||
// Folder hierarchy delimiter
|
// Folder hierarchy delimiter
|
||||||
$labels['form.delimiter'] = 'Folder hierarchy delimiter';
|
$labels['form.delimiter'] = 'Folder hierarchy delimiter';
|
||||||
|
|
||||||
|
// Value in \'Label\' field of IMAP section is too long (32 chars max).
|
||||||
|
$labels['err.label.long'] = 'Value in \'Label\' field of IMAP section is too long (32 chars max).';
|
||||||
|
|
||||||
|
// Value in \'Server host name\' field of IMAP section is too long (64 chars max).
|
||||||
|
$labels['err.host.long'] = 'Value in \'Server host name\' field of IMAP section is too long (64 chars max).';
|
||||||
|
|
||||||
|
// Value in \'Username\' field of IMAP section is too long (64 chars max).
|
||||||
|
$labels['err.user.long'] = 'Value in \'Username\' field of IMAP section is too long (64 chars max).';
|
||||||
|
|
||||||
|
// Value in \'Folder hierarchy delimiter\' field of IMAP section is too long (1 char max).
|
||||||
|
$labels['err.delim.long'] = 'Value in \'Folder hierarchy delimiter\' field of IMAP section is too long (1 char max).';
|
||||||
|
|
||||||
|
// Value in \'Port\' field of IMAP section must be a number.
|
||||||
|
$labels['err.port.num'] = 'Value in \'Port\' field of IMAP section must be a number.';
|
||||||
|
|
||||||
|
// Value in \'Port\' field of IMAP section must be between 1 and 65535.
|
||||||
|
$labels['err.port.rtange'] = 'Value in \'Port\' field of IMAP section must be between 1 and 65535.';
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ $labels['form.label'] = 'Название';
|
|||||||
$labels['form.host'] = 'Адрес сервера';
|
$labels['form.host'] = 'Адрес сервера';
|
||||||
|
|
||||||
// Secure connection (SSL/TLS)
|
// Secure connection (SSL/TLS)
|
||||||
$labels['form.secure'] = 'Безопасное соединение (SSL/TLS)';
|
$labels['form.secure'] = 'Защита подключения';
|
||||||
|
|
||||||
// Port
|
// Port
|
||||||
$labels['form.port'] = 'Порт';
|
$labels['form.port'] = 'Порт';
|
||||||
@@ -30,3 +30,21 @@ $labels['form.password'] = 'Пароль';
|
|||||||
|
|
||||||
// Folder hierarchy delimiter
|
// Folder hierarchy delimiter
|
||||||
$labels['form.delimiter'] = 'Разделитель в иерархии папок';
|
$labels['form.delimiter'] = 'Разделитель в иерархии папок';
|
||||||
|
|
||||||
|
// Value in \'Label\' field of IMAP section is too long (32 chars max).
|
||||||
|
$labels['err.label.long'] = '\'Название\' в разделе IMAP должно быть не длинее 32 символов.';
|
||||||
|
|
||||||
|
// Value in \'Server host name\' field of IMAP section is too long (64 chars max).
|
||||||
|
$labels['err.host.long'] = '\'Адрес сервера\' в разделе IMAP должен быть не длинее 64 символов.';
|
||||||
|
|
||||||
|
// Value in \'Username\' field of IMAP section is too long (64 chars max).
|
||||||
|
$labels['err.user.long'] = '\'Имя пользователя\' в секции IMAP должно быть не длинее 64 символов.';
|
||||||
|
|
||||||
|
// Value in \'Folder hierarchy delimiter\' field of IMAP section is too long (1 char max).
|
||||||
|
$labels['err.delim.long'] = '\'Разделитель в иерархии папок\' в секции IMAP должен быть не длинее 1 символа.';
|
||||||
|
|
||||||
|
// Value in \'Port\' field of IMAP section must be a number.
|
||||||
|
$labels['err.port.num'] = '\'Порт\' в секции IMAP должен быть числом.';
|
||||||
|
|
||||||
|
// Value in \'Port\' field of IMAP section must be between 1 and 65535.
|
||||||
|
$labels['err.port.rtange'] = '\'Порт\' в секции IMAP должен быть в диапазоне от 1 до 65535.';
|
||||||
|
|||||||
Reference in New Issue
Block a user