From 12547ccf014969d1069dbea4b89985dffa70df41 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak
Date: Sun, 13 Dec 2020 10:21:52 +0100
Subject: [PATCH] Require php-intl extension, get rid of Net_IDNA2, PHP8 fixes,
short array syntax
Net_IDNA2 is not compatible, and Intl is a bundled ext since PHP 5.3.
Fixed some regressions.
---
.github/workflows/tests.yml | 2 +-
CHANGELOG | 4 +-
INSTALL | 4 +-
composer.json-dist | 1 -
installer/check.php | 67 ++--
installer/config.php | 193 +++++------
installer/index.php | 94 +++---
installer/test.php | 311 +++++++++---------
.../new_user_identity/new_user_identity.php | 5 +
program/actions/settings/identity_edit.php | 2 +-
program/actions/settings/identity_save.php | 2 +-
program/include/rcmail_install.php | 4 +-
program/lib/Roundcube/bootstrap.php | 64 ----
program/lib/Roundcube/html.php | 14 +-
program/lib/Roundcube/rcube.php | 5 +-
program/lib/Roundcube/rcube_utils.php | 1 -
16 files changed, 356 insertions(+), 417 deletions(-)
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index cb25dba52..46953446a 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -21,7 +21,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- extensions: dom, curl, fileinfo, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, ldap
+ extensions: dom, curl, fileinfo, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, ldap, intl
tools: composer:v2
coverage: none
diff --git a/CHANGELOG b/CHANGELOG
index 0d56d6f56..30c3b977d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,9 @@ CHANGELOG Roundcube Webmail
===========================
- Require PHP >= 5.5
+- Require php-intl
+- Remove use of ext-iconv
+- Remove use of Net_IDNA2 package
- Automatically collected recipients and trusted senders (#6904)
- Added configurable Collected Recipients addressbook source (#4971)
- Added configurable Trusted Senders addressbook source (#5046)
@@ -14,7 +17,6 @@ CHANGELOG Roundcube Webmail
- Upgrade to TinyMCE 5.5.1
- Upgrade to jQuery 3.5.1 (#7464)
- Allow array in smtp_host config (#7296)
-- Remove use of ext-iconv
- Support proxy for server-side HTTP requests (#7658)
- Add posibility to (re-)define field mapping on contacts import from a CSV file (#7045, #6668)
- Move "On request for return receipt" from "Mailbox View" to "Displaying Messages" (#7614)
diff --git a/INSTALL b/INSTALL
index ec774f17d..c45f385e0 100644
--- a/INSTALL
+++ b/INSTALL
@@ -12,9 +12,9 @@ REQUIREMENTS
* An IMAP, HTTP and SMTP server
* .htaccess support allowing overrides for DirectoryIndex
* PHP Version 5.5 or greater including:
- - PCRE, DOM, JSON, Session, Sockets, OpenSSL, Mbstring, Filter, Ctype (required)
+ - PCRE, DOM, JSON, Session, Sockets, OpenSSL, Mbstring, Filter, Ctype, Intl (required)
- PHP PDO with driver for either MySQL, PostgreSQL, SQL Server, Oracle or SQLite (required)
- - Zip, Fileinfo, Intl, Exif (recommended)
+ - Zip, Fileinfo, Exif (recommended)
- LDAP for LDAP addressbook support (optional)
- GD, Imagick (optional thumbnails generation, QR-code)
* PEAR and PEAR packages distributed with Roundcube or external.
diff --git a/composer.json-dist b/composer.json-dist
index cb7ddd8ae..89d1fa8d2 100644
--- a/composer.json-dist
+++ b/composer.json-dist
@@ -12,7 +12,6 @@
"php": ">=5.5.0",
"pear/pear-core-minimal": "~1.10.1",
"pear/auth_sasl": "~1.1.0",
- "pear/net_idna2": "~0.2.0",
"pear/mail_mime": "~1.10.0",
"pear/net_smtp": "~1.9.0",
"pear/crypt_gpg": "~1.6.3",
diff --git a/installer/check.php b/installer/check.php
index 8f7d5093e..d4d701197 100644
--- a/installer/check.php
+++ b/installer/check.php
@@ -18,59 +18,54 @@ if (!class_exists('rcmail_install', false) || !isset($RCI)) {
die("Not allowed! Please open installer/index.php instead.");
}
-?>
-
supported_dbs as $database => $ext) {
if (extension_loaded($ext)) {
$RCI->pass($database);
@@ -180,7 +179,6 @@ if (empty($found_db_driver)) {
?>
-
Check for required 3rd party libs
This also checks if the include path is set correctly.
@@ -242,7 +240,8 @@ foreach ($optional_checks as $var => $val) {
if ($val === '-NOTEMPTY-') {
if (empty($status)) {
$RCI->optfail($var, "Could be set");
- } else {
+ }
+ else {
$RCI->pass($var);
}
echo ' ';
@@ -275,7 +274,7 @@ foreach ($optional_checks as $var => $val) {
failures) {
- echo 'Sorry but your webserver does not meet the requirements for Roundcube!
+ echo '
Sorry but your webserver does not meet the requirements for Roundcube!
Please install the missing modules or fix the php.ini settings according to the above check results.
Hint: only checks showing NOT OK need to be fixed.
';
}
diff --git a/installer/config.php b/installer/config.php
index 69aac3941..ede2047f7 100644
--- a/installer/config.php
+++ b/installer/config.php
@@ -19,13 +19,13 @@ if (!class_exists('rcmail_install', false) || !isset($RCI)) {
}
// register these boolean fields
-$RCI->bool_config_props = array(
- 'ip_check' => 1,
+$RCI->bool_config_props = [
+ 'ip_check' => 1,
'enable_spellcheck' => 1,
- 'auto_create_user' => 1,
- 'smtp_log' => 1,
- 'prefer_html' => 1,
-);
+ 'auto_create_user' => 1,
+ 'smtp_log' => 1,
+ 'prefer_html' => 1,
+];
// allow the current user to get to the next step
$_SESSION['allowinstaller'] = true;
@@ -34,10 +34,12 @@ if (!empty($_POST['submit'])) {
$_SESSION['config'] = $RCI->create_config();
if ($RCI->save_configfile($_SESSION['config'])) {
- echo 'The config file was saved successfully into '.RCMAIL_CONFIG_DIR.' directory of your Roundcube installation.';
+ echo '
The config file was saved successfully into'
+ . ' '.RCMAIL_CONFIG_DIR.' directory of your Roundcube installation.';
if ($RCI->legacy_config) {
- echo ' Afterwards, please remove the old configuration files main.inc.php and db.inc.php from the config directory.';
+ echo ' Afterwards, please remove the old configuration files'
+ . ' main.inc.php and db.inc.php from the config directory.';
}
echo '
';
@@ -60,12 +62,13 @@ if (!empty($_POST['submit'])) {
echo $save_button;
if ($RCI->legacy_config) {
- echo ' Afterwards, please remove the old configuration files main.inc.php and db.inc.php from the config directory.';
+ echo ' Afterwards, please remove the old configuration files'
+ . ' main.inc.php and db.inc.php from the config directory.';
}
echo '';
- $textbox = new html_textarea(array('rows' => 16, 'cols' => 60, 'class' => "configfile"));
+ $textbox = new html_textarea(['rows' => 16, 'cols' => 60, 'class' => 'configfile']);
echo $textbox->show(($_SESSION['config']));
}
@@ -90,7 +93,7 @@ if (!empty($_POST['submit'])) {
'_product_name', 'size' => 30, 'id' => "cfgprodname"));
+$input_prodname = new html_inputfield(['name' => '_product_name', 'size' => 30, 'id' => 'cfgprodname']);
echo $input_prodname->show($RCI->getprop('product_name'));
?>
@@ -101,7 +104,7 @@ echo $input_prodname->show($RCI->getprop('product_name'));
'_support_url', 'size' => 50, 'id' => "cfgsupporturl"));
+$input_support = new html_inputfield(['name' => '_support_url', 'size' => 50, 'id' => 'cfgsupporturl']);
echo $input_support->show($RCI->getprop('support_url'));
?>
@@ -109,23 +112,11 @@ echo $input_support->show($RCI->getprop('support_url'));
Enter an absolute URL (including http://) to a support page/form or a mailto: link.
- skin_logo
-
- '_skin_logo', 'size' => 50, 'id' => "cfgskinlogo"));
-echo $input_skin->show($RCI->getprop('skin_logo'));
-
-?>
-Custom image to display instead of the Roundcube logo.
-Enter a URL relative to the document root of this Roundcube installation.
-
-
temp_dir
'_temp_dir', 'size' => 30, 'id' => "cfgtempdir"));
+$input_tempdir = new html_inputfield(['name' => '_temp_dir', 'size' => 30, 'id' => 'cfgtempdir']);
echo $input_tempdir->show($RCI->getprop('temp_dir'));
?>
@@ -136,7 +127,7 @@ echo $input_tempdir->show($RCI->getprop('temp_dir'));
'_des_key', 'size' => 30, 'id' => "cfgdeskey"));
+$input_deskey = new html_inputfield(['name' => '_des_key', 'size' => 30, 'id' => 'cfgdeskey']);
echo $input_deskey->show($RCI->getprop('des_key'));
?>
@@ -148,7 +139,7 @@ echo $input_deskey->show($RCI->getprop('des_key'));
'_ip_check', 'id' => "cfgipcheck"));
+$check_ipcheck = new html_checkbox(['name' => '_ip_check', 'id' => 'cfgipcheck']);
echo $check_ipcheck->show(intval($RCI->getprop('ip_check')), array('value' => 1));
?>
@@ -157,30 +148,33 @@ echo $check_ipcheck->show(intval($RCI->getprop('ip_check')), array('value' => 1)
This increases security but can cause sudden logouts when someone uses a proxy with changing IPs.
-
enable_spellcheck
'_enable_spellcheck', 'id' => "cfgspellcheck"));
-echo $check_spell->show(intval($RCI->getprop('enable_spellcheck')), array('value' => 1));
+$check_spell = new html_checkbox(['name' => '_enable_spellcheck', 'id' => 'cfgspellcheck']);
+echo $check_spell->show(intval($RCI->getprop('enable_spellcheck')), ['value' => 1]);
?>
+
Make use of the spell checker
spellcheck_engine
+
'_spellcheck_engine', 'id' => "cfgspellcheckengine"));
-if (extension_loaded('pspell'))
- $select_spell->add('Pspell', 'pspell');
-if (extension_loaded('enchant'))
- $select_spell->add('Enchant', 'enchant');
+$select_spell = new html_select(['name' => '_spellcheck_engine', 'id' => 'cfgspellcheckengine']);
+if (extension_loaded('pspell')) {
+ $select_spell->add('Pspell', 'pspell');
+}
+if (extension_loaded('enchant')) {
+ $select_spell->add('Enchant', 'enchant');
+}
$select_spell->add('Googie', 'googie');
$select_spell->add('ATD', 'atd');
echo $select_spell->show($RCI->is_post ? $_POST['_spellcheck_engine'] : 'pspell');
-
?>
+
Which spell checker to use
Googie implies that the message content will be sent to external server to check the spelling.
@@ -188,9 +182,10 @@ echo $select_spell->show($RCI->is_post ? $_POST['_spellcheck_engine'] : 'pspell'
identities_level
+
'_identities_level', 'id' => "cfgidentitieslevel"));
+$input_ilevel = new html_select(['name' => '_identities_level', 'id' => 'cfgidentitieslevel']);
$input_ilevel->add('many identities with possibility to edit all params', 0);
$input_ilevel->add('many identities with possibility to edit all params but not email address', 1);
$input_ilevel->add('one identity with possibility to edit all params', 2);
@@ -199,6 +194,7 @@ $input_ilevel->add('one identity with possibility to edit only signature', 4);
echo $input_ilevel->show($RCI->getprop('identities_level'), 0);
?>
+
Level of identities access
Defines what users can do with their identities.
@@ -212,13 +208,13 @@ echo $input_ilevel->show($RCI->getprop('identities_level'), 0);
log_driver
+
'_log_driver', 'id' => "cfglogdriver"));
-$select_log_driver->add(array('file', 'syslog', 'stdout'), array('file', 'syslog', 'stdout'));
+$select_log_driver = new html_select(['name' => '_log_driver', 'id' => 'cfglogdriver']);
+$select_log_driver->add(['file', 'syslog', 'stdout'], ['file', 'syslog', 'stdout']);
echo $select_log_driver->show($RCI->getprop('log_driver', 'file'));
-
?>
+
How to do logging? 'file' - write to files in the log directory, 'syslog' - use the syslog facility, 'stdout' writes to the process' STDOUT file descriptor.
@@ -226,7 +222,7 @@ echo $select_log_driver->show($RCI->getprop('log_driver', 'file'));
'_log_dir', 'size' => 30, 'id' => "cfglogdir"));
+$input_logdir = new html_inputfield(['name' => '_log_dir', 'size' => 30, 'id' => 'cfglogdir']);
echo $input_logdir->show($RCI->getprop('log_dir'));
?>
@@ -237,7 +233,7 @@ echo $input_logdir->show($RCI->getprop('log_dir'));
'_syslog_id', 'size' => 30, 'id' => "cfgsyslogid"));
+$input_syslogid = new html_inputfield(['name' => '_syslog_id', 'size' => 30, 'id' => 'cfgsyslogid']);
echo $input_syslogid->show($RCI->getprop('syslog_id', 'roundcube'));
?>
@@ -248,7 +244,7 @@ echo $input_syslogid->show($RCI->getprop('syslog_id', 'roundcube'));
'_syslog_facility', 'id' => "cfgsyslogfacility"));
+$input_syslogfacility = new html_select(['name' => '_syslog_facility', 'id' => 'cfgsyslogfacility']);
$input_syslogfacility->add('user-level messages', LOG_USER);
$input_syslogfacility->add('mail subsystem', LOG_MAIL);
$input_syslogfacility->add('local level 0', LOG_LOCAL0);
@@ -265,13 +261,9 @@ echo $input_syslogfacility->show($RCI->getprop('syslog_facility'), LOG_USER);
What ID to use when logging with syslog. Note that this only applies if you are using the 'syslog' log_driver.
-
-
-
-
Database setup
@@ -280,17 +272,17 @@ echo $input_syslogfacility->show($RCI->getprop('syslog_facility'), LOG_USER);
Database settings for read/write operations:
'_dbtype', 'id' => "cfgdbtype"));
+$select_dbtype = new html_select(['name' => '_dbtype', 'id' => 'cfgdbtype']);
foreach ($RCI->supported_dbs as $database => $ext) {
if (extension_loaded($ext)) {
$select_dbtype->add($database, substr($ext, 4));
}
}
-$input_dbhost = new html_inputfield(array('name' => '_dbhost', 'size' => 20, 'id' => "cfgdbhost"));
-$input_dbname = new html_inputfield(array('name' => '_dbname', 'size' => 20, 'id' => "cfgdbname"));
-$input_dbuser = new html_inputfield(array('name' => '_dbuser', 'size' => 20, 'id' => "cfgdbuser"));
-$input_dbpass = new html_inputfield(array('name' => '_dbpass', 'size' => 20, 'id' => "cfgdbpass"));
+$input_dbhost = new html_inputfield(['name' => '_dbhost', 'size' => 20, 'id' => 'cfgdbhos']);
+$input_dbname = new html_inputfield(['name' => '_dbname', 'size' => 20, 'id' => 'cfgdbname']);
+$input_dbuser = new html_inputfield(['name' => '_dbuser', 'size' => 20, 'id' => 'cfgdbuser']);
+$input_dbpass = new html_inputfield(['name' => '_dbpass', 'size' => 20, 'id' => 'cfgdbpass']);
$dsnw = rcube_db::parse_dsn($RCI->getprop('db_dsnw'));
@@ -312,7 +304,7 @@ echo 'Database password (omit for sqlite) ';
'_db_prefix', 'size' => 20, 'id' => "cfgdbprefix"));
+$input_prefix = new html_inputfield(['name' => '_db_prefix', 'size' => 20, 'id' => 'cfgdbprefix']);
echo $input_prefix->show($RCI->getprop('db_prefix'));
?>
@@ -332,18 +324,20 @@ echo $input_prefix->show($RCI->getprop('db_prefix'));
'_default_host[]', 'size' => 30));
+$text_imaphost = new html_inputfield(['name' => '_default_host[]', 'size' => 30]);
$default_hosts = $RCI->get_hostlist();
-if (empty($default_hosts))
- $default_hosts = array('');
+if (empty($default_hosts)) {
+ $default_hosts = [''];
+}
$i = 0;
foreach ($default_hosts as $host) {
- echo '
' . $text_imaphost->show($host);
- if ($i++ > 0)
- echo '
remove ';
- echo '
';
+ echo '
' . $text_imaphost->show($host);
+ if ($i++ > 0) {
+ echo '
remove ';
+ }
+ echo '
';
}
?>
@@ -357,7 +351,7 @@ foreach ($default_hosts as $host) {
'_default_port', 'size' => 6, 'id' => "cfgimapport"));
+$text_imapport = new html_inputfield(['name' => '_default_port', 'size' => 6, 'id' => 'cfgimapport']);
echo $text_imapport->show($RCI->getprop('default_port'));
?>
@@ -368,7 +362,7 @@ echo $text_imapport->show($RCI->getprop('default_port'));
'_username_domain', 'size' => 30, 'id' => "cfguserdomain"));
+$text_userdomain = new html_inputfield(['name' => '_username_domain', 'size' => 30, 'id' => 'cfguserdomain']);
echo $text_userdomain->show($RCI->getprop('username_domain'));
?>
@@ -381,8 +375,8 @@ echo $text_userdomain->show($RCI->getprop('username_domain'));
'_auto_create_user', 'id' => "cfgautocreate"));
-echo $check_autocreate->show(intval($RCI->getprop('auto_create_user')), array('value' => 1));
+$check_autocreate = new html_checkbox(['name' => '_auto_create_user', 'id' => 'cfgautocreate']);
+echo $check_autocreate->show(intval($RCI->getprop('auto_create_user')), ['value' => 1]);
?>
Automatically create a new Roundcube user when log-in the first time
@@ -398,7 +392,7 @@ what means that you have to create those records manually or disable this option
'_sent_mbox', 'size' => 20, 'id' => "cfgsentmbox"));
+$text_sentmbox = new html_inputfield(['name' => '_sent_mbox', 'size' => 20, 'id' => 'cfgsentmbox']);
echo $text_sentmbox->show($RCI->getprop('sent_mbox'));
?>
@@ -411,7 +405,7 @@ echo $text_sentmbox->show($RCI->getprop('sent_mbox'));
'_trash_mbox', 'size' => 20, 'id' => "cfgtrashmbox"));
+$text_trashmbox = new html_inputfield(['name' => '_trash_mbox', 'size' => 20, 'id' => 'cfgtrashmbox']);
echo $text_trashmbox->show($RCI->getprop('trash_mbox'));
?>
@@ -424,7 +418,7 @@ echo $text_trashmbox->show($RCI->getprop('trash_mbox'));
'_drafts_mbox', 'size' => 20, 'id' => "cfgdraftsmbox"));
+$text_draftsmbox = new html_inputfield(['name' => '_drafts_mbox', 'size' => 20, 'id' => 'cfgdraftsmbox']);
echo $text_draftsmbox->show($RCI->getprop('drafts_mbox'));
?>
@@ -437,7 +431,7 @@ echo $text_draftsmbox->show($RCI->getprop('drafts_mbox'));
'_junk_mbox', 'size' => 20, 'id' => "cfgjunkmbox"));
+$text_junkmbox = new html_inputfield(['name' => '_junk_mbox', 'size' => 20, 'id' => 'cfgjunkmbox']);
echo $text_junkmbox->show($RCI->getprop('junk_mbox'));
?>
@@ -450,7 +444,6 @@ echo $text_junkmbox->show($RCI->getprop('junk_mbox'));
-
SMTP Settings
@@ -458,7 +451,7 @@ echo $text_junkmbox->show($RCI->getprop('junk_mbox'));
'_smtp_server', 'size' => 30, 'id' => "cfgsmtphost"));
+$text_smtphost = new html_inputfield(['name' => '_smtp_server', 'size' => 30, 'id' => 'cfgsmtphost']);
echo $text_smtphost->show($RCI->getprop('smtp_server', 'localhost'));
?>
@@ -471,7 +464,7 @@ echo $text_smtphost->show($RCI->getprop('smtp_server', 'localhost'));
'_smtp_port', 'size' => 6, 'id' => "cfgsmtpport"));
+$text_smtpport = new html_inputfield(['name' => '_smtp_port', 'size' => 6, 'id' => 'cfgsmtpport']);
echo $text_smtpport->show($RCI->getprop('smtp_port'));
?>
@@ -482,8 +475,8 @@ echo $text_smtpport->show($RCI->getprop('smtp_port'));
'_smtp_user', 'size' => 20, 'id' => "cfgsmtpuser"));
-$text_smtppass = new html_inputfield(array('name' => '_smtp_pass', 'size' => 20, 'id' => "cfgsmtppass"));
+$text_smtpuser = new html_inputfield(['name' => '_smtp_user', 'size' => 20, 'id' => 'cfgsmtpuser']);
+$text_smtppass = new html_inputfield(['name' => '_smtp_pass', 'size' => 20, 'id' => 'cfgsmtppass']);
echo $text_smtpuser->show($RCI->getprop('smtp_user'));
echo $text_smtppass->show($RCI->getprop('smtp_pass'));
@@ -492,32 +485,20 @@ echo $text_smtppass->show($RCI->getprop('smtp_pass'));
'_smtp_user_u', 'id' => "cfgsmtpuseru"));
-echo $check_smtpuser->show($RCI->getprop('smtp_user') == '%u' || $_POST['_smtp_user_u'] ? 1 : 0, array('value' => 1));
+$check_smtpuser = new html_checkbox(['name' => '_smtp_user_u', 'id' => 'cfgsmtpuseru']);
+echo $check_smtpuser->show($RCI->getprop('smtp_user') == '%u' || !empty($_POST['_smtp_user_u']) ? 1 : 0, ['value' => 1]);
?>
Use the current IMAP username and password for SMTP authentication
-
+
smtp_log
'_smtp_log', 'id' => "cfgsmtplog"));
-echo $check_smtplog->show(intval($RCI->getprop('smtp_log')), array('value' => 1));
+$check_smtplog = new html_checkbox(['name' => '_smtp_log', 'id' => 'cfgsmtplog']);
+echo $check_smtplog->show(intval($RCI->getprop('smtp_log')), ['value' => 1]);
?>
Log sent messages in {log_dir}/sendmail or to syslog.
@@ -535,7 +516,7 @@ echo $check_smtplog->show(intval($RCI->getprop('smtp_log')), array('value' => 1)
'_language', 'size' => 6, 'id' => "cfglocale"));
+$input_locale = new html_inputfield(['name' => '_language', 'size' => 6, 'id' => 'cfglocale']);
echo $input_locale->show($RCI->getprop('language'));
?>
@@ -547,7 +528,7 @@ echo $input_locale->show($RCI->getprop('language'));
'_skin', 'id' => "cfgskin"));
+$input_skin = new html_select(['name' => '_skin', 'id' => 'cfgskin']);
$input_skin->add($RCI->list_skins());
echo $input_skin->show($RCI->getprop('skin'));
@@ -563,7 +544,7 @@ $pagesize = $RCI->getprop('mail_pagesize');
if (!$pagesize) {
$pagesize = $RCI->getprop('pagesize');
}
-$input_pagesize = new html_inputfield(array('name' => '_mail_pagesize', 'size' => 6, 'id' => "cfgmailpagesize"));
+$input_pagesize = new html_inputfield(['name' => '_mail_pagesize', 'size' => 6, 'id' => 'cfgmailpagesize']);
echo $input_pagesize->show($pagesize);
?>
@@ -578,7 +559,7 @@ $pagesize = $RCI->getprop('addressbook_pagesize');
if (!$pagesize) {
$pagesize = $RCI->getprop('pagesize');
}
-$input_pagesize = new html_inputfield(array('name' => '_addressbook_pagesize', 'size' => 6, 'id' => "cfgabookpagesize"));
+$input_pagesize = new html_inputfield(['name' => '_addressbook_pagesize', 'size' => 6, 'id' => 'cfgabookpagesize']);
echo $input_pagesize->show($pagesize);
?>
@@ -589,7 +570,7 @@ echo $input_pagesize->show($pagesize);
'_prefer_html', 'id' => "cfghtmlview", 'value' => 1));
+$check_htmlview = new html_checkbox(['name' => '_prefer_html', 'id' => 'cfghtmlview', 'value' => 1]);
echo $check_htmlview->show(intval($RCI->getprop('prefer_html')));
?>
@@ -601,7 +582,7 @@ echo $check_htmlview->show(intval($RCI->getprop('prefer_html')));
Compose HTML formatted messages
'_htmleditor', 'id' => "cfghtmlcompose"));
+$select_htmlcomp = new html_select(['name' => '_htmleditor', 'id' => 'cfghtmlcompose']);
$select_htmlcomp->add('never', 0);
$select_htmlcomp->add('always', 1);
$select_htmlcomp->add('on reply to HTML message only', 2);
@@ -615,10 +596,11 @@ echo $select_htmlcomp->show(intval($RCI->getprop('htmleditor')));
Save compose message every
'_draft_autosave', 'id' => 'cfgautosave'));
+$select_autosave = new html_select(['name' => '_draft_autosave', 'id' => 'cfgautosave']);
$select_autosave->add('never', 0);
-foreach (array(1, 3, 5, 10) as $i => $min)
- $select_autosave->add("$min min", $min*60);
+foreach ([1, 3, 5, 10] as $i => $min) {
+ $select_autosave->add("$min min", $min * 60);
+}
echo $select_autosave->show(intval($RCI->getprop('draft_autosave')));
@@ -629,15 +611,15 @@ echo $select_autosave->show(intval($RCI->getprop('draft_autosave')));
'ask the user',
1 => 'send automatically',
3 => 'send receipt to user contacts, otherwise ask the user',
4 => 'send receipt to user contacts, otherwise ignore',
2 => 'ignore',
-);
+];
-$select_mdnreq = new html_select(array('name' => '_mdn_requests', 'id' => "cfgmdnreq"));
+$select_mdnreq = new html_select(['name' => '_mdn_requests', 'id' => 'cfgmdnreq']);
$select_mdnreq->add(array_values($mdn_opts), array_keys($mdn_opts));
echo $select_mdnreq->show(intval($RCI->getprop('mdn_requests')));
@@ -649,7 +631,7 @@ echo $select_mdnreq->show(intval($RCI->getprop('mdn_requests')));
'_mime_param_folding', 'id' => "cfgmimeparamfolding"));
+$select_param_folding = new html_select(['name' => '_mime_param_folding', 'id' => 'cfgmimeparamfolding']);
$select_param_folding->add('Full RFC 2231 (Roundcube, Thunderbird)', '0');
$select_param_folding->add('RFC 2047/2231 (MS Outlook, OE)', '1');
$select_param_folding->add('Full RFC 2047 (deprecated)', '2');
@@ -665,7 +647,6 @@ echo $select_param_folding->show(strval($RCI->getprop('mime_param_folding')));
* These settings are defaults for the user preferences
-
Plugins
@@ -673,7 +654,7 @@ echo $select_param_folding->show(strval($RCI->getprop('mime_param_folding')));
list_plugins();
foreach ($plugins as $p) {
- $p_check = new html_checkbox(array('name' => '_plugins_'.$p['name'], 'id' => 'cfgplugin_'.$p['name'], 'value' => $p['name']));
+ $p_check = new html_checkbox(['name' => '_plugins_'.$p['name'], 'id' => 'cfgplugin_'.$p['name'], 'value' => $p['name']]);
echo '';
echo $p_check->show($p['enabled'] ? $p['name'] : 0);
echo ' ' . $p['name'] . ' ';
diff --git a/installer/index.php b/installer/index.php
index e17aa8dee..3fe302672 100644
--- a/installer/index.php
+++ b/installer/index.php
@@ -42,53 +42,56 @@ define('INSTALL_PATH', realpath(__DIR__ . '/../').'/');
require INSTALL_PATH . 'program/include/iniset.php';
-if (function_exists('session_start'))
- session_start();
+if (function_exists('session_start')) {
+ session_start();
+}
$RCI = rcmail_install::get_instance();
$RCI->load_config();
if (isset($_GET['_getconfig'])) {
- $filename = 'config.inc.php';
- if (!empty($_SESSION['config']) && $_GET['_getconfig'] == 2) {
- $path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $filename;
- @unlink($path);
- file_put_contents($path, $_SESSION['config']);
- exit;
- }
- else if (!empty($_SESSION['config'])) {
- header('Content-type: text/plain');
- header('Content-Disposition: attachment; filename="'.$filename.'"');
- echo $_SESSION['config'];
- exit;
- }
- else {
+ $filename = 'config.inc.php';
+ if (!empty($_SESSION['config']) && $_GET['_getconfig'] == 2) {
+ $path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $filename;
+ @unlink($path);
+ file_put_contents($path, $_SESSION['config']);
+ exit;
+ }
+
+ if (!empty($_SESSION['config'])) {
+ header('Content-type: text/plain');
+ header('Content-Disposition: attachment; filename="'.$filename.'"');
+ echo $_SESSION['config'];
+ exit;
+ }
+
header('HTTP/1.0 404 Not found');
die("The requested configuration was not found. Please run the installer from the beginning.");
- }
}
-if ($RCI->configured && ($RCI->getprop('enable_installer') || $_SESSION['allowinstaller']) &&
- !empty($_GET['_mergeconfig'])) {
- $filename = 'config.inc.php';
+if (
+ $RCI->configured
+ && ($RCI->getprop('enable_installer') || $_SESSION['allowinstaller']) &&
+ !empty($_GET['_mergeconfig'])
+) {
+ $filename = 'config.inc.php';
- header('Content-type: text/plain');
- header('Content-Disposition: attachment; filename="'.$filename.'"');
+ header('Content-type: text/plain');
+ header('Content-Disposition: attachment; filename="'.$filename.'"');
- $RCI->merge_config();
- echo $RCI->create_config();
- exit;
+ $RCI->merge_config();
+ echo $RCI->create_config();
+ exit;
}
// go to 'check env' step if we have a local configuration
if ($RCI->configured && empty($_REQUEST['_step'])) {
- header("Location: ./?_step=1");
- exit;
+ header("Location: ./?_step=1");
+ exit;
}
?>
-
+
Roundcube Webmail Installer
@@ -113,22 +116,23 @@ if ($RCI->configured && empty($_REQUEST['_step'])) {
configured && !$RCI->getprop('enable_installer') && !$_SESSION['allowinstaller']) {
+// exit if installation is complete
+if ($RCI->configured && !$RCI->getprop('enable_installer') && empty($_SESSION['allowinstaller'])) {
// header("HTTP/1.0 404 Not Found");
if ($RCI->configured && $RCI->legacy_config) {
- echo 'Your configuration needs to be migrated! ';
- echo 'We changed the configuration files structure and your installation needs to be updated accordingly.
';
- echo 'Please run the bin/update.sh script from the command line or set
$rcube_config[\'enable_installer\'] = true;
';
- echo ' in your RCUBE_CONFIG_DIR/main.inc.php to let the installer help you migrating it.';
+ echo 'Your configuration needs to be migrated! ';
+ echo 'We changed the configuration files structure and your installation needs to be updated accordingly.
';
+ echo 'Please run the bin/update.sh script from the command line or set
$rcube_config[\'enable_installer\'] = true;
';
+ echo ' in your RCUBE_CONFIG_DIR/main.inc.php to let the installer help you migrating it.';
}
else {
- echo 'The installer is disabled! ';
- echo 'To enable it again, set $config[\'enable_installer\'] = true; in RCUBE_CONFIG_DIR/config.inc.php
';
+ echo 'The installer is disabled! ';
+ echo 'To enable it again, set $config[\'enable_installer\'] = true; in RCUBE_CONFIG_DIR/config.inc.php
';
}
+
echo ' ';
exit;
- }
+}
?>
@@ -136,21 +140,21 @@ if ($RCI->configured && empty($_REQUEST['_step'])) {
'./check.php',
2 => './config.php',
3 => './test.php',
- );
+];
- if (!in_array($RCI->step, array_keys($include_steps))) {
+if (!in_array($RCI->step, array_keys($include_steps))) {
$RCI->step = 1;
- }
+}
- foreach (array('Check environment', 'Create config', 'Test config') as $i => $item) {
+foreach (['Check environment', 'Create config', 'Test config'] as $i => $item) {
$j = $i + 1;
$link = ($RCI->step >= $j || $RCI->configured) ? '' . rcube::Q($item) . ' ' : rcube::Q($item);
printf('%s ', $j+1, $RCI->step > $j ? ' passed' : ($RCI->step == $j ? ' current' : ''), $link);
- }
+}
?>
@@ -162,7 +166,7 @@ include $include_steps[$RCI->step];