'_imap_host[]', 'size' => 30]);
+$text_imaphost = new \html_inputfield(['name' => '_imap_host[]', 'size' => 30]);
$default_hosts = $RCI->get_hostlist();
if (empty($default_hosts)) {
@@ -344,7 +344,7 @@
';
diff --git a/installer/index.php b/installer/index.php
index 931bd75272a..d063f86dc5b 100644
--- a/installer/index.php
+++ b/installer/index.php
@@ -46,7 +46,7 @@
session_start();
}
-$RCI = rcmail_install::get_instance();
+$RCI = \rcmail_install::get_instance();
$RCI->load_config();
if (isset($_GET['_getconfig'])) {
@@ -150,7 +150,7 @@
foreach (['Check environment', 'Create config', 'Test config'] as $i => $item) {
$j = $i + 1;
- $link = ($RCI->step >= $j || $RCI->configured) ? '' . rcube::Q($item) . '' : rcube::Q($item);
+ $link = ($RCI->step >= $j || $RCI->configured) ? '' . \rcube::Q($item) . '' : \rcube::Q($item);
printf('%s', $j + 1, $RCI->step > $j ? ' passed' : ($RCI->step == $j ? ' current' : ''), $link);
}
?>
diff --git a/installer/test.php b/installer/test.php
index 2c774886014..8fd77657d06 100644
--- a/installer/test.php
+++ b/installer/test.php
@@ -18,8 +18,8 @@
exit('Not allowed! Please open installer/index.php instead.');
}
-/** @var rcmail_install $RCI */
-/** @var rcube_db|null $DB */
+/** @var \rcmail_install $RCI */
+/** @var \rcube_db|null $DB */
$DB = null;
@@ -62,8 +62,8 @@
echo '';
foreach ($messages['replaced'] as $msg) {
- echo html::tag('li', null, html::span('propname', $msg['prop']) .
- ' was replaced by ' . html::span('propname', $msg['replacement']));
+ echo \html::tag('li', null, \html::span('propname', $msg['prop']) .
+ ' was replaced by ' . \html::span('propname', $msg['replacement']));
}
echo '
';
}
@@ -74,14 +74,14 @@
echo '';
foreach ($messages['obsolete'] as $msg) {
- echo html::tag('li', null, html::span('propname', $msg['prop'])
+ echo \html::tag('li', null, \html::span('propname', $msg['prop'])
. (!empty($msg['explain']) ? ': ' . $msg['explain'] : ''));
}
echo '
';
}
echo 'OK, lazy people can download the updated config file here: ';
- echo html::a(['href' => './?_mergeconfig=1'], 'config.inc.php') . ' ';
+ echo \html::a(['href' => './?_mergeconfig=1'], 'config.inc.php') . ' ';
echo '
';
if (!empty($messages['dependencies'])) {
@@ -90,7 +90,7 @@
echo '';
foreach ($messages['dependencies'] as $msg) {
- echo html::tag('li', null, html::span('propname', $msg['prop']) . ': ' . $msg['explain']);
+ echo \html::tag('li', null, \html::span('propname', $msg['prop']) . ': ' . $msg['explain']);
}
echo '
';
}
@@ -108,7 +108,7 @@
}
foreach ($dirs as $dir) {
- $dirpath = rcube_utils::is_absolute_path($dir) ? $dir : INSTALL_PATH . $dir;
+ $dirpath = \rcube_utils::is_absolute_path($dir) ? $dir : INSTALL_PATH . $dir;
if (is_writable(realpath($dirpath))) {
$RCI->pass($dir);
$pass = true;
@@ -129,7 +129,7 @@
if ($RCI->configured) {
if (!empty($RCI->config['db_dsnw'])) {
- $DB = rcube_db::factory($RCI->config['db_dsnw'], '', false);
+ $DB = \rcube_db::factory($RCI->config['db_dsnw'], '', false);
$DB->set_debug((bool) $RCI->config['sql_debug']);
$DB->db_connect('w');
@@ -139,7 +139,7 @@
} else {
$RCI->fail('DSN (write)', $db_error_msg);
echo 'Make sure that the configured database exists and that the user has write privileges
';
- echo 'DSN: ' . rcube::Q($RCI->config['db_dsnw']) . '
';
+ echo 'DSN: ' . \rcube::Q($RCI->config['db_dsnw']) . '';
$DB = null;
}
} else {
@@ -249,26 +249,26 @@
$smtp_hosts = $RCI->get_hostlist('smtp_host');
if (!empty($smtp_hosts)) {
- $smtp_host_field = new html_select(['name' => '_smtp_host', 'id' => 'smtp_host']);
+ $smtp_host_field = new \html_select(['name' => '_smtp_host', 'id' => 'smtp_host']);
$smtp_host_field->add($smtp_hosts, $smtp_hosts);
} else {
- $smtp_host_field = new html_inputfield(['name' => '_smtp_host', 'id' => 'smtp_host']);
+ $smtp_host_field = new \html_inputfield(['name' => '_smtp_host', 'id' => 'smtp_host']);
}
$user = $RCI->getprop('smtp_user', '(none)');
$pass = $RCI->getprop('smtp_pass', '(none)');
if ($user == '%u') {
- $user_field = new html_inputfield(['name' => '_smtp_user', 'id' => 'smtp_user']);
+ $user_field = new \html_inputfield(['name' => '_smtp_user', 'id' => 'smtp_user']);
$user = $user_field->show($_POST['_smtp_user'] ?? '');
} else {
- $user = html::quote($user);
+ $user = \html::quote($user);
}
if ($pass == '%p') {
- $pass_field = new html_passwordfield(['name' => '_smtp_pass', 'id' => 'smtp_pass']);
+ $pass_field = new \html_passwordfield(['name' => '_smtp_pass', 'id' => 'smtp_pass']);
$pass = $pass_field->show();
} else {
- $pass = html::quote($pass);
+ $pass = \html::quote($pass);
}
?>
@@ -298,16 +298,16 @@
'_from', 'id' => 'sendmailfrom']);
-$to_field = new html_inputfield(['name' => '_to', 'id' => 'sendmailto']);
+$from_field = new \html_inputfield(['name' => '_from', 'id' => 'sendmailfrom']);
+$to_field = new \html_inputfield(['name' => '_to', 'id' => 'sendmailto']);
if (isset($_POST['sendmail'])) {
echo 'Trying to send email...
';
$smtp_host = trim($_POST['_smtp_host']);
- $from = rcube_utils::idn_to_ascii(trim($_POST['_from']));
- $to = rcube_utils::idn_to_ascii(trim($_POST['_to']));
+ $from = \rcube_utils::idn_to_ascii(trim($_POST['_from']));
+ $to = \rcube_utils::idn_to_ascii(trim($_POST['_to']));
if (
preg_match('/^' . $RCI->email_pattern . '$/i', $from)
@@ -331,11 +331,11 @@
$CONFIG['smtp_pass'] = $_POST['_smtp_pass'];
}
- $mail_object = new Mail_mime();
+ $mail_object = new \Mail_mime();
$send_headers = $mail_object->headers($headers);
$head = $mail_object->txtHeaders($send_headers);
- $SMTP = new rcube_smtp();
+ $SMTP = new \rcube_smtp();
$SMTP->connect($smtp_host, null, $CONFIG['smtp_user'], $CONFIG['smtp_pass']);
$status = $SMTP->send_mail($headers['From'], $headers['To'], $head, $body);
@@ -380,14 +380,14 @@
$default_hosts = $RCI->get_hostlist();
if (!empty($default_hosts)) {
- $host_field = new html_select(['name' => '_host', 'id' => 'imaphost']);
+ $host_field = new \html_select(['name' => '_host', 'id' => 'imaphost']);
$host_field->add($default_hosts, $default_hosts);
} else {
- $host_field = new html_inputfield(['name' => '_host', 'id' => 'imaphost']);
+ $host_field = new \html_inputfield(['name' => '_host', 'id' => 'imaphost']);
}
-$user_field = new html_inputfield(['name' => '_user', 'id' => 'imapuser']);
-$pass_field = new html_passwordfield(['name' => '_pass', 'id' => 'imappass']);
+$user_field = new \html_inputfield(['name' => '_user', 'id' => 'imapuser']);
+$pass_field = new \html_passwordfield(['name' => '_pass', 'id' => 'imappass']);
?>
@@ -411,7 +411,7 @@
Connecting to ' . rcube::Q($_POST['_host']) . '...
';
+ echo '
Connecting to ' . \rcube::Q($_POST['_host']) . '...
';
$imap_host = trim($_POST['_host']);
$imap_port = 143;
@@ -424,10 +424,10 @@
$imap_port = $a_host['port'] ?? ($imap_ssl && $imap_ssl != 'tls' ? 993 : 143);
}
- $imap_host = rcube_utils::idn_to_ascii($imap_host);
- $imap_user = rcube_utils::idn_to_ascii($_POST['_user']);
+ $imap_host = \rcube_utils::idn_to_ascii($imap_host);
+ $imap_user = \rcube_utils::idn_to_ascii($_POST['_user']);
- $imap = new rcube_imap();
+ $imap = new \rcube_imap();
$imap->set_options([
'auth_type' => $RCI->getprop('imap_auth_type'),
'debug' => $RCI->getprop('imap_debug'),
diff --git a/plugins/acl/acl.php b/plugins/acl/acl.php
index 20aff988d1f..60d23d1536e 100644
--- a/plugins/acl/acl.php
+++ b/plugins/acl/acl.php
@@ -21,7 +21,7 @@
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
-class acl extends rcube_plugin
+class acl extends \rcube_plugin
{
public $task = 'settings';
@@ -34,10 +34,10 @@ class acl extends rcube_plugin
/**
* Plugin initialization
*/
- #[Override]
+ #[\Override]
public function init()
{
- $this->rc = rcmail::get_instance();
+ $this->rc = \rcmail::get_instance();
// Register hooks
$this->add_hook('folder_form', [$this, 'folder_form']);
@@ -52,7 +52,7 @@ public function init()
*/
public function acl_actions()
{
- $action = trim(rcube_utils::get_input_string('_act', rcube_utils::INPUT_GPC));
+ $action = trim(\rcube_utils::get_input_string('_act', \rcube_utils::INPUT_GPC));
// Connect to IMAP
$this->rc->storage_init();
@@ -80,8 +80,8 @@ public function acl_autocomplete()
{
$this->load_config();
- $search = rcube_utils::get_input_string('_search', rcube_utils::INPUT_GPC, true);
- $reqid = rcube_utils::get_input_string('_reqid', rcube_utils::INPUT_GPC);
+ $search = \rcube_utils::get_input_string('_search', \rcube_utils::INPUT_GPC, true);
+ $reqid = \rcube_utils::get_input_string('_reqid', \rcube_utils::INPUT_GPC);
$users = [];
$keys = [];
@@ -101,7 +101,7 @@ public function acl_autocomplete()
}
if ($user) {
- $display = rcube_addressbook::compose_search_name($record);
+ $display = \rcube_addressbook::compose_search_name($record);
$user = ['name' => $user, 'display' => $display];
$users[] = $user;
$keys[] = $display ?: $user['name'];
@@ -186,7 +186,7 @@ public function folder_form($args)
// Display folder rights to 'Info' fieldset
$args['form']['props']['fieldsets']['info']['content']['myrights'] = [
- 'label' => rcube::Q($this->gettext('myrights')),
+ 'label' => \rcube::Q($this->gettext('myrights')),
'value' => $this->acl2text($myrights),
];
@@ -210,7 +210,7 @@ public function folder_form($args)
$this->rc->output->add_label('autocompletechars', 'autocompletemore');
$args['form']['sharing'] = [
- 'name' => rcube::Q($this->gettext('sharing')),
+ 'name' => \rcube::Q($this->gettext('sharing')),
'content' => $this->rc->output->parse('acl.table', false, false),
];
@@ -260,19 +260,19 @@ public function templ_rights($attrib)
$out = '';
$ul = '';
- $input = new html_checkbox();
+ $input = new \html_checkbox();
// Advanced rights
$attrib['id'] = 'advancedrights';
foreach ($supported as $key => $val) {
$id = "acl{$val}";
- $ul .= html::tag('li', null,
+ $ul .= \html::tag('li', null,
$input->show('', ['name' => "acl[{$val}]", 'value' => $val, 'id' => $id])
- . html::label(['for' => $id, 'title' => $this->gettext('longacl' . $val)], $this->gettext('acl' . $val))
+ . \html::label(['for' => $id, 'title' => $this->gettext('longacl' . $val)], $this->gettext('acl' . $val))
);
}
- $out = html::tag('ul', $attrib, $ul, html::$common_attrib);
+ $out = \html::tag('ul', $attrib, $ul, \html::$common_attrib);
// Simple rights
$ul = '';
@@ -293,13 +293,13 @@ public function templ_rights($attrib)
$id = "acl{$key}";
$title = !empty($data['titles'][$key]) ? $data['titles'][$key] : $this->gettext('longacl' . $key);
$label = !empty($data['labels'][$key]) ? $data['labels'][$key] : $this->gettext('acl' . $key);
- $ul .= html::tag('li', null,
+ $ul .= \html::tag('li', null,
$input->show('', ['name' => "acl[{$val}]", 'value' => $val, 'id' => $id])
- . html::label(['for' => $id, 'title' => $title], $label)
+ . \html::label(['for' => $id, 'title' => $title], $label)
);
}
- $out .= "\n" . html::tag('ul', $attrib, $ul, html::$common_attrib);
+ $out .= "\n" . \html::tag('ul', $attrib, $ul, \html::$common_attrib);
$this->rc->output->set_env('acl_items', $data['rights']);
@@ -320,17 +320,17 @@ public function templ_user($attrib)
$attrib['name'] = 'acluser';
$attrib['class'] = 'form-control';
- $textfield = new html_inputfield($attrib);
+ $textfield = new \html_inputfield($attrib);
- $label = html::label(['for' => $attrib['id'], 'class' => 'input-group-text'], $this->gettext('username'));
+ $label = \html::label(['for' => $attrib['id'], 'class' => 'input-group-text'], $this->gettext('username'));
$fields = [
- 'user' => html::div('input-group', html::span('input-group-prepend', $label) . ' ' . $textfield->show()),
+ 'user' => \html::div('input-group', \html::span('input-group-prepend', $label) . ' ' . $textfield->show()),
];
// Add special entries
if (!empty($this->specials)) {
foreach ($this->specials as $key) {
- $fields[$key] = html::label(['for' => 'id' . $key], $this->gettext($key));
+ $fields[$key] = \html::label(['for' => 'id' . $key], $this->gettext($key));
}
}
@@ -340,16 +340,16 @@ public function templ_user($attrib)
if (count($fields) > 1) {
$ul = '';
foreach ($fields as $key => $val) {
- $radio = new html_radiobutton(['name' => 'usertype']);
+ $radio = new \html_radiobutton(['name' => 'usertype']);
$radio = $radio->show($key == 'user' ? 'user' : '', ['value' => $key, 'id' => 'id' . $key]);
- $ul .= html::tag('li', null, $radio . $val);
+ $ul .= \html::tag('li', null, $radio . $val);
}
- $out = html::tag('ul', ['id' => 'usertype', 'class' => $class], $ul, html::$common_attrib);
+ $out = \html::tag('ul', ['id' => 'usertype', 'class' => $class], $ul, \html::$common_attrib);
}
// Display text input alone
else {
- $out = html::div($class, $fields['user']);
+ $out = \html::div($class, $fields['user']);
}
return $out;
@@ -426,7 +426,7 @@ private function list_rights($attrib = [])
// Create the table
$attrib['noheader'] = true;
- $table = new html_table($attrib);
+ $table = new \html_table($attrib);
$self = $this->rc->get_user_name();
$js_table = [];
@@ -444,7 +444,7 @@ private function list_rights($attrib = [])
// filter out virtual rights (c or d) the server may return
$userrights = array_intersect($rights, $supported);
- $userid = rcube_utils::html_identifier($user);
+ $userid = \rcube_utils::html_identifier($user);
$title = null;
if (!empty($this->specials) && in_array($user, $this->specials)) {
@@ -455,7 +455,7 @@ private function list_rights($attrib = [])
$table->add_row(['id' => 'rcmrow' . $userid, 'data-userid' => $user]);
$table->add(['class' => 'user text-nowrap', 'title' => $title],
- html::a(['id' => 'rcmlinkrow' . $userid], rcube::Q($username))
+ \html::a(['id' => 'rcmlinkrow' . $userid], \rcube::Q($username))
);
foreach ($items as $key => $right) {
@@ -490,10 +490,10 @@ private function list_rights($attrib = [])
*/
private function action_save()
{
- $mbox = trim(rcube_utils::get_input_string('_mbox', rcube_utils::INPUT_POST, true)); // UTF7-IMAP
- $users = trim(rcube_utils::get_input_string('_user', rcube_utils::INPUT_POST));
- $acl = trim(rcube_utils::get_input_string('_acl', rcube_utils::INPUT_POST));
- $oldid = trim(rcube_utils::get_input_string('_old', rcube_utils::INPUT_POST));
+ $mbox = trim(\rcube_utils::get_input_string('_mbox', \rcube_utils::INPUT_POST, true)); // UTF7-IMAP
+ $users = trim(\rcube_utils::get_input_string('_user', \rcube_utils::INPUT_POST));
+ $acl = trim(\rcube_utils::get_input_string('_acl', \rcube_utils::INPUT_POST));
+ $oldid = trim(\rcube_utils::get_input_string('_old', \rcube_utils::INPUT_POST));
$acl = array_intersect(str_split($acl), $this->rights_supported());
$users = $oldid ? [$users] : explode(',', $users);
@@ -511,12 +511,12 @@ private function action_save()
$username = $this->gettext($user);
} elseif (!empty($user)) {
if (!strpos($user, '@') && ($realm = $this->get_realm())) {
- $user .= '@' . rcube_utils::idn_to_ascii(preg_replace('/^@/', '', $realm));
+ $user .= '@' . \rcube_utils::idn_to_ascii(preg_replace('/^@/', '', $realm));
}
// Make sure it's valid email address to prevent from "disappearing folder"
// issue in Cyrus IMAP e.g. when the acl user identifier contains spaces inside.
- if (strpos($user, '@') && !rcube_utils::check_email($user, false)) {
+ if (strpos($user, '@') && !\rcube_utils::check_email($user, false)) {
$user = null;
}
@@ -534,7 +534,7 @@ private function action_save()
if ($this->rc->storage->set_acl($mbox, $user, $acl)) {
$display = $this->resolve_acl_identifier($username, $title);
$this->rc->output->command('acl_update', [
- 'id' => rcube_utils::html_identifier($user),
+ 'id' => \rcube_utils::html_identifier($user),
'username' => $username,
'title' => $title,
'display' => $display,
@@ -558,15 +558,15 @@ private function action_save()
*/
private function action_delete()
{
- $mbox = trim(rcube_utils::get_input_string('_mbox', rcube_utils::INPUT_POST, true)); // UTF7-IMAP
- $user = trim(rcube_utils::get_input_string('_user', rcube_utils::INPUT_POST));
+ $mbox = trim(\rcube_utils::get_input_string('_mbox', \rcube_utils::INPUT_POST, true)); // UTF7-IMAP
+ $user = trim(\rcube_utils::get_input_string('_user', \rcube_utils::INPUT_POST));
$user = explode(',', $user);
foreach ($user as $u) {
$u = trim($u);
if ($this->rc->storage->delete_acl($mbox, $u)) {
- $this->rc->output->command('acl_remove_row', rcube_utils::html_identifier($u));
+ $this->rc->output->command('acl_remove_row', \rcube_utils::html_identifier($u));
} else {
$error = true;
}
@@ -588,8 +588,8 @@ private function action_list()
return;
}
- $this->mbox = trim(rcube_utils::get_input_string('_mbox', rcube_utils::INPUT_GPC, true)); // UTF7-IMAP
- $advanced = trim(rcube_utils::get_input_string('_mode', rcube_utils::INPUT_GPC));
+ $this->mbox = trim(\rcube_utils::get_input_string('_mbox', \rcube_utils::INPUT_GPC, true)); // UTF7-IMAP
+ $advanced = trim(\rcube_utils::get_input_string('_mode', \rcube_utils::INPUT_GPC));
$advanced = $advanced == 'advanced';
// Save state in user preferences
@@ -624,15 +624,15 @@ public function acl2text($rights)
foreach ($supported as $right) {
if (in_array($right, $rights)) {
- $list[] = html::tag('li', null, rcube::Q($this->gettext('acl' . $right)));
+ $list[] = \html::tag('li', null, \rcube::Q($this->gettext('acl' . $right)));
}
}
if (count($list) == count($supported)) {
- return rcube::Q($this->gettext('aclfull'));
+ return \rcube::Q($this->gettext('aclfull'));
}
- return html::tag('ul', $attrib, implode("\n", $list));
+ return \html::tag('ul', $attrib, implode("\n", $list));
}
/**
@@ -711,7 +711,7 @@ private function get_realm()
$self = $this->rc->get_user_name();
// find realm in username of logged user (?)
- [$name, $domain] = rcube_utils::explode('@', $self);
+ [$name, $domain] = \rcube_utils::explode('@', $self);
// Use (always existent) ACL entry on the INBOX for the user to determine
// whether or not the user ID in ACL entries need to be qualified and how
@@ -791,7 +791,7 @@ protected function init_ldap()
$config['vlv'] = false;
// Initialize LDAP connection
- $this->ldap = new rcube_ldap(
+ $this->ldap = new \rcube_ldap(
$config,
$this->rc->config->get('ldap_debug'),
$this->rc->config->mail_domain($_SESSION['imap_host'])
@@ -833,7 +833,7 @@ protected function resolve_acl_identifier($id, &$title = null)
// list_groups() allows searching by group name only
if ($groups && $prefix && $group_field === 'name' && strpos($id, $prefix) === 0) {
$gid = substr($id, strlen($prefix));
- $result = $this->ldap->list_groups($gid, rcube_addressbook::SEARCH_STRICT);
+ $result = $this->ldap->list_groups($gid, \rcube_addressbook::SEARCH_STRICT);
if (count($result) === 1 && ($record = $result[0])) {
if (isset($record[$group_field]) && $record[$group_field] === $gid) {
@@ -851,12 +851,12 @@ protected function resolve_acl_identifier($id, &$title = null)
$this->ldap->set_pagesize('2');
// Note: 'uid' works here because we overwrite fieldmap in init_ldap() above
- $result = $this->ldap->search('uid', $id, rcube_addressbook::SEARCH_STRICT);
+ $result = $this->ldap->search('uid', $id, \rcube_addressbook::SEARCH_STRICT);
if ($result->count === 1 && ($record = $result->first())) {
if ($record['uid'] === $id) {
- $title = rcube_addressbook::compose_search_name($record);
- $display = rcube_addressbook::compose_list_name($record);
+ $title = \rcube_addressbook::compose_search_name($record);
+ $display = \rcube_addressbook::compose_list_name($record);
return $display;
}
diff --git a/plugins/additional_message_headers/additional_message_headers.php b/plugins/additional_message_headers/additional_message_headers.php
index 5359148feb6..5b5982ac310 100644
--- a/plugins/additional_message_headers/additional_message_headers.php
+++ b/plugins/additional_message_headers/additional_message_headers.php
@@ -13,12 +13,12 @@
*
* @website http://roundcube.net
*/
-class additional_message_headers extends rcube_plugin
+class additional_message_headers extends \rcube_plugin
{
/**
* Plugin initialization
*/
- #[Override]
+ #[\Override]
public function init()
{
$this->add_hook('message_before_send', [$this, 'message_headers']);
@@ -35,7 +35,7 @@ public function message_headers($args)
{
$this->load_config();
- $rcube = rcube::get_instance();
+ $rcube = \rcube::get_instance();
// additional email headers
$additional_headers = $rcube->config->get('additional_message_headers', []);
diff --git a/plugins/archive/archive.php b/plugins/archive/archive.php
index e9178b97ada..124bc299669 100644
--- a/plugins/archive/archive.php
+++ b/plugins/archive/archive.php
@@ -11,7 +11,7 @@
* @license GNU GPLv3+
* @author Andre Rodier, Thomas Bruederli, Aleksander Machniak
*/
-class archive extends rcube_plugin
+class archive extends \rcube_plugin
{
public $task = 'settings|mail|login';
@@ -22,13 +22,13 @@ class archive extends rcube_plugin
/**
* Plugin initialization.
*/
- #[Override]
+ #[\Override]
public function init()
{
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
// register special folder type
- rcube_storage::$folder_types[] = 'archive';
+ \rcube_storage::$folder_types[] = 'archive';
$this->archive_folder = $rcmail->config->get('archive_mbox');
@@ -79,7 +79,7 @@ public function init()
public function render_mailboxlist($p)
{
// set localized name for the configured archive folder
- if ($this->archive_folder && !rcmail::get_instance()->config->get('show_real_foldernames')) {
+ if ($this->archive_folder && !\rcmail::get_instance()->config->get('show_real_foldernames')) {
if (isset($p['list'][$this->archive_folder])) {
$p['list'][$this->archive_folder]['name'] = $this->gettext('archivefolder');
} else {
@@ -116,7 +116,7 @@ private function _mod_folder_name(&$list, $folder, $new_name)
*/
public function move_messages()
{
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
// only process ajax requests
if (!$rcmail->output->ajax_call) {
@@ -131,7 +131,7 @@ public function move_messages()
$read_on_move = (bool) $rcmail->config->get('read_on_archive');
$archive_type = $rcmail->config->get('archive_type', '');
$archive_prefix = $this->archive_folder . $delimiter;
- $search_request = rcube_utils::get_input_string('_search', rcube_utils::INPUT_GPC);
+ $search_request = \rcube_utils::get_input_string('_search', \rcube_utils::INPUT_GPC);
$from_show_action = !empty($_POST['_from']) && $_POST['_from'] == 'show';
// count messages before changing anything
@@ -140,8 +140,8 @@ public function move_messages()
$old_count = $storage->count(null, $threading ? 'THREADS' : 'ALL');
}
- $sort_col = rcmail_action_mail_index::sort_column();
- $sort_ord = rcmail_action_mail_index::sort_order();
+ $sort_col = \rcmail_action_mail_index::sort_column();
+ $sort_ord = \rcmail_action_mail_index::sort_order();
$count = 0;
$all = false;
@@ -154,7 +154,7 @@ public function move_messages()
'destinations' => [],
];
- foreach (rcmail_action::get_uids(null, null, $multifolder, rcube_utils::INPUT_POST) as $mbox => $uids) {
+ foreach (\rcmail_action::get_uids(null, null, $multifolder, \rcube_utils::INPUT_POST) as $mbox => $uids) {
$all = $uids === '*';
if (!$this->archive_folder || $mbox === $this->archive_folder || strpos($mbox, $archive_prefix) === 0) {
$count = count($uids);
@@ -248,7 +248,7 @@ public function move_messages()
}
if ($from_show_action) {
- if ($next = rcube_utils::get_input_string('_next_uid', rcube_utils::INPUT_GPC)) {
+ if ($next = \rcube_utils::get_input_string('_next_uid', \rcube_utils::INPUT_GPC)) {
$rcmail->output->command('show_message', $next);
} else {
$rcmail->output->command('command', 'list');
@@ -279,7 +279,7 @@ public function move_messages()
// update unread messages counts for all involved folders
// @phpstan-ignore-next-line
foreach ($this->result['sources'] as $folder) {
- rcmail_action_mail_index::send_unread_count($folder, true);
+ \rcmail_action_mail_index::send_unread_count($folder, true);
}
// update message count display
@@ -287,11 +287,11 @@ public function move_messages()
$rcmail->output->set_env('current_page', $page);
$rcmail->output->set_env('pagecount', $pages);
$rcmail->output->set_env('exists', $exists);
- $rcmail->output->command('set_quota', rcmail_action::quota_content(null, $quota_root));
- $rcmail->output->command('set_rowcount', rcmail_action_mail_index::get_messagecount_text($msg_count), $mbox);
+ $rcmail->output->command('set_quota', \rcmail_action::quota_content(null, $quota_root));
+ $rcmail->output->command('set_rowcount', \rcmail_action_mail_index::get_messagecount_text($msg_count), $mbox);
if ($threading) {
- $count = rcube_utils::get_input_string('_count', rcube_utils::INPUT_POST);
+ $count = \rcube_utils::get_input_string('_count', \rcube_utils::INPUT_POST);
}
// add new rows from next page (if any)
@@ -301,7 +301,7 @@ public function move_messages()
$a_headers = $storage->list_messages($mbox, null, $sort_col, $sort_ord, $count);
- rcmail_action_mail_index::js_message_list($a_headers, false);
+ \rcmail_action_mail_index::js_message_list($a_headers, false);
}
// @phpstan-ignore-next-line
@@ -313,7 +313,7 @@ public function move_messages()
if (!$read_on_move) {
// @phpstan-ignore-next-line
foreach ($this->result['destinations'] as $folder) {
- rcmail_action_mail_index::send_unread_count($folder, true);
+ \rcmail_action_mail_index::send_unread_count($folder, true);
}
}
}
@@ -327,7 +327,7 @@ public function move_messages()
*/
private function move_messages_worker($uids, $from_mbox, $to_mbox, $read_on_move)
{
- $storage = rcmail::get_instance()->get_storage();
+ $storage = \rcmail::get_instance()->get_storage();
if ($read_on_move) {
// don't flush cache (4th argument)
@@ -354,7 +354,7 @@ private function move_messages_worker($uids, $from_mbox, $to_mbox, $read_on_move
*/
private function subfolder_worker($folder)
{
- $storage = rcmail::get_instance()->get_storage();
+ $storage = \rcmail::get_instance()->get_storage();
$delimiter = $storage->get_hierarchy_delimiter();
if ($this->folders === null) {
@@ -388,7 +388,7 @@ public function prefs_table($args)
{
$this->add_texts('localization');
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
$dont_override = $rcmail->config->get('dont_override', []);
if ($args['section'] == 'folders' && !in_array('archive_mbox', $dont_override)) {
@@ -397,7 +397,7 @@ public function prefs_table($args)
// load folders list when needed
if ($args['current']) {
- $select = rcmail_action::folder_selector([
+ $select = \rcmail_action::folder_selector([
'noselection' => '---',
'realnames' => true,
'maxlength' => 30,
@@ -407,19 +407,19 @@ public function prefs_table($args)
'class' => 'custom-select',
]);
} else {
- $select = new html_select();
+ $select = new \html_select();
}
$args['blocks']['main']['options']['archive_mbox'] = [
- 'title' => html::label('_archive_mbox', rcube::Q($this->gettext('archivefolder'))),
+ 'title' => \html::label('_archive_mbox', \rcube::Q($this->gettext('archivefolder'))),
'content' => $select->show($mbox, ['id' => '_archive_mbox', 'name' => '_archive_mbox']),
];
// If the server supports only either messages or folders in a folder
// we do not allow archive splitting, for simplicity (#5057)
- if ($rcmail->get_storage()->get_capability(rcube_storage::DUAL_USE_FOLDERS)) {
+ if ($rcmail->get_storage()->get_capability(\rcube_storage::DUAL_USE_FOLDERS)) {
// add option for structuring the archive folder
- $archive_type = new html_select(['name' => '_archive_type', 'id' => 'ff_archive_type', 'class' => 'custom-select']);
+ $archive_type = new \html_select(['name' => '_archive_type', 'id' => 'ff_archive_type', 'class' => 'custom-select']);
$archive_type->add($this->gettext('none'), '');
$archive_type->add($this->gettext('archivetypeyear'), 'year');
$archive_type->add($this->gettext('archivetypemonth'), 'month');
@@ -430,19 +430,19 @@ public function prefs_table($args)
$archive_type->add($this->gettext('archivetypefoldermonth'), 'foldermonth');
$args['blocks']['archive'] = [
- 'name' => rcube::Q($this->gettext('settingstitle')),
+ 'name' => \rcube::Q($this->gettext('settingstitle')),
'options' => [
'archive_type' => [
- 'title' => html::label('ff_archive_type', rcube::Q($this->gettext('archivetype'))),
+ 'title' => \html::label('ff_archive_type', \rcube::Q($this->gettext('archivetype'))),
'content' => $archive_type->show($type),
],
],
];
}
} elseif ($args['section'] == 'server' && !in_array('read_on_archive', $dont_override)) {
- $chbox = new html_checkbox(['name' => '_read_on_archive', 'id' => 'ff_read_on_archive', 'value' => 1]);
+ $chbox = new \html_checkbox(['name' => '_read_on_archive', 'id' => 'ff_read_on_archive', 'value' => 1]);
$args['blocks']['main']['options']['read_on_archive'] = [
- 'title' => html::label('ff_read_on_archive', rcube::Q($this->gettext('readonarchive'))),
+ 'title' => \html::label('ff_read_on_archive', \rcube::Q($this->gettext('readonarchive'))),
'content' => $chbox->show($rcmail->config->get('read_on_archive') ? 1 : 0),
];
}
@@ -459,13 +459,13 @@ public function prefs_table($args)
*/
public function prefs_save($args)
{
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
$dont_override = $rcmail->config->get('dont_override', []);
if ($args['section'] == 'folders' && !in_array('archive_mbox', $dont_override)) {
- $args['prefs']['archive_type'] = rcube_utils::get_input_string('_archive_type', rcube_utils::INPUT_POST);
+ $args['prefs']['archive_type'] = \rcube_utils::get_input_string('_archive_type', \rcube_utils::INPUT_POST);
} elseif ($args['section'] == 'server' && !in_array('read_on_archive', $dont_override)) {
- $args['prefs']['read_on_archive'] = (bool) rcube_utils::get_input_value('_read_on_archive', rcube_utils::INPUT_POST);
+ $args['prefs']['read_on_archive'] = (bool) \rcube_utils::get_input_value('_read_on_archive', \rcube_utils::INPUT_POST);
}
return $args;
@@ -487,7 +487,7 @@ protected function sender_subfolder($from)
}
if ($delim === null) {
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
$storage = $rcmail->get_storage();
$delim = $storage->get_hierarchy_delimiter();
$vendor = $storage->get_vendor();
diff --git a/plugins/attachment_reminder/attachment_reminder.php b/plugins/attachment_reminder/attachment_reminder.php
index b4bd1129935..6a8f077b31d 100644
--- a/plugins/attachment_reminder/attachment_reminder.php
+++ b/plugins/attachment_reminder/attachment_reminder.php
@@ -25,7 +25,7 @@
* along with this program. If not, see
*/
-class attachment_reminder extends rcube_plugin
+class attachment_reminder extends \rcube_plugin
{
public $task = 'mail|settings';
public $noajax = true;
@@ -33,10 +33,10 @@ class attachment_reminder extends rcube_plugin
/**
* Plugin initialization
*/
- #[Override]
+ #[\Override]
public function init()
{
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
if ($rcmail->task == 'mail' && $rcmail->action == 'compose') {
if ($rcmail->config->get('attachment_reminder')) {
@@ -67,12 +67,12 @@ public function prefs_list($args)
{
if ($args['section'] == 'compose') {
$this->add_texts('localization/');
- $reminder = rcube::get_instance()->config->get('attachment_reminder');
+ $reminder = \rcube::get_instance()->config->get('attachment_reminder');
$field_id = 'rcmfd_attachment_reminder';
- $checkbox = new html_checkbox(['name' => '_attachment_reminder', 'id' => $field_id, 'value' => 1]);
+ $checkbox = new \html_checkbox(['name' => '_attachment_reminder', 'id' => $field_id, 'value' => 1]);
$args['blocks']['main']['options']['attachment_reminder'] = [
- 'title' => html::label($field_id, rcube::Q($this->gettext('reminderoption'))),
+ 'title' => \html::label($field_id, \rcube::Q($this->gettext('reminderoption'))),
'content' => $checkbox->show($reminder ? 1 : 0),
];
}
@@ -90,7 +90,7 @@ public function prefs_list($args)
public function prefs_save($args)
{
if ($args['section'] == 'compose') {
- $dont_override = rcube::get_instance()->config->get('dont_override', []);
+ $dont_override = \rcube::get_instance()->config->get('dont_override', []);
if (!in_array('attachment_reminder', $dont_override)) {
$args['prefs']['attachment_reminder'] = !empty($_POST['_attachment_reminder']);
}
diff --git a/plugins/autologon/autologon.php b/plugins/autologon/autologon.php
index 62de477069b..ee0c824ec36 100644
--- a/plugins/autologon/autologon.php
+++ b/plugins/autologon/autologon.php
@@ -7,14 +7,14 @@
* @license GNU GPLv3+
* @author Thomas Bruederli
*/
-class autologon extends rcube_plugin
+class autologon extends \rcube_plugin
{
public $task = 'login';
/**
* Plugin initialization
*/
- #[Override]
+ #[\Override]
public function init()
{
$this->add_hook('startup', [$this, 'startup']);
diff --git a/plugins/autologout/autologout.php b/plugins/autologout/autologout.php
index e9803aae6ae..8c1c8a7bf5f 100644
--- a/plugins/autologout/autologout.php
+++ b/plugins/autologout/autologout.php
@@ -24,14 +24,14 @@
* $("#loSubmitButton").click();)
*/
-class autologout extends rcube_plugin
+class autologout extends \rcube_plugin
{
public $task = 'logout';
/**
* Plugin initialization
*/
- #[Override]
+ #[\Override]
public function init()
{
$this->add_hook('startup', [$this, 'startup']);
@@ -42,7 +42,7 @@ public function init()
*/
public function startup($args)
{
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
// Change task and action to logout
if (!empty($_SESSION['user_id']) && !empty($_POST['_autologout']) && $this->known_client()) {
diff --git a/plugins/database_attachments/database_attachments.php b/plugins/database_attachments/database_attachments.php
index 4237acf65a0..1002a94a2ed 100644
--- a/plugins/database_attachments/database_attachments.php
+++ b/plugins/database_attachments/database_attachments.php
@@ -31,7 +31,7 @@
require_once INSTALL_PATH . 'plugins/filesystem_attachments/filesystem_attachments.php';
-class database_attachments extends filesystem_attachments
+class database_attachments extends \filesystem_attachments
{
// Cache object
protected $cache;
@@ -42,7 +42,7 @@ class database_attachments extends filesystem_attachments
/**
* Save a newly uploaded attachment
*/
- #[Override]
+ #[\Override]
public function upload($args)
{
$args['status'] = false;
@@ -70,7 +70,7 @@ public function upload($args)
/**
* Save an attachment from a non-upload source (draft or forward)
*/
- #[Override]
+ #[\Override]
public function save($args)
{
$args['status'] = false;
@@ -103,7 +103,7 @@ public function save($args)
* Remove an attachment from storage
* This is triggered by the remove attachment button on the compose screen
*/
- #[Override]
+ #[\Override]
public function remove($args)
{
$cache = $this->get_cache();
@@ -119,7 +119,7 @@ public function remove($args)
* For this plugin, $this->get() will check the file and
* return it's contents
*/
- #[Override]
+ #[\Override]
public function display($args)
{
return $this->get($args);
@@ -129,7 +129,7 @@ public function display($args)
* When displaying or sending the attachment the file contents are fetched
* using this method. This is also called by the attachment_display hook.
*/
- #[Override]
+ #[\Override]
public function get($args)
{
$cache = $this->get_cache();
@@ -148,7 +148,7 @@ public function get($args)
/**
* Delete all temp files associated with this user
*/
- #[Override]
+ #[\Override]
public function cleanup($args)
{
// check if cache object exist, it may be empty on session_destroy (#1489726)
@@ -174,7 +174,7 @@ protected function get_cache()
if (!$this->cache) {
$this->load_config();
- $rcmail = rcube::get_instance();
+ $rcmail = \rcube::get_instance();
$ttl = 12 * 60 * 60; // default: 12 hours
$ttl = $rcmail->config->get('database_attachments_cache_ttl', $ttl);
$type = $rcmail->config->get('database_attachments_cache', 'db');
diff --git a/plugins/debug_logger/debug_logger.php b/plugins/debug_logger/debug_logger.php
index d1ad3c0e894..2af9c2d4b14 100644
--- a/plugins/debug_logger/debug_logger.php
+++ b/plugins/debug_logger/debug_logger.php
@@ -59,31 +59,31 @@
* [17-Feb-2009 16:51:37 -0500] sql: select * from example
* [17-Feb-2009 16:51:37 -0500] sql: select * from example
*/
-class debug_logger extends rcube_plugin
+class debug_logger extends \rcube_plugin
{
protected $runlog;
- #[Override]
+ #[\Override]
public function init()
{
require_once __DIR__ . '/runlog/runlog.php';
- $this->runlog = new runlog();
+ $this->runlog = new \runlog();
- if (!rcmail::get_instance()->config->get('log_dir')) {
- rcmail::get_instance()->config->set('log_dir', INSTALL_PATH . 'logs');
+ if (!\rcmail::get_instance()->config->get('log_dir')) {
+ \rcmail::get_instance()->config->set('log_dir', INSTALL_PATH . 'logs');
}
- $log_config = rcmail::get_instance()->config->get('debug_logger', []);
- $log_dir = rcmail::get_instance()->config->get('log_dir');
+ $log_config = \rcmail::get_instance()->config->get('debug_logger', []);
+ $log_dir = \rcmail::get_instance()->config->get('log_dir');
foreach ($log_config as $type => $file) {
$this->runlog->set_file($log_dir . '/' . $file, $type);
}
$start_string = '';
- $action = rcmail::get_instance()->action;
- $task = rcmail::get_instance()->task;
+ $action = \rcmail::get_instance()->action;
+ $task = \rcmail::get_instance()->task;
if ($action) {
$start_string .= "Action: {$action}. ";
diff --git a/plugins/emoticons/emoticons.php b/plugins/emoticons/emoticons.php
index 5e0e7fd4246..2171448cbd4 100644
--- a/plugins/emoticons/emoticons.php
+++ b/plugins/emoticons/emoticons.php
@@ -12,17 +12,17 @@
*
* @website https://roundcube.net
*/
-class emoticons extends rcube_plugin
+class emoticons extends \rcube_plugin
{
public $task = 'mail|settings|utils';
/**
* Plugin initialization.
*/
- #[Override]
+ #[\Override]
public function init()
{
- $rcube = rcmail::get_instance();
+ $rcube = \rcmail::get_instance();
$this->add_hook('message_part_after', [$this, 'message_part_after']);
$this->add_hook('html_editor', [$this, 'html_editor']);
@@ -42,7 +42,7 @@ public function message_part_after($args)
if ($args['type'] == 'plain') {
$this->load_config();
- $rcube = rcmail::get_instance();
+ $rcube = \rcmail::get_instance();
if (!$rcube->config->get('emoticons_display', false)) {
return $args;
}
@@ -58,7 +58,7 @@ public function message_part_after($args)
*/
public function html_editor($args)
{
- $rcube = rcmail::get_instance();
+ $rcube = \rcmail::get_instance();
$this->load_config();
@@ -75,7 +75,7 @@ public function html_editor($args)
*/
public function preferences_list($args)
{
- $rcube = rcmail::get_instance();
+ $rcube = \rcmail::get_instance();
$dont_override = $rcube->config->get('dont_override', []);
if ($args['section'] == 'mailview' && !in_array('emoticons_display', $dont_override)) {
@@ -83,10 +83,10 @@ public function preferences_list($args)
$this->add_texts('localization');
$field_id = 'emoticons_display';
- $checkbox = new html_checkbox(['name' => '_' . $field_id, 'id' => $field_id, 'value' => 1]);
+ $checkbox = new \html_checkbox(['name' => '_' . $field_id, 'id' => $field_id, 'value' => 1]);
$args['blocks']['main']['options']['emoticons_display'] = [
- 'title' => html::label($field_id, $this->gettext('emoticonsdisplay')),
+ 'title' => \html::label($field_id, $this->gettext('emoticonsdisplay')),
'content' => $checkbox->show(intval($rcube->config->get('emoticons_display', false))),
];
} elseif ($args['section'] == 'compose' && !in_array('emoticons_compose', $dont_override)) {
@@ -94,10 +94,10 @@ public function preferences_list($args)
$this->add_texts('localization');
$field_id = 'emoticons_compose';
- $checkbox = new html_checkbox(['name' => '_' . $field_id, 'id' => $field_id, 'value' => 1]);
+ $checkbox = new \html_checkbox(['name' => '_' . $field_id, 'id' => $field_id, 'value' => 1]);
$args['blocks']['main']['options']['emoticons_compose'] = [
- 'title' => html::label($field_id, $this->gettext('emoticonscompose')),
+ 'title' => \html::label($field_id, $this->gettext('emoticonscompose')),
'content' => $checkbox->show(intval($rcube->config->get('emoticons_compose', true))),
];
}
@@ -111,9 +111,9 @@ public function preferences_list($args)
public function preferences_save($args)
{
if ($args['section'] == 'mailview') {
- $args['prefs']['emoticons_display'] = (bool) rcube_utils::get_input_value('_emoticons_display', rcube_utils::INPUT_POST);
+ $args['prefs']['emoticons_display'] = (bool) \rcube_utils::get_input_value('_emoticons_display', \rcube_utils::INPUT_POST);
} elseif ($args['section'] == 'compose') {
- $args['prefs']['emoticons_compose'] = (bool) rcube_utils::get_input_value('_emoticons_compose', rcube_utils::INPUT_POST);
+ $args['prefs']['emoticons_compose'] = (bool) \rcube_utils::get_input_value('_emoticons_compose', \rcube_utils::INPUT_POST);
}
return $args;
@@ -161,6 +161,6 @@ protected static function text2icons($text)
protected static function ico_tag($ico, $title)
{
- return html::span(['title' => $title], "{$ico};");
+ return \html::span(['title' => $title], "{$ico};");
}
}
diff --git a/plugins/enigma/bin/import_keys.sh b/plugins/enigma/bin/import_keys.sh
index 4832497a5ad..2982bf5e256 100755
--- a/plugins/enigma/bin/import_keys.sh
+++ b/plugins/enigma/bin/import_keys.sh
@@ -24,10 +24,10 @@ define('INSTALL_PATH', realpath(__DIR__ . '/../../../') . '/');
require INSTALL_PATH . 'program/include/clisetup.php';
-$rcmail = rcube::get_instance();
+$rcmail = \rcube::get_instance();
// get arguments
-$args = rcube_utils::get_opt([
+$args = \rcube_utils::get_opt([
'u' => 'user',
'h' => 'host',
'd' => 'dir',
@@ -40,7 +40,7 @@ if (!empty($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'help') {
}
if (empty($args['dir'])) {
- rcube::raise_error('--dir argument is required', true);
+ \rcube::raise_error('--dir argument is required', true);
}
$host = get_host($args);
@@ -92,7 +92,7 @@ function get_host($args)
} elseif (is_array($hosts) && count($hosts) == 1) {
$args['host'] = reset($hosts);
} else {
- rcube::raise_error('Specify a host name', true);
+ \rcube::raise_error('Specify a host name', true);
}
// host can be a URL like tls://192.168.12.44
@@ -112,10 +112,10 @@ function get_user_id($username, $host)
$db = $rcmail->get_dbh();
// find user in local database
- $user = rcube_user::query($username, $host);
+ $user = \rcube_user::query($username, $host);
if (empty($user)) {
- rcube::raise_error("User does not exist: {$username}");
+ \rcube::raise_error("User does not exist: {$username}");
}
return $user->ID;
@@ -156,7 +156,7 @@ function import_dir($user_id, $dir, $dry_run = false)
$datasize = strlen($data);
if ($datasize > $maxsize) {
- rcube::raise_error([
+ \rcube::raise_error([
'code' => 605,
'message' => "Enigma: Failed to save {$file}. Size exceeds max_allowed_packet.",
], true, false);
@@ -176,7 +176,7 @@ function import_dir($user_id, $dir, $dry_run = false)
$user_id, $file, $mtime, $data);
if ($db->is_error($result)) {
- rcube::raise_error([
+ \rcube::raise_error([
'code' => 605,
'message' => "Enigma: Failed to save {$file} into database.",
], true, false);
diff --git a/plugins/enigma/enigma.php b/plugins/enigma/enigma.php
index 4e3f8eb4101..088a1f1b96b 100644
--- a/plugins/enigma/enigma.php
+++ b/plugins/enigma/enigma.php
@@ -18,7 +18,7 @@
* This class contains only hooks and action handlers.
* Most plugin logic is placed in enigma_engine and enigma_ui classes.
*/
-class enigma extends rcube_plugin
+class enigma extends \rcube_plugin
{
public $task = 'mail|settings|cli';
public $rc;
@@ -30,10 +30,10 @@ class enigma extends rcube_plugin
/**
* Plugin initialization.
*/
- #[Override]
+ #[\Override]
public function init()
{
- $this->rc = rcmail::get_instance();
+ $this->rc = \rcmail::get_instance();
if ($this->rc->task == 'mail') {
// message parse/display hooks
@@ -126,7 +126,7 @@ public function load_ui($all = false)
$this->load_env();
// Load UI
- $this->ui = new enigma_ui($this);
+ $this->ui = new \enigma_ui($this);
}
if ($all) {
@@ -147,7 +147,7 @@ public function load_engine()
// load config/localization
$this->load_env();
- return $this->engine = new enigma_engine();
+ return $this->engine = new \enigma_engine();
}
/**
@@ -253,14 +253,14 @@ public function preferences_list($p)
}
$field_id = 'rcmfd_enigma_encryption';
- $input = new html_checkbox([
+ $input = new \html_checkbox([
'name' => '_enigma_encryption',
'id' => $field_id,
'value' => 1,
]);
$p['blocks']['main']['options']['enigma_encryption'] = [
- 'title' => html::label($field_id, $this->gettext('supportencryption')),
+ 'title' => \html::label($field_id, $this->gettext('supportencryption')),
'content' => $input->show(intval($this->rc->config->get('enigma_encryption'))),
];
}
@@ -272,14 +272,14 @@ public function preferences_list($p)
}
$field_id = 'rcmfd_enigma_signatures';
- $input = new html_checkbox([
+ $input = new \html_checkbox([
'name' => '_enigma_signatures',
'id' => $field_id,
'value' => 1,
]);
$p['blocks']['main']['options']['enigma_signatures'] = [
- 'title' => html::label($field_id, $this->gettext('supportsignatures')),
+ 'title' => \html::label($field_id, $this->gettext('supportsignatures')),
'content' => $input->show(intval($this->rc->config->get('enigma_signatures'))),
];
}
@@ -291,14 +291,14 @@ public function preferences_list($p)
}
$field_id = 'rcmfd_enigma_decryption';
- $input = new html_checkbox([
+ $input = new \html_checkbox([
'name' => '_enigma_decryption',
'id' => $field_id,
'value' => 1,
]);
$p['blocks']['main']['options']['enigma_decryption'] = [
- 'title' => html::label($field_id, $this->gettext('supportdecryption')),
+ 'title' => \html::label($field_id, $this->gettext('supportdecryption')),
'content' => $input->show(intval($this->rc->config->get('enigma_decryption'))),
];
}
@@ -310,14 +310,14 @@ public function preferences_list($p)
}
$field_id = 'rcmfd_enigma_sign_all';
- $input = new html_checkbox([
+ $input = new \html_checkbox([
'name' => '_enigma_sign_all',
'id' => $field_id,
'value' => 1,
]);
$p['blocks']['main']['options']['enigma_sign_all'] = [
- 'title' => html::label($field_id, $this->gettext('signdefault')),
+ 'title' => \html::label($field_id, $this->gettext('signdefault')),
'content' => $input->show($this->rc->config->get('enigma_sign_all') ? 1 : 0),
];
}
@@ -329,14 +329,14 @@ public function preferences_list($p)
}
$field_id = 'rcmfd_enigma_encrypt_all';
- $input = new html_checkbox([
+ $input = new \html_checkbox([
'name' => '_enigma_encrypt_all',
'id' => $field_id,
'value' => 1,
]);
$p['blocks']['main']['options']['enigma_encrypt_all'] = [
- 'title' => html::label($field_id, $this->gettext('encryptdefault')),
+ 'title' => \html::label($field_id, $this->gettext('encryptdefault')),
'content' => $input->show($this->rc->config->get('enigma_encrypt_all') ? 1 : 0),
];
}
@@ -348,14 +348,14 @@ public function preferences_list($p)
}
$field_id = 'rcmfd_enigma_attach_pubkey';
- $input = new html_checkbox([
+ $input = new \html_checkbox([
'name' => '_enigma_attach_pubkey',
'id' => $field_id,
'value' => 1,
]);
$p['blocks']['main']['options']['enigma_attach_pubkey'] = [
- 'title' => html::label($field_id, $this->gettext('attachpubkeydefault')),
+ 'title' => \html::label($field_id, $this->gettext('attachpubkeydefault')),
'content' => $input->show($this->rc->config->get('enigma_attach_pubkey') ? 1 : 0),
];
}
@@ -367,7 +367,7 @@ public function preferences_list($p)
}
$field_id = 'rcmfd_enigma_password_time';
- $select = new html_select(['name' => '_enigma_password_time', 'id' => $field_id, 'class' => 'custom-select']);
+ $select = new \html_select(['name' => '_enigma_password_time', 'id' => $field_id, 'class' => 'custom-select']);
foreach ([1, 5, 10, 15, 30] as $m) {
$label = $this->gettext(['name' => 'nminutes', 'vars' => ['m' => $m]]);
@@ -376,7 +376,7 @@ public function preferences_list($p)
$select->add($this->gettext('wholesession'), 0);
$p['blocks']['main']['options']['enigma_password_time'] = [
- 'title' => html::label($field_id, $this->gettext('passwordtime')),
+ 'title' => \html::label($field_id, $this->gettext('passwordtime')),
'content' => $select->show(intval($this->rc->config->get('enigma_password_time'))),
];
}
@@ -395,13 +395,13 @@ public function preferences_list($p)
public function preferences_save($p)
{
if ($p['section'] == 'encryption') {
- $p['prefs']['enigma_signatures'] = (bool) rcube_utils::get_input_value('_enigma_signatures', rcube_utils::INPUT_POST);
- $p['prefs']['enigma_decryption'] = (bool) rcube_utils::get_input_value('_enigma_decryption', rcube_utils::INPUT_POST);
- $p['prefs']['enigma_encryption'] = (bool) rcube_utils::get_input_value('_enigma_encryption', rcube_utils::INPUT_POST);
- $p['prefs']['enigma_sign_all'] = (bool) rcube_utils::get_input_value('_enigma_sign_all', rcube_utils::INPUT_POST);
- $p['prefs']['enigma_encrypt_all'] = (bool) rcube_utils::get_input_value('_enigma_encrypt_all', rcube_utils::INPUT_POST);
- $p['prefs']['enigma_attach_pubkey'] = (bool) rcube_utils::get_input_value('_enigma_attach_pubkey', rcube_utils::INPUT_POST);
- $p['prefs']['enigma_password_time'] = intval(rcube_utils::get_input_value('_enigma_password_time', rcube_utils::INPUT_POST));
+ $p['prefs']['enigma_signatures'] = (bool) \rcube_utils::get_input_value('_enigma_signatures', \rcube_utils::INPUT_POST);
+ $p['prefs']['enigma_decryption'] = (bool) \rcube_utils::get_input_value('_enigma_decryption', \rcube_utils::INPUT_POST);
+ $p['prefs']['enigma_encryption'] = (bool) \rcube_utils::get_input_value('_enigma_encryption', \rcube_utils::INPUT_POST);
+ $p['prefs']['enigma_sign_all'] = (bool) \rcube_utils::get_input_value('_enigma_sign_all', \rcube_utils::INPUT_POST);
+ $p['prefs']['enigma_encrypt_all'] = (bool) \rcube_utils::get_input_value('_enigma_encrypt_all', \rcube_utils::INPUT_POST);
+ $p['prefs']['enigma_attach_pubkey'] = (bool) \rcube_utils::get_input_value('_enigma_attach_pubkey', \rcube_utils::INPUT_POST);
+ $p['prefs']['enigma_password_time'] = intval(\rcube_utils::get_input_value('_enigma_password_time', \rcube_utils::INPUT_POST));
}
return $p;
@@ -439,24 +439,24 @@ public function identity_form($p)
$keys = $engine->list_keys($p['record']['email']);
// On error do nothing, plugin/gnupg misconfigured?
- if ($keys instanceof enigma_error) {
+ if ($keys instanceof \enigma_error) {
return $p;
}
foreach ($keys as $key) {
- if ($key->get_type() === enigma_key::TYPE_KEYPAIR) {
- $listing[] = html::tag('li', null,
- html::tag('strong', 'uid', html::quote($key->id))
- . ' ' . html::tag('span', 'identity', html::quote($key->name))
+ if ($key->get_type() === \enigma_key::TYPE_KEYPAIR) {
+ $listing[] = \html::tag('li', null,
+ \html::tag('strong', 'uid', \html::quote($key->id))
+ . ' ' . \html::tag('span', 'identity', \html::quote($key->name))
);
}
}
if (count($listing)) {
- $content .= html::p(null, $this->gettext(['name' => 'identitymatchingprivkeys', 'vars' => ['nr' => count($listing)]]));
- $content .= html::tag('ul', 'keylist', implode("\n", $listing));
+ $content .= \html::p(null, $this->gettext(['name' => 'identitymatchingprivkeys', 'vars' => ['nr' => count($listing)]]));
+ $content .= \html::tag('ul', 'keylist', implode("\n", $listing));
} else {
- $content .= html::p(null, $this->gettext('identitynoprivkeys'));
+ $content .= \html::p(null, $this->gettext('identitynoprivkeys'));
}
}
@@ -466,12 +466,12 @@ public function identity_form($p)
'href' => $this->rc->url(['action' => 'plugin.enigmakeys']),
'target' => '_parent',
];
- $content .= html::p(null, html::a($button_attr, $this->gettext('managekeys')));
+ $content .= \html::p(null, \html::a($button_attr, $this->gettext('managekeys')));
// rename class to avoid Mailvelope key management to kick in
$p['form']['encryption']['attrs'] = ['class' => 'enigma-identity-encryption'];
// fill fieldset content with our stuff
- $p['form']['encryption']['content'] = html::div('identity-encryption-block', $content);
+ $p['form']['encryption']['content'] = \html::div('identity-encryption-block', $content);
}
return $p;
diff --git a/plugins/enigma/lib/enigma_driver.php b/plugins/enigma/lib/enigma_driver.php
index 187c9a88d4a..7d822714cf0 100644
--- a/plugins/enigma/lib/enigma_driver.php
+++ b/plugins/enigma/lib/enigma_driver.php
@@ -36,9 +36,9 @@ abstract public function init();
/**
* Encryption (and optional signing).
*
- * @param string $text Message body
- * @param array $keys List of keys (enigma_key objects)
- * @param enigma_key $sign_key Optional signing Key ID
+ * @param string $text Message body
+ * @param array $keys List of keys (enigma_key objects)
+ * @param \enigma_key $sign_key Optional signing Key ID
*
* @return mixed Encrypted message or enigma_error on failure
*/
@@ -47,9 +47,9 @@ abstract public function encrypt($text, $keys, $sign_key = null);
/**
* Decryption (and sig verification if sig exists).
*
- * @param string $text Encrypted message
- * @param array $keys List of key-password
- * @param enigma_signature $signature Signature information (if available)
+ * @param string $text Encrypted message
+ * @param array $keys List of key-password
+ * @param \enigma_signature $signature Signature information (if available)
*
* @return mixed Decrypted message or enigma_error on failure
*/
@@ -58,9 +58,9 @@ abstract public function decrypt($text, $keys = [], &$signature = null);
/**
* Signing.
*
- * @param string $text Message body
- * @param enigma_key $key The signing key
- * @param int $mode Signing mode (enigma_engine::SIGN_*)
+ * @param string $text Message body
+ * @param \enigma_key $key The signing key
+ * @param int $mode Signing mode (enigma_engine::SIGN_*)
*
* @return mixed True on success or enigma_error on failure
*/
diff --git a/plugins/enigma/lib/enigma_driver_gnupg.php b/plugins/enigma/lib/enigma_driver_gnupg.php
index a96b61ccb06..3c9a499530e 100644
--- a/plugins/enigma/lib/enigma_driver_gnupg.php
+++ b/plugins/enigma/lib/enigma_driver_gnupg.php
@@ -16,7 +16,7 @@
require_once 'Crypt/GPG.php';
-class enigma_driver_gnupg extends enigma_driver
+class enigma_driver_gnupg extends \enigma_driver
{
protected $rc;
protected $gpg;
@@ -29,12 +29,12 @@ class enigma_driver_gnupg extends enigma_driver
/**
* Class constructor
*
- * @param rcube_user $user User object
+ * @param \rcube_user $user User object
*/
- #[Override]
+ #[\Override]
public function __construct($user)
{
- $this->rc = rcmail::get_instance();
+ $this->rc = \rcmail::get_instance();
$this->user = $user;
}
@@ -42,9 +42,9 @@ public function __construct($user)
* Driver initialization and environment checking.
* Should only return critical errors.
*
- * @return enigma_error|null NULL on success, enigma_error on failure
+ * @return \enigma_error|null NULL on success, enigma_error on failure
*/
- #[Override]
+ #[\Override]
public function init()
{
$homedir = $this->rc->config->get('enigma_pgp_homedir');
@@ -54,17 +54,17 @@ public function init()
$gpgconf = $this->rc->config->get('enigma_pgp_gpgconf');
if (!$homedir) {
- return new enigma_error(enigma_error::INTERNAL,
+ return new \enigma_error(\enigma_error::INTERNAL,
"Option 'enigma_pgp_homedir' not specified");
}
// check if homedir exists (create it if not) and is readable
if (!file_exists($homedir)) {
- return new enigma_error(enigma_error::INTERNAL,
+ return new \enigma_error(\enigma_error::INTERNAL,
"Keys directory doesn't exists: {$homedir}");
}
if (!is_writable($homedir)) {
- return new enigma_error(enigma_error::INTERNAL,
+ return new \enigma_error(\enigma_error::INTERNAL,
"Keys directory isn't writeable: {$homedir}");
}
@@ -76,11 +76,11 @@ public function init()
}
if (!file_exists($homedir)) {
- return new enigma_error(enigma_error::INTERNAL,
+ return new \enigma_error(\enigma_error::INTERNAL,
"Unable to create keys directory: {$homedir}");
}
if (!is_writable($homedir)) {
- return new enigma_error(enigma_error::INTERNAL,
+ return new \enigma_error(\enigma_error::INTERNAL,
"Unable to write to keys directory: {$homedir}");
}
@@ -107,8 +107,8 @@ public function init()
// Create Crypt_GPG object
try {
- $this->gpg = new Crypt_GPG($options);
- } catch (Exception $e) {
+ $this->gpg = new \Crypt_GPG($options);
+ } catch (\Exception $e) {
return $this->get_error_from_exception($e);
}
@@ -120,13 +120,13 @@ public function init()
/**
* Encryption (and optional signing).
*
- * @param string $text Message body
- * @param array $keys List of keys (enigma_key objects)
- * @param enigma_key $sign_key Optional signing Key ID
+ * @param string $text Message body
+ * @param array $keys List of keys (enigma_key objects)
+ * @param \enigma_key $sign_key Optional signing Key ID
*
- * @return string|enigma_error Encrypted message or enigma_error on failure
+ * @return string|\enigma_error Encrypted message or enigma_error on failure
*/
- #[Override]
+ #[\Override]
public function encrypt($text, $keys, $sign_key = null)
{
try {
@@ -146,7 +146,7 @@ public function encrypt($text, $keys, $sign_key = null)
}
return $this->gpg->encrypt($text, true);
- } catch (Exception $e) {
+ } catch (\Exception $e) {
return $this->get_error_from_exception($e);
}
}
@@ -154,13 +154,13 @@ public function encrypt($text, $keys, $sign_key = null)
/**
* Decrypt a message (and verify if signature found)
*
- * @param string $text Encrypted message
- * @param array $keys List of key-password mapping
- * @param enigma_signature &$signature Signature information (if available)
+ * @param string $text Encrypted message
+ * @param array $keys List of key-password mapping
+ * @param \enigma_signature &$signature Signature information (if available)
*
* @return mixed Decrypted message or enigma_error on failure
*/
- #[Override]
+ #[\Override]
public function decrypt($text, $keys = [], &$signature = null)
{
try {
@@ -179,13 +179,13 @@ public function decrypt($text, $keys = [], &$signature = null)
if (method_exists($this->gpg, 'getWarnings')) {
foreach ($this->gpg->getWarnings() as $warning_msg) {
if (strpos($warning_msg, 'not integrity protected') !== false) {
- return new enigma_error(enigma_error::NOMDC, ucfirst($warning_msg));
+ return new \enigma_error(\enigma_error::NOMDC, ucfirst($warning_msg));
}
}
}
return $result['data'];
- } catch (Exception $e) {
+ } catch (\Exception $e) {
return $this->get_error_from_exception($e);
}
}
@@ -193,25 +193,25 @@ public function decrypt($text, $keys = [], &$signature = null)
/**
* Signing.
*
- * @param string $text Message body
- * @param enigma_key $key The key
- * @param int $mode Signing mode (enigma_engine::SIGN_*)
+ * @param string $text Message body
+ * @param \enigma_key $key The key
+ * @param int $mode Signing mode (enigma_engine::SIGN_*)
*
* @return mixed True on success or enigma_error on failure
*/
- #[Override]
+ #[\Override]
public function sign($text, $key, $mode = null)
{
try {
$this->gpg->addSignKey($key->reference, $key->password);
- $res = $this->gpg->sign($text, $mode, Crypt_GPG::ARMOR_ASCII, true);
+ $res = $this->gpg->sign($text, $mode, \Crypt_GPG::ARMOR_ASCII, true);
$sigInfo = $this->gpg->getLastSignatureInfo();
$this->last_sig_algorithm = $sigInfo->getHashAlgorithmName();
return $res;
- } catch (Exception $e) {
+ } catch (\Exception $e) {
return $this->get_error_from_exception($e);
}
}
@@ -222,15 +222,15 @@ public function sign($text, $key, $mode = null)
* @param string $text Message body
* @param string $signature Signature, if message is of type PGP/MIME and body doesn't contain it
*
- * @return enigma_signature|enigma_error Signature information or enigma_error
+ * @return \enigma_signature|\enigma_error Signature information or enigma_error
*/
- #[Override]
+ #[\Override]
public function verify($text, $signature)
{
try {
$verified = $this->gpg->verify($text, $signature);
return $this->parse_signature($verified[0]);
- } catch (Exception $e) {
+ } catch (\Exception $e) {
return $this->get_error_from_exception($e);
}
}
@@ -244,7 +244,7 @@ public function verify($text, $signature)
*
* @return mixed Import status array or enigma_error
*/
- #[Override]
+ #[\Override]
public function import($content, $isfile = false, $passwords = [])
{
try {
@@ -262,7 +262,7 @@ public function import($content, $isfile = false, $passwords = [])
$this->db_save();
return $result;
- } catch (Exception $e) {
+ } catch (\Exception $e) {
return $this->get_error_from_exception($e);
}
}
@@ -274,9 +274,9 @@ public function import($content, $isfile = false, $passwords = [])
* @param bool $with_private Include private key
* @param array $passwords Optional key => password map
*
- * @return string|enigma_error Key content or enigma_error
+ * @return string|\enigma_error Key content or enigma_error
*/
- #[Override]
+ #[\Override]
public function export($keyid, $with_private = false, $passwords = [])
{
try {
@@ -293,7 +293,7 @@ public function export($keyid, $with_private = false, $passwords = [])
}
return $key;
- } catch (Exception $e) {
+ } catch (\Exception $e) {
return $this->get_error_from_exception($e);
}
}
@@ -305,7 +305,7 @@ public function export($keyid, $with_private = false, $passwords = [])
*
* @return enigma_key[]|enigma_error Array of keys or enigma_error
*/
- #[Override]
+ #[\Override]
public function list_keys($pattern = '')
{
try {
@@ -317,7 +317,7 @@ public function list_keys($pattern = '')
}
return $result;
- } catch (Exception $e) {
+ } catch (\Exception $e) {
return $this->get_error_from_exception($e);
}
}
@@ -327,9 +327,9 @@ public function list_keys($pattern = '')
*
* @param string $keyid Key ID, user ID or fingerprint
*
- * @return enigma_key|enigma_error Key object or enigma_error
+ * @return \enigma_key|\enigma_error Key object or enigma_error
*/
- #[Override]
+ #[\Override]
public function get_key($keyid)
{
$list = $this->list_keys($keyid);
@@ -349,12 +349,12 @@ public function get_key($keyid)
*
* @return mixed Key (enigma_key) object or enigma_error
*/
- #[Override]
+ #[\Override]
public function gen_key($data)
{
try {
$debug = $this->rc->config->get('enigma_debug');
- $keygen = new Crypt_GPG_KeyGenerator([
+ $keygen = new \Crypt_GPG_KeyGenerator([
'homedir' => $this->homedir,
// 'binary' => '/usr/bin/gpg2',
'debug' => $debug ? [$this, 'debug'] : false,
@@ -366,7 +366,7 @@ public function gen_key($data)
->generateKey($data['user'], $data['email']);
return $this->parse_key($key);
- } catch (Exception $e) {
+ } catch (\Exception $e) {
return $this->get_error_from_exception($e);
}
}
@@ -378,7 +378,7 @@ public function gen_key($data)
*
* @return mixed True on success or enigma_error
*/
- #[Override]
+ #[\Override]
public function delete_key($keyid)
{
// delete public key
@@ -389,11 +389,11 @@ public function delete_key($keyid)
$code = $result->getCode();
// if not found, delete private key
- if ($code == enigma_error::KEYNOTFOUND) {
+ if ($code == \enigma_error::KEYNOTFOUND) {
$result = $this->delete_privkey($keyid);
}
// need to delete private key first
- elseif ($code == enigma_error::DELKEY) {
+ elseif ($code == \enigma_error::DELKEY) {
$result = $this->delete_privkey($keyid);
if ($result === true) {
@@ -413,7 +413,7 @@ public function delete_key($keyid)
*
* @return string Hash algorithm name e.g. sha1
*/
- #[Override]
+ #[\Override]
public function signature_algorithm()
{
return $this->last_sig_algorithm;
@@ -424,14 +424,14 @@ public function signature_algorithm()
*
* @return array Capabilities list
*/
- #[Override]
+ #[\Override]
public function capabilities()
{
- $caps = [enigma_driver::SUPPORT_RSA];
+ $caps = [\enigma_driver::SUPPORT_RSA];
$version = $this->gpg->getVersion();
if (version_compare($version, '2.1.7', 'ge')) {
- $caps[] = enigma_driver::SUPPORT_ECC;
+ $caps[] = \enigma_driver::SUPPORT_ECC;
}
return $caps;
@@ -445,7 +445,7 @@ protected function delete_privkey($keyid)
try {
$this->gpg->deletePrivateKey($keyid);
return true;
- } catch (Exception $e) {
+ } catch (\Exception $e) {
return $this->get_error_from_exception($e);
}
}
@@ -458,7 +458,7 @@ protected function delete_pubkey($keyid)
try {
$this->gpg->deletePublicKey($keyid);
return true;
- } catch (Exception $e) {
+ } catch (\Exception $e) {
return $this->get_error_from_exception($e);
}
}
@@ -468,42 +468,42 @@ protected function delete_pubkey($keyid)
*
* @param mixed $e Exception object
*
- * @return enigma_error Error object
+ * @return \enigma_error Error object
*/
protected function get_error_from_exception($e)
{
$data = [];
- if ($e instanceof Crypt_GPG_KeyNotFoundException) {
- $error = enigma_error::KEYNOTFOUND;
+ if ($e instanceof \Crypt_GPG_KeyNotFoundException) {
+ $error = \enigma_error::KEYNOTFOUND;
$data['id'] = $e->getKeyId();
- } elseif ($e instanceof Crypt_GPG_BadPassphraseException) {
- $error = enigma_error::BADPASS;
+ } elseif ($e instanceof \Crypt_GPG_BadPassphraseException) {
+ $error = \enigma_error::BADPASS;
$data['bad'] = $e->getBadPassphrases();
$data['missing'] = $e->getMissingPassphrases();
- } elseif ($e instanceof Crypt_GPG_NoDataException) {
- $error = enigma_error::NODATA;
- } elseif ($e instanceof Crypt_GPG_DeletePrivateKeyException) {
- $error = enigma_error::DELKEY;
+ } elseif ($e instanceof \Crypt_GPG_NoDataException) {
+ $error = \enigma_error::NODATA;
+ } elseif ($e instanceof \Crypt_GPG_DeletePrivateKeyException) {
+ $error = \enigma_error::DELKEY;
} else {
- $error = enigma_error::INTERNAL;
+ $error = \enigma_error::INTERNAL;
}
$msg = $e->getMessage();
- return new enigma_error($error, $msg, $data);
+ return new \enigma_error($error, $msg, $data);
}
/**
* Converts Crypt_GPG_Signature object into Enigma's signature object
*
- * @param Crypt_GPG_Signature $sig Signature object
+ * @param \Crypt_GPG_Signature $sig Signature object
*
- * @return enigma_signature Signature object
+ * @return \enigma_signature Signature object
*/
protected function parse_signature($sig)
{
- $data = new enigma_signature();
+ $data = new \enigma_signature();
$data->id = $sig->getId() ?: $sig->getKeyId();
$data->valid = $sig->isValid();
@@ -524,16 +524,16 @@ protected function parse_signature($sig)
/**
* Converts Crypt_GPG_Key object into Enigma's key object
*
- * @param Crypt_GPG_Key $key Key object
+ * @param \Crypt_GPG_Key $key Key object
*
- * @return enigma_key Key object
+ * @return \enigma_key Key object
*/
protected function parse_key($key)
{
- $ekey = new enigma_key();
+ $ekey = new \enigma_key();
foreach ($key->getUserIds() as $idx => $user) {
- $id = new enigma_userid();
+ $id = new \enigma_userid();
$id->name = $user->getName();
$id->comment = $user->getComment();
$id->email = $user->getEmail();
@@ -549,8 +549,8 @@ protected function parse_key($key)
$ekey->reference = $key;
foreach ($key->getSubKeys() as $idx => $subkey) {
- /** @var Crypt_GPG_SubKey $subkey */
- $skey = new enigma_subkey();
+ /** @var \Crypt_GPG_SubKey $subkey */
+ $skey = new \enigma_subkey();
$skey->id = $subkey->getId();
$skey->revoked = $subkey->isRevoked();
$skey->fingerprint = $subkey->getFingerprint();
@@ -568,11 +568,11 @@ protected function parse_key($key)
$skey->expires = $subkey->getExpirationDate();
if ($skey->created) {
- $skey->created = new DateTime("@{$skey->created}");
+ $skey->created = new \DateTime("@{$skey->created}");
}
if ($skey->expires) {
- $skey->expires = new DateTime("@{$skey->expires}");
+ $skey->expires = new \DateTime("@{$skey->expires}");
}
}
@@ -615,7 +615,7 @@ protected function db_sync()
// @phpstan-ignore-next-line
if (!is_array($data)) {
- rcube::raise_error([
+ \rcube::raise_error([
'code' => 605,
'message' => "Enigma: Failed to sync {$file} ({$file_id}). Decode error.",
], true, false);
@@ -644,7 +644,7 @@ protected function db_sync()
// error
@unlink($tmpfile);
- rcube::raise_error([
+ \rcube::raise_error([
'code' => 605,
'message' => "Enigma: Failed to sync {$file}.",
], true, false);
@@ -712,7 +712,7 @@ protected function db_save($is_empty = false)
}
if ($datasize > $maxsize) {
- rcube::raise_error([
+ \rcube::raise_error([
'code' => 605,
'message' => "Enigma: Failed to save {$file}. Size exceeds max_allowed_packet.",
], true, false);
@@ -724,7 +724,7 @@ protected function db_save($is_empty = false)
$result = $db->insert_or_update($table, $unique, ['mtime', 'data'], [$mtime, $data]);
if ($db->is_error($result)) {
- rcube::raise_error([
+ \rcube::raise_error([
'code' => 605,
'message' => "Enigma: Failed to save {$file} into database.",
], true, false);
@@ -746,7 +746,7 @@ protected function db_save($is_empty = false)
);
if ($db->is_error($result)) {
- rcube::raise_error([
+ \rcube::raise_error([
'code' => 605,
'message' => "Enigma: Failed to delete {$file} from database.",
], true, false);
@@ -785,6 +785,6 @@ protected function db_files_list()
*/
public function debug($line)
{
- rcube::write_log('enigma', 'GPG: ' . $line);
+ \rcube::write_log('enigma', 'GPG: ' . $line);
}
}
diff --git a/plugins/enigma/lib/enigma_driver_phpssl.php b/plugins/enigma/lib/enigma_driver_phpssl.php
index 664a511e6db..6eeba8c014c 100644
--- a/plugins/enigma/lib/enigma_driver_phpssl.php
+++ b/plugins/enigma/lib/enigma_driver_phpssl.php
@@ -14,16 +14,16 @@
+-------------------------------------------------------------------------+
*/
-class enigma_driver_phpssl extends enigma_driver
+class enigma_driver_phpssl extends \enigma_driver
{
private $rc;
private $homedir; // @phpstan-ignore-line
private $user;
- #[Override]
+ #[\Override]
public function __construct($user)
{
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
$this->rc = $rcmail;
$this->user = $user;
}
@@ -32,25 +32,25 @@ public function __construct($user)
* Driver initialization and environment checking.
* Should only return critical errors.
*
- * @return enigma_error|null NULL on success, enigma_error on failure
+ * @return \enigma_error|null NULL on success, enigma_error on failure
*/
- #[Override]
+ #[\Override]
public function init()
{
$homedir = $this->rc->config->get('enigma_smime_homedir', INSTALL_PATH . '/plugins/enigma/home');
if (!$homedir) {
- return new enigma_error(enigma_error::INTERNAL,
+ return new \enigma_error(\enigma_error::INTERNAL,
"Option 'enigma_smime_homedir' not specified");
}
// check if homedir exists (create it if not) and is readable
if (!file_exists($homedir)) {
- return new enigma_error(enigma_error::INTERNAL,
+ return new \enigma_error(\enigma_error::INTERNAL,
"Keys directory doesn't exists: {$homedir}");
}
if (!is_writable($homedir)) {
- return new enigma_error(enigma_error::INTERNAL,
+ return new \enigma_error(\enigma_error::INTERNAL,
"Keys directory isn't writeable: {$homedir}");
}
@@ -62,11 +62,11 @@ public function init()
}
if (!file_exists($homedir)) {
- return new enigma_error(enigma_error::INTERNAL,
+ return new \enigma_error(\enigma_error::INTERNAL,
"Unable to create keys directory: {$homedir}");
}
if (!is_writable($homedir)) {
- return new enigma_error(enigma_error::INTERNAL,
+ return new \enigma_error(\enigma_error::INTERNAL,
"Unable to write to keys directory: {$homedir}");
}
@@ -75,25 +75,25 @@ public function init()
return null;
}
- #[Override]
+ #[\Override]
public function encrypt($text, $keys, $sign_key = null)
{
- return new enigma_error(enigma_error::INTERNAL, 'Not implemented');
+ return new \enigma_error(\enigma_error::INTERNAL, 'Not implemented');
}
- #[Override]
+ #[\Override]
public function decrypt($text, $keys = [], &$signature = null)
{
- return new enigma_error(enigma_error::INTERNAL, 'Not implemented');
+ return new \enigma_error(\enigma_error::INTERNAL, 'Not implemented');
}
- #[Override]
+ #[\Override]
public function sign($text, $key, $mode = null)
{
- return new enigma_error(enigma_error::INTERNAL, 'Not implemented');
+ return new \enigma_error(\enigma_error::INTERNAL, 'Not implemented');
}
- #[Override]
+ #[\Override]
public function verify($struct, $message)
{
/*
@@ -134,43 +134,43 @@ public function verify($struct, $message)
return $sig;
*/
- return new enigma_error(enigma_error::INTERNAL, 'Not implemented');
+ return new \enigma_error(\enigma_error::INTERNAL, 'Not implemented');
}
- #[Override]
+ #[\Override]
public function import($content, $isfile = false, $passwords = [])
{
- return new enigma_error(enigma_error::INTERNAL, 'Not implemented');
+ return new \enigma_error(\enigma_error::INTERNAL, 'Not implemented');
}
- #[Override]
+ #[\Override]
public function export($key, $with_private = false, $passwords = [])
{
- return new enigma_error(enigma_error::INTERNAL, 'Not implemented');
+ return new \enigma_error(\enigma_error::INTERNAL, 'Not implemented');
}
- #[Override]
+ #[\Override]
public function list_keys($pattern = '')
{
- return new enigma_error(enigma_error::INTERNAL, 'Not implemented');
+ return new \enigma_error(\enigma_error::INTERNAL, 'Not implemented');
}
- #[Override]
+ #[\Override]
public function get_key($keyid)
{
- return new enigma_error(enigma_error::INTERNAL, 'Not implemented');
+ return new \enigma_error(\enigma_error::INTERNAL, 'Not implemented');
}
- #[Override]
+ #[\Override]
public function gen_key($data)
{
- return new enigma_error(enigma_error::INTERNAL, 'Not implemented');
+ return new \enigma_error(\enigma_error::INTERNAL, 'Not implemented');
}
- #[Override]
+ #[\Override]
public function delete_key($keyid)
{
- return new enigma_error(enigma_error::INTERNAL, 'Not implemented');
+ return new \enigma_error(\enigma_error::INTERNAL, 'Not implemented');
}
/**
@@ -179,7 +179,7 @@ public function delete_key($keyid)
*
* @return string Hash algorithm name e.g. sha1
*/
- #[Override]
+ #[\Override]
public function signature_algorithm()
{
return ''; // TODO
@@ -202,10 +202,10 @@ private function parse_sig_cert($file, $validity)
if (empty($cert) || empty($cert['subject'])) {
$errorstr = $this->get_openssl_error();
- return new enigma_error(enigma_error::INTERNAL, $errorstr);
+ return new \enigma_error(\enigma_error::INTERNAL, $errorstr);
}
- $data = new enigma_signature();
+ $data = new \enigma_signature();
$data->id = $cert['hash']; // ?
$data->valid = $validity;
diff --git a/plugins/enigma/lib/enigma_engine.php b/plugins/enigma/lib/enigma_engine.php
index 7450c54a749..dc40e73ca0c 100644
--- a/plugins/enigma/lib/enigma_engine.php
+++ b/plugins/enigma/lib/enigma_engine.php
@@ -49,7 +49,7 @@ class enigma_engine
*/
public function __construct()
{
- $this->rc = rcmail::get_instance();
+ $this->rc = \rcmail::get_instance();
$this->password_time = $this->rc->config->get('enigma_password_time') * 60;
@@ -77,7 +77,7 @@ public function load_pgp_driver()
// Initialise driver
$result = $this->pgp_driver->init();
- if ($result instanceof enigma_error) {
+ if ($result instanceof \enigma_error) {
self::raise_error($result, __LINE__, true);
}
}
@@ -100,7 +100,7 @@ public function load_smime_driver()
// Initialise driver
$result = $this->smime_driver->init();
- if ($result instanceof enigma_error) {
+ if ($result instanceof \enigma_error) {
self::raise_error($result, __LINE__, true);
}
}
@@ -108,21 +108,21 @@ public function load_smime_driver()
/**
* Handler for message signing
*
- * @param Mail_mime &$message Original message
- * @param int $mode Encryption mode
+ * @param \Mail_mime &$message Original message
+ * @param int $mode Encryption mode
*
* @return ?enigma_error On error returns error object
*/
public function sign_message(&$message, $mode = null)
{
- $mime = new enigma_mime_message($message, enigma_mime_message::PGP_SIGNED);
+ $mime = new \enigma_mime_message($message, \enigma_mime_message::PGP_SIGNED);
$from = $mime->getFromAddress();
// find private key
$key = $this->find_key($from, true);
if (empty($key)) {
- return new enigma_error(enigma_error::KEYNOTFOUND);
+ return new \enigma_error(\enigma_error::KEYNOTFOUND);
}
// check if we have password for this key
@@ -132,7 +132,7 @@ public function sign_message(&$message, $mode = null)
if ($pass === null && !$this->rc->config->get('enigma_passwordless')) {
// ask for password
$error = ['missing' => [$key->id => $key->name]];
- return new enigma_error(enigma_error::BADPASS, '', $error);
+ return new \enigma_error(\enigma_error::BADPASS, '', $error);
}
$key->password = $pass;
@@ -140,21 +140,21 @@ public function sign_message(&$message, $mode = null)
// select mode
switch ($mode) {
case self::SIGN_MODE_BODY:
- $pgp_mode = Crypt_GPG::SIGN_MODE_CLEAR;
+ $pgp_mode = \Crypt_GPG::SIGN_MODE_CLEAR;
break;
case self::SIGN_MODE_MIME:
- $pgp_mode = Crypt_GPG::SIGN_MODE_DETACHED;
+ $pgp_mode = \Crypt_GPG::SIGN_MODE_DETACHED;
break;
default:
if ($mime->isMultipart()) {
- $pgp_mode = Crypt_GPG::SIGN_MODE_DETACHED;
+ $pgp_mode = \Crypt_GPG::SIGN_MODE_DETACHED;
} else {
- $pgp_mode = Crypt_GPG::SIGN_MODE_CLEAR;
+ $pgp_mode = \Crypt_GPG::SIGN_MODE_CLEAR;
}
}
// get message body
- if ($pgp_mode == Crypt_GPG::SIGN_MODE_CLEAR) {
+ if ($pgp_mode == \Crypt_GPG::SIGN_MODE_CLEAR) {
// in this mode we'll replace text part
// with the one containing signature
$body = $message->getTXTBody();
@@ -165,8 +165,8 @@ public function sign_message(&$message, $mode = null)
// We can't use format=flowed for signed messages
if (strpos($text_charset, 'format=flowed')) {
[$charset, $params] = explode(';', $text_charset);
- $body = rcube_mime::unfold_flowed($body);
- $body = rcube_mime::wordwrap($body, $line_length, "\r\n", false, $charset);
+ $body = \rcube_mime::unfold_flowed($body);
+ $body = \rcube_mime::wordwrap($body, $line_length, "\r\n", false, $charset);
$text_charset = str_replace(";\r\n format=flowed", '', $text_charset);
}
@@ -179,17 +179,17 @@ public function sign_message(&$message, $mode = null)
$result = $this->pgp_sign($body, $key, $pgp_mode);
if ($result !== true) {
- if ($result->getCode() == enigma_error::BADPASS) {
+ if ($result->getCode() == \enigma_error::BADPASS) {
// ask for password
$error = ['bad' => [$key->id => $key->name]];
- return new enigma_error(enigma_error::BADPASS, '', $error);
+ return new \enigma_error(\enigma_error::BADPASS, '', $error);
}
return $result;
}
// replace message body
- if ($pgp_mode == Crypt_GPG::SIGN_MODE_CLEAR) {
+ if ($pgp_mode == \Crypt_GPG::SIGN_MODE_CLEAR) {
$message->setTXTBody($body);
if (!empty($text_charset)) {
$message->setParam('text_charset', $text_charset);
@@ -205,15 +205,15 @@ public function sign_message(&$message, $mode = null)
/**
* Handler for message encryption
*
- * @param Mail_mime &$message Original message
- * @param int $mode Encryption mode
- * @param bool $is_draft Is draft-save action - use only sender's key for encryption
+ * @param \Mail_mime &$message Original message
+ * @param int $mode Encryption mode
+ * @param bool $is_draft Is draft-save action - use only sender's key for encryption
*
* @return ?enigma_error On error returns error object
*/
public function encrypt_message(&$message, $mode = null, $is_draft = false)
{
- $mime = new enigma_mime_message($message, enigma_mime_message::PGP_ENCRYPTED);
+ $mime = new \enigma_mime_message($message, \enigma_mime_message::PGP_ENCRYPTED);
// always use sender's key
$from = $mime->getFromAddress();
@@ -226,7 +226,7 @@ public function encrypt_message(&$message, $mode = null, $is_draft = false)
$sign_key = $this->find_key($from, true);
if (empty($sign_key)) {
- return new enigma_error(enigma_error::KEYNOTFOUND);
+ return new \enigma_error(\enigma_error::KEYNOTFOUND);
}
// check if we have password for this key
@@ -236,7 +236,7 @@ public function encrypt_message(&$message, $mode = null, $is_draft = false)
if ($sign_pass === null && !$this->rc->config->get('enigma_passwordless')) {
// ask for password
$error = ['missing' => [$sign_key->id => $sign_key->name]];
- return new enigma_error(enigma_error::BADPASS, '', $error);
+ return new \enigma_error(\enigma_error::BADPASS, '', $error);
}
$sign_key->password = $sign_pass;
@@ -263,7 +263,7 @@ public function encrypt_message(&$message, $mode = null, $is_draft = false)
}
if (empty($key)) {
- return new enigma_error(enigma_error::KEYNOTFOUND, '', ['missing' => $email]);
+ return new \enigma_error(\enigma_error::KEYNOTFOUND, '', ['missing' => $email]);
}
$keys[] = $key;
@@ -292,10 +292,10 @@ public function encrypt_message(&$message, $mode = null, $is_draft = false)
$result = $this->pgp_encrypt($body, $keys, $sign_key);
if ($result !== true) {
- if ($result->getCode() == enigma_error::BADPASS) {
+ if ($result->getCode() == \enigma_error::BADPASS) {
// ask for password
$error = ['bad' => [$sign_key->id => $sign_key->name]];
- return new enigma_error(enigma_error::BADPASS, '', $error);
+ return new \enigma_error(\enigma_error::BADPASS, '', $error);
}
return $result;
@@ -315,22 +315,22 @@ public function encrypt_message(&$message, $mode = null, $is_draft = false)
/**
* Handler for attaching public key to a message
*
- * @param Mail_mime &$message Original message
+ * @param \Mail_mime &$message Original message
*
* @return bool True on success, False on failure
*/
public function attach_public_key(&$message)
{
$headers = $message->headers();
- $from = rcube_mime::decode_address_list($headers['From'], 1, false, null, true);
+ $from = \rcube_mime::decode_address_list($headers['From'], 1, false, null, true);
$from = $from[1] ?? null;
// find my key
if ($from && ($key = $this->find_key($from, true))) {
$pubkey_armor = $this->export_key($key->id);
- if (!$pubkey_armor instanceof enigma_error) {
- $pubkey_name = '0x' . enigma_key::format_id($key->id) . '.asc';
+ if (!$pubkey_armor instanceof \enigma_error) {
+ $pubkey_name = '0x' . \enigma_key::format_id($key->id) . '.asc';
$message->addAttachment($pubkey_armor, 'application/pgp-keys', $pubkey_name, false, '7bit');
return true;
}
@@ -364,7 +364,7 @@ public function part_structure($p, $body = null)
$this->sender = $p['object']->sender['mailto'];
}
if (!empty($p['structure']->headers) && !empty($p['structure']->headers['from'])) {
- $from = rcube_mime::decode_address_list($p['structure']->headers['from'], 1, false);
+ $from = \rcube_mime::decode_address_list($p['structure']->headers['from'], 1, false);
if (($from = current($from)) && !empty($from['mailto'])) {
$this->sender = $from['mailto'];
}
@@ -401,7 +401,7 @@ public function part_structure($p, $body = null)
*/
public function part_body($p)
{
- /** @var rcube_message_part $part */
+ /** @var \rcube_message_part $part */
$part = $p['part'];
// encrypted attachment, see parse_plain_encrypted()
@@ -872,7 +872,7 @@ private function pgp_verify(&$msg_body, $sig_body = null)
$sig = $this->pgp_driver->verify($msg_body, $sig_body);
- if (($sig instanceof enigma_error) && $sig->getCode() != enigma_error::KEYNOTFOUND) {
+ if (($sig instanceof \enigma_error) && $sig->getCode() != \enigma_error::KEYNOTFOUND) {
self::raise_error($sig, __LINE__);
}
@@ -882,8 +882,8 @@ private function pgp_verify(&$msg_body, $sig_body = null)
/**
* PGP message decryption.
*
- * @param mixed &$msg_body Message body
- * @param enigma_signature &$signature Signature verification result
+ * @param mixed &$msg_body Message body
+ * @param \enigma_signature &$signature Signature verification result
*
* @return mixed True or enigma_error
*/
@@ -902,8 +902,8 @@ private function pgp_decrypt(&$msg_body, &$signature = null)
$keys = $this->get_passwords();
$result = $this->pgp_driver->decrypt($msg_body, $keys, $signature);
- if ($result instanceof enigma_error) {
- if ($result->getCode() != enigma_error::KEYNOTFOUND) {
+ if ($result instanceof \enigma_error) {
+ if ($result->getCode() != \enigma_error::KEYNOTFOUND) {
self::raise_error($result, __LINE__);
}
@@ -918,9 +918,9 @@ private function pgp_decrypt(&$msg_body, &$signature = null)
/**
* PGP message signing
*
- * @param mixed &$msg_body Message body
- * @param enigma_key $key The key (with passphrase)
- * @param int $mode Signing mode
+ * @param mixed &$msg_body Message body
+ * @param \enigma_key $key The key (with passphrase)
+ * @param int $mode Signing mode
*
* @return mixed True or enigma_error
*/
@@ -929,8 +929,8 @@ private function pgp_sign(&$msg_body, $key, $mode = null)
// @TODO: Handle big bodies using (temp) files
$result = $this->pgp_driver->sign($msg_body, $key, $mode);
- if ($result instanceof enigma_error) {
- if ($result->getCode() != enigma_error::KEYNOTFOUND) {
+ if ($result instanceof \enigma_error) {
+ if ($result->getCode() != \enigma_error::KEYNOTFOUND) {
self::raise_error($result, __LINE__);
}
@@ -957,8 +957,8 @@ private function pgp_encrypt(&$msg_body, $keys, $sign_key = null, $sign_pass = n
// @TODO: Handle big bodies using (temp) files
$result = $this->pgp_driver->encrypt($msg_body, $keys, $sign_key, $sign_pass);
- if ($result instanceof enigma_error) {
- if ($result->getCode() != enigma_error::KEYNOTFOUND) {
+ if ($result instanceof \enigma_error) {
+ if ($result->getCode() != \enigma_error::KEYNOTFOUND) {
self::raise_error($result, __LINE__);
}
@@ -982,7 +982,7 @@ public function list_keys($pattern = '')
$this->load_pgp_driver();
$result = $this->pgp_driver->list_keys($pattern);
- if ($result instanceof enigma_error) {
+ if ($result instanceof \enigma_error) {
self::raise_error($result, __LINE__);
}
@@ -1006,18 +1006,18 @@ public function find_key($email, $can_sign = false)
$this->load_pgp_driver();
$result = $this->pgp_driver->list_keys($email);
- if ($result instanceof enigma_error) {
+ if ($result instanceof \enigma_error) {
self::raise_error($result, __LINE__);
return null;
}
- $mode = $can_sign ? enigma_key::CAN_SIGN : enigma_key::CAN_ENCRYPT;
+ $mode = $can_sign ? \enigma_key::CAN_SIGN : \enigma_key::CAN_ENCRYPT;
$found = [];
// check key validity and type
foreach ($result as $key) {
if (($subkey = $key->find_subkey($email, $mode))
- && (!$can_sign || $key->get_type() == enigma_key::TYPE_KEYPAIR)
+ && (!$can_sign || $key->get_type() == \enigma_key::TYPE_KEYPAIR)
) {
$found[$subkey->get_creation_date(true)] = $key;
}
@@ -1051,7 +1051,7 @@ public function get_key($keyid)
$this->load_pgp_driver();
$result = $this->pgp_driver->get_key($keyid);
- if ($result instanceof enigma_error) {
+ if ($result instanceof \enigma_error) {
self::raise_error($result, __LINE__);
}
@@ -1063,14 +1063,14 @@ public function get_key($keyid)
*
* @param string $keyid Key ID
*
- * @return enigma_error|bool True on success
+ * @return \enigma_error|bool True on success
*/
public function delete_key($keyid)
{
$this->load_pgp_driver();
$result = $this->pgp_driver->delete_key($keyid);
- if ($result instanceof enigma_error) {
+ if ($result instanceof \enigma_error) {
self::raise_error($result, __LINE__);
}
@@ -1089,7 +1089,7 @@ public function generate_key($data)
$this->load_pgp_driver();
$result = $this->pgp_driver->gen_key($data);
- if ($result instanceof enigma_error) {
+ if ($result instanceof \enigma_error) {
self::raise_error($result, __LINE__);
}
@@ -1109,7 +1109,7 @@ public function import_key($content, $isfile = false)
$this->load_pgp_driver();
$result = $this->pgp_driver->import($content, $isfile, $this->get_passwords());
- if ($result instanceof enigma_error) {
+ if ($result instanceof \enigma_error) {
self::raise_error($result, __LINE__);
} else {
$result['imported'] = $result['public_imported'] + $result['private_imported'];
@@ -1126,14 +1126,14 @@ public function import_key($content, $isfile = false)
* @param ?resource $fp Optional output stream
* @param bool $include_private Include private key
*
- * @return string|enigma_error|null Key content (Null if writing to a file) or enigma_error
+ * @return string|\enigma_error|null Key content (Null if writing to a file) or enigma_error
*/
public function export_key($key, $fp = null, $include_private = false)
{
$this->load_pgp_driver();
$result = $this->pgp_driver->export($key, $include_private, $this->get_passwords());
- if ($result instanceof enigma_error) {
+ if ($result instanceof \enigma_error) {
self::raise_error($result, __LINE__);
return $result;
}
@@ -1151,8 +1151,8 @@ public function export_key($key, $fp = null, $include_private = false)
*/
public function password_handler()
{
- $keyid = rcube_utils::get_input_string('_keyid', rcube_utils::INPUT_POST);
- $passwd = rcube_utils::get_input_string('_passwd', rcube_utils::INPUT_POST, true);
+ $keyid = \rcube_utils::get_input_string('_keyid', \rcube_utils::INPUT_POST);
+ $passwd = \rcube_utils::get_input_string('_passwd', \rcube_utils::INPUT_POST, true);
if ($keyid && strlen($passwd)) {
$this->save_password(strtoupper($keyid), $passwd);
@@ -1212,8 +1212,8 @@ public function get_passwords()
/**
* Get message part body.
*
- * @param rcube_message $msg Message object
- * @param rcube_message_part $part Message part
+ * @param \rcube_message $msg Message object
+ * @param \rcube_message_part $part Message part
*/
private function get_part_body($msg, $part)
{
@@ -1249,7 +1249,7 @@ private function get_part_body($msg, $part)
*
* @param string &$body Message body
*
- * @return rcube_message_part Message structure
+ * @return \rcube_message_part Message structure
*/
private function parse_body(&$body)
{
@@ -1257,15 +1257,15 @@ private function parse_body(&$body)
$body = (string) preg_replace('/\r?\n/', "\r\n", $body);
// parse the body into structure
- return rcube_mime::parse_message($body);
+ return \rcube_mime::parse_message($body);
}
/**
* Replace message encrypted structure with decrypted message structure
*
- * @param array &$p Hook arguments
- * @param rcube_message_part $struct Part structure
- * @param int $size Part size
+ * @param array &$p Hook arguments
+ * @param \rcube_message_part $struct Part structure
+ * @param int $size Part size
*/
private function modify_structure(&$p, $struct, $size = 0)
{
@@ -1294,9 +1294,9 @@ private function modify_structure(&$p, $struct, $size = 0)
/**
* Modify decrypted message part
*
- * @param rcube_message_part $part
- * @param rcube_message $msg
- * @param string $old_id
+ * @param \rcube_message_part $part
+ * @param \rcube_message $msg
+ * @param string $old_id
*/
private function modify_structure_part($part, $msg, $old_id)
{
@@ -1349,7 +1349,7 @@ private function explode_signed_body($body, $boundary)
/**
* Checks if specified message part is a PGP-key or S/MIME cert data
*
- * @param rcube_message_part $part Part object
+ * @param \rcube_message_part $part Part object
*
* @return bool True if part is a key/cert
*/
@@ -1387,7 +1387,7 @@ public static function delete_dir($dir)
// This code can be executed from command line, make sure
// we have permissions to delete keys directory
if (!is_writable($dir)) {
- rcube::raise_error("Unable to delete {$dir}", false, true);
+ \rcube::raise_error("Unable to delete {$dir}", false, true);
return false;
}
@@ -1425,8 +1425,8 @@ public function is_supported($feature)
*/
protected static function raise_error($result, $line, $abort = false)
{
- if ($result->getCode() != enigma_error::BADPASS) {
- rcube::raise_error([
+ if ($result->getCode() != \enigma_error::BADPASS) {
+ \rcube::raise_error([
'code' => 600,
'line' => $line,
'message' => 'Enigma plugin: ' . $result->getMessage(),
diff --git a/plugins/enigma/lib/enigma_key.php b/plugins/enigma/lib/enigma_key.php
index 7429de78105..acbb5b5da63 100644
--- a/plugins/enigma/lib/enigma_key.php
+++ b/plugins/enigma/lib/enigma_key.php
@@ -110,7 +110,7 @@ public function is_private()
* @param string $email Email address
* @param int $mode Key mode (see self::CAN_* constants)
*
- * @return enigma_subkey|null Subkey object
+ * @return \enigma_subkey|null Subkey object
*/
public function find_subkey($email, $mode)
{
diff --git a/plugins/enigma/lib/enigma_mime_message.php b/plugins/enigma/lib/enigma_mime_message.php
index bef5e7b5ba9..e47eaefda03 100644
--- a/plugins/enigma/lib/enigma_mime_message.php
+++ b/plugins/enigma/lib/enigma_mime_message.php
@@ -14,7 +14,7 @@
+-------------------------------------------------------------------------+
*/
-class enigma_mime_message extends Mail_mime
+class enigma_mime_message extends \Mail_mime
{
public const PGP_SIGNED = 1;
public const PGP_ENCRYPTED = 2;
@@ -29,8 +29,8 @@ class enigma_mime_message extends Mail_mime
/**
* Object constructor
*
- * @param Mail_mime $message Original message
- * @param int $type Output message type
+ * @param \Mail_mime $message Original message
+ * @param int $type Output message type
*/
public function __construct($message, $type)
{
@@ -56,7 +56,7 @@ public function __construct($message, $type)
*
* @return bool True if it is multipart, otherwise False
*/
- #[Override]
+ #[\Override]
public function isMultipart()
{
return $this->message instanceof self
@@ -74,7 +74,7 @@ public function getFromAddress()
$headers = $this->message->headers();
if (isset($headers['From'])) {
- $from = rcube_mime::decode_address_list($headers['From'], 1, false, null, true);
+ $from = \rcube_mime::decode_address_list($headers['From'], 1, false, null, true);
$from = $from[1] ?? null;
return $from;
@@ -92,9 +92,9 @@ public function getRecipients()
{
// get sender address
$headers = $this->message->headers();
- $to = rcube_mime::decode_address_list($headers['To'] ?? '', null, false, null, true);
- $cc = rcube_mime::decode_address_list($headers['Cc'] ?? '', null, false, null, true);
- $bcc = rcube_mime::decode_address_list($headers['Bcc'] ?? '', null, false, null, true);
+ $to = \rcube_mime::decode_address_list($headers['To'] ?? '', null, false, null, true);
+ $cc = \rcube_mime::decode_address_list($headers['Cc'] ?? '', null, false, null, true);
+ $bcc = \rcube_mime::decode_address_list($headers['Bcc'] ?? '', null, false, null, true);
$recipients = array_unique(array_filter(array_merge($to, $cc, $bcc)));
$recipients = array_diff($recipients, ['undisclosed-recipients:']);
@@ -164,7 +164,7 @@ public function setPGPEncryptedBody($body)
*
* @return mixed The MIME message content string, null or PEAR error object
*/
- #[Override]
+ #[\Override]
public function get($params = null, $filename = null, $skip_head = false)
{
if (!empty($params)) {
@@ -186,7 +186,7 @@ public function get($params = null, $filename = null, $skip_head = false)
$params['content_type'] .= '; micalg=pgp-' . $this->micalg;
}
- $message = new Mail_mimePart('', $params);
+ $message = new \Mail_mimePart('', $params);
if (!empty($this->body)) {
$headers = $this->message->headers();
@@ -199,7 +199,7 @@ public function get($params = null, $filename = null, $skip_head = false)
// For plain text body we have to decode it back, to prevent from
// a double encoding issue (#8413)
- $this->body = rcube_mime::decode($this->body, $this->build_params['text_encoding']);
+ $this->body = \rcube_mime::decode($this->body, $this->build_params['text_encoding']);
}
$message->addSubpart($this->body, $params);
@@ -220,7 +220,7 @@ public function get($params = null, $filename = null, $skip_head = false)
'eol' => $this->build_params['eol'],
];
- $message = new Mail_mimePart('', $params);
+ $message = new \Mail_mimePart('', $params);
$message->addSubpart('Version: 1', [
'content_type' => 'application/pgp-encrypted',
@@ -234,7 +234,7 @@ public function get($params = null, $filename = null, $skip_head = false)
'filename' => 'encrypted.asc',
]);
} else {
- throw new Exception('Unexpected message type');
+ throw new \Exception('Unexpected message type');
}
// Use saved boundary
@@ -279,7 +279,7 @@ public function get($params = null, $filename = null, $skip_head = false)
*
* @return array Headers array
*/
- #[Override]
+ #[\Override]
protected function contentHeaders()
{
$this->checkParams();
@@ -313,7 +313,7 @@ protected function contentHeaders()
. " protocol=\"application/pgp-encrypted\";{$eol}"
. " boundary=\"{$boundary}\"";
} else {
- throw new Exception('Unexpected message type');
+ throw new \Exception('Unexpected message type');
}
return $headers;
diff --git a/plugins/enigma/lib/enigma_signature.php b/plugins/enigma/lib/enigma_signature.php
index ca61fe19e82..639b9d2bf09 100644
--- a/plugins/enigma/lib/enigma_signature.php
+++ b/plugins/enigma/lib/enigma_signature.php
@@ -32,9 +32,9 @@ class enigma_signature
/**
* Find key user id matching the email message sender
*
- * @param enigma_engine $engine Enigma engine
- * @param rcube_message $message Message object
- * @param string $part_id Message part identifier
+ * @param \enigma_engine $engine Enigma engine
+ * @param \rcube_message $message Message object
+ * @param string $part_id Message part identifier
*
* @return string User identifier (name + email)
*/
@@ -63,7 +63,7 @@ public function get_sender($engine, $message, $part_id = null)
}
}
- $from = rcube_mime::decode_address_list($from, 1, true, $charset);
+ $from = \rcube_mime::decode_address_list($from, 1, true, $charset);
$from = (array) $from[1];
if (!empty($from)) {
diff --git a/plugins/enigma/lib/enigma_subkey.php b/plugins/enigma/lib/enigma_subkey.php
index 5303565bc7f..8c0190a1b8d 100644
--- a/plugins/enigma/lib/enigma_subkey.php
+++ b/plugins/enigma/lib/enigma_subkey.php
@@ -35,7 +35,7 @@ class enigma_subkey
public function get_short_id()
{
// E.g. 04622F2089E037A5 => 89E037A5
- return enigma_key::format_id($this->id);
+ return \enigma_key::format_id($this->id);
}
/**
@@ -45,7 +45,7 @@ public function get_short_id()
*/
public function get_fingerprint()
{
- return enigma_key::format_fingerprint($this->fingerprint);
+ return \enigma_key::format_fingerprint($this->fingerprint);
}
/**
@@ -86,7 +86,7 @@ public function get_algorithm()
*/
public function is_expired()
{
- $now = new DateTime('now');
+ $now = new \DateTime('now');
return !empty($this->expires) && $this->expires < $now;
}
@@ -108,7 +108,7 @@ public function get_creation_date($asInt = false)
return (int) $this->created->format('U');
}
- $date_format = rcube::get_instance()->config->get('date_format', 'Y-m-d');
+ $date_format = \rcube::get_instance()->config->get('date_format', 'Y-m-d');
return $this->created->format($date_format);
}
@@ -124,7 +124,7 @@ public function get_expiration_date()
return null;
}
- $date_format = rcube::get_instance()->config->get('date_format', 'Y-m-d');
+ $date_format = \rcube::get_instance()->config->get('date_format', 'Y-m-d');
return $this->expires->format($date_format);
}
diff --git a/plugins/enigma/lib/enigma_ui.php b/plugins/enigma/lib/enigma_ui.php
index c31311b4945..6e312abea4a 100644
--- a/plugins/enigma/lib/enigma_ui.php
+++ b/plugins/enigma/lib/enigma_ui.php
@@ -27,7 +27,7 @@ class enigma_ui
/**
* Object constructor
*
- * @param enigma $enigma_plugin The plugin instance
+ * @param \enigma $enigma_plugin The plugin instance
*/
public function __construct($enigma_plugin)
{
@@ -42,7 +42,7 @@ public function init()
{
$this->add_js();
- $action = rcube_utils::get_input_string('_a', rcube_utils::INPUT_GPC);
+ $action = \rcube_utils::get_input_string('_a', \rcube_utils::INPUT_GPC);
if ($this->rc->action == 'plugin.enigmakeys') {
switch ($action) {
@@ -140,8 +140,8 @@ public function add_js()
/**
* Initializes key password prompt
*
- * @param enigma_error $status Error object with key info
- * @param array $params Optional prompt parameters
+ * @param \enigma_error $status Error object with key info
+ * @param array $params Optional prompt parameters
*/
public function password_prompt($status, $params = [])
{
@@ -205,7 +205,7 @@ public function tpl_keys_list($attrib)
$a_show_cols = ['name'];
// create XHTML table
- $out = rcmail_action::table_output($attrib, [], $a_show_cols, 'id');
+ $out = \rcmail_action::table_output($attrib, [], $a_show_cols, 'id');
// set client env
$this->rc->output->add_gui_object('keyslist', $attrib['id']);
@@ -229,8 +229,8 @@ private function key_list()
$this->enigma->load_engine();
$pagesize = $this->rc->config->get('pagesize', 100);
- $page = max(intval(rcube_utils::get_input_string('_p', rcube_utils::INPUT_GPC)), 1);
- $search = rcube_utils::get_input_string('_q', rcube_utils::INPUT_GPC);
+ $page = max(intval(\rcube_utils::get_input_string('_p', \rcube_utils::INPUT_GPC)), 1);
+ $search = \rcube_utils::get_input_string('_q', \rcube_utils::INPUT_GPC);
// Get the list
$list = $this->enigma->engine->list_keys($search);
@@ -255,7 +255,7 @@ private function key_list()
// Add rows
foreach ($list as $key) {
$this->rc->output->command('enigma_add_list_row', [
- 'name' => rcube::Q($key->name),
+ 'name' => \rcube::Q($key->name),
'id' => $key->id,
'flags' => $key->is_private() ? 'p' : '',
]);
@@ -286,7 +286,7 @@ public function tpl_keys_rowcount($attrib)
$this->rc->output->add_gui_object('countdisplay', $attrib['id']);
- return html::span($attrib, $this->get_rowcount_text());
+ return \html::span($attrib, $this->get_rowcount_text());
}
/**
@@ -316,10 +316,10 @@ private function key_info()
{
$this->enigma->load_engine();
- $id = rcube_utils::get_input_string('_id', rcube_utils::INPUT_GET);
+ $id = \rcube_utils::get_input_string('_id', \rcube_utils::INPUT_GET);
$res = $this->enigma->engine->get_key($id);
- if ($res instanceof enigma_key) {
+ if ($res instanceof \enigma_key) {
$this->data = $res;
} else { // error
$this->rc->output->show_message('enigma.keyopenerror', 'error');
@@ -345,7 +345,7 @@ private function key_info()
*/
public function tpl_key_name($attrib)
{
- return rcube::Q($this->data->name);
+ return \rcube::Q($this->data->name);
}
/**
@@ -358,38 +358,38 @@ public function tpl_key_name($attrib)
public function tpl_key_data($attrib)
{
$out = '';
- $table = new html_table(['cols' => 2]);
+ $table = new \html_table(['cols' => 2]);
// Key user ID
- $table->add('title', html::label(null, $this->enigma->gettext('keyuserid')));
- $table->add(null, rcube::Q($this->data->name));
+ $table->add('title', \html::label(null, $this->enigma->gettext('keyuserid')));
+ $table->add(null, \rcube::Q($this->data->name));
// Key ID
- $table->add('title', html::label(null, $this->enigma->gettext('keyid')));
+ $table->add('title', \html::label(null, $this->enigma->gettext('keyid')));
$table->add(null, $this->data->subkeys[0]->get_short_id());
// Key type
$keytype = $this->data->get_type();
$type = null;
- if ($keytype == enigma_key::TYPE_KEYPAIR) {
+ if ($keytype == \enigma_key::TYPE_KEYPAIR) {
$type = $this->enigma->gettext('typekeypair');
- } elseif ($keytype == enigma_key::TYPE_PUBLIC) {
+ } elseif ($keytype == \enigma_key::TYPE_PUBLIC) {
$type = $this->enigma->gettext('typepublickey');
}
- $table->add('title', html::label(null, $this->enigma->gettext('keytype')));
+ $table->add('title', \html::label(null, $this->enigma->gettext('keytype')));
$table->add(null, $type);
// Key fingerprint
- $table->add('title', html::label(null, $this->enigma->gettext('fingerprint')));
+ $table->add('title', \html::label(null, $this->enigma->gettext('fingerprint')));
$table->add(null, $this->data->subkeys[0]->get_fingerprint());
- $out .= html::tag('fieldset', null,
- html::tag('legend', null, $this->enigma->gettext('basicinfo')) . $table->show($attrib)
+ $out .= \html::tag('fieldset', null,
+ \html::tag('legend', null, $this->enigma->gettext('basicinfo')) . $table->show($attrib)
);
// Subkeys
- $table = new html_table(['cols' => 5, 'id' => 'enigmasubkeytable', 'class' => 'records-table']);
+ $table = new \html_table(['cols' => 5, 'id' => 'enigmasubkeytable', 'class' => 'records-table']);
$table->add_header('id', $this->enigma->gettext('subkeyid'));
$table->add_header('algo', $this->enigma->gettext('subkeyalgo'));
@@ -398,10 +398,10 @@ public function tpl_key_data($attrib)
$table->add_header('usage', $this->enigma->gettext('subkeyusage'));
$usage_map = [
- enigma_key::CAN_ENCRYPT => $this->enigma->gettext('typeencrypt'),
- enigma_key::CAN_SIGN => $this->enigma->gettext('typesign'),
- enigma_key::CAN_CERTIFY => $this->enigma->gettext('typecert'),
- enigma_key::CAN_AUTHENTICATE => $this->enigma->gettext('typeauth'),
+ \enigma_key::CAN_ENCRYPT => $this->enigma->gettext('typeencrypt'),
+ \enigma_key::CAN_SIGN => $this->enigma->gettext('typesign'),
+ \enigma_key::CAN_CERTIFY => $this->enigma->gettext('typecert'),
+ \enigma_key::CAN_AUTHENTICATE => $this->enigma->gettext('typeauth'),
];
foreach ($this->data->subkeys as $subkey) {
@@ -425,19 +425,19 @@ public function tpl_key_data($attrib)
$table->add('usage', implode(',', $usage));
}
- $out .= html::tag('fieldset', null,
- html::tag('legend', null, $this->enigma->gettext('subkeys')) . $table->show()
+ $out .= \html::tag('fieldset', null,
+ \html::tag('legend', null, $this->enigma->gettext('subkeys')) . $table->show()
);
// Additional user IDs
- $table = new html_table(['cols' => 2, 'id' => 'enigmausertable', 'class' => 'records-table']);
+ $table = new \html_table(['cols' => 2, 'id' => 'enigmausertable', 'class' => 'records-table']);
$table->add_header('id', $this->enigma->gettext('userid'));
$table->add_header('valid', $this->enigma->gettext('uservalid'));
foreach ($this->data->users as $user) {
// Display domains in UTF8
- if ($email = rcube_utils::idn_to_utf8($user->email)) {
+ if ($email = \rcube_utils::idn_to_utf8($user->email)) {
$user->email = $email;
}
@@ -448,12 +448,12 @@ public function tpl_key_data($attrib)
$username .= ' <' . $user->email . '>';
$table->set_row_attribs($user->revoked || !$user->valid ? 'deleted' : '');
- $table->add('id', rcube::Q(trim($username)));
+ $table->add('id', \rcube::Q(trim($username)));
$table->add('valid', $this->enigma->gettext($user->valid ? 'valid' : 'unknown'));
}
- $out .= html::tag('fieldset', null,
- html::tag('legend', null, $this->enigma->gettext('userids')) . $table->show()
+ $out .= \html::tag('fieldset', null,
+ \html::tag('legend', null, $this->enigma->gettext('userids')) . $table->show()
);
return $out;
@@ -464,8 +464,8 @@ public function tpl_key_data($attrib)
*/
private function key_export()
{
- $keys = rcube_utils::get_input_string('_keys', rcube_utils::INPUT_POST);
- $priv = rcube_utils::get_input_string('_priv', rcube_utils::INPUT_POST);
+ $keys = \rcube_utils::get_input_string('_keys', \rcube_utils::INPUT_POST);
+ $priv = \rcube_utils::get_input_string('_priv', \rcube_utils::INPUT_POST);
$engine = $this->enigma->load_engine();
$list = $keys == '*' ? $engine->list_keys() : explode(',', $keys);
@@ -480,10 +480,10 @@ private function key_export()
$keyid = is_object($key) ? $key->id : $key;
$status = $engine->export_key($keyid, $fp, (bool) $priv);
- if ($status instanceof enigma_error) {
+ if ($status instanceof \enigma_error) {
$code = $status->getCode();
- if ($code == enigma_error::BADPASS) {
+ if ($code == \enigma_error::BADPASS) {
$this->password_prompt($status, [
'input_keys' => $keys,
'input_priv' => 1,
@@ -520,14 +520,14 @@ private function key_export()
private function key_import()
{
// Import process
- if ($data = rcube_utils::get_input_string('_keys', rcube_utils::INPUT_POST)) {
+ if ($data = \rcube_utils::get_input_string('_keys', \rcube_utils::INPUT_POST)) {
$this->enigma->load_engine();
$this->enigma->engine->password_handler();
$result = $this->enigma->engine->import_key($data);
if (is_array($result)) {
- if (rcube_utils::get_input_value('_generated', rcube_utils::INPUT_POST)) {
+ if (\rcube_utils::get_input_value('_generated', \rcube_utils::INPUT_POST)) {
$this->rc->output->command('enigma_key_create_success');
$this->rc->output->show_message('enigma.keygeneratesuccess', 'confirmation');
} else {
@@ -557,14 +557,14 @@ private function key_import()
['new' => $result['imported'], 'old' => $result['unchanged']]);
$this->rc->output->command('parent.enigma_import_success');
- } elseif ($result instanceof enigma_error && $result->getCode() == enigma_error::BADPASS) {
+ } elseif ($result instanceof \enigma_error && $result->getCode() == \enigma_error::BADPASS) {
$this->password_prompt($result);
} else {
$this->rc->output->show_message('enigma.keysimportfailed', 'error');
}
$this->rc->output->send('iframe');
} elseif (!empty($_FILES['_file']['error'])) {
- rcmail_action::upload_error($_FILES['_file']['error']);
+ \rcmail_action::upload_error($_FILES['_file']['error']);
$this->rc->output->send('iframe');
}
@@ -600,7 +600,7 @@ public function tpl_key_import_form($attrib)
if (empty($attrib['part']) || $attrib['part'] == 'import') {
$title = $this->enigma->gettext('keyimportlabel');
- $upload = new html_inputfield([
+ $upload = new \html_inputfield([
'type' => 'file',
'name' => '_file',
'id' => 'rcmimportfile',
@@ -608,48 +608,48 @@ public function tpl_key_import_form($attrib)
'class' => 'form-control',
]);
- $max_filesize = rcmail_action::upload_init();
- $upload_button = new html_button([
+ $max_filesize = \rcmail_action::upload_init();
+ $upload_button = new \html_button([
'class' => 'button import',
'onclick' => "return rcmail.command('plugin.enigma-import','',this,event)",
]);
- $form = html::div(null, html::p(null, rcube::Q($this->enigma->gettext('keyimporttext'), 'show'))
+ $form = \html::div(null, \html::p(null, \rcube::Q($this->enigma->gettext('keyimporttext'), 'show'))
. $upload->show()
- . html::div('hint', $this->rc->gettext(['id' => 'importfile', 'name' => 'maxuploadsize', 'vars' => ['size' => $max_filesize]]))
- . (empty($attrib['part']) ? html::br() . html::br() . $upload_button->show($this->rc->gettext('import')) : '')
+ . \html::div('hint', $this->rc->gettext(['id' => 'importfile', 'name' => 'maxuploadsize', 'vars' => ['size' => $max_filesize]]))
+ . (empty($attrib['part']) ? \html::br() . \html::br() . $upload_button->show($this->rc->gettext('import')) : '')
);
if (empty($attrib['part'])) {
- $form = html::tag('fieldset', '', html::tag('legend', null, $title) . $form);
+ $form = \html::tag('fieldset', '', \html::tag('legend', null, $title) . $form);
} else {
$this->rc->output->set_pagetitle($title);
}
$warning = $this->enigma->gettext('keystoragenotice');
- $warning = html::div(['class' => 'boxinformation mb-3', 'id' => 'key-notice'], $warning);
+ $warning = \html::div(['class' => 'boxinformation mb-3', 'id' => 'key-notice'], $warning);
$form = $warning . $form;
}
if (empty($attrib['part']) || $attrib['part'] == 'search') {
$title = $this->enigma->gettext('keyimportsearchlabel');
- $search = new html_inputfield(['type' => 'text', 'name' => '_search',
+ $search = new \html_inputfield(['type' => 'text', 'name' => '_search',
'id' => 'rcmimportsearch', 'size' => 30, 'class' => 'form-control']);
- $search_button = new html_button([
+ $search_button = new \html_button([
'class' => 'button search',
'onclick' => "return rcmail.command('plugin.enigma-import-search','',this,event)",
]);
- $form = html::div(null,
- rcube::Q($this->enigma->gettext('keyimportsearchtext'), 'show')
- . html::br() . html::br() . $search->show()
- . (empty($attrib['part']) ? html::br() . html::br() . $search_button->show($this->rc->gettext('search')) : '')
+ $form = \html::div(null,
+ \rcube::Q($this->enigma->gettext('keyimportsearchtext'), 'show')
+ . \html::br() . \html::br() . $search->show()
+ . (empty($attrib['part']) ? \html::br() . \html::br() . $search_button->show($this->rc->gettext('search')) : '')
);
if (empty($attrib['part'])) {
- $form = html::tag('fieldset', '', html::tag('legend', null, $title) . $form);
+ $form = \html::tag('fieldset', '', \html::tag('legend', null, $title) . $form);
} else {
$this->rc->output->set_pagetitle($title);
}
@@ -684,17 +684,17 @@ private function key_generate()
// It is also very slow (which is problematic because it may exceed
// request time limit) and requires entropy generator
// That's why we use only OpenPGP.js method of key generation
- rcmail::raise_error(['code' => 404, 'message' => 'Key generation not implemented'], true, true);
+ \rcmail::raise_error(['code' => 404, 'message' => 'Key generation not implemented'], true, true);
- $user = rcube_utils::get_input_string('_user', rcube_utils::INPUT_POST, true);
- $pass = rcube_utils::get_input_string('_password', rcube_utils::INPUT_POST, true);
- $size = (int) rcube_utils::get_input_value('_size', rcube_utils::INPUT_POST);
+ $user = \rcube_utils::get_input_string('_user', \rcube_utils::INPUT_POST, true);
+ $pass = \rcube_utils::get_input_string('_password', \rcube_utils::INPUT_POST, true);
+ $size = (int) \rcube_utils::get_input_value('_size', \rcube_utils::INPUT_POST);
if ($size > 4096) {
$size = 4096;
}
- $ident = rcube_mime::decode_address_list($user, 1, false);
+ $ident = \rcube_mime::decode_address_list($user, 1, false);
if (empty($ident)) {
$this->rc->output->show_message('enigma.keygenerateerror', 'error');
@@ -709,7 +709,7 @@ private function key_generate()
'size' => $size,
]);
- if ($result instanceof enigma_key) {
+ if ($result instanceof \enigma_key) {
$this->rc->output->command('enigma_key_create_success');
$this->rc->output->show_message('enigma.keygeneratesuccess', 'confirmation');
} else {
@@ -744,11 +744,11 @@ private function key_create()
public function tpl_key_create_form($attrib)
{
$attrib += ['id' => 'rcmKeyCreateForm'];
- $table = new html_table(['cols' => 2]);
+ $table = new \html_table(['cols' => 2]);
// get user's identities
$identities = $this->rc->user->list_identities(null, true);
- $checkbox = new html_checkbox(['name' => 'identity[]']);
+ $checkbox = new \html_checkbox(['name' => 'identity[]']);
$plugin = $this->rc->plugins->exec_hook('enigma_user_identities', ['identities' => $identities]);
$identities = $plugin['identities'];
@@ -757,27 +757,27 @@ public function tpl_key_create_form($attrib)
foreach ($identities as $idx => $ident) {
$name = format_email_recipient($ident['email'], $ident['name']);
$attr = ['value' => $idx, 'data-name' => $ident['name'], 'data-email' => $ident['email_ascii']];
- $identities[$idx] = html::tag('li', null, html::label(null, $checkbox->show($idx, $attr) . rcube::Q($name)));
+ $identities[$idx] = \html::tag('li', null, \html::label(null, $checkbox->show($idx, $attr) . \rcube::Q($name)));
}
- $table->add('title', html::label('key-name', rcube::Q($this->enigma->gettext('newkeyident'))));
- $table->add(null, html::tag('ul', 'proplist', implode("\n", $identities)));
+ $table->add('title', \html::label('key-name', \rcube::Q($this->enigma->gettext('newkeyident'))));
+ $table->add(null, \html::tag('ul', 'proplist', implode("\n", $identities)));
// Key size
- $select = new html_select(['name' => 'type', 'id' => 'key-type', 'class' => 'custom-select']);
+ $select = new \html_select(['name' => 'type', 'id' => 'key-type', 'class' => 'custom-select']);
$select->add($this->enigma->gettext('rsa2048'), 'rsa2048');
$select->add($this->enigma->gettext('rsa4096'), 'rsa4096');
- if ($engine->is_supported(enigma_driver::SUPPORT_ECC)) {
+ if ($engine->is_supported(\enigma_driver::SUPPORT_ECC)) {
$select->add($this->enigma->gettext('ecckeypair'), 'ecc');
}
- $table->add('title', html::label('key-type', rcube::Q($this->enigma->gettext('newkeytype'))));
+ $table->add('title', \html::label('key-type', \rcube::Q($this->enigma->gettext('newkeytype'))));
$table->add(null, $select->show());
// Password and confirm password
- $table->add('title', html::label('key-pass', rcube::Q($this->enigma->gettext('newkeypass'))));
- $table->add(null, rcube_output::get_edit_field('password', '', [
+ $table->add('title', \html::label('key-pass', \rcube::Q($this->enigma->gettext('newkeypass'))));
+ $table->add(null, \rcube_output::get_edit_field('password', '', [
'id' => 'key-pass',
'size' => $attrib['size'] ?? null,
'required' => true,
@@ -786,8 +786,8 @@ public function tpl_key_create_form($attrib)
], 'text')
);
- $table->add('title', html::label('key-pass-confirm', rcube::Q($this->enigma->gettext('newkeypassconfirm'))));
- $table->add(null, rcube_output::get_edit_field('password-confirm', '', [
+ $table->add('title', \html::label('key-pass-confirm', \rcube::Q($this->enigma->gettext('newkeypassconfirm'))));
+ $table->add(null, \rcube_output::get_edit_field('password-confirm', '', [
'id' => 'key-pass-confirm',
'size' => $attrib['size'] ?? null,
'required' => true,
@@ -797,7 +797,7 @@ public function tpl_key_create_form($attrib)
);
$warning = $this->enigma->gettext('keystoragenotice');
- $warning = html::div(['class' => 'boxinformation mb-3', 'id' => 'key-notice'], $warning);
+ $warning = \html::div(['class' => 'boxinformation mb-3', 'id' => 'key-notice'], $warning);
$this->rc->output->add_gui_object('keyform', $attrib['id']);
$this->rc->output->add_label('enigma.keygenerating', 'enigma.formerror',
@@ -812,7 +812,7 @@ public function tpl_key_create_form($attrib)
*/
private function key_delete()
{
- $keys = rcube_utils::get_input_value('_keys', rcube_utils::INPUT_POST);
+ $keys = \rcube_utils::get_input_value('_keys', \rcube_utils::INPUT_POST);
$engine = $this->enigma->load_engine();
foreach ((array) $keys as $key) {
@@ -872,13 +872,13 @@ private function compose_ui()
private function compose_ui_options($wrap = false)
{
$locks = (array) $this->rc->config->get('enigma_options_lock');
- $chbox = new html_checkbox(['value' => 1]);
+ $chbox = new \html_checkbox(['value' => 1]);
- $out = html::div('form-group form-check row',
- html::label(['for' => 'enigmasignopt', 'class' => 'col-form-label col-6'],
- rcube::Q($this->enigma->gettext('signmsg'))
+ $out = \html::div('form-group form-check row',
+ \html::label(['for' => 'enigmasignopt', 'class' => 'col-form-label col-6'],
+ \rcube::Q($this->enigma->gettext('signmsg'))
)
- . html::div('form-check col-6',
+ . \html::div('form-check col-6',
$chbox->show($this->rc->config->get('enigma_sign_all') ? 1 : 0, [
'name' => '_enigma_sign',
'id' => 'enigmasignopt',
@@ -888,11 +888,11 @@ private function compose_ui_options($wrap = false)
)
);
- $out .= html::div('form-group form-check row',
- html::label(['for' => 'enigmaencryptopt', 'class' => 'col-form-label col-6'],
- rcube::Q($this->enigma->gettext('encryptmsg'))
+ $out .= \html::div('form-group form-check row',
+ \html::label(['for' => 'enigmaencryptopt', 'class' => 'col-form-label col-6'],
+ \rcube::Q($this->enigma->gettext('encryptmsg'))
)
- . html::div('form-check col-6',
+ . \html::div('form-check col-6',
$chbox->show($this->rc->config->get('enigma_encrypt_all') ? 1 : 0, [
'name' => '_enigma_encrypt',
'id' => 'enigmaencryptopt',
@@ -902,11 +902,11 @@ private function compose_ui_options($wrap = false)
)
);
- $out .= html::div('form-group form-check row',
- html::label(['for' => 'enigmaattachpubkeyopt', 'class' => 'col-form-label col-6'],
- rcube::Q($this->enigma->gettext('attachpubkeymsg'))
+ $out .= \html::div('form-group form-check row',
+ \html::label(['for' => 'enigmaattachpubkeyopt', 'class' => 'col-form-label col-6'],
+ \rcube::Q($this->enigma->gettext('attachpubkeymsg'))
)
- . html::div('form-check col-6',
+ . \html::div('form-check col-6',
$chbox->show($this->rc->config->get('enigma_attach_pubkey') ? 1 : 0, [
'name' => '_enigma_attachpubkey',
'id' => 'enigmaattachpubkeyopt',
@@ -920,7 +920,7 @@ private function compose_ui_options($wrap = false)
return $out;
}
- return html::div(['id' => 'enigmamenu', 'class' => 'popupmenu'], $out);
+ return \html::div(['id' => 'enigmamenu', 'class' => 'popupmenu'], $out);
}
/**
@@ -936,7 +936,7 @@ private function compose_ui_options($wrap = false)
public function status_message($p)
{
// skip: not a message part
- if ($p['part'] instanceof rcube_message) {
+ if ($p['part'] instanceof \rcube_message) {
return $p;
}
@@ -962,29 +962,29 @@ public function status_message($p)
// display status info
$attrib = ['id' => 'enigma-message'];
- if ($status instanceof enigma_error) {
+ if ($status instanceof \enigma_error) {
$attrib['class'] = 'boxerror enigmaerror encrypted';
$code = $status->getCode();
- if ($code == enigma_error::KEYNOTFOUND) {
- $msg = rcube::Q(str_replace('$keyid', enigma_key::format_id($status->getData('id')),
+ if ($code == \enigma_error::KEYNOTFOUND) {
+ $msg = \rcube::Q(str_replace('$keyid', \enigma_key::format_id($status->getData('id')),
$this->enigma->gettext('decryptnokey')));
- } elseif ($code == enigma_error::BADPASS) {
+ } elseif ($code == \enigma_error::BADPASS) {
$missing = $status->getData('missing');
$label = 'decrypt' . (!empty($missing) ? 'no' : 'bad') . 'pass';
- $msg = rcube::Q($this->enigma->gettext($label));
+ $msg = \rcube::Q($this->enigma->gettext($label));
$this->password_prompt($status);
- } elseif ($code == enigma_error::NOMDC) {
- $msg = rcube::Q($this->enigma->gettext('decryptnomdc'));
+ } elseif ($code == \enigma_error::NOMDC) {
+ $msg = \rcube::Q($this->enigma->gettext('decryptnomdc'));
} else {
- $msg = rcube::Q($this->enigma->gettext('decrypterror'));
+ $msg = \rcube::Q($this->enigma->gettext('decrypterror'));
}
- } elseif ($status === enigma_engine::ENCRYPTED_PARTIALLY) {
+ } elseif ($status === \enigma_engine::ENCRYPTED_PARTIALLY) {
$attrib['class'] = 'boxwarning enigmawarning encrypted';
- $msg = rcube::Q($this->enigma->gettext('decryptpartial'));
+ $msg = \rcube::Q($this->enigma->gettext('decryptpartial'));
} else {
$attrib['class'] = 'boxconfirmation enigmanotice encrypted';
- $msg = rcube::Q($this->enigma->gettext('decryptok'));
+ $msg = \rcube::Q($this->enigma->gettext('decryptok'));
}
$attrib['msg'] = $msg;
@@ -1004,34 +1004,34 @@ public function status_message($p)
// display status info
$attrib = ['id' => 'enigma-message'];
- if ($sig instanceof enigma_signature) {
+ if ($sig instanceof \enigma_signature) {
$sender = $sig->get_sender($engine, $p['message'], $part_id);
- if ($sig->valid === enigma_error::UNVERIFIED) {
+ if ($sig->valid === \enigma_error::UNVERIFIED) {
$attrib['class'] = 'boxwarning enigmawarning signed';
$msg = str_replace('$sender', $sender, $this->enigma->gettext('sigunverified'));
$msg = str_replace('$keyid', $sig->id, $msg);
- $msg = rcube::Q($msg);
+ $msg = \rcube::Q($msg);
} elseif ($sig->valid) {
$attrib['class'] = ($sig->partial ? 'boxwarning enigmawarning' : 'boxconfirmation enigmanotice') . ' signed';
$label = 'sigvalid' . ($sig->partial ? 'partial' : '');
- $msg = rcube::Q(str_replace('$sender', $sender, $this->enigma->gettext($label)));
+ $msg = \rcube::Q(str_replace('$sender', $sender, $this->enigma->gettext($label)));
} else {
$attrib['class'] = 'boxwarning enigmawarning signed';
if ($sender) {
- $msg = rcube::Q(str_replace('$sender', $sender, $this->enigma->gettext('siginvalid')));
+ $msg = \rcube::Q(str_replace('$sender', $sender, $this->enigma->gettext('siginvalid')));
} else {
- $msg = rcube::Q(str_replace('$keyid', enigma_key::format_id($sig->id),
+ $msg = \rcube::Q(str_replace('$keyid', \enigma_key::format_id($sig->id),
$this->enigma->gettext('signokey')));
}
}
- } elseif ($sig->getCode() == enigma_error::KEYNOTFOUND) {
+ } elseif ($sig->getCode() == \enigma_error::KEYNOTFOUND) {
$attrib['class'] = 'boxwarning enigmawarning signed';
- $msg = rcube::Q(str_replace('$keyid', enigma_key::format_id($sig->getData('id')),
+ $msg = \rcube::Q(str_replace('$keyid', \enigma_key::format_id($sig->getData('id')),
$this->enigma->gettext('signokey')));
} else {
$attrib['class'] = 'boxwarning enigmaerror signed';
- $msg = rcube::Q($this->enigma->gettext('sigerror'));
+ $msg = \rcube::Q($this->enigma->gettext('sigerror'));
}
$attrib['msg'] = $msg;
@@ -1041,10 +1041,10 @@ public function status_message($p)
if ($count = count($messages)) {
if ($count == 2 && $messages[0]['class'] == $messages[1]['class']) {
// @phpstan-ignore-next-line
- $p['prefix'] .= html::div($messages[0], $messages[0]['msg'] . ' ' . $messages[1]['msg']);
+ $p['prefix'] .= \html::div($messages[0], $messages[0]['msg'] . ' ' . $messages[1]['msg']);
} else {
foreach ($messages as $msg) {
- $p['prefix'] .= html::div($msg, $msg['msg']);
+ $p['prefix'] .= \html::div($msg, $msg['msg']);
}
}
}
@@ -1104,13 +1104,13 @@ public function message_output($p)
}
// add box above the message body
- $p['content'] = html::p(['class' => 'enigmaattachment boxinformation aligned-buttons'],
- html::span(null, rcube::Q($this->enigma->gettext('keyattfound'))) .
- html::tag('button', [
- 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . ".enigma_import_attachment('" . rcube::JQ($part) . "')",
+ $p['content'] = \html::p(['class' => 'enigmaattachment boxinformation aligned-buttons'],
+ \html::span(null, \rcube::Q($this->enigma->gettext('keyattfound'))) .
+ \html::tag('button', [
+ 'onclick' => 'return ' . \rcmail_output::JS_OBJECT_NAME . ".enigma_import_attachment('" . \rcube::JQ($part) . "')",
'title' => $this->enigma->gettext('keyattimport'),
'class' => 'import btn-sm',
- ], rcube::Q($this->rc->gettext('import'))
+ ], \rcube::Q($this->rc->gettext('import'))
)
) . $p['content'];
@@ -1137,9 +1137,9 @@ public function message_ready($p)
}
$savedraft = !empty($_POST['_draft']) && empty($_GET['_saveonly']);
- $sign_enable = (bool) rcube_utils::get_input_value('_enigma_sign', rcube_utils::INPUT_POST);
- $encrypt_enable = (bool) rcube_utils::get_input_value('_enigma_encrypt', rcube_utils::INPUT_POST);
- $pubkey_enable = (bool) rcube_utils::get_input_value('_enigma_attachpubkey', rcube_utils::INPUT_POST);
+ $sign_enable = (bool) \rcube_utils::get_input_value('_enigma_sign', \rcube_utils::INPUT_POST);
+ $encrypt_enable = (bool) \rcube_utils::get_input_value('_enigma_encrypt', \rcube_utils::INPUT_POST);
+ $pubkey_enable = (bool) \rcube_utils::get_input_value('_enigma_attachpubkey', \rcube_utils::INPUT_POST);
$locks = (array) $this->rc->config->get('enigma_options_lock');
if (in_array('sign', $locks)) {
@@ -1162,27 +1162,27 @@ public function message_ready($p)
if ($encrypt_enable) {
$engine = $this->enigma->load_engine();
- $mode = !$savedraft && $sign_enable ? enigma_engine::ENCRYPT_MODE_SIGN : null;
+ $mode = !$savedraft && $sign_enable ? \enigma_engine::ENCRYPT_MODE_SIGN : null;
$status = $engine->encrypt_message($p['message'], $mode, $savedraft);
$mode = 'encrypt';
} elseif (!$savedraft && $sign_enable) {
$engine = $this->enigma->load_engine();
- $status = $engine->sign_message($p['message'], enigma_engine::SIGN_MODE_MIME);
+ $status = $engine->sign_message($p['message'], \enigma_engine::SIGN_MODE_MIME);
$mode = 'sign';
}
- if ($mode && ($status instanceof enigma_error)) {
+ if ($mode && ($status instanceof \enigma_error)) {
$code = $status->getCode();
$vars = [];
- if ($code == enigma_error::KEYNOTFOUND) {
+ if ($code == \enigma_error::KEYNOTFOUND) {
if ($email = $status->getData('missing')) {
$vars = ['email' => $email];
$msg = 'enigma.' . $mode . 'nokey';
} else {
$msg = 'enigma.' . ($encrypt_enable ? 'encryptnoprivkey' : 'signnokey');
}
- } elseif ($code == enigma_error::BADPASS) {
+ } elseif ($code == \enigma_error::BADPASS) {
$this->password_prompt($status);
} else {
$msg = 'enigma.' . $mode . 'error';
@@ -1227,19 +1227,19 @@ public function message_compose($p)
// Decryption status
foreach ($engine->decryptions as $status) {
- if ($status instanceof enigma_error) {
+ if ($status instanceof \enigma_error) {
$code = $status->getCode();
- if ($code == enigma_error::BADPASS) {
+ if ($code == \enigma_error::BADPASS) {
$this->password_prompt($status, ['compose-init' => true]);
return $p;
}
- if ($code == enigma_error::KEYNOTFOUND) {
- $msg = rcube::Q(str_replace('$keyid', enigma_key::format_id($status->getData('id')),
+ if ($code == \enigma_error::KEYNOTFOUND) {
+ $msg = \rcube::Q(str_replace('$keyid', \enigma_key::format_id($status->getData('id')),
$this->enigma->gettext('decryptnokey')));
} else {
- $msg = rcube::Q($this->enigma->gettext('decrypterror'));
+ $msg = \rcube::Q($this->enigma->gettext('decrypterror'));
}
}
}
@@ -1264,20 +1264,20 @@ public function message_compose($p)
*/
public function import_file()
{
- $uid = rcube_utils::get_input_string('_uid', rcube_utils::INPUT_POST);
- $mbox = rcube_utils::get_input_string('_mbox', rcube_utils::INPUT_POST);
- $mime_id = rcube_utils::get_input_string('_part', rcube_utils::INPUT_POST);
+ $uid = \rcube_utils::get_input_string('_uid', \rcube_utils::INPUT_POST);
+ $mbox = \rcube_utils::get_input_string('_mbox', \rcube_utils::INPUT_POST);
+ $mime_id = \rcube_utils::get_input_string('_part', \rcube_utils::INPUT_POST);
$engine = $this->enigma->load_engine();
if ($uid && $mime_id) {
// Note: we get the attachment body via rcube_message class
// to support keys inside encrypted messages (#5285)
- $message = new rcube_message($uid, $mbox);
+ $message = new \rcube_message($uid, $mbox);
// Check if we don't need to ask for password again
foreach ($engine->decryptions as $status) {
- if ($status instanceof enigma_error) {
- if ($status->getCode() == enigma_error::BADPASS) {
+ if ($status instanceof \enigma_error) {
+ if ($status->getCode() == \enigma_error::BADPASS) {
$this->password_prompt($status, [
'input_uid' => $uid,
'input_mbox' => $mbox,
diff --git a/plugins/example_addressbook/example_addressbook.php b/plugins/example_addressbook/example_addressbook.php
index 7b92e80f458..fdf35aff345 100644
--- a/plugins/example_addressbook/example_addressbook.php
+++ b/plugins/example_addressbook/example_addressbook.php
@@ -9,12 +9,12 @@
* @license GNU GPLv3+
* @author Thomas Bruederli
*/
-class example_addressbook extends rcube_plugin
+class example_addressbook extends \rcube_plugin
{
private $abook_id = 'static';
private $abook_name = 'Static List';
- #[Override]
+ #[\Override]
public function init()
{
$this->add_hook('addressbooks_list', [$this, 'address_sources']);
@@ -22,7 +22,7 @@ public function init()
// use this address book for autocompletion queries
// (maybe this should be configurable by the user?)
- $config = rcmail::get_instance()->config;
+ $config = \rcmail::get_instance()->config;
$sources = (array) $config->get('autocomplete_addressbooks', ['sql']);
if (!in_array($this->abook_id, $sources)) {
$sources[] = $this->abook_id;
@@ -32,7 +32,7 @@ public function init()
public function address_sources($p)
{
- $abook = new example_addressbook_backend($this->abook_name);
+ $abook = new \example_addressbook_backend($this->abook_name);
$p['sources'][$this->abook_id] = [
'id' => $this->abook_id,
@@ -47,7 +47,7 @@ public function address_sources($p)
public function get_address_book($p)
{
if ($p['id'] === $this->abook_id) {
- $p['instance'] = new example_addressbook_backend($this->abook_name);
+ $p['instance'] = new \example_addressbook_backend($this->abook_name);
}
return $p;
diff --git a/plugins/example_addressbook/example_addressbook_backend.php b/plugins/example_addressbook/example_addressbook_backend.php
index a0134481ddb..be836dd5ebf 100644
--- a/plugins/example_addressbook/example_addressbook_backend.php
+++ b/plugins/example_addressbook/example_addressbook_backend.php
@@ -7,7 +7,7 @@
*
* @author Thomas Bruederli
*/
-class example_addressbook_backend extends rcube_addressbook
+class example_addressbook_backend extends \rcube_addressbook
{
public $primary_key = 'ID';
public $readonly = true;
@@ -60,7 +60,7 @@ public function __construct($name)
*
* @return ?array group properties as hash array, null in case of error
*/
- #[Override]
+ #[\Override]
public function get_group($group_id)
{
foreach ($this->db_groups as $group) {
@@ -72,32 +72,32 @@ public function get_group($group_id)
return null;
}
- #[Override]
+ #[\Override]
public function get_name()
{
return $this->name;
}
- #[Override]
+ #[\Override]
public function set_search_set($filter): void
{
$this->filter = $filter;
}
- #[Override]
+ #[\Override]
public function get_search_set()
{
return $this->filter;
}
- #[Override]
+ #[\Override]
public function reset(): void
{
$this->result = null;
$this->filter = null;
}
- #[Override]
+ #[\Override]
public function list_groups($search = null, $mode = 0)
{
if (is_string($search) && strlen($search)) {
@@ -115,7 +115,7 @@ public function list_groups($search = null, $mode = 0)
return $this->db_groups;
}
- #[Override]
+ #[\Override]
public function list_records($cols = null, $subset = 0, $nocount = false)
{
// Note: Paging is not implemented
@@ -123,13 +123,13 @@ public function list_records($cols = null, $subset = 0, $nocount = false)
return $this->result = $this->count();
}
- #[Override]
+ #[\Override]
public function search($fields, $value, $mode = 0, $select = true, $nocount = false, $required = [])
{
// Note: we do not implement all possible search request modes and variants.
// We implement only the simplest searching case in "select" mode
- $result = new rcube_result_set();
+ $result = new \rcube_result_set();
foreach ($this->list_records() as $record) {
if (is_string($value)) {
$found = false;
@@ -151,12 +151,12 @@ public function search($fields, $value, $mode = 0, $select = true, $nocount = fa
return $result;
}
- #[Override]
+ #[\Override]
public function count()
{
// Note: Paging is not implemented
- $result = new rcube_result_set(0, ($this->list_page - 1) * $this->page_size);
+ $result = new \rcube_result_set(0, ($this->list_page - 1) * $this->page_size);
$count = 0;
foreach ($this->db_users as $user) {
@@ -175,16 +175,16 @@ public function count()
return $result;
}
- #[Override]
+ #[\Override]
public function get_result()
{
return $this->result;
}
- #[Override]
+ #[\Override]
public function get_record($id, $assoc = false)
{
- $result = new rcube_result_set(0);
+ $result = new \rcube_result_set(0);
foreach ($this->db_users as $user) {
if ($user['ID'] == $id) {
@@ -207,7 +207,7 @@ public function get_record($id, $assoc = false)
*
* @return array List of assigned groups, indexed by group ID
*/
- #[Override]
+ #[\Override]
public function get_record_groups($id)
{
$result = [];
@@ -228,13 +228,13 @@ public function get_record_groups($id)
/**
* Setter for the current group
*/
- #[Override]
+ #[\Override]
public function set_group($gid)
{
$this->group_id = $gid;
}
- #[Override]
+ #[\Override]
public function create_group($name)
{
$result = false;
@@ -242,25 +242,25 @@ public function create_group($name)
return $result;
}
- #[Override]
+ #[\Override]
public function delete_group($gid)
{
return false;
}
- #[Override]
+ #[\Override]
public function rename_group($gid, $newname, &$newid)
{
return $newname;
}
- #[Override]
+ #[\Override]
public function add_to_group($group_id, $ids)
{
return 0;
}
- #[Override]
+ #[\Override]
public function remove_from_group($group_id, $ids)
{
return 0;
diff --git a/plugins/filesystem_attachments/filesystem_attachments.php b/plugins/filesystem_attachments/filesystem_attachments.php
index 1e62e86fb2c..5afcd7e20d5 100644
--- a/plugins/filesystem_attachments/filesystem_attachments.php
+++ b/plugins/filesystem_attachments/filesystem_attachments.php
@@ -24,19 +24,19 @@
* @author Ziba Scott
* @author Thomas Bruederli
*/
-class filesystem_attachments extends rcube_plugin
+class filesystem_attachments extends \rcube_plugin
{
public $task = '?(?!login).*';
public $initialized = false;
- #[Override]
+ #[\Override]
public function init()
{
// Find filesystem_attachments-based plugins, we can use only one
foreach ($this->api->loaded_plugins() as $plugin_name) {
$plugin = $this->api->get_plugin($plugin_name);
if (($plugin instanceof self) && $plugin->initialized) {
- rcube::raise_error([
+ \rcube::raise_error([
'message' => "Can use only one plugin for attachments/file uploads! Using '{$plugin_name}', ignoring others.",
], true, false);
return;
@@ -74,7 +74,7 @@ public function upload($args)
$group = $args['group'];
// use common temp dir for file uploads
- $tmpfname = rcube_utils::temp_filename('attmnt');
+ $tmpfname = \rcube_utils::temp_filename('attmnt');
if (!empty($args['path']) && move_uploaded_file($args['path'], $tmpfname) && file_exists($tmpfname)) {
$args['id'] = $this->file_id();
@@ -95,7 +95,7 @@ public function save($args)
$args['status'] = false;
if (empty($args['path'])) {
- $tmp_path = rcube_utils::temp_filename('attmnt');
+ $tmp_path = \rcube_utils::temp_filename('attmnt');
if ($fp = fopen($tmp_path, 'w')) {
fwrite($fp, $args['data']);
@@ -152,7 +152,7 @@ public function get($args)
*/
public function cleanup($args)
{
- $rcube = rcube::get_instance();
+ $rcube = \rcube::get_instance();
$group = $args['group'] ?? null;
// @phpstan-ignore-next-line
@@ -167,7 +167,7 @@ public function cleanup($args)
protected static function file_id()
{
- $rcube = rcube::get_instance();
+ $rcube = \rcube::get_instance();
[$usec, $sec] = explode(' ', microtime());
$id = preg_replace('/[^0-9]/', '', $rcube->user->ID . $sec . $usec);
@@ -193,7 +193,7 @@ protected static function verify_path($path)
return false;
}
- $rcmail = rcube::get_instance();
+ $rcmail = \rcube::get_instance();
$temp_dir = $rcmail->config->get('temp_dir');
$file_path = pathinfo($path, \PATHINFO_DIRNAME);
@@ -202,7 +202,7 @@ protected static function verify_path($path)
// tempnam() fallbacks to system temp without a warning.
// We allow that, but we'll let to know the user about the misconfiguration.
if ($file_path == sys_get_temp_dir()) {
- rcube::raise_error([
+ \rcube::raise_error([
'message' => "Detected 'temp_dir' change. "
. "Access to '{$temp_dir}' restricted by filesystem permissions or open_basedir",
], true, false);
@@ -210,7 +210,7 @@ protected static function verify_path($path)
return true;
}
- rcube::raise_error([
+ \rcube::raise_error([
'message' => sprintf("%s can't read %s (not in temp_dir)",
$rcmail->get_user_name(), substr($path, 0, 512)),
], true, false);
diff --git a/plugins/help/help.php b/plugins/help/help.php
index d3d1e5a0a61..a40b1bc8719 100644
--- a/plugins/help/help.php
+++ b/plugins/help/help.php
@@ -10,7 +10,7 @@
* Configuration (see config.inc.php.dist)
*/
-class help extends rcube_plugin
+class help extends \rcube_plugin
{
// all task excluding 'login' and 'logout'
public $task = '?(?!login|logout).*';
@@ -18,7 +18,7 @@ class help extends rcube_plugin
// we've got no ajax handlers
public $noajax = true;
- #[Override]
+ #[\Override]
public function init()
{
$this->load_config();
@@ -38,7 +38,7 @@ public function init()
public function startup($args)
{
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
if (!$rcmail->output->framed) {
// add taskbar button
@@ -62,7 +62,7 @@ public function startup($args)
public function action()
{
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
if ($rcmail->action == 'about') {
$rcmail->output->set_pagetitle($this->gettext('about'));
@@ -84,7 +84,7 @@ public function action()
public function help_content($attrib)
{
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
// $rcmail->output->set_env('content', $content);
if (!empty($_GET['_content'])) {
@@ -98,7 +98,7 @@ public function help_content($attrib)
public function tablink($attrib)
{
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
$attrib['name'] = 'helplink' . $attrib['action'];
$attrib['href'] = $rcmail->url(['_action' => $attrib['action'], '_extwin' => !empty($_REQUEST['_extwin']) ? 1 : null]);
@@ -115,7 +115,7 @@ public function tablink($attrib)
public function help_metadata()
{
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
$content = [];
// About
@@ -155,14 +155,14 @@ public function help_metadata()
public function error_page($args)
{
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
if (
$args['code'] == 403
- && $rcmail->request_status == rcube::REQUEST_ERROR_URL
+ && $rcmail->request_status == \rcube::REQUEST_ERROR_URL
&& ($url = $rcmail->config->get('help_csrf_info'))
) {
- $args['text'] .= '' . html::a(['href' => $url, 'target' => '_blank'], $this->gettext('csrfinfo')) . '
';
+ $args['text'] .= '' . \html::a(['href' => $url, 'target' => '_blank'], $this->gettext('csrfinfo')) . '
';
}
return $args;
@@ -171,7 +171,7 @@ public function error_page($args)
private function resolve_language($path)
{
// resolve language placeholder
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
$langmap = $rcmail->config->get('help_language_map', ['*' => 'en_US']);
$lang = $_SESSION['language'] ?? 'en_US';
$lang = !empty($langmap[$lang]) ? $langmap[$lang] : $langmap['*'];
diff --git a/plugins/hide_blockquote/hide_blockquote.php b/plugins/hide_blockquote/hide_blockquote.php
index ac220ee80a3..3d6789d615c 100644
--- a/plugins/hide_blockquote/hide_blockquote.php
+++ b/plugins/hide_blockquote/hide_blockquote.php
@@ -13,17 +13,17 @@
* @license GNU GPLv3+
* @author Aleksander Machniak
*/
-class hide_blockquote extends rcube_plugin
+class hide_blockquote extends \rcube_plugin
{
public $task = 'mail|settings';
/**
* Plugin initialization
*/
- #[Override]
+ #[\Override]
public function init()
{
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
if ($rcmail->task == 'mail'
&& ($rcmail->action == 'preview' || $rcmail->action == 'show')
@@ -62,10 +62,10 @@ public function prefs_table($args)
$this->add_texts('localization');
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
$limit = (int) $rcmail->config->get('hide_blockquote_limit');
$field_id = 'hide_blockquote_limit';
- $input = new html_inputfield([
+ $input = new \html_inputfield([
'name' => '_' . $field_id,
'id' => $field_id,
'size' => 5,
@@ -73,7 +73,7 @@ public function prefs_table($args)
]);
$args['blocks']['main']['options']['hide_blockquote_limit'] = [
- 'title' => html::label($field_id, $this->gettext('quotelimit')),
+ 'title' => \html::label($field_id, $this->gettext('quotelimit')),
'content' => $input->show($limit ?: ''),
];
@@ -90,7 +90,7 @@ public function prefs_table($args)
public function prefs_save($args)
{
if ($args['section'] == 'mailview') {
- $args['prefs']['hide_blockquote_limit'] = (int) rcube_utils::get_input_value('_hide_blockquote_limit', rcube_utils::INPUT_POST);
+ $args['prefs']['hide_blockquote_limit'] = (int) \rcube_utils::get_input_value('_hide_blockquote_limit', \rcube_utils::INPUT_POST);
}
return $args;
diff --git a/plugins/http_authentication/http_authentication.php b/plugins/http_authentication/http_authentication.php
index d99b0104b1e..e015c607f18 100644
--- a/plugins/http_authentication/http_authentication.php
+++ b/plugins/http_authentication/http_authentication.php
@@ -16,11 +16,11 @@
* @license GNU GPLv3+
* @author Thomas Bruederli
*/
-class http_authentication extends rcube_plugin
+class http_authentication extends \rcube_plugin
{
private $redirect_query;
- #[Override]
+ #[\Override]
public function init()
{
$this->add_hook('startup', [$this, 'startup']);
@@ -32,7 +32,7 @@ public function init()
public function startup($args)
{
if (!empty($_SERVER['PHP_AUTH_USER'])) {
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
$rcmail->add_shutdown_function(['http_authentication', 'shutdown']);
// handle login action
@@ -56,9 +56,9 @@ public function authenticate($args)
// Load plugin's config file
$this->load_config();
- $host = rcmail::get_instance()->config->get('http_authentication_host');
+ $host = \rcmail::get_instance()->config->get('http_authentication_host');
if (is_string($host) && trim($host) !== '' && empty($args['host'])) {
- $args['host'] = rcube_utils::idn_to_ascii(rcube_utils::parse_host($host));
+ $args['host'] = \rcube_utils::idn_to_ascii(\rcube_utils::parse_host($host));
}
// Allow entering other user data in login form,
@@ -84,7 +84,7 @@ public function logout($args)
{
// redirect to configured URL in order to clear HTTP auth credentials
if (!empty($_SERVER['PHP_AUTH_USER']) && $args['user'] == $_SERVER['PHP_AUTH_USER']) {
- if ($url = rcmail::get_instance()->config->get('logout_url')) {
+ if ($url = \rcmail::get_instance()->config->get('logout_url')) {
header("Location: {$url}", true, 307);
exit;
}
@@ -95,7 +95,7 @@ public static function shutdown()
{
// There's no need to store password (even if encrypted) in session
// We'll set it back on startup (#1486553)
- rcmail::get_instance()->session->remove('password');
+ \rcmail::get_instance()->session->remove('password');
}
public function login($args)
diff --git a/plugins/identicon/identicon.php b/plugins/identicon/identicon.php
index 640c15fd678..ff1729f524d 100644
--- a/plugins/identicon/identicon.php
+++ b/plugins/identicon/identicon.php
@@ -17,14 +17,14 @@
*
* @website http://roundcube.net
*/
-class identicon extends rcube_plugin
+class identicon extends \rcube_plugin
{
public $task = 'addressbook';
/**
* Plugin initialization.
*/
- #[Override]
+ #[\Override]
public function init()
{
$this->add_hook('contact_photo', [$this, 'contact_photo']);
@@ -42,14 +42,14 @@ public function contact_photo($args)
return $args;
}
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
// supporting edit/add action may be tricky, let's not do this
if ($rcmail->action == 'show' || $rcmail->action == 'photo') {
$email = !empty($args['email']) ? $args['email'] : null;
if (!$email && $args['record']) {
- $addresses = rcube_addressbook::get_col_values('email', $args['record'], true);
+ $addresses = \rcube_addressbook::get_col_values('email', $args['record'], true);
if (!empty($addresses)) {
$email = $addresses[0];
}
@@ -61,10 +61,10 @@ public function contact_photo($args)
if (!empty($args['attrib']['bg-color'])) {
$bgcolor = $args['attrib']['bg-color'];
} else {
- $bgcolor = rcube_utils::get_input_string('_bgcolor', rcube_utils::INPUT_GET);
+ $bgcolor = \rcube_utils::get_input_string('_bgcolor', \rcube_utils::INPUT_GET);
}
- $identicon = new identicon_engine($email, null, $bgcolor);
+ $identicon = new \identicon_engine($email, null, $bgcolor);
if ($rcmail->action == 'show') {
// set photo URL using data-uri
diff --git a/plugins/identicon/identicon_engine.php b/plugins/identicon/identicon_engine.php
index 3bf15a105dd..988dc6f72bb 100644
--- a/plugins/identicon/identicon_engine.php
+++ b/plugins/identicon/identicon_engine.php
@@ -84,7 +84,7 @@ public function getBinary()
public function sendOutput()
{
if ($this->binary) {
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
$rcmail->output->future_expire_header(10 * 60);
header('Content-Type: ' . $this->mimetype);
@@ -132,7 +132,7 @@ private function generate()
$this->generateGD();
} else {
// log an error
- rcube::raise_error([
+ \rcube::raise_error([
'code' => 500,
'message' => "PHP-GD module not found. It's required by identicon plugin.",
], true, false);
diff --git a/plugins/identity_select/identity_select.php b/plugins/identity_select/identity_select.php
index f4504695881..6ec49aed000 100644
--- a/plugins/identity_select/identity_select.php
+++ b/plugins/identity_select/identity_select.php
@@ -19,11 +19,11 @@
* @author Aleksander Machniak
* @license GNU GPLv3+
*/
-class identity_select extends rcube_plugin
+class identity_select extends \rcube_plugin
{
public $task = 'mail';
- #[Override]
+ #[\Override]
public function init()
{
$this->add_hook('identity_select', [$this, 'select']);
@@ -35,7 +35,7 @@ public function init()
*/
public function storage_init($p)
{
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
if ($add_headers = (array) $rcmail->config->get('identity_select_headers', [])) {
$add_headers = strtoupper(implode(' ', $add_headers));
@@ -59,7 +59,7 @@ public function select($p)
return $p;
}
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
foreach ((array) $rcmail->config->get('identity_select_headers', []) as $header) {
if ($emails = $this->get_email_from_header($p['message'], $header)) {
diff --git a/plugins/jqueryui/jqueryui.php b/plugins/jqueryui/jqueryui.php
index c971bd133f2..0d2b82e6dc6 100644
--- a/plugins/jqueryui/jqueryui.php
+++ b/plugins/jqueryui/jqueryui.php
@@ -12,7 +12,7 @@
* @author Aleksander Machniak
* @license GNU GPLv3+
*/
-class jqueryui extends rcube_plugin
+class jqueryui extends \rcube_plugin
{
public $noajax = true;
public $version = '1.13.2';
@@ -28,10 +28,10 @@ class jqueryui extends rcube_plugin
/**
* Plugin initialization
*/
- #[Override]
+ #[\Override]
public function init()
{
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
// the plugin might have been force-loaded so do some sanity check first
if ($rcmail->output->type != 'html' || self::$ui_theme) {
@@ -110,13 +110,13 @@ public static function miniColors()
self::$features[] = 'miniColors';
- $rcube = rcmail::get_instance();
+ $rcube = \rcmail::get_instance();
$script = 'plugins/jqueryui/js/jquery.minicolors.min.js';
$css = self::$css_path . '/jquery.minicolors.css';
$colors_theme = $rcube->config->get('jquery_ui_colors_theme', 'default');
$config = ['theme' => $colors_theme];
- $config_str = rcube_output::json_serialize($config);
+ $config_str = \rcube_output::json_serialize($config);
$rcube->output->include_css('plugins/jqueryui/' . $css);
$rcube->output->include_script($script, 'head', false);
@@ -136,7 +136,7 @@ public static function tagedit()
self::$features[] = 'tagedit';
$script = 'plugins/jqueryui/js/jquery.tagedit.js';
- $rcube = rcmail::get_instance();
+ $rcube = \rcmail::get_instance();
$css = self::$css_path . '/tagedit.css';
if (!array_key_exists('elastic', (array) $rcube->output->skins)) {
@@ -151,7 +151,7 @@ public static function tagedit()
*/
protected static function asset_exists($path, $minified = true)
{
- $rcube = rcmail::get_instance();
+ $rcube = \rcmail::get_instance();
$path = (strpos($path, 'plugins/') !== false ? '/' : '/plugins/jqueryui/') . $path;
return $rcube->find_asset($path, $minified) !== null;
diff --git a/plugins/krb_authentication/krb_authentication.php b/plugins/krb_authentication/krb_authentication.php
index e31ffb1897e..e130af24a76 100644
--- a/plugins/krb_authentication/krb_authentication.php
+++ b/plugins/krb_authentication/krb_authentication.php
@@ -11,14 +11,14 @@
* @license GNU GPLv3+
* @author Jeroen van Meeuwen
*/
-class krb_authentication extends rcube_plugin
+class krb_authentication extends \rcube_plugin
{
private $redirect_query;
/**
* Plugin initialization
*/
- #[Override]
+ #[\Override]
public function init()
{
$this->add_hook('startup', [$this, 'startup']);
@@ -56,11 +56,11 @@ public function authenticate($args)
// Load plugin's config file
$this->load_config();
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
$host = $rcmail->config->get('krb_authentication_host');
if (is_string($host) && trim($host) !== '' && empty($args['host'])) {
- $args['host'] = rcube_utils::idn_to_ascii(rcube_utils::parse_host($host));
+ $args['host'] = \rcube_utils::idn_to_ascii(\rcube_utils::parse_host($host));
}
if (!empty($_SERVER['REMOTE_USER'])) {
@@ -145,7 +145,7 @@ private function gssapi_context($protocol)
// Load plugin's config file
$this->load_config();
- $rcmail = rcmail::get_instance();
+ $rcmail = \rcmail::get_instance();
$context = $rcmail->config->get('krb_authentication_context');
if (is_array($context) && isset($context[$protocol])) {
@@ -153,7 +153,7 @@ private function gssapi_context($protocol)
}
if (empty($context)) {
- rcube::raise_error("Empty GSSAPI context ({$protocol}).", true);
+ \rcube::raise_error("Empty GSSAPI context ({$protocol}).", true);
}
return $context;
diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve.php b/plugins/managesieve/lib/Roundcube/rcube_sieve.php
index 730b129c82c..b6f39f6e40f 100644
--- a/plugins/managesieve/lib/Roundcube/rcube_sieve.php
+++ b/plugins/managesieve/lib/Roundcube/rcube_sieve.php
@@ -64,7 +64,7 @@ public function __construct($username, $password = '', $host = 'localhost', $por
$auth_cid = null, $auth_pw = null, $options = [], $gssapi_principal = null,
$gssapi_cname = null)
{
- $this->sieve = new Net_Sieve();
+ $this->sieve = new \Net_Sieve();
if ($debug) {
$this->sieve->setDebug(true, [$this, 'debug_handler']);
@@ -403,7 +403,7 @@ public function load_script($script)
private function _parse($txt)
{
// parse
- $script = new rcube_sieve_script($txt, $this->exts);
+ $script = new \rcube_sieve_script($txt, $this->exts);
// fix/convert to Roundcube format
if (!empty($script->content)) {
@@ -482,6 +482,6 @@ private function _set_error($error)
*/
public function debug_handler($sieve, $message)
{
- rcube::write_log('sieve', preg_replace('/\r\n$/', '', $message));
+ \rcube::write_log('sieve', preg_replace('/\r\n$/', '', $message));
}
}
diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
index 31c77d758ba..b9819f8b069 100644
--- a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
+++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
@@ -71,7 +71,7 @@ class rcube_sieve_engine
*/
public function __construct($plugin)
{
- $this->rc = rcube::get_instance();
+ $this->rc = \rcube::get_instance();
$this->plugin = $plugin;
$this->headers = $this->get_default_headers();
}
@@ -110,7 +110,7 @@ public function start($mode = null)
if ($mode != 'vacation' && $mode != 'forward') {
if (!empty($_GET['_set']) || !empty($_POST['_set'])) {
- $script_name = rcube_utils::get_input_string('_set', rcube_utils::INPUT_GPC, true);
+ $script_name = \rcube_utils::get_input_string('_set', \rcube_utils::INPUT_GPC, true);
} elseif (!empty($_SESSION['managesieve_current'])) {
$script_name = $_SESSION['managesieve_current'];
}
@@ -122,8 +122,8 @@ public function start($mode = null)
// finally set script objects
if ($error) {
switch ($error) {
- case rcube_sieve::ERROR_CONNECTION:
- case rcube_sieve::ERROR_LOGIN:
+ case \rcube_sieve::ERROR_CONNECTION:
+ case \rcube_sieve::ERROR_LOGIN:
$this->rc->output->show_message('managesieve.filterconnerror', 'error');
break;
default:
@@ -178,15 +178,15 @@ public function connect($username, $password)
if (array_key_exists($_SESSION['storage_host'], $host)) {
$host = $host[$this->rc->config->mail_domain($_SESSION['storage_host'])];
} else {
- rcube::raise_error([
+ \rcube::raise_error([
'code' => 500,
'message' => "Can't locate the sieve server. Please check the 'managesieve_host' config option.",
], true, false);
- return rcube_sieve::ERROR_CONNECTION;
+ return \rcube_sieve::ERROR_CONNECTION;
}
}
- $host = rcube_utils::parse_host($host);
+ $host = \rcube_utils::parse_host($host);
$plugin = $this->rc->plugins->exec_hook('managesieve_connect', [
'user' => $username,
@@ -202,7 +202,7 @@ public function connect($username, $password)
'gssapi_cn' => null,
]);
- [$host, $scheme, $port] = rcube_utils::parse_host_uri($plugin['host']);
+ [$host, $scheme, $port] = \rcube_utils::parse_host_uri($plugin['host']);
// Support explicit STARTTLS by establishing an unencrypted TCP connection, then instructing Net_Sieve to send the `STARTTLS` command.
$tls = $scheme === 'tls';
@@ -216,13 +216,13 @@ public function connect($username, $password)
$port = getservbyname('sieve', 'tcp') ?: self::PORT;
}
- $host = rcube_utils::idn_to_ascii($host);
+ $host = \rcube_utils::idn_to_ascii($host);
// Handle per-host socket options
- rcube_utils::parse_socket_options($plugin['socket_options'], $host);
+ \rcube_utils::parse_socket_options($plugin['socket_options'], $host);
// try to connect to managesieve server and to fetch the script
- $this->sieve = new rcube_sieve(
+ $this->sieve = new \rcube_sieve(
$plugin['user'],
$plugin['password'],
$host,
@@ -241,7 +241,7 @@ public function connect($username, $password)
$error = $this->sieve->error();
if ($error) {
- rcube::raise_error([
+ \rcube::raise_error([
'code' => 403,
'message' => "Unable to connect to managesieve on {$host}:{$port}",
], true, false);
@@ -276,7 +276,7 @@ protected function load_script($script_name = null)
if ($script_name) {
if ($this->is_protected_script($script_name)) {
- return rcube_sieve::ERROR_NOT_EXISTS;
+ return \rcube_sieve::ERROR_NOT_EXISTS;
}
$this->sieve->load($script_name);
@@ -293,8 +293,8 @@ public function actions()
$error = $this->start();
// Handle user requests
- if ($action = rcube_utils::get_input_string('_act', rcube_utils::INPUT_GPC)) {
- $fid = (int) rcube_utils::get_input_value('_fid', rcube_utils::INPUT_POST);
+ if ($action = \rcube_utils::get_input_string('_act', \rcube_utils::INPUT_GPC)) {
+ $fid = (int) \rcube_utils::get_input_value('_fid', \rcube_utils::INPUT_POST);
if ($action == 'delete' && !$error) {
if (!in_array('delete_filter', $this->disabled_actions)) {
@@ -316,7 +316,7 @@ public function actions()
}
} elseif ($action == 'move' && !$error) {
if (isset($this->script[$fid])) {
- $to = (int) rcube_utils::get_input_value('_to', rcube_utils::INPUT_POST);
+ $to = (int) \rcube_utils::get_input_value('_to', \rcube_utils::INPUT_POST);
$rule = $this->script[$fid];
// remove rule
@@ -379,7 +379,7 @@ public function actions()
}
} elseif ($action == 'setact' && !$error) {
if (!in_array('enable_disable_set', $this->disabled_actions)) {
- $script_name = rcube_utils::get_input_string('_set', rcube_utils::INPUT_POST, true);
+ $script_name = \rcube_utils::get_input_string('_set', \rcube_utils::INPUT_POST, true);
$result = $this->activate_script($script_name);
$kep14 = $this->rc->config->get('managesieve_kolab_master');
@@ -396,7 +396,7 @@ public function actions()
}
} elseif ($action == 'deact' && !$error) {
if (!in_array('enable_disable_set', $this->disabled_actions)) {
- $script_name = rcube_utils::get_input_string('_set', rcube_utils::INPUT_POST, true);
+ $script_name = \rcube_utils::get_input_string('_set', \rcube_utils::INPUT_POST, true);
$result = $this->deactivate_script($script_name);
if ($result === true) {
@@ -412,7 +412,7 @@ public function actions()
}
} elseif ($action == 'setdel' && !$error) {
if (!in_array('delete_set', $this->disabled_actions)) {
- $script_name = rcube_utils::get_input_string('_set', rcube_utils::INPUT_POST, true);
+ $script_name = \rcube_utils::get_input_string('_set', \rcube_utils::INPUT_POST, true);
$result = $this->remove_script($script_name);
if ($result === true) {
@@ -427,9 +427,9 @@ public function actions()
}
} elseif ($action == 'setget') {
if (!in_array('download_set', $this->disabled_actions)) {
- $this->rc->request_security_check(rcube_utils::INPUT_GET);
+ $this->rc->request_security_check(\rcube_utils::INPUT_GET);
- $script_name = rcube_utils::get_input_string('_set', rcube_utils::INPUT_GPC, true);
+ $script_name = \rcube_utils::get_input_string('_set', \rcube_utils::INPUT_GPC, true);
if ($this->is_protected_script($script_name)) {
exit;
@@ -449,19 +449,19 @@ public function actions()
$this->rc->output->command('managesieve_updatelist', 'list', ['list' => $result]);
} elseif ($action == 'ruleadd') {
- $rid = rcube_utils::get_input_string('_rid', rcube_utils::INPUT_POST);
+ $rid = \rcube_utils::get_input_string('_rid', \rcube_utils::INPUT_POST);
$id = $this->genid();
$content = $this->rule_div($fid, $id, false, !empty($_SESSION['managesieve-compact-form']));
$this->rc->output->command('managesieve_rulefill', $content, $id, $rid);
} elseif ($action == 'actionadd') {
- $aid = rcube_utils::get_input_string('_aid', rcube_utils::INPUT_POST);
+ $aid = \rcube_utils::get_input_string('_aid', \rcube_utils::INPUT_POST);
$id = $this->genid();
$content = $this->action_div($fid, $id, false);
$this->rc->output->command('managesieve_actionfill', $content, $id, $aid);
} elseif ($action == 'addresses') {
- $aid = rcube_utils::get_input_string('_aid', rcube_utils::INPUT_POST);
+ $aid = \rcube_utils::get_input_string('_aid', \rcube_utils::INPUT_POST);
$this->rc->output->command('managesieve_vacation_addresses_update', $aid, $this->user_emails());
}
@@ -469,7 +469,7 @@ public function actions()
$this->rc->output->send();
} elseif ($this->rc->task == 'mail') {
// Initialize the form
- $rules = rcube_utils::get_input_value('r', rcube_utils::INPUT_GET);
+ $rules = \rcube_utils::get_input_value('r', \rcube_utils::INPUT_GET);
if (!empty($rules)) {
$tests = [];
foreach ($rules as $rule) {
@@ -502,7 +502,7 @@ public function saveraw()
// Init plugin and handle managesieve connection
$error = $this->start();
- $script_name = rcube_utils::get_input_string('_set', rcube_utils::INPUT_POST);
+ $script_name = \rcube_utils::get_input_string('_set', \rcube_utils::INPUT_POST);
$result = empty($error) && !$this->is_protected_script($script_name)
&& $this->sieve->save_script($script_name, $_POST['rawsetcontent']);
@@ -539,7 +539,7 @@ public function save()
// check request size limit
if ($max_post && count($_POST, \COUNT_RECURSIVE) >= $max_post) {
- rcube::raise_error([
+ \rcube::raise_error([
'code' => 500,
'message' => 'Request size limit exceeded (one of max_input_vars/suhosin.request.max_vars/suhosin.post.max_vars)',
], true, false);
@@ -547,7 +547,7 @@ public function save()
}
// check request depth limits
elseif ($max_depth && count($_POST['_header']) > $max_depth) {
- rcube::raise_error([
+ \rcube::raise_error([
'code' => 500,
'message' => 'Request size limit exceeded (one of suhosin.request.max_array_depth/suhosin.post.max_array_depth)',
], true, false);
@@ -555,9 +555,9 @@ public function save()
}
// filters set add action
elseif (!empty($_POST['_newset'])) {
- $name = rcube_utils::get_input_string('_name', rcube_utils::INPUT_POST, true);
- $copy = rcube_utils::get_input_string('_copy', rcube_utils::INPUT_POST, true);
- $from = rcube_utils::get_input_string('_from', rcube_utils::INPUT_POST);
+ $name = \rcube_utils::get_input_string('_name', \rcube_utils::INPUT_POST, true);
+ $copy = \rcube_utils::get_input_string('_copy', \rcube_utils::INPUT_POST, true);
+ $from = \rcube_utils::get_input_string('_from', \rcube_utils::INPUT_POST);
$exceptions = $this->rc->config->get('managesieve_filename_exceptions');
$kolab = $this->rc->config->get('managesieve_kolab_master');
$name_uc = mb_strtolower($name);
@@ -588,7 +588,7 @@ public function save()
}
} else {
// upload failed
- rcmail_action::upload_error($_FILES['_file']['error']);
+ \rcmail_action::upload_error($_FILES['_file']['error']);
}
} elseif (!$this->sieve->copy($name, $from == 'set' ? $copy : '')) {
$error = 'managesieve.setcreateerror';
@@ -610,69 +610,69 @@ public function save()
}
// filter add/edit action
elseif (isset($_POST['_name'])) {
- $name = trim(rcube_utils::get_input_string('_name', rcube_utils::INPUT_POST, true));
- $fid = trim(rcube_utils::get_input_string('_fid', rcube_utils::INPUT_POST));
- $join = trim(rcube_utils::get_input_string('_join', rcube_utils::INPUT_POST));
+ $name = trim(\rcube_utils::get_input_string('_name', \rcube_utils::INPUT_POST, true));
+ $fid = trim(\rcube_utils::get_input_string('_fid', \rcube_utils::INPUT_POST));
+ $join = trim(\rcube_utils::get_input_string('_join', \rcube_utils::INPUT_POST));
// and arrays
- $headers = rcube_utils::get_input_value('_header', rcube_utils::INPUT_POST);
- $cust_headers = rcube_utils::get_input_value('_custom_header', rcube_utils::INPUT_POST);
- $cust_vars = rcube_utils::get_input_value('_custom_var', rcube_utils::INPUT_POST);
- $ops = rcube_utils::get_input_value('_rule_op', rcube_utils::INPUT_POST);
- $sizeops = rcube_utils::get_input_value('_rule_size_op', rcube_utils::INPUT_POST);
- $sizeitems = rcube_utils::get_input_value('_rule_size_item', rcube_utils::INPUT_POST);
- $sizetargets = rcube_utils::get_input_value('_rule_size_target', rcube_utils::INPUT_POST);
- $spamtestops = rcube_utils::get_input_value('_rule_spamtest_op', rcube_utils::INPUT_POST);
- $spamtesttargets = rcube_utils::get_input_value('_rule_spamtest_target', rcube_utils::INPUT_POST);
- $targets = rcube_utils::get_input_value('_rule_target', rcube_utils::INPUT_POST, true);
- $mods = rcube_utils::get_input_value('_rule_mod', rcube_utils::INPUT_POST);
- $mod_types = rcube_utils::get_input_value('_rule_mod_type', rcube_utils::INPUT_POST);
- $body_trans = rcube_utils::get_input_value('_rule_trans', rcube_utils::INPUT_POST);
- $body_types = rcube_utils::get_input_value('_rule_trans_type', rcube_utils::INPUT_POST, true);
- $comparators = rcube_utils::get_input_value('_rule_comp', rcube_utils::INPUT_POST);
- $indexes = rcube_utils::get_input_value('_rule_index', rcube_utils::INPUT_POST);
- $lastindexes = rcube_utils::get_input_value('_rule_index_last', rcube_utils::INPUT_POST);
- $dateheaders = rcube_utils::get_input_value('_rule_date_header', rcube_utils::INPUT_POST);
- $dateparts = rcube_utils::get_input_value('_rule_date_part', rcube_utils::INPUT_POST);
- $mime_parts = rcube_utils::get_input_value('_rule_mime_part', rcube_utils::INPUT_POST);
- $mime_types = rcube_utils::get_input_value('_rule_mime_type', rcube_utils::INPUT_POST);
- $mime_params = rcube_utils::get_input_value('_rule_mime_param', rcube_utils::INPUT_POST, true);
- $message = rcube_utils::get_input_value('_rule_message', rcube_utils::INPUT_POST);
- $dup_handles = rcube_utils::get_input_value('_rule_duplicate_handle', rcube_utils::INPUT_POST, true);
- $dup_headers = rcube_utils::get_input_value('_rule_duplicate_header', rcube_utils::INPUT_POST, true);
- $dup_uniqueids = rcube_utils::get_input_value('_rule_duplicate_uniqueid', rcube_utils::INPUT_POST, true);
- $dup_seconds = rcube_utils::get_input_value('_rule_duplicate_seconds', rcube_utils::INPUT_POST);
- $dup_lasts = rcube_utils::get_input_value('_rule_duplicate_last', rcube_utils::INPUT_POST);
- $act_types = rcube_utils::get_input_value('_action_type', rcube_utils::INPUT_POST, true);
- $mailboxes = rcube_utils::get_input_value('_action_mailbox', rcube_utils::INPUT_POST, true);
- $act_targets = rcube_utils::get_input_value('_action_target', rcube_utils::INPUT_POST, true);
- $domain_targets = rcube_utils::get_input_value('_action_target_domain', rcube_utils::INPUT_POST);
- $area_targets = rcube_utils::get_input_value('_action_target_area', rcube_utils::INPUT_POST, true);
- $reasons = rcube_utils::get_input_value('_action_reason', rcube_utils::INPUT_POST, true);
- $addresses = rcube_utils::get_input_value('_action_addresses', rcube_utils::INPUT_POST, true);
- $intervals = rcube_utils::get_input_value('_action_interval', rcube_utils::INPUT_POST);
- $interval_types = rcube_utils::get_input_value('_action_interval_type', rcube_utils::INPUT_POST);
- $from = rcube_utils::get_input_value('_action_from', rcube_utils::INPUT_POST, true);
- $subject = rcube_utils::get_input_value('_action_subject', rcube_utils::INPUT_POST, true);
- $flags = rcube_utils::get_input_value('_action_flags', rcube_utils::INPUT_POST);
- $varnames = rcube_utils::get_input_value('_action_varname', rcube_utils::INPUT_POST);
- $varvalues = rcube_utils::get_input_value('_action_varvalue', rcube_utils::INPUT_POST);
- $varmods = rcube_utils::get_input_value('_action_varmods', rcube_utils::INPUT_POST);
- $notifymethods = rcube_utils::get_input_value('_action_notifymethod', rcube_utils::INPUT_POST);
- $notifytargets = rcube_utils::get_input_value('_action_notifytarget', rcube_utils::INPUT_POST, true);
- $notifyoptions = rcube_utils::get_input_value('_action_notifyoption', rcube_utils::INPUT_POST, true);
- $notifymessages = rcube_utils::get_input_value('_action_notifymessage', rcube_utils::INPUT_POST, true);
- $notifyfrom = rcube_utils::get_input_value('_action_notifyfrom', rcube_utils::INPUT_POST, true);
- $notifyimp = rcube_utils::get_input_value('_action_notifyimportance', rcube_utils::INPUT_POST);
- $addheader_name = rcube_utils::get_input_value('_action_addheader_name', rcube_utils::INPUT_POST);
- $addheader_value = rcube_utils::get_input_value('_action_addheader_value', rcube_utils::INPUT_POST, true);
- $addheader_pos = rcube_utils::get_input_value('_action_addheader_pos', rcube_utils::INPUT_POST);
- $delheader_name = rcube_utils::get_input_value('_action_delheader_name', rcube_utils::INPUT_POST);
- $delheader_value = rcube_utils::get_input_value('_action_delheader_value', rcube_utils::INPUT_POST, true);
- $delheader_pos = rcube_utils::get_input_value('_action_delheader_pos', rcube_utils::INPUT_POST);
- $delheader_index = rcube_utils::get_input_value('_action_delheader_index', rcube_utils::INPUT_POST);
- $delheader_op = rcube_utils::get_input_value('_action_delheader_op', rcube_utils::INPUT_POST);
- $delheader_comp = rcube_utils::get_input_value('_action_delheader_comp', rcube_utils::INPUT_POST);
+ $headers = \rcube_utils::get_input_value('_header', \rcube_utils::INPUT_POST);
+ $cust_headers = \rcube_utils::get_input_value('_custom_header', \rcube_utils::INPUT_POST);
+ $cust_vars = \rcube_utils::get_input_value('_custom_var', \rcube_utils::INPUT_POST);
+ $ops = \rcube_utils::get_input_value('_rule_op', \rcube_utils::INPUT_POST);
+ $sizeops = \rcube_utils::get_input_value('_rule_size_op', \rcube_utils::INPUT_POST);
+ $sizeitems = \rcube_utils::get_input_value('_rule_size_item', \rcube_utils::INPUT_POST);
+ $sizetargets = \rcube_utils::get_input_value('_rule_size_target', \rcube_utils::INPUT_POST);
+ $spamtestops = \rcube_utils::get_input_value('_rule_spamtest_op', \rcube_utils::INPUT_POST);
+ $spamtesttargets = \rcube_utils::get_input_value('_rule_spamtest_target', \rcube_utils::INPUT_POST);
+ $targets = \rcube_utils::get_input_value('_rule_target', \rcube_utils::INPUT_POST, true);
+ $mods = \rcube_utils::get_input_value('_rule_mod', \rcube_utils::INPUT_POST);
+ $mod_types = \rcube_utils::get_input_value('_rule_mod_type', \rcube_utils::INPUT_POST);
+ $body_trans = \rcube_utils::get_input_value('_rule_trans', \rcube_utils::INPUT_POST);
+ $body_types = \rcube_utils::get_input_value('_rule_trans_type', \rcube_utils::INPUT_POST, true);
+ $comparators = \rcube_utils::get_input_value('_rule_comp', \rcube_utils::INPUT_POST);
+ $indexes = \rcube_utils::get_input_value('_rule_index', \rcube_utils::INPUT_POST);
+ $lastindexes = \rcube_utils::get_input_value('_rule_index_last', \rcube_utils::INPUT_POST);
+ $dateheaders = \rcube_utils::get_input_value('_rule_date_header', \rcube_utils::INPUT_POST);
+ $dateparts = \rcube_utils::get_input_value('_rule_date_part', \rcube_utils::INPUT_POST);
+ $mime_parts = \rcube_utils::get_input_value('_rule_mime_part', \rcube_utils::INPUT_POST);
+ $mime_types = \rcube_utils::get_input_value('_rule_mime_type', \rcube_utils::INPUT_POST);
+ $mime_params = \rcube_utils::get_input_value('_rule_mime_param', \rcube_utils::INPUT_POST, true);
+ $message = \rcube_utils::get_input_value('_rule_message', \rcube_utils::INPUT_POST);
+ $dup_handles = \rcube_utils::get_input_value('_rule_duplicate_handle', \rcube_utils::INPUT_POST, true);
+ $dup_headers = \rcube_utils::get_input_value('_rule_duplicate_header', \rcube_utils::INPUT_POST, true);
+ $dup_uniqueids = \rcube_utils::get_input_value('_rule_duplicate_uniqueid', \rcube_utils::INPUT_POST, true);
+ $dup_seconds = \rcube_utils::get_input_value('_rule_duplicate_seconds', \rcube_utils::INPUT_POST);
+ $dup_lasts = \rcube_utils::get_input_value('_rule_duplicate_last', \rcube_utils::INPUT_POST);
+ $act_types = \rcube_utils::get_input_value('_action_type', \rcube_utils::INPUT_POST, true);
+ $mailboxes = \rcube_utils::get_input_value('_action_mailbox', \rcube_utils::INPUT_POST, true);
+ $act_targets = \rcube_utils::get_input_value('_action_target', \rcube_utils::INPUT_POST, true);
+ $domain_targets = \rcube_utils::get_input_value('_action_target_domain', \rcube_utils::INPUT_POST);
+ $area_targets = \rcube_utils::get_input_value('_action_target_area', \rcube_utils::INPUT_POST, true);
+ $reasons = \rcube_utils::get_input_value('_action_reason', \rcube_utils::INPUT_POST, true);
+ $addresses = \rcube_utils::get_input_value('_action_addresses', \rcube_utils::INPUT_POST, true);
+ $intervals = \rcube_utils::get_input_value('_action_interval', \rcube_utils::INPUT_POST);
+ $interval_types = \rcube_utils::get_input_value('_action_interval_type', \rcube_utils::INPUT_POST);
+ $from = \rcube_utils::get_input_value('_action_from', \rcube_utils::INPUT_POST, true);
+ $subject = \rcube_utils::get_input_value('_action_subject', \rcube_utils::INPUT_POST, true);
+ $flags = \rcube_utils::get_input_value('_action_flags', \rcube_utils::INPUT_POST);
+ $varnames = \rcube_utils::get_input_value('_action_varname', \rcube_utils::INPUT_POST);
+ $varvalues = \rcube_utils::get_input_value('_action_varvalue', \rcube_utils::INPUT_POST);
+ $varmods = \rcube_utils::get_input_value('_action_varmods', \rcube_utils::INPUT_POST);
+ $notifymethods = \rcube_utils::get_input_value('_action_notifymethod', \rcube_utils::INPUT_POST);
+ $notifytargets = \rcube_utils::get_input_value('_action_notifytarget', \rcube_utils::INPUT_POST, true);
+ $notifyoptions = \rcube_utils::get_input_value('_action_notifyoption', \rcube_utils::INPUT_POST, true);
+ $notifymessages = \rcube_utils::get_input_value('_action_notifymessage', \rcube_utils::INPUT_POST, true);
+ $notifyfrom = \rcube_utils::get_input_value('_action_notifyfrom', \rcube_utils::INPUT_POST, true);
+ $notifyimp = \rcube_utils::get_input_value('_action_notifyimportance', \rcube_utils::INPUT_POST);
+ $addheader_name = \rcube_utils::get_input_value('_action_addheader_name', \rcube_utils::INPUT_POST);
+ $addheader_value = \rcube_utils::get_input_value('_action_addheader_value', \rcube_utils::INPUT_POST, true);
+ $addheader_pos = \rcube_utils::get_input_value('_action_addheader_pos', \rcube_utils::INPUT_POST);
+ $delheader_name = \rcube_utils::get_input_value('_action_delheader_name', \rcube_utils::INPUT_POST);
+ $delheader_value = \rcube_utils::get_input_value('_action_delheader_value', \rcube_utils::INPUT_POST, true);
+ $delheader_pos = \rcube_utils::get_input_value('_action_delheader_pos', \rcube_utils::INPUT_POST);
+ $delheader_index = \rcube_utils::get_input_value('_action_delheader_index', \rcube_utils::INPUT_POST);
+ $delheader_op = \rcube_utils::get_input_value('_action_delheader_op', \rcube_utils::INPUT_POST);
+ $delheader_comp = \rcube_utils::get_input_value('_action_delheader_comp', \rcube_utils::INPUT_POST);
$this->form['disabled'] = empty($_POST['_enabled']);
$this->form['join'] = $join == 'allof';
@@ -1052,7 +1052,7 @@ public function save()
if ($target === '') {
$this->errors['actions'][$i]['target'] = $this->plugin->gettext('cannotbeempty');
- } elseif (!rcube_utils::check_email($target)) {
+ } elseif (!\rcube_utils::check_email($target)) {
$this->errors['actions'][$i]['target'] = $this->plugin->gettext(!empty($domains) ? 'forbiddenchars' : 'noemailwarning');
}
@@ -1126,7 +1126,7 @@ public function save()
if (empty($address)) {
unset($this->form['actions'][$i]['addresses'][$aidx]);
- } elseif (!rcube_utils::check_email($address)) {
+ } elseif (!\rcube_utils::check_email($address)) {
$this->errors['actions'][$i]['addresses'] = $this->plugin->gettext('noemailwarning');
break;
}
@@ -1266,7 +1266,7 @@ public function filters_list($attrib)
$result = $this->list_rules();
// create the table
- $out = rcmail_action::table_output($attrib, $result, $a_show_cols, 'id');
+ $out = \rcmail_action::table_output($attrib, $result, $a_show_cols, 'id');
// set client env
$this->rc->output->add_gui_object('filterslist', $attrib['id']);
@@ -1317,7 +1317,7 @@ public function filtersets_list($attrib, $no_env = false)
$this->rc->output->set_env('filtersets', $scripts);
$this->rc->output->include_script('list.js');
} else {
- $select = new html_select([
+ $select = new \html_select([
'name' => '_set',
'id' => $attrib['id'],
'class' => 'custom-select',
@@ -1344,12 +1344,12 @@ public function filtersets_list($attrib, $no_env = false)
public function filterset_editraw($attrib)
{
- $script_name = rcube_utils::get_input_string('_set', rcube_utils::INPUT_GP);
+ $script_name = \rcube_utils::get_input_string('_set', \rcube_utils::INPUT_GP);
$script = $this->sieve->get_script($script_name);
$script_post = !empty($_POST['rawsetcontent']) ? $_POST['rawsetcontent'] : null;
$framed = !empty($_POST['_framed']) || !empty($_GET['_framed']);
- $hiddenfields = new html_hiddenfield();
+ $hiddenfields = new \html_hiddenfield();
$hiddenfields->add(['name' => '_task', 'value' => $this->rc->task]);
$hiddenfields->add(['name' => '_action', 'value' => 'plugin.managesieve-saveraw']);
$hiddenfields->add(['name' => '_set', 'value' => $script_name]);
@@ -1358,7 +1358,7 @@ public function filterset_editraw($attrib)
$out = $hiddenfields->show();
- $txtarea = new html_textarea([
+ $txtarea = new \html_textarea([
'id' => 'rawfiltersettxt',
'name' => 'rawsetcontent',
'class' => 'form-control',
@@ -1377,7 +1377,7 @@ public function filterset_editraw($attrib)
$this->rc->output->show_message('managesieve.filterunknownerror', 'error');
}
- $out = html::tag('form', $attrib + [
+ $out = \html::tag('form', $attrib + [
'id' => 'filtersetrawform',
'name' => 'filtersetrawform',
'action' => './',
@@ -1396,39 +1396,39 @@ public function filterset_form($attrib)
}
$framed = !empty($_POST['_framed']) || !empty($_GET['_framed']);
- $table = new html_table(['cols' => 2, 'class' => 'propform']);
- $hiddenfields = new html_hiddenfield(['name' => '_task', 'value' => $this->rc->task]);
+ $table = new \html_table(['cols' => 2, 'class' => 'propform']);
+ $hiddenfields = new \html_hiddenfield(['name' => '_task', 'value' => $this->rc->task]);
$hiddenfields->add(['name' => '_action', 'value' => 'plugin.managesieve-save']);
$hiddenfields->add(['name' => '_framed', 'value' => $framed ? 1 : 0]);
$hiddenfields->add(['name' => '_newset', 'value' => 1]);
- $name = rcube_utils::get_input_string('_name', rcube_utils::INPUT_POST);
- $copy = rcube_utils::get_input_string('_copy', rcube_utils::INPUT_POST);
- $selected = rcube_utils::get_input_string('_from', rcube_utils::INPUT_POST);
+ $name = \rcube_utils::get_input_string('_name', \rcube_utils::INPUT_POST);
+ $copy = \rcube_utils::get_input_string('_copy', \rcube_utils::INPUT_POST);
+ $selected = \rcube_utils::get_input_string('_from', \rcube_utils::INPUT_POST);
// filter set name input
- $input_name = new html_inputfield([
+ $input_name = new \html_inputfield([
'name' => '_name',
'id' => '_name',
'size' => 30,
'class' => !empty($this->errors['name']) ? 'error form-control' : 'form-control',
]);
- $table->add('title', html::label('_name', rcube::Q($this->plugin->gettext('filtersetname'))));
+ $table->add('title', \html::label('_name', \rcube::Q($this->plugin->gettext('filtersetname'))));
$table->add(null, $input_name->show($name));
$filters = '';
- $filters .= '- ' . html::label('from_none', html::tag('input', [
+ $filters .= '
- ' . \html::label('from_none', \html::tag('input', [
'type' => 'radio',
'id' => 'from_none',
'name' => '_from',
'value' => 'none',
'checked' => !$selected || $selected == 'none',
- ]) . rcube::Q($this->plugin->gettext('none'))) . '
';
+ ]) . \rcube::Q($this->plugin->gettext('none'))) . '';
// filters set list
$list = $this->list_scripts();
- $select = new html_select(['name' => '_copy', 'id' => '_copy', 'class' => 'custom-select']);
+ $select = new \html_select(['name' => '_copy', 'id' => '_copy', 'class' => 'custom-select']);
if (is_array($list)) {
asort($list, \SORT_LOCALE_STRING);
@@ -1441,17 +1441,17 @@ public function filterset_form($attrib)
$select->add($set, $set);
}
- $filters .= '- ' . html::label('from_set', html::tag('input', [
+ $filters .= '
- ' . \html::label('from_set', \html::tag('input', [
'type' => 'radio',
'id' => 'from_set',
'name' => '_from',
'value' => 'set',
'checked' => $selected == 'set',
- ]) . rcube::Q($this->plugin->gettext('fromset')) . ' ' . $select->show($copy)) . '
';
+ ]) . \rcube::Q($this->plugin->gettext('fromset')) . ' ' . $select->show($copy)) . '';
}
// script upload box
- $upload = new html_inputfield([
+ $upload = new \html_inputfield([
'name' => '_file',
'id' => '_file',
'size' => 30,
@@ -1459,17 +1459,17 @@ public function filterset_form($attrib)
'class' => !empty($this->errors['file']) ? 'error form-control' : 'form-control',
]);
- $filters .= '- ' . html::label('from_file', html::tag('input', [
+ $filters .= '
- ' . \html::label('from_file', \html::tag('input', [
'type' => 'radio',
'id' => 'from_file',
'name' => '_from',
'value' => 'file',
'checked' => $selected == 'file',
- ]) . rcube::Q($this->plugin->gettext('fromfile')) . ' ' . $upload->show()) . '
';
+ ]) . \rcube::Q($this->plugin->gettext('fromfile')) . ' ' . $upload->show()) . '';
$filters .= '
';
- $table->add('title', html::label('from_none', rcube::Q($this->plugin->gettext('filters'))));
+ $table->add('title', \html::label('from_none', \rcube::Q($this->plugin->gettext('filters'))));
$table->add('', $filters);
$out = '