From d18406a8bd637d32366a03ffa4d84552930c74bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Fri, 2 Feb 2024 07:53:34 +0100 Subject: [PATCH] Fix binary operator spaces CS (#9330) * align_single_space_minimal for assign * assign operators grouping is not supported by PHP CS Fixer * binary_operator_spaces = single_space * fix anonymous function on single line * align comments manually --- .php-cs-fixer.dist.php | 1 - bin/gc.sh | 2 +- bin/identity.sh | 2 +- bin/install-jsdeps.sh | 20 +- bin/installto.sh | 6 +- bin/moduserprefs.sh | 2 +- bin/msgexport.sh | 10 +- bin/msgimport.sh | 10 +- bin/update.sh | 6 +- bin/updatecss.sh | 22 +- config/defaults.inc.php | 28 +- config/mimetypes.php | 2 +- index.php | 20 +- installer/check.php | 90 +- installer/config.php | 2 +- installer/test.php | 22 +- plugins/acl/acl.php | 114 +-- plugins/acl/tests/Acl.php | 2 +- .../tests/AdditionalMessageHeaders.php | 2 +- plugins/archive/archive.php | 92 +- plugins/archive/tests/Archive.php | 14 +- .../attachment_reminder.php | 4 +- .../tests/AttachmentReminder.php | 10 +- plugins/autologon/autologon.php | 8 +- plugins/autologon/tests/Autologon.php | 2 +- plugins/autologout/tests/Autologout.php | 2 +- .../database_attachments.php | 24 +- .../tests/DatabaseAttachments.php | 2 +- plugins/debug_logger/debug_logger.php | 6 +- plugins/debug_logger/runlog/runlog.php | 52 +- plugins/debug_logger/tests/DebugLogger.php | 2 +- plugins/emoticons/emoticons.php | 28 +- plugins/emoticons/tests/Emoticons.php | 2 +- plugins/enigma/bin/import_keys.sh | 10 +- plugins/enigma/enigma.php | 66 +- plugins/enigma/lib/enigma_driver_gnupg.php | 70 +- plugins/enigma/lib/enigma_driver_phpssl.php | 14 +- plugins/enigma/lib/enigma_engine.php | 80 +- plugins/enigma/lib/enigma_error.php | 20 +- plugins/enigma/lib/enigma_key.php | 10 +- plugins/enigma/lib/enigma_mime_message.php | 42 +- plugins/enigma/lib/enigma_signature.php | 4 +- plugins/enigma/lib/enigma_ui.php | 220 ++--- plugins/enigma/tests/Enigma.php | 2 +- plugins/enigma/tests/EnigmaDriverGnupg.php | 2 +- plugins/enigma/tests/EnigmaEngine.php | 2 +- plugins/enigma/tests/EnigmaMimeMessage.php | 4 +- .../example_addressbook.php | 8 +- .../example_addressbook_backend.php | 30 +- .../tests/ExampleAddressbook.php | 4 +- .../filesystem_attachments.php | 20 +- .../tests/FilesystemAttachments.php | 2 +- plugins/help/config.inc.php.dist | 14 +- plugins/help/help.php | 26 +- plugins/help/tests/Help.php | 4 +- plugins/hide_blockquote/hide_blockquote.php | 14 +- .../hide_blockquote/tests/HideBlockquote.php | 10 +- .../http_authentication.php | 4 +- .../tests/HttpAuthentication.php | 2 +- plugins/identicon/identicon.php | 2 +- plugins/identicon/identicon_engine.php | 26 +- plugins/identicon/tests/Identicon.php | 2 +- .../identity_select/tests/IdentitySelect.php | 2 +- plugins/jqueryui/jqueryui.php | 24 +- plugins/jqueryui/tests/Jqueryui.php | 2 +- .../krb_authentication/krb_authentication.php | 18 +- .../tests/KrbAuthentication.php | 2 +- .../managesieve/lib/Roundcube/rcube_sieve.php | 40 +- .../lib/Roundcube/rcube_sieve_engine.php | 796 +++++++++--------- .../lib/Roundcube/rcube_sieve_forward.php | 78 +- .../lib/Roundcube/rcube_sieve_script.php | 94 +-- .../lib/Roundcube/rcube_sieve_vacation.php | 196 ++--- plugins/managesieve/managesieve.php | 38 +- plugins/managesieve/tests/Engine.php | 8 +- plugins/managesieve/tests/Forward.php | 4 +- plugins/managesieve/tests/Managesieve.php | 2 +- plugins/managesieve/tests/Script.php | 8 +- plugins/managesieve/tests/Vacation.php | 10 +- plugins/markasjunk/config.inc.php.dist | 4 +- .../markasjunk/drivers/amavis_blacklist.php | 6 +- plugins/markasjunk/drivers/cmd_learn.php | 10 +- plugins/markasjunk/drivers/dir_learn.php | 4 +- plugins/markasjunk/drivers/edit_headers.php | 4 +- plugins/markasjunk/drivers/email_learn.php | 60 +- plugins/markasjunk/drivers/jsevent.php | 4 +- plugins/markasjunk/drivers/sa_blacklist.php | 16 +- plugins/markasjunk/drivers/sa_detach.php | 6 +- plugins/markasjunk/markasjunk.php | 80 +- plugins/markasjunk/tests/Markasjunk.php | 4 +- plugins/new_user_dialog/new_user_dialog.php | 54 +- .../new_user_dialog/tests/NewUserDialog.php | 2 +- .../new_user_identity/new_user_identity.php | 20 +- .../tests/NewUserIdentity.php | 2 +- plugins/newmail_notifier/newmail_notifier.php | 26 +- .../tests/NewmailNotifier.php | 2 +- plugins/password/config.inc.php.dist | 2 +- plugins/password/drivers/cpanel.php | 14 +- plugins/password/drivers/dbmail.php | 6 +- plugins/password/drivers/directadmin.php | 34 +- plugins/password/drivers/domainfactory.php | 12 +- .../password/drivers/dovecot_passwdfile.php | 8 +- plugins/password/drivers/expect.php | 8 +- plugins/password/drivers/gearman.php | 6 +- plugins/password/drivers/hmail.php | 2 +- plugins/password/drivers/httpapi.php | 10 +- plugins/password/drivers/ldap.php | 44 +- plugins/password/drivers/ldap_ppolicy.php | 12 +- plugins/password/drivers/ldap_simple.php | 38 +- plugins/password/drivers/mailcow.php | 8 +- plugins/password/drivers/miab.php | 4 +- plugins/password/drivers/modoboa.php | 46 +- plugins/password/drivers/plesk.php | 28 +- plugins/password/drivers/poppassd.php | 2 +- plugins/password/drivers/pwned.php | 4 +- plugins/password/drivers/sasl.php | 4 +- plugins/password/drivers/smb.php | 12 +- plugins/password/drivers/sql.php | 16 +- plugins/password/drivers/tinycp.php | 8 +- plugins/password/drivers/virtualmin.php | 4 +- plugins/password/drivers/vpopmaild.php | 6 +- plugins/password/drivers/xmail.php | 2 +- plugins/password/drivers/zxcvbn.php | 4 +- plugins/password/password.php | 114 +-- plugins/password/tests/Password.php | 12 +- .../redundant_attachments.php | 10 +- .../tests/RedundantAttachments.php | 2 +- .../show_additional_headers.php | 4 +- .../tests/ShowAdditionalHeaders.php | 2 +- .../squirrelmail_usercopy.php | 32 +- .../tests/SquirrelmailUsercopy.php | 2 +- .../subscriptions_option.php | 2 +- .../tests/SubscriptionsOption.php | 10 +- plugins/userinfo/tests/Userinfo.php | 2 +- plugins/userinfo/userinfo.php | 14 +- .../tests/VcardAttachments.php | 4 +- .../vcard_attachments/vcard_attachments.php | 50 +- plugins/virtuser_file/tests/VirtuserFile.php | 2 +- plugins/virtuser_file/virtuser_file.php | 4 +- .../virtuser_query/tests/VirtuserQuery.php | 2 +- plugins/virtuser_query/virtuser_query.php | 16 +- .../zipdownload/tests/Browser/MailTest.php | 2 +- plugins/zipdownload/tests/Zipdownload.php | 2 +- plugins/zipdownload/zipdownload.php | 68 +- program/actions/contacts/copy.php | 20 +- program/actions/contacts/delete.php | 16 +- program/actions/contacts/edit.php | 90 +- program/actions/contacts/export.php | 8 +- program/actions/contacts/group_addmembers.php | 12 +- program/actions/contacts/group_create.php | 6 +- program/actions/contacts/group_delete.php | 6 +- program/actions/contacts/group_delmembers.php | 8 +- program/actions/contacts/group_rename.php | 14 +- program/actions/contacts/import.php | 88 +- program/actions/contacts/index.php | 394 ++++----- program/actions/contacts/list.php | 8 +- program/actions/contacts/mailto.php | 12 +- program/actions/contacts/move.php | 42 +- program/actions/contacts/photo.php | 10 +- program/actions/contacts/print.php | 56 +- program/actions/contacts/qrcode.php | 8 +- program/actions/contacts/save.php | 20 +- program/actions/contacts/search.php | 48 +- program/actions/contacts/search_create.php | 4 +- program/actions/contacts/search_delete.php | 2 +- program/actions/contacts/show.php | 90 +- program/actions/contacts/undo.php | 2 +- program/actions/contacts/upload_photo.php | 18 +- program/actions/login/oauth.php | 2 +- program/actions/login/oauth_backchannel.php | 8 +- program/actions/mail/addcontact.php | 12 +- program/actions/mail/attachment_upload.php | 46 +- program/actions/mail/autocomplete.php | 44 +- program/actions/mail/bounce.php | 18 +- program/actions/mail/check_recent.php | 20 +- program/actions/mail/compose.php | 228 ++--- program/actions/mail/copy.php | 6 +- program/actions/mail/delete.php | 28 +- program/actions/mail/folder_expunge.php | 2 +- program/actions/mail/folder_purge.php | 20 +- program/actions/mail/get.php | 38 +- program/actions/mail/getunread.php | 8 +- program/actions/mail/group_expand.php | 6 +- program/actions/mail/headers.php | 6 +- program/actions/mail/import.php | 14 +- program/actions/mail/index.php | 254 +++--- program/actions/mail/list.php | 10 +- program/actions/mail/list_contacts.php | 32 +- program/actions/mail/mark.php | 50 +- program/actions/mail/move.php | 18 +- program/actions/mail/pagenav.php | 14 +- program/actions/mail/search.php | 36 +- program/actions/mail/search_contacts.php | 28 +- program/actions/mail/send.php | 76 +- program/actions/mail/sendmdn.php | 20 +- program/actions/mail/show.php | 165 ++-- program/actions/mail/viewsource.php | 14 +- program/actions/settings/about.php | 8 +- program/actions/settings/folder_delete.php | 4 +- program/actions/settings/folder_edit.php | 50 +- program/actions/settings/folder_purge.php | 14 +- program/actions/settings/folder_rename.php | 14 +- program/actions/settings/folder_save.php | 36 +- program/actions/settings/folder_size.php | 4 +- program/actions/settings/folder_subscribe.php | 4 +- .../actions/settings/folder_unsubscribe.php | 4 +- program/actions/settings/folders.php | 130 +-- program/actions/settings/identity_delete.php | 4 +- program/actions/settings/identity_edit.php | 40 +- program/actions/settings/identity_save.php | 4 +- program/actions/settings/index.php | 556 ++++++------ program/actions/settings/prefs_edit.php | 2 +- program/actions/settings/prefs_save.php | 90 +- program/actions/settings/response_edit.php | 26 +- program/actions/settings/response_save.php | 16 +- program/actions/settings/upload.php | 32 +- program/actions/utils/error.php | 24 +- program/actions/utils/html2text.php | 2 +- program/actions/utils/modcss.php | 12 +- program/actions/utils/save_pref.php | 8 +- program/actions/utils/spell.php | 6 +- program/actions/utils/spell_html.php | 10 +- program/include/rcmail.php | 196 ++--- program/include/rcmail_action.php | 204 ++--- program/include/rcmail_attachment_handler.php | 34 +- program/include/rcmail_html_page.php | 4 +- program/include/rcmail_install.php | 132 +-- program/include/rcmail_oauth.php | 168 ++-- program/include/rcmail_output.php | 10 +- program/include/rcmail_output_html.php | 366 ++++---- program/include/rcmail_output_json.php | 8 +- program/include/rcmail_resend_mail.php | 12 +- program/include/rcmail_sendmail.php | 276 +++--- program/include/rcmail_string_replacer.php | 6 +- program/include/rcmail_utils.php | 82 +- program/lib/Roundcube/bootstrap.php | 24 +- program/lib/Roundcube/cache/apc.php | 4 +- program/lib/Roundcube/cache/db.php | 10 +- program/lib/Roundcube/cache/memcache.php | 10 +- program/lib/Roundcube/cache/memcached.php | 18 +- program/lib/Roundcube/cache/redis.php | 4 +- program/lib/Roundcube/db/mysql.php | 20 +- program/lib/Roundcube/db/param.php | 4 +- program/lib/Roundcube/db/pgsql.php | 16 +- program/lib/Roundcube/html.php | 46 +- program/lib/Roundcube/rcube.php | 128 +-- program/lib/Roundcube/rcube_addressbook.php | 46 +- program/lib/Roundcube/rcube_addresses.php | 34 +- program/lib/Roundcube/rcube_browser.php | 14 +- program/lib/Roundcube/rcube_cache.php | 48 +- program/lib/Roundcube/rcube_charset.php | 262 +++--- program/lib/Roundcube/rcube_config.php | 280 +++--- program/lib/Roundcube/rcube_contacts.php | 72 +- program/lib/Roundcube/rcube_csv2vcard.php | 406 ++++----- program/lib/Roundcube/rcube_db.php | 104 +-- program/lib/Roundcube/rcube_enriched.php | 30 +- program/lib/Roundcube/rcube_html2text.php | 10 +- program/lib/Roundcube/rcube_image.php | 56 +- program/lib/Roundcube/rcube_imap.php | 256 +++--- program/lib/Roundcube/rcube_imap_cache.php | 120 +-- program/lib/Roundcube/rcube_imap_generic.php | 338 ++++---- program/lib/Roundcube/rcube_imap_search.php | 16 +- program/lib/Roundcube/rcube_ldap.php | 208 ++--- program/lib/Roundcube/rcube_ldap_generic.php | 4 +- program/lib/Roundcube/rcube_message.php | 142 ++-- .../lib/Roundcube/rcube_message_header.php | 36 +- program/lib/Roundcube/rcube_message_part.php | 10 +- program/lib/Roundcube/rcube_mime.php | 112 +-- program/lib/Roundcube/rcube_mime_decode.php | 46 +- program/lib/Roundcube/rcube_output.php | 16 +- program/lib/Roundcube/rcube_plugin.php | 12 +- program/lib/Roundcube/rcube_plugin_api.php | 102 +-- program/lib/Roundcube/rcube_result_index.php | 22 +- .../Roundcube/rcube_result_multifolder.php | 28 +- program/lib/Roundcube/rcube_result_thread.php | 66 +- program/lib/Roundcube/rcube_session.php | 36 +- program/lib/Roundcube/rcube_smtp.php | 50 +- program/lib/Roundcube/rcube_spellchecker.php | 8 +- program/lib/Roundcube/rcube_storage.php | 26 +- .../lib/Roundcube/rcube_string_replacer.php | 46 +- program/lib/Roundcube/rcube_text2html.php | 38 +- program/lib/Roundcube/rcube_tnef_decoder.php | 230 ++--- program/lib/Roundcube/rcube_uploads.php | 12 +- program/lib/Roundcube/rcube_user.php | 114 +-- program/lib/Roundcube/rcube_utils.php | 126 +-- program/lib/Roundcube/rcube_vcard.php | 92 +- program/lib/Roundcube/rcube_washtml.php | 50 +- program/lib/Roundcube/session/db.php | 12 +- program/lib/Roundcube/session/memcache.php | 12 +- program/lib/Roundcube/session/memcached.php | 12 +- program/lib/Roundcube/session/php.php | 4 +- program/lib/Roundcube/session/redis.php | 12 +- program/lib/Roundcube/spellchecker/atd.php | 14 +- .../lib/Roundcube/spellchecker/enchant.php | 6 +- program/lib/Roundcube/spellchecker/googie.php | 4 +- program/lib/Roundcube/spellchecker/pspell.php | 10 +- tests/ActionTestCase.php | 42 +- tests/Actions/Contacts/Copy.php | 16 +- tests/Actions/Contacts/Delete.php | 10 +- tests/Actions/Contacts/Edit.php | 8 +- tests/Actions/Contacts/Export.php | 10 +- tests/Actions/Contacts/GroupAddmembers.php | 12 +- tests/Actions/Contacts/GroupCreate.php | 4 +- tests/Actions/Contacts/GroupDelete.php | 8 +- tests/Actions/Contacts/GroupDelmembers.php | 12 +- tests/Actions/Contacts/GroupRename.php | 8 +- tests/Actions/Contacts/Index.php | 2 +- tests/Actions/Contacts/Mailto.php | 6 +- tests/Actions/Contacts/Move.php | 10 +- tests/Actions/Contacts/Print.php | 4 +- tests/Actions/Contacts/Qrcode.php | 4 +- tests/Actions/Contacts/Save.php | 4 +- tests/Actions/Contacts/SearchCreate.php | 4 +- tests/Actions/Contacts/SearchDelete.php | 8 +- tests/Actions/Contacts/Show.php | 6 +- tests/Actions/Contacts/Undo.php | 8 +- tests/Actions/Mail/Copy.php | 8 +- tests/Actions/Mail/Index.php | 34 +- tests/Actions/Mail/Search.php | 10 +- tests/Actions/Settings/FolderCreate.php | 8 +- tests/Actions/Settings/FolderEdit.php | 8 +- tests/Actions/Settings/Folders.php | 8 +- tests/Actions/Settings/IdentityDelete.php | 8 +- tests/Actions/Settings/IdentityEdit.php | 4 +- tests/Actions/Settings/IdentitySave.php | 6 +- tests/Actions/Settings/Index.php | 2 +- tests/Actions/Utils/Error.php | 4 +- tests/Actions/Utils/SavePref.php | 2 +- tests/Browser/Browser.php | 6 +- tests/Browser/Components/HtmlEditor.php | 2 +- tests/Browser/Mail/ListTest.php | 2 +- .../Settings/Preferences/GeneralTest.php | 2 +- .../Settings/Preferences/ServerTest.php | 8 +- tests/Browser/TestCase.php | 4 +- tests/Browser/bootstrap.php | 10 +- tests/Framework/Addressbook.php | 6 +- tests/Framework/Addresses.php | 2 +- tests/Framework/BaseReplacer.php | 2 +- tests/Framework/Bootstrap.php | 92 +- tests/Framework/Browser.php | 142 ++-- tests/Framework/CacheDB.php | 4 +- tests/Framework/Csv2vcard.php | 14 +- tests/Framework/DB.php | 4 +- tests/Framework/Enriched.php | 2 +- tests/Framework/Html2text.php | 76 +- tests/Framework/Image.php | 4 +- tests/Framework/Message.php | 4 +- tests/Framework/Mime.php | 84 +- tests/Framework/Output.php | 2 +- tests/Framework/ResultThread.php | 2 +- tests/Framework/Smtp.php | 4 +- tests/Framework/SpellcheckerPspell.php | 2 +- tests/Framework/Text2Html.php | 22 +- tests/Framework/TnefDecoder.php | 10 +- tests/Framework/Utils.php | 30 +- tests/Framework/Washtml.php | 36 +- tests/OutputHtmlMock.php | 10 +- tests/OutputJsonMock.php | 8 +- tests/Rcmail/Install.php | 14 +- tests/Rcmail/Oauth.php | 136 +-- tests/Rcmail/OutputHtml.php | 42 +- tests/Rcmail/OutputJson.php | 2 +- tests/Rcmail/Rcmail.php | 2 +- tests/Rcmail/Sendmail.php | 14 +- tests/Rcmail/Utils.php | 2 +- tests/bootstrap.php | 2 +- 365 files changed, 6840 insertions(+), 6806 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index b5751524e..86d237a85 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -95,7 +95,6 @@ return (new Config()) // TODO 'array_indentation' => false, - 'binary_operator_spaces' => ['default' => 'at_least_single_space'], 'general_phpdoc_annotation_remove' => false, 'method_argument_space' => ['on_multiline' => 'ignore'], 'modernize_types_casting' => false, diff --git a/bin/gc.sh b/bin/gc.sh index 2f4d70e1e..21f50a43b 100755 --- a/bin/gc.sh +++ b/bin/gc.sh @@ -24,7 +24,7 @@ require INSTALL_PATH . 'program/include/clisetup.php'; $rcmail = rcube::get_instance(); -$session_driver = $rcmail->config->get('session_storage', 'db'); +$session_driver = $rcmail->config->get('session_storage', 'db'); $session_lifetime = $rcmail->config->get('session_lifetime', 0) * 60 * 2; // Clean expired SQL sessions diff --git a/bin/identity.sh b/bin/identity.sh index c911ce50a..8499e4478 100755 --- a/bin/identity.sh +++ b/bin/identity.sh @@ -178,7 +178,7 @@ function add_identity($options) $new_identity['email'] = get_option_value($options, 'email', '', false, true, 'Enter the email e.g. -e somemail@example.com'); $new_identity['name'] = get_option_value($options, 'name', '', false, true, "Enter the name of an identity e.g. -n 'John Smith'"); - $new_identity['organization'] = get_option_value($options, 'organization', '', false, false); + $new_identity['organization'] = get_option_value($options, 'organization', '', false, false); $new_identity['html_signature'] = 0; $new_identity['signature'] = get_option_value($options, 'plain_text_signature', '', false, false); diff --git a/bin/install-jsdeps.sh b/bin/install-jsdeps.sh index 3cdef0dfd..1dadd4f4a 100755 --- a/bin/install-jsdeps.sh +++ b/bin/install-jsdeps.sh @@ -34,8 +34,8 @@ if (empty($SOURCES['dependencies'])) { rcube::raise_error("Failed to read dependencies list from {$cfgfile}", false, true); } -$CURL = trim(shell_exec('which curl')); -$WGET = trim(shell_exec('which wget')); +$CURL = trim(shell_exec('which curl')); +$WGET = trim(shell_exec('which wget')); if (($CACHEDIR = getenv('CACHEDIR')) && is_writable($CACHEDIR)) { // use $CACHEDIR @@ -126,7 +126,7 @@ function fetch_from_source($package, $useCache = true, &$filetype = null) // Try Github API as a fallback (#6248) if ($retval !== 0 && !empty($package['api_url'])) { - $url = str_replace('$v', $package['version'], $package['api_url']); + $url = str_replace('$v', $package['version'], $package['api_url']); $header = 'Accept:application/vnd.github.v3.raw'; rcube::raise_error("Fetching failed. Using Github API on {$url}"); @@ -153,7 +153,7 @@ function extract_filetype($package, &$filetype = null) { global $CACHEDIR; - $filetype = pathinfo(preg_replace('/[?&].*$/', '', $package['url']), \PATHINFO_EXTENSION) ?: 'tmp'; + $filetype = pathinfo(preg_replace('/[?&].*$/', '', $package['url']), \PATHINFO_EXTENSION) ?: 'tmp'; $cache_file = $CACHEDIR . '/' . $package['lib'] . '-' . $package['version'] . '.' . $filetype; // Make sure it is a zip file @@ -235,13 +235,13 @@ function extract_zipfile($package, $srcfile) if (!empty($package['map'])) { // get the root folder of the extracted package $extract_tree = glob("{$extract}/*", \GLOB_ONLYDIR); - $sourcedir = count($extract_tree) ? $extract_tree[0] : $extract; + $sourcedir = count($extract_tree) ? $extract_tree[0] : $extract; foreach ($package['map'] as $src => $dest) { echo "Installing {$sourcedir}/{$src} into {$destdir}/{$dest}\n"; $dest_file = $destdir . '/' . $dest; - $src_file = $sourcedir . '/' . $src; + $src_file = $sourcedir . '/' . $src; // make sure the destination's parent directory exists if (strpos($dest, '/') !== false) { @@ -317,13 +317,13 @@ $args = rcube_utils::get_opt([ 'g' => 'get:bool', 'e' => 'extract:bool', ]) + [ - 'force' => false, - 'delete' => false, - 'get' => false, + 'force' => false, + 'delete' => false, + 'get' => false, 'extract' => false, ]; -$WHAT = $args[0] ?? null; +$WHAT = $args[0] ?? null; $useCache = !$args['force'] && !$args['get']; if (!$args['get'] && !$args['extract'] && !$args['delete']) { diff --git a/bin/installto.sh b/bin/installto.sh index cd8883b49..de2888275 100755 --- a/bin/installto.sh +++ b/bin/installto.sh @@ -69,7 +69,7 @@ if (strtolower($input) == 'y') { foreach ($dirs as $dir) { // @FIXME: should we use --delete for all directories? - $delete = in_array($dir, ['program', 'vendor', 'installer']) ? '--delete ' : ''; + $delete = in_array($dir, ['program', 'vendor', 'installer']) ? '--delete ' : ''; $command = 'rsync -aC --out-format=%n ' . $delete . INSTALL_PATH . "{$dir}/ {$target_dir}/{$dir}/"; if (system($command, $ret) === false || $ret > 0) { @@ -120,8 +120,8 @@ if (strtolower($input) == 'y') { } // check if js-deps are up-to-date elseif (file_exists("{$target_dir}/jsdeps.json") && file_exists("{$target_dir}/bin/install-jsdeps.sh")) { - $jsdeps = json_decode(file_get_contents("{$target_dir}/jsdeps.json")); - $package = $jsdeps->dependencies[0]; + $jsdeps = json_decode(file_get_contents("{$target_dir}/jsdeps.json")); + $package = $jsdeps->dependencies[0]; $dest_file = $target_dir . '/' . $package->dest; if (!file_exists($dest_file) || sha1_file($dest_file) !== $package->sha1) { diff --git a/bin/moduserprefs.sh b/bin/moduserprefs.sh index b0c359ecc..aa8321d1f 100755 --- a/bin/moduserprefs.sh +++ b/bin/moduserprefs.sh @@ -49,7 +49,7 @@ if (empty($_SERVER['argv'][1]) || $_SERVER['argv'][1] == 'help') { exit; } -$pref_name = trim($args[0]); +$pref_name = trim($args[0]); $pref_value = !empty($args['delete']) ? null : trim($args[1]); if ($pref_value === null) { diff --git a/bin/msgexport.sh b/bin/msgexport.sh index 132989452..2a40462b5 100755 --- a/bin/msgexport.sh +++ b/bin/msgexport.sh @@ -107,13 +107,13 @@ $args['pass'] = rcube_utils::prompt_silent('Password: '); // parse $host URL $a_host = parse_url($args['host']); if (!empty($a_host['host'])) { - $host = $a_host['host']; - $imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], ['ssl', 'imaps', 'tls'])) ? true : false; + $host = $a_host['host']; + $imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], ['ssl', 'imaps', 'tls'])) ? true : false; $imap_port = $a_host['port'] ?? ($imap_ssl ? 993 : 143); } else { - $host = $args['host']; + $host = $args['host']; $imap_port = 143; - $imap_ssl = false; + $imap_ssl = false; } // instantiate IMAP class @@ -123,7 +123,7 @@ $IMAP = new rcube_imap(null); if ($IMAP->connect($host, $args['user'], $args['pass'], $imap_port, $imap_ssl)) { vputs("IMAP login successful.\n"); - $filename = null; + $filename = null; $mailboxes = $args['mbox'] == '*' ? $IMAP->list_folders(null) : [$args['mbox']]; foreach ($mailboxes as $mbox) { diff --git a/bin/msgimport.sh b/bin/msgimport.sh index fdf0adfc2..256a21929 100755 --- a/bin/msgimport.sh +++ b/bin/msgimport.sh @@ -59,13 +59,13 @@ if (empty($args['pass'])) { // parse $host URL $a_host = parse_url($args['host']); if (!empty($a_host['host'])) { - $host = $a_host['host']; - $imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], ['ssl', 'imaps', 'tls'])) ? true : false; + $host = $a_host['host']; + $imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], ['ssl', 'imaps', 'tls'])) ? true : false; $imap_port = $a_host['port'] ?? ($imap_ssl ? 993 : 143); } else { - $host = $args['host']; + $host = $args['host']; $imap_port = 143; - $imap_ssl = false; + $imap_ssl = false; } // instantiate IMAP class @@ -76,7 +76,7 @@ if ($IMAP->connect($host, $args['user'], $args['pass'], $imap_port, $imap_ssl)) echo "IMAP login successful.\n"; echo "Uploading messages...\n"; - $count = 0; + $count = 0; $message = $lastline = ''; $fp = fopen($args['file'], 'r'); diff --git a/bin/update.sh b/bin/update.sh index 52afc21f5..cdf4ccd7f 100755 --- a/bin/update.sh +++ b/bin/update.sh @@ -173,9 +173,9 @@ if ($RCI->configured) { // update composer dependencies if (is_file(INSTALL_PATH . 'composer.json') && is_readable(INSTALL_PATH . 'composer.json-dist')) { - $composer_data = json_decode(file_get_contents(INSTALL_PATH . 'composer.json'), true); + $composer_data = json_decode(file_get_contents(INSTALL_PATH . 'composer.json'), true); $composer_template = json_decode(file_get_contents(INSTALL_PATH . 'composer.json-dist'), true); - $composer_json = null; + $composer_json = null; // update the require section with the new dependencies if (!empty($composer_data['require']) && !empty($composer_template['require'])) { @@ -213,7 +213,7 @@ if ($RCI->configured) { $rkey = repo_key($repo); $existing = false; - foreach ($composer_data['repositories'] as $k => $_repo) { + foreach ($composer_data['repositories'] as $k => $_repo) { if ($rkey == repo_key($_repo)) { // switch to https:// if (isset($_repo['url']) && strpos($_repo['url'], 'http://') === 0) { diff --git a/bin/updatecss.sh b/bin/updatecss.sh index d1c4e40ed..2852e6451 100755 --- a/bin/updatecss.sh +++ b/bin/updatecss.sh @@ -28,9 +28,9 @@ $opts = rcube_utils::get_opt(['d' => 'dir']); if (empty($opts['dir'])) { echo "Skin directory not specified (--dir). Using skins/ and plugins/*/skins/.\n"; - $dir = INSTALL_PATH . 'skins'; - $dir_p = INSTALL_PATH . 'plugins'; - $skins = glob("{$dir}/*", \GLOB_ONLYDIR); + $dir = INSTALL_PATH . 'skins'; + $dir_p = INSTALL_PATH . 'plugins'; + $skins = glob("{$dir}/*", \GLOB_ONLYDIR); $skins_p = glob("{$dir_p}/*/skins/*", \GLOB_ONLYDIR); $dirs = array_merge($skins, $skins_p); @@ -48,20 +48,20 @@ foreach ($dirs as $dir) { continue; } - $files = get_files($dir); - $images = get_images($img_dir); - $find = []; + $files = get_files($dir); + $images = get_images($img_dir); + $find = []; $replace = []; // build regexps array foreach ($images as $path => $sum) { - $path_ex = str_replace('.', '\\.', $path); - $find[] = "#url\\(['\"]?images/{$path_ex}(\\?v=[a-f0-9-\\.]+)?['\"]?\\)#"; + $path_ex = str_replace('.', '\\.', $path); + $find[] = "#url\\(['\"]?images/{$path_ex}(\\?v=[a-f0-9-\\.]+)?['\"]?\\)#"; $replace[] = "url(images/{$path}?v={$sum})"; } foreach ($files as $file) { - $file = $dir . '/' . $file; + $file = $dir . '/' . $file; echo "File: {$file}\n"; $content = file_get_contents($file); $content = preg_replace($find, $replace, $content, -1, $count); @@ -74,7 +74,7 @@ foreach ($dirs as $dir) { function get_images($dir) { $images = []; - $dh = opendir($dir); + $dh = opendir($dir); while ($file = readdir($dh)) { if (preg_match('/^(.+)\.(gif|ico|png|jpg|jpeg)$/', $file, $m)) { @@ -96,7 +96,7 @@ function get_images($dir) function get_files($dir) { $files = []; - $dh = opendir($dir); + $dh = opendir($dir); while ($file = readdir($dh)) { if (preg_match('/^(.+)\.(css|html)$/', $file, $m)) { diff --git a/config/defaults.inc.php b/config/defaults.inc.php index 1ac31d433..27545e4e8 100644 --- a/config/defaults.inc.php +++ b/config/defaults.inc.php @@ -201,8 +201,8 @@ $config['imap_vendor'] = null; // Note: These can be used also to overwrite server's namespaces // Note: Set these to FALSE to disable access to specified namespace $config['imap_ns_personal'] = null; -$config['imap_ns_other'] = null; -$config['imap_ns_shared'] = null; +$config['imap_ns_other'] = null; +$config['imap_ns_shared'] = null; // By default IMAP capabilities are read after connection to IMAP server // In some cases, e.g. when using IMAP proxy, there's a need to refresh the list @@ -1526,19 +1526,19 @@ $config['default_font'] = 'Verdana'; // Note: At minimum the font name set in default_font must be present in this array // Setting a single value will hide the font select box in the interface $config['available_fonts'] = [ - 'Andale Mono' => '"Andale Mono",Times,monospace', - 'Arial' => 'Arial,Helvetica,sans-serif', - 'Arial Black' => '"Arial Black","Avant Garde",sans-serif', - 'Book Antiqua' => '"Book Antiqua",Palatino,serif', - 'Courier New' => '"Courier New",Courier,monospace', - 'Georgia' => 'Georgia,Palatino,serif', - 'Helvetica' => 'Helvetica,Arial,sans-serif', - 'Impact' => 'Impact,Chicago,sans-serif', - 'Tahoma' => 'Tahoma,Arial,Helvetica,sans-serif', - 'Terminal' => 'Terminal,Monaco,monospace', + 'Andale Mono' => '"Andale Mono",Times,monospace', + 'Arial' => 'Arial,Helvetica,sans-serif', + 'Arial Black' => '"Arial Black","Avant Garde",sans-serif', + 'Book Antiqua' => '"Book Antiqua",Palatino,serif', + 'Courier New' => '"Courier New",Courier,monospace', + 'Georgia' => 'Georgia,Palatino,serif', + 'Helvetica' => 'Helvetica,Arial,sans-serif', + 'Impact' => 'Impact,Chicago,sans-serif', + 'Tahoma' => 'Tahoma,Arial,Helvetica,sans-serif', + 'Terminal' => 'Terminal,Monaco,monospace', 'Times New Roman' => '"Times New Roman",Times,serif', - 'Trebuchet MS' => '"Trebuchet MS",Geneva,sans-serif', - 'Verdana' => 'Verdana,Geneva,sans-serif', + 'Trebuchet MS' => '"Trebuchet MS",Geneva,sans-serif', + 'Verdana' => 'Verdana,Geneva,sans-serif', ]; // Default font size for composed HTML message diff --git a/config/mimetypes.php b/config/mimetypes.php index b906503c3..dcd655994 100644 --- a/config/mimetypes.php +++ b/config/mimetypes.php @@ -49,7 +49,7 @@ return [ 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'xps' => 'application/vnd.ms-xpsdocument', 'rar' => 'application/x-rar-compressed', - '7z' => 'application/x-7z-compressed', + '7z' => 'application/x-7z-compressed', 's7z' => 'application/x-7z-compressed', 'vcf' => 'text/vcard', 'ics' => 'text/calendar', diff --git a/index.php b/index.php index e7358d796..1dc8c2704 100644 --- a/index.php +++ b/index.php @@ -99,7 +99,7 @@ $session_error = null; // try to log in if ($RCMAIL->task == 'login' && $RCMAIL->action == 'login') { $request_valid = !empty($_SESSION['temp']) && $RCMAIL->check_request(); - $pass_charset = $RCMAIL->config->get('password_charset', 'UTF-8'); + $pass_charset = $RCMAIL->config->get('password_charset', 'UTF-8'); // purge the session in case of new login when a session already exists if ($request_valid) { @@ -107,9 +107,9 @@ if ($RCMAIL->task == 'login' && $RCMAIL->action == 'login') { } $auth = $RCMAIL->plugins->exec_hook('authenticate', [ - 'host' => $RCMAIL->autoselect_host(), - 'user' => trim(rcube_utils::get_input_string('_user', rcube_utils::INPUT_POST)), - 'pass' => rcube_utils::get_input_string('_pass', rcube_utils::INPUT_POST, true, $pass_charset), + 'host' => $RCMAIL->autoselect_host(), + 'user' => trim(rcube_utils::get_input_string('_user', rcube_utils::INPUT_POST)), + 'pass' => rcube_utils::get_input_string('_pass', rcube_utils::INPUT_POST, true, $pass_charset), 'valid' => $request_valid, 'error' => null, 'cookiecheck' => true, @@ -160,11 +160,11 @@ if ($RCMAIL->task == 'login' && $RCMAIL->action == 'login') { } $error_labels = [ - rcmail::ERROR_STORAGE => 'storageerror', + rcmail::ERROR_STORAGE => 'storageerror', rcmail::ERROR_COOKIES_DISABLED => 'cookiesdisabled', - rcmail::ERROR_INVALID_REQUEST => 'invalidrequest', - rcmail::ERROR_INVALID_HOST => 'invalidhost', - rcmail::ERROR_RATE_LIMIT => 'accountlocked', + rcmail::ERROR_INVALID_REQUEST => 'invalidrequest', + rcmail::ERROR_INVALID_HOST => 'invalidhost', + rcmail::ERROR_RATE_LIMIT => 'accountlocked', ]; if (!empty($auth['error']) && !is_numeric($auth['error'])) { @@ -242,8 +242,8 @@ if (empty($RCMAIL->user->ID)) { } $plugin = $RCMAIL->plugins->exec_hook('unauthenticated', [ - 'task' => 'login', - 'error' => $session_error, + 'task' => 'login', + 'error' => $session_error, // Return 401 only on failed logins (#7010) 'http_code' => empty($session_error) && !empty($error_message) ? 401 : 200, ]); diff --git a/installer/check.php b/installer/check.php index d2afaf21c..664939f43 100644 --- a/installer/check.php +++ b/installer/check.php @@ -19,34 +19,34 @@ if (!class_exists('rcmail_install', false) || !isset($RCI)) { } $required_php_exts = [ - 'PCRE' => 'pcre', - 'DOM' => 'dom', - 'Session' => 'session', - 'XML' => 'xml', - 'Intl' => 'intl', - 'JSON' => 'json', - 'PDO' => 'PDO', + 'PCRE' => 'pcre', + 'DOM' => 'dom', + 'Session' => 'session', + 'XML' => 'xml', + 'Intl' => 'intl', + 'JSON' => 'json', + 'PDO' => 'PDO', 'Multibyte' => 'mbstring', - 'OpenSSL' => 'openssl', - 'Filter' => 'filter', + 'OpenSSL' => 'openssl', + 'Filter' => 'filter', ]; $optional_php_exts = [ - 'cURL' => 'curl', - 'FileInfo' => 'fileinfo', - 'Exif' => 'exif', - 'Iconv' => 'iconv', - 'LDAP' => 'ldap', - 'GD' => 'gd', - 'Imagick' => 'imagick', + 'cURL' => 'curl', + 'FileInfo' => 'fileinfo', + 'Exif' => 'exif', + 'Iconv' => 'iconv', + 'LDAP' => 'ldap', + 'GD' => 'gd', + 'Imagick' => 'imagick', 'XMLWriter' => 'xmlwriter', - 'Zip' => 'zip', + 'Zip' => 'zip', ]; $required_libs = [ - 'PEAR' => 'pear.php.net', + 'PEAR' => 'pear.php.net', 'Auth_SASL' => 'pear.php.net', - 'Net_SMTP' => 'pear.php.net', + 'Net_SMTP' => 'pear.php.net', 'Mail_mime' => 'pear.php.net', 'GuzzleHttp\Client' => 'github.com/guzzle/guzzle', ]; @@ -56,9 +56,9 @@ $optional_libs = [ ]; $ini_checks = [ - 'file_uploads' => 1, - 'session.auto_start' => 0, - 'mbstring.func_overload' => 0, + 'file_uploads' => 1, + 'session.auto_start' => 0, + 'mbstring.func_overload' => 0, 'suhosin.session.encrypt' => 0, ]; @@ -67,31 +67,31 @@ $optional_checks = [ ]; $source_urls = [ - 'cURL' => 'https://www.php.net/manual/en/book.curl.php', - 'Sockets' => 'https://www.php.net/manual/en/book.sockets.php', - 'Session' => 'https://www.php.net/manual/en/book.session.php', - 'PCRE' => 'https://www.php.net/manual/en/book.pcre.php', - 'FileInfo' => 'https://www.php.net/manual/en/book.fileinfo.php', + 'cURL' => 'https://www.php.net/manual/en/book.curl.php', + 'Sockets' => 'https://www.php.net/manual/en/book.sockets.php', + 'Session' => 'https://www.php.net/manual/en/book.session.php', + 'PCRE' => 'https://www.php.net/manual/en/book.pcre.php', + 'FileInfo' => 'https://www.php.net/manual/en/book.fileinfo.php', 'Multibyte' => 'https://www.php.net/manual/en/book.mbstring.php', - 'OpenSSL' => 'https://www.php.net/manual/en/book.openssl.php', - 'JSON' => 'https://www.php.net/manual/en/book.json.php', - 'DOM' => 'https://www.php.net/manual/en/book.dom.php', - 'Iconv' => 'https://www.php.net/manual/en/book.iconv.php', - 'Intl' => 'https://www.php.net/manual/en/book.intl.php', - 'Exif' => 'https://www.php.net/manual/en/book.exif.php', - 'PDO' => 'https://www.php.net/manual/en/book.pdo.php', - 'LDAP' => 'https://www.php.net/manual/en/book.ldap.php', - 'GD' => 'https://www.php.net/manual/en/book.image.php', - 'Imagick' => 'https://www.php.net/manual/en/book.imagick.php', - 'XML' => 'https://www.php.net/manual/en/book.xml.php', + 'OpenSSL' => 'https://www.php.net/manual/en/book.openssl.php', + 'JSON' => 'https://www.php.net/manual/en/book.json.php', + 'DOM' => 'https://www.php.net/manual/en/book.dom.php', + 'Iconv' => 'https://www.php.net/manual/en/book.iconv.php', + 'Intl' => 'https://www.php.net/manual/en/book.intl.php', + 'Exif' => 'https://www.php.net/manual/en/book.exif.php', + 'PDO' => 'https://www.php.net/manual/en/book.pdo.php', + 'LDAP' => 'https://www.php.net/manual/en/book.ldap.php', + 'GD' => 'https://www.php.net/manual/en/book.image.php', + 'Imagick' => 'https://www.php.net/manual/en/book.imagick.php', + 'XML' => 'https://www.php.net/manual/en/book.xml.php', 'XMLWriter' => 'https://www.php.net/manual/en/book.xmlwriter.php', - 'Zip' => 'https://www.php.net/manual/en/book.zip.php', - 'Filter' => 'https://www.php.net/manual/en/book.filter.php', - 'pdo_mysql' => 'https://www.php.net/manual/en/ref.pdo-mysql.php', - 'pdo_pgsql' => 'https://www.php.net/manual/en/ref.pdo-pgsql.php', - 'pdo_sqlite' => 'https://www.php.net/manual/en/ref.pdo-sqlite.php', - 'PEAR' => 'https://pear.php.net', - 'Net_SMTP' => 'https://pear.php.net/package/Net_SMTP', + 'Zip' => 'https://www.php.net/manual/en/book.zip.php', + 'Filter' => 'https://www.php.net/manual/en/book.filter.php', + 'pdo_mysql' => 'https://www.php.net/manual/en/ref.pdo-mysql.php', + 'pdo_pgsql' => 'https://www.php.net/manual/en/ref.pdo-pgsql.php', + 'pdo_sqlite' => 'https://www.php.net/manual/en/ref.pdo-sqlite.php', + 'PEAR' => 'https://pear.php.net', + 'Net_SMTP' => 'https://pear.php.net/package/Net_SMTP', 'Mail_mime' => 'https://pear.php.net/package/Mail_mime', 'Net_LDAP3' => 'https://git.kolab.org/diffusion/PNL', ]; diff --git a/installer/config.php b/installer/config.php index 8a46f2ca4..ef3f7c2ce 100644 --- a/installer/config.php +++ b/installer/config.php @@ -41,7 +41,7 @@ if (!empty($_POST['submit'])) { echo ''; - $button_txt = html::quote('Save in ' . $dir); + $button_txt = html::quote('Save in ' . $dir); $save_button = ' '; } diff --git a/installer/test.php b/installer/test.php index 5ee555504..201ad61a4 100644 --- a/installer/test.php +++ b/installer/test.php @@ -299,7 +299,7 @@ if ($pass == '%p') { '_from', 'id' => 'sendmailfrom']); -$to_field = new html_inputfield(['name' => '_to', 'id' => 'sendmailto']); +$to_field = new html_inputfield(['name' => '_to', 'id' => 'sendmailto']); if (isset($_POST['sendmail'])) { echo '

Trying to send email...
'; @@ -307,15 +307,15 @@ if (isset($_POST['sendmail'])) { $smtp_host = trim($_POST['_smtp_host']); $from = rcube_utils::idn_to_ascii(trim($_POST['_from'])); - $to = rcube_utils::idn_to_ascii(trim($_POST['_to'])); + $to = rcube_utils::idn_to_ascii(trim($_POST['_to'])); if ( preg_match('/^' . $RCI->email_pattern . '$/i', $from) && preg_match('/^' . $RCI->email_pattern . '$/i', $to) ) { $headers = [ - 'From' => $from, - 'To' => $to, + 'From' => $from, + 'To' => $to, 'Subject' => 'Test message from Roundcube', ]; @@ -331,14 +331,14 @@ if (isset($_POST['sendmail'])) { $CONFIG['smtp_pass'] = $_POST['_smtp_pass']; } - $mail_object = new Mail_mime(); + $mail_object = new Mail_mime(); $send_headers = $mail_object->headers($headers); - $head = $mail_object->txtHeaders($send_headers); + $head = $mail_object->txtHeaders($send_headers); $SMTP = new rcube_smtp(); $SMTP->connect($smtp_host, null, $CONFIG['smtp_user'], $CONFIG['smtp_pass']); - $status = $SMTP->send_mail($headers['From'], $headers['To'], $head, $body); + $status = $SMTP->send_mail($headers['From'], $headers['To'], $head, $body); $smtp_response = $SMTP->get_response(); if ($status) { @@ -415,12 +415,12 @@ if (isset($_POST['imaptest']) && !empty($_POST['_host']) && !empty($_POST['_user $imap_host = trim($_POST['_host']); $imap_port = 143; - $imap_ssl = false; + $imap_ssl = false; $a_host = parse_url($imap_host); if ($a_host['host']) { $imap_host = $a_host['host']; - $imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], ['ssl', 'imaps', 'tls'])) ? $a_host['scheme'] : null; + $imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], ['ssl', 'imaps', 'tls'])) ? $a_host['scheme'] : null; $imap_port = $a_host['port'] ?? ($imap_ssl && $imap_ssl != 'tls' ? 993 : 143); } @@ -429,8 +429,8 @@ if (isset($_POST['imaptest']) && !empty($_POST['_host']) && !empty($_POST['_user $imap = new rcube_imap(); $imap->set_options([ - 'auth_type' => $RCI->getprop('imap_auth_type'), - 'debug' => $RCI->getprop('imap_debug'), + 'auth_type' => $RCI->getprop('imap_auth_type'), + 'debug' => $RCI->getprop('imap_debug'), 'socket_options' => $RCI->getprop('imap_conn_options'), ]); diff --git a/plugins/acl/acl.php b/plugins/acl/acl.php index a3add95cb..12218f658 100644 --- a/plugins/acl/acl.php +++ b/plugins/acl/acl.php @@ -80,12 +80,12 @@ class acl extends rcube_plugin $this->load_config(); $search = rcube_utils::get_input_string('_search', rcube_utils::INPUT_GPC, true); - $reqid = rcube_utils::get_input_string('_reqid', rcube_utils::INPUT_GPC); - $users = []; - $keys = []; + $reqid = rcube_utils::get_input_string('_reqid', rcube_utils::INPUT_GPC); + $users = []; + $keys = []; if ($this->init_ldap()) { - $max = (int) $this->rc->config->get('autocomplete_max', 15); + $max = (int) $this->rc->config->get('autocomplete_max', 15); $mode = (int) $this->rc->config->get('addressbook_search_mode'); $this->ldap->set_pagesize($max); @@ -101,24 +101,24 @@ class acl extends rcube_plugin if ($user) { $display = rcube_addressbook::compose_search_name($record); - $user = ['name' => $user, 'display' => $display]; + $user = ['name' => $user, 'display' => $display]; $users[] = $user; - $keys[] = $display ?: $user['name']; + $keys[] = $display ?: $user['name']; } } if ($this->rc->config->get('acl_groups')) { - $prefix = $this->rc->config->get('acl_group_prefix'); + $prefix = $this->rc->config->get('acl_group_prefix'); $group_field = $this->rc->config->get('acl_group_field', 'name'); - $result = $this->ldap->list_groups($search, $mode); + $result = $this->ldap->list_groups($search, $mode); foreach ($result as $record) { - $group = $record['name']; + $group = $record['name']; $group_id = is_array($record[$group_field]) ? $record[$group_field][0] : $record[$group_field]; if ($group) { $users[] = ['name' => ($prefix ?: '') . $group_id, 'display' => $group, 'type' => 'group']; - $keys[] = $group; + $keys[] = $group; } } } @@ -148,7 +148,7 @@ class acl extends rcube_plugin public function folder_form($args) { $mbox_imap = $args['options']['name'] ?? ''; - $myrights = $args['options']['rights'] ?? ''; + $myrights = $args['options']['rights'] ?? ''; // Edited folder name (empty in create-folder mode) if (!strlen($mbox_imap)) { @@ -178,7 +178,7 @@ class acl extends rcube_plugin // add Info fieldset if it doesn't exist if (!isset($args['form']['props']['fieldsets']['info'])) { $args['form']['props']['fieldsets']['info'] = [ - 'name' => $this->rc->gettext('info'), + 'name' => $this->rc->gettext('info'), 'content' => [], ]; } @@ -199,8 +199,8 @@ class acl extends rcube_plugin $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'], + 'acltable' => [$this, 'templ_table'], + 'acluser' => [$this, 'templ_user'], 'aclrights' => [$this, 'templ_rights'], ]); @@ -209,7 +209,7 @@ class acl extends rcube_plugin $this->rc->output->add_label('autocompletechars', 'autocompletemore'); $args['form']['sharing'] = [ - 'name' => rcube::Q($this->gettext('sharing')), + 'name' => rcube::Q($this->gettext('sharing')), 'content' => $this->rc->output->parse('acl.table', false, false), ]; @@ -258,7 +258,7 @@ class acl extends rcube_plugin $deleteright = implode('', array_intersect(str_split('ted'), $supported)); $out = ''; - $ul = ''; + $ul = ''; $input = new html_checkbox(); // Advanced rights @@ -277,10 +277,10 @@ class acl extends rcube_plugin $ul = ''; $attrib['id'] = 'simplerights'; $items = [ - 'read' => 'lrs', - 'write' => 'wi', + 'read' => 'lrs', + 'write' => 'wi', 'delete' => $deleteright, - 'other' => preg_replace('/[lrswi' . $deleteright . ']/', '', implode('', $supported)), + 'other' => preg_replace('/[lrswi' . $deleteright . ']/', '', implode('', $supported)), ]; // give plugins the opportunity to adjust this list @@ -289,10 +289,10 @@ class acl extends rcube_plugin ); foreach ($data['rights'] as $key => $val) { - $id = "acl{$key}"; + $id = "acl{$key}"; $title = !empty($data['titles'][$key]) ? $data['titles'][$key] : $this->gettext('longacl' . $key); $label = !empty($data['labels'][$key]) ? $data['labels'][$key] : $this->gettext('acl' . $key); - $ul .= html::tag('li', null, + $ul .= html::tag('li', null, $input->show('', ['name' => "acl[{$val}]", 'value' => $val, 'id' => $id]) . html::label(['for' => $id, 'title' => $title], $label) ); @@ -316,7 +316,7 @@ class acl extends rcube_plugin { // Create username input $class = !empty($attrib['class']) ? $attrib['class'] : ''; - $attrib['name'] = 'acluser'; + $attrib['name'] = 'acluser'; $attrib['class'] = 'form-control'; $textfield = new html_inputfield($attrib); @@ -409,10 +409,10 @@ class acl extends rcube_plugin } } else { $items = [ - 'read' => 'lrs', - 'write' => 'wi', + 'read' => 'lrs', + 'write' => 'wi', 'delete' => $deleteright, - 'other' => preg_replace('/[lrswi' . $deleteright . ']/', '', implode('', $supported)), + 'other' => preg_replace('/[lrswi' . $deleteright . ']/', '', implode('', $supported)), ]; // give plugins the opportunity to adjust this list @@ -424,8 +424,8 @@ class acl extends rcube_plugin // Create the table $attrib['noheader'] = true; - $table = new html_table($attrib); - $self = $this->rc->get_user_name(); + $table = new html_table($attrib); + $self = $this->rc->get_user_name(); $js_table = []; // Create table header @@ -442,8 +442,8 @@ class acl extends rcube_plugin // filter out virtual rights (c or d) the server may return $userrights = array_intersect($rights, $supported); - $userid = rcube_utils::html_identifier($user); - $title = null; + $userid = rcube_utils::html_identifier($user); + $title = null; if (!empty($this->specials) && in_array($user, $this->specials)) { $username = $this->gettext($user); @@ -488,20 +488,20 @@ class acl extends rcube_plugin */ private function action_save() { - $mbox = trim(rcube_utils::get_input_string('_mbox', rcube_utils::INPUT_POST, true)); // UTF7-IMAP - $user = trim(rcube_utils::get_input_string('_user', rcube_utils::INPUT_POST)); - $acl = trim(rcube_utils::get_input_string('_acl', rcube_utils::INPUT_POST)); + $mbox = trim(rcube_utils::get_input_string('_mbox', rcube_utils::INPUT_POST, true)); // UTF7-IMAP + $user = trim(rcube_utils::get_input_string('_user', rcube_utils::INPUT_POST)); + $acl = trim(rcube_utils::get_input_string('_acl', rcube_utils::INPUT_POST)); $oldid = trim(rcube_utils::get_input_string('_old', rcube_utils::INPUT_POST)); - $acl = array_intersect(str_split($acl), $this->rights_supported()); - $users = $oldid ? [$user] : explode(',', $user); + $acl = array_intersect(str_split($acl), $this->rights_supported()); + $users = $oldid ? [$user] : explode(',', $user); $result = 0; - $self = $this->rc->get_user_name(); + $self = $this->rc->get_user_name(); foreach ($users as $user) { - $user = trim($user); + $user = trim($user); $username = ''; - $prefix = $this->rc->config->get('acl_groups') ? $this->rc->config->get('acl_group_prefix') : ''; + $prefix = $this->rc->config->get('acl_groups') ? $this->rc->config->get('acl_group_prefix') : ''; if ($prefix && strpos($user, $prefix) === 0) { $username = $user; @@ -525,19 +525,19 @@ class acl extends rcube_plugin continue; } - $user = $this->mod_login($user); + $user = $this->mod_login($user); $username = $this->mod_login($username); if ($user != $self && $username != $self) { if ($this->rc->storage->set_acl($mbox, $user, $acl)) { $display = $this->resolve_acl_identifier($username, $title); $this->rc->output->command('acl_update', [ - 'id' => rcube_utils::html_identifier($user), + 'id' => rcube_utils::html_identifier($user), 'username' => $username, - 'title' => $title, - 'display' => $display, - 'acl' => implode('', $acl), - 'old' => $oldid, + 'title' => $title, + 'display' => $display, + 'acl' => implode('', $acl), + 'old' => $oldid, ]); $result++; } @@ -587,8 +587,8 @@ class acl extends rcube_plugin } $this->mbox = trim(rcube_utils::get_input_string('_mbox', rcube_utils::INPUT_GPC, true)); // UTF7-IMAP - $advanced = trim(rcube_utils::get_input_string('_mode', rcube_utils::INPUT_GPC)); - $advanced = $advanced == 'advanced'; + $advanced = trim(rcube_utils::get_input_string('_mode', rcube_utils::INPUT_GPC)); + $advanced = $advanced == 'advanced'; // Save state in user preferences $this->rc->user->save_prefs(['acl_advanced_mode' => $advanced]); @@ -614,8 +614,8 @@ class acl extends rcube_plugin } $supported = $this->rights_supported(); - $list = []; - $attrib = [ + $list = []; + $attrib = [ 'name' => 'rcmyrights', 'style' => 'margin:0; padding:0 15px;', ]; @@ -654,7 +654,7 @@ class acl extends rcube_plugin $acl1 = array_intersect($acl1, $rights); $acl2 = array_intersect($acl2, $rights); - $res = array_intersect($acl1, $acl2); + $res = array_intersect($acl1, $acl2); $cnt1 = count($res); $cnt2 = count($acl2); @@ -749,11 +749,11 @@ class acl extends rcube_plugin // not an array, use configured ldap_public source if (!is_array($config)) { $ldap_config = (array) $this->rc->config->get('ldap_public'); - $config = $ldap_config[$config]; + $config = $ldap_config[$config]; } $uid_field = $this->rc->config->get('acl_users_field', 'mail'); - $filter = $this->rc->config->get('acl_users_filter'); + $filter = $this->rc->config->get('acl_users_filter'); if (empty($uid_field) || empty($config)) { return false; @@ -770,14 +770,14 @@ class acl extends rcube_plugin // add UID field to fieldmap, so it will be returned in a record with name $config['fieldmap']['name'] = $name_field; - $config['fieldmap']['uid'] = $uid_field; + $config['fieldmap']['uid'] = $uid_field; // search in UID and name fields // $name_field can be in a form of : (#1490591) $name_field = preg_replace('/:.*$/', '', $name_field); - $search = array_unique([$name_field, $uid_field]); + $search = array_unique([$name_field, $uid_field]); - $config['search_fields'] = $search; + $config['search_fields'] = $search; $config['required_fields'] = [$uid_field]; // set search filter @@ -823,14 +823,14 @@ class acl extends rcube_plugin protected function resolve_acl_identifier($id, &$title = null) { if ($this->init_ldap()) { - $groups = $this->rc->config->get('acl_groups'); - $prefix = $this->rc->config->get('acl_group_prefix'); + $groups = $this->rc->config->get('acl_groups'); + $prefix = $this->rc->config->get('acl_group_prefix'); $group_field = $this->rc->config->get('acl_group_field', 'name'); // Unfortunately this works only if group_field=name, // list_groups() allows searching by group name only if ($groups && $prefix && $group_field === 'name' && strpos($id, $prefix) === 0) { - $gid = substr($id, strlen($prefix)); + $gid = substr($id, strlen($prefix)); $result = $this->ldap->list_groups($gid, rcube_addressbook::SEARCH_STRICT); if (count($result) === 1 && ($record = $result[0])) { @@ -853,7 +853,7 @@ class acl extends rcube_plugin if ($result->count === 1 && ($record = $result->first())) { if ($record['uid'] === $id) { - $title = rcube_addressbook::compose_search_name($record); + $title = rcube_addressbook::compose_search_name($record); $display = rcube_addressbook::compose_list_name($record); return $display; diff --git a/plugins/acl/tests/Acl.php b/plugins/acl/tests/Acl.php index 5fd2f1332..9fa18e49f 100644 --- a/plugins/acl/tests/Acl.php +++ b/plugins/acl/tests/Acl.php @@ -12,7 +12,7 @@ class Acl_Plugin extends ActionTestCase */ public function test_constructor() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new acl($rcube->plugins); $this->assertInstanceOf('acl', $plugin); diff --git a/plugins/additional_message_headers/tests/AdditionalMessageHeaders.php b/plugins/additional_message_headers/tests/AdditionalMessageHeaders.php index 3cd225647..7d6708688 100644 --- a/plugins/additional_message_headers/tests/AdditionalMessageHeaders.php +++ b/plugins/additional_message_headers/tests/AdditionalMessageHeaders.php @@ -12,7 +12,7 @@ class AdditionalMessageHeaders_Plugin extends ActionTestCase */ public function test_plugin() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new additional_message_headers($rcube->plugins); $this->assertInstanceOf('additional_message_headers', $plugin); diff --git a/plugins/archive/archive.php b/plugins/archive/archive.php index 1404ff94e..670e5272c 100644 --- a/plugins/archive/archive.php +++ b/plugins/archive/archive.php @@ -37,15 +37,15 @@ class archive extends rcube_plugin $this->add_texts('localization', true); $this->add_button( [ - 'type' => 'link', - 'label' => 'buttontext', - 'command' => 'plugin.archive', - 'class' => 'button buttonPas archive disabled', + 'type' => 'link', + 'label' => 'buttontext', + 'command' => 'plugin.archive', + 'class' => 'button buttonPas archive disabled', 'classact' => 'button archive', - 'width' => 32, - 'height' => 32, - 'title' => 'buttontitle', - 'domain' => $this->ID, + 'width' => 32, + 'height' => 32, + 'title' => 'buttontitle', + 'domain' => $this->ID, 'innerclass' => 'inner', ], 'toolbar'); @@ -124,11 +124,11 @@ class archive extends rcube_plugin $this->add_texts('localization'); - $storage = $rcmail->get_storage(); - $delimiter = $storage->get_hierarchy_delimiter(); - $threading = (bool) $storage->get_threading(); - $read_on_move = (bool) $rcmail->config->get('read_on_archive'); - $archive_type = $rcmail->config->get('archive_type', ''); + $storage = $rcmail->get_storage(); + $delimiter = $storage->get_hierarchy_delimiter(); + $threading = (bool) $storage->get_threading(); + $read_on_move = (bool) $rcmail->config->get('read_on_archive'); + $archive_type = $rcmail->config->get('archive_type', ''); $archive_prefix = $this->archive_folder . $delimiter; $search_request = rcube_utils::get_input_string('_search', rcube_utils::INPUT_GPC); $from_show_action = !empty($_POST['_from']) && $_POST['_from'] == 'show'; @@ -141,15 +141,15 @@ class archive extends rcube_plugin $sort_col = rcmail_action_mail_index::sort_column(); $sort_ord = rcmail_action_mail_index::sort_order(); - $count = 0; - $uids = null; + $count = 0; + $uids = null; // this way response handler for 'move' action will be executed $rcmail->action = 'move'; - $this->result = [ - 'reload' => false, - 'error' => false, - 'sources' => [], + $this->result = [ + 'reload' => false, + 'error' => false, + 'sources' => [], 'destinations' => [], ]; @@ -172,11 +172,11 @@ class archive extends rcube_plugin } else { if ($uids == '*') { $index = $storage->index(null, $sort_col, $sort_ord); - $uids = $index->get(); + $uids = $index->get(); } $messages = $storage->fetch_headers($mbox, $uids); - $execute = []; + $execute = []; foreach ($messages as $message) { $subfolder = null; @@ -254,16 +254,16 @@ class archive extends rcube_plugin $rcmail->output->send(); } - $mbox = $storage->get_folder(); - $msg_count = $storage->count(null, $threading ? 'THREADS' : 'ALL'); - $exists = $storage->count($mbox, 'EXISTS', true); - $page_size = $storage->get_pagesize(); - $page = $storage->get_page(); - $pages = ceil($msg_count / $page_size); + $mbox = $storage->get_folder(); + $msg_count = $storage->count(null, $threading ? 'THREADS' : 'ALL'); + $exists = $storage->count($mbox, 'EXISTS', true); + $page_size = $storage->get_pagesize(); + $page = $storage->get_page(); + $pages = ceil($msg_count / $page_size); $nextpage_count = $old_count - $page_size * $page; - $remaining = $msg_count - $page_size * ($page - 1); - $quota_root = $multifolder ? $this->result['sources'][0] : 'INBOX'; - $jump_back = false; + $remaining = $msg_count - $page_size * ($page - 1); + $quota_root = $multifolder ? $this->result['sources'][0] : 'INBOX'; + $jump_back = false; // jump back one page (user removed the whole last page) if ($page > 1 && $remaining == 0) { @@ -348,7 +348,7 @@ class archive extends rcube_plugin */ private function subfolder_worker($folder) { - $storage = rcmail::get_instance()->get_storage(); + $storage = rcmail::get_instance()->get_storage(); $delimiter = $storage->get_hierarchy_delimiter(); if ($this->folders === null) { @@ -382,7 +382,7 @@ class archive extends rcube_plugin { $this->add_texts('localization'); - $rcmail = rcmail::get_instance(); + $rcmail = rcmail::get_instance(); $dont_override = $rcmail->config->get('dont_override', []); if ($args['section'] == 'folders' && !in_array('archive_mbox', $dont_override)) { @@ -392,20 +392,20 @@ class archive extends rcube_plugin // load folders list when needed if ($args['current']) { $select = rcmail_action::folder_selector([ - 'noselection' => '---', - 'realnames' => true, - 'maxlength' => 30, + 'noselection' => '---', + 'realnames' => true, + 'maxlength' => 30, 'folder_filter' => 'mail', 'folder_rights' => 'w', - 'onchange' => "if ($(this).val() == 'INBOX') $(this).val('')", - 'class' => 'custom-select', + 'onchange' => "if ($(this).val() == 'INBOX') $(this).val('')", + 'class' => 'custom-select', ]); } else { $select = new html_select(); } $args['blocks']['main']['options']['archive_mbox'] = [ - 'title' => html::label('_archive_mbox', rcube::Q($this->gettext('archivefolder'))), + 'title' => html::label('_archive_mbox', rcube::Q($this->gettext('archivefolder'))), 'content' => $select->show($mbox, ['id' => '_archive_mbox', 'name' => '_archive_mbox']), ]; @@ -424,10 +424,10 @@ class archive extends rcube_plugin $archive_type->add($this->gettext('archivetypefoldermonth'), 'foldermonth'); $args['blocks']['archive'] = [ - 'name' => rcube::Q($this->gettext('settingstitle')), + 'name' => rcube::Q($this->gettext('settingstitle')), 'options' => [ 'archive_type' => [ - 'title' => html::label('ff_archive_type', rcube::Q($this->gettext('archivetype'))), + 'title' => html::label('ff_archive_type', rcube::Q($this->gettext('archivetype'))), 'content' => $archive_type->show($type), ], ], @@ -436,7 +436,7 @@ class archive extends rcube_plugin } 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'))), + 'title' => html::label('ff_read_on_archive', rcube::Q($this->gettext('readonarchive'))), 'content' => $chbox->show($rcmail->config->get('read_on_archive') ? 1 : 0), ]; } @@ -453,7 +453,7 @@ class archive extends rcube_plugin */ public function prefs_save($args) { - $rcmail = rcmail::get_instance(); + $rcmail = rcmail::get_instance(); $dont_override = $rcmail->config->get('dont_override', []); if ($args['section'] == 'folders' && !in_array('archive_mbox', $dont_override)) { @@ -481,10 +481,10 @@ class archive extends rcube_plugin } if ($delim === null) { - $rcmail = rcmail::get_instance(); - $storage = $rcmail->get_storage(); - $delim = $storage->get_hierarchy_delimiter(); - $vendor = $storage->get_vendor(); + $rcmail = rcmail::get_instance(); + $storage = $rcmail->get_storage(); + $delim = $storage->get_hierarchy_delimiter(); + $vendor = $storage->get_vendor(); $skip_hidden = $rcmail->config->get('imap_skip_hidden_folders'); } diff --git a/plugins/archive/tests/Archive.php b/plugins/archive/tests/Archive.php index 0646ca198..68ed644eb 100644 --- a/plugins/archive/tests/Archive.php +++ b/plugins/archive/tests/Archive.php @@ -14,7 +14,7 @@ class Archive_Plugin extends TestCase */ public function test_constructor() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new archive($rcube->plugins); $this->assertInstanceOf('archive', $plugin); @@ -28,7 +28,7 @@ class Archive_Plugin extends TestCase */ public function test_prefs_table() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new archive($rcube->plugins); $args = ['section' => 'server', 'blocks' => ['main' => ['options' => []]]]; @@ -53,32 +53,32 @@ class Archive_Plugin extends TestCase */ public function test_prefs_save() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new archive($rcube->plugins); $_POST = []; - $args = ['section' => 'folders', 'prefs' => []]; + $args = ['section' => 'folders', 'prefs' => []]; $result = $plugin->prefs_save($args); $this->assertSame('', $result['prefs']['archive_type']); $_POST = ['_archive_type' => 'aaa']; - $args = ['section' => 'folders', 'prefs' => []]; + $args = ['section' => 'folders', 'prefs' => []]; $result = $plugin->prefs_save($args); $this->assertSame('aaa', $result['prefs']['archive_type']); $_POST = []; - $args = ['section' => 'server', 'prefs' => []]; + $args = ['section' => 'server', 'prefs' => []]; $result = $plugin->prefs_save($args); $this->assertFalse($result['prefs']['read_on_archive']); $_POST = ['_read_on_archive' => 1]; - $args = ['section' => 'server', 'prefs' => []]; + $args = ['section' => 'server', 'prefs' => []]; $result = $plugin->prefs_save($args); diff --git a/plugins/attachment_reminder/attachment_reminder.php b/plugins/attachment_reminder/attachment_reminder.php index a4d2b7fd4..33925faad 100644 --- a/plugins/attachment_reminder/attachment_reminder.php +++ b/plugins/attachment_reminder/attachment_reminder.php @@ -27,7 +27,7 @@ class attachment_reminder extends rcube_plugin { - public $task = 'mail|settings'; + public $task = 'mail|settings'; public $noajax = true; /** @@ -71,7 +71,7 @@ class attachment_reminder extends rcube_plugin $checkbox = new html_checkbox(['name' => '_attachment_reminder', 'id' => $field_id, 'value' => 1]); $args['blocks']['main']['options']['attachment_reminder'] = [ - 'title' => html::label($field_id, rcube::Q($this->gettext('reminderoption'))), + 'title' => html::label($field_id, rcube::Q($this->gettext('reminderoption'))), 'content' => $checkbox->show($reminder ? 1 : 0), ]; } diff --git a/plugins/attachment_reminder/tests/AttachmentReminder.php b/plugins/attachment_reminder/tests/AttachmentReminder.php index b62edf2e9..fc994a4d7 100644 --- a/plugins/attachment_reminder/tests/AttachmentReminder.php +++ b/plugins/attachment_reminder/tests/AttachmentReminder.php @@ -14,7 +14,7 @@ class AttachmentReminder_Plugin extends TestCase */ public function test_constructor() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new attachment_reminder($rcube->plugins); $this->assertInstanceOf('attachment_reminder', $plugin); @@ -28,7 +28,7 @@ class AttachmentReminder_Plugin extends TestCase */ public function test_prefs_list() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new attachment_reminder($rcube->plugins); $args = ['section' => 'compose', 'blocks' => ['main' => ['options' => []]]]; @@ -50,18 +50,18 @@ class AttachmentReminder_Plugin extends TestCase */ public function test_prefs_save() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new attachment_reminder($rcube->plugins); $_POST = []; - $args = ['section' => 'compose', 'prefs' => []]; + $args = ['section' => 'compose', 'prefs' => []]; $result = $plugin->prefs_save($args); $this->assertFalse($result['prefs']['attachment_reminder']); $_POST = ['_attachment_reminder' => 1]; - $args = ['section' => 'compose', 'prefs' => []]; + $args = ['section' => 'compose', 'prefs' => []]; $result = $plugin->prefs_save($args); diff --git a/plugins/autologon/autologon.php b/plugins/autologon/autologon.php index 5b9a4599f..945cd885a 100644 --- a/plugins/autologon/autologon.php +++ b/plugins/autologon/autologon.php @@ -47,11 +47,11 @@ class autologon extends rcube_plugin public function authenticate($args) { if (!empty($_GET['_autologin']) && $this->is_localhost()) { - $args['user'] = 'me'; - $args['pass'] = '******'; - $args['host'] = 'localhost'; + $args['user'] = 'me'; + $args['pass'] = '******'; + $args['host'] = 'localhost'; $args['cookiecheck'] = false; - $args['valid'] = true; + $args['valid'] = true; } return $args; diff --git a/plugins/autologon/tests/Autologon.php b/plugins/autologon/tests/Autologon.php index 11f909f08..c4f91a48a 100644 --- a/plugins/autologon/tests/Autologon.php +++ b/plugins/autologon/tests/Autologon.php @@ -14,7 +14,7 @@ class Autologon_Plugin extends TestCase */ public function test_constructor() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new autologon($rcube->plugins); $this->assertInstanceOf('autologon', $plugin); diff --git a/plugins/autologout/tests/Autologout.php b/plugins/autologout/tests/Autologout.php index 5bd14ef7b..a7bbc771f 100644 --- a/plugins/autologout/tests/Autologout.php +++ b/plugins/autologout/tests/Autologout.php @@ -14,7 +14,7 @@ class Autologout_Plugin extends TestCase */ public function test_constructor() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new autologout($rcube->plugins); $this->assertInstanceOf('autologout', $plugin); diff --git a/plugins/database_attachments/database_attachments.php b/plugins/database_attachments/database_attachments.php index 017ffcda5..7629595ed 100644 --- a/plugins/database_attachments/database_attachments.php +++ b/plugins/database_attachments/database_attachments.php @@ -47,20 +47,20 @@ class database_attachments extends filesystem_attachments $args['status'] = false; $cache = $this->get_cache(); - $key = $this->_key($args); - $data = file_get_contents($args['path']); + $key = $this->_key($args); + $data = file_get_contents($args['path']); if ($data === false) { return $args; } - $data = base64_encode($data); + $data = base64_encode($data); $status = $cache->set($key, $data); if ($status) { - $args['id'] = $key; + $args['id'] = $key; $args['status'] = true; - $args['path'] = null; + $args['path'] = null; } return $args; @@ -74,7 +74,7 @@ class database_attachments extends filesystem_attachments $args['status'] = false; $cache = $this->get_cache(); - $key = $this->_key($args); + $key = $this->_key($args); if (!empty($args['path'])) { $args['data'] = file_get_contents($args['path']); @@ -86,7 +86,7 @@ class database_attachments extends filesystem_attachments $args['path'] = null; } - $data = base64_encode($args['data']); + $data = base64_encode($args['data']); $status = $cache->set($key, $data); if ($status) { @@ -103,7 +103,7 @@ class database_attachments extends filesystem_attachments */ public function remove($args) { - $cache = $this->get_cache(); + $cache = $this->get_cache(); $status = $cache->remove($args['id']); $args['status'] = true; @@ -128,7 +128,7 @@ class database_attachments extends filesystem_attachments public function get($args) { $cache = $this->get_cache(); - $data = $cache->get($args['id']); + $data = $cache->get($args['id']); if ($data !== null && $data !== false) { $args['data'] = base64_decode($data); @@ -169,9 +169,9 @@ class database_attachments extends filesystem_attachments $this->load_config(); $rcmail = rcube::get_instance(); - $ttl = 12 * 60 * 60; // default: 12 hours - $ttl = $rcmail->config->get('database_attachments_cache_ttl', $ttl); - $type = $rcmail->config->get('database_attachments_cache', 'db'); + $ttl = 12 * 60 * 60; // default: 12 hours + $ttl = $rcmail->config->get('database_attachments_cache_ttl', $ttl); + $type = $rcmail->config->get('database_attachments_cache', 'db'); $prefix = self::PREFIX; // Add session identifier to the prefix to prevent from removing attachments diff --git a/plugins/database_attachments/tests/DatabaseAttachments.php b/plugins/database_attachments/tests/DatabaseAttachments.php index 1b7de9514..9d49c4847 100644 --- a/plugins/database_attachments/tests/DatabaseAttachments.php +++ b/plugins/database_attachments/tests/DatabaseAttachments.php @@ -14,7 +14,7 @@ class DatabaseAttachments_Plugin extends TestCase */ public function test_constructor() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new database_attachments($rcube->plugins); $this->assertInstanceOf('database_attachments', $plugin); diff --git a/plugins/debug_logger/debug_logger.php b/plugins/debug_logger/debug_logger.php index 840951566..e94d1315b 100644 --- a/plugins/debug_logger/debug_logger.php +++ b/plugins/debug_logger/debug_logger.php @@ -74,7 +74,7 @@ class debug_logger extends rcube_plugin } $log_config = rcmail::get_instance()->config->get('debug_logger', []); - $log_dir = rcmail::get_instance()->config->get('log_dir'); + $log_dir = rcmail::get_instance()->config->get('log_dir'); foreach ($log_config as $type => $file) { $this->runlog->set_file($log_dir . '/' . $file, $type); @@ -82,7 +82,7 @@ class debug_logger extends rcube_plugin $start_string = ''; $action = rcmail::get_instance()->action; - $task = rcmail::get_instance()->task; + $task = rcmail::get_instance()->task; if ($action) { $start_string .= "Action: {$action}. "; @@ -113,7 +113,7 @@ class debug_logger extends rcube_plugin } 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(); + $bt = debug_backtrace(); $file = count($bt) >= 2 ? $bt[2]['file'] : ''; switch (basename($file)) { diff --git a/plugins/debug_logger/runlog/runlog.php b/plugins/debug_logger/runlog/runlog.php index 1a96ae384..4ac26b342 100644 --- a/plugins/debug_logger/runlog/runlog.php +++ b/plugins/debug_logger/runlog/runlog.php @@ -7,18 +7,18 @@ */ class runlog { - private $start_time = false; - private $parent_stack = []; - private $file_handles = []; + private $start_time = false; + private $parent_stack = []; + private $file_handles = []; private $debug_messages = []; - private $indent = 0; - private $run_log = []; + private $indent = 0; + private $run_log = []; public $print_to_console = false; - public $threshold = 0; - public $tag_count = []; - public $timestamp = 'd-M-Y H:i:s O'; - public $max_line_size = 150; + public $threshold = 0; + public $tag_count = []; + public $timestamp = 'd-M-Y H:i:s O'; + public $max_line_size = 150; public function __construct() { @@ -28,13 +28,13 @@ class runlog public function start($name, $tag = false) { $this->run_log[] = [ - 'type' => 'start', - 'tag' => $tag, - 'index' => count($this->run_log), - 'value' => $name, - 'time' => microtime(true), + 'type' => 'start', + 'tag' => $tag, + 'index' => count($this->run_log), + 'value' => $name, + 'time' => microtime(true), 'parents' => $this->parent_stack, - 'ended' => false, + 'ended' => false, ]; $this->parent_stack[] = $name; @@ -46,7 +46,7 @@ class runlog public function end() { - $name = array_pop($this->parent_stack); + $name = array_pop($this->parent_stack); $lastk = 0; foreach ($this->run_log as $k => $entry) { @@ -59,13 +59,13 @@ class runlog $this->run_log[$lastk]['duration'] = microtime(true) - $start; $this->run_log[$lastk]['ended'] = true; $this->run_log[] = [ - 'type' => 'end', - 'tag' => $this->run_log[$lastk]['tag'], - 'index' => $lastk, - 'value' => $name, - 'time' => microtime(true), + 'type' => 'end', + 'tag' => $this->run_log[$lastk]['tag'], + 'index' => $lastk, + 'value' => $name, + 'time' => microtime(true), 'duration' => microtime(true) - $start, - 'parents' => $this->parent_stack, + 'parents' => $this->parent_stack, ]; $this->indent--; @@ -129,10 +129,10 @@ class runlog } $this->debug_messages[] = $msg; $this->run_log[] = [ - 'type' => 'note', - 'tag' => $tag ?: 'text', - 'value' => htmlentities($msg), - 'time' => microtime(true), + 'type' => 'note', + 'tag' => $tag ?: 'text', + 'value' => htmlentities($msg), + 'time' => microtime(true), 'parents' => $this->parent_stack, ]; diff --git a/plugins/debug_logger/tests/DebugLogger.php b/plugins/debug_logger/tests/DebugLogger.php index a30b4677b..926578b90 100644 --- a/plugins/debug_logger/tests/DebugLogger.php +++ b/plugins/debug_logger/tests/DebugLogger.php @@ -14,7 +14,7 @@ class DebugLogger_Plugin extends TestCase */ public function test_constructor() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new debug_logger($rcube->plugins); $this->assertInstanceOf('debug_logger', $plugin); diff --git a/plugins/emoticons/emoticons.php b/plugins/emoticons/emoticons.php index 43f1dc3ed..3c159f757 100644 --- a/plugins/emoticons/emoticons.php +++ b/plugins/emoticons/emoticons.php @@ -74,7 +74,7 @@ class emoticons extends rcube_plugin */ public function preferences_list($args) { - $rcube = rcmail::get_instance(); + $rcube = rcmail::get_instance(); $dont_override = $rcube->config->get('dont_override', []); if ($args['section'] == 'mailview' && !in_array('emoticons_display', $dont_override)) { @@ -85,7 +85,7 @@ class emoticons extends rcube_plugin $checkbox = new html_checkbox(['name' => '_' . $field_id, 'id' => $field_id, 'value' => 1]); $args['blocks']['main']['options']['emoticons_display'] = [ - 'title' => html::label($field_id, $this->gettext('emoticonsdisplay')), + 'title' => html::label($field_id, $this->gettext('emoticonsdisplay')), 'content' => $checkbox->show(intval($rcube->config->get('emoticons_display', false))), ]; } elseif ($args['section'] == 'compose' && !in_array('emoticons_compose', $dont_override)) { @@ -96,7 +96,7 @@ class emoticons extends rcube_plugin $checkbox = new html_checkbox(['name' => '_' . $field_id, 'id' => $field_id, 'value' => 1]); $args['blocks']['main']['options']['emoticons_compose'] = [ - 'title' => html::label($field_id, $this->gettext('emoticonscompose')), + 'title' => html::label($field_id, $this->gettext('emoticonscompose')), 'content' => $checkbox->show(intval($rcube->config->get('emoticons_compose', true))), ]; } @@ -141,18 +141,18 @@ class emoticons extends rcube_plugin // map of emoticon replacements $map = [ - '/(? self::ico_tag('1f603', ':D'), // laugh - '/:-?\(/' => self::ico_tag('1f626', ':('), // frown - '/' . $entity . ';-?\)/' => self::ico_tag('1f609', ';)'), // wink - '/8-?\)/' => self::ico_tag('1f60e', '8)'), // cool - '/(? self::ico_tag('1f62e', ':O'), // surprised - '/(? self::ico_tag('1f61b', ':P'), // tongue out - '/(? self::ico_tag('1f631', ':-@'), // yell - '/O:-?\)/i' => self::ico_tag('1f607', 'O:-)'), // innocent - '/(? self::ico_tag('1f60a', ':-)'), // smile - '/(? self::ico_tag('1f633', ':-$'), // embarrassed + '/(? self::ico_tag('1f603', ':D'), // laugh + '/:-?\(/' => self::ico_tag('1f626', ':('), // frown + '/' . $entity . ';-?\)/' => self::ico_tag('1f609', ';)'), // wink + '/8-?\)/' => self::ico_tag('1f60e', '8)'), // cool + '/(? self::ico_tag('1f62e', ':O'), // surprised + '/(? self::ico_tag('1f61b', ':P'), // tongue out + '/(? self::ico_tag('1f631', ':-@'), // yell + '/O:-?\)/i' => self::ico_tag('1f607', 'O:-)'), // innocent + '/(? self::ico_tag('1f60a', ':-)'), // smile + '/(? self::ico_tag('1f633', ':-$'), // embarrassed '/(? self::ico_tag('1f48b', ':-*'), // kiss - '/(? self::ico_tag('1f615', ':-S'), // undecided + '/(? self::ico_tag('1f615', ':-S'), // undecided ]; return preg_replace(array_keys($map), array_values($map), $text); diff --git a/plugins/emoticons/tests/Emoticons.php b/plugins/emoticons/tests/Emoticons.php index 1a2058932..3611990f4 100644 --- a/plugins/emoticons/tests/Emoticons.php +++ b/plugins/emoticons/tests/Emoticons.php @@ -14,7 +14,7 @@ class Emoticons_Plugin extends TestCase */ public function test_constructor() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new emoticons($rcube->plugins); $this->assertInstanceOf('emoticons', $plugin); diff --git a/plugins/enigma/bin/import_keys.sh b/plugins/enigma/bin/import_keys.sh index d63628b92..f625f2ac6 100755 --- a/plugins/enigma/bin/import_keys.sh +++ b/plugins/enigma/bin/import_keys.sh @@ -140,10 +140,10 @@ function import_dir($user_id, $dir, $dry_run = false) { global $rcmail; - $db = $rcmail->get_dbh(); - $table = $db->table_name('filestore', true); + $db = $rcmail->get_dbh(); + $table = $db->table_name('filestore', true); $db_files = ['pubring.gpg', 'secring.gpg', 'pubring.kbx']; - $maxsize = min($db->get_variable('max_allowed_packet', 1048500), 4 * 1024 * 1024) - 2000; + $maxsize = min($db->get_variable('max_allowed_packet', 1048500), 4 * 1024 * 1024) - 2000; foreach (glob("{$dir}/private-keys-v1.d/*.key") as $file) { $db_files[] = substr($file, strlen($dir) + 1); @@ -151,8 +151,8 @@ function import_dir($user_id, $dir, $dry_run = false) foreach ($db_files as $file) { if ($mtime = @filemtime("{$dir}/{$file}")) { - $data = file_get_contents("{$dir}/{$file}"); - $data = base64_encode($data); + $data = file_get_contents("{$dir}/{$file}"); + $data = base64_encode($data); $datasize = strlen($data); if ($datasize > $maxsize) { diff --git a/plugins/enigma/enigma.php b/plugins/enigma/enigma.php index c24c2931c..3f73cdfc8 100644 --- a/plugins/enigma/enigma.php +++ b/plugins/enigma/enigma.php @@ -195,9 +195,9 @@ class enigma extends rcube_plugin // register as settings action $args['actions'][] = [ 'action' => 'plugin.enigmakeys', - 'class' => 'enigma keys', - 'label' => 'enigmakeys', - 'title' => 'enigmakeys', + 'class' => 'enigma keys', + 'label' => 'enigmakeys', + 'title' => 'enigmakeys', 'domain' => 'enigma', ]; /* @@ -252,14 +252,14 @@ class enigma extends rcube_plugin } $field_id = 'rcmfd_enigma_encryption'; - $input = new html_checkbox([ - 'name' => '_enigma_encryption', - 'id' => $field_id, + $input = new html_checkbox([ + 'name' => '_enigma_encryption', + 'id' => $field_id, 'value' => 1, ]); $p['blocks']['main']['options']['enigma_encryption'] = [ - 'title' => html::label($field_id, $this->gettext('supportencryption')), + 'title' => html::label($field_id, $this->gettext('supportencryption')), 'content' => $input->show(intval($this->rc->config->get('enigma_encryption'))), ]; } @@ -271,14 +271,14 @@ class enigma extends rcube_plugin } $field_id = 'rcmfd_enigma_signatures'; - $input = new html_checkbox([ - 'name' => '_enigma_signatures', - 'id' => $field_id, + $input = new html_checkbox([ + 'name' => '_enigma_signatures', + 'id' => $field_id, 'value' => 1, ]); $p['blocks']['main']['options']['enigma_signatures'] = [ - 'title' => html::label($field_id, $this->gettext('supportsignatures')), + 'title' => html::label($field_id, $this->gettext('supportsignatures')), 'content' => $input->show(intval($this->rc->config->get('enigma_signatures'))), ]; } @@ -290,14 +290,14 @@ class enigma extends rcube_plugin } $field_id = 'rcmfd_enigma_decryption'; - $input = new html_checkbox([ - 'name' => '_enigma_decryption', - 'id' => $field_id, + $input = new html_checkbox([ + 'name' => '_enigma_decryption', + 'id' => $field_id, 'value' => 1, ]); $p['blocks']['main']['options']['enigma_decryption'] = [ - 'title' => html::label($field_id, $this->gettext('supportdecryption')), + 'title' => html::label($field_id, $this->gettext('supportdecryption')), 'content' => $input->show(intval($this->rc->config->get('enigma_decryption'))), ]; } @@ -309,14 +309,14 @@ class enigma extends rcube_plugin } $field_id = 'rcmfd_enigma_sign_all'; - $input = new html_checkbox([ - 'name' => '_enigma_sign_all', - 'id' => $field_id, + $input = new html_checkbox([ + 'name' => '_enigma_sign_all', + 'id' => $field_id, 'value' => 1, ]); $p['blocks']['main']['options']['enigma_sign_all'] = [ - 'title' => html::label($field_id, $this->gettext('signdefault')), + 'title' => html::label($field_id, $this->gettext('signdefault')), 'content' => $input->show($this->rc->config->get('enigma_sign_all') ? 1 : 0), ]; } @@ -328,14 +328,14 @@ class enigma extends rcube_plugin } $field_id = 'rcmfd_enigma_encrypt_all'; - $input = new html_checkbox([ - 'name' => '_enigma_encrypt_all', - 'id' => $field_id, + $input = new html_checkbox([ + 'name' => '_enigma_encrypt_all', + 'id' => $field_id, 'value' => 1, ]); $p['blocks']['main']['options']['enigma_encrypt_all'] = [ - 'title' => html::label($field_id, $this->gettext('encryptdefault')), + 'title' => html::label($field_id, $this->gettext('encryptdefault')), 'content' => $input->show($this->rc->config->get('enigma_encrypt_all') ? 1 : 0), ]; } @@ -347,14 +347,14 @@ class enigma extends rcube_plugin } $field_id = 'rcmfd_enigma_attach_pubkey'; - $input = new html_checkbox([ - 'name' => '_enigma_attach_pubkey', - 'id' => $field_id, + $input = new html_checkbox([ + 'name' => '_enigma_attach_pubkey', + 'id' => $field_id, 'value' => 1, ]); $p['blocks']['main']['options']['enigma_attach_pubkey'] = [ - 'title' => html::label($field_id, $this->gettext('attachpubkeydefault')), + 'title' => html::label($field_id, $this->gettext('attachpubkeydefault')), 'content' => $input->show($this->rc->config->get('enigma_attach_pubkey') ? 1 : 0), ]; } @@ -366,7 +366,7 @@ class enigma extends rcube_plugin } $field_id = 'rcmfd_enigma_password_time'; - $select = new html_select(['name' => '_enigma_password_time', 'id' => $field_id, 'class' => 'custom-select']); + $select = new html_select(['name' => '_enigma_password_time', 'id' => $field_id, 'class' => 'custom-select']); foreach ([1, 5, 10, 15, 30] as $m) { $label = $this->gettext(['name' => 'nminutes', 'vars' => ['m' => $m]]); @@ -375,7 +375,7 @@ class enigma extends rcube_plugin $select->add($this->gettext('wholesession'), 0); $p['blocks']['main']['options']['enigma_password_time'] = [ - 'title' => html::label($field_id, $this->gettext('passwordtime')), + 'title' => html::label($field_id, $this->gettext('passwordtime')), 'content' => $select->show(intval($this->rc->config->get('enigma_password_time'))), ]; } @@ -434,8 +434,8 @@ class enigma extends rcube_plugin // find private keys for this identity if (!empty($p['record']['email'])) { $listing = []; - $engine = $this->load_engine(); - $keys = $engine->list_keys($p['record']['email']); + $engine = $this->load_engine(); + $keys = $engine->list_keys($p['record']['email']); // On error do nothing, plugin/gnupg misconfigured? if ($keys instanceof enigma_error) { @@ -461,8 +461,8 @@ class enigma extends rcube_plugin // add button linking to enigma key management $button_attr = [ - 'class' => 'button', - 'href' => $this->rc->url(['action' => 'plugin.enigmakeys']), + 'class' => 'button', + 'href' => $this->rc->url(['action' => 'plugin.enigmakeys']), 'target' => '_parent', ]; $content .= html::p(null, html::a($button_attr, $this->gettext('managekeys'))); diff --git a/plugins/enigma/lib/enigma_driver_gnupg.php b/plugins/enigma/lib/enigma_driver_gnupg.php index 01f15b806..066665acb 100644 --- a/plugins/enigma/lib/enigma_driver_gnupg.php +++ b/plugins/enigma/lib/enigma_driver_gnupg.php @@ -23,7 +23,7 @@ class enigma_driver_gnupg extends enigma_driver protected $homedir; protected $user; protected $last_sig_algorithm; - protected $debug = false; + protected $debug = false; protected $db_files = ['pubring.gpg', 'secring.gpg', 'pubring.kbx']; /** @@ -33,7 +33,7 @@ class enigma_driver_gnupg extends enigma_driver */ public function __construct($user) { - $this->rc = rcmail::get_instance(); + $this->rc = rcmail::get_instance(); $this->user = $user; } @@ -46,9 +46,9 @@ class enigma_driver_gnupg extends enigma_driver public function init() { $homedir = $this->rc->config->get('enigma_pgp_homedir'); - $debug = $this->rc->config->get('enigma_debug'); - $binary = $this->rc->config->get('enigma_pgp_binary'); - $agent = $this->rc->config->get('enigma_pgp_agent'); + $debug = $this->rc->config->get('enigma_debug'); + $binary = $this->rc->config->get('enigma_pgp_binary'); + $agent = $this->rc->config->get('enigma_pgp_agent'); $gpgconf = $this->rc->config->get('enigma_pgp_gpgconf'); if (!$homedir) { @@ -82,7 +82,7 @@ class enigma_driver_gnupg extends enigma_driver "Unable to write to keys directory: {$homedir}"); } - $this->debug = $debug; + $this->debug = $debug; $this->homedir = $homedir; $options = ['homedir' => $this->homedir]; @@ -134,7 +134,7 @@ class enigma_driver_gnupg extends enigma_driver if ($sign_key) { $this->gpg->addSignKey($sign_key->reference, $sign_key->password); - $res = $this->gpg->encryptAndSign($text, true); + $res = $this->gpg->encryptAndSign($text, true); $sigInfo = $this->gpg->getLastSignatureInfo(); $this->last_sig_algorithm = $sigInfo->getHashAlgorithmName(); @@ -200,7 +200,7 @@ class enigma_driver_gnupg extends enigma_driver try { $this->gpg->addSignKey($key->reference, $key->password); - $res = $this->gpg->sign($text, $mode, Crypt_GPG::ARMOR_ASCII, true); + $res = $this->gpg->sign($text, $mode, Crypt_GPG::ARMOR_ASCII, true); $sigInfo = $this->gpg->getLastSignatureInfo(); $this->last_sig_algorithm = $sigInfo->getHashAlgorithmName(); @@ -300,7 +300,7 @@ class enigma_driver_gnupg extends enigma_driver public function list_keys($pattern = '') { try { - $keys = $this->gpg->getKeys($pattern); + $keys = $this->gpg->getKeys($pattern); $result = []; foreach ($keys as $idx => $key) { @@ -342,11 +342,11 @@ class enigma_driver_gnupg extends enigma_driver public function gen_key($data) { try { - $debug = $this->rc->config->get('enigma_debug'); + $debug = $this->rc->config->get('enigma_debug'); $keygen = new Crypt_GPG_KeyGenerator([ 'homedir' => $this->homedir, // 'binary' => '/usr/bin/gpg2', - 'debug' => $debug ? [$this, 'debug'] : false, + 'debug' => $debug ? [$this, 'debug'] : false, ]); $key = $keygen @@ -465,7 +465,7 @@ class enigma_driver_gnupg extends enigma_driver $data['id'] = $e->getKeyId(); } elseif ($e instanceof Crypt_GPG_BadPassphraseException) { $error = enigma_error::BADPASS; - $data['bad'] = $e->getBadPassphrases(); + $data['bad'] = $e->getBadPassphrases(); $data['missing'] = $e->getMissingPassphrases(); } elseif ($e instanceof Crypt_GPG_NoDataException) { $error = enigma_error::NODATA; @@ -491,17 +491,17 @@ class enigma_driver_gnupg extends enigma_driver { $data = new enigma_signature(); - $data->id = $sig->getId() ?: $sig->getKeyId(); - $data->valid = $sig->isValid(); + $data->id = $sig->getId() ?: $sig->getKeyId(); + $data->valid = $sig->isValid(); $data->fingerprint = $sig->getKeyFingerprint(); - $data->created = $sig->getCreationDate(); - $data->expires = $sig->getExpirationDate(); + $data->created = $sig->getCreationDate(); + $data->expires = $sig->getExpirationDate(); // In case of ERRSIG user may not be set if ($user = $sig->getUserId()) { - $data->name = $user->getName(); + $data->name = $user->getName(); $data->comment = $user->getComment(); - $data->email = $user->getEmail(); + $data->email = $user->getEmail(); } return $data; @@ -520,10 +520,10 @@ class enigma_driver_gnupg extends enigma_driver foreach ($key->getUserIds() as $idx => $user) { $id = new enigma_userid(); - $id->name = $user->getName(); + $id->name = $user->getName(); $id->comment = $user->getComment(); - $id->email = $user->getEmail(); - $id->valid = $user->isValid(); + $id->email = $user->getEmail(); + $id->valid = $user->isValid(); $id->revoked = $user->isRevoked(); $ekey->users[$idx] = $id; @@ -537,13 +537,13 @@ class enigma_driver_gnupg extends enigma_driver foreach ($key->getSubKeys() as $idx => $subkey) { /** @var Crypt_GPG_SubKey $subkey */ $skey = new enigma_subkey(); - $skey->id = $subkey->getId(); - $skey->revoked = $subkey->isRevoked(); + $skey->id = $subkey->getId(); + $skey->revoked = $subkey->isRevoked(); $skey->fingerprint = $subkey->getFingerprint(); $skey->has_private = $subkey->hasPrivate(); - $skey->algorithm = $subkey->getAlgorithm(); - $skey->length = $subkey->getLength(); - $skey->usage = $subkey->usage(); + $skey->algorithm = $subkey->getAlgorithm(); + $skey->length = $subkey->getLength(); + $skey->usage = $subkey->usage(); if (method_exists($subkey, 'getCreationDateTime')) { $skey->created = $subkey->getCreationDateTime(); @@ -578,7 +578,7 @@ class enigma_driver_gnupg extends enigma_driver return; } - $db = $this->rc->get_dbh(); + $db = $this->rc->get_dbh(); $table = $db->table_name('filestore', true); $files = []; @@ -588,7 +588,7 @@ class enigma_driver_gnupg extends enigma_driver ); while ($record = $db->fetch_assoc($result)) { - $file = $this->homedir . '/' . $record['filename']; + $file = $this->homedir . '/' . $record['filename']; $mtime = @filemtime($file); $files[] = $record['filename']; @@ -598,7 +598,7 @@ class enigma_driver_gnupg extends enigma_driver ); $record = $db->fetch_assoc($data_result); - $data = $record ? base64_decode($record['data']) : null; + $data = $record ? base64_decode($record['data']) : null; if ($data === null || $data === false) { rcube::raise_error([ @@ -665,8 +665,8 @@ class enigma_driver_gnupg extends enigma_driver return true; } - $db = $this->rc->get_dbh(); - $table = $db->table_name('filestore', true); + $db = $this->rc->get_dbh(); + $table = $db->table_name('filestore', true); $records = []; if (!$is_empty) { @@ -681,15 +681,15 @@ class enigma_driver_gnupg extends enigma_driver } foreach ($this->db_files_list() as $filename) { - $file = $this->homedir . '/' . $filename; + $file = $this->homedir . '/' . $filename; $mtime = @filemtime($file); $existing = !empty($records[$filename]) ? $records[$filename] : null; unset($records[$filename]); if ($mtime && (empty($existing) || $mtime > $existing['mtime'])) { - $data = file_get_contents($file); - $data = base64_encode($data); + $data = file_get_contents($file); + $data = base64_encode($data); $datasize = strlen($data); if (empty($maxsize)) { @@ -725,7 +725,7 @@ class enigma_driver_gnupg extends enigma_driver // Delete removed files from database foreach (array_keys($records) as $filename) { - $file = $this->homedir . '/' . $filename; + $file = $this->homedir . '/' . $filename; $result = $db->query("DELETE FROM {$table} WHERE `user_id` = ? AND `context` = ? AND `filename` = ?", $this->rc->user->ID, 'enigma', $filename ); diff --git a/plugins/enigma/lib/enigma_driver_phpssl.php b/plugins/enigma/lib/enigma_driver_phpssl.php index f597a9528..6fdedbbe7 100644 --- a/plugins/enigma/lib/enigma_driver_phpssl.php +++ b/plugins/enigma/lib/enigma_driver_phpssl.php @@ -23,7 +23,7 @@ class enigma_driver_phpssl extends enigma_driver public function __construct($user) { $rcmail = rcmail::get_instance(); - $this->rc = $rcmail; + $this->rc = $rcmail; $this->user = $user; } @@ -163,14 +163,14 @@ class enigma_driver_phpssl extends enigma_driver $data = new enigma_signature(); - $data->id = $cert['hash']; // ? - $data->valid = $validity; + $data->id = $cert['hash']; // ? + $data->valid = $validity; $data->fingerprint = $cert['serialNumber']; - $data->created = $cert['validFrom_time_t']; - $data->expires = $cert['validTo_time_t']; - $data->name = $cert['subject']['CN']; + $data->created = $cert['validFrom_time_t']; + $data->expires = $cert['validTo_time_t']; + $data->name = $cert['subject']['CN']; // $data->comment = ''; - $data->email = $cert['subject']['emailAddress']; + $data->email = $cert['subject']['emailAddress']; return $data; } diff --git a/plugins/enigma/lib/enigma_engine.php b/plugins/enigma/lib/enigma_engine.php index 34a52514d..728542f96 100644 --- a/plugins/enigma/lib/enigma_engine.php +++ b/plugins/enigma/lib/enigma_engine.php @@ -31,15 +31,15 @@ class enigma_engine private $sender; private $cache = []; - public $decryptions = []; - public $signatures = []; + public $decryptions = []; + public $signatures = []; public $encrypted_parts = []; public const ENCRYPTED_PARTIALLY = 100; - public const SIGN_MODE_BODY = 1; + public const SIGN_MODE_BODY = 1; public const SIGN_MODE_SEPARATE = 2; - public const SIGN_MODE_MIME = 4; + public const SIGN_MODE_MIME = 4; public const ENCRYPT_MODE_BODY = 1; public const ENCRYPT_MODE_MIME = 2; @@ -50,7 +50,7 @@ class enigma_engine */ public function __construct($enigma) { - $this->rc = rcmail::get_instance(); + $this->rc = rcmail::get_instance(); $this->enigma = $enigma; $this->password_time = $this->rc->config->get('enigma_password_time') * 60; @@ -70,7 +70,7 @@ class enigma_engine return; } - $driver = 'enigma_driver_' . $this->rc->config->get('enigma_pgp_driver', 'gnupg'); + $driver = 'enigma_driver_' . $this->rc->config->get('enigma_pgp_driver', 'gnupg'); $username = $this->rc->user->get_username(); // Load driver @@ -100,7 +100,7 @@ class enigma_engine return; } - $driver = 'enigma_driver_' . $this->rc->config->get('enigma_smime_driver', 'phpssl'); + $driver = 'enigma_driver_' . $this->rc->config->get('enigma_smime_driver', 'phpssl'); $username = $this->rc->user->get_username(); // Load driver @@ -143,7 +143,7 @@ class enigma_engine // check if we have password for this key $passwords = $this->get_passwords(); - $pass = $passwords[$key->id] ?? null; + $pass = $passwords[$key->id] ?? null; if ($pass === null && !$this->rc->config->get('enigma_passwordless')) { // ask for password @@ -176,7 +176,7 @@ class enigma_engine $body = $message->getTXTBody(); $text_charset = $message->getParam('text_charset'); - $line_length = $this->rc->config->get('line_length', 72); + $line_length = $this->rc->config->get('line_length', 72); // We can't use format=flowed for signed messages if (strpos($text_charset, 'format=flowed')) { @@ -235,7 +235,7 @@ class enigma_engine $from = $mime->getFromAddress(); $sign_key = null; - $keys = []; + $keys = []; // check senders key for signing if ($mode & self::ENCRYPT_MODE_SIGN) { @@ -338,8 +338,8 @@ class enigma_engine public function attach_public_key(&$message) { $headers = $message->headers(); - $from = rcube_mime::decode_address_list($headers['From'], 1, false, null, true); - $from = $from[1] ?? null; + $from = rcube_mime::decode_address_list($headers['From'], 1, false, null, true); + $from = $from[1] ?? null; // find my key if ($from && ($key = $this->find_key($from, true))) { @@ -425,8 +425,8 @@ class enigma_engine $this->load_pgp_driver(); $storage = $this->rc->get_storage(); - $body = $storage->get_message_part($p['object']->uid, $part->mime_id, $part, null, null, true, 0, false); - $result = $this->pgp_decrypt($body); + $body = $storage->get_message_part($p['object']->uid, $part->mime_id, $part, null, null, true, 0, false); + $result = $this->pgp_decrypt($body); // @TODO: what to do on error? if ($result === true) { @@ -464,14 +464,14 @@ class enigma_engine fwrite($fd, $body); rewind($fd); - $body = ''; + $body = ''; $prefix = ''; - $mode = ''; + $mode = ''; $tokens = [ 'BEGIN PGP SIGNED MESSAGE' => 'signed-start', - 'END PGP SIGNATURE' => 'signed-end', - 'BEGIN PGP MESSAGE' => 'encrypted-start', - 'END PGP MESSAGE' => 'encrypted-end', + 'END PGP SIGNATURE' => 'signed-end', + 'BEGIN PGP MESSAGE' => 'encrypted-start', + 'END PGP MESSAGE' => 'encrypted-end', ]; $regexp = '/^-----(' . implode('|', array_keys($tokens)) . ')-----[\r\n]*/'; @@ -687,7 +687,7 @@ class enigma_engine $sig = $this->pgp_verify($msg_body, $sig_body); // Store signature data for display - $this->signatures[$struct->mime_id] = $sig; + $this->signatures[$struct->mime_id] = $sig; $this->signatures[$msg_part->mime_id] = $sig; } } @@ -746,7 +746,7 @@ class enigma_engine // Parse decrypted message if ($result === true) { - $part->body = $prefix . $body; + $part->body = $prefix . $body; $part->body_modified = true; // it maybe PGP signed inside, verify signature @@ -809,7 +809,7 @@ class enigma_engine $this->load_pgp_driver(); $struct = $p['structure']; - $part = $struct->parts[1]; + $part = $struct->parts[1]; // Get body $body = $this->get_part_body($p['object'], $part); @@ -826,9 +826,9 @@ class enigma_engine // Parse the structure (there may be encrypted/signed parts inside $this->part_structure([ - 'object' => $p['object'], + 'object' => $p['object'], 'structure' => $struct, - 'mimetype' => $struct->mimetype, + 'mimetype' => $struct->mimetype, ], $body); // Attach the decryption message to all parts @@ -915,7 +915,7 @@ class enigma_engine // Get rid of possible non-ascii characters (#5962) $msg_body = preg_replace('/[^\x00-\x7F]/', '', $msg_body); - $keys = $this->get_passwords(); + $keys = $this->get_passwords(); $result = $this->pgp_driver->decrypt($msg_body, $keys, $signature); if ($result instanceof enigma_error) { @@ -1027,7 +1027,7 @@ class enigma_engine return null; } - $mode = $can_sign ? enigma_key::CAN_SIGN : enigma_key::CAN_ENCRYPT; + $mode = $can_sign ? enigma_key::CAN_SIGN : enigma_key::CAN_ENCRYPT; $found = []; // check key validity and type @@ -1128,7 +1128,7 @@ class enigma_engine if ($result instanceof enigma_error) { self::raise_error($result, __LINE__); } else { - $result['imported'] = $result['public_imported'] + $result['private_imported']; + $result['imported'] = $result['public_imported'] + $result['private_imported']; $result['unchanged'] = $result['public_unchanged'] + $result['private_unchanged']; } @@ -1166,7 +1166,7 @@ class enigma_engine */ public function password_handler() { - $keyid = rcube_utils::get_input_string('_keyid', rcube_utils::INPUT_POST); + $keyid = rcube_utils::get_input_string('_keyid', rcube_utils::INPUT_POST); $passwd = rcube_utils::get_input_string('_passwd', rcube_utils::INPUT_POST, true); if ($keyid && strlen($passwd)) { @@ -1203,7 +1203,7 @@ class enigma_engine } $threshold = $this->password_time ? time() - $this->password_time : 0; - $keys = []; + $keys = []; // delete expired passwords if (!empty($config)) { @@ -1246,7 +1246,7 @@ class enigma_engine } $storage = $this->rc->get_storage(); - $body = $storage->get_message_part($msg->uid, $part->mime_id, $part, + $body = $storage->get_message_part($msg->uid, $part->mime_id, $part, null, null, true, 0, false); if (!empty($reset)) { @@ -1294,8 +1294,8 @@ class enigma_engine } // set some part params used by Roundcube core - $struct->headers = array_merge($p['structure']->headers, $struct->headers); - $struct->size = $size; + $struct->headers = array_merge($p['structure']->headers, $struct->headers); + $struct->size = $size; $struct->filename = $p['structure']->filename; // modify the new structure to be correctly handled by Roundcube @@ -1303,7 +1303,7 @@ class enigma_engine // replace old structure with the new one $p['structure'] = $struct; - $p['mimetype'] = $struct->mimetype; + $p['mimetype'] = $struct->mimetype; } /** @@ -1317,7 +1317,7 @@ class enigma_engine { // never cache the body $part->body_modified = true; - $part->encoding = 'stream'; + $part->encoding = 'stream'; // modify part identifier if ($old_id) { @@ -1343,15 +1343,15 @@ class enigma_engine return []; } - $boundary = '--' . $boundary; + $boundary = '--' . $boundary; $boundary_len = strlen($boundary) + 2; // Find boundaries $start = strpos($body, $boundary) + $boundary_len; - $end = strpos($body, $boundary, $start); + $end = strpos($body, $boundary, $start); // Get signed body and signature - $sig = substr($body, $end + $boundary_len); + $sig = substr($body, $end + $boundary_len); $body = substr($body, $start, $end - $start - 2); // Cleanup signature @@ -1442,9 +1442,9 @@ class enigma_engine { if ($result->getCode() != enigma_error::BADPASS) { rcube::raise_error([ - 'code' => 600, - 'file' => __FILE__, - 'line' => $line, + '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 092561ee0..5772f2bf5 100644 --- a/plugins/enigma/lib/enigma_error.php +++ b/plugins/enigma/lib/enigma_error.php @@ -21,21 +21,21 @@ class enigma_error private $data = []; // error codes - public const OK = 0; - public const INTERNAL = 1; - public const NODATA = 2; + 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 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->code = $code; $this->message = $message; - $this->data = $data; + $this->data = $data; } public function getCode() diff --git a/plugins/enigma/lib/enigma_key.php b/plugins/enigma/lib/enigma_key.php index 4039caed8..7429de781 100644 --- a/plugins/enigma/lib/enigma_key.php +++ b/plugins/enigma/lib/enigma_key.php @@ -18,18 +18,18 @@ class enigma_key { public $id; public $name; - public $users = []; + public $users = []; public $subkeys = []; public $reference; public $password; public const TYPE_UNKNOWN = 0; public const TYPE_KEYPAIR = 1; - public const TYPE_PUBLIC = 2; + public const TYPE_PUBLIC = 2; - public const CAN_ENCRYPT = 1; - public const CAN_SIGN = 2; - public const CAN_CERTIFY = 4; + public const CAN_ENCRYPT = 1; + public const CAN_SIGN = 2; + public const CAN_CERTIFY = 4; public const CAN_AUTHENTICATE = 8; /** diff --git a/plugins/enigma/lib/enigma_mime_message.php b/plugins/enigma/lib/enigma_mime_message.php index b57509d33..f4c05bd71 100644 --- a/plugins/enigma/lib/enigma_mime_message.php +++ b/plugins/enigma/lib/enigma_mime_message.php @@ -16,7 +16,7 @@ class enigma_mime_message extends Mail_mime { - public const PGP_SIGNED = 1; + public const PGP_SIGNED = 1; public const PGP_ENCRYPTED = 2; protected $type; @@ -35,7 +35,7 @@ class enigma_mime_message extends Mail_mime public function __construct($message, $type) { $this->message = $message; - $this->type = $type; + $this->type = $type; // clone parameters foreach (array_keys($this->build_params) as $param) { @@ -71,8 +71,8 @@ class enigma_mime_message extends Mail_mime $headers = $this->message->headers(); if (isset($headers['From'])) { - $from = rcube_mime::decode_address_list($headers['From'], 1, false, null, true); - $from = $from[1] ?? null; + $from = rcube_mime::decode_address_list($headers['From'], 1, false, null, true); + $from = $from[1] ?? null; return $from; } @@ -89,9 +89,9 @@ class enigma_mime_message extends Mail_mime { // get sender address $headers = $this->message->headers(); - $to = rcube_mime::decode_address_list($headers['To'] ?? '', null, false, null, true); - $cc = rcube_mime::decode_address_list($headers['Cc'] ?? '', null, false, null, true); - $bcc = rcube_mime::decode_address_list($headers['Bcc'] ?? '', null, false, null, true); + $to = rcube_mime::decode_address_list($headers['To'] ?? '', null, false, null, true); + $cc = rcube_mime::decode_address_list($headers['Cc'] ?? '', null, false, null, true); + $bcc = rcube_mime::decode_address_list($headers['Bcc'] ?? '', null, false, null, true); $recipients = array_unique(array_filter(array_merge($to, $cc, $bcc))); $recipients = array_diff($recipients, ['undisclosed-recipients:']); @@ -107,7 +107,7 @@ class enigma_mime_message extends Mail_mime public function getOrigBody() { $_headers = $this->message->headers(); - $headers = []; + $headers = []; if (!empty($_headers['Content-Transfer-Encoding']) && stripos($_headers['Content-Type'], 'multipart') === false @@ -128,7 +128,7 @@ class enigma_mime_message extends Mail_mime public function addPGPSignature($body, $algorithm = null) { $this->signature = $body; - $this->micalg = $algorithm; + $this->micalg = $algorithm; // Reset Content-Type to be overwritten with valid boundary unset($this->headers['Content-Type']); @@ -173,9 +173,9 @@ class enigma_mime_message extends Mail_mime if ($this->type == self::PGP_SIGNED) { $params = [ - 'preamble' => 'This is an OpenPGP/MIME signed message (RFC 4880 and 3156)', + 'preamble' => 'This is an OpenPGP/MIME signed message (RFC 4880 and 3156)', 'content_type' => 'multipart/signed; protocol="application/pgp-signature"', - 'eol' => $this->build_params['eol'], + 'eol' => $this->build_params['eol'], ]; if ($this->micalg) { @@ -186,7 +186,7 @@ class enigma_mime_message extends Mail_mime if (!empty($this->body)) { $headers = $this->message->headers(); - $params = ['content_type' => $headers['Content-Type']]; + $params = ['content_type' => $headers['Content-Type']]; if (!empty($headers['Content-Transfer-Encoding']) && stripos($headers['Content-Type'], 'multipart') === false @@ -203,31 +203,31 @@ class enigma_mime_message extends Mail_mime if (!empty($this->signature)) { $message->addSubpart($this->signature, [ - 'filename' => 'signature.asc', + 'filename' => 'signature.asc', 'content_type' => 'application/pgp-signature', - 'disposition' => 'attachment', - 'description' => 'OpenPGP digital signature', + 'disposition' => 'attachment', + 'description' => 'OpenPGP digital signature', ]); } } elseif ($this->type == self::PGP_ENCRYPTED) { $params = [ - 'preamble' => 'This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156)', + 'preamble' => 'This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156)', 'content_type' => 'multipart/encrypted; protocol="application/pgp-encrypted"', - 'eol' => $this->build_params['eol'], + 'eol' => $this->build_params['eol'], ]; $message = new Mail_mimePart('', $params); $message->addSubpart('Version: 1', [ 'content_type' => 'application/pgp-encrypted', - 'description' => 'PGP/MIME version identification', + 'description' => 'PGP/MIME version identification', ]); $message->addSubpart($this->encrypted, [ 'content_type' => 'application/octet-stream', - 'description' => 'PGP/MIME encrypted message', - 'disposition' => 'inline', - 'filename' => 'encrypted.asc', + 'description' => 'PGP/MIME encrypted message', + 'disposition' => 'inline', + 'filename' => 'encrypted.asc', ]); } else { throw new Exception('Unexpected message type'); diff --git a/plugins/enigma/lib/enigma_signature.php b/plugins/enigma/lib/enigma_signature.php index 25a921fb5..ca61fe19e 100644 --- a/plugins/enigma/lib/enigma_signature.php +++ b/plugins/enigma/lib/enigma_signature.php @@ -45,7 +45,7 @@ class enigma_signature } if ($this->fingerprint && ($key = $engine->get_key($this->fingerprint))) { - $from = $message->headers->from; + $from = $message->headers->from; $charset = $message->headers->charset; // Get From: header from the parent part, if it's a forwarded message @@ -56,7 +56,7 @@ class enigma_signature while (array_pop($level) !== null) { $parent = implode('.', $level); if (!empty($parts[$parent]) && $parts[$parent]->mimetype == 'message/rfc822') { - $from = $parts[$parent]->headers['from']; + $from = $parts[$parent]->headers['from']; $charset = $parts[$parent]->charset; break; } diff --git a/plugins/enigma/lib/enigma_ui.php b/plugins/enigma/lib/enigma_ui.php index 7e2f678a9..5e99fa258 100644 --- a/plugins/enigma/lib/enigma_ui.php +++ b/plugins/enigma/lib/enigma_ui.php @@ -22,7 +22,7 @@ class enigma_ui private $css_loaded; private $js_loaded; private $data; - private $keys_parts = []; + private $keys_parts = []; private $keys_bodies = []; /** @@ -34,8 +34,8 @@ class enigma_ui public function __construct($enigma_plugin, $home = '') { $this->enigma = $enigma_plugin; - $this->rc = $enigma_plugin->rc; - $this->home = $home; // we cannot use $enigma_plugin->home here + $this->rc = $enigma_plugin->rc; + $this->home = $home; // we cannot use $enigma_plugin->home here } /** @@ -82,9 +82,9 @@ class enigma_ui } $this->rc->output->add_handlers([ - 'keyslist' => [$this, 'tpl_keys_list'], + 'keyslist' => [$this, 'tpl_keys_list'], 'countdisplay' => [$this, 'tpl_keys_rowcount'], - 'searchform' => [$this->rc->output, 'search_form'], + 'searchform' => [$this->rc->output, 'search_form'], ]); $this->rc->output->set_pagetitle($this->enigma->gettext('enigmakeys')); @@ -166,7 +166,7 @@ class enigma_ui if (isset($keyid)) { $data = [ 'keyid' => $keyid, - 'user' => $data[$keyid] ?? null, + 'user' => $data[$keyid] ?? null, ]; } else { $data = []; @@ -232,12 +232,12 @@ class enigma_ui $this->enigma->load_engine(); $pagesize = $this->rc->config->get('pagesize', 100); - $page = max(intval(rcube_utils::get_input_string('_p', rcube_utils::INPUT_GPC)), 1); - $search = rcube_utils::get_input_string('_q', rcube_utils::INPUT_GPC); + $page = max(intval(rcube_utils::get_input_string('_p', rcube_utils::INPUT_GPC)), 1); + $search = rcube_utils::get_input_string('_q', rcube_utils::INPUT_GPC); // Get the list - $list = $this->enigma->engine->list_keys($search); - $size = 0; + $list = $this->enigma->engine->list_keys($search); + $size = 0; $listsize = 0; if (!is_array($list)) { @@ -258,8 +258,8 @@ class enigma_ui // Add rows foreach ($list as $key) { $this->rc->output->command('enigma_add_list_row', [ - 'name' => rcube::Q($key->name), - 'id' => $key->id, + 'name' => rcube::Q($key->name), + 'id' => $key->id, 'flags' => $key->is_private() ? 'p' : '', ]); } @@ -301,7 +301,7 @@ class enigma_ui $out = $this->enigma->gettext('nokeysfound'); } else { $pagesize = $this->rc->config->get('pagesize', 100); - $first = ($page - 1) * $pagesize; + $first = ($page - 1) * $pagesize; $out = $this->enigma->gettext([ 'name' => 'keysfromto', @@ -319,7 +319,7 @@ class enigma_ui { $this->enigma->load_engine(); - $id = rcube_utils::get_input_string('_id', rcube_utils::INPUT_GET); + $id = rcube_utils::get_input_string('_id', rcube_utils::INPUT_GET); $res = $this->enigma->engine->get_key($id); if ($res instanceof enigma_key) { @@ -360,7 +360,7 @@ class enigma_ui */ public function tpl_key_data($attrib) { - $out = ''; + $out = ''; $table = new html_table(['cols' => 2]); // Key user ID @@ -373,7 +373,7 @@ class enigma_ui // Key type $keytype = $this->data->get_type(); - $type = null; + $type = null; if ($keytype == enigma_key::TYPE_KEYPAIR) { $type = $this->enigma->gettext('typekeypair'); } elseif ($keytype == enigma_key::TYPE_PUBLIC) { @@ -401,9 +401,9 @@ class enigma_ui $table->add_header('usage', $this->enigma->gettext('subkeyusage')); $usage_map = [ - enigma_key::CAN_ENCRYPT => $this->enigma->gettext('typeencrypt'), - enigma_key::CAN_SIGN => $this->enigma->gettext('typesign'), - enigma_key::CAN_CERTIFY => $this->enigma->gettext('typecert'), + enigma_key::CAN_ENCRYPT => $this->enigma->gettext('typeencrypt'), + enigma_key::CAN_SIGN => $this->enigma->gettext('typesign'), + enigma_key::CAN_CERTIFY => $this->enigma->gettext('typecert'), enigma_key::CAN_AUTHENTICATE => $this->enigma->gettext('typeauth'), ]; @@ -467,10 +467,10 @@ class enigma_ui */ private function key_export() { - $keys = rcube_utils::get_input_string('_keys', rcube_utils::INPUT_POST); - $priv = rcube_utils::get_input_string('_priv', rcube_utils::INPUT_POST); + $keys = rcube_utils::get_input_string('_keys', rcube_utils::INPUT_POST); + $priv = rcube_utils::get_input_string('_priv', rcube_utils::INPUT_POST); $engine = $this->enigma->load_engine(); - $list = $keys == '*' ? $engine->list_keys() : explode(',', $keys); + $list = $keys == '*' ? $engine->list_keys() : explode(',', $keys); if (is_array($list) && ($fp = fopen('php://memory', 'rw'))) { $filename = 'export.pgp'; @@ -480,7 +480,7 @@ class enigma_ui $status = null; foreach ($list as $key) { - $keyid = is_object($key) ? $key->id : $key; + $keyid = is_object($key) ? $key->id : $key; $status = $engine->export_key($keyid, $fp, (bool) $priv); if ($status instanceof enigma_error) { @@ -488,14 +488,14 @@ class enigma_ui if ($code == enigma_error::BADPASS) { $this->password_prompt($status, [ - 'input_keys' => $keys, - 'input_priv' => 1, - 'input_task' => 'settings', + 'input_keys' => $keys, + 'input_priv' => 1, + 'input_task' => 'settings', 'input_action' => 'plugin.enigmakeys', - 'input_a' => 'export', - 'action' => '?', - 'iframe' => true, - 'nolock' => true, + 'input_a' => 'export', + 'action' => '?', + 'iframe' => true, + 'nolock' => true, ]); fclose($fp); $this->rc->output->send('iframe'); @@ -602,18 +602,18 @@ class enigma_ui $attrib += ['id' => 'rcmKeyImportForm']; if (empty($attrib['part']) || $attrib['part'] == 'import') { - $title = $this->enigma->gettext('keyimportlabel'); + $title = $this->enigma->gettext('keyimportlabel'); $upload = new html_inputfield([ - 'type' => 'file', - 'name' => '_file', - 'id' => 'rcmimportfile', - 'size' => 30, + 'type' => 'file', + 'name' => '_file', + 'id' => 'rcmimportfile', + 'size' => 30, 'class' => 'form-control', ]); - $max_filesize = rcmail_action::upload_init(); + $max_filesize = rcmail_action::upload_init(); $upload_button = new html_button([ - 'class' => 'button import', + 'class' => 'button import', 'onclick' => "return rcmail.command('plugin.enigma-import','',this,event)", ]); @@ -636,12 +636,12 @@ class enigma_ui } if (empty($attrib['part']) || $attrib['part'] == 'search') { - $title = $this->enigma->gettext('keyimportsearchlabel'); + $title = $this->enigma->gettext('keyimportsearchlabel'); $search = new html_inputfield(['type' => 'text', 'name' => '_search', 'id' => 'rcmimportsearch', 'size' => 30, 'class' => 'form-control']); $search_button = new html_button([ - 'class' => 'button search', + 'class' => 'button search', 'onclick' => "return rcmail.command('plugin.enigma-import-search','',this,event)", ]); @@ -668,8 +668,8 @@ class enigma_ui $this->rc->output->add_gui_object('importform', $attrib['id']); $out = $this->rc->output->form_tag([ - 'action' => $this->rc->url(['action' => $this->rc->action, 'a' => 'import']), - 'method' => 'post', + 'action' => $this->rc->url(['action' => $this->rc->action, 'a' => 'import']), + 'method' => 'post', 'enctype' => 'multipart/form-data', ] + $attrib, $form ?? '' @@ -705,10 +705,10 @@ class enigma_ui $this->enigma->load_engine(); $result = $this->enigma->engine->generate_key([ - 'user' => $ident[1]['name'], - 'email' => $ident[1]['mailto'], + 'user' => $ident[1]['name'], + 'email' => $ident[1]['mailto'], 'password' => $pass, - 'size' => $size, + 'size' => $size, ]); if ($result instanceof enigma_key) { @@ -746,15 +746,15 @@ class enigma_ui public function tpl_key_create_form($attrib) { $attrib += ['id' => 'rcmKeyCreateForm']; - $table = new html_table(['cols' => 2]); + $table = new html_table(['cols' => 2]); // get user's identities $identities = $this->rc->user->list_identities(null, true); - $checkbox = new html_checkbox(['name' => 'identity[]']); + $checkbox = new html_checkbox(['name' => 'identity[]']); - $plugin = $this->rc->plugins->exec_hook('enigma_user_identities', ['identities' => $identities]); + $plugin = $this->rc->plugins->exec_hook('enigma_user_identities', ['identities' => $identities]); $identities = $plugin['identities']; - $engine = $this->enigma->load_engine(); + $engine = $this->enigma->load_engine(); foreach ($identities as $idx => $ident) { $name = format_email_recipient($ident['email'], $ident['name']); @@ -780,21 +780,21 @@ class enigma_ui // Password and confirm password $table->add('title', html::label('key-pass', rcube::Q($this->enigma->gettext('newkeypass')))); $table->add(null, rcube_output::get_edit_field('password', '', [ - 'id' => 'key-pass', - 'size' => $attrib['size'] ?? null, - 'required' => true, + 'id' => 'key-pass', + 'size' => $attrib['size'] ?? null, + 'required' => true, 'autocomplete' => 'new-password', - 'oninput' => "this.type = this.value.length ? 'password' : 'text'", + 'oninput' => "this.type = this.value.length ? 'password' : 'text'", ], 'text') ); $table->add('title', html::label('key-pass-confirm', rcube::Q($this->enigma->gettext('newkeypassconfirm')))); $table->add(null, rcube_output::get_edit_field('password-confirm', '', [ - 'id' => 'key-pass-confirm', - 'size' => $attrib['size'] ?? null, - 'required' => true, + 'id' => 'key-pass-confirm', + 'size' => $attrib['size'] ?? null, + 'required' => true, 'autocomplete' => 'new-password', - 'oninput' => "this.type = this.value.length ? 'password' : 'text'", + 'oninput' => "this.type = this.value.length ? 'password' : 'text'", ], 'text') ); @@ -814,7 +814,7 @@ class enigma_ui */ private function key_delete() { - $keys = rcube_utils::get_input_value('_keys', rcube_utils::INPUT_POST); + $keys = rcube_utils::get_input_value('_keys', rcube_utils::INPUT_POST); $engine = $this->enigma->load_engine(); foreach ((array) $keys as $key) { @@ -848,16 +848,16 @@ class enigma_ui else { // Options menu button $this->enigma->add_button([ - 'type' => 'link', - 'command' => 'plugin.enigma', - 'onclick' => "rcmail.command('menu-open', 'enigmamenu', event.target, event)", - 'class' => 'button enigma', - 'title' => 'encryptionoptions', - 'label' => 'encryption', - 'domain' => $this->enigma->ID, - 'width' => 32, - 'height' => 32, - 'aria-owns' => 'enigmamenu', + 'type' => 'link', + 'command' => 'plugin.enigma', + 'onclick' => "rcmail.command('menu-open', 'enigmamenu', event.target, event)", + 'class' => 'button enigma', + 'title' => 'encryptionoptions', + 'label' => 'encryption', + 'domain' => $this->enigma->ID, + 'width' => 32, + 'height' => 32, + 'aria-owns' => 'enigmamenu', 'aria-haspopup' => 'true', 'aria-expanded' => 'false', ], 'toolbar' @@ -882,9 +882,9 @@ class enigma_ui ) . 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', + 'name' => '_enigma_sign', + 'id' => 'enigmasignopt', + 'class' => 'form-check-input', 'disabled' => in_array('sign', $locks), ]) ) @@ -896,9 +896,9 @@ class enigma_ui ) . 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', + 'name' => '_enigma_encrypt', + 'id' => 'enigmaencryptopt', + 'class' => 'form-check-input', 'disabled' => in_array('encrypt', $locks), ]) ) @@ -910,9 +910,9 @@ class enigma_ui ) . 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', + 'name' => '_enigma_attachpubkey', + 'id' => 'enigmaattachpubkeyopt', + 'class' => 'form-check-input', 'disabled' => in_array('pubkey', $locks), ]) ) @@ -947,8 +947,8 @@ class enigma_ui return $p; } - $engine = $this->enigma->engine; - $part_id = $p['part']->mime_id; + $engine = $this->enigma->engine; + $part_id = $p['part']->mime_id; $messages = []; // Decryption status @@ -966,15 +966,15 @@ class enigma_ui if ($status instanceof enigma_error) { $attrib['class'] = 'boxerror enigmaerror encrypted'; - $code = $status->getCode(); + $code = $status->getCode(); 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) { $missing = $status->getData('missing'); - $label = 'decrypt' . (!empty($missing) ? 'no' : 'bad') . 'pass'; - $msg = rcube::Q($this->enigma->gettext($label)); + $label = 'decrypt' . (!empty($missing) ? 'no' : 'bad') . 'pass'; + $msg = rcube::Q($this->enigma->gettext($label)); $this->password_prompt($status); } elseif ($code == enigma_error::NOMDC) { $msg = rcube::Q($this->enigma->gettext('decryptnomdc')); @@ -1037,7 +1037,7 @@ class enigma_ui } $attrib['msg'] = $msg; - $messages[] = $attrib; + $messages[] = $attrib; } if ($count = count($messages)) { @@ -1077,7 +1077,7 @@ class enigma_ui // the same with message bodies foreach ((array) $p['object']->parts as $part) { if ($engine->is_keys_part($part)) { - $this->keys_parts[] = $part->mime_id; + $this->keys_parts[] = $part->mime_id; $this->keys_bodies[] = $part->mime_id; } } @@ -1109,8 +1109,8 @@ class enigma_ui html::span(null, rcube::Q($this->enigma->gettext('keyattfound'))) . html::tag('button', [ 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . ".enigma_import_attachment('" . rcube::JQ($part) . "')", - 'title' => $this->enigma->gettext('keyattimport'), - 'class' => 'import btn-sm', + 'title' => $this->enigma->gettext('keyattimport'), + 'class' => 'import btn-sm', ], rcube::Q($this->rc->gettext('import')) ) ) . $p['content']; @@ -1137,11 +1137,11 @@ class enigma_ui return $p; } - $savedraft = !empty($_POST['_draft']) && empty($_GET['_saveonly']); - $sign_enable = (bool) rcube_utils::get_input_value('_enigma_sign', rcube_utils::INPUT_POST); + $savedraft = !empty($_POST['_draft']) && empty($_GET['_saveonly']); + $sign_enable = (bool) rcube_utils::get_input_value('_enigma_sign', rcube_utils::INPUT_POST); $encrypt_enable = (bool) rcube_utils::get_input_value('_enigma_encrypt', rcube_utils::INPUT_POST); - $pubkey_enable = (bool) rcube_utils::get_input_value('_enigma_attachpubkey', rcube_utils::INPUT_POST); - $locks = (array) $this->rc->config->get('enigma_options_lock'); + $pubkey_enable = (bool) rcube_utils::get_input_value('_enigma_attachpubkey', rcube_utils::INPUT_POST); + $locks = (array) $this->rc->config->get('enigma_options_lock'); if (in_array('sign', $locks)) { $sign_enable = (bool) $this->rc->config->get('enigma_sign_all'); @@ -1158,18 +1158,18 @@ class enigma_ui $engine->attach_public_key($p['message']); } - $mode = null; + $mode = null; $status = null; if ($encrypt_enable) { $engine = $this->enigma->load_engine(); - $mode = !$savedraft && $sign_enable ? enigma_engine::ENCRYPT_MODE_SIGN : null; + $mode = !$savedraft && $sign_enable ? enigma_engine::ENCRYPT_MODE_SIGN : null; $status = $engine->encrypt_message($p['message'], $mode, $savedraft); - $mode = 'encrypt'; + $mode = 'encrypt'; } elseif (!$savedraft && $sign_enable) { $engine = $this->enigma->load_engine(); $status = $engine->sign_message($p['message'], enigma_engine::SIGN_MODE_MIME); - $mode = 'sign'; + $mode = 'sign'; } if ($mode && ($status instanceof enigma_error)) { @@ -1179,7 +1179,7 @@ class enigma_ui if ($code == enigma_error::KEYNOTFOUND) { if ($email = $status->getData('missing')) { $vars = ['email' => $email]; - $msg = 'enigma.' . $mode . 'nokey'; + $msg = 'enigma.' . $mode . 'nokey'; } else { $msg = 'enigma.' . ($encrypt_enable ? 'encryptnoprivkey' : 'signnokey'); } @@ -1192,11 +1192,11 @@ class enigma_ui 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'), + 'email' => $vars['email'], + 'text' => $this->rc->gettext(['name' => $msg, 'vars' => $vars]), + 'title' => $this->enigma->gettext('keynotfound'), 'button' => $this->enigma->gettext('findkey'), - 'mode' => $mode, + 'mode' => $mode, ]); } else { $this->rc->output->show_message($msg, 'error', $vars); @@ -1224,7 +1224,7 @@ class enigma_ui } $engine = $this->enigma->engine; - $locks = (array) $this->rc->config->get('enigma_options_lock'); + $locks = (array) $this->rc->config->get('enigma_options_lock'); // Decryption status foreach ($engine->decryptions as $status) { @@ -1265,10 +1265,10 @@ class enigma_ui */ 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); + $uid = rcube_utils::get_input_string('_uid', rcube_utils::INPUT_POST); + $mbox = rcube_utils::get_input_string('_mbox', rcube_utils::INPUT_POST); $mime_id = rcube_utils::get_input_string('_part', rcube_utils::INPUT_POST); - $engine = $this->enigma->load_engine(); + $engine = $this->enigma->load_engine(); if ($uid && $mime_id) { // Note: we get the attachment body via rcube_message class @@ -1280,13 +1280,13 @@ class enigma_ui 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_uid' => $uid, + 'input_mbox' => $mbox, + 'input_part' => $mime_id, + 'input_task' => 'mail', 'input_action' => 'plugin.enigmaimport', - 'action' => '?', - 'iframe' => true, + 'action' => '?', + 'iframe' => true, ]); $this->rc->output->send($this->rc->output->type == 'html' ? 'iframe' : null); return; @@ -1315,8 +1315,8 @@ class enigma_ui */ private function find_part_id($part_id, $data) { - $ids = explode('.', $part_id); - $i = 0; + $ids = explode('.', $part_id); + $i = 0; $count = count($ids); while ($i < $count && strlen($part = implode('.', array_slice($ids, 0, ++$i)))) { diff --git a/plugins/enigma/tests/Enigma.php b/plugins/enigma/tests/Enigma.php index 7842e7490..ef1ca5657 100644 --- a/plugins/enigma/tests/Enigma.php +++ b/plugins/enigma/tests/Enigma.php @@ -14,7 +14,7 @@ class Enigma_Plugin extends TestCase */ public function test_constructor() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new enigma($rcube->plugins); $this->assertInstanceOf('enigma', $plugin); diff --git a/plugins/enigma/tests/EnigmaDriverGnupg.php b/plugins/enigma/tests/EnigmaDriverGnupg.php index c9acbb850..d2dec39d7 100644 --- a/plugins/enigma/tests/EnigmaDriverGnupg.php +++ b/plugins/enigma/tests/EnigmaDriverGnupg.php @@ -15,7 +15,7 @@ class Enigma_EnigmaDriverGnupg extends TestCase */ public function test_constructor() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new enigma_driver_gnupg($rcube->user); $this->assertInstanceOf('enigma_driver', $plugin); diff --git a/plugins/enigma/tests/EnigmaEngine.php b/plugins/enigma/tests/EnigmaEngine.php index 147ad95be..72da64786 100644 --- a/plugins/enigma/tests/EnigmaEngine.php +++ b/plugins/enigma/tests/EnigmaEngine.php @@ -15,7 +15,7 @@ class Enigma_EnigmaEngine extends TestCase */ public function test_password_handler() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new enigma($rcube->plugins); $engine = new enigma_engine($plugin); diff --git a/plugins/enigma/tests/EnigmaMimeMessage.php b/plugins/enigma/tests/EnigmaMimeMessage.php index caaff19ac..c9a06ce0c 100644 --- a/plugins/enigma/tests/EnigmaMimeMessage.php +++ b/plugins/enigma/tests/EnigmaMimeMessage.php @@ -14,7 +14,7 @@ class Enigma_EnigmaMimeMessage extends TestCase */ public function test_is_multipart() { - $mime = new Mail_mime(); + $mime = new Mail_mime(); $message1 = new enigma_mime_message($mime, enigma_mime_message::PGP_SIGNED); $this->assertFalse($message1->isMultipart()); @@ -34,7 +34,7 @@ class Enigma_EnigmaMimeMessage extends TestCase */ public function test_get_from_address() { - $mime = new Mail_mime(); + $mime = new Mail_mime(); $message = new enigma_mime_message($mime, enigma_mime_message::PGP_SIGNED); $this->assertNull($message->getFromAddress()); diff --git a/plugins/example_addressbook/example_addressbook.php b/plugins/example_addressbook/example_addressbook.php index 0f006f926..87be94a00 100644 --- a/plugins/example_addressbook/example_addressbook.php +++ b/plugins/example_addressbook/example_addressbook.php @@ -21,7 +21,7 @@ class example_addressbook extends rcube_plugin // use this address book for autocompletion queries // (maybe this should be configurable by the user?) - $config = rcmail::get_instance()->config; + $config = rcmail::get_instance()->config; $sources = (array) $config->get('autocomplete_addressbooks', ['sql']); if (!in_array($this->abook_id, $sources)) { $sources[] = $this->abook_id; @@ -34,10 +34,10 @@ class example_addressbook extends rcube_plugin $abook = new example_addressbook_backend($this->abook_name); $p['sources'][$this->abook_id] = [ - 'id' => $this->abook_id, - 'name' => $this->abook_name, + 'id' => $this->abook_id, + 'name' => $this->abook_name, 'readonly' => $abook->readonly, - 'groups' => $abook->groups, + 'groups' => $abook->groups, ]; return $p; diff --git a/plugins/example_addressbook/example_addressbook_backend.php b/plugins/example_addressbook/example_addressbook_backend.php index a86fb89da..429508691 100644 --- a/plugins/example_addressbook/example_addressbook_backend.php +++ b/plugins/example_addressbook/example_addressbook_backend.php @@ -10,8 +10,8 @@ class example_addressbook_backend extends rcube_addressbook { public $primary_key = 'ID'; - public $readonly = true; - public $groups = true; + public $readonly = true; + public $groups = true; private $filter; private $result; @@ -19,31 +19,31 @@ class example_addressbook_backend extends rcube_addressbook private $db_groups = [ [ - 'ID' => 'testgroup1', + 'ID' => 'testgroup1', 'name' => 'Testgroup', ], [ - 'ID' => 'testgroup2', + 'ID' => 'testgroup2', 'name' => 'Sample Group', ], ]; private $db_users = [ [ - 'ID' => '111', - 'name' => 'John Doe', + 'ID' => '111', + 'name' => 'John Doe', 'firstname' => 'John', - 'surname' => 'Doe', - 'email' => 'example1@roundcube.net', - 'groups' => ['testgroup1'], + 'surname' => 'Doe', + 'email' => 'example1@roundcube.net', + 'groups' => ['testgroup1'], ], [ - 'ID' => '112', - 'name' => 'Jane Example', + 'ID' => '112', + 'name' => 'Jane Example', 'firstname' => 'Jane', - 'surname' => 'Example', - 'email' => 'example2@roundcube.net', - 'groups' => ['testgroup2'], + 'surname' => 'Example', + 'email' => 'example2@roundcube.net', + 'groups' => ['testgroup2'], ], ]; @@ -148,7 +148,7 @@ class example_addressbook_backend extends rcube_addressbook // Note: Paging is not implemented $result = new rcube_result_set(0, ($this->list_page - 1) * $this->page_size); - $count = 0; + $count = 0; foreach ($this->db_users as $user) { if ($this->group_id && (empty($user['groups']) || !in_array($this->group_id, $user['groups']))) { diff --git a/plugins/example_addressbook/tests/ExampleAddressbook.php b/plugins/example_addressbook/tests/ExampleAddressbook.php index 27e101089..5d54429d2 100644 --- a/plugins/example_addressbook/tests/ExampleAddressbook.php +++ b/plugins/example_addressbook/tests/ExampleAddressbook.php @@ -15,7 +15,7 @@ class ExampleAddressbook_Plugin extends TestCase */ public function test_constructor() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new example_addressbook($rcube->plugins); $this->assertInstanceOf('example_addressbook', $plugin); @@ -29,7 +29,7 @@ class ExampleAddressbook_Plugin extends TestCase */ public function test_address_sources() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new example_addressbook($rcube->plugins); $result = $plugin->address_sources(['sources' => []]); diff --git a/plugins/filesystem_attachments/filesystem_attachments.php b/plugins/filesystem_attachments/filesystem_attachments.php index a27260e82..38860d15d 100644 --- a/plugins/filesystem_attachments/filesystem_attachments.php +++ b/plugins/filesystem_attachments/filesystem_attachments.php @@ -78,8 +78,8 @@ class filesystem_attachments extends rcube_plugin $tmpfname = rcube_utils::temp_filename('attmnt'); if (!empty($args['path']) && move_uploaded_file($args['path'], $tmpfname) && file_exists($tmpfname)) { - $args['id'] = $this->file_id(); - $args['path'] = $tmpfname; + $args['id'] = $this->file_id(); + $args['path'] = $tmpfname; $args['status'] = true; @chmod($tmpfname, 0600); // set correct permissions (#1488996) } @@ -107,7 +107,7 @@ class filesystem_attachments extends rcube_plugin } } - $args['id'] = $this->file_id(); + $args['id'] = $this->file_id(); $args['status'] = true; return $args; @@ -176,7 +176,7 @@ class filesystem_attachments extends rcube_plugin // @phpstan-ignore-next-line while ($rcube->get_uploaded_file($id)) { // increment last four characters - $x = intval(substr($id, -4)) + 1; + $x = intval(substr($id, -4)) + 1; $id = substr($id, 0, -4) . sprintf('%04d', $x > 9999 ? $x - 9999 : $x); } @@ -194,8 +194,8 @@ class filesystem_attachments extends rcube_plugin return false; } - $rcmail = rcube::get_instance(); - $temp_dir = $rcmail->config->get('temp_dir'); + $rcmail = rcube::get_instance(); + $temp_dir = $rcmail->config->get('temp_dir'); $file_path = pathinfo($path, \PATHINFO_DIRNAME); if ($temp_dir !== $file_path) { @@ -204,8 +204,8 @@ class filesystem_attachments extends rcube_plugin // 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__, + 'file' => __FILE__, + 'line' => __LINE__, 'message' => "Detected 'temp_dir' change. " . "Access to '{$temp_dir}' restricted by filesystem permissions or open_basedir", ], true, false); @@ -214,8 +214,8 @@ class filesystem_attachments extends rcube_plugin } rcube::raise_error([ - 'file' => __FILE__, - 'line' => __LINE__, + '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); diff --git a/plugins/filesystem_attachments/tests/FilesystemAttachments.php b/plugins/filesystem_attachments/tests/FilesystemAttachments.php index d138b2629..dc371c442 100644 --- a/plugins/filesystem_attachments/tests/FilesystemAttachments.php +++ b/plugins/filesystem_attachments/tests/FilesystemAttachments.php @@ -14,7 +14,7 @@ class FilesystemAttachments_Plugin extends TestCase */ public function test_constructor() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new filesystem_attachments($rcube->plugins); $this->assertInstanceOf('filesystem_attachments', $plugin); diff --git a/plugins/help/config.inc.php.dist b/plugins/help/config.inc.php.dist index 4ac5864b5..fbb3e2010 100644 --- a/plugins/help/config.inc.php.dist +++ b/plugins/help/config.inc.php.dist @@ -9,14 +9,14 @@ $config['help_source'] = 'https://docs.roundcube.net/doc/help/1.1/%l/'; // Use '/' or only '' strings as keys // The values will be appended to the 'help_source' URL $config['help_index_map'] = [ - 'login' => 'login.html', - 'mail' => 'mail/index.html', - 'mail/compose' => 'mail/compose.html', - 'addressbook' => 'addressbook/index.html', - 'settings' => 'settings/index.html', + 'login' => 'login.html', + 'mail' => 'mail/index.html', + 'mail/compose' => 'mail/compose.html', + 'addressbook' => 'addressbook/index.html', + 'settings' => 'settings/index.html', 'settings/preferences' => 'settings/preferences.html', - 'settings/folders' => 'settings/folders.html', - 'settings/identities' => 'settings/identities.html', + 'settings/folders' => 'settings/folders.html', + 'settings/identities' => 'settings/identities.html', ]; // Map to translate Roundcube language codes into help document languages diff --git a/plugins/help/help.php b/plugins/help/help.php index 17a99b338..cdc33a50a 100644 --- a/plugins/help/help.php +++ b/plugins/help/help.php @@ -42,12 +42,12 @@ class help extends rcube_plugin if (!$rcmail->output->framed) { // add taskbar button $this->add_button([ - 'command' => 'help', - 'class' => 'button-help', - 'classsel' => 'button-help button-selected', + 'command' => 'help', + 'class' => 'button-help', + 'classsel' => 'button-help button-selected', 'innerclass' => 'button-inner', - 'label' => 'help.help', - 'type' => 'link', + 'label' => 'help.help', + 'type' => 'link', ], 'taskbar' ); @@ -73,8 +73,8 @@ class help extends rcube_plugin // 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()); @@ -101,7 +101,7 @@ class help extends rcube_plugin $attrib['name'] = 'helplink' . $attrib['action']; $attrib['href'] = $rcmail->url(['_action' => $attrib['action'], '_extwin' => !empty($_REQUEST['_extwin']) ? 1 : null]); - $attrib['rel'] = $attrib['action']; + $attrib['rel'] = $attrib['action']; // title might be already translated here, so revert to it's initial value // so button() will translate it correctly @@ -114,7 +114,7 @@ class help extends rcube_plugin public function help_metadata() { - $rcmail = rcmail::get_instance(); + $rcmail = rcmail::get_instance(); $content = []; // About @@ -135,7 +135,7 @@ class help extends rcube_plugin } // Help Index - $src = $rcmail->config->get('help_source', 'http://docs.roundcube.net/doc/help/1.1/%l/'); + $src = $rcmail->config->get('help_source', 'http://docs.roundcube.net/doc/help/1.1/%l/'); $index_map = $rcmail->config->get('help_index_map', []); // resolve task/action for deep linking @@ -170,10 +170,10 @@ class help extends rcube_plugin private function resolve_language($path) { // resolve language placeholder - $rcmail = rcmail::get_instance(); + $rcmail = rcmail::get_instance(); $langmap = $rcmail->config->get('help_language_map', ['*' => 'en_US']); - $lang = $_SESSION['language'] ?? 'en_US'; - $lang = !empty($langmap[$lang]) ? $langmap[$lang] : $langmap['*']; + $lang = $_SESSION['language'] ?? 'en_US'; + $lang = !empty($langmap[$lang]) ? $langmap[$lang] : $langmap['*']; return str_replace('%l', $lang, $path); } diff --git a/plugins/help/tests/Help.php b/plugins/help/tests/Help.php index ec49f50c8..53c1ba166 100644 --- a/plugins/help/tests/Help.php +++ b/plugins/help/tests/Help.php @@ -14,7 +14,7 @@ class Help_Plugin extends TestCase */ public function test_constructor() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new help($rcube->plugins); $this->assertInstanceOf('help', $plugin); @@ -26,7 +26,7 @@ class Help_Plugin extends TestCase */ public function test_help_metadata() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new help($rcube->plugins); $result = $plugin->help_metadata(); diff --git a/plugins/hide_blockquote/hide_blockquote.php b/plugins/hide_blockquote/hide_blockquote.php index b275c6ced..f03d306ec 100644 --- a/plugins/hide_blockquote/hide_blockquote.php +++ b/plugins/hide_blockquote/hide_blockquote.php @@ -61,18 +61,18 @@ class hide_blockquote extends rcube_plugin $this->add_texts('localization'); - $rcmail = rcmail::get_instance(); - $limit = (int) $rcmail->config->get('hide_blockquote_limit'); + $rcmail = rcmail::get_instance(); + $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, + $input = new html_inputfield([ + 'name' => '_' . $field_id, + 'id' => $field_id, + 'size' => 5, 'class' => 'form-control', ]); $args['blocks']['main']['options']['hide_blockquote_limit'] = [ - 'title' => html::label($field_id, $this->gettext('quotelimit')), + 'title' => html::label($field_id, $this->gettext('quotelimit')), 'content' => $input->show($limit ?: ''), ]; diff --git a/plugins/hide_blockquote/tests/HideBlockquote.php b/plugins/hide_blockquote/tests/HideBlockquote.php index fcfc537da..719d5b571 100644 --- a/plugins/hide_blockquote/tests/HideBlockquote.php +++ b/plugins/hide_blockquote/tests/HideBlockquote.php @@ -14,7 +14,7 @@ class HideBlockquote_Plugin extends TestCase */ public function test_constructor() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new hide_blockquote($rcube->plugins); $this->assertInstanceOf('hide_blockquote', $plugin); @@ -28,7 +28,7 @@ class HideBlockquote_Plugin extends TestCase */ public function test_prefs_table() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new hide_blockquote($rcube->plugins); $args = ['section' => 'mailview', 'blocks' => ['main' => ['options' => []]]]; @@ -51,18 +51,18 @@ class HideBlockquote_Plugin extends TestCase */ public function test_prefs_save() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new hide_blockquote($rcube->plugins); $_POST = []; - $args = ['section' => 'mailview', 'prefs' => []]; + $args = ['section' => 'mailview', 'prefs' => []]; $result = $plugin->prefs_save($args); $this->assertSame(0, $result['prefs']['hide_blockquote_limit']); $_POST = ['_hide_blockquote_limit' => '10']; - $args = ['section' => 'mailview', 'prefs' => []]; + $args = ['section' => 'mailview', 'prefs' => []]; $result = $plugin->prefs_save($args); diff --git a/plugins/http_authentication/http_authentication.php b/plugins/http_authentication/http_authentication.php index b76ca0d70..931add5dc 100644 --- a/plugins/http_authentication/http_authentication.php +++ b/plugins/http_authentication/http_authentication.php @@ -36,7 +36,7 @@ class http_authentication extends rcube_plugin // handle login action if (empty($_SESSION['user_id'])) { - $args['action'] = 'login'; + $args['action'] = 'login'; $this->redirect_query = $_SERVER['QUERY_STRING']; } // Set user password in session (see shutdown() method for more info) @@ -74,7 +74,7 @@ class http_authentication extends rcube_plugin } $args['cookiecheck'] = false; - $args['valid'] = true; + $args['valid'] = true; return $args; } diff --git a/plugins/http_authentication/tests/HttpAuthentication.php b/plugins/http_authentication/tests/HttpAuthentication.php index 70a076ba1..752b107f1 100644 --- a/plugins/http_authentication/tests/HttpAuthentication.php +++ b/plugins/http_authentication/tests/HttpAuthentication.php @@ -14,7 +14,7 @@ class HttpAuthentication_Plugin extends TestCase */ public function test_constructor() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new http_authentication($rcube->plugins); $this->assertInstanceOf('http_authentication', $plugin); diff --git a/plugins/identicon/identicon.php b/plugins/identicon/identicon.php index fb2a2f699..5f20487b3 100644 --- a/plugins/identicon/identicon.php +++ b/plugins/identicon/identicon.php @@ -68,7 +68,7 @@ class identicon extends rcube_plugin if ($rcmail->action == 'show') { // set photo URL using data-uri if (($icon = $identicon->getBinary()) && ($icon = base64_encode($icon))) { - $mimetype = $identicon->getMimetype(); + $mimetype = $identicon->getMimetype(); $args['url'] = sprintf('data:%s;base64,%s', $mimetype, $icon); } } else { diff --git a/plugins/identicon/identicon_engine.php b/plugins/identicon/identicon_engine.php index e9fc34aba..b31019a21 100644 --- a/plugins/identicon/identicon_engine.php +++ b/plugins/identicon/identicon_engine.php @@ -12,9 +12,9 @@ class identicon_engine private $margin; private $binary; private $color; - private $bgcolor = '#F9F9F9'; + private $bgcolor = '#F9F9F9'; private $mimetype = 'image/png'; - private $palette = [ + private $palette = [ '#F44336', '#E91E63', '#9C27B0', '#673AB7', '#3F51B5', '#2196F3', '#03A9F4', '#00BCD4', '#009688', '#4CAF50', '#8BC34A', '#CDDC39', '#FFEB3B', '#FFC107', '#FF9800', '#FF5722', '#795548', '#607D8B', @@ -43,9 +43,9 @@ class identicon_engine $size = self::ICON_SIZE; } - $this->ident = $ident; + $this->ident = $ident; $this->margin = (int) round($size / 10); - $this->width = (int) round(($size - $this->margin * 2) / self::GRID_SIZE) * self::GRID_SIZE + $this->margin * 2; + $this->width = (int) round(($size - $this->margin * 2) / self::GRID_SIZE) * self::GRID_SIZE + $this->margin * 2; $this->height = $this->width; if ($bgcolor) { @@ -105,25 +105,25 @@ class identicon_engine $ident = md5($this->ident, true); // set icon color - $div = intval(255 / count($this->palette)); - $index = intval(ord($ident[0]) / $div); + $div = intval(255 / count($this->palette)); + $index = intval(ord($ident[0]) / $div); $this->color = $this->palette[$index] ?? $this->palette[0]; // set cell size - $cell_width = ($this->width - $this->margin * 2) / self::GRID_SIZE; + $cell_width = ($this->width - $this->margin * 2) / self::GRID_SIZE; $cell_height = ($this->height - $this->margin * 2) / self::GRID_SIZE; // create a grid foreach ($this->grid as $i => $idx) { - $row_num = intval($i / self::GRID_SIZE); + $row_num = intval($i / self::GRID_SIZE); $cell_num_h = $i - $row_num * self::GRID_SIZE; $this->grid[$i] = [ 'active' => ord($ident[$idx]) % 2 > 0, - 'x1' => $cell_width * $cell_num_h + $this->margin, - 'y1' => $cell_height * $row_num + $this->margin, - 'x2' => $cell_width * ($cell_num_h + 1) + $this->margin, - 'y2' => $cell_height * ($row_num + 1) + $this->margin, + 'x1' => $cell_width * $cell_num_h + $this->margin, + 'y1' => $cell_height * $row_num + $this->margin, + 'x2' => $cell_width * ($cell_num_h + 1) + $this->margin, + 'y2' => $cell_height * ($row_num + 1) + $this->margin, ]; } @@ -133,7 +133,7 @@ class identicon_engine } else { // log an error $error = [ - 'code' => 500, + 'code' => 500, 'message' => "PHP-GD module not found. It's required by identicon plugin.", ]; diff --git a/plugins/identicon/tests/Identicon.php b/plugins/identicon/tests/Identicon.php index f65372407..1852c170f 100644 --- a/plugins/identicon/tests/Identicon.php +++ b/plugins/identicon/tests/Identicon.php @@ -14,7 +14,7 @@ class Identicon_Plugin extends TestCase */ public function test_constructor() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new identicon($rcube->plugins); $this->assertInstanceOf('identicon', $plugin); diff --git a/plugins/identity_select/tests/IdentitySelect.php b/plugins/identity_select/tests/IdentitySelect.php index 935bacdc5..8ddfb5693 100644 --- a/plugins/identity_select/tests/IdentitySelect.php +++ b/plugins/identity_select/tests/IdentitySelect.php @@ -14,7 +14,7 @@ class IdentitySelect_Plugin extends TestCase */ public function test_constructor() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new identity_select($rcube->plugins); $this->assertInstanceOf('identity_select', $plugin); diff --git a/plugins/jqueryui/jqueryui.php b/plugins/jqueryui/jqueryui.php index be883bf5a..860be60a0 100644 --- a/plugins/jqueryui/jqueryui.php +++ b/plugins/jqueryui/jqueryui.php @@ -14,14 +14,14 @@ */ class jqueryui extends rcube_plugin { - public $noajax = true; + public $noajax = true; public $version = '1.13.2'; private static $features = []; private static $ui_theme; private static $css_path; private static $skin_map = [ - 'larry' => 'larry', + 'larry' => 'larry', 'default' => 'elastic', ]; @@ -43,10 +43,10 @@ class jqueryui extends rcube_plugin $this->include_script('js/jquery-ui.min.js'); // include UI stylesheet - $skin = $rcmail->config->get('skin'); - $ui_map = $rcmail->config->get('jquery_ui_skin_map', self::$skin_map); - $skins = array_keys($rcmail->output->skins); - $skins[] = 'elastic'; + $skin = $rcmail->config->get('skin'); + $ui_map = $rcmail->config->get('jquery_ui_skin_map', self::$skin_map); + $skins = array_keys($rcmail->output->skins); + $skins[] = 'elastic'; foreach ($skins as $skin) { self::$ui_theme = !empty($ui_map[$skin]) ? $ui_map[$skin] : $skin; @@ -110,13 +110,13 @@ class jqueryui extends rcube_plugin self::$features[] = 'miniColors'; - $rcube = rcmail::get_instance(); + $rcube = rcmail::get_instance(); $script = 'plugins/jqueryui/js/jquery.minicolors.min.js'; - $css = self::$css_path . '/jquery.minicolors.css'; + $css = self::$css_path . '/jquery.minicolors.css'; $colors_theme = $rcube->config->get('jquery_ui_colors_theme', 'default'); - $config = ['theme' => $colors_theme]; - $config_str = rcube_output::json_serialize($config); + $config = ['theme' => $colors_theme]; + $config_str = rcube_output::json_serialize($config); $rcube->output->include_css('plugins/jqueryui/' . $css); $rcube->output->include_script($script, 'head', false); @@ -136,8 +136,8 @@ class jqueryui extends rcube_plugin self::$features[] = 'tagedit'; $script = 'plugins/jqueryui/js/jquery.tagedit.js'; - $rcube = rcmail::get_instance(); - $css = self::$css_path . '/tagedit.css'; + $rcube = rcmail::get_instance(); + $css = self::$css_path . '/tagedit.css'; if (!array_key_exists('elastic', (array) $rcube->output->skins)) { $rcube->output->include_css('plugins/jqueryui/' . $css); diff --git a/plugins/jqueryui/tests/Jqueryui.php b/plugins/jqueryui/tests/Jqueryui.php index a059cd1aa..27c5a0ccb 100644 --- a/plugins/jqueryui/tests/Jqueryui.php +++ b/plugins/jqueryui/tests/Jqueryui.php @@ -14,7 +14,7 @@ class Jqueryui_Plugin extends TestCase */ public function test_constructor() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new jqueryui($rcube->plugins); $this->assertInstanceOf('jqueryui', $plugin); diff --git a/plugins/krb_authentication/krb_authentication.php b/plugins/krb_authentication/krb_authentication.php index 9580d85a8..51e0419be 100644 --- a/plugins/krb_authentication/krb_authentication.php +++ b/plugins/krb_authentication/krb_authentication.php @@ -36,7 +36,7 @@ class krb_authentication extends rcube_plugin if (!empty($_SERVER['REMOTE_USER']) && !empty($_SERVER['KRB5CCNAME'])) { // handle login action if (empty($_SESSION['user_id'])) { - $args['action'] = 'login'; + $args['action'] = 'login'; $this->redirect_query = $_SERVER['QUERY_STRING']; } else { $_SESSION['password'] = null; @@ -56,7 +56,7 @@ class krb_authentication extends rcube_plugin $this->load_config(); $rcmail = rcmail::get_instance(); - $host = $rcmail->config->get('krb_authentication_host'); + $host = $rcmail->config->get('krb_authentication_host'); if (is_string($host) && trim($host) !== '' && empty($args['host'])) { $args['host'] = rcube_utils::idn_to_ascii(rcube_utils::parse_host($host)); @@ -68,7 +68,7 @@ class krb_authentication extends rcube_plugin } $args['cookiecheck'] = false; - $args['valid'] = true; + $args['valid'] = true; } return $args; @@ -95,8 +95,8 @@ class krb_authentication extends rcube_plugin { if (!empty($_SERVER['REMOTE_USER']) && !empty($_SERVER['KRB5CCNAME'])) { $args['gssapi_context'] = $this->gssapi_context('imap'); - $args['gssapi_cn'] = $_SERVER['KRB5CCNAME']; - $args['auth_type'] = 'GSSAPI'; + $args['gssapi_cn'] = $_SERVER['KRB5CCNAME']; + $args['auth_type'] = 'GSSAPI'; } return $args; @@ -112,8 +112,8 @@ class krb_authentication extends rcube_plugin && !empty($_SERVER['REMOTE_USER']) && !empty($_SERVER['KRB5CCNAME']) ) { $args['gssapi_context'] = $this->gssapi_context('sieve'); - $args['gssapi_cn'] = $_SERVER['KRB5CCNAME']; - $args['auth_type'] = 'GSSAPI'; + $args['gssapi_cn'] = $_SERVER['KRB5CCNAME']; + $args['auth_type'] = 'GSSAPI'; } return $args; @@ -129,7 +129,7 @@ class krb_authentication extends rcube_plugin && !empty($_SERVER['REMOTE_USER']) && !empty($_SERVER['KRB5CCNAME']) ) { $args['gssapi_context'] = $this->gssapi_context('smtp'); - $args['gssapi_cn'] = $_SERVER['KRB5CCNAME']; + $args['gssapi_cn'] = $_SERVER['KRB5CCNAME']; $args['smtp_auth_type'] = 'GSSAPI'; } @@ -144,7 +144,7 @@ class krb_authentication extends rcube_plugin // Load plugin's config file $this->load_config(); - $rcmail = rcmail::get_instance(); + $rcmail = rcmail::get_instance(); $context = $rcmail->config->get('krb_authentication_context'); if (is_array($context) && isset($context[$protocol])) { diff --git a/plugins/krb_authentication/tests/KrbAuthentication.php b/plugins/krb_authentication/tests/KrbAuthentication.php index 71d96c9b2..8f080d7fd 100644 --- a/plugins/krb_authentication/tests/KrbAuthentication.php +++ b/plugins/krb_authentication/tests/KrbAuthentication.php @@ -14,7 +14,7 @@ class KrbAuthentication_Plugin extends TestCase */ public function test_constructor() { - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); $plugin = new krb_authentication($rcube->plugins); $this->assertInstanceOf('krb_authentication', $plugin); diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve.php b/plugins/managesieve/lib/Roundcube/rcube_sieve.php index 2c4632e4b..49c210305 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve.php @@ -24,25 +24,25 @@ class rcube_sieve { - private $sieve; // Net_Sieve object - private $error = false; // error flag - private $errorLines = []; // array of line numbers within sieve script which raised an error - private $list = []; // scripts list - private $exts; // array of supported extensions - private $active; // active script name + private $sieve; // Net_Sieve object + private $error = false; // error flag + private $errorLines = []; // array of line numbers within sieve script which raised an error + private $list = []; // scripts list + private $exts; // array of supported extensions + private $active; // active script name - public $script; // rcube_sieve_script object - public $current; // name of currently loaded script + public $script; // rcube_sieve_script object + public $current; // name of currently loaded script 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 + 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 /** * Object constructor @@ -87,7 +87,7 @@ class rcube_sieve $authz = null; if (!empty($auth_cid)) { - $authz = $username; + $authz = $username; $username = $auth_cid; } @@ -313,7 +313,7 @@ class rcube_sieve if ($this->script) { $supported = $this->script->get_extensions(); - $ext = array_values(array_intersect($ext, $supported)); + $ext = array_values(array_intersect($ext, $supported)); } return $ext; @@ -330,13 +330,13 @@ class rcube_sieve } $active = null; - $list = $this->sieve->listScripts($active); + $list = $this->sieve->listScripts($active); if (is_a($list, 'PEAR_Error')) { return $this->_set_error(self::ERROR_OTHER); } - $this->list = $list; + $this->list = $list; $this->active = $active; } diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php index 0be91acf5..d7eaef7a9 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php @@ -30,10 +30,10 @@ class rcube_sieve_engine protected $errors; protected $form; protected $list; - protected $tips = []; - protected $script = []; - protected $exts = []; - protected $active = []; + protected $tips = []; + protected $script = []; + protected $exts = []; + protected $active = []; protected $headers = []; protected $disabled_actions = []; protected $addr_headers = [ @@ -61,17 +61,17 @@ class rcube_sieve_engine 1 => 'notifyimportancehigh', ]; - public const VERSION = '9.5'; + public const VERSION = '9.5'; public const PROGNAME = 'Roundcube (Managesieve)'; - public const PORT = 4190; + public const PORT = 4190; /** * Class constructor */ public function __construct($plugin) { - $this->rc = rcube::get_instance(); - $this->plugin = $plugin; + $this->rc = rcube::get_instance(); + $this->plugin = $plugin; $this->headers = $this->get_default_headers(); } @@ -82,10 +82,10 @@ class rcube_sieve_engine { // register UI objects $this->rc->output->add_handlers([ - 'filterslist' => [$this, 'filters_list'], - 'filtersetslist' => [$this, 'filtersets_list'], - 'filterform' => [$this, 'filter_form'], - 'filtersetform' => [$this, 'filterset_form'], + 'filterslist' => [$this, 'filters_list'], + 'filtersetslist' => [$this, 'filtersets_list'], + 'filterform' => [$this, 'filter_form'], + 'filtersetform' => [$this, 'filterset_form'], 'filterseteditraw' => [$this, 'filterset_editraw'], ]); @@ -166,17 +166,17 @@ class rcube_sieve_engine $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'), + '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, + 'gssapi_cn' => null, ]); [$host, $scheme, $port] = rcube_utils::parse_host_uri($plugin['host']); @@ -219,9 +219,9 @@ class rcube_sieve_engine if ($error) { rcube::raise_error([ - 'code' => 403, - 'file' => __FILE__, - 'line' => __LINE__, + 'code' => 403, + 'file' => __FILE__, + 'line' => __LINE__, 'message' => "Unable to connect to managesieve on {$host}:{$port}", ], true, false); } @@ -291,7 +291,7 @@ class rcube_sieve_engine } } elseif ($action == 'move' && !$error) { if (isset($this->script[$fid])) { - $to = (int) rcube_utils::get_input_value('_to', rcube_utils::INPUT_POST); + $to = (int) rcube_utils::get_input_value('_to', rcube_utils::INPUT_POST); $rule = $this->script[$fid]; // remove rule @@ -327,7 +327,7 @@ class rcube_sieve_engine } } elseif ($action == 'act' && !$error) { if (isset($this->script[$fid])) { - $rule = $this->script[$fid]; + $rule = $this->script[$fid]; $disabled = !empty($rule['disabled']); $rule['disabled'] = !$disabled; $result = $this->sieve->script->update_rule($fid, $rule); @@ -355,8 +355,8 @@ class rcube_sieve_engine } 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); - $kep14 = $this->rc->config->get('managesieve_kolab_master'); + $result = $this->activate_script($script_name); + $kep14 = $this->rc->config->get('managesieve_kolab_master'); if ($result === true) { $this->rc->output->set_env('active_sets', $this->active); @@ -372,7 +372,7 @@ class rcube_sieve_engine } 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); + $result = $this->deactivate_script($script_name); if ($result === true) { $this->rc->output->set_env('active_sets', $this->active); @@ -388,7 +388,7 @@ class rcube_sieve_engine } 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); + $result = $this->remove_script($script_name); if ($result === true) { $this->rc->output->show_message('managesieve.setdeleted', 'confirmation'); @@ -405,7 +405,7 @@ class rcube_sieve_engine $this->rc->request_security_check(rcube_utils::INPUT_GET); $script_name = rcube_utils::get_input_string('_set', rcube_utils::INPUT_GPC, true); - $script = $this->sieve->get_script($script_name); + $script = $this->sieve->get_script($script_name); if ($script !== false) { $this->rc->output->download_headers($script_name . '.txt', ['length' => strlen($script)]); @@ -420,13 +420,13 @@ class rcube_sieve_engine $this->rc->output->command('managesieve_updatelist', 'list', ['list' => $result]); } elseif ($action == 'ruleadd') { $rid = rcube_utils::get_input_string('_rid', rcube_utils::INPUT_POST); - $id = $this->genid(); + $id = $this->genid(); $content = $this->rule_div($fid, $id, false, !empty($_SESSION['managesieve-compact-form'])); $this->rc->output->command('managesieve_rulefill', $content, $id, $rid); } elseif ($action == 'actionadd') { $aid = rcube_utils::get_input_string('_aid', rcube_utils::INPUT_POST); - $id = $this->genid(); + $id = $this->genid(); $content = $this->action_div($fid, $id, false); $this->rc->output->command('managesieve_actionfill', $content, $id, $aid); @@ -453,8 +453,8 @@ class rcube_sieve_engine } $this->form = [ - 'join' => count($tests) > 1 ? 'allof' : 'anyof', - 'name' => '', + 'join' => count($tests) > 1 ? 'allof' : 'anyof', + 'name' => '', 'tests' => $tests, 'actions' => [ ['type' => 'fileinto'], @@ -524,13 +524,13 @@ class rcube_sieve_engine } // filters set add action elseif (!empty($_POST['_newset'])) { - $name = rcube_utils::get_input_string('_name', rcube_utils::INPUT_POST, true); - $copy = rcube_utils::get_input_string('_copy', rcube_utils::INPUT_POST, true); - $from = rcube_utils::get_input_string('_from', rcube_utils::INPUT_POST); + $name = rcube_utils::get_input_string('_name', rcube_utils::INPUT_POST, true); + $copy = rcube_utils::get_input_string('_copy', rcube_utils::INPUT_POST, true); + $from = rcube_utils::get_input_string('_from', rcube_utils::INPUT_POST); $exceptions = $this->rc->config->get('managesieve_filename_exceptions'); - $kolab = $this->rc->config->get('managesieve_kolab_master'); - $name_uc = mb_strtolower($name); - $list = $this->list_scripts(); + $kolab = $this->rc->config->get('managesieve_kolab_master'); + $name_uc = mb_strtolower($name); + $list = $this->list_scripts(); if (in_array('new_set', $this->disabled_actions)) { $error = 'managesieve.disabledaction'; @@ -567,7 +567,7 @@ class rcube_sieve_engine // Find position of the new script on the list $list[] = $name; asort($list, \SORT_LOCALE_STRING); - $list = array_values($list); + $list = array_values($list); $index = array_search($name, $list); $this->rc->output->show_message('managesieve.setcreated', 'confirmation'); @@ -580,74 +580,74 @@ class rcube_sieve_engine // filter add/edit action elseif (isset($_POST['_name'])) { $name = trim(rcube_utils::get_input_string('_name', rcube_utils::INPUT_POST, true)); - $fid = trim(rcube_utils::get_input_string('_fid', rcube_utils::INPUT_POST)); + $fid = trim(rcube_utils::get_input_string('_fid', rcube_utils::INPUT_POST)); $join = trim(rcube_utils::get_input_string('_join', rcube_utils::INPUT_POST)); // and arrays - $headers = rcube_utils::get_input_value('_header', rcube_utils::INPUT_POST); - $cust_headers = rcube_utils::get_input_value('_custom_header', rcube_utils::INPUT_POST); - $cust_vars = rcube_utils::get_input_value('_custom_var', rcube_utils::INPUT_POST); - $ops = rcube_utils::get_input_value('_rule_op', rcube_utils::INPUT_POST); - $sizeops = rcube_utils::get_input_value('_rule_size_op', rcube_utils::INPUT_POST); - $sizeitems = rcube_utils::get_input_value('_rule_size_item', rcube_utils::INPUT_POST); - $sizetargets = rcube_utils::get_input_value('_rule_size_target', rcube_utils::INPUT_POST); - $spamtestops = rcube_utils::get_input_value('_rule_spamtest_op', rcube_utils::INPUT_POST); + $headers = rcube_utils::get_input_value('_header', rcube_utils::INPUT_POST); + $cust_headers = rcube_utils::get_input_value('_custom_header', rcube_utils::INPUT_POST); + $cust_vars = rcube_utils::get_input_value('_custom_var', rcube_utils::INPUT_POST); + $ops = rcube_utils::get_input_value('_rule_op', rcube_utils::INPUT_POST); + $sizeops = rcube_utils::get_input_value('_rule_size_op', rcube_utils::INPUT_POST); + $sizeitems = rcube_utils::get_input_value('_rule_size_item', rcube_utils::INPUT_POST); + $sizetargets = rcube_utils::get_input_value('_rule_size_target', rcube_utils::INPUT_POST); + $spamtestops = rcube_utils::get_input_value('_rule_spamtest_op', rcube_utils::INPUT_POST); $spamtesttargets = rcube_utils::get_input_value('_rule_spamtest_target', rcube_utils::INPUT_POST); - $targets = rcube_utils::get_input_value('_rule_target', rcube_utils::INPUT_POST, true); - $mods = rcube_utils::get_input_value('_rule_mod', rcube_utils::INPUT_POST); - $mod_types = rcube_utils::get_input_value('_rule_mod_type', rcube_utils::INPUT_POST); - $body_trans = rcube_utils::get_input_value('_rule_trans', rcube_utils::INPUT_POST); - $body_types = rcube_utils::get_input_value('_rule_trans_type', rcube_utils::INPUT_POST, true); - $comparators = rcube_utils::get_input_value('_rule_comp', rcube_utils::INPUT_POST); - $indexes = rcube_utils::get_input_value('_rule_index', rcube_utils::INPUT_POST); - $lastindexes = rcube_utils::get_input_value('_rule_index_last', rcube_utils::INPUT_POST); - $dateheaders = rcube_utils::get_input_value('_rule_date_header', rcube_utils::INPUT_POST); - $dateparts = rcube_utils::get_input_value('_rule_date_part', rcube_utils::INPUT_POST); - $mime_parts = rcube_utils::get_input_value('_rule_mime_part', rcube_utils::INPUT_POST); - $mime_types = rcube_utils::get_input_value('_rule_mime_type', rcube_utils::INPUT_POST); - $mime_params = rcube_utils::get_input_value('_rule_mime_param', rcube_utils::INPUT_POST, true); - $message = rcube_utils::get_input_value('_rule_message', rcube_utils::INPUT_POST); - $dup_handles = rcube_utils::get_input_value('_rule_duplicate_handle', rcube_utils::INPUT_POST, true); - $dup_headers = rcube_utils::get_input_value('_rule_duplicate_header', rcube_utils::INPUT_POST, true); - $dup_uniqueids = rcube_utils::get_input_value('_rule_duplicate_uniqueid', rcube_utils::INPUT_POST, true); - $dup_seconds = rcube_utils::get_input_value('_rule_duplicate_seconds', rcube_utils::INPUT_POST); - $dup_lasts = rcube_utils::get_input_value('_rule_duplicate_last', rcube_utils::INPUT_POST); - $act_types = rcube_utils::get_input_value('_action_type', rcube_utils::INPUT_POST, true); - $mailboxes = rcube_utils::get_input_value('_action_mailbox', rcube_utils::INPUT_POST, true); - $act_targets = rcube_utils::get_input_value('_action_target', rcube_utils::INPUT_POST, true); + $targets = rcube_utils::get_input_value('_rule_target', rcube_utils::INPUT_POST, true); + $mods = rcube_utils::get_input_value('_rule_mod', rcube_utils::INPUT_POST); + $mod_types = rcube_utils::get_input_value('_rule_mod_type', rcube_utils::INPUT_POST); + $body_trans = rcube_utils::get_input_value('_rule_trans', rcube_utils::INPUT_POST); + $body_types = rcube_utils::get_input_value('_rule_trans_type', rcube_utils::INPUT_POST, true); + $comparators = rcube_utils::get_input_value('_rule_comp', rcube_utils::INPUT_POST); + $indexes = rcube_utils::get_input_value('_rule_index', rcube_utils::INPUT_POST); + $lastindexes = rcube_utils::get_input_value('_rule_index_last', rcube_utils::INPUT_POST); + $dateheaders = rcube_utils::get_input_value('_rule_date_header', rcube_utils::INPUT_POST); + $dateparts = rcube_utils::get_input_value('_rule_date_part', rcube_utils::INPUT_POST); + $mime_parts = rcube_utils::get_input_value('_rule_mime_part', rcube_utils::INPUT_POST); + $mime_types = rcube_utils::get_input_value('_rule_mime_type', rcube_utils::INPUT_POST); + $mime_params = rcube_utils::get_input_value('_rule_mime_param', rcube_utils::INPUT_POST, true); + $message = rcube_utils::get_input_value('_rule_message', rcube_utils::INPUT_POST); + $dup_handles = rcube_utils::get_input_value('_rule_duplicate_handle', rcube_utils::INPUT_POST, true); + $dup_headers = rcube_utils::get_input_value('_rule_duplicate_header', rcube_utils::INPUT_POST, true); + $dup_uniqueids = rcube_utils::get_input_value('_rule_duplicate_uniqueid', rcube_utils::INPUT_POST, true); + $dup_seconds = rcube_utils::get_input_value('_rule_duplicate_seconds', rcube_utils::INPUT_POST); + $dup_lasts = rcube_utils::get_input_value('_rule_duplicate_last', rcube_utils::INPUT_POST); + $act_types = rcube_utils::get_input_value('_action_type', rcube_utils::INPUT_POST, true); + $mailboxes = rcube_utils::get_input_value('_action_mailbox', rcube_utils::INPUT_POST, true); + $act_targets = rcube_utils::get_input_value('_action_target', rcube_utils::INPUT_POST, true); $domain_targets = rcube_utils::get_input_value('_action_target_domain', rcube_utils::INPUT_POST); - $area_targets = rcube_utils::get_input_value('_action_target_area', rcube_utils::INPUT_POST, true); - $reasons = rcube_utils::get_input_value('_action_reason', rcube_utils::INPUT_POST, true); - $addresses = rcube_utils::get_input_value('_action_addresses', rcube_utils::INPUT_POST, true); - $intervals = rcube_utils::get_input_value('_action_interval', rcube_utils::INPUT_POST); + $area_targets = rcube_utils::get_input_value('_action_target_area', rcube_utils::INPUT_POST, true); + $reasons = rcube_utils::get_input_value('_action_reason', rcube_utils::INPUT_POST, true); + $addresses = rcube_utils::get_input_value('_action_addresses', rcube_utils::INPUT_POST, true); + $intervals = rcube_utils::get_input_value('_action_interval', rcube_utils::INPUT_POST); $interval_types = rcube_utils::get_input_value('_action_interval_type', rcube_utils::INPUT_POST); - $from = rcube_utils::get_input_value('_action_from', rcube_utils::INPUT_POST, true); - $subject = rcube_utils::get_input_value('_action_subject', rcube_utils::INPUT_POST, true); - $flags = rcube_utils::get_input_value('_action_flags', rcube_utils::INPUT_POST); - $varnames = rcube_utils::get_input_value('_action_varname', rcube_utils::INPUT_POST); - $varvalues = rcube_utils::get_input_value('_action_varvalue', rcube_utils::INPUT_POST); - $varmods = rcube_utils::get_input_value('_action_varmods', rcube_utils::INPUT_POST); - $notifymethods = rcube_utils::get_input_value('_action_notifymethod', rcube_utils::INPUT_POST); - $notifytargets = rcube_utils::get_input_value('_action_notifytarget', rcube_utils::INPUT_POST, true); - $notifyoptions = rcube_utils::get_input_value('_action_notifyoption', rcube_utils::INPUT_POST, true); + $from = rcube_utils::get_input_value('_action_from', rcube_utils::INPUT_POST, true); + $subject = rcube_utils::get_input_value('_action_subject', rcube_utils::INPUT_POST, true); + $flags = rcube_utils::get_input_value('_action_flags', rcube_utils::INPUT_POST); + $varnames = rcube_utils::get_input_value('_action_varname', rcube_utils::INPUT_POST); + $varvalues = rcube_utils::get_input_value('_action_varvalue', rcube_utils::INPUT_POST); + $varmods = rcube_utils::get_input_value('_action_varmods', rcube_utils::INPUT_POST); + $notifymethods = rcube_utils::get_input_value('_action_notifymethod', rcube_utils::INPUT_POST); + $notifytargets = rcube_utils::get_input_value('_action_notifytarget', rcube_utils::INPUT_POST, true); + $notifyoptions = rcube_utils::get_input_value('_action_notifyoption', rcube_utils::INPUT_POST, true); $notifymessages = rcube_utils::get_input_value('_action_notifymessage', rcube_utils::INPUT_POST, true); - $notifyfrom = rcube_utils::get_input_value('_action_notifyfrom', rcube_utils::INPUT_POST, true); - $notifyimp = rcube_utils::get_input_value('_action_notifyimportance', rcube_utils::INPUT_POST); - $addheader_name = rcube_utils::get_input_value('_action_addheader_name', rcube_utils::INPUT_POST); + $notifyfrom = rcube_utils::get_input_value('_action_notifyfrom', rcube_utils::INPUT_POST, true); + $notifyimp = rcube_utils::get_input_value('_action_notifyimportance', rcube_utils::INPUT_POST); + $addheader_name = rcube_utils::get_input_value('_action_addheader_name', rcube_utils::INPUT_POST); $addheader_value = rcube_utils::get_input_value('_action_addheader_value', rcube_utils::INPUT_POST, true); - $addheader_pos = rcube_utils::get_input_value('_action_addheader_pos', rcube_utils::INPUT_POST); - $delheader_name = rcube_utils::get_input_value('_action_delheader_name', rcube_utils::INPUT_POST); + $addheader_pos = rcube_utils::get_input_value('_action_addheader_pos', rcube_utils::INPUT_POST); + $delheader_name = rcube_utils::get_input_value('_action_delheader_name', rcube_utils::INPUT_POST); $delheader_value = rcube_utils::get_input_value('_action_delheader_value', rcube_utils::INPUT_POST, true); - $delheader_pos = rcube_utils::get_input_value('_action_delheader_pos', rcube_utils::INPUT_POST); + $delheader_pos = rcube_utils::get_input_value('_action_delheader_pos', rcube_utils::INPUT_POST); $delheader_index = rcube_utils::get_input_value('_action_delheader_index', rcube_utils::INPUT_POST); - $delheader_op = rcube_utils::get_input_value('_action_delheader_op', rcube_utils::INPUT_POST); - $delheader_comp = rcube_utils::get_input_value('_action_delheader_comp', rcube_utils::INPUT_POST); + $delheader_op = rcube_utils::get_input_value('_action_delheader_op', rcube_utils::INPUT_POST); + $delheader_comp = rcube_utils::get_input_value('_action_delheader_comp', rcube_utils::INPUT_POST); $this->form['disabled'] = empty($_POST['_enabled']); - $this->form['join'] = $join == 'allof'; - $this->form['name'] = $name; - $this->form['tests'] = []; - $this->form['actions'] = []; + $this->form['join'] = $join == 'allof'; + $this->form['name'] = $name; + $this->form['tests'] = []; + $this->form['actions'] = []; if ($name == '') { $this->errors['name'] = $this->plugin->gettext('cannotbeempty'); @@ -667,19 +667,19 @@ class rcube_sieve_engine } else { foreach ($headers as $idx => $header) { // targets are indexed differently (assume form order) - $target = $this->strip_value($targets[$idx], true); - $header = $this->strip_value($header); - $operator = $this->strip_value($ops[$idx]); + $target = $this->strip_value($targets[$idx], true); + $header = $this->strip_value($header); + $operator = $this->strip_value($ops[$idx]); $comparator = $this->strip_value($comparators[$idx]); if ($header == 'size') { - $sizeop = $this->strip_value($sizeops[$idx]); - $sizeitem = $this->strip_value($sizeitems[$idx]); + $sizeop = $this->strip_value($sizeops[$idx]); + $sizeitem = $this->strip_value($sizeitems[$idx]); $sizetarget = $this->strip_value($sizetargets[$idx]); $this->form['tests'][$i]['test'] = 'size'; $this->form['tests'][$i]['type'] = $sizeop; - $this->form['tests'][$i]['arg'] = $sizetarget; + $this->form['tests'][$i]['arg'] = $sizetarget; if ($sizetarget === '') { $this->errors['tests'][$i]['sizetarget'] = $this->plugin->gettext('cannotbeempty'); @@ -690,18 +690,18 @@ class rcube_sieve_engine $this->form['tests'][$i]['arg'] .= $m[1]; } } elseif ($header == 'spamtest') { - $spamtestop = $this->strip_value($spamtestops[$idx]); + $spamtestop = $this->strip_value($spamtestops[$idx]); $spamtesttarget = $this->strip_value($spamtesttargets[$idx]); - $comparator = 'i;ascii-numeric'; + $comparator = 'i;ascii-numeric'; if (!$spamtestop) { - $spamtestop = 'value-eq'; + $spamtestop = 'value-eq'; $spamtesttarget = '0'; } $this->form['tests'][$i]['test'] = 'spamtest'; $this->form['tests'][$i]['type'] = $spamtestop; - $this->form['tests'][$i]['arg'] = $spamtesttarget; + $this->form['tests'][$i]['arg'] = $spamtesttarget; if ($spamtesttarget === '') { $this->errors['tests'][$i]['spamtesttarget'] = $this->plugin->gettext('cannotbeempty'); @@ -710,13 +710,13 @@ class rcube_sieve_engine } } elseif ($header == 'currentdate') { $datepart = $this->strip_value($dateparts[$idx]); - $type = preg_replace('/^not/', '', $operator); + $type = preg_replace('/^not/', '', $operator); $this->form['tests'][$i]['test'] = 'currentdate'; $this->form['tests'][$i]['type'] = $type; $this->form['tests'][$i]['part'] = $datepart; - $this->form['tests'][$i]['arg'] = $target; - $this->form['tests'][$i]['not'] = preg_match('/^not/', $operator) === 1; + $this->form['tests'][$i]['arg'] = $target; + $this->form['tests'][$i]['not'] = preg_match('/^not/', $operator) === 1; if ($type == 'exists') { $this->errors['tests'][$i]['op'] = true; @@ -748,11 +748,11 @@ class rcube_sieve_engine } } } elseif ($header == 'date') { - $datepart = $this->strip_value($dateparts[$idx]); - $dateheader = $this->strip_value($dateheaders[$idx]); - $index = $this->strip_value($indexes[$idx]); - $indexlast = $this->strip_value($lastindexes[$idx] ?? null); - $mod = $this->strip_value($mods[$idx]); + $datepart = $this->strip_value($dateparts[$idx]); + $dateheader = $this->strip_value($dateheaders[$idx]); + $index = $this->strip_value($indexes[$idx]); + $indexlast = $this->strip_value($lastindexes[$idx] ?? null); + $mod = $this->strip_value($mods[$idx]); $type = preg_replace('/^not/', '', $operator); @@ -762,7 +762,7 @@ class rcube_sieve_engine if (!empty($index) && $mod != 'envelope') { $this->form['tests'][$i]['index'] = intval($index); - $this->form['tests'][$i]['last'] = !empty($indexlast); + $this->form['tests'][$i]['last'] = !empty($indexlast); } if (empty($dateheader)) { @@ -771,12 +771,12 @@ class rcube_sieve_engine $this->errors['tests'][$i]['dateheader'] = $this->plugin->gettext('forbiddenchars'); } - $this->form['tests'][$i]['test'] = 'date'; - $this->form['tests'][$i]['type'] = $type; - $this->form['tests'][$i]['part'] = $datepart; - $this->form['tests'][$i]['arg'] = $target; + $this->form['tests'][$i]['test'] = 'date'; + $this->form['tests'][$i]['type'] = $type; + $this->form['tests'][$i]['part'] = $datepart; + $this->form['tests'][$i]['arg'] = $target; $this->form['tests'][$i]['header'] = $dateheader; - $this->form['tests'][$i]['not'] = preg_match('/^not/', $operator) === 1; + $this->form['tests'][$i]['not'] = preg_match('/^not/', $operator) === 1; if ($type != 'exists') { if (empty($target)) { @@ -804,14 +804,14 @@ class rcube_sieve_engine } } } elseif ($header == 'body') { - $trans = $this->strip_value($body_trans[$idx]); + $trans = $this->strip_value($body_trans[$idx]); $trans_type = $this->strip_value($body_types[$idx], true); - $type = preg_replace('/^not/', '', $operator); + $type = preg_replace('/^not/', '', $operator); $this->form['tests'][$i]['test'] = 'body'; $this->form['tests'][$i]['type'] = $type; - $this->form['tests'][$i]['arg'] = $target; - $this->form['tests'][$i]['not'] = preg_match('/^not/', $operator) === 1; + $this->form['tests'][$i]['arg'] = $target; + $this->form['tests'][$i]['not'] = preg_match('/^not/', $operator) === 1; $this->form['tests'][$i]['part'] = $trans; if ($trans == 'content') { @@ -842,11 +842,11 @@ class rcube_sieve_engine $this->form['tests'][$i]['test'] = $test; if ($test == 'duplicate') { - $this->form['tests'][$i]['last'] = !empty($dup_lasts[$idx]); - $this->form['tests'][$i]['handle'] = trim($dup_handles[$idx]); - $this->form['tests'][$i]['header'] = trim($dup_headers[$idx]); + $this->form['tests'][$i]['last'] = !empty($dup_lasts[$idx]); + $this->form['tests'][$i]['handle'] = trim($dup_handles[$idx]); + $this->form['tests'][$i]['header'] = trim($dup_headers[$idx]); $this->form['tests'][$i]['uniqueid'] = trim($dup_uniqueids[$idx]); - $this->form['tests'][$i]['seconds'] = trim($dup_seconds[$idx]); + $this->form['tests'][$i]['seconds'] = trim($dup_seconds[$idx]); if ($this->form['tests'][$i]['seconds'] && preg_match('/[^0-9]/', $this->form['tests'][$i]['seconds']) @@ -860,14 +860,14 @@ class rcube_sieve_engine } } else { $cust_header = $headers = $this->strip_value($cust_headers[$idx]); - $mod = $this->strip_value($mods[$idx]); - $mod_type = $this->strip_value($mod_types[$idx]); - $index = isset($indexes[$idx]) ? $this->strip_value($indexes[$idx]) : null; - $indexlast = isset($lastindexes[$idx]) ? $this->strip_value($lastindexes[$idx]) : null; - $mime_param = isset($mime_params[$idx]) ? $this->strip_value($mime_params[$idx]) : null; - $mime_type = $mime_types[$idx] ?? null; - $mime_part = $mime_parts[$idx] ?? null; - $cust_var = null; + $mod = $this->strip_value($mods[$idx]); + $mod_type = $this->strip_value($mod_types[$idx]); + $index = isset($indexes[$idx]) ? $this->strip_value($indexes[$idx]) : null; + $indexlast = isset($lastindexes[$idx]) ? $this->strip_value($lastindexes[$idx]) : null; + $mime_param = isset($mime_params[$idx]) ? $this->strip_value($mime_params[$idx]) : null; + $mime_type = $mime_types[$idx] ?? null; + $mime_part = $mime_parts[$idx] ?? null; + $cust_var = null; if ($header == 'string') { $cust_var = $headers = $this->strip_value($cust_vars[$idx]); @@ -879,7 +879,7 @@ class rcube_sieve_engine if (!empty($index) && $mod != 'envelope') { $this->form['tests'][$i]['index'] = intval($index); - $this->form['tests'][$i]['last'] = !empty($indexlast); + $this->form['tests'][$i]['last'] = !empty($indexlast); } if ($header == '...' || $header == 'string') { @@ -899,7 +899,7 @@ class rcube_sieve_engine } } - $test = $header == 'string' ? 'string' : 'header'; + $test = $header == 'string' ? 'string' : 'header'; $header = $header == 'string' ? $cust_var : $header; $header = $header == '...' ? $cust_header : $header; @@ -1043,9 +1043,9 @@ class rcube_sieve_engine break; case 'addheader': case 'deleteheader': - $this->form['actions'][$i]['name'] = trim($type == 'addheader' ? $addheader_name[$idx] : $delheader_name[$idx]); + $this->form['actions'][$i]['name'] = trim($type == 'addheader' ? $addheader_name[$idx] : $delheader_name[$idx]); $this->form['actions'][$i]['value'] = $type == 'addheader' ? $addheader_value[$idx] : $delheader_value[$idx]; - $this->form['actions'][$i]['last'] = ($type == 'addheader' ? $addheader_pos[$idx] : $delheader_pos[$idx]) == 'last'; + $this->form['actions'][$i]['last'] = ($type == 'addheader' ? $addheader_pos[$idx] : $delheader_pos[$idx]) == 'last'; if (empty($this->form['actions'][$i]['name'])) { $this->errors['actions'][$i]['name'] = $this->plugin->gettext('cannotbeempty'); @@ -1062,7 +1062,7 @@ class rcube_sieve_engine $this->form['actions'][$i]['match-type'] = $delheader_op[$idx]; $this->form['actions'][$i]['comparator'] = $delheader_comp[$idx]; - $this->form['actions'][$i]['index'] = $delheader_index[$idx]; + $this->form['actions'][$i]['index'] = $delheader_index[$idx]; if (empty($this->form['actions'][$i]['index'])) { if (!empty($this->form['actions'][$i]['last'])) { @@ -1079,12 +1079,12 @@ class rcube_sieve_engine break; case 'vacation': - $reason = $this->strip_value($reasons[$idx], true); + $reason = $this->strip_value($reasons[$idx], true); $interval_type = $interval_types && $interval_types[$idx] == 'seconds' ? 'seconds' : 'days'; - $this->form['actions'][$i]['reason'] = str_replace("\r\n", "\n", $reason); - $this->form['actions'][$i]['from'] = $from[$idx]; - $this->form['actions'][$i]['subject'] = $subject[$idx]; + $this->form['actions'][$i]['reason'] = str_replace("\r\n", "\n", $reason); + $this->form['actions'][$i]['from'] = $from[$idx]; + $this->form['actions'][$i]['subject'] = $subject[$idx]; $this->form['actions'][$i]['addresses'] = $addresses[$idx]; $this->form['actions'][$i][$interval_type] = $intervals[$idx]; @@ -1147,10 +1147,10 @@ class rcube_sieve_engine } } - $this->form['actions'][$i]['method'] = $notifymethods[$idx] . ':' . $notifytargets[$idx]; - $this->form['actions'][$i]['options'] = $notifyoptions[$idx]; - $this->form['actions'][$i]['message'] = $notifymessages[$idx]; - $this->form['actions'][$i]['from'] = $notifyfrom[$idx]; + $this->form['actions'][$i]['method'] = $notifymethods[$idx] . ':' . $notifytargets[$idx]; + $this->form['actions'][$i]['options'] = $notifyoptions[$idx]; + $this->form['actions'][$i]['message'] = $notifymessages[$idx]; + $this->form['actions'][$i]['from'] = $notifyfrom[$idx]; $this->form['actions'][$i]['importance'] = $notifyimp[$idx]; if (!empty($notifyfrom[$idx]) && stripos($this->form['actions'][$i]['method'], 'mailto:') === 0) { @@ -1182,8 +1182,8 @@ class rcube_sieve_engine $this->rc->output->show_message('managesieve.filtersaved', 'confirmation'); if ($this->rc->task != 'mail') { $args = [ - 'name' => $this->form['name'], - 'id' => $fid, + 'name' => $this->form['name'], + 'id' => $fid, 'disabled' => $this->form['disabled'], ]; $this->rc->output->command('parent.managesieve_updatelist', isset($new) ? 'add' : 'update', $args); @@ -1266,15 +1266,15 @@ class rcube_sieve_engine if (!empty($attrib['type']) && $attrib['type'] == 'list') { // define list of cols to be displayed $a_show_cols = ['name']; - $result = []; - $scripts = []; + $result = []; + $scripts = []; if ($list) { foreach ($list as $idx => $set) { $scripts['S' . $idx] = $set; $result[] = [ - 'name' => $set, - 'id' => 'S' . $idx, + 'name' => $set, + 'id' => 'S' . $idx, 'class' => !in_array($set, $this->active) ? 'disabled' : '', ]; } @@ -1287,9 +1287,9 @@ class rcube_sieve_engine $this->rc->output->include_script('list.js'); } else { $select = new html_select([ - 'name' => '_set', - 'id' => $attrib['id'], - 'class' => 'custom-select', + 'name' => '_set', + 'id' => $attrib['id'], + 'class' => 'custom-select', 'onchange' => $this->rc->task != 'mail' ? 'rcmail.managesieve_set()' : '', ]); @@ -1314,9 +1314,9 @@ class rcube_sieve_engine public function filterset_editraw($attrib) { $script_name = rcube_utils::get_input_string('_set', rcube_utils::INPUT_GP); - $script = $this->sieve->get_script($script_name); + $script = $this->sieve->get_script($script_name); $script_post = !empty($_POST['rawsetcontent']) ? $_POST['rawsetcontent'] : null; - $framed = !empty($_POST['_framed']) || !empty($_GET['_framed']); + $framed = !empty($_POST['_framed']) || !empty($_GET['_framed']); $hiddenfields = new html_hiddenfield(); $hiddenfields->add(['name' => '_task', 'value' => $this->rc->task]); @@ -1328,10 +1328,10 @@ class rcube_sieve_engine $out = $hiddenfields->show(); $txtarea = new html_textarea([ - 'id' => 'rawfiltersettxt', - 'name' => 'rawsetcontent', + 'id' => 'rawfiltersettxt', + 'name' => 'rawsetcontent', 'class' => 'form-control', - 'rows' => '15', + 'rows' => '15', ]); $out .= $txtarea->show($script_post !== null ? $script_post : ($script !== false ? rtrim($script) : '')); @@ -1347,10 +1347,10 @@ class rcube_sieve_engine } $out = html::tag('form', $attrib + [ - 'id' => 'filtersetrawform', - 'name' => 'filtersetrawform', - 'action' => './', - 'method' => 'post', + 'id' => 'filtersetrawform', + 'name' => 'filtersetrawform', + 'action' => './', + 'method' => 'post', 'enctype' => 'multipart/form-data', ], $out ); @@ -1364,22 +1364,22 @@ class rcube_sieve_engine $attrib['id'] = 'rcmfiltersetform'; } - $framed = !empty($_POST['_framed']) || !empty($_GET['_framed']); - $table = new html_table(['cols' => 2, 'class' => 'propform']); + $framed = !empty($_POST['_framed']) || !empty($_GET['_framed']); + $table = new html_table(['cols' => 2, 'class' => 'propform']); $hiddenfields = new html_hiddenfield(['name' => '_task', 'value' => $this->rc->task]); $hiddenfields->add(['name' => '_action', 'value' => 'plugin.managesieve-save']); $hiddenfields->add(['name' => '_framed', 'value' => $framed ? 1 : 0]); $hiddenfields->add(['name' => '_newset', 'value' => 1]); - $name = rcube_utils::get_input_string('_name', rcube_utils::INPUT_POST); - $copy = rcube_utils::get_input_string('_copy', rcube_utils::INPUT_POST); + $name = rcube_utils::get_input_string('_name', rcube_utils::INPUT_POST); + $copy = rcube_utils::get_input_string('_copy', rcube_utils::INPUT_POST); $selected = rcube_utils::get_input_string('_from', rcube_utils::INPUT_POST); // filter set name input $input_name = new html_inputfield([ - 'name' => '_name', - 'id' => '_name', - 'size' => 30, + 'name' => '_name', + 'id' => '_name', + 'size' => 30, 'class' => !empty($this->errors['name']) ? 'error form-control' : 'form-control', ]); @@ -1388,15 +1388,15 @@ class rcube_sieve_engine $filters = '