Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5577699dae | ||
|
|
eb8175fb7c | ||
|
|
3e803f65a2 | ||
|
|
ad97f4bfd0 | ||
|
|
181ac6b27c | ||
|
|
ae7b905824 | ||
|
|
5aed4c9947 | ||
|
|
46eba62185 | ||
|
|
ca790d72de | ||
|
|
af54e4b099 | ||
|
|
da17fb896b | ||
|
|
afc4f54594 | ||
|
|
7795a0fbf9 | ||
|
|
6fa82d6ba5 | ||
|
|
fff6c6b95a | ||
|
|
92d0f40e3c |
@@ -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 1.X (not supported any more) - for Roundcube v1.1
|
||||||
* Versions 2.X (not supported any more) - for Roundcube v1.2
|
* Versions 2.X (not supported any more) - for Roundcube v1.2
|
||||||
* Versions 3.X (not supported any more) - for Roundcube v1.3
|
* 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.
|
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.
|
||||||
|
|||||||
@@ -34,6 +34,18 @@ CREATE TABLE ident_switch
|
|||||||
smtp_port
|
smtp_port
|
||||||
integer
|
integer
|
||||||
CHECK(smtp_port > 0 AND smtp_port <= 65535),
|
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)
|
UNIQUE (user_id, label)
|
||||||
);
|
);
|
||||||
CREATE INDEX IX_ident_switch_user_id ON ident_switch(user_id);
|
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": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Boris Gulay",
|
"name": "Boris Gulay",
|
||||||
"email": "boris@boressoft.ru",
|
"email": "boris@gulay.name",
|
||||||
"role": "Developer"
|
"role": "Developer"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This plugin allows fast switching between accounts.
|
* This plugin allows fast switching between accounts.
|
||||||
*
|
*
|
||||||
* @version 1.0
|
* @version 4.4.2
|
||||||
* @author Boris Gulay
|
* @author Boris Gulay
|
||||||
* @url
|
* @url
|
||||||
*/
|
*/
|
||||||
@@ -69,7 +69,7 @@ class ident_switch extends rcube_plugin
|
|||||||
{
|
{
|
||||||
$defaultKey = $type . '_mbox_default' . self::MY_POSTFIX;
|
$defaultKey = $type . '_mbox_default' . self::MY_POSTFIX;
|
||||||
$otherKey = $type . '_mbox' . self::MY_POSTFIX;
|
$otherKey = $type . '_mbox' . self::MY_POSTFIX;
|
||||||
$val = $_SESSION[$otherKey] ? $_SESSION[$otherKey] : $_SESSION[$defaultKey];
|
$val = isset($_SESSION[$otherKey]) ? $_SESSION[$otherKey] : $_SESSION[$defaultKey];
|
||||||
$rc->config->set($type . '_mbox', $val);
|
$rc->config->set($type . '_mbox', $val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ class ident_switch extends rcube_plugin
|
|||||||
elseif (ctype_digit($iid_s))
|
elseif (ctype_digit($iid_s))
|
||||||
$iid = intval($iid_s);
|
$iid = intval($iid_s);
|
||||||
|
|
||||||
$accNames = array($_SESSION['global_alias'] ? $_SESSION['global_alias'] : $rc->user->data['username']);
|
$accNames = array(isset($_SESSION['global_alias']) ? $_SESSION['global_alias'] : $rc->user->data['username']);
|
||||||
$accValues = array(-1);
|
$accValues = array(-1);
|
||||||
$accSelected = -1;
|
$accSelected = -1;
|
||||||
|
|
||||||
@@ -159,11 +159,24 @@ class ident_switch extends rcube_plugin
|
|||||||
{
|
{
|
||||||
$iid = $_SESSION['iid' . self::MY_POSTFIX];
|
$iid = $_SESSION['iid' . self::MY_POSTFIX];
|
||||||
if (!is_numeric($iid) || $iid == -1)
|
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;
|
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();
|
$rc = rcmail::get_instance();
|
||||||
|
|
||||||
$sql = 'SELECT smtp_host, flags, smtp_port, username, smtp_auth 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);
|
$q = $rc->db->query($sql, $iid ,$rc->user->ID);
|
||||||
$r = $rc->db->fetch_assoc($q);
|
$r = $rc->db->fetch_assoc($q);
|
||||||
if (is_array($r))
|
if (is_array($r))
|
||||||
@@ -179,16 +192,32 @@ class ident_switch extends rcube_plugin
|
|||||||
|
|
||||||
$args['smtp_user'] = $r['username'];
|
$args['smtp_user'] = $r['username'];
|
||||||
$args['smtp_pass'] = $r['smtp_auth'] == self::SMTP_AUTH_IMAP ? $rc->decrypt($r['password']) : '';
|
$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
|
# 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 ($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.');
|
self::write_log('SMTP server already contains protocol, ignoring TLS flag.');
|
||||||
else
|
else
|
||||||
$args['smtp_server'] = 'tls://' . $args['smtp_server'];
|
$args[$paramSmtpHost] = 'tls://' . $args[$paramSmtpHost];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$smtpPort = $r['smtp_port'] ? $r['smtp_port'] : 587; // Default SMTP port here
|
||||||
|
if ($paramSmtpPort)
|
||||||
|
$args[$paramSmtpPort] = $smtpPort;
|
||||||
|
else
|
||||||
|
$args[$paramSmtpHost] .= ':' . $smtpPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $args;
|
return $args;
|
||||||
@@ -658,6 +687,8 @@ class ident_switch extends rcube_plugin
|
|||||||
$rc->session->remove($k);
|
$rc->session->remove($k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$delimiter = isset($config['imap_delimiter']) ? $config['imap_delimiter']:'.';
|
||||||
|
$_SESSION['imap_delimiter'] = $delimiter;
|
||||||
$_SESSION['username'] = $rc->user->data['username'];
|
$_SESSION['username'] = $rc->user->data['username'];
|
||||||
$_SESSION['password'] = $_SESSION['password' . self::MY_POSTFIX];
|
$_SESSION['password'] = $_SESSION['password' . self::MY_POSTFIX];
|
||||||
$_SESSION['iid' . self::MY_POSTFIX] = -1;
|
$_SESSION['iid' . self::MY_POSTFIX] = -1;
|
||||||
@@ -665,7 +696,7 @@ class ident_switch extends rcube_plugin
|
|||||||
foreach (rcube_storage::$folder_types as $type)
|
foreach (rcube_storage::$folder_types as $type)
|
||||||
{
|
{
|
||||||
$otherKey = $type . '_mbox' . self::MY_POSTFIX;
|
$otherKey = $type . '_mbox' . self::MY_POSTFIX;
|
||||||
if ($_SESSION[$otherKey])
|
if (isset($_SESSION[$otherKey]))
|
||||||
$rc->session->remove($otherKey);
|
$rc->session->remove($otherKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -693,7 +724,7 @@ class ident_switch extends rcube_plugin
|
|||||||
{
|
{
|
||||||
if (strncasecmp($k, 'storage', 7) === 0 && substr_compare($k, self::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)
|
||||||
{
|
{
|
||||||
if (!$_SESSION[$k . self::MY_POSTFIX])
|
if (!isset($_SESSION[$k . self::MY_POSTFIX]))
|
||||||
$_SESSION[$k . self::MY_POSTFIX] = $_SESSION[$k];
|
$_SESSION[$k . self::MY_POSTFIX] = $_SESSION[$k];
|
||||||
|
|
||||||
$rc->session->remove($k);
|
$rc->session->remove($k);
|
||||||
@@ -703,7 +734,7 @@ class ident_switch extends rcube_plugin
|
|||||||
$moreToSave = array('password', 'imap_delimiter');
|
$moreToSave = array('password', 'imap_delimiter');
|
||||||
foreach ($moreToSave as $k)
|
foreach ($moreToSave as $k)
|
||||||
{
|
{
|
||||||
if (!$_SESSION[$k . self::MY_POSTFIX])
|
if (!isset($_SESSION[$k . self::MY_POSTFIX]))
|
||||||
$_SESSION[$k . self::MY_POSTFIX] = $_SESSION[$k];
|
$_SESSION[$k . self::MY_POSTFIX] = $_SESSION[$k];
|
||||||
|
|
||||||
$rc->session->remove($k);
|
$rc->session->remove($k);
|
||||||
@@ -724,7 +755,7 @@ class ident_switch extends rcube_plugin
|
|||||||
if ($ssl && strncasecmp($host, $hostProtocol, strlen($hostProtocol)) !== 0)
|
if ($ssl && strncasecmp($host, $hostProtocol, strlen($hostProtocol)) !== 0)
|
||||||
$host = $hostProtocol . $host;
|
$host = $hostProtocol . $host;
|
||||||
|
|
||||||
$delimiter = $r['imap_delimiter'] ? $r['imap_delimiter'] : '.'; // Default delimiter here
|
$delimiter = isset($r['imap_delimiter']) ? $r['imap_delimiter'] : '.'; // Default delimiter here
|
||||||
|
|
||||||
$_SESSION['storage_host'] = $host;
|
$_SESSION['storage_host'] = $host;
|
||||||
$_SESSION['storage_ssl'] = $ssl;
|
$_SESSION['storage_ssl'] = $ssl;
|
||||||
@@ -736,7 +767,7 @@ class ident_switch extends rcube_plugin
|
|||||||
|
|
||||||
foreach (rcube_storage::$folder_types as $type)
|
foreach (rcube_storage::$folder_types as $type)
|
||||||
{
|
{
|
||||||
if ($r[$type . '_mbox']) {
|
if (isset($r[$type . '_mbox'])) {
|
||||||
$otherKey = $type . '_mbox' . self::MY_POSTFIX;
|
$otherKey = $type . '_mbox' . self::MY_POSTFIX;
|
||||||
$_SESSION[$otherKey] = $r[$type . '_mbox'];
|
$_SESSION[$otherKey] = $r[$type . '_mbox'];
|
||||||
}
|
}
|
||||||
|
|||||||
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