Please try to initialize the database manually as described in the INSTALL guide.
Make sure that the configured database exists and that the user as write privileges
';
@@ -192,8 +182,7 @@
. '';
$db_working = false;
- }
- else {
+ } else {
$RCI->pass('DB Schema');
echo ' ';
}
@@ -215,8 +204,7 @@
$RCI->pass('DB Write');
$DB->query('DELETE FROM ' . $DB->quote_identifier($RCI->config['db_prefix'] . 'session')
. ' WHERE `sess_id` = ?', $insert_id);
- }
- else {
+ } else {
$RCI->fail('DB Write', $RCI->get_error());
}
echo ' ';
@@ -237,8 +225,7 @@
// sometimes db and web servers are on separate hosts, so allow a 30 minutes delta
if (abs($tz_diff) > 1800) {
$RCI->fail('DB Time', "Database time differs {$tz_diff}s from PHP time");
- }
- else {
+ } else {
$RCI->pass('DB Time');
}
}
@@ -253,13 +240,11 @@
$RCI->fail('Fileinfo/mime_content_type configuration');
if (!empty($RCI->config['mime_magic'])) {
echo '
Try setting the mime_magic config option to null.
';
- }
- else {
+ } else {
echo '
Check the Fileinfo functions of your PHP installation. ';
echo 'The path to the magic.mime file can be set using the mime_magic config option in Roundcube.
Please set a valid path to your webserver\'s mime.types file to the mime_types config option. ';
echo 'If you can\'t find such a file, download it from svn.apache.org.
';
-}
-else {
+} else {
$RCI->pass('Mimetype to file extension mapping');
echo ' ';
}
@@ -279,8 +263,7 @@
if (!empty($smtp_hosts)) {
$smtp_host_field = new html_select(['name' => '_smtp_host', 'id' => 'smtp_host']);
$smtp_host_field->add($smtp_hosts, $smtp_hosts);
-}
-else {
+} else {
$smtp_host_field = new html_inputfield(['name' => '_smtp_host', 'id' => 'smtp_host']);
}
@@ -290,15 +273,13 @@
if ($user == '%u') {
$user_field = new html_inputfield(['name' => '_smtp_user', 'id' => 'smtp_user']);
$user = $user_field->show(isset($_POST['_smtp_user']) ? $_POST['_smtp_user'] : '');
-}
-else {
+} else {
$user = html::quote($user);
}
if ($pass == '%p') {
$pass_field = new html_passwordfield(['name' => '_smtp_pass', 'id' => 'smtp_pass']);
$pass = $pass_field->show();
-}
-else {
+} else {
$pass = html::quote($pass);
}
@@ -375,12 +356,10 @@
if ($status) {
$RCI->pass('SMTP send');
- }
- else {
+ } else {
$RCI->fail('SMTP send', implode('; ', $smtp_response));
}
- }
- else {
+ } else {
$RCI->fail('SMTP send', 'Invalid sender or recipient');
}
@@ -416,8 +395,7 @@
if (!empty($default_hosts)) {
$host_field = new html_select(['name' => '_host', 'id' => 'imaphost']);
$host_field->add($default_hosts, $default_hosts);
-}
-else {
+} else {
$host_field = new html_inputfield(['name' => '_host', 'id' => 'imaphost']);
}
@@ -463,7 +441,7 @@
$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'),
@@ -473,8 +451,7 @@
if ($imap->connect($imap_host, $imap_user, $_POST['_pass'], $imap_port, $imap_ssl)) {
$RCI->pass('IMAP connect', 'SORT capability: ' . ($imap->get_capability('SORT') ? 'yes' : 'no'));
$imap->close();
- }
- else {
+ } else {
$RCI->fail('IMAP connect', $RCI->get_error());
}
}
diff --git a/plugins/acl/acl.php b/plugins/acl/acl.php
index b3ac02d5e3..6542ba1bad 100644
--- a/plugins/acl/acl.php
+++ b/plugins/acl/acl.php
@@ -34,7 +34,7 @@ class acl extends rcube_plugin
/**
* Plugin initialization
*/
- function init()
+ public function init()
{
$this->rc = rcmail::get_instance();
@@ -49,7 +49,7 @@ function init()
/**
* Handler for plugin actions (AJAX)
*/
- function acl_actions()
+ public function acl_actions()
{
$action = trim(rcube_utils::get_input_string('_act', rcube_utils::INPUT_GPC));
@@ -62,11 +62,9 @@ function acl_actions()
if ($action == 'save') {
$this->action_save();
- }
- elseif ($action == 'delete') {
+ } elseif ($action == 'delete') {
$this->action_delete();
- }
- elseif ($action == 'list') {
+ } elseif ($action == 'list') {
$this->action_list();
}
@@ -77,7 +75,7 @@ function acl_actions()
/**
* Handler for user login autocomplete request
*/
- function acl_autocomplete()
+ public function acl_autocomplete()
{
$this->load_config();
@@ -147,7 +145,7 @@ function acl_autocomplete()
*
* @return array Hook arguments array
*/
- function folder_form($args)
+ public function folder_form($args)
{
$mbox_imap = $args['options']['name'] ?? '';
$myrights = $args['options']['rights'] ?? '';
@@ -201,9 +199,9 @@ function folder_form($args)
$this->rc->output->set_env('acl_users_source', (bool) $this->rc->config->get('acl_users_source'));
$this->rc->output->set_env('mailbox', $mbox_imap);
$this->rc->output->add_handlers([
- 'acltable' => [$this, 'templ_table'],
- 'acluser' => [$this, 'templ_user'],
- 'aclrights' => [$this, 'templ_rights'],
+ 'acltable' => [$this, 'templ_table'],
+ 'acluser' => [$this, 'templ_user'],
+ 'aclrights' => [$this, 'templ_rights'],
]);
$this->rc->output->set_env('autocomplete_max', (int) $this->rc->config->get('autocomplete_max', 15));
@@ -225,7 +223,7 @@ function folder_form($args)
*
* @return string HTML Content
*/
- function templ_table($attrib)
+ public function templ_table($attrib)
{
if (empty($attrib['id'])) {
$attrib['id'] = 'acl-table';
@@ -245,7 +243,7 @@ function templ_table($attrib)
*
* @return string HTML Content
*/
- function templ_rights($attrib)
+ public function templ_rights($attrib)
{
// Get supported rights
$supported = $this->rights_supported();
@@ -314,7 +312,7 @@ function templ_rights($attrib)
*
* @return string HTML Content
*/
- function templ_user($attrib)
+ public function templ_user($attrib)
{
// Create username input
$class = !empty($attrib['class']) ? $attrib['class'] : '';
@@ -409,8 +407,7 @@ private function list_rights($attrib = [])
foreach ($supported as $sup) {
$items[$sup] = $sup;
}
- }
- else {
+ } else {
$items = [
'read' => 'lrs',
'write' => 'wi',
@@ -450,8 +447,7 @@ private function list_rights($attrib = [])
if (!empty($this->specials) && in_array($user, $this->specials)) {
$username = $this->gettext($user);
- }
- else {
+ } else {
$username = $this->resolve_acl_identifier($user, $title);
}
@@ -509,11 +505,9 @@ private function action_save()
if ($prefix && strpos($user, $prefix) === 0) {
$username = $user;
- }
- elseif (!empty($this->specials) && in_array($user, $this->specials)) {
+ } elseif (!empty($this->specials) && in_array($user, $this->specials)) {
$username = $this->gettext($user);
- }
- elseif (!empty($user)) {
+ } elseif (!empty($user)) {
if (!strpos($user, '@') && ($realm = $this->get_realm())) {
$user .= '@' . rcube_utils::idn_to_ascii(preg_replace('/^@/', '', $realm));
}
@@ -538,12 +532,12 @@ 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),
- 'username' => $username,
- 'title' => $title,
- 'display' => $display,
- 'acl' => implode('', $acl),
- 'old' => $oldid,
+ 'id' => rcube_utils::html_identifier($user),
+ 'username' => $username,
+ 'title' => $title,
+ 'display' => $display,
+ 'acl' => implode('', $acl),
+ 'old' => $oldid,
]);
$result++;
}
@@ -552,8 +546,7 @@ private function action_save()
if ($result) {
$this->rc->output->show_message($oldid ? 'acl.updatesuccess' : 'acl.createsuccess', 'confirmation');
- }
- else {
+ } else {
$this->rc->output->show_message($oldid ? 'acl.updateerror' : 'acl.createerror', 'error');
}
}
@@ -572,16 +565,14 @@ private function action_delete()
$u = trim($u);
if ($this->rc->storage->delete_acl($mbox, $u)) {
$this->rc->output->command('acl_remove_row', rcube_utils::html_identifier($u));
- }
- else {
+ } else {
$error = true;
}
}
if (empty($error)) {
$this->rc->output->show_message('acl.deletesuccess', 'confirmation');
- }
- else {
+ } else {
$this->rc->output->show_message('acl.deleteerror', 'error');
}
}
@@ -616,7 +607,7 @@ private function action_list()
*
* @return string HTML content
*/
- function acl2text($rights)
+ public function acl2text($rights)
{
if (empty($rights)) {
return '';
@@ -650,7 +641,7 @@ function acl2text($rights)
*
* @return int Comparison result, 2 - full match, 1 - partial match, 0 - no match
*/
- function acl_compare($acl1, $acl2)
+ public function acl_compare($acl1, $acl2)
{
if (!is_array($acl1)) {
$acl1 = str_split($acl1);
@@ -684,7 +675,7 @@ function acl_compare($acl1, $acl2)
*
* @return array List of supported access rights abbreviations
*/
- function rights_supported()
+ public function rights_supported()
{
if ($this->supported !== null) {
return $this->supported;
@@ -694,8 +685,7 @@ function rights_supported()
if (is_array($capa) && !empty($capa)) {
$rights = strtolower($capa[0]);
- }
- else {
+ } else {
$rights = 'cd';
}
diff --git a/plugins/acl/tests/Acl.php b/plugins/acl/tests/Acl.php
index 0b326f4795..5fd2f13327 100644
--- a/plugins/acl/tests/Acl.php
+++ b/plugins/acl/tests/Acl.php
@@ -2,7 +2,7 @@
class Acl_Plugin extends ActionTestCase
{
- static function setUpBeforeClass(): void
+ public static function setUpBeforeClass(): void
{
include_once __DIR__ . '/../acl.php';
}
@@ -10,7 +10,7 @@ static function setUpBeforeClass(): void
/**
* Plugin object construction test
*/
- function test_constructor()
+ public function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new acl($rcube->plugins);
diff --git a/plugins/additional_message_headers/additional_message_headers.php b/plugins/additional_message_headers/additional_message_headers.php
index 8f79cd37e4..e003c016f1 100644
--- a/plugins/additional_message_headers/additional_message_headers.php
+++ b/plugins/additional_message_headers/additional_message_headers.php
@@ -18,7 +18,7 @@ class additional_message_headers extends rcube_plugin
/**
* Plugin initialization
*/
- function init()
+ public function init()
{
$this->add_hook('message_before_send', [$this, 'message_headers']);
}
@@ -30,7 +30,7 @@ function init()
*
* @return array Modified hook arguments
*/
- function message_headers($args)
+ public function message_headers($args)
{
$this->load_config();
diff --git a/plugins/additional_message_headers/tests/AdditionalMessageHeaders.php b/plugins/additional_message_headers/tests/AdditionalMessageHeaders.php
index b390894414..3cd2256477 100644
--- a/plugins/additional_message_headers/tests/AdditionalMessageHeaders.php
+++ b/plugins/additional_message_headers/tests/AdditionalMessageHeaders.php
@@ -2,7 +2,7 @@
class AdditionalMessageHeaders_Plugin extends ActionTestCase
{
- static function setUpBeforeClass(): void
+ public static function setUpBeforeClass(): void
{
include_once __DIR__ . '/../additional_message_headers.php';
}
@@ -10,7 +10,7 @@ static function setUpBeforeClass(): void
/**
* Test the plugin
*/
- function test_plugin()
+ public function test_plugin()
{
$rcube = rcube::get_instance();
$plugin = new additional_message_headers($rcube->plugins);
diff --git a/plugins/archive/archive.php b/plugins/archive/archive.php
index b37ecb7ead..5d69ae8db4 100644
--- a/plugins/archive/archive.php
+++ b/plugins/archive/archive.php
@@ -23,7 +23,7 @@ class archive extends rcube_plugin
/**
* Plugin initialization.
*/
- function init()
+ public function init()
{
$rcmail = rcmail::get_instance();
@@ -56,13 +56,11 @@ function init()
// set env variables for client
$rcmail->output->set_env('archive_folder', $this->archive_folder);
- $rcmail->output->set_env('archive_type', $rcmail->config->get('archive_type',''));
- }
- elseif ($rcmail->task == 'mail') {
+ $rcmail->output->set_env('archive_type', $rcmail->config->get('archive_type', ''));
+ } elseif ($rcmail->task == 'mail') {
// handler for ajax request
$this->register_action('plugin.move2archive', [$this, 'move_messages']);
- }
- elseif ($rcmail->task == 'settings') {
+ } elseif ($rcmail->task == 'settings') {
$this->add_hook('preferences_list', [$this, 'prefs_table']);
$this->add_hook('preferences_save', [$this, 'prefs_save']);
@@ -78,14 +76,13 @@ function init()
/**
* Hook to give the archive folder a localized name in the mailbox list
*/
- function render_mailboxlist($p)
+ 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 (isset($p['list'][$this->archive_folder])) {
$p['list'][$this->archive_folder]['name'] = $this->gettext('archivefolder');
- }
- else {
+ } else {
// search in subfolders
$this->_mod_folder_name($p['list'], $this->archive_folder, $this->gettext('archivefolder'));
}
@@ -103,8 +100,7 @@ private function _mod_folder_name(&$list, $folder, $new_name)
if ($item['id'] == $folder) {
$list[$idx]['name'] = $new_name;
return true;
- }
- elseif (!empty($item['folders'])) {
+ } elseif (!empty($item['folders'])) {
if ($this->_mod_folder_name($list[$idx]['folders'], $folder, $new_name)) {
return true;
}
@@ -118,7 +114,7 @@ private function _mod_folder_name(&$list, $folder, $new_name)
* Plugin action to move the submitted list of messages to the archive subfolders
* according to the user settings and their headers.
*/
- function move_messages()
+ public function move_messages()
{
$rcmail = rcmail::get_instance();
@@ -162,8 +158,7 @@ function move_messages()
if (!$this->archive_folder || $mbox === $this->archive_folder || strpos($mbox, $archive_prefix) === 0) {
$count = count($uids);
continue;
- }
- elseif (!$archive_type || $archive_type == 'folder') {
+ } elseif (!$archive_type || $archive_type == 'folder') {
$folder = $this->archive_folder;
if ($archive_type == 'folder') {
@@ -175,8 +170,7 @@ function move_messages()
$this->subfolder_worker($folder);
$count += $this->move_messages_worker($uids, $mbox, $folder, $read_on_move);
- }
- else {
+ } else {
if ($uids == '*') {
$index = $storage->index(null, $sort_col, $sort_ord);
$uids = $index->get();
@@ -247,8 +241,7 @@ function move_messages()
// FIXME: send updated message rows instead of reloading the entire list
$rcmail->output->command('refresh_list');
$addrows = false;
- }
- else {
+ } else {
$addrows = true;
}
@@ -260,8 +253,7 @@ function move_messages()
if ($from_show_action) {
if ($next = rcube_utils::get_input_string('_next_uid', rcube_utils::INPUT_GPC)) {
$rcmail->output->command('show_message', $next);
- }
- else {
+ } else {
$rcmail->output->command('command', 'list');
}
@@ -316,8 +308,7 @@ function move_messages()
if ($this->result['reload']) {
$rcmail->output->show_message($this->gettext('archivedreload'), 'confirmation');
- }
- else {
+ } else {
$rcmail->output->show_message($this->gettext('archived'), 'confirmation');
if (!$read_on_move) {
@@ -393,7 +384,7 @@ private function subfolder_worker($folder)
*
* @return array Modified hook arguments
*/
- function prefs_table($args)
+ public function prefs_table($args)
{
$this->add_texts('localization');
@@ -407,16 +398,15 @@ function prefs_table($args)
// load folders list when needed
if ($args['current']) {
$select = rcmail_action::folder_selector([
- 'noselection' => '---',
- 'realnames' => true,
- 'maxlength' => 30,
- 'folder_filter' => 'mail',
- 'folder_rights' => 'w',
- 'onchange' => "if ($(this).val() == 'INBOX') $(this).val('')",
- 'class' => 'custom-select',
+ 'noselection' => '---',
+ 'realnames' => true,
+ 'maxlength' => 30,
+ 'folder_filter' => 'mail',
+ 'folder_rights' => 'w',
+ 'onchange' => "if ($(this).val() == 'INBOX') $(this).val('')",
+ 'class' => 'custom-select',
]);
- }
- else {
+ } else {
$select = new html_select();
}
@@ -449,8 +439,7 @@ function prefs_table($args)
],
];
}
- }
- elseif ($args['section'] == 'server' && !in_array('read_on_archive', $dont_override)) {
+ } 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]);
$args['blocks']['main']['options']['read_on_archive'] = [
'title' => html::label('ff_read_on_archive', rcube::Q($this->gettext('readonarchive'))),
@@ -468,15 +457,14 @@ function prefs_table($args)
*
* @return array Modified hook arguments
*/
- function prefs_save($args)
+ public function prefs_save($args)
{
$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);
- }
- elseif ($args['section'] == 'server' && !in_array('read_on_archive', $dont_override)) {
+ } 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);
}
diff --git a/plugins/archive/tests/Archive.php b/plugins/archive/tests/Archive.php
index 17091341cc..c958727479 100644
--- a/plugins/archive/tests/Archive.php
+++ b/plugins/archive/tests/Archive.php
@@ -2,7 +2,7 @@
class Archive_Plugin extends PHPUnit\Framework\TestCase
{
- static function setUpBeforeClass(): void
+ public static function setUpBeforeClass(): void
{
include_once __DIR__ . '/../archive.php';
}
@@ -10,7 +10,7 @@ static function setUpBeforeClass(): void
/**
* Plugin object construction test
*/
- function test_constructor()
+ public function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new archive($rcube->plugins);
@@ -24,7 +24,7 @@ function test_constructor()
/**
* Test prefs_table() method
*/
- function test_prefs_table()
+ public function test_prefs_table()
{
$rcube = rcube::get_instance();
$plugin = new archive($rcube->plugins);
@@ -49,7 +49,7 @@ function test_prefs_table()
/**
* Test prefs_save() method
*/
- function test_prefs_save()
+ public function test_prefs_save()
{
$rcube = rcube::get_instance();
$plugin = new archive($rcube->plugins);
diff --git a/plugins/attachment_reminder/attachment_reminder.php b/plugins/attachment_reminder/attachment_reminder.php
index 1c3328e569..d9b61908c6 100644
--- a/plugins/attachment_reminder/attachment_reminder.php
+++ b/plugins/attachment_reminder/attachment_reminder.php
@@ -34,7 +34,7 @@ class attachment_reminder extends rcube_plugin
/**
* Plugin initialization
*/
- function init()
+ public function init()
{
$rcmail = rcube::get_instance();
@@ -63,7 +63,7 @@ function init()
*
* @return array Hook arguments
*/
- function prefs_list($args)
+ public function prefs_list($args)
{
if ($args['section'] == 'compose') {
$this->add_texts('localization/');
@@ -87,7 +87,7 @@ function prefs_list($args)
*
* @return array Hook arguments
*/
- function prefs_save($args)
+ public function prefs_save($args)
{
if ($args['section'] == 'compose') {
$dont_override = rcube::get_instance()->config->get('dont_override', []);
diff --git a/plugins/attachment_reminder/tests/AttachmentReminder.php b/plugins/attachment_reminder/tests/AttachmentReminder.php
index b4d595482d..3d4c5a79a2 100644
--- a/plugins/attachment_reminder/tests/AttachmentReminder.php
+++ b/plugins/attachment_reminder/tests/AttachmentReminder.php
@@ -2,7 +2,7 @@
class AttachmentReminder_Plugin extends PHPUnit\Framework\TestCase
{
- static function setUpBeforeClass(): void
+ public static function setUpBeforeClass(): void
{
include_once __DIR__ . '/../attachment_reminder.php';
}
@@ -10,7 +10,7 @@ static function setUpBeforeClass(): void
/**
* Plugin object construction test
*/
- function test_constructor()
+ public function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new attachment_reminder($rcube->plugins);
@@ -24,7 +24,7 @@ function test_constructor()
/**
* Test prefs_list() method
*/
- function test_prefs_list()
+ public function test_prefs_list()
{
$rcube = rcube::get_instance();
$plugin = new attachment_reminder($rcube->plugins);
@@ -46,7 +46,7 @@ function test_prefs_list()
/**
* Test prefs_save() method
*/
- function test_prefs_save()
+ public function test_prefs_save()
{
$rcube = rcube::get_instance();
$plugin = new attachment_reminder($rcube->plugins);
diff --git a/plugins/autologon/autologon.php b/plugins/autologon/autologon.php
index 30a7d34e19..5b9a4599fb 100644
--- a/plugins/autologon/autologon.php
+++ b/plugins/autologon/autologon.php
@@ -27,7 +27,7 @@ public function init()
*
* @return array Hook arguments
*/
- function startup($args)
+ public function startup($args)
{
// change action to login
if (empty($_SESSION['user_id']) && !empty($_GET['_autologin']) && $this->is_localhost()) {
@@ -44,7 +44,7 @@ function startup($args)
*
* @return array Hook arguments
*/
- function authenticate($args)
+ public function authenticate($args)
{
if (!empty($_GET['_autologin']) && $this->is_localhost()) {
$args['user'] = 'me';
diff --git a/plugins/autologon/tests/Autologon.php b/plugins/autologon/tests/Autologon.php
index 318a46e9fc..f79b4f5d3b 100644
--- a/plugins/autologon/tests/Autologon.php
+++ b/plugins/autologon/tests/Autologon.php
@@ -10,7 +10,7 @@ public static function setUpBeforeClass(): void
/**
* Plugin object construction test
*/
- function test_constructor()
+ public function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new autologon($rcube->plugins);
diff --git a/plugins/autologout/tests/Autologout.php b/plugins/autologout/tests/Autologout.php
index b9dfa9bab8..0da48abf90 100644
--- a/plugins/autologout/tests/Autologout.php
+++ b/plugins/autologout/tests/Autologout.php
@@ -10,7 +10,7 @@ public static function setUpBeforeClass(): void
/**
* Plugin object construction test
*/
- function test_constructor()
+ public function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new autologout($rcube->plugins);
diff --git a/plugins/database_attachments/database_attachments.php b/plugins/database_attachments/database_attachments.php
index 5054e9f367..017ffcda5b 100644
--- a/plugins/database_attachments/database_attachments.php
+++ b/plugins/database_attachments/database_attachments.php
@@ -37,12 +37,12 @@ class database_attachments extends filesystem_attachments
protected $cache;
// A prefix for the cache key used in the session and in the key field of the cache table
- const PREFIX = 'ATTACH';
+ public const PREFIX = 'ATTACH';
/**
* Save a newly uploaded attachment
*/
- function upload($args)
+ public function upload($args)
{
$args['status'] = false;
@@ -69,7 +69,7 @@ function upload($args)
/**
* Save an attachment from a non-upload source (draft or forward)
*/
- function save($args)
+ public function save($args)
{
$args['status'] = false;
@@ -101,7 +101,7 @@ function save($args)
* Remove an attachment from storage
* This is triggered by the remove attachment button on the compose screen
*/
- function remove($args)
+ public function remove($args)
{
$cache = $this->get_cache();
$status = $cache->remove($args['id']);
@@ -116,7 +116,7 @@ function remove($args)
* For this plugin, $this->get() will check the file and
* return it's contents
*/
- function display($args)
+ public function display($args)
{
return $this->get($args);
}
@@ -125,7 +125,7 @@ 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.
*/
- function get($args)
+ public function get($args)
{
$cache = $this->get_cache();
$data = $cache->get($args['id']);
@@ -133,8 +133,7 @@ function get($args)
if ($data !== null && $data !== false) {
$args['data'] = base64_decode($data);
$args['status'] = true;
- }
- else {
+ } else {
$args['status'] = false;
}
@@ -144,7 +143,7 @@ function get($args)
/**
* Delete all temp files associated with this user
*/
- function cleanup($args)
+ public function cleanup($args)
{
// check if cache object exist, it may be empty on session_destroy (#1489726)
if ($cache = $this->get_cache()) {
diff --git a/plugins/database_attachments/tests/DatabaseAttachments.php b/plugins/database_attachments/tests/DatabaseAttachments.php
index d6a38f83d5..6ac0baffe2 100644
--- a/plugins/database_attachments/tests/DatabaseAttachments.php
+++ b/plugins/database_attachments/tests/DatabaseAttachments.php
@@ -10,7 +10,7 @@ public static function setUpBeforeClass(): void
/**
* Plugin object construction test
*/
- function test_constructor()
+ public function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new database_attachments($rcube->plugins);
diff --git a/plugins/debug_logger/debug_logger.php b/plugins/debug_logger/debug_logger.php
index e35b9b74a5..8409515665 100644
--- a/plugins/debug_logger/debug_logger.php
+++ b/plugins/debug_logger/debug_logger.php
@@ -63,7 +63,7 @@ class debug_logger extends rcube_plugin
{
protected $runlog;
- function init()
+ public function init()
{
require_once __DIR__ . '/runlog/runlog.php';
@@ -98,20 +98,19 @@ function init()
$this->add_hook('authenticate', [$this, 'authenticate']);
}
- function authenticate($args)
+ public function authenticate($args)
{
$this->runlog->note('Authenticating ' . $args['user'] . '@' . $args['host']);
return $args;
}
- function console($args)
+ public function console($args)
{
$note = $args['args'][0];
if (!empty($args['args'][1])) {
$type = $args['args'][1];
- }
- else {
+ } else {
// This could be extended to detect types based on the
// file which called console. For now only rcube_imap/rcube_storage is supported
$bt = debug_backtrace();
@@ -151,7 +150,7 @@ function console($args)
return $args;
}
- function __destruct()
+ public function __destruct()
{
if ($this->runlog) {
$this->runlog->end();
diff --git a/plugins/debug_logger/runlog/runlog.php b/plugins/debug_logger/runlog/runlog.php
index 4044ebe99c..815e5036e3 100644
--- a/plugins/debug_logger/runlog/runlog.php
+++ b/plugins/debug_logger/runlog/runlog.php
@@ -20,7 +20,7 @@ class runlog
public $timestamp = 'd-M-Y H:i:s O';
public $max_line_size = 150;
- function __construct()
+ public function __construct()
{
$this->start_time = microtime(true);
}
@@ -76,7 +76,7 @@ public function end()
}
$end_txt = sprintf("end: $name - %0.4f seconds $tag_report", $this->run_log[$lastk]['duration']);
$this->print_to_console($end_txt, $this->run_log[$lastk]['tag']);
- $this->print_to_file($end_txt, $this->run_log[$lastk]['tag']);
+ $this->print_to_file($end_txt, $this->run_log[$lastk]['tag']);
}
}
@@ -164,7 +164,7 @@ public function print_to_file($msg, $tag = false)
$buffer = sprintf('[%s] %s', date($this->timestamp, time()), $buffer);
}
if (strlen($buffer) > $this->max_line_size) {
- $buffer = substr($buffer,0,$this->max_line_size - 3) . '...';
+ $buffer = substr($buffer, 0, $this->max_line_size - 3) . '...';
}
fwrite($this->file_handles['master'], $buffer . "\n");
}
@@ -181,8 +181,7 @@ public function print_to_console($msg, $tag = false)
}
echo "$msg\n";
}
- }
- else {
+ } else {
echo $this->get_indent();
if ($tag) {
echo "$tag: ";
@@ -201,7 +200,7 @@ private function get_indent()
return $buf;
}
- function __destruct()
+ public function __destruct()
{
foreach ($this->file_handles as $handle) {
fclose($handle);
diff --git a/plugins/debug_logger/tests/DebugLogger.php b/plugins/debug_logger/tests/DebugLogger.php
index c497e53263..a07b7fb0e9 100644
--- a/plugins/debug_logger/tests/DebugLogger.php
+++ b/plugins/debug_logger/tests/DebugLogger.php
@@ -10,7 +10,7 @@ public static function setUpBeforeClass(): void
/**
* Plugin object construction test
*/
- function test_constructor()
+ public function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new debug_logger($rcube->plugins);
diff --git a/plugins/emoticons/emoticons.php b/plugins/emoticons/emoticons.php
index 72af3b3e0b..df2ece5c0b 100644
--- a/plugins/emoticons/emoticons.php
+++ b/plugins/emoticons/emoticons.php
@@ -20,7 +20,7 @@ class emoticons extends rcube_plugin
/**
* Plugin initialization.
*/
- function init()
+ public function init()
{
$rcube = rcube::get_instance();
@@ -37,7 +37,7 @@ function init()
* 'message_part_after' hook handler to replace common
* plain text emoticons with emoji
*/
- function message_part_after($args)
+ public function message_part_after($args)
{
if ($args['type'] == 'plain') {
$this->load_config();
@@ -56,7 +56,7 @@ function message_part_after($args)
/**
* 'html_editor' hook handler, where we enable emoticons in TinyMCE
*/
- function html_editor($args)
+ public function html_editor($args)
{
$rcube = rcube::get_instance();
@@ -73,7 +73,7 @@ function html_editor($args)
/**
* 'preferences_list' hook handler
*/
- function preferences_list($args)
+ public function preferences_list($args)
{
$rcube = rcube::get_instance();
$dont_override = $rcube->config->get('dont_override', []);
@@ -86,11 +86,10 @@ function preferences_list($args)
$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')),
- 'content' => $checkbox->show(intval($rcube->config->get('emoticons_display', false))),
+ '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)) {
+ } elseif ($args['section'] == 'compose' && !in_array('emoticons_compose', $dont_override)) {
$this->load_config();
$this->add_texts('localization');
@@ -98,8 +97,8 @@ function preferences_list($args)
$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')),
- 'content' => $checkbox->show(intval($rcube->config->get('emoticons_compose', true))),
+ 'title' => html::label($field_id, $this->gettext('emoticonscompose')),
+ 'content' => $checkbox->show(intval($rcube->config->get('emoticons_compose', true))),
];
}
@@ -109,12 +108,11 @@ function preferences_list($args)
/**
* 'preferences_save' hook handler
*/
- function preferences_save($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);
- }
- elseif ($args['section'] == 'compose') {
+ } elseif ($args['section'] == 'compose') {
$args['prefs']['emoticons_compose'] = (bool) rcube_utils::get_input_value('_emoticons_compose', rcube_utils::INPUT_POST);
}
diff --git a/plugins/emoticons/tests/Emoticons.php b/plugins/emoticons/tests/Emoticons.php
index 9b898fee29..8c99dfd729 100644
--- a/plugins/emoticons/tests/Emoticons.php
+++ b/plugins/emoticons/tests/Emoticons.php
@@ -10,7 +10,7 @@ public static function setUpBeforeClass(): void
/**
* Plugin object construction test
*/
- function test_constructor()
+ public function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new emoticons($rcube->plugins);
diff --git a/plugins/enigma/bin/import_keys.sh b/plugins/enigma/bin/import_keys.sh
index e8d7ca21dc..1e007ac437 100755
--- a/plugins/enigma/bin/import_keys.sh
+++ b/plugins/enigma/bin/import_keys.sh
@@ -28,10 +28,10 @@ $rcmail = rcube::get_instance();
// get arguments
$args = rcube_utils::get_opt([
- 'u' => 'user',
- 'h' => 'host',
- 'd' => 'dir',
- 'x' => 'dry-run',
+ 'u' => 'user',
+ 'h' => 'host',
+ 'd' => 'dir',
+ 'x' => 'dry-run',
]);
if (!empty($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'help') {
@@ -90,11 +90,9 @@ function get_host($args)
$hosts = $rcmail->config->get('imap_host', '');
if (is_string($hosts)) {
$args['host'] = $hosts;
- }
- elseif (is_array($hosts) && count($hosts) == 1) {
+ } elseif (is_array($hosts) && count($hosts) == 1) {
$args['host'] = reset($hosts);
- }
- else {
+ } else {
rcube::raise_error('Specify a host name', true);
}
@@ -160,9 +158,9 @@ function import_dir($user_id, $dir, $dry_run = false)
if ($datasize > $maxsize) {
rcube::raise_error([
- 'code' => 605, 'line' => __LINE__, 'file' => __FILE__,
- 'message' => "Enigma: Failed to save $file. Size exceeds max_allowed_packet.",
- ], true, false);
+ 'code' => 605, 'line' => __LINE__, 'file' => __FILE__,
+ 'message' => "Enigma: Failed to save $file. Size exceeds max_allowed_packet.",
+ ], true, false);
continue;
}
@@ -180,9 +178,9 @@ function import_dir($user_id, $dir, $dry_run = false)
if ($db->is_error($result)) {
rcube::raise_error([
- 'code' => 605, 'line' => __LINE__, 'file' => __FILE__,
- 'message' => "Enigma: Failed to save $file into database.",
- ], true, false);
+ 'code' => 605, 'line' => __LINE__, 'file' => __FILE__,
+ 'message' => "Enigma: Failed to save $file into database.",
+ ], true, false);
}
}
}
diff --git a/plugins/enigma/enigma.php b/plugins/enigma/enigma.php
index deb2ac5cb5..03f448913e 100644
--- a/plugins/enigma/enigma.php
+++ b/plugins/enigma/enigma.php
@@ -31,7 +31,7 @@ class enigma extends rcube_plugin
/**
* Plugin initialization.
*/
- function init()
+ public function init()
{
$this->rc = rcube::get_instance();
@@ -67,8 +67,7 @@ function init()
}
$this->password_handler();
- }
- elseif ($this->rc->task == 'settings') {
+ } elseif ($this->rc->task == 'settings') {
// add hooks for Enigma settings
$this->add_hook('settings_actions', [$this, 'settings_actions']);
$this->add_hook('preferences_sections_list', [$this, 'preferences_sections_list']);
@@ -87,8 +86,7 @@ function init()
}
$this->password_handler();
- }
- elseif ($this->rc->task == 'cli') {
+ } elseif ($this->rc->task == 'cli') {
$this->add_hook('user_delete_commit', [$this, 'user_delete']);
}
@@ -98,7 +96,7 @@ function init()
/**
* Plugin environment initialization.
*/
- function load_env()
+ public function load_env()
{
if ($this->env_loaded) {
return;
@@ -121,7 +119,7 @@ function load_env()
/**
* Plugin UI initialization.
*/
- function load_ui($all = false)
+ public function load_ui($all = false)
{
if (!$this->ui) {
// load config/localization
@@ -140,7 +138,7 @@ function load_ui($all = false)
/**
* Plugin engine initialization.
*/
- function load_engine()
+ public function load_engine()
{
if ($this->engine) {
return $this->engine;
@@ -160,7 +158,7 @@ function load_engine()
*
* @return array Modified parameters
*/
- function part_structure($p)
+ public function part_structure($p)
{
$this->load_engine();
@@ -175,7 +173,7 @@ function part_structure($p)
*
* @return array Modified parameters
*/
- function part_body($p)
+ public function part_body($p)
{
$this->load_engine();
@@ -190,7 +188,7 @@ function part_body($p)
*
* @return array Modified parameters
*/
- function settings_actions($args)
+ public function settings_actions($args)
{
// add labels
$this->add_texts('localization/');
@@ -223,7 +221,7 @@ function settings_actions($args)
*
* @return array Modified parameters
*/
- function preferences_sections_list($p)
+ public function preferences_sections_list($p)
{
$p['list']['enigma'] = [
'id' => 'enigma', 'section' => $this->gettext('encryption'),
@@ -240,7 +238,7 @@ function preferences_sections_list($p)
*
* @return array Modified parameters
*/
- function preferences_list($p)
+ public function preferences_list($p)
{
if ($p['section'] != 'encryption') {
return $p;
@@ -256,9 +254,9 @@ function preferences_list($p)
$field_id = 'rcmfd_enigma_encryption';
$input = new html_checkbox([
- 'name' => '_enigma_encryption',
- 'id' => $field_id,
- 'value' => 1,
+ 'name' => '_enigma_encryption',
+ 'id' => $field_id,
+ 'value' => 1,
]);
$p['blocks']['main']['options']['enigma_encryption'] = [
@@ -275,9 +273,9 @@ function preferences_list($p)
$field_id = 'rcmfd_enigma_signatures';
$input = new html_checkbox([
- 'name' => '_enigma_signatures',
- 'id' => $field_id,
- 'value' => 1,
+ 'name' => '_enigma_signatures',
+ 'id' => $field_id,
+ 'value' => 1,
]);
$p['blocks']['main']['options']['enigma_signatures'] = [
@@ -294,9 +292,9 @@ function preferences_list($p)
$field_id = 'rcmfd_enigma_decryption';
$input = new html_checkbox([
- 'name' => '_enigma_decryption',
- 'id' => $field_id,
- 'value' => 1,
+ 'name' => '_enigma_decryption',
+ 'id' => $field_id,
+ 'value' => 1,
]);
$p['blocks']['main']['options']['enigma_decryption'] = [
@@ -313,9 +311,9 @@ function preferences_list($p)
$field_id = 'rcmfd_enigma_sign_all';
$input = new html_checkbox([
- 'name' => '_enigma_sign_all',
- 'id' => $field_id,
- 'value' => 1,
+ 'name' => '_enigma_sign_all',
+ 'id' => $field_id,
+ 'value' => 1,
]);
$p['blocks']['main']['options']['enigma_sign_all'] = [
@@ -332,9 +330,9 @@ function preferences_list($p)
$field_id = 'rcmfd_enigma_encrypt_all';
$input = new html_checkbox([
- 'name' => '_enigma_encrypt_all',
- 'id' => $field_id,
- 'value' => 1,
+ 'name' => '_enigma_encrypt_all',
+ 'id' => $field_id,
+ 'value' => 1,
]);
$p['blocks']['main']['options']['enigma_encrypt_all'] = [
@@ -351,9 +349,9 @@ function preferences_list($p)
$field_id = 'rcmfd_enigma_attach_pubkey';
$input = new html_checkbox([
- 'name' => '_enigma_attach_pubkey',
- 'id' => $field_id,
- 'value' => 1,
+ 'name' => '_enigma_attach_pubkey',
+ 'id' => $field_id,
+ 'value' => 1,
]);
$p['blocks']['main']['options']['enigma_attach_pubkey'] = [
@@ -394,7 +392,7 @@ function preferences_list($p)
*
* @return array Modified parameters
*/
- function preferences_save($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);
@@ -412,7 +410,7 @@ function preferences_save($p)
/**
* Handler for keys/certs management UI template.
*/
- function preferences_ui()
+ public function preferences_ui()
{
$this->load_ui();
@@ -429,7 +427,7 @@ function preferences_ui()
*
* @return array Modified parameters
*/
- function identity_form($p)
+ public function identity_form($p)
{
if (isset($p['form']['encryption']) && !empty($p['record']['identity_id'])) {
$content = '';
@@ -457,8 +455,7 @@ function identity_form($p)
if (count($listing)) {
$content .= html::p(null, $this->gettext(['name' => 'identitymatchingprivkeys', 'vars' => ['nr' => count($listing)]]));
$content .= html::tag('ul', 'keylist', implode("\n", $listing));
- }
- else {
+ } else {
$content .= html::p(null, $this->gettext('identitynoprivkeys'));
}
}
@@ -490,7 +487,7 @@ function identity_form($p)
*
* @return array Modified parameters
*/
- function status_message($p)
+ public function status_message($p)
{
$this->load_ui();
@@ -501,7 +498,7 @@ function status_message($p)
* Handler for message_load hook.
* Check message bodies and attachments for keys/certs.
*/
- function message_load($p)
+ public function message_load($p)
{
$this->load_ui();
@@ -513,7 +510,7 @@ function message_load($p)
* This callback function adds a box below the message content
* if there is a key/cert attachment available
*/
- function message_output($p)
+ public function message_output($p)
{
$this->load_ui();
@@ -523,7 +520,7 @@ function message_output($p)
/**
* Handler for attached keys/certs import
*/
- function import_file()
+ public function import_file()
{
$this->load_ui();
@@ -533,7 +530,7 @@ function import_file()
/**
* Handle password submissions
*/
- function password_handler()
+ public function password_handler()
{
$this->load_engine();
@@ -543,7 +540,7 @@ function password_handler()
/**
* Handle message_ready hook (encryption/signing)
*/
- function message_ready($p)
+ public function message_ready($p)
{
$this->load_ui();
@@ -553,7 +550,7 @@ function message_ready($p)
/**
* Handle message_compose_body hook
*/
- function message_compose($p)
+ public function message_compose($p)
{
$this->load_ui();
@@ -563,7 +560,7 @@ function message_compose($p)
/**
* Handler for refresh hook.
*/
- function refresh($p)
+ public function refresh($p)
{
// calling enigma_engine constructor to remove passwords
// stored in session after expiration time
@@ -575,7 +572,7 @@ function refresh($p)
/**
* Handle delete_user_commit hook
*/
- function user_delete($p)
+ public function user_delete($p)
{
$this->load_engine();
diff --git a/plugins/enigma/lib/enigma_driver.php b/plugins/enigma/lib/enigma_driver.php
index 1970447f73..187c9a88d4 100644
--- a/plugins/enigma/lib/enigma_driver.php
+++ b/plugins/enigma/lib/enigma_driver.php
@@ -16,22 +16,22 @@
abstract class enigma_driver
{
- const SUPPORT_RSA = 'RSA';
- const SUPPORT_ECC = 'ECC';
+ public const SUPPORT_RSA = 'RSA';
+ public const SUPPORT_ECC = 'ECC';
/**
* Class constructor.
*
* @param string $user User name (email address)
*/
- abstract function __construct($user);
+ abstract public function __construct($user);
/**
* Driver initialization.
*
* @return mixed NULL on success, enigma_error on failure
*/
- abstract function init();
+ abstract public function init();
/**
* Encryption (and optional signing).
@@ -42,7 +42,7 @@ abstract function init();
*
* @return mixed Encrypted message or enigma_error on failure
*/
- abstract function encrypt($text, $keys, $sign_key = null);
+ abstract public function encrypt($text, $keys, $sign_key = null);
/**
* Decryption (and sig verification if sig exists).
@@ -53,7 +53,7 @@ abstract function encrypt($text, $keys, $sign_key = null);
*
* @return mixed Decrypted message or enigma_error on failure
*/
- abstract function decrypt($text, $keys = [], &$signature = null);
+ abstract public function decrypt($text, $keys = [], &$signature = null);
/**
* Signing.
@@ -64,7 +64,7 @@ abstract function decrypt($text, $keys = [], &$signature = null);
*
* @return mixed True on success or enigma_error on failure
*/
- abstract function sign($text, $key, $mode = null);
+ abstract public function sign($text, $key, $mode = null);
/**
* Signature verification.
@@ -74,7 +74,7 @@ abstract function sign($text, $key, $mode = null);
*
* @return mixed Signature information (enigma_signature) or enigma_error
*/
- abstract function verify($text, $signature);
+ abstract public function verify($text, $signature);
/**
* Key/Cert file import.
@@ -85,7 +85,7 @@ abstract function verify($text, $signature);
*
* @return mixed Import status array or enigma_error
*/
- abstract function import($content, $isfile = false, $passwords = []);
+ abstract public function import($content, $isfile = false, $passwords = []);
/**
* Key/Cert export.
@@ -96,7 +96,7 @@ abstract function import($content, $isfile = false, $passwords = []);
*
* @return mixed Key content or enigma_error
*/
- abstract function export($key, $with_private = false, $passwords = []);
+ abstract public function export($key, $with_private = false, $passwords = []);
/**
* Keys listing.
@@ -105,7 +105,7 @@ abstract function export($key, $with_private = false, $passwords = []);
*
* @return mixed Array of enigma_key objects or enigma_error
*/
- abstract function list_keys($pattern = '');
+ abstract public function list_keys($pattern = '');
/**
* Single key information.
@@ -114,7 +114,7 @@ abstract function list_keys($pattern = '');
*
* @return mixed Key (enigma_key) object or enigma_error
*/
- abstract function get_key($keyid);
+ abstract public function get_key($keyid);
/**
* Key pair generation.
@@ -123,7 +123,7 @@ abstract function get_key($keyid);
*
* @return mixed Key (enigma_key) object or enigma_error
*/
- abstract function gen_key($data);
+ abstract public function gen_key($data);
/**
* Key deletion.
@@ -132,7 +132,7 @@ abstract function gen_key($data);
*
* @return mixed True on success or enigma_error
*/
- abstract function delete_key($keyid);
+ abstract public function delete_key($keyid);
/**
* Returns a name of the hash algorithm used for the last
@@ -140,7 +140,7 @@ abstract function delete_key($keyid);
*
* @return string Hash algorithm name e.g. sha1
*/
- abstract function signature_algorithm();
+ abstract public function signature_algorithm();
/**
* Returns a list of supported features.
diff --git a/plugins/enigma/lib/enigma_driver_gnupg.php b/plugins/enigma/lib/enigma_driver_gnupg.php
index 8ec7a49d03..57d41239df 100644
--- a/plugins/enigma/lib/enigma_driver_gnupg.php
+++ b/plugins/enigma/lib/enigma_driver_gnupg.php
@@ -32,7 +32,7 @@ class enigma_driver_gnupg extends enigma_driver
*
* @param rcube_user $user User object
*/
- function __construct($user)
+ public function __construct($user)
{
$this->rc = rcmail::get_instance();
$this->user = $user;
@@ -44,7 +44,7 @@ function __construct($user)
*
* @return enigma_error|null NULL on success, enigma_error on failure
*/
- function init()
+ public function init()
{
$homedir = $this->rc->config->get('enigma_pgp_homedir');
$debug = $this->rc->config->get('enigma_debug');
@@ -107,8 +107,7 @@ function init()
// Create Crypt_GPG object
try {
$this->gpg = new Crypt_GPG($options);
- }
- catch (Exception $e) {
+ } catch (Exception $e) {
return $this->get_error_from_exception($e);
}
@@ -124,7 +123,7 @@ function init()
*
* @return string|enigma_error Encrypted message or enigma_error on failure
*/
- function encrypt($text, $keys, $sign_key = null)
+ public function encrypt($text, $keys, $sign_key = null)
{
try {
foreach ($keys as $key) {
@@ -143,8 +142,7 @@ 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);
}
}
@@ -158,7 +156,7 @@ function encrypt($text, $keys, $sign_key = null)
*
* @return mixed Decrypted message or enigma_error on failure
*/
- function decrypt($text, $keys = [], &$signature = null)
+ public function decrypt($text, $keys = [], &$signature = null)
{
try {
foreach ($keys as $key => $password) {
@@ -182,8 +180,7 @@ function decrypt($text, $keys = [], &$signature = null)
}
return $result['data'];
- }
- catch (Exception $e) {
+ } catch (Exception $e) {
return $this->get_error_from_exception($e);
}
}
@@ -197,7 +194,7 @@ function decrypt($text, $keys = [], &$signature = null)
*
* @return mixed True on success or enigma_error on failure
*/
- function sign($text, $key, $mode = null)
+ public function sign($text, $key, $mode = null)
{
try {
$this->gpg->addSignKey($key->reference, $key->password);
@@ -208,8 +205,7 @@ function sign($text, $key, $mode = null)
$this->last_sig_algorithm = $sigInfo->getHashAlgorithmName();
return $res;
- }
- catch (Exception $e) {
+ } catch (Exception $e) {
return $this->get_error_from_exception($e);
}
}
@@ -222,13 +218,12 @@ function sign($text, $key, $mode = null)
*
* @return enigma_signature|enigma_error Signature information or enigma_error
*/
- function verify($text, $signature)
+ 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);
}
}
@@ -252,16 +247,14 @@ public function import($content, $isfile = false, $passwords = [])
if ($isfile) {
$result = $this->gpg->importKeyFile($content);
- }
- else {
+ } else {
$result = $this->gpg->importKey($content);
}
$this->db_save();
return $result;
- }
- catch (Exception $e) {
+ } catch (Exception $e) {
return $this->get_error_from_exception($e);
}
}
@@ -291,8 +284,7 @@ public function export($keyid, $with_private = false, $passwords = [])
}
return $key;
- }
- catch (Exception $e) {
+ } catch (Exception $e) {
return $this->get_error_from_exception($e);
}
}
@@ -315,8 +307,7 @@ public function list_keys($pattern = '')
}
return $result;
- }
- catch (Exception $e) {
+ } catch (Exception $e) {
return $this->get_error_from_exception($e);
}
}
@@ -352,9 +343,9 @@ public function gen_key($data)
try {
$debug = $this->rc->config->get('enigma_debug');
$keygen = new Crypt_GPG_KeyGenerator([
- 'homedir' => $this->homedir,
- // 'binary' => '/usr/bin/gpg2',
- 'debug' => $debug ? [$this, 'debug'] : false,
+ 'homedir' => $this->homedir,
+ // 'binary' => '/usr/bin/gpg2',
+ 'debug' => $debug ? [$this, 'debug'] : false,
]);
$key = $keygen
@@ -363,8 +354,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);
}
}
@@ -440,8 +430,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);
}
}
@@ -454,8 +443,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);
}
}
@@ -474,19 +462,15 @@ protected function get_error_from_exception($e)
if ($e instanceof Crypt_GPG_KeyNotFoundException) {
$error = enigma_error::KEYNOTFOUND;
$data['id'] = $e->getKeyId();
- }
- elseif ($e instanceof Crypt_GPG_BadPassphraseException) {
+ } elseif ($e instanceof Crypt_GPG_BadPassphraseException) {
$error = enigma_error::BADPASS;
$data['bad'] = $e->getBadPassphrases();
$data['missing'] = $e->getMissingPassphrases();
- }
- elseif ($e instanceof Crypt_GPG_NoDataException) {
+ } elseif ($e instanceof Crypt_GPG_NoDataException) {
$error = enigma_error::NODATA;
- }
- elseif ($e instanceof Crypt_GPG_DeletePrivateKeyException) {
+ } elseif ($e instanceof Crypt_GPG_DeletePrivateKeyException) {
$error = enigma_error::DELKEY;
- }
- else {
+ } else {
$error = enigma_error::INTERNAL;
}
@@ -562,8 +546,7 @@ protected function parse_key($key)
if (method_exists($subkey, 'getCreationDateTime')) {
$skey->created = $subkey->getCreationDateTime();
$skey->expires = $subkey->getExpirationDateTime();
- }
- else {
+ } else {
$skey->created = $subkey->getCreationDate();
$skey->expires = $subkey->getExpirationDate();
@@ -617,9 +600,9 @@ protected function db_sync()
if ($data === null || $data === false) {
rcube::raise_error([
- 'code' => 605, 'line' => __LINE__, 'file' => __FILE__,
- 'message' => "Enigma: Failed to sync $file ({$record['file_id']}). Decode error.",
- ], true, false);
+ 'code' => 605, 'line' => __LINE__, 'file' => __FILE__,
+ 'message' => "Enigma: Failed to sync $file ({$record['file_id']}). Decode error.",
+ ], true, false);
continue;
}
@@ -640,15 +623,14 @@ protected function db_sync()
if ($this->debug) {
$this->debug("SYNC: Fetched file: $file");
}
- }
- else {
+ } else {
// error
@unlink($tmpfile);
rcube::raise_error([
- 'code' => 605, 'line' => __LINE__, 'file' => __FILE__,
- 'message' => "Enigma: Failed to sync $file.",
- ], true, false);
+ 'code' => 605, 'line' => __LINE__, 'file' => __FILE__,
+ 'message' => "Enigma: Failed to sync $file.",
+ ], true, false);
}
}
}
@@ -714,9 +696,9 @@ protected function db_save($is_empty = false)
if ($datasize > $maxsize) {
rcube::raise_error([
- 'code' => 605, 'line' => __LINE__, 'file' => __FILE__,
- 'message' => "Enigma: Failed to save $file. Size exceeds max_allowed_packet.",
- ], true, false);
+ 'code' => 605, 'line' => __LINE__, 'file' => __FILE__,
+ 'message' => "Enigma: Failed to save $file. Size exceeds max_allowed_packet.",
+ ], true, false);
continue;
}
@@ -726,9 +708,9 @@ protected function db_save($is_empty = false)
if ($db->is_error($result)) {
rcube::raise_error([
- 'code' => 605, 'line' => __LINE__, 'file' => __FILE__,
- 'message' => "Enigma: Failed to save $file into database.",
- ], true, false);
+ 'code' => 605, 'line' => __LINE__, 'file' => __FILE__,
+ 'message' => "Enigma: Failed to save $file into database.",
+ ], true, false);
break;
}
@@ -748,9 +730,9 @@ protected function db_save($is_empty = false)
if ($db->is_error($result)) {
rcube::raise_error([
- 'code' => 605, 'line' => __LINE__, 'file' => __FILE__,
- 'message' => "Enigma: Failed to delete $file from database.",
- ], true, false);
+ 'code' => 605, 'line' => __LINE__, 'file' => __FILE__,
+ 'message' => "Enigma: Failed to delete $file from database.",
+ ], true, false);
break;
}
diff --git a/plugins/enigma/lib/enigma_driver_phpssl.php b/plugins/enigma/lib/enigma_driver_phpssl.php
index 74952cc1c6..089878b55b 100644
--- a/plugins/enigma/lib/enigma_driver_phpssl.php
+++ b/plugins/enigma/lib/enigma_driver_phpssl.php
@@ -20,7 +20,7 @@ class enigma_driver_phpssl extends enigma_driver
private $homedir;
private $user;
- function __construct($user)
+ public function __construct($user)
{
$rcmail = rcmail::get_instance();
$this->rc = $rcmail;
@@ -33,7 +33,7 @@ function __construct($user)
*
* @return mixed NULL on success, enigma_error on failure
*/
- function init()
+ public function init()
{
$homedir = $this->rc->config->get('enigma_smime_homedir', INSTALL_PATH . '/plugins/enigma/home');
@@ -72,13 +72,13 @@ function init()
}
- function encrypt($text, $keys, $sign_key = null) {}
+ public function encrypt($text, $keys, $sign_key = null) {}
- function decrypt($text, $keys = [], &$signature = null) {}
+ public function decrypt($text, $keys = [], &$signature = null) {}
- function sign($text, $key, $mode = null) {}
+ public function sign($text, $key, $mode = null) {}
- function verify($struct, $message)
+ public function verify($struct, $message)
{
// use common temp dir
$msg_file = rcube_utils::temp_filename('enigmsg');
@@ -87,8 +87,7 @@ function verify($struct, $message)
$fh = fopen($msg_file, 'w');
if ($struct->mime_id) {
$message->get_part_body($struct->mime_id, false, 0, $fh);
- }
- else {
+ } else {
$this->rc->storage->get_raw_body($message->uid, $fh);
}
fclose($fh);
@@ -107,8 +106,7 @@ function verify($struct, $message)
if ($sig === true) {
$sig = $this->parse_sig_cert($cert_file, $validity);
- }
- else {
+ } else {
$errorstr = $this->get_openssl_error();
$sig = new enigma_error(enigma_error::INTERNAL, $errorstr);
}
diff --git a/plugins/enigma/lib/enigma_engine.php b/plugins/enigma/lib/enigma_engine.php
index be46247e70..64783315b6 100644
--- a/plugins/enigma/lib/enigma_engine.php
+++ b/plugins/enigma/lib/enigma_engine.php
@@ -35,21 +35,21 @@ class enigma_engine
public $signatures = [];
public $encrypted_parts = [];
- const ENCRYPTED_PARTIALLY = 100;
+ public const ENCRYPTED_PARTIALLY = 100;
- const SIGN_MODE_BODY = 1;
- const SIGN_MODE_SEPARATE = 2;
- const SIGN_MODE_MIME = 4;
+ public const SIGN_MODE_BODY = 1;
+ public const SIGN_MODE_SEPARATE = 2;
+ public const SIGN_MODE_MIME = 4;
- const ENCRYPT_MODE_BODY = 1;
- const ENCRYPT_MODE_MIME = 2;
- const ENCRYPT_MODE_SIGN = 4;
+ public const ENCRYPT_MODE_BODY = 1;
+ public const ENCRYPT_MODE_MIME = 2;
+ public const ENCRYPT_MODE_SIGN = 4;
/**
* Plugin initialization.
*/
- function __construct($enigma)
+ public function __construct($enigma)
{
$this->rc = rcmail::get_instance();
$this->enigma = $enigma;
@@ -65,7 +65,7 @@ function __construct($enigma)
/**
* PGP driver initialization.
*/
- function load_pgp_driver()
+ public function load_pgp_driver()
{
if ($this->pgp_driver) {
return;
@@ -79,10 +79,9 @@ function load_pgp_driver()
if (!$this->pgp_driver) {
rcube::raise_error([
- 'code' => 600, 'file' => __FILE__, 'line' => __LINE__,
- 'message' => "Enigma plugin: Unable to load PGP driver: $driver",
- ], true, true
- );
+ 'code' => 600, 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => "Enigma plugin: Unable to load PGP driver: $driver",
+ ], true, true);
}
// Initialise driver
@@ -96,7 +95,7 @@ function load_pgp_driver()
/**
* S/MIME driver initialization.
*/
- function load_smime_driver()
+ public function load_smime_driver()
{
if ($this->smime_driver) {
return;
@@ -110,10 +109,9 @@ function load_smime_driver()
if (!$this->smime_driver) {
rcube::raise_error([
- 'code' => 600, 'file' => __FILE__, 'line' => __LINE__,
- 'message' => "Enigma plugin: Unable to load S/MIME driver: $driver",
- ], true, true
- );
+ 'code' => 600, 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => "Enigma plugin: Unable to load S/MIME driver: $driver",
+ ], true, true);
}
// Initialise driver
@@ -132,7 +130,7 @@ function load_smime_driver()
*
* @return enigma_error On error returns error object
*/
- function sign_message(&$message, $mode = null)
+ public function sign_message(&$message, $mode = null)
{
$mime = new enigma_mime_message($message, enigma_mime_message::PGP_SIGNED);
$from = $mime->getFromAddress();
@@ -169,8 +167,7 @@ function sign_message(&$message, $mode = null)
default:
if ($mime->isMultipart()) {
$pgp_mode = Crypt_GPG::SIGN_MODE_DETACHED;
- }
- else {
+ } else {
$pgp_mode = Crypt_GPG::SIGN_MODE_CLEAR;
}
}
@@ -192,8 +189,7 @@ function sign_message(&$message, $mode = null)
$text_charset = str_replace(";\r\n format=flowed", '', $text_charset);
}
- }
- else {
+ } else {
// here we'll build PGP/MIME message
$body = $mime->getOrigBody();
}
@@ -217,8 +213,7 @@ function sign_message(&$message, $mode = null)
if (!empty($text_charset)) {
$message->setParam('text_charset', $text_charset);
}
- }
- else {
+ } else {
$mime->addPGPSignature($body, $this->pgp_driver->signature_algorithm());
$message = $mime;
}
@@ -233,7 +228,7 @@ function sign_message(&$message, $mode = null)
*
* @return enigma_error On error returns error object
*/
- function encrypt_message(&$message, $mode = null, $is_draft = false)
+ public function encrypt_message(&$message, $mode = null, $is_draft = false)
{
$mime = new enigma_mime_message($message, enigma_mime_message::PGP_ENCRYPTED);
@@ -280,8 +275,7 @@ function encrypt_message(&$message, $mode = null, $is_draft = false)
foreach ((array) $recipients as $email) {
if ($email == $from && $sign_key) {
$key = $sign_key;
- }
- else {
+ } else {
$key = $this->find_key($email);
}
@@ -295,11 +289,9 @@ function encrypt_message(&$message, $mode = null, $is_draft = false)
// select mode
if ($mode & self::ENCRYPT_MODE_BODY) {
$encrypt_mode = $mode;
- }
- elseif ($mode & self::ENCRYPT_MODE_MIME) {
+ } elseif ($mode & self::ENCRYPT_MODE_MIME) {
$encrypt_mode = $mode;
- }
- else {
+ } else {
$encrypt_mode = $mime->isMultipart() ? self::ENCRYPT_MODE_MIME : self::ENCRYPT_MODE_BODY;
}
@@ -308,8 +300,7 @@ function encrypt_message(&$message, $mode = null, $is_draft = false)
// in this mode we'll replace text part
// with the one containing encrypted message
$body = $message->getTXTBody();
- }
- else {
+ } else {
// here we'll build PGP/MIME message
$body = $mime->getOrigBody();
}
@@ -330,8 +321,7 @@ function encrypt_message(&$message, $mode = null, $is_draft = false)
// replace message body
if ($encrypt_mode == self::ENCRYPT_MODE_BODY) {
$message->setTXTBody($body);
- }
- else {
+ } else {
$mime->setPGPEncryptedBody($body);
$message = $mime;
}
@@ -344,7 +334,7 @@ function encrypt_message(&$message, $mode = null, $is_draft = false)
*
* @return bool True on success, False on failure
*/
- function attach_public_key(&$message)
+ public function attach_public_key(&$message)
{
$headers = $message->headers();
$from = rcube_mime::decode_address_list($headers['From'], 1, false, null, true);
@@ -373,7 +363,7 @@ function attach_public_key(&$message)
*
* @return array Modified parameters
*/
- function part_structure($p, $body = null)
+ public function part_structure($p, $body = null)
{
static $got_content = false;
@@ -401,20 +391,16 @@ function part_structure($p, $body = null)
if ($p['mimetype'] == 'text/plain' || $p['mimetype'] == 'application/pgp') {
$this->parse_plain($p, $body);
$got_content = true;
- }
- elseif ($p['mimetype'] == 'multipart/signed') {
+ } elseif ($p['mimetype'] == 'multipart/signed') {
$this->parse_signed($p, $body);
$got_content = true;
- }
- elseif ($p['mimetype'] == 'multipart/encrypted') {
+ } elseif ($p['mimetype'] == 'multipart/encrypted') {
$this->parse_encrypted($p);
$got_content = true;
- }
- elseif ($p['mimetype'] == 'application/pkcs7-mime') {
+ } elseif ($p['mimetype'] == 'application/pkcs7-mime') {
$this->parse_encrypted($p);
$got_content = true;
- }
- else {
+ } else {
$got_content = !empty($p['structure']->type) && $p['structure']->type === 'content';
}
@@ -428,7 +414,7 @@ function part_structure($p, $body = null)
*
* @return array Modified parameters
*/
- function part_body($p)
+ public function part_body($p)
{
// encrypted attachment, see parse_plain_encrypted()
if (!empty($p['part']->need_decryption) && $p['part']->body === null) {
@@ -455,7 +441,7 @@ function part_body($p)
* @param array &$p Reference to hook's parameters
* @param string $body Part body (will be set if used internally)
*/
- function parse_plain(&$p, $body = null)
+ public function parse_plain(&$p, $body = null)
{
$part = $p['structure'];
@@ -516,11 +502,9 @@ function parse_plain(&$p, $body = null)
if ($mode === 'signed') {
$body .= $line;
- }
- elseif ($mode === 'encrypted') {
+ } elseif ($mode === 'encrypted') {
$body .= $line;
- }
- else {
+ } else {
$prefix .= $line;
}
}
@@ -529,8 +513,7 @@ function parse_plain(&$p, $body = null)
if ($mode === 'signed') {
$this->parse_plain_signed($p, $body, $prefix);
- }
- elseif ($mode === 'encrypted') {
+ } elseif ($mode === 'encrypted') {
$this->parse_plain_encrypted($p, $body, $prefix);
}
}
@@ -541,7 +524,7 @@ function parse_plain(&$p, $body = null)
* @param array &$p Reference to hook's parameters
* @param string $body Part body (will be set if used internally)
*/
- function parse_signed(&$p, $body = null)
+ public function parse_signed(&$p, $body = null)
{
$struct = $p['structure'];
@@ -567,7 +550,7 @@ function parse_signed(&$p, $body = null)
*
* @param array &$p Reference to hook's parameters
*/
- function parse_encrypted(&$p)
+ public function parse_encrypted(&$p)
{
$struct = $p['structure'];
@@ -628,11 +611,9 @@ private function parse_plain_signed(&$p, $body, $prefix = '')
while (($line = fgets($fd, 1024)) !== false) {
if ($part->body === null) {
$part->body = '';
- }
- elseif (preg_match('/^-----BEGIN PGP SIGNATURE-----/', $line)) {
+ } elseif (preg_match('/^-----BEGIN PGP SIGNATURE-----/', $line)) {
break;
- }
- else {
+ } else {
$part->body .= $line;
}
}
@@ -756,8 +737,7 @@ private function parse_plain_encrypted(&$p, $body, $prefix = '')
$items = explode('.', $part->mime_id);
array_pop($items);
$parent = implode('.', $items);
- }
- else {
+ } else {
$parent = 0;
}
@@ -843,10 +823,10 @@ private function parse_pgp_encrypted(&$p)
// Parse the structure (there may be encrypted/signed parts inside
$this->part_structure([
- 'object' => $p['object'],
- 'structure' => $struct,
- 'mimetype' => $struct->mimetype,
- ], $body);
+ 'object' => $p['object'],
+ 'structure' => $struct,
+ 'mimetype' => $struct->mimetype,
+ ], $body);
// Attach the decryption message to all parts
$this->decryptions[$struct->mime_id] = $result;
@@ -856,8 +836,7 @@ private function parse_pgp_encrypted(&$p)
$this->signatures[$sp->mime_id] = $signature;
}
}
- }
- else {
+ } else {
$this->decryptions[$part->mime_id] = $result;
// Make sure decryption status message will be displayed
@@ -1011,7 +990,7 @@ private function pgp_encrypt(&$msg_body, $keys, $sign_key = null, $sign_pass = n
*
* @return mixed Array of keys or enigma_error
*/
- function list_keys($pattern = '')
+ public function list_keys($pattern = '')
{
$this->load_pgp_driver();
$result = $this->pgp_driver->list_keys($pattern);
@@ -1031,7 +1010,7 @@ function list_keys($pattern = '')
*
* @return enigma_key The key
*/
- function find_key($email, $can_sign = false)
+ public function find_key($email, $can_sign = false)
{
if ($can_sign && array_key_exists($email, $this->cache)) {
return $this->cache[$email];
@@ -1080,7 +1059,7 @@ function find_key($email, $can_sign = false)
*
* @return mixed enigma_key or enigma_error
*/
- function get_key($keyid)
+ public function get_key($keyid)
{
$this->load_pgp_driver();
$result = $this->pgp_driver->get_key($keyid);
@@ -1099,7 +1078,7 @@ function get_key($keyid)
*
* @return enigma_error|bool True on success
*/
- function delete_key($keyid)
+ public function delete_key($keyid)
{
$this->load_pgp_driver();
$result = $this->pgp_driver->delete_key($keyid);
@@ -1118,7 +1097,7 @@ function delete_key($keyid)
*
* @return mixed enigma_key or enigma_error
*/
- function generate_key($data)
+ public function generate_key($data)
{
$this->load_pgp_driver();
$result = $this->pgp_driver->gen_key($data);
@@ -1138,15 +1117,14 @@ function generate_key($data)
*
* @return mixed Import status data array or enigma_error
*/
- function import_key($content, $isfile = false)
+ 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) {
self::raise_error($result, __LINE__);
- }
- else {
+ } else {
$result['imported'] = $result['public_imported'] + $result['private_imported'];
$result['unchanged'] = $result['public_unchanged'] + $result['private_unchanged'];
}
@@ -1163,7 +1141,7 @@ function import_key($content, $isfile = false)
*
* @return mixed Key content or enigma_error
*/
- function export_key($key, $fp = null, $include_private = false)
+ 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());
@@ -1175,8 +1153,7 @@ function export_key($key, $fp = null, $include_private = false)
if ($fp) {
fwrite($fp, $result);
- }
- else {
+ } else {
return $result;
}
}
@@ -1184,7 +1161,7 @@ function export_key($key, $fp = null, $include_private = false)
/**
* Registers password for specified key/cert sent by the password prompt.
*/
- function password_handler()
+ 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);
@@ -1197,7 +1174,7 @@ function password_handler()
/**
* Saves key/cert password in user session
*/
- function save_password($keyid, $password)
+ public function save_password($keyid, $password)
{
// we store passwords in session for specified time
if (!empty($_SESSION['enigma_pass'])) {
@@ -1215,7 +1192,7 @@ function save_password($keyid, $password)
/**
* Returns currently stored passwords
*/
- function get_passwords()
+ public function get_passwords()
{
if (!empty($_SESSION['enigma_pass'])) {
$config = $this->rc->decrypt($_SESSION['enigma_pass']);
@@ -1231,8 +1208,7 @@ function get_passwords()
if ($threshold && $value[1] < $threshold) {
unset($config[$key]);
$modified = true;
- }
- else {
+ } else {
$keys[$key] = $value[0];
}
}
@@ -1273,8 +1249,7 @@ private function get_part_body($msg, $part)
if (!empty($reset)) {
$part->size = 0;
}
- }
- else {
+ } else {
$body = $msg->get_part_body($part->mime_id, false);
}
@@ -1435,8 +1410,7 @@ public static function delete_dir($dir)
if (is_dir($filename)) {
self::delete_dir($filename);
- }
- else {
+ } else {
unlink($filename);
}
}
@@ -1465,12 +1439,11 @@ protected static function raise_error($result, $line, $abort = false)
{
if ($result->getCode() != enigma_error::BADPASS) {
rcube::raise_error([
- 'code' => 600,
- 'file' => __FILE__,
- 'line' => $line,
- 'message' => 'Enigma plugin: ' . $result->getMessage(),
- ], true, $abort
- );
+ 'code' => 600,
+ 'file' => __FILE__,
+ 'line' => $line,
+ 'message' => 'Enigma plugin: ' . $result->getMessage(),
+ ], true, $abort);
}
}
diff --git a/plugins/enigma/lib/enigma_error.php b/plugins/enigma/lib/enigma_error.php
index 0866763192..59a509e1c0 100644
--- a/plugins/enigma/lib/enigma_error.php
+++ b/plugins/enigma/lib/enigma_error.php
@@ -21,35 +21,35 @@ class enigma_error
private $data = [];
// error codes
- const OK = 0;
- const INTERNAL = 1;
- const NODATA = 2;
- const KEYNOTFOUND = 3;
- const DELKEY = 4;
- const BADPASS = 5;
- const EXPIRED = 6;
- const UNVERIFIED = 7;
- const NOMDC = 8;
-
-
- function __construct($code = null, $message = '', $data = [])
+ public const OK = 0;
+ public const INTERNAL = 1;
+ public const NODATA = 2;
+ public const KEYNOTFOUND = 3;
+ public const DELKEY = 4;
+ public const BADPASS = 5;
+ public const EXPIRED = 6;
+ public const UNVERIFIED = 7;
+ public const NOMDC = 8;
+
+
+ public function __construct($code = null, $message = '', $data = [])
{
$this->code = $code;
$this->message = $message;
$this->data = $data;
}
- function getCode()
+ public function getCode()
{
return $this->code;
}
- function getMessage()
+ public function getMessage()
{
return $this->message;
}
- function getData($name = null)
+ public function getData($name = null)
{
if ($name) {
return $this->data[$name] ?? null;
diff --git a/plugins/enigma/lib/enigma_key.php b/plugins/enigma/lib/enigma_key.php
index 69a9347bb8..e3e2c11adb 100644
--- a/plugins/enigma/lib/enigma_key.php
+++ b/plugins/enigma/lib/enigma_key.php
@@ -23,20 +23,20 @@ class enigma_key
public $reference;
public $password;
- const TYPE_UNKNOWN = 0;
- const TYPE_KEYPAIR = 1;
- const TYPE_PUBLIC = 2;
+ public const TYPE_UNKNOWN = 0;
+ public const TYPE_KEYPAIR = 1;
+ public const TYPE_PUBLIC = 2;
- const CAN_ENCRYPT = 1;
- const CAN_SIGN = 2;
- const CAN_CERTIFY = 4;
- const CAN_AUTHENTICATE = 8;
+ public const CAN_ENCRYPT = 1;
+ public const CAN_SIGN = 2;
+ public const CAN_CERTIFY = 4;
+ public const CAN_AUTHENTICATE = 8;
/**
* Keys list sorting callback for usort()
*/
- static function cmp($a, $b)
+ public static function cmp($a, $b)
{
return strcmp($a->name, $b->name);
}
@@ -46,12 +46,11 @@ static function cmp($a, $b)
*
* @return int One of self::TYPE_* constant values
*/
- function get_type()
+ public function get_type()
{
if (!empty($this->subkeys[0]) && $this->subkeys[0]->has_private) {
return self::TYPE_KEYPAIR;
- }
- elseif (!empty($this->subkeys[0])) {
+ } elseif (!empty($this->subkeys[0])) {
return self::TYPE_PUBLIC;
}
@@ -63,7 +62,7 @@ function get_type()
*
* @return bool
*/
- function is_revoked()
+ public function is_revoked()
{
foreach ($this->subkeys as $subkey) {
if (!$subkey->revoked) {
@@ -79,7 +78,7 @@ function is_revoked()
*
* @return bool
*/
- function is_valid()
+ public function is_valid()
{
foreach ($this->users as $user) {
if ($user->valid) {
@@ -95,7 +94,7 @@ function is_valid()
*
* @return bool
*/
- function is_private()
+ public function is_private()
{
foreach ($this->subkeys as $subkey) {
if ($subkey->has_private) {
@@ -114,7 +113,7 @@ function is_private()
*
* @return enigma_subkey|null Subkey object
*/
- function find_subkey($email, $mode)
+ public function find_subkey($email, $mode)
{
foreach ($this->users as $user) {
if (strcasecmp($user->email, $email) === 0 && $user->valid && !$user->revoked) {
@@ -137,7 +136,7 @@ function find_subkey($email, $mode)
*
* @return string Key short ID
*/
- static function format_id($id)
+ public static function format_id($id)
{
// E.g. 04622F2089E037A5 => 89E037A5
@@ -151,7 +150,7 @@ static function format_id($id)
*
* @return string Formatted fingerprint (with spaces)
*/
- static function format_fingerprint($fingerprint)
+ public static function format_fingerprint($fingerprint)
{
if (!$fingerprint) {
return '';
diff --git a/plugins/enigma/lib/enigma_mime_message.php b/plugins/enigma/lib/enigma_mime_message.php
index 3183048f80..3f2a3853fa 100644
--- a/plugins/enigma/lib/enigma_mime_message.php
+++ b/plugins/enigma/lib/enigma_mime_message.php
@@ -16,8 +16,8 @@
class enigma_mime_message extends Mail_mime
{
- const PGP_SIGNED = 1;
- const PGP_ENCRYPTED = 2;
+ public const PGP_SIGNED = 1;
+ public const PGP_ENCRYPTED = 2;
protected $type;
protected $message;
@@ -33,7 +33,7 @@ class enigma_mime_message extends Mail_mime
* @param Mail_mime $message Original message
* @param int $type Output message type
*/
- function __construct($message, $type)
+ public function __construct($message, $type)
{
$this->message = $message;
$this->type = $type;
@@ -204,14 +204,13 @@ public function get($params = null, $filename = null, $skip_head = false)
if (!empty($this->signature)) {
$message->addSubpart($this->signature, [
- 'filename' => 'signature.asc',
- 'content_type' => 'application/pgp-signature',
- 'disposition' => 'attachment',
- 'description' => 'OpenPGP digital signature',
+ 'filename' => 'signature.asc',
+ 'content_type' => 'application/pgp-signature',
+ 'disposition' => 'attachment',
+ 'description' => 'OpenPGP digital signature',
]);
}
- }
- elseif ($this->type == self::PGP_ENCRYPTED) {
+ } elseif ($this->type == self::PGP_ENCRYPTED) {
$params = [
'preamble' => 'This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156)',
'content_type' => 'multipart/encrypted; protocol="application/pgp-encrypted"',
@@ -221,23 +220,22 @@ public function get($params = null, $filename = null, $skip_head = false)
$message = new Mail_mimePart('', $params);
$message->addSubpart('Version: 1', [
- 'content_type' => 'application/pgp-encrypted',
- 'description' => 'PGP/MIME version identification',
+ 'content_type' => 'application/pgp-encrypted',
+ 'description' => 'PGP/MIME version identification',
]);
$message->addSubpart($this->encrypted, [
- 'content_type' => 'application/octet-stream',
- 'description' => 'PGP/MIME encrypted message',
- 'disposition' => 'inline',
- 'filename' => 'encrypted.asc',
+ 'content_type' => 'application/octet-stream',
+ 'description' => 'PGP/MIME encrypted message',
+ 'disposition' => 'inline',
+ 'filename' => 'encrypted.asc',
]);
}
// Use saved boundary
if (!empty($this->build_params['boundary'])) {
$boundary = $this->build_params['boundary'];
- }
- else {
+ } else {
$boundary = null;
}
@@ -251,8 +249,7 @@ public function get($params = null, $filename = null, $skip_head = false)
}
$this->headers = array_merge($this->headers, $headers);
- }
- else {
+ } else {
$output = $message->encode($boundary, $skip_head);
if ($this->isError($output)) {
@@ -286,13 +283,11 @@ protected function contentHeaders()
// multipart message: and boundary
if (!empty($this->build_params['boundary'])) {
$boundary = $this->build_params['boundary'];
- }
- elseif (!empty($this->headers['Content-Type'])
+ } elseif (!empty($this->headers['Content-Type'])
&& preg_match('/boundary="([^"]+)"/', $this->headers['Content-Type'], $m)
) {
$boundary = $m[1];
- }
- else {
+ } else {
$boundary = '=_' . md5(rand() . microtime());
}
@@ -306,8 +301,7 @@ protected function contentHeaders()
if ($this->micalg) {
$headers['Content-Type'] .= ";{$eol} micalg=pgp-" . $this->micalg;
}
- }
- elseif ($this->type == self::PGP_ENCRYPTED) {
+ } elseif ($this->type == self::PGP_ENCRYPTED) {
$headers['Content-Type'] = "multipart/encrypted;$eol"
. " protocol=\"application/pgp-encrypted\";$eol"
. " boundary=\"$boundary\"";
diff --git a/plugins/enigma/lib/enigma_subkey.php b/plugins/enigma/lib/enigma_subkey.php
index fdf430f344..6f7f6b7442 100644
--- a/plugins/enigma/lib/enigma_subkey.php
+++ b/plugins/enigma/lib/enigma_subkey.php
@@ -33,7 +33,7 @@ class enigma_subkey
*
* @return string Key ID
*/
- function get_short_id()
+ public function get_short_id()
{
// E.g. 04622F2089E037A5 => 89E037A5
return enigma_key::format_id($this->id);
@@ -44,7 +44,7 @@ function get_short_id()
*
* @return string Formatted fingerprint
*/
- function get_fingerprint()
+ public function get_fingerprint()
{
return enigma_key::format_fingerprint($this->fingerprint);
}
@@ -54,7 +54,7 @@ function get_fingerprint()
*
* @return string Algorithm name
*/
- function get_algorithm()
+ public function get_algorithm()
{
// http://tools.ietf.org/html/rfc4880#section-9.1
switch ($this->algorithm) {
@@ -83,7 +83,7 @@ function get_algorithm()
*
* @return bool
*/
- function is_expired()
+ public function is_expired()
{
$now = new DateTime('now');
@@ -97,7 +97,7 @@ function is_expired()
*
* @return string|int|null
*/
- function get_creation_date($asInt = false)
+ public function get_creation_date($asInt = false)
{
if (empty($this->created)) {
return $asInt ? 0 : null;
@@ -117,7 +117,7 @@ function get_creation_date($asInt = false)
*
* @return string|null
*/
- function get_expiration_date()
+ public function get_expiration_date()
{
if (empty($this->expires)) {
return null;
diff --git a/plugins/enigma/lib/enigma_ui.php b/plugins/enigma/lib/enigma_ui.php
index 872a36a795..bc425534a7 100644
--- a/plugins/enigma/lib/enigma_ui.php
+++ b/plugins/enigma/lib/enigma_ui.php
@@ -31,7 +31,7 @@ class enigma_ui
* @param enigma $enigma_plugin The plugin instance
* @param string $home Home directory
*/
- function __construct($enigma_plugin, $home = '')
+ public function __construct($enigma_plugin, $home = '')
{
$this->enigma = $enigma_plugin;
$this->rc = $enigma_plugin->rc;
@@ -41,7 +41,7 @@ function __construct($enigma_plugin, $home = '')
/**
* UI initialization and requests handlers.
*/
- function init()
+ public function init()
{
$this->add_js();
@@ -88,9 +88,9 @@ function init()
}
$this->rc->output->add_handlers([
- 'keyslist' => [$this, 'tpl_keys_list'],
- 'countdisplay' => [$this, 'tpl_keys_rowcount'],
- 'searchform' => [$this->rc->output, 'search_form'],
+ 'keyslist' => [$this, 'tpl_keys_list'],
+ 'countdisplay' => [$this, 'tpl_keys_rowcount'],
+ 'searchform' => [$this->rc->output, 'search_form'],
]);
$this->rc->output->set_pagetitle($this->enigma->gettext('enigmakeys'));
@@ -119,7 +119,7 @@ function init()
/**
* Adds CSS style file to the page header.
*/
- function add_css()
+ public function add_css()
{
if ($this->css_loaded) {
return;
@@ -133,7 +133,7 @@ function add_css()
/**
* Adds javascript file to the page header.
*/
- function add_js()
+ public function add_js()
{
if ($this->js_loaded) {
return;
@@ -152,7 +152,7 @@ function add_js()
* @param enigma_error $status Error object with key info
* @param array $params Optional prompt parameters
*/
- function password_prompt($status, $params = [])
+ public function password_prompt($status, $params = [])
{
$data = array_merge($status->getData('missing') ?: [], $status->getData('bad') ?: []);
@@ -180,8 +180,7 @@ function password_prompt($status, $params = [])
if (preg_match('/^(send|plugin.enigmaimport|plugin.enigmakeys)$/', $this->rc->action)) {
$this->rc->output->command('enigma_password_request', $data);
- }
- else {
+ } else {
$this->rc->output->set_env('enigma_password_request', $data);
}
@@ -200,7 +199,7 @@ function password_prompt($status, $params = [])
*
* @return string HTML content
*/
- function tpl_keys_list($attrib)
+ public function tpl_keys_list($attrib)
{
// add id to message list table if not specified
if (empty($attrib['id'])) {
@@ -245,11 +244,9 @@ private function key_list()
if (!is_array($list)) {
$this->rc->output->show_message('enigma.keylisterror', 'error');
- }
- elseif (empty($list)) {
+ } elseif (empty($list)) {
$this->rc->output->show_message('enigma.nokeysfound', 'notice');
- }
- else {
+ } else {
// Save the size
$listsize = count($list);
@@ -263,9 +260,9 @@ private function key_list()
// Add rows
foreach ($list as $key) {
$this->rc->output->command('enigma_add_list_row', [
- 'name' => rcube::Q($key->name),
- 'id' => $key->id,
- 'flags' => $key->is_private() ? 'p' : '',
+ 'name' => rcube::Q($key->name),
+ 'id' => $key->id,
+ 'flags' => $key->is_private() ? 'p' : '',
]);
}
}
@@ -286,7 +283,7 @@ private function key_list()
*
* @return string HTML output
*/
- function tpl_keys_rowcount($attrib)
+ public function tpl_keys_rowcount($attrib)
{
if (empty($attrib['id'])) {
$attrib['id'] = 'rcmcountdisplay';
@@ -304,14 +301,13 @@ private function get_rowcount_text($all = 0, $curr_count = 0, $page = 1)
{
if (!$curr_count) {
$out = $this->enigma->gettext('nokeysfound');
- }
- else {
+ } else {
$pagesize = $this->rc->config->get('pagesize', 100);
$first = ($page - 1) * $pagesize;
$out = $this->enigma->gettext([
- 'name' => 'keysfromto',
- 'vars' => ['from' => $first + 1, 'to' => $first + $curr_count, 'count' => $all],
+ 'name' => 'keysfromto',
+ 'vars' => ['from' => $first + 1, 'to' => $first + $curr_count, 'count' => $all],
]);
}
@@ -330,8 +326,7 @@ private function key_info()
if ($res instanceof enigma_key) {
$this->data = $res;
- }
- else { // error
+ } else { // error
$this->rc->output->show_message('enigma.keyopenerror', 'error');
$this->rc->output->command('parent.enigma_loadframe');
$this->rc->output->send('iframe');
@@ -353,7 +348,7 @@ private function key_info()
*
* @return string HTML output
*/
- function tpl_key_name($attrib)
+ public function tpl_key_name($attrib)
{
return rcube::Q($this->data->name);
}
@@ -365,7 +360,7 @@ function tpl_key_name($attrib)
*
* @return string HTML output
*/
- function tpl_key_data($attrib)
+ public function tpl_key_data($attrib)
{
$out = '';
$table = new html_table(['cols' => 2]);
@@ -383,8 +378,7 @@ function tpl_key_data($attrib)
$type = null;
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');
}
@@ -496,14 +490,14 @@ private function key_export()
if ($code == enigma_error::BADPASS) {
$this->password_prompt($status, [
- 'input_keys' => $keys,
- 'input_priv' => 1,
- 'input_task' => 'settings',
- 'input_action' => 'plugin.enigmakeys',
- 'input_a' => 'export',
- 'action' => '?',
- 'iframe' => true,
- 'nolock' => true,
+ 'input_keys' => $keys,
+ 'input_priv' => 1,
+ 'input_task' => 'settings',
+ 'input_action' => 'plugin.enigmakeys',
+ 'input_a' => 'export',
+ 'action' => '?',
+ 'iframe' => true,
+ 'nolock' => true,
]);
fclose($fp);
$this->rc->output->send('iframe');
@@ -541,8 +535,7 @@ private function key_import()
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 {
+ } else {
$this->rc->output->show_message('enigma.keysimportsuccess', 'confirmation',
['new' => $result['imported'], 'old' => $result['unchanged']]);
@@ -550,14 +543,12 @@ private function key_import()
$this->rc->output->command('enigma_list', 1, false);
}
}
- }
- else {
+ } else {
$this->rc->output->show_message('enigma.keysimportfailed', 'error');
}
$this->rc->output->send();
- }
- elseif (!empty($_FILES['_file']['tmp_name']) && is_uploaded_file($_FILES['_file']['tmp_name'])) {
+ } elseif (!empty($_FILES['_file']['tmp_name']) && is_uploaded_file($_FILES['_file']['tmp_name'])) {
$this->enigma->load_engine();
$result = $this->enigma->engine->import_key($_FILES['_file']['tmp_name'], true);
@@ -571,22 +562,19 @@ 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 {
+ } else {
$this->rc->output->show_message('enigma.keysimportfailed', 'error');
}
$this->rc->output->send('iframe');
- }
- elseif (!empty($_FILES['_file']['error'])) {
+ } elseif (!empty($_FILES['_file']['error'])) {
rcmail_action::upload_error($_FILES['_file']['error']);
$this->rc->output->send('iframe');
}
$this->rc->output->add_handlers([
- 'importform' => [$this, 'tpl_key_import_form'],
+ 'importform' => [$this, 'tpl_key_import_form'],
]);
$this->rc->output->send('enigma.keyimport');
@@ -598,7 +586,7 @@ private function key_import()
private function key_import_search()
{
$this->rc->output->add_handlers([
- 'importform' => [$this, 'tpl_key_import_form'],
+ 'importform' => [$this, 'tpl_key_import_form'],
]);
$this->rc->output->send('enigma.keysearch');
@@ -611,24 +599,24 @@ private function key_import_search()
*
* @return string HTML output
*/
- function tpl_key_import_form($attrib)
+ public function tpl_key_import_form($attrib)
{
$attrib += ['id' => 'rcmKeyImportForm'];
if (empty($attrib['part']) || $attrib['part'] == 'import') {
$title = $this->enigma->gettext('keyimportlabel');
$upload = new html_inputfield([
- 'type' => 'file',
- 'name' => '_file',
- 'id' => 'rcmimportfile',
- 'size' => 30,
- 'class' => 'form-control',
+ 'type' => 'file',
+ 'name' => '_file',
+ 'id' => 'rcmimportfile',
+ 'size' => 30,
+ 'class' => 'form-control',
]);
$max_filesize = rcmail_action::upload_init();
$upload_button = new html_button([
- 'class' => 'button import',
- 'onclick' => "return rcmail.command('plugin.enigma-import','',this,event)",
+ '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'))
@@ -639,8 +627,7 @@ function tpl_key_import_form($attrib)
if (empty($attrib['part'])) {
$form = html::tag('fieldset', '', html::tag('legend', null, $title) . $form);
- }
- else {
+ } else {
$this->rc->output->set_pagetitle($title);
}
@@ -656,8 +643,8 @@ function tpl_key_import_form($attrib)
'id' => 'rcmimportsearch', 'size' => 30, 'class' => 'form-control']);
$search_button = new html_button([
- 'class' => 'button search',
- 'onclick' => "return rcmail.command('plugin.enigma-import-search','',this,event)",
+ 'class' => 'button search',
+ 'onclick' => "return rcmail.command('plugin.enigma-import-search','',this,event)",
]);
$form = html::div(null,
@@ -668,8 +655,7 @@ function tpl_key_import_form($attrib)
if (empty($attrib['part'])) {
$form = html::tag('fieldset', '', html::tag('legend', null, $title) . $form);
- }
- else {
+ } else {
$this->rc->output->set_pagetitle($title);
}
@@ -677,8 +663,8 @@ function tpl_key_import_form($attrib)
}
$this->rc->output->add_label('selectimportfile', 'importwait', 'nopubkeyfor', 'nopubkeyforsender',
- 'encryptnoattachments','encryptedsendialog','searchpubkeyservers', 'importpubkeys',
- 'encryptpubkeysfound', 'search', 'close', 'import', 'keyid', 'keylength', 'keyexpired',
+ 'encryptnoattachments', 'encryptedsendialog', 'searchpubkeyservers', 'importpubkeys',
+ 'encryptpubkeysfound', 'search', 'close', 'import', 'keyid', 'keylength', 'keyexpired',
'keyrevoked', 'keyimportsuccess', 'keyservererror');
$this->rc->output->add_gui_object('importform', $attrib['id']);
@@ -722,17 +708,16 @@ private function key_generate()
$this->enigma->load_engine();
$result = $this->enigma->engine->generate_key([
- 'user' => $ident[1]['name'],
- 'email' => $ident[1]['mailto'],
- 'password' => $pass,
- 'size' => $size,
+ 'user' => $ident[1]['name'],
+ 'email' => $ident[1]['mailto'],
+ 'password' => $pass,
+ 'size' => $size,
]);
if ($result instanceof enigma_key) {
$this->rc->output->command('enigma_key_create_success');
$this->rc->output->show_message('enigma.keygeneratesuccess', 'confirmation');
- }
- else {
+ } else {
$this->rc->output->show_message('enigma.keygenerateerror', 'error');
}
@@ -761,7 +746,7 @@ private function key_create()
*
* @return string HTML output
*/
- function tpl_key_create_form($attrib)
+ public function tpl_key_create_form($attrib)
{
$attrib += ['id' => 'rcmKeyCreateForm'];
$table = new html_table(['cols' => 2]);
@@ -900,10 +885,10 @@ private function compose_ui_options($wrap = false)
)
. html::div('form-check col-6',
$chbox->show($this->rc->config->get('enigma_sign_all') ? 1 : 0, [
- 'name' => '_enigma_sign',
- 'id' => 'enigmasignopt',
- 'class' => 'form-check-input',
- 'disabled' => in_array('sign', $locks),
+ 'name' => '_enigma_sign',
+ 'id' => 'enigmasignopt',
+ 'class' => 'form-check-input',
+ 'disabled' => in_array('sign', $locks),
])
)
);
@@ -914,10 +899,10 @@ private function compose_ui_options($wrap = false)
)
. html::div('form-check col-6',
$chbox->show($this->rc->config->get('enigma_encrypt_all') ? 1 : 0, [
- 'name' => '_enigma_encrypt',
- 'id' => 'enigmaencryptopt',
- 'class' => 'form-check-input',
- 'disabled' => in_array('encrypt', $locks),
+ 'name' => '_enigma_encrypt',
+ 'id' => 'enigmaencryptopt',
+ 'class' => 'form-check-input',
+ 'disabled' => in_array('encrypt', $locks),
])
)
);
@@ -928,10 +913,10 @@ private function compose_ui_options($wrap = false)
)
. html::div('form-check col-6',
$chbox->show($this->rc->config->get('enigma_attach_pubkey') ? 1 : 0, [
- 'name' => '_enigma_attachpubkey',
- 'id' => 'enigmaattachpubkeyopt',
- 'class' => 'form-check-input',
- 'disabled' => in_array('pubkey', $locks),
+ 'name' => '_enigma_attachpubkey',
+ 'id' => 'enigmaattachpubkeyopt',
+ 'class' => 'form-check-input',
+ 'disabled' => in_array('pubkey', $locks),
])
)
);
@@ -953,7 +938,7 @@ private function compose_ui_options($wrap = false)
*
* @return array Modified parameters
*/
- function status_message($p)
+ public function status_message($p)
{
// skip: not a message part
if ($p['part'] instanceof rcube_message) {
@@ -989,25 +974,20 @@ function status_message($p)
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));
$this->password_prompt($status);
- }
- elseif ($code == enigma_error::NOMDC) {
+ } elseif ($code == enigma_error::NOMDC) {
$msg = rcube::Q($this->enigma->gettext('decryptnomdc'));
- }
- else {
+ } else {
$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'));
- }
- else {
+ } else {
$attrib['class'] = 'boxconfirmation enigmanotice encrypted';
$msg = rcube::Q($this->enigma->gettext('decryptok'));
}
@@ -1037,29 +1017,24 @@ function status_message($p)
$msg = str_replace('$sender', $sender, $this->enigma->gettext('sigunverified'));
$msg = str_replace('$keyid', $sig->id, $msg);
$msg = rcube::Q($msg);
- }
- elseif ($sig->valid) {
+ } 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)));
- }
- else {
+ } else {
$attrib['class'] = 'boxwarning enigmawarning signed';
if ($sender) {
$msg = rcube::Q(str_replace('$sender', $sender, $this->enigma->gettext('siginvalid')));
- }
- else {
+ } else {
$msg = rcube::Q(str_replace('$keyid', enigma_key::format_id($sig->id),
$this->enigma->gettext('signokey')));
}
}
- }
- elseif ($sig && $sig->getCode() == enigma_error::KEYNOTFOUND) {
+ } elseif ($sig && $sig->getCode() == enigma_error::KEYNOTFOUND) {
$attrib['class'] = 'boxwarning enigmawarning signed';
$msg = rcube::Q(str_replace('$keyid', enigma_key::format_id($sig->getData('id')),
$this->enigma->gettext('signokey')));
- }
- else {
+ } else {
$attrib['class'] = 'boxwarning enigmaerror signed';
$msg = rcube::Q($this->enigma->gettext('sigerror'));
}
@@ -1071,8 +1046,7 @@ function status_message($p)
if ($count = count($messages)) {
if ($count == 2 && $messages[0]['class'] == $messages[1]['class']) {
$p['prefix'] .= html::div($messages[0], $messages[0]['msg'] . ' ' . $messages[1]['msg']);
- }
- else {
+ } else {
foreach ($messages as $msg) {
$p['prefix'] .= html::div($msg, $msg['msg']);
}
@@ -1092,7 +1066,7 @@ function status_message($p)
* Handler for message_load hook.
* Check message bodies and attachments for keys/certs.
*/
- function message_load($p)
+ public function message_load($p)
{
$engine = $this->enigma->load_engine();
@@ -1125,7 +1099,7 @@ function message_load($p)
* This callback function adds a box below the message content
* if there is a key/cert attachment available
*/
- function message_output($p)
+ public function message_output($p)
{
foreach ($this->keys_parts as $part) {
// remove part's body
@@ -1159,7 +1133,7 @@ function message_output($p)
/**
* Handle message_ready hook (encryption/signing/attach public key)
*/
- function message_ready($p)
+ public function message_ready($p)
{
// The message might have been already encrypted by Mailvelope
if (strpos((string) $p['message']->getParam('ctype'), 'multipart/encrypted') === 0) {
@@ -1195,8 +1169,7 @@ function message_ready($p)
$mode = !$savedraft && $sign_enable ? enigma_engine::ENCRYPT_MODE_SIGN : null;
$status = $engine->encrypt_message($p['message'], $mode, $savedraft);
$mode = 'encrypt';
- }
- elseif (!$savedraft && $sign_enable) {
+ } elseif (!$savedraft && $sign_enable) {
$engine = $this->enigma->load_engine();
$status = $engine->sign_message($p['message'], enigma_engine::SIGN_MODE_MIME);
$mode = 'sign';
@@ -1210,29 +1183,25 @@ function message_ready($p)
if ($email = $status->getData('missing')) {
$vars = ['email' => $email];
$msg = 'enigma.' . $mode . 'nokey';
- }
- else {
+ } else {
$msg = 'enigma.' . ($encrypt_enable ? 'encryptnoprivkey' : 'signnokey');
}
- }
- elseif ($code == enigma_error::BADPASS) {
+ } elseif ($code == enigma_error::BADPASS) {
$this->password_prompt($status);
- }
- else {
+ } else {
$msg = 'enigma.' . $mode . 'error';
}
if (!empty($msg)) {
if (!empty($vars) && !empty($vars['email'])) {
$this->rc->output->command('enigma_key_not_found', [
- 'email' => $vars['email'],
- 'text' => $this->rc->gettext(['name' => $msg, 'vars' => $vars]),
- 'title' => $this->enigma->gettext('keynotfound'),
- 'button' => $this->enigma->gettext('findkey'),
- 'mode' => $mode,
+ 'email' => $vars['email'],
+ 'text' => $this->rc->gettext(['name' => $msg, 'vars' => $vars]),
+ 'title' => $this->enigma->gettext('keynotfound'),
+ 'button' => $this->enigma->gettext('findkey'),
+ 'mode' => $mode,
]);
- }
- else {
+ } else {
$this->rc->output->show_message($msg, 'error', $vars);
}
}
@@ -1248,7 +1217,7 @@ function message_ready($p)
* Display error when the message cannot be encrypted
* and provide a way to try again with a password.
*/
- function message_compose($p)
+ public function message_compose($p)
{
$engine = $this->enigma->load_engine();
@@ -1273,8 +1242,7 @@ function message_compose($p)
if ($code == enigma_error::KEYNOTFOUND) {
$msg = rcube::Q(str_replace('$keyid', enigma_key::format_id($status->getData('id')),
$this->enigma->gettext('decryptnokey')));
- }
- else {
+ } else {
$msg = rcube::Q($this->enigma->gettext('decrypterror'));
}
}
@@ -1298,7 +1266,7 @@ function message_compose($p)
/**
* Handler for keys/certs import request action
*/
- function import_file()
+ 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);
@@ -1315,13 +1283,13 @@ function import_file()
if ($status instanceof enigma_error) {
if ($status->getCode() == enigma_error::BADPASS) {
$this->password_prompt($status, [
- 'input_uid' => $uid,
- 'input_mbox' => $mbox,
- 'input_part' => $mime_id,
- 'input_task' => 'mail',
- 'input_action' => 'plugin.enigmaimport',
- 'action' => '?',
- 'iframe' => true,
+ 'input_uid' => $uid,
+ 'input_mbox' => $mbox,
+ 'input_part' => $mime_id,
+ 'input_task' => 'mail',
+ 'input_action' => 'plugin.enigmaimport',
+ 'action' => '?',
+ 'iframe' => true,
]);
$this->rc->output->send($this->rc->output->type == 'html' ? 'iframe' : null);
return;
@@ -1337,8 +1305,7 @@ function import_file()
if (!empty($part) && is_array($result = $engine->import_key($part))) {
$this->rc->output->show_message('enigma.keysimportsuccess', 'confirmation',
['new' => $result['imported'], 'old' => $result['unchanged']]);
- }
- else {
+ } else {
$this->rc->output->show_message('enigma.keysimportfailed', 'error');
}
diff --git a/plugins/enigma/tests/Enigma.php b/plugins/enigma/tests/Enigma.php
index 8923da4445..8831ebd4d6 100644
--- a/plugins/enigma/tests/Enigma.php
+++ b/plugins/enigma/tests/Enigma.php
@@ -10,7 +10,7 @@ protected function setUp(): void
/**
* Plugin object construction test
*/
- function test_constructor()
+ public function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new enigma($rcube->plugins);
diff --git a/plugins/enigma/tests/EnigmaDriverGnupg.php b/plugins/enigma/tests/EnigmaDriverGnupg.php
index 12677553b9..553cce800b 100644
--- a/plugins/enigma/tests/EnigmaDriverGnupg.php
+++ b/plugins/enigma/tests/EnigmaDriverGnupg.php
@@ -2,7 +2,7 @@
class Enigma_EnigmaDriverGnupg extends PHPUnit\Framework\TestCase
{
- static function setUpBeforeClass(): void
+ public static function setUpBeforeClass(): void
{
include_once __DIR__ . '/../lib/enigma_driver.php';
include_once __DIR__ . '/../lib/enigma_driver_gnupg.php';
@@ -11,7 +11,7 @@ static function setUpBeforeClass(): void
/**
* Test constructor
*/
- function test_constructor()
+ public function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new enigma_driver_gnupg($rcube->user);
diff --git a/plugins/enigma/tests/EnigmaEngine.php b/plugins/enigma/tests/EnigmaEngine.php
index 0e4bf0996d..1a63f41223 100644
--- a/plugins/enigma/tests/EnigmaEngine.php
+++ b/plugins/enigma/tests/EnigmaEngine.php
@@ -2,7 +2,7 @@
class Enigma_EnigmaEngine extends PHPUnit\Framework\TestCase
{
- static function setUpBeforeClass(): void
+ public static function setUpBeforeClass(): void
{
include_once __DIR__ . '/../enigma.php';
include_once __DIR__ . '/../lib/enigma_engine.php';
@@ -11,7 +11,7 @@ static function setUpBeforeClass(): void
/**
* Test password_handler()
*/
- function test_password_handler()
+ public function test_password_handler()
{
$rcube = rcube::get_instance();
$plugin = new enigma($rcube->plugins);
diff --git a/plugins/enigma/tests/EnigmaError.php b/plugins/enigma/tests/EnigmaError.php
index f3ce16a011..8d4f893916 100644
--- a/plugins/enigma/tests/EnigmaError.php
+++ b/plugins/enigma/tests/EnigmaError.php
@@ -2,7 +2,7 @@
class Enigma_EnigmaError extends PHPUnit\Framework\TestCase
{
- static function setUpBeforeClass(): void
+ public static function setUpBeforeClass(): void
{
include_once __DIR__ . '/../lib/enigma_error.php';
}
@@ -10,7 +10,7 @@ static function setUpBeforeClass(): void
/**
* Test constructor
*/
- function test_constructor()
+ public function test_constructor()
{
$error = new enigma_error(enigma_error::EXPIRED, 'message', ['test1' => 'test2']);
diff --git a/plugins/enigma/tests/EnigmaKey.php b/plugins/enigma/tests/EnigmaKey.php
index 7aa0bb3ba3..9e1cea3060 100644
--- a/plugins/enigma/tests/EnigmaKey.php
+++ b/plugins/enigma/tests/EnigmaKey.php
@@ -2,7 +2,7 @@
class Enigma_EnigmaKey extends PHPUnit\Framework\TestCase
{
- static function setUpBeforeClass(): void
+ public static function setUpBeforeClass(): void
{
include_once __DIR__ . '/../lib/enigma_key.php';
}
@@ -10,7 +10,7 @@ static function setUpBeforeClass(): void
/**
* Test "empty" key
*/
- function test_empty_key()
+ public function test_empty_key()
{
$key = new enigma_key();
diff --git a/plugins/enigma/tests/EnigmaMimeMessage.php b/plugins/enigma/tests/EnigmaMimeMessage.php
index 644bd0127c..228c71e711 100644
--- a/plugins/enigma/tests/EnigmaMimeMessage.php
+++ b/plugins/enigma/tests/EnigmaMimeMessage.php
@@ -2,7 +2,7 @@
class Enigma_EnigmaMimeMessage extends PHPUnit\Framework\TestCase
{
- static function setUpBeforeClass(): void
+ public static function setUpBeforeClass(): void
{
include_once __DIR__ . '/../lib/enigma_mime_message.php';
}
@@ -10,7 +10,7 @@ static function setUpBeforeClass(): void
/**
* Test isMultipart()
*/
- function test_is_multipart()
+ public function test_is_multipart()
{
$mime = new Mail_mime();
$message1 = new enigma_mime_message($mime, enigma_mime_message::PGP_SIGNED);
@@ -30,7 +30,7 @@ function test_is_multipart()
/**
* Test getFromAddress()
*/
- function test_get_from_address()
+ public function test_get_from_address()
{
$mime = new Mail_mime();
$message = new enigma_mime_message($mime, enigma_mime_message::PGP_SIGNED);
@@ -46,7 +46,7 @@ function test_get_from_address()
/**
* Test getRecipients()
*/
- function test_get_recipients()
+ public function test_get_recipients()
{
$mime = new Mail_mime();
$mime->setFrom('test1@domain.com');
@@ -64,7 +64,7 @@ function test_get_recipients()
/**
* Test getOrigBody()
*/
- function test_get_orig_body()
+ public function test_get_orig_body()
{
$mime = new Mail_mime();
$mime->setTXTBody('test body');
@@ -81,7 +81,7 @@ function test_get_orig_body()
/**
* Test get()
*/
- function test_get()
+ public function test_get()
{
$mime = new Mail_mime();
$mime->setTXTBody('test body');
diff --git a/plugins/enigma/tests/EnigmaSignature.php b/plugins/enigma/tests/EnigmaSignature.php
index 6cdb416bc7..5dccab4cc0 100644
--- a/plugins/enigma/tests/EnigmaSignature.php
+++ b/plugins/enigma/tests/EnigmaSignature.php
@@ -2,7 +2,7 @@
class Enigma_EnigmaSignature extends PHPUnit\Framework\TestCase
{
- static function setUpBeforeClass(): void
+ public static function setUpBeforeClass(): void
{
include_once __DIR__ . '/../lib/enigma_signature.php';
}
@@ -10,7 +10,7 @@ static function setUpBeforeClass(): void
/**
* Test constructor
*/
- function test_constructor()
+ public function test_constructor()
{
$error = new enigma_signature();
diff --git a/plugins/enigma/tests/EnigmaSubkey.php b/plugins/enigma/tests/EnigmaSubkey.php
index 139368c8be..26b4f7642e 100644
--- a/plugins/enigma/tests/EnigmaSubkey.php
+++ b/plugins/enigma/tests/EnigmaSubkey.php
@@ -2,7 +2,7 @@
class Enigma_EnigmaSubkey extends PHPUnit\Framework\TestCase
{
- static function setUpBeforeClass(): void
+ public static function setUpBeforeClass(): void
{
include_once __DIR__ . '/../lib/enigma_subkey.php';
}
@@ -10,7 +10,7 @@ static function setUpBeforeClass(): void
/**
* Test constructor
*/
- function test_constructor()
+ public function test_constructor()
{
$error = new enigma_subkey();
diff --git a/plugins/enigma/tests/EnigmaUserid.php b/plugins/enigma/tests/EnigmaUserid.php
index 23eab4f898..4e26cfd413 100644
--- a/plugins/enigma/tests/EnigmaUserid.php
+++ b/plugins/enigma/tests/EnigmaUserid.php
@@ -2,7 +2,7 @@
class Enigma_EnigmaUserid extends PHPUnit\Framework\TestCase
{
- static function setUpBeforeClass(): void
+ public static function setUpBeforeClass(): void
{
include_once __DIR__ . '/../lib/enigma_userid.php';
}
@@ -10,7 +10,7 @@ static function setUpBeforeClass(): void
/**
* Test constructor
*/
- function test_constructor()
+ public function test_constructor()
{
$error = new enigma_userid();
diff --git a/plugins/example_addressbook/example_addressbook_backend.php b/plugins/example_addressbook/example_addressbook_backend.php
index d8f0b5b92a..f1ff027315 100644
--- a/plugins/example_addressbook/example_addressbook_backend.php
+++ b/plugins/example_addressbook/example_addressbook_backend.php
@@ -60,7 +60,7 @@ public function __construct($name)
*
* @return ?array Group properties as hash array, null in case of error.
*/
- function get_group($group_id)
+ public function get_group($group_id)
{
foreach ($this->db_groups as $group) {
if ($group['ID'] == $group_id) {
@@ -90,7 +90,7 @@ public function reset()
$this->filter = null;
}
- function list_groups($search = null, $mode = 0)
+ public function list_groups($search = null, $mode = 0)
{
if (is_string($search) && strlen($search)) {
$result = [];
@@ -194,7 +194,7 @@ public function get_record($id, $assoc = false)
*
* @return array List of assigned groups, indexed by group ID
*/
- function get_record_groups($id)
+ public function get_record_groups($id)
{
$result = [];
@@ -214,34 +214,34 @@ function get_record_groups($id)
/**
* Setter for the current group
*/
- function set_group($gid)
+ public function set_group($gid)
{
$this->group_id = $gid;
}
- function create_group($name)
+ public function create_group($name)
{
$result = false;
return $result;
}
- function delete_group($gid)
+ public function delete_group($gid)
{
return false;
}
- function rename_group($gid, $newname, &$newid)
+ public function rename_group($gid, $newname, &$newid)
{
return $newname;
}
- function add_to_group($group_id, $ids)
+ public function add_to_group($group_id, $ids)
{
return false;
}
- function remove_from_group($group_id, $ids)
+ public function remove_from_group($group_id, $ids)
{
return false;
}
diff --git a/plugins/example_addressbook/tests/ExampleAddressbook.php b/plugins/example_addressbook/tests/ExampleAddressbook.php
index c9196cb5c9..ecd1a5d7e1 100644
--- a/plugins/example_addressbook/tests/ExampleAddressbook.php
+++ b/plugins/example_addressbook/tests/ExampleAddressbook.php
@@ -11,7 +11,7 @@ public static function setUpBeforeClass(): void
/**
* Plugin object construction test
*/
- function test_constructor()
+ public function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new example_addressbook($rcube->plugins);
@@ -25,7 +25,7 @@ function test_constructor()
/**
* Test address_sources()
*/
- function test_address_sources()
+ public function test_address_sources()
{
$rcube = rcube::get_instance();
$plugin = new example_addressbook($rcube->plugins);
diff --git a/plugins/filesystem_attachments/filesystem_attachments.php b/plugins/filesystem_attachments/filesystem_attachments.php
index f22b5cc8d3..db220f90b0 100644
--- a/plugins/filesystem_attachments/filesystem_attachments.php
+++ b/plugins/filesystem_attachments/filesystem_attachments.php
@@ -30,17 +30,16 @@ class filesystem_attachments extends rcube_plugin
public $task = '?(?!login).*';
public $initialized = false;
- function init()
+ 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([
- 'file' => __FILE__, 'line' => __LINE__,
- 'message' => "Can use only one plugin for attachments/file uploads! Using '$plugin_name', ignoring others.",
- ], true, false
- );
+ 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => "Can use only one plugin for attachments/file uploads! Using '$plugin_name', ignoring others.",
+ ], true, false);
return;
}
}
@@ -70,7 +69,7 @@ function init()
/**
* Save a newly uploaded attachment
*/
- function upload($args)
+ public function upload($args)
{
$args['status'] = false;
$group = $args['group'];
@@ -91,7 +90,7 @@ function upload($args)
/**
* Save an attachment from a non-upload source (draft or forward)
*/
- function save($args)
+ public function save($args)
{
$group = $args['group'];
$args['status'] = false;
@@ -103,8 +102,7 @@ function save($args)
fwrite($fp, $args['data']);
fclose($fp);
$args['path'] = $tmp_path;
- }
- else {
+ } else {
return $args;
}
}
@@ -119,7 +117,7 @@ function save($args)
* Remove an attachment from storage
* This is triggered by the remove attachment button on the compose screen
*/
- function remove($args)
+ public function remove($args)
{
$args['status'] = $this->verify_path($args['path']) && @unlink($args['path']);
return $args;
@@ -130,7 +128,7 @@ function remove($args)
* For this plugin, the file is already in place, just check for
* the existence of the proper metadata
*/
- function display($args)
+ public function display($args)
{
$args['status'] = $this->verify_path($args['path']) && file_exists($args['path']);
return $args;
@@ -141,7 +139,7 @@ function display($args)
* on disk for use. This stub function is kept here to make this
* class handy as a parent class for other plugins which may need it.
*/
- function get($args)
+ public function get($args)
{
if (!$this->verify_path($args['path'])) {
$args['path'] = null;
@@ -153,7 +151,7 @@ function get($args)
/**
* Delete all temp files associated with this user session
*/
- function cleanup($args)
+ public function cleanup($args)
{
$rcube = rcube::get_instance();
$group = $args['group'] ?? null;
@@ -204,23 +202,21 @@ protected static function verify_path($path)
// We allow that, but we'll let to know the user about the misconfiguration.
if ($file_path == sys_get_temp_dir()) {
rcube::raise_error([
- 'file' => __FILE__,
- 'line' => __LINE__,
- 'message' => "Detected 'temp_dir' change. "
- . "Access to '$temp_dir' restricted by filesystem permissions or open_basedir",
- ], true, false
- );
+ 'file' => __FILE__,
+ 'line' => __LINE__,
+ 'message' => "Detected 'temp_dir' change. "
+ . "Access to '$temp_dir' restricted by filesystem permissions or open_basedir",
+ ], true, false);
return true;
}
rcube::raise_error([
- 'file' => __FILE__,
- 'line' => __LINE__,
- 'message' => sprintf("%s can't read %s (not in temp_dir)",
- $rcmail->get_user_name(), substr($path, 0, 512)),
- ], true, false
- );
+ 'file' => __FILE__,
+ 'line' => __LINE__,
+ 'message' => sprintf("%s can't read %s (not in temp_dir)",
+ $rcmail->get_user_name(), substr($path, 0, 512)),
+ ], true, false);
return false;
}
diff --git a/plugins/filesystem_attachments/tests/FilesystemAttachments.php b/plugins/filesystem_attachments/tests/FilesystemAttachments.php
index 6107305124..53596835e0 100644
--- a/plugins/filesystem_attachments/tests/FilesystemAttachments.php
+++ b/plugins/filesystem_attachments/tests/FilesystemAttachments.php
@@ -10,7 +10,7 @@ public static function setUpBeforeClass(): void
/**
* Plugin object construction test
*/
- function test_constructor()
+ public function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new filesystem_attachments($rcube->plugins);
diff --git a/plugins/help/help.php b/plugins/help/help.php
index 64d9e5ed46..17a99b3387 100644
--- a/plugins/help/help.php
+++ b/plugins/help/help.php
@@ -18,7 +18,7 @@ class help extends rcube_plugin
// we've got no ajax handlers
public $noajax = true;
- function init()
+ public function init()
{
$this->load_config();
$this->add_texts('localization/', false);
@@ -35,7 +35,7 @@ function init()
$this->add_hook('error_page', [$this, 'error_page']);
}
- function startup($args)
+ public function startup($args)
{
$rcmail = rcmail::get_instance();
@@ -59,31 +59,29 @@ function startup($args)
$this->include_stylesheet($this->local_skin_path() . '/help.css');
}
- function action()
+ public function action()
{
$rcmail = rcmail::get_instance();
if ($rcmail->action == 'about') {
$rcmail->output->set_pagetitle($this->gettext('about'));
- }
- elseif ($rcmail->action == 'license') {
+ } elseif ($rcmail->action == 'license') {
$rcmail->output->set_pagetitle($this->gettext('license'));
- }
- else {
+ } else {
$rcmail->output->set_pagetitle($this->gettext('help'));
}
// register UI objects
$rcmail->output->add_handlers([
- 'helpcontent' => [$this, 'help_content'],
- 'tablink' => [$this, 'tablink'],
+ 'helpcontent' => [$this, 'help_content'],
+ 'tablink' => [$this, 'tablink'],
]);
$rcmail->output->set_env('help_links', $this->help_metadata());
$rcmail->output->send(!empty($_GET['_content']) ? 'help.content' : 'help.help');
}
- function help_content($attrib)
+ public function help_content($attrib)
{
$rcmail = rcmail::get_instance();
// $rcmail->output->set_env('content', $content);
@@ -91,14 +89,13 @@ function help_content($attrib)
if (!empty($_GET['_content'])) {
if ($rcmail->action == 'about') {
return file_get_contents($this->home . '/content/about.html');
- }
- elseif ($rcmail->action == 'license') {
+ } elseif ($rcmail->action == 'license') {
return file_get_contents($this->home . '/content/license.html');
}
}
}
- function tablink($attrib)
+ public function tablink($attrib)
{
$rcmail = rcmail::get_instance();
@@ -115,7 +112,7 @@ function tablink($attrib)
return $rcmail->output->button($attrib);
}
- function help_metadata()
+ public function help_metadata()
{
$rcmail = rcmail::get_instance();
$content = [];
@@ -123,8 +120,7 @@ function help_metadata()
// About
if (is_readable($this->home . '/content/about.html')) {
$content['about'] = 'self';
- }
- else {
+ } else {
$default = $rcmail->url(['_task' => 'settings', '_action' => 'about', '_framed' => 1]);
$content['about'] = $rcmail->config->get('help_about_url', $default);
$content['about'] = $this->resolve_language($content['about']);
@@ -133,8 +129,7 @@ function help_metadata()
// License
if (is_readable($this->home . '/content/license.html')) {
$content['license'] = 'self';
- }
- else {
+ } else {
$content['license'] = $rcmail->config->get('help_license_url', 'http://www.gnu.org/licenses/gpl-3.0-standalone.html');
$content['license'] = $this->resolve_language($content['license']);
}
@@ -148,8 +143,7 @@ function help_metadata()
[$task] = explode('/', $rel);
if (!empty($index_map[$rel])) {
$src .= $index_map[$rel];
- }
- elseif (!empty($index_map[$task])) {
+ } elseif (!empty($index_map[$task])) {
$src .= $index_map[$task];
}
@@ -158,7 +152,7 @@ function help_metadata()
return $content;
}
- function error_page($args)
+ public function error_page($args)
{
$rcmail = rcmail::get_instance();
diff --git a/plugins/help/tests/Help.php b/plugins/help/tests/Help.php
index db6b72953a..3234a3e080 100644
--- a/plugins/help/tests/Help.php
+++ b/plugins/help/tests/Help.php
@@ -10,7 +10,7 @@ public static function setUpBeforeClass(): void
/**
* Plugin object construction test
*/
- function test_constructor()
+ public function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new help($rcube->plugins);
@@ -22,7 +22,7 @@ function test_constructor()
/**
* Test help_metadata()
*/
- function test_help_metadata()
+ public function test_help_metadata()
{
$rcube = rcube::get_instance();
$plugin = new help($rcube->plugins);
diff --git a/plugins/hide_blockquote/hide_blockquote.php b/plugins/hide_blockquote/hide_blockquote.php
index 1d8932fe06..b275c6ced8 100644
--- a/plugins/hide_blockquote/hide_blockquote.php
+++ b/plugins/hide_blockquote/hide_blockquote.php
@@ -20,7 +20,7 @@ class hide_blockquote extends rcube_plugin
/**
* Plugin initialization
*/
- function init()
+ public function init()
{
$rcmail = rcmail::get_instance();
@@ -37,8 +37,7 @@ function init()
// set env variable for client
$rcmail->output->set_env('blockquote_limit', $limit);
- }
- elseif ($rcmail->task == 'settings') {
+ } elseif ($rcmail->task == 'settings') {
$dont_override = $rcmail->config->get('dont_override', []);
if (!in_array('hide_blockquote_limit', $dont_override)) {
$this->add_hook('preferences_list', [$this, 'prefs_table']);
@@ -54,7 +53,7 @@ function init()
*
* @return array Modified hook arguments
*/
- function prefs_table($args)
+ public function prefs_table($args)
{
if ($args['section'] != 'mailview') {
return $args;
@@ -66,10 +65,10 @@ function prefs_table($args)
$limit = (int) $rcmail->config->get('hide_blockquote_limit');
$field_id = 'hide_blockquote_limit';
$input = new html_inputfield([
- 'name' => '_' . $field_id,
- 'id' => $field_id,
- 'size' => 5,
- 'class' => 'form-control',
+ 'name' => '_' . $field_id,
+ 'id' => $field_id,
+ 'size' => 5,
+ 'class' => 'form-control',
]);
$args['blocks']['main']['options']['hide_blockquote_limit'] = [
@@ -87,7 +86,7 @@ function prefs_table($args)
*
* @return array Modified hook arguments
*/
- function prefs_save($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);
diff --git a/plugins/hide_blockquote/tests/HideBlockquote.php b/plugins/hide_blockquote/tests/HideBlockquote.php
index 364d658cf6..f5bd627948 100644
--- a/plugins/hide_blockquote/tests/HideBlockquote.php
+++ b/plugins/hide_blockquote/tests/HideBlockquote.php
@@ -10,7 +10,7 @@ public static function setUpBeforeClass(): void
/**
* Plugin object construction test
*/
- function test_constructor()
+ public function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new hide_blockquote($rcube->plugins);
@@ -24,7 +24,7 @@ function test_constructor()
/**
* Test prefs_table() method
*/
- function test_prefs_table()
+ public function test_prefs_table()
{
$rcube = rcube::get_instance();
$plugin = new hide_blockquote($rcube->plugins);
@@ -47,7 +47,7 @@ function test_prefs_table()
/**
* Test prefs_save() method
*/
- function test_prefs_save()
+ public function test_prefs_save()
{
$rcube = rcube::get_instance();
$plugin = new hide_blockquote($rcube->plugins);
diff --git a/plugins/http_authentication/http_authentication.php b/plugins/http_authentication/http_authentication.php
index 39ed72c582..537604bbb7 100644
--- a/plugins/http_authentication/http_authentication.php
+++ b/plugins/http_authentication/http_authentication.php
@@ -20,7 +20,7 @@ class http_authentication extends rcube_plugin
{
private $redirect_query;
- function init()
+ public function init()
{
$this->add_hook('startup', [$this, 'startup']);
$this->add_hook('authenticate', [$this, 'authenticate']);
@@ -28,7 +28,7 @@ function init()
$this->add_hook('login_after', [$this, 'login']);
}
- function startup($args)
+ public function startup($args)
{
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$rcmail = rcmail::get_instance();
@@ -50,7 +50,7 @@ function startup($args)
return $args;
}
- function authenticate($args)
+ public function authenticate($args)
{
// Load plugin's config file
$this->load_config();
@@ -79,7 +79,7 @@ function authenticate($args)
return $args;
}
- function logout($args)
+ 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']) {
@@ -90,14 +90,14 @@ function logout($args)
}
}
- static function shutdown()
+ 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');
}
- function login($args)
+ public function login($args)
{
// Redirect to the previous QUERY_STRING
if ($this->redirect_query) {
diff --git a/plugins/http_authentication/tests/HttpAuthentication.php b/plugins/http_authentication/tests/HttpAuthentication.php
index b968daa7ce..99700a4108 100644
--- a/plugins/http_authentication/tests/HttpAuthentication.php
+++ b/plugins/http_authentication/tests/HttpAuthentication.php
@@ -10,7 +10,7 @@ public static function setUpBeforeClass(): void
/**
* Plugin object construction test
*/
- function test_constructor()
+ public function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new http_authentication($rcube->plugins);
diff --git a/plugins/identicon/identicon.php b/plugins/identicon/identicon.php
index 2eb5de6097..4c77bcf7ac 100644
--- a/plugins/identicon/identicon.php
+++ b/plugins/identicon/identicon.php
@@ -25,7 +25,7 @@ class identicon extends rcube_plugin
/**
* Plugin initialization.
*/
- function init()
+ public function init()
{
$this->add_hook('contact_photo', [$this, 'contact_photo']);
}
@@ -33,7 +33,7 @@ function init()
/**
* 'contact_photo' hook handler to inject an identicon image
*/
- function contact_photo($args)
+ public function contact_photo($args)
{
// pre-conditions, exit if photo already exists or invalid input
if (!empty($args['url']) || !empty($args['data'])
@@ -60,8 +60,7 @@ function contact_photo($args)
if (!empty($args['attrib']['bg-color'])) {
$bgcolor = $args['attrib']['bg-color'];
- }
- else {
+ } else {
$bgcolor = rcube_utils::get_input_string('_bgcolor', rcube_utils::INPUT_GET);
}
@@ -73,8 +72,7 @@ function contact_photo($args)
$mimetype = $identicon->getMimetype();
$args['url'] = sprintf('data:%s;base64,%s', $mimetype, $icon);
}
- }
- else {
+ } else {
// send the icon to the browser
if ($identicon->sendOutput()) {
exit;
diff --git a/plugins/identicon/identicon_engine.php b/plugins/identicon/identicon_engine.php
index a938a112ad..cdcf00080d 100644
--- a/plugins/identicon/identicon_engine.php
+++ b/plugins/identicon/identicon_engine.php
@@ -20,15 +20,15 @@ class identicon_engine
'#FFEB3B', '#FFC107', '#FF9800', '#FF5722', '#795548', '#607D8B',
];
private $grid = [
- 0, 1, 2, 1, 0,
- 3, 4, 5, 4, 3,
- 6, 7, 8, 7, 6,
- 9, 10, 11, 10, 9,
+ 0, 1, 2, 1, 0,
+ 3, 4, 5, 4, 3,
+ 6, 7, 8, 7, 6,
+ 9, 10, 11, 10, 9,
12, 13, 14, 13, 12,
];
- const GRID_SIZE = 5;
- const ICON_SIZE = 150;
+ public const GRID_SIZE = 5;
+ public const ICON_SIZE = 150;
/**
@@ -55,8 +55,7 @@ public function __construct($ident, $size = null, $bgcolor = null)
$bgcolor = "#{$bgcolor}";
}
$this->bgcolor = $bgcolor;
- }
- elseif ($bgcolor === 'transparent') {
+ } elseif ($bgcolor === 'transparent') {
$this->bgcolor = $bgcolor;
}
}
@@ -132,8 +131,7 @@ private function generate()
// really generate the image using supported methods
if (function_exists('imagepng')) {
$this->generateGD();
- }
- else {
+ } else {
// log an error
$error = [
'code' => 500,
@@ -158,8 +156,7 @@ private function generateGD()
if ($this->bgcolor === 'transparent') {
$bgcolor = imagecolorallocatealpha($image, 0, 0, 0, 127);
imagesavealpha($image, true);
- }
- else {
+ } else {
$bgcolor = $this->toRGB($this->bgcolor);
$bgcolor = imagecolorallocate($image, $bgcolor[0], $bgcolor[1], $bgcolor[2]);
}
diff --git a/plugins/identicon/tests/Identicon.php b/plugins/identicon/tests/Identicon.php
index 777cfe52ff..dd30515519 100644
--- a/plugins/identicon/tests/Identicon.php
+++ b/plugins/identicon/tests/Identicon.php
@@ -10,7 +10,7 @@ public static function setUpBeforeCLass(): void
/**
* Plugin object construction test
*/
- function test_constructor()
+ public function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new identicon($rcube->plugins);
diff --git a/plugins/identicon/tests/IdenticonEngine.php b/plugins/identicon/tests/IdenticonEngine.php
index b92e1c1063..8b8513c902 100644
--- a/plugins/identicon/tests/IdenticonEngine.php
+++ b/plugins/identicon/tests/IdenticonEngine.php
@@ -10,7 +10,7 @@ public static function setUpBeforeClass(): void
/**
* Test icon generation
*/
- function test_icon_generation()
+ public function test_icon_generation()
{
if (!function_exists('imagepng')) {
$this->markTestSkipped();
diff --git a/plugins/identity_select/identity_select.php b/plugins/identity_select/identity_select.php
index f248012270..fee22c0040 100644
--- a/plugins/identity_select/identity_select.php
+++ b/plugins/identity_select/identity_select.php
@@ -24,7 +24,7 @@ class identity_select extends rcube_plugin
public $task = 'mail';
- function init()
+ public function init()
{
$this->add_hook('identity_select', [$this, 'select']);
$this->add_hook('storage_init', [$this, 'storage_init']);
@@ -33,7 +33,7 @@ function init()
/**
* Adds additional headers to supported headers list
*/
- function storage_init($p)
+ public function storage_init($p)
{
$rcmail = rcmail::get_instance();
@@ -42,8 +42,7 @@ function storage_init($p)
if (isset($p['fetch_headers'])) {
$p['fetch_headers'] .= ' ' . $add_headers;
- }
- else {
+ } else {
$p['fetch_headers'] = $add_headers;
}
}
@@ -54,7 +53,7 @@ function storage_init($p)
/**
* Identity selection
*/
- function select($p)
+ public function select($p)
{
if ($p['selected'] !== null || empty($p['message']->headers)) {
return $p;
diff --git a/plugins/identity_select/tests/IdentitySelect.php b/plugins/identity_select/tests/IdentitySelect.php
index e9b63e2b62..1d2fc36807 100644
--- a/plugins/identity_select/tests/IdentitySelect.php
+++ b/plugins/identity_select/tests/IdentitySelect.php
@@ -10,7 +10,7 @@ public static function setUpBeforeClass(): void
/**
* Plugin object construction test
*/
- function test_constructor()
+ public function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new identity_select($rcube->plugins);
diff --git a/plugins/jqueryui/config.inc.php.dist b/plugins/jqueryui/config.inc.php.dist
index c349f5e698..fc689916e9 100644
--- a/plugins/jqueryui/config.inc.php.dist
+++ b/plugins/jqueryui/config.inc.php.dist
@@ -5,6 +5,6 @@ $config['jquery_ui_i18n'] = ['datepicker'];
// map Roundcube skins with jquery-ui themes here
$config['jquery_ui_skin_map'] = [
- 'larry' => 'larry',
- 'default' => 'elastic',
+ 'larry' => 'larry',
+ 'default' => 'elastic',
];
diff --git a/plugins/jqueryui/jqueryui.php b/plugins/jqueryui/jqueryui.php
index 3258b8b3f4..1313d2e4ee 100644
--- a/plugins/jqueryui/jqueryui.php
+++ b/plugins/jqueryui/jqueryui.php
@@ -68,8 +68,7 @@ public function init()
foreach ($jquery_ui_i18n as $package) {
if (self::asset_exists("js/i18n/$package-$lang_l.js", false)) {
$this->include_script("js/i18n/$package-$lang_l.js");
- }
- elseif ($lang_s != 'en' && self::asset_exists("js/i18n/$package-$lang_s.js", false)) {
+ } elseif ($lang_s != 'en' && self::asset_exists("js/i18n/$package-$lang_s.js", false)) {
$this->include_script("js/i18n/$package-$lang_s.js");
}
}
@@ -78,12 +77,12 @@ public function init()
// Date format for datepicker
$date_format = $date_format_localized = $rcmail->config->get('date_format', 'Y-m-d');
$date_format = strtr($date_format, [
- 'y' => 'y',
- 'Y' => 'yy',
- 'm' => 'mm',
- 'n' => 'm',
- 'd' => 'dd',
- 'j' => 'd',
+ 'y' => 'y',
+ 'Y' => 'yy',
+ 'm' => 'mm',
+ 'n' => 'm',
+ 'd' => 'dd',
+ 'j' => 'd',
]);
$replaces = ['Y' => 'yyyy', 'y' => 'yy', 'm' => 'mm', 'd' => 'dd', 'j' => 'd', 'n' => 'm'];
diff --git a/plugins/jqueryui/tests/Jqueryui.php b/plugins/jqueryui/tests/Jqueryui.php
index f6dfd732e8..079d028ed2 100644
--- a/plugins/jqueryui/tests/Jqueryui.php
+++ b/plugins/jqueryui/tests/Jqueryui.php
@@ -10,7 +10,7 @@ public static function setUpBeforeClass(): void
/**
* Plugin object construction test
*/
- function test_constructor()
+ public function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new jqueryui($rcube->plugins);
diff --git a/plugins/krb_authentication/krb_authentication.php b/plugins/krb_authentication/krb_authentication.php
index 76004443d0..ed6bb6a67d 100644
--- a/plugins/krb_authentication/krb_authentication.php
+++ b/plugins/krb_authentication/krb_authentication.php
@@ -18,7 +18,7 @@ class krb_authentication extends rcube_plugin
/**
* Plugin initialization
*/
- function init()
+ public function init()
{
$this->add_hook('startup', [$this, 'startup']);
$this->add_hook('authenticate', [$this, 'authenticate']);
@@ -31,15 +31,14 @@ function init()
/**
* Startup hook handler
*/
- function startup($args)
+ public function startup($args)
{
if (!empty($_SERVER['REMOTE_USER']) && !empty($_SERVER['KRB5CCNAME'])) {
// handle login action
if (empty($_SESSION['user_id'])) {
$args['action'] = 'login';
$this->redirect_query = $_SERVER['QUERY_STRING'];
- }
- else {
+ } else {
$_SESSION['password'] = null;
}
}
@@ -50,7 +49,7 @@ function startup($args)
/**
* Authenticate hook handler
*/
- function authenticate($args)
+ public function authenticate($args)
{
if (!empty($_SERVER['REMOTE_USER']) && !empty($_SERVER['KRB5CCNAME'])) {
// Load plugin's config file
@@ -78,7 +77,7 @@ function authenticate($args)
/**
* login_after hook handler
*/
- function login($args)
+ public function login($args)
{
// Redirect to the previous QUERY_STRING
if ($this->redirect_query) {
@@ -92,7 +91,7 @@ function login($args)
/**
* Storage_connect hook handler
*/
- function storage_connect($args)
+ public function storage_connect($args)
{
if (!empty($_SERVER['REMOTE_USER']) && !empty($_SERVER['KRB5CCNAME'])) {
$args['gssapi_context'] = $this->gssapi_context('imap');
@@ -106,7 +105,7 @@ function storage_connect($args)
/**
* managesieve_connect hook handler
*/
- function managesieve_connect($args)
+ public function managesieve_connect($args)
{
if (
(!isset($args['auth_type']) || $args['auth_type'] == 'GSSAPI')
@@ -123,7 +122,7 @@ function managesieve_connect($args)
/**
* smtp_connect hook handler
*/
- function smtp_connect($args)
+ public function smtp_connect($args)
{
if (
(!isset($args['smtp_auth_type']) || $args['smtp_auth_type'] == 'GSSAPI')
diff --git a/plugins/krb_authentication/tests/KrbAuthentication.php b/plugins/krb_authentication/tests/KrbAuthentication.php
index b4424a949b..192a30c24c 100644
--- a/plugins/krb_authentication/tests/KrbAuthentication.php
+++ b/plugins/krb_authentication/tests/KrbAuthentication.php
@@ -10,7 +10,7 @@ public static function setUpBeforeClass(): void
/**
* Plugin object construction test
*/
- function test_constructor()
+ public function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new krb_authentication($rcube->plugins);
diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve.php b/plugins/managesieve/lib/Roundcube/rcube_sieve.php
index bf158fe88d..5fad848af6 100644
--- a/plugins/managesieve/lib/Roundcube/rcube_sieve.php
+++ b/plugins/managesieve/lib/Roundcube/rcube_sieve.php
@@ -34,15 +34,15 @@ class rcube_sieve
public $script; // rcube_sieve_script object
public $current; // name of currently loaded script
- const ERROR_CONNECTION = 1;
- const ERROR_LOGIN = 2;
- const ERROR_NOT_EXISTS = 3; // script not exists
- const ERROR_INSTALL = 4; // script installation
- const ERROR_ACTIVATE = 5; // script activation
- const ERROR_DELETE = 6; // script deletion
- const ERROR_INTERNAL = 7; // internal error
- const ERROR_DEACTIVATE = 8; // script activation
- const ERROR_OTHER = 255; // other/unknown error
+ public const ERROR_CONNECTION = 1;
+ public const ERROR_LOGIN = 2;
+ public const ERROR_NOT_EXISTS = 3; // script not exists
+ public const ERROR_INSTALL = 4; // script installation
+ public const ERROR_ACTIVATE = 5; // script activation
+ public const ERROR_DELETE = 6; // script deletion
+ public const ERROR_INTERNAL = 7; // internal error
+ public const ERROR_DEACTIVATE = 8; // script activation
+ public const ERROR_OTHER = 255; // other/unknown error
/**
@@ -186,8 +186,7 @@ public function save_script($name, $content = null)
if ($res === 1) {
if (count($matches) > 2) {
$this->errorLines[] = ['line' => $matches[1], 'msg' => $matches[2]];
- }
- else {
+ } else {
$this->errorLines[] = ['line' => $matches[1], 'msg' => null];
}
}
diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
index 842c61e67d..a7eaed9b92 100644
--- a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
+++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
@@ -61,15 +61,15 @@ class rcube_sieve_engine
1 => 'notifyimportancehigh',
];
- const VERSION = '9.5';
- const PROGNAME = 'Roundcube (Managesieve)';
- const PORT = 4190;
+ public const VERSION = '9.5';
+ public const PROGNAME = 'Roundcube (Managesieve)';
+ public const PORT = 4190;
/**
* Class constructor
*/
- function __construct($plugin)
+ public function __construct($plugin)
{
$this->rc = rcube::get_instance();
$this->plugin = $plugin;
@@ -79,15 +79,15 @@ function __construct($plugin)
/**
* Loads configuration, initializes plugin (including sieve connection)
*/
- function start($mode = null)
+ public function start($mode = null)
{
// register UI objects
$this->rc->output->add_handlers([
- 'filterslist' => [$this, 'filters_list'],
- 'filtersetslist' => [$this, 'filtersets_list'],
- 'filterform' => [$this, 'filter_form'],
- 'filtersetform' => [$this, 'filterset_form'],
- 'filterseteditraw' => [$this, 'filterset_editraw'],
+ 'filterslist' => [$this, 'filters_list'],
+ 'filtersetslist' => [$this, 'filtersets_list'],
+ 'filterform' => [$this, 'filter_form'],
+ 'filtersetform' => [$this, 'filterset_form'],
+ 'filterseteditraw' => [$this, 'filterset_editraw'],
]);
$this->disabled_actions = (array) $this->rc->config->get('managesieve_disabled_actions');
@@ -110,8 +110,7 @@ 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);
- }
- elseif (!empty($_SESSION['managesieve_current'])) {
+ } elseif (!empty($_SESSION['managesieve_current'])) {
$script_name = $_SESSION['managesieve_current'];
}
}
@@ -140,8 +139,7 @@ function start($mode = null)
// to disable 'Add filter' button set env variable
$this->rc->output->set_env('filterconnerror', true);
$this->script = [];
- }
- else {
+ } else {
$this->exts = $this->sieve->get_extensions();
$this->init_script();
$this->rc->output->set_env('currentset', $this->sieve->current);
@@ -169,17 +167,17 @@ public function connect($username, $password)
$host = rcube_utils::parse_host($host);
$plugin = $this->rc->plugins->exec_hook('managesieve_connect', [
- 'user' => $username,
- 'password' => $password,
- 'host' => $host,
- 'auth_type' => $this->rc->config->get('managesieve_auth_type'),
- 'disabled' => $this->rc->config->get('managesieve_disabled_extensions'),
- 'debug' => $this->rc->config->get('managesieve_debug', false),
- 'auth_cid' => $this->rc->config->get('managesieve_auth_cid'),
- 'auth_pw' => $this->rc->config->get('managesieve_auth_pw'),
- 'socket_options' => $this->rc->config->get('managesieve_conn_options'),
- 'gssapi_context' => null,
- 'gssapi_cn' => null,
+ 'user' => $username,
+ 'password' => $password,
+ 'host' => $host,
+ 'auth_type' => $this->rc->config->get('managesieve_auth_type'),
+ 'disabled' => $this->rc->config->get('managesieve_disabled_extensions'),
+ 'debug' => $this->rc->config->get('managesieve_debug', false),
+ 'auth_cid' => $this->rc->config->get('managesieve_auth_cid'),
+ 'auth_pw' => $this->rc->config->get('managesieve_auth_pw'),
+ 'socket_options' => $this->rc->config->get('managesieve_conn_options'),
+ 'gssapi_context' => null,
+ 'gssapi_cn' => null,
]);
[$host, $scheme, $port] = rcube_utils::parse_host_uri($plugin['host']);
@@ -222,12 +220,11 @@ public function connect($username, $password)
if ($error) {
rcube::raise_error([
- 'code' => 403,
- 'file' => __FILE__,
- 'line' => __LINE__,
- 'message' => "Unable to connect to managesieve on $host:$port",
- ], true, false
- );
+ 'code' => 403,
+ 'file' => __FILE__,
+ 'line' => __LINE__,
+ 'message' => "Unable to connect to managesieve on $host:$port",
+ ], true, false);
}
return $error;
@@ -249,11 +246,9 @@ protected function load_script($script_name = null)
// get (first) active script
if (!empty($this->active)) {
$script_name = $this->active[0];
- }
- elseif ($list) {
+ } elseif ($list) {
$script_name = $list[0];
- }
- else {
+ } else {
// if script does not exist create one with default content
$this->create_default_script();
}
@@ -269,7 +264,7 @@ protected function load_script($script_name = null)
/**
* User interface actions handler
*/
- function actions()
+ public function actions()
{
$error = $this->start();
@@ -288,17 +283,14 @@ function actions()
if ($result === true) {
$this->rc->output->show_message('managesieve.filterdeleted', 'confirmation');
$this->rc->output->command('managesieve_updatelist', 'del', ['id' => $fid]);
- }
- else {
+ } else {
$this->rc->output->show_message('managesieve.filterdeleteerror', 'error');
}
}
- }
- else {
+ } else {
$this->rc->output->show_message('managesieve.disabledaction', 'error');
}
- }
- elseif ($action == 'move' && !$error) {
+ } elseif ($action == 'move' && !$error) {
if (isset($this->script[$fid])) {
$to = (int) rcube_utils::get_input_value('_to', rcube_utils::INPUT_POST);
$rule = $this->script[$fid];
@@ -310,8 +302,7 @@ function actions()
// add at target position
if ($to >= count($this->script)) {
$this->script[] = $rule;
- }
- else {
+ } else {
$script = [];
foreach ($this->script as $idx => $r) {
if ($idx == $to) {
@@ -331,13 +322,11 @@ function actions()
$this->rc->output->show_message('managesieve.moved', 'confirmation');
$this->rc->output->command('managesieve_updatelist', 'list',
['list' => $result, 'clear' => true, 'set' => $to]);
- }
- else {
+ } else {
$this->rc->output->show_message('managesieve.moveerror', 'error');
}
}
- }
- elseif ($action == 'act' && !$error) {
+ } elseif ($action == 'act' && !$error) {
if (isset($this->script[$fid])) {
$rule = $this->script[$fid];
$disabled = !empty($rule['disabled']);
@@ -351,24 +340,20 @@ function actions()
if ($result === true) {
if ($rule['disabled']) {
$this->rc->output->show_message('managesieve.deactivated', 'confirmation');
- }
- else {
+ } else {
$this->rc->output->show_message('managesieve.activated', 'confirmation');
}
$this->rc->output->command('managesieve_updatelist', 'update',
['id' => $fid, 'disabled' => $rule['disabled']]);
- }
- else {
+ } else {
if ($rule['disabled']) {
$this->rc->output->show_message('managesieve.deactivateerror', 'error');
- }
- else {
+ } else {
$this->rc->output->show_message('managesieve.activateerror', 'error');
}
}
}
- }
- elseif ($action == 'setact' && !$error) {
+ } 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);
$result = $this->activate_script($script_name);
@@ -379,16 +364,13 @@ function actions()
$this->rc->output->show_message('managesieve.setactivated', 'confirmation');
$this->rc->output->command('managesieve_updatelist', 'setact',
['name' => $script_name, 'active' => true, 'all' => !$kep14]);
- }
- else {
+ } else {
$this->rc->output->show_message('managesieve.setactivateerror', 'error');
}
- }
- else {
+ } else {
$this->rc->output->show_message('managesieve.disabledaction', 'error');
}
- }
- elseif ($action == 'deact' && !$error) {
+ } 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);
$result = $this->deactivate_script($script_name);
@@ -398,16 +380,13 @@ function actions()
$this->rc->output->show_message('managesieve.setdeactivated', 'confirmation');
$this->rc->output->command('managesieve_updatelist', 'setact',
['name' => $script_name, 'active' => false]);
- }
- else {
+ } else {
$this->rc->output->show_message('managesieve.setdeactivateerror', 'error');
}
- }
- else {
+ } else {
$this->rc->output->show_message('managesieve.disabledaction', 'error');
}
- }
- elseif ($action == 'setdel' && !$error) {
+ } 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);
$result = $this->remove_script($script_name);
@@ -416,16 +395,13 @@ function actions()
$this->rc->output->show_message('managesieve.setdeleted', 'confirmation');
$this->rc->output->command('managesieve_updatelist', 'setdel', ['name' => $script_name]);
$this->rc->session->remove('managesieve_current');
- }
- else {
+ } else {
$this->rc->output->show_message('managesieve.setdeleteerror', 'error');
}
- }
- else {
+ } else {
$this->rc->output->show_message('managesieve.disabledaction', 'error');
}
- }
- elseif ($action == 'setget') {
+ } elseif ($action == 'setget') {
if (!in_array('download_set', $this->disabled_actions)) {
$this->rc->request_security_check(rcube_utils::INPUT_GET);
@@ -439,35 +415,30 @@ function actions()
exit;
}
- }
- elseif ($action == 'list') {
+ } elseif ($action == 'list') {
$result = $this->list_rules();
$this->rc->output->command('managesieve_updatelist', 'list', ['list' => $result]);
- }
- elseif ($action == 'ruleadd') {
+ } elseif ($action == 'ruleadd') {
$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') {
+ } elseif ($action == 'actionadd') {
$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') {
+ } elseif ($action == 'addresses') {
$aid = rcube_utils::get_input_string('_aid', rcube_utils::INPUT_POST);
$this->rc->output->command('managesieve_vacation_addresses_update', $aid, $this->user_emails());
}
$this->rc->output->send();
- }
- elseif ($this->rc->task == 'mail') {
+ } elseif ($this->rc->task == 'mail') {
// Initialize the form
$rules = rcube_utils::get_input_value('r', rcube_utils::INPUT_GET);
if (!empty($rules)) {
@@ -497,7 +468,7 @@ function actions()
$this->send();
}
- function saveraw()
+ public function saveraw()
{
// Init plugin and handle managesieve connection
$error = $this->start();
@@ -512,8 +483,7 @@ function saveraw()
if (count($errorLines) > 0) {
$this->rc->output->set_env('sieve_errors', $errorLines);
}
- }
- else {
+ } else {
$this->rc->output->show_message('managesieve.setupdated', 'confirmation');
$this->rc->output->command('parent.managesieve_updatelist', 'refresh');
}
@@ -521,38 +491,36 @@ function saveraw()
$this->send();
}
- function save()
+ public function save()
{
// Init plugin and handle managesieve connection
$error = $this->start();
// get request size limits (#1488648)
$max_post = max([
- ini_get('max_input_vars'),
- ini_get('suhosin.request.max_vars'),
- ini_get('suhosin.post.max_vars'),
+ ini_get('max_input_vars'),
+ ini_get('suhosin.request.max_vars'),
+ ini_get('suhosin.post.max_vars'),
]);
$max_depth = max([
- ini_get('suhosin.request.max_array_depth'),
- ini_get('suhosin.post.max_array_depth'),
+ ini_get('suhosin.request.max_array_depth'),
+ ini_get('suhosin.post.max_array_depth'),
]);
// check request size limit
if ($max_post && count($_POST, \COUNT_RECURSIVE) >= $max_post) {
rcube::raise_error([
- 'code' => 500, 'file' => __FILE__, 'line' => __LINE__,
- 'message' => 'Request size limit exceeded (one of max_input_vars/suhosin.request.max_vars/suhosin.post.max_vars)',
- ], true, false
- );
+ 'code' => 500, 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => 'Request size limit exceeded (one of max_input_vars/suhosin.request.max_vars/suhosin.post.max_vars)',
+ ], true, false);
$this->rc->output->show_message('managesieve.filtersaveerror', 'error');
}
// check request depth limits
elseif ($max_depth && count($_POST['_header']) > $max_depth) {
rcube::raise_error([
- 'code' => 500, 'file' => __FILE__, 'line' => __LINE__,
- 'message' => 'Request size limit exceeded (one of suhosin.request.max_array_depth/suhosin.post.max_array_depth)',
- ], true, false
- );
+ 'code' => 500, 'file' => __FILE__, 'line' => __LINE__,
+ 'message' => 'Request size limit exceeded (one of suhosin.request.max_array_depth/suhosin.post.max_array_depth)',
+ ], true, false);
$this->rc->output->show_message('managesieve.filtersaveerror', 'error');
}
// filters set add action
@@ -567,23 +535,17 @@ function save()
if (in_array('new_set', $this->disabled_actions)) {
$error = 'managesieve.disabledaction';
- }
- elseif (!$name) {
+ } elseif (!$name) {
$this->errors['name'] = $this->plugin->gettext('cannotbeempty');
- }
- elseif (mb_strlen($name) > 128) {
+ } elseif (mb_strlen($name) > 128) {
$this->errors['name'] = $this->plugin->gettext('nametoolong');
- }
- elseif (!empty($exceptions) && in_array($name, (array) $exceptions)) {
+ } elseif (!empty($exceptions) && in_array($name, (array) $exceptions)) {
$this->errors['name'] = $this->plugin->gettext('namereserved');
- }
- elseif (!empty($kolab) && in_array($name_uc, ['MASTER', 'USER', 'MANAGEMENT'])) {
+ } elseif (!empty($kolab) && in_array($name_uc, ['MASTER', 'USER', 'MANAGEMENT'])) {
$this->errors['name'] = $this->plugin->gettext('namereserved');
- }
- elseif (in_array($name, $list)) {
+ } elseif (in_array($name, $list)) {
$this->errors['name'] = $this->plugin->gettext('setexist');
- }
- elseif ($from == 'file') {
+ } elseif ($from == 'file') {
// from file
if (is_uploaded_file($_FILES['_file']['tmp_name'])) {
$file = file_get_contents($_FILES['_file']['tmp_name']);
@@ -594,13 +556,11 @@ function save()
if (!$this->save_script($name)) {
$this->errors['file'] = $this->plugin->gettext('setcreateerror');
}
- }
- else {
+ } else {
// upload failed
rcmail_action::upload_error($_FILES['_file']['error']);
}
- }
- elseif (!$this->sieve->copy($name, $from == 'set' ? $copy : '')) {
+ } elseif (!$this->sieve->copy($name, $from == 'set' ? $copy : '')) {
$error = 'managesieve.setcreateerror';
}
@@ -614,11 +574,9 @@ function save()
$this->rc->output->show_message('managesieve.setcreated', 'confirmation');
$this->rc->output->command('parent.managesieve_updatelist', 'setadd',
['name' => $name, 'index' => $index]);
- }
- elseif (!empty($msg)) {
+ } elseif (!empty($msg)) {
$this->rc->output->command('display_message', $msg, 'error');
- }
- elseif ($error) {
+ } elseif ($error) {
$this->rc->output->show_message($error, 'error');
}
}
@@ -696,8 +654,7 @@ function save()
if ($name == '') {
$this->errors['name'] = $this->plugin->gettext('cannotbeempty');
- }
- else {
+ } else {
foreach ($this->script as $idx => $rule) {
if ($rule['name'] == $name && $idx != $fid) {
$this->errors['name'] = $this->plugin->gettext('ruleexist');
@@ -710,8 +667,7 @@ function save()
// rules
if ($join == 'any') {
$this->form['tests'][0]['test'] = 'true';
- }
- else {
+ } else {
foreach ($headers as $idx => $header) {
// targets are indexed differently (assume form order)
$target = $this->strip_value($targets[$idx], true);
@@ -730,16 +686,13 @@ function save()
if ($sizetarget === '') {
$this->errors['tests'][$i]['sizetarget'] = $this->plugin->gettext('cannotbeempty');
- }
- elseif (!preg_match('/^[0-9]+(K|M|G)?$/i', $sizetarget . $sizeitem, $m)) {
+ } elseif (!preg_match('/^[0-9]+(K|M|G)?$/i', $sizetarget . $sizeitem, $m)) {
$this->errors['tests'][$i]['sizetarget'] = $this->plugin->gettext('forbiddenchars');
$this->form['tests'][$i]['item'] = $sizeitem;
- }
- else {
+ } else {
$this->form['tests'][$i]['arg'] .= $m[1];
}
- }
- elseif ($header == 'spamtest') {
+ } elseif ($header == 'spamtest') {
$spamtestop = $this->strip_value($spamtestops[$idx]);
$spamtesttarget = $this->strip_value($spamtesttargets[$idx]);
$comparator = 'i;ascii-numeric';
@@ -755,12 +708,10 @@ function save()
if ($spamtesttarget === '') {
$this->errors['tests'][$i]['spamtesttarget'] = $this->plugin->gettext('cannotbeempty');
- }
- elseif (!preg_match('/^([0-9]|10)$/i', $spamtesttarget)) {
+ } elseif (!preg_match('/^([0-9]|10)$/i', $spamtesttarget)) {
$this->errors['tests'][$i]['spamtesttarget'] = $this->plugin->gettext('forbiddenchars');
}
- }
- elseif ($header == 'currentdate') {
+ } elseif ($header == 'currentdate') {
$datepart = $this->strip_value($dateparts[$idx]);
$type = preg_replace('/^not/', '', $operator);
@@ -777,15 +728,13 @@ function save()
if ($type != 'exists') {
if (empty($target)) {
$this->errors['tests'][$i]['target'] = $this->plugin->gettext('cannotbeempty');
- }
- elseif (strpos($type, 'count-') === 0) {
+ } elseif (strpos($type, 'count-') === 0) {
foreach ($target as $arg) {
if (preg_match('/[^0-9]/', $arg)) {
$this->errors['tests'][$i]['target'] = $this->plugin->gettext('forbiddenchars');
}
}
- }
- elseif (strpos($type, 'value-') === 0) {
+ } elseif (strpos($type, 'value-') === 0) {
// Some date/time formats do not support i;ascii-numeric comparator
if ($comparator == 'i;ascii-numeric' && in_array($datepart, ['date', 'time', 'iso8601', 'std11'])) {
$comparator = '';
@@ -801,8 +750,7 @@ function save()
}
}
}
- }
- elseif ($header == 'date') {
+ } elseif ($header == 'date') {
$datepart = $this->strip_value($dateparts[$idx]);
$dateheader = $this->strip_value($dateheaders[$idx]);
$index = $this->strip_value($indexes[$idx]);
@@ -822,8 +770,7 @@ function save()
if (empty($dateheader)) {
$dateheader = 'Date';
- }
- elseif (!preg_match('/^[\x21-\x39\x41-\x7E]+$/i', $dateheader)) {
+ } elseif (!preg_match('/^[\x21-\x39\x41-\x7E]+$/i', $dateheader)) {
$this->errors['tests'][$i]['dateheader'] = $this->plugin->gettext('forbiddenchars');
}
@@ -837,15 +784,13 @@ function save()
if ($type != 'exists') {
if (empty($target)) {
$this->errors['tests'][$i]['target'] = $this->plugin->gettext('cannotbeempty');
- }
- elseif (strpos($type, 'count-') === 0) {
+ } elseif (strpos($type, 'count-') === 0) {
foreach ($target as $arg) {
if (preg_match('/[^0-9]/', $arg)) {
$this->errors['tests'][$i]['target'] = $this->plugin->gettext('forbiddenchars');
}
}
- }
- elseif (strpos($type, 'value-') === 0) {
+ } elseif (strpos($type, 'value-') === 0) {
// Some date/time formats do not support i;ascii-numeric comparator
if ($comparator == 'i;ascii-numeric' && in_array($datepart, ['date', 'time', 'iso8601', 'std11'])) {
$comparator = '';
@@ -861,8 +806,7 @@ function save()
}
}
}
- }
- elseif ($header == 'body') {
+ } elseif ($header == 'body') {
$trans = $this->strip_value($body_trans[$idx]);
$trans_type = $this->strip_value($body_types[$idx], true);
$type = preg_replace('/^not/', '', $operator);
@@ -883,16 +827,14 @@ function save()
if (empty($target) && $type != 'exists') {
$this->errors['tests'][$i]['target'] = $this->plugin->gettext('cannotbeempty');
- }
- elseif (preg_match('/^(value|count)-/', $type)) {
+ } elseif (preg_match('/^(value|count)-/', $type)) {
foreach ($target as $target_value) {
if (preg_match('/[^0-9]/', $target_value)) {
$this->errors['tests'][$i]['target'] = $this->plugin->gettext('forbiddenchars');
}
}
}
- }
- elseif ($header == 'message') {
+ } elseif ($header == 'message') {
$test = $this->strip_value($message[$idx]);
if (preg_match('/^not/', $test)) {
@@ -919,8 +861,7 @@ function save()
$this->errors['tests'][$i]['duplicate_uniqueid'] = $this->plugin->gettext('duplicate.conflict.err');
}
}
- }
- else {
+ } else {
$cust_header = $headers = $this->strip_value($cust_headers[$idx]);
$mod = $this->strip_value($mods[$idx]);
$mod_type = $this->strip_value($mod_types[$idx]);
@@ -947,8 +888,7 @@ function save()
if ($header == '...' || $header == 'string') {
if (!count($headers)) {
$this->errors['tests'][$i]['header'] = $this->plugin->gettext('cannotbeempty');
- }
- elseif ($header == '...') {
+ } elseif ($header == '...') {
foreach ($headers as $hr) {
// RFC2822: printable ASCII except colon
if (!preg_match('/^[\x21-\x39\x41-\x7E]+$/i', $hr)) {
@@ -977,8 +917,7 @@ function save()
if ($type == 'exists') {
$this->form['tests'][$i]['test'] = 'exists';
$this->form['tests'][$i]['arg'] = $header;
- }
- else {
+ } else {
if ($mod == 'address' || $mod == 'envelope') {
$found = false;
if (empty($this->errors['tests'][$i]['header'])) {
@@ -1000,8 +939,7 @@ function save()
if (empty($target)) {
$this->errors['tests'][$i]['target'] = $this->plugin->gettext('cannotbeempty');
- }
- elseif (preg_match('/^(value|count)-/', $type)) {
+ } elseif (preg_match('/^(value|count)-/', $type)) {
foreach ($target as $target_value) {
if (preg_match('/[^0-9]/', $target_value)) {
$this->errors['tests'][$i]['target'] = $this->plugin->gettext('forbiddenchars');
@@ -1086,8 +1024,7 @@ 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');
}
@@ -1117,8 +1054,7 @@ function save()
if (empty($this->form['actions'][$i]['name'])) {
$this->errors['actions'][$i]['name'] = $this->plugin->gettext('cannotbeempty');
- }
- elseif (!preg_match('/^[0-9a-z_-]+$/i', $this->form['actions'][$i]['name'])) {
+ } elseif (!preg_match('/^[0-9a-z_-]+$/i', $this->form['actions'][$i]['name'])) {
$this->errors['actions'][$i]['name'] = $this->plugin->gettext('forbiddenchars');
}
@@ -1137,12 +1073,10 @@ function save()
if (!empty($this->form['actions'][$i]['last'])) {
$this->errors['actions'][$i]['index'] = $this->plugin->gettext('lastindexempty');
}
- }
- elseif (!preg_match('/^[0-9]+$/i', $this->form['actions'][$i]['index'])) {
+ } elseif (!preg_match('/^[0-9]+$/i', $this->form['actions'][$i]['index'])) {
$this->errors['actions'][$i]['index'] = $this->plugin->gettext('forbiddenchars');
}
- }
- else {
+ } else {
if (empty($this->form['actions'][$i]['value'])) {
$this->errors['actions'][$i]['value'] = $this->plugin->gettext('cannotbeempty');
}
@@ -1167,8 +1101,7 @@ 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;
}
@@ -1196,8 +1129,7 @@ function save()
if (empty($varnames[$idx])) {
$this->errors['actions'][$i]['name'] = $this->plugin->gettext('cannotbeempty');
- }
- elseif (!preg_match('/^[0-9a-z_]+$/i', $varnames[$idx])) {
+ } elseif (!preg_match('/^[0-9a-z_]+$/i', $varnames[$idx])) {
$this->errors['actions'][$i]['name'] = $this->plugin->gettext('forbiddenchars');
}
@@ -1244,8 +1176,7 @@ function save()
if (!isset($this->script[$fid])) {
$fid = $this->sieve->script->add_rule($this->form);
$new = true;
- }
- else {
+ } else {
$fid = $this->sieve->script->update_rule($fid, $this->form);
}
@@ -1262,17 +1193,14 @@ function save()
'disabled' => $this->form['disabled'],
];
$this->rc->output->command('parent.managesieve_updatelist', isset($new) ? 'add' : 'update', $args);
- }
- else {
+ } else {
$this->rc->output->command('managesieve_dialog_close');
$this->rc->output->send('iframe');
}
- }
- else {
+ } else {
$this->rc->output->show_message('managesieve.filtersaveerror', 'error');
}
- }
- else {
+ } else {
$this->rc->output->show_message('managesieve.filterformerror', 'warning');
}
}
@@ -1286,15 +1214,12 @@ protected function send()
if (isset($_GET['_framed']) || isset($_POST['_framed'])) {
if (isset($_GET['_newset']) || isset($_POST['_newset'])) {
$this->rc->output->send('managesieve.setedit');
- }
- elseif (isset($_GET['_seteditraw']) || isset($_POST['_seteditraw'])) {
+ } elseif (isset($_GET['_seteditraw']) || isset($_POST['_seteditraw'])) {
$this->rc->output->send('managesieve.seteditraw');
- }
- else {
+ } else {
$this->rc->output->send('managesieve.filteredit');
}
- }
- else {
+ } else {
$this->rc->output->set_pagetitle($this->plugin->gettext('filters'));
$this->rc->output->send('managesieve.managesieve');
}
@@ -1303,7 +1228,7 @@ protected function send()
/**
* Return the filters list as HTML table
*/
- function filters_list($attrib)
+ public function filters_list($attrib)
{
// add id to message list table if not specified
if (empty($attrib['id'])) {
@@ -1331,7 +1256,7 @@ function filters_list($attrib)
/**
* Return the filters list as