Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/roundcube/roundcubemail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2020-12-13 12:21:52 +0300
committerAleksander Machniak <alec@alec.pl>2020-12-13 12:21:52 +0300
commit12547ccf014969d1069dbea4b89985dffa70df41 (patch)
treea4cbb605a2c7a88e20245bf583e0f4016eaa0d23 /installer
parent61a5ade87230bf59549730f5e464e297353385c9 (diff)
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.
Diffstat (limited to 'installer')
-rw-r--r--installer/check.php67
-rw-r--r--installer/config.php193
-rw-r--r--installer/index.php94
-rw-r--r--installer/test.php323
4 files changed, 333 insertions, 344 deletions
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.");
}
-?>
-<form action="index.php" method="get">
-<?php
-
-$required_php_exts = array(
+$required_php_exts = [
'PCRE' => 'pcre',
'DOM' => 'dom',
'Session' => 'session',
'XML' => 'xml',
+ 'Intl' => 'intl',
'JSON' => 'json',
'PDO' => 'PDO',
'Multibyte' => 'mbstring',
'OpenSSL' => 'openssl',
'Filter' => 'filter',
'Ctype' => 'ctype',
-);
+];
-$optional_php_exts = array(
+$optional_php_exts = [
'cURL' => 'curl',
'FileInfo' => 'fileinfo',
- 'Intl' => 'intl',
'Exif' => 'exif',
'LDAP' => 'ldap',
'GD' => 'gd',
'Imagick' => 'imagick',
'Zip' => 'zip',
-);
+];
-$required_libs = array(
+$required_libs = [
'PEAR' => 'pear.php.net',
'Auth_SASL' => 'pear.php.net',
'Net_SMTP' => 'pear.php.net',
- 'Net_IDNA2' => 'pear.php.net',
'Mail_mime' => 'pear.php.net',
'GuzzleHttp\Client' => 'github.com/guzzle/guzzle',
-);
+];
-$optional_libs = array(
+$optional_libs = [
'Net_LDAP3' => 'git.kolab.org',
-);
+];
-$ini_checks = array(
- 'file_uploads' => 1,
- 'session.auto_start' => 0,
- 'mbstring.func_overload' => 0,
- 'suhosin.session.encrypt' => 0,
-);
+$ini_checks = [
+ 'file_uploads' => 1,
+ 'session.auto_start' => 0,
+ 'mbstring.func_overload' => 0,
+ 'suhosin.session.encrypt' => 0,
+];
-$optional_checks = array(
- 'date.timezone' => '-VALID-',
-);
+$optional_checks = [
+ 'date.timezone' => '-VALID-',
+];
-$source_urls = array(
+$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',
@@ -99,10 +94,13 @@ $source_urls = array(
'PEAR' => 'https://pear.php.net',
'Net_SMTP' => 'https://pear.php.net/package/Net_SMTP',
'Mail_mime' => 'https://pear.php.net/package/Mail_mime',
- 'Net_IDNA2' => 'https://pear.php.net/package/Net_IDNA2',
'Net_LDAP3' => 'https://git.kolab.org/diffusion/PNL',
-);
+];
+
+?>
+<form action="index.php" method="get">
+<?php
echo '<input type="hidden" name="_step" value="' . ($RCI->configured ? 3 : 2) . '" />';
?>
@@ -112,7 +110,8 @@ echo '<input type="hidden" name="_step" value="' . ($RCI->configured ? 3 : 2) .
define('MIN_PHP_VERSION', '5.5.0');
if (version_compare(PHP_VERSION, MIN_PHP_VERSION, '>=')) {
$RCI->pass('Version', 'PHP ' . PHP_VERSION . ' detected');
-} else {
+}
+else {
$RCI->fail('Version', 'PHP Version ' . MIN_PHP_VERSION . ' or greater is required ' . PHP_VERSION . ' detected');
}
?>
@@ -124,11 +123,12 @@ if (version_compare(PHP_VERSION, MIN_PHP_VERSION, '>=')) {
// get extensions location
$ext_dir = ini_get('extension_dir');
-$prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';
+$prefix = PHP_SHLIB_SUFFIX === 'dll' ? 'php_' : '';
foreach ($required_php_exts as $name => $ext) {
if (extension_loaded($ext)) {
$RCI->pass($name);
- } else {
+ }
+ else {
$_ext = $ext_dir . '/' . $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
$msg = @is_readable($_ext) ? 'Could be loaded. Please add in php.ini' : '';
$RCI->fail($name, $msg, $source_urls[$name]);
@@ -155,13 +155,12 @@ foreach ($optional_php_exts as $name => $ext) {
?>
-
<h3>Checking available databases</h3>
<p class="hint">Check which of the supported extensions are installed. At least one of them is required.</p>
<?php
-$prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';
+$prefix = PHP_SHLIB_SUFFIX === 'dll' ? 'php_' : '';
foreach ($RCI->supported_dbs as $database => $ext) {
if (extension_loaded($ext)) {
$RCI->pass($database);
@@ -180,7 +179,6 @@ if (empty($found_db_driver)) {
?>
-
<h3>Check for required 3rd party libs</h3>
<p class="hint">This also checks if the include path is set correctly.</p>
@@ -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 '<br />';
@@ -275,7 +274,7 @@ foreach ($optional_checks as $var => $val) {
<?php
if ($RCI->failures) {
- echo '<p class="warning">Sorry but your webserver does not meet the requirements for Roundcube!<br />
+ echo '<p class="warning">Sorry but your webserver does not meet the requirements for Roundcube!<br />
Please install the missing modules or fix the php.ini settings according to the above check results.<br />
Hint: only checks showing <span class="fail">NOT OK</span> need to be fixed.</p>';
}
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 '<p class="notice">The config file was saved successfully into <tt>'.RCMAIL_CONFIG_DIR.'</tt> directory of your Roundcube installation.';
+ echo '<p class="notice">The config file was saved successfully into'
+ . ' <tt>'.RCMAIL_CONFIG_DIR.'</tt> directory of your Roundcube installation.';
if ($RCI->legacy_config) {
- echo '<br/><br/>Afterwards, please <b>remove</b> the old configuration files <tt>main.inc.php</tt> and <tt>db.inc.php</tt> from the config directory.';
+ echo '<br/><br/>Afterwards, please <b>remove</b> the old configuration files'
+ . ' <tt>main.inc.php</tt> and <tt>db.inc.php</tt> from the config directory.';
}
echo '</p>';
@@ -60,12 +62,13 @@ if (!empty($_POST['submit'])) {
echo $save_button;
if ($RCI->legacy_config) {
- echo '<br/><br/>Afterwards, please <b>remove</b> the old configuration files <tt>main.inc.php</tt> and <tt>db.inc.php</tt> from the config directory.';
+ echo '<br/><br/>Afterwards, please <b>remove</b> the old configuration files'
+ . ' <tt>main.inc.php</tt> and <tt>db.inc.php</tt> from the config directory.';
}
echo '</p>';
- $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'])) {
<dd>
<?php
-$input_prodname = new html_inputfield(array('name' => '_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'));
<dd>
<?php
-$input_support = new html_inputfield(array('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'));
<p class="hint">Enter an absolute URL (including http://) to a support page/form or a mailto: link.</p>
</dd>
-<dt class="propname">skin_logo</dt>
-<dd>
-<?php
-
-$input_skin = new html_inputfield(array('name' => '_skin_logo', 'size' => 50, 'id' => "cfgskinlogo"));
-echo $input_skin->show($RCI->getprop('skin_logo'));
-
-?>
-<div>Custom image to display instead of the Roundcube logo.</div>
-<p class="hint">Enter a URL relative to the document root of this Roundcube installation.</p>
-</dd>
-
<dt class="propname">temp_dir</dt>
<dd>
<?php
-$input_tempdir = new html_inputfield(array('name' => '_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'));
<dd>
<?php
-$input_deskey = new html_inputfield(array('name' => '_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'));
<dd>
<?php
-$check_ipcheck = new html_checkbox(array('name' => '_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)
<p class="hint">This increases security but can cause sudden logouts when someone uses a proxy with changing IPs.</p>
</dd>
-
<dt class="propname">enable_spellcheck</dt>
<dd>
<?php
-$check_spell = new html_checkbox(array('name' => '_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]);
?>
+
<label for="cfgspellcheck">Make use of the spell checker</label><br />
</dd>
<dt class="propname">spellcheck_engine</dt>
<dd>
+
<?php
-$select_spell = new html_select(array('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 = 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');
-
?>
+
<label for="cfgspellcheckengine">Which spell checker to use</label><br />
<p class="hint">Googie implies that the message content will be sent to external server to check the spelling.</p>
@@ -188,9 +182,10 @@ echo $select_spell->show($RCI->is_post ? $_POST['_spellcheck_engine'] : 'pspell'
<dt class="propname">identities_level</dt>
<dd>
+
<?php
-$input_ilevel = new html_select(array('name' => '_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);
?>
+
<div>Level of identities access</div>
<p class="hint">Defines what users can do with their identities.</p>
</dd>
@@ -212,13 +208,13 @@ echo $input_ilevel->show($RCI->getprop('identities_level'), 0);
<dt class="propname">log_driver</dt>
<dd>
-<?php
-$select_log_driver = new html_select(array('name' => '_log_driver', 'id' => "cfglogdriver"));
-$select_log_driver->add(array('file', 'syslog', 'stdout'), array('file', 'syslog', 'stdout'));
+<?php
+$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'));
-
?>
+
<div>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.</div>
</dd>
@@ -226,7 +222,7 @@ echo $select_log_driver->show($RCI->getprop('log_driver', 'file'));
<dd>
<?php
-$input_logdir = new html_inputfield(array('name' => '_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'));
<dd>
<?php
-$input_syslogid = new html_inputfield(array('name' => '_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'));
<dd>
<?php
-$input_syslogfacility = new html_select(array('name' => '_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);
<div>What ID to use when logging with syslog. Note that this only applies if you are using the 'syslog' log_driver.</div>
</dd>
-
-
-
</dl>
</fieldset>
-
<fieldset>
<legend>Database setup</legend>
<dl class="configblock" id="cgfblockdb">
@@ -280,17 +272,17 @@ echo $input_syslogfacility->show($RCI->getprop('syslog_facility'), LOG_USER);
<p>Database settings for read/write operations:</p>
<?php
-$select_dbtype = new html_select(array('name' => '_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 '<label for="cfgdbpass">Database password (omit for sqlite)</label><br />';
<dd>
<?php
-$input_prefix = new html_inputfield(array('name' => '_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'));
<div id="defaulthostlist">
<?php
-$text_imaphost = new html_inputfield(array('name' => '_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 '<div id="defaulthostentry'.$i.'">' . $text_imaphost->show($host);
- if ($i++ > 0)
- echo '<a href="#" onclick="removehostfield(this.parentNode);return false" class="removelink" title="Remove this entry">remove</a>';
- echo '</div>';
+ echo '<div id="defaulthostentry'.$i.'">' . $text_imaphost->show($host);
+ if ($i++ > 0) {
+ echo '<a href="#" onclick="removehostfield(this.parentNode);return false" class="removelink" title="Remove this entry">remove</a>';
+ }
+ echo '</div>';
}
?>
@@ -357,7 +351,7 @@ foreach ($default_hosts as $host) {
<dd>
<?php
-$text_imapport = new html_inputfield(array('name' => '_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'));
<dd>
<?php
-$text_userdomain = new html_inputfield(array('name' => '_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'));
<dd>
<?php
-$check_autocreate = new html_checkbox(array('name' => '_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]);
?>
<label for="cfgautocreate">Automatically create a new Roundcube user when log-in the first time</label><br />
@@ -398,7 +392,7 @@ what means that you have to create those records manually or disable this option
<dd>
<?php
-$text_sentmbox = new html_inputfield(array('name' => '_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'));
<dd>
<?php
-$text_trashmbox = new html_inputfield(array('name' => '_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'));
<dd>
<?php
-$text_draftsmbox = new html_inputfield(array('name' => '_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'));
<dd>
<?php
-$text_junkmbox = new html_inputfield(array('name' => '_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'));
</dl>
</fieldset>
-
<fieldset>
<legend>SMTP Settings</legend>
<dl class="configblock" id="cgfblocksmtp">
@@ -458,7 +451,7 @@ echo $text_junkmbox->show($RCI->getprop('junk_mbox'));
<dd>
<?php
-$text_smtphost = new html_inputfield(array('name' => '_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'));
<dd>
<?php
-$text_smtpport = new html_inputfield(array('name' => '_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'));
<dd>
<?php
-$text_smtpuser = new html_inputfield(array('name' => '_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'));
<p>
<?php
-$check_smtpuser = new html_checkbox(array('name' => '_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]);
?>
<label for="cfgsmtpuseru">Use the current IMAP username and password for SMTP authentication</label>
</p>
</dd>
-<!--
-<dt class="propname">smtp_auth_type</dt>
-<dd>
-<?php
-/*
-$select_smtpauth = new html_select(array('name' => '_smtp_auth_type', 'id' => "cfgsmtpauth"));
-$select_smtpauth->add(array('(auto)', 'PLAIN', 'DIGEST-MD5', 'CRAM-MD5', 'LOGIN'), array('0', 'PLAIN', 'DIGEST-MD5', 'CRAM-MD5', 'LOGIN'));
-echo $select_smtpauth->show(intval($RCI->getprop('smtp_auth_type')));
-*/
-?>
-<div>Method to authenticate at the SMTP server. Choose (auto) if you don't know what this is</div>
-</dd>
--->
+
<dt class="propname">smtp_log</dt>
<dd>
<?php
-$check_smtplog = new html_checkbox(array('name' => '_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]);
?>
<label for="cfgsmtplog">Log sent messages in <tt>{log_dir}/sendmail</tt> or to syslog.</label><br />
@@ -535,7 +516,7 @@ echo $check_smtplog->show(intval($RCI->getprop('smtp_log')), array('value' => 1)
<dd>
<?php
-$input_locale = new html_inputfield(array('name' => '_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'));
<dd>
<?php
-$input_skin = new html_select(array('name' => '_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);
<dd>
<?php
-$check_htmlview = new html_checkbox(array('name' => '_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')));
<label for="cfghtmlcompose">Compose HTML formatted messages</label>
<?php
-$select_htmlcomp = new html_select(array('name' => '_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')));
<label for="cfgautosave">Save compose message every</label>
<?php
-$select_autosave = new html_select(array('name' => '_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')));
<dd>
<?php
-$mdn_opts = array(
+$mdn_opts = [
0 => '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')));
<dd>
<?php
-$select_param_folding = new html_select(array('name' => '_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')));
<p class="hint"><span class="userconf">*</span>&nbsp; These settings are defaults for the user preferences</p>
</fieldset>
-
<fieldset>
<legend>Plugins</legend>
<dl class="configblock" id="cgfblockdisplay">
@@ -673,7 +654,7 @@ echo $select_param_folding->show(strval($RCI->getprop('mime_param_folding')));
<?php
$plugins = $RCI->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 '<dt class="propname"><label>';
echo $p_check->show($p['enabled'] ? $p['name'] : 0);
echo '&nbsp;' . $p['name'] . '</label></dt><dd>';
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;
}
?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Roundcube Webmail Installer</title>
@@ -113,22 +116,23 @@ if ($RCI->configured && empty($_REQUEST['_step'])) {
<?php
- // exit if installation is complete
- if ($RCI->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 '<h2 class="error">Your configuration needs to be migrated!</h2>';
- echo '<p>We changed the configuration files structure and your installation needs to be updated accordingly.</p>';
- echo '<p>Please run the <tt>bin/update.sh</tt> script from the command line or set <p>&nbsp; <tt>$rcube_config[\'enable_installer\'] = true;</tt></p>';
- echo ' in your RCUBE_CONFIG_DIR/main.inc.php to let the installer help you migrating it.</p>';
+ echo '<h2 class="error">Your configuration needs to be migrated!</h2>';
+ echo '<p>We changed the configuration files structure and your installation needs to be updated accordingly.</p>';
+ echo '<p>Please run the <tt>bin/update.sh</tt> script from the command line or set <p>&nbsp; <tt>$rcube_config[\'enable_installer\'] = true;</tt></p>';
+ echo ' in your RCUBE_CONFIG_DIR/main.inc.php to let the installer help you migrating it.</p>';
}
else {
- echo '<h2 class="error">The installer is disabled!</h2>';
- echo '<p>To enable it again, set <tt>$config[\'enable_installer\'] = true;</tt> in RCUBE_CONFIG_DIR/config.inc.php</p>';
+ echo '<h2 class="error">The installer is disabled!</h2>';
+ echo '<p>To enable it again, set <tt>$config[\'enable_installer\'] = true;</tt> in RCUBE_CONFIG_DIR/config.inc.php</p>';
}
+
echo '</div></body></html>';
exit;
- }
+}
?>
@@ -136,21 +140,21 @@ if ($RCI->configured && empty($_REQUEST['_step'])) {
<ol id="progress">
<?php
- $include_steps = array(
+$include_steps = [
1 => './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) ? '<a href="./index.php?_step='.$j.'">' . rcube::Q($item) . '</a>' : rcube::Q($item);
printf('<li class="step%d%s">%s</li>', $j+1, $RCI->step > $j ? ' passed' : ($RCI->step == $j ? ' current' : ''), $link);
- }
+}
?>
</ol>
@@ -162,7 +166,7 @@ include $include_steps[$RCI->step];
</div>
<div id="footer">
- Installer by the Roundcube Dev Team. Copyright &copy; 2008-2012 – Published under the GNU Public License;&nbsp;
+ Installer by the Roundcube Dev Team. Copyright &copy; 2008-2020 – Published under the GNU Public License;&nbsp;
Icons by <a href="http://famfamfam.com">famfamfam</a>
</div>
</body>
diff --git a/installer/test.php b/installer/test.php
index 0566fa7a6..6594d978c 100644
--- a/installer/test.php
+++ b/installer/test.php
@@ -24,73 +24,74 @@ if (!class_exists('rcmail_install', false) || !isset($RCI)) {
<?php
if ($read_config = is_readable(RCUBE_CONFIG_DIR . 'defaults.inc.php')) {
- $config = $RCI->load_config_file(RCUBE_CONFIG_DIR . 'defaults.inc.php');
- if (!empty($config)) {
- $RCI->pass('defaults.inc.php');
- }
- else {
- $RCI->fail('defaults.inc.php', 'Syntax error');
- }
+ $config = $RCI->load_config_file(RCUBE_CONFIG_DIR . 'defaults.inc.php');
+ if (!empty($config)) {
+ $RCI->pass('defaults.inc.php');
+ }
+ else {
+ $RCI->fail('defaults.inc.php', 'Syntax error');
+ }
}
else {
- $RCI->fail('defaults.inc.php', 'Unable to read default config file?');
+ $RCI->fail('defaults.inc.php', 'Unable to read default config file?');
}
+
echo '<br />';
if ($read_config = is_readable(RCUBE_CONFIG_DIR . 'config.inc.php')) {
- $config = $RCI->load_config_file(RCUBE_CONFIG_DIR . 'config.inc.php');
- if (!empty($config)) {
- $RCI->pass('config.inc.php');
- }
- else {
- $RCI->fail('config.inc.php', 'Syntax error');
- }
+ $config = $RCI->load_config_file(RCUBE_CONFIG_DIR . 'config.inc.php');
+ if (!empty($config)) {
+ $RCI->pass('config.inc.php');
+ }
+ else {
+ $RCI->fail('config.inc.php', 'Syntax error');
+ }
}
else {
- $RCI->fail('config.inc.php', 'Unable to read file. Did you create the config file?');
+ $RCI->fail('config.inc.php', 'Unable to read file. Did you create the config file?');
}
-echo '<br />';
+echo '<br />';
if ($RCI->configured && ($messages = $RCI->check_config())) {
- if (is_array($messages['replaced'])) {
- echo '<h3 class="warning">Replaced config options</h3>';
- echo '<p class="hint">The following config options have been replaced or renamed. ';
- echo 'Please update them accordingly in your config files.</p>';
-
- echo '<ul class="configwarings">';
- foreach ($messages['replaced'] as $msg) {
- echo html::tag('li', null, html::span('propname', $msg['prop']) .
- ' was replaced by ' . html::span('propname', $msg['replacement']));
+ if (is_array($messages['replaced'])) {
+ echo '<h3 class="warning">Replaced config options</h3>';
+ echo '<p class="hint">The following config options have been replaced or renamed. ';
+ echo 'Please update them accordingly in your config files.</p>';
+
+ echo '<ul class="configwarings">';
+ foreach ($messages['replaced'] as $msg) {
+ echo html::tag('li', null, html::span('propname', $msg['prop']) .
+ ' was replaced by ' . html::span('propname', $msg['replacement']));
+ }
+ echo '</ul>';
}
- echo '</ul>';
- }
- if (is_array($messages['obsolete'])) {
- echo '<h3>Obsolete config options</h3>';
- echo '<p class="hint">You still have some obsolete or inexistent properties set. This isn\'t a problem but should be noticed.</p>';
+ if (is_array($messages['obsolete'])) {
+ echo '<h3>Obsolete config options</h3>';
+ echo '<p class="hint">You still have some obsolete or inexistent properties set. This isn\'t a problem but should be noticed.</p>';
- echo '<ul class="configwarings">';
- foreach ($messages['obsolete'] as $msg) {
- echo html::tag('li', null, html::span('propname', $msg['prop']) . ($msg['name'] ? ':&nbsp;' . $msg['name'] : ''));
+ echo '<ul class="configwarings">';
+ foreach ($messages['obsolete'] as $msg) {
+ echo html::tag('li', null, html::span('propname', $msg['prop']) . ($msg['name'] ? ':&nbsp;' . $msg['name'] : ''));
+ }
+ echo '</ul>';
}
- echo '</ul>';
- }
- echo '<p class="suggestion">OK, lazy people can download the updated config file here: ';
- echo html::a(array('href' => './?_mergeconfig=1'), 'config.inc.php') . ' &nbsp;';
- echo "</p>";
+ echo '<p class="suggestion">OK, lazy people can download the updated config file here: ';
+ echo html::a(['href' => './?_mergeconfig=1'], 'config.inc.php') . ' &nbsp;';
+ echo "</p>";
- if (is_array($messages['dependencies'])) {
- echo '<h3 class="warning">Dependency check failed</h3>';
- echo '<p class="hint">Some of your configuration settings require other options to be configured or additional PHP modules to be installed</p>';
+ if (is_array($messages['dependencies'])) {
+ echo '<h3 class="warning">Dependency check failed</h3>';
+ echo '<p class="hint">Some of your configuration settings require other options to be configured or additional PHP modules to be installed</p>';
- echo '<ul class="configwarings">';
- foreach ($messages['dependencies'] as $msg) {
- echo html::tag('li', null, html::span('propname', $msg['prop']) . ': ' . $msg['explain']);
+ echo '<ul class="configwarings">';
+ foreach ($messages['dependencies'] as $msg) {
+ echo html::tag('li', null, html::span('propname', $msg['prop']) . ': ' . $msg['explain']);
+ }
+ echo '</ul>';
}
- echo '</ul>';
- }
}
?>
@@ -99,9 +100,10 @@ if ($RCI->configured && ($messages = $RCI->check_config())) {
<p>Roundcube may need to write/save files into these directories</p>
<?php
-$dirs[] = $RCI->config['temp_dir'] ? $RCI->config['temp_dir'] : 'temp';
-if ($RCI->config['log_driver'] != 'syslog')
+$dirs[] = !empty($RCI->config['temp_dir']) ? $RCI->config['temp_dir'] : 'temp';
+if ($RCI->config['log_driver'] != 'syslog') {
$dirs[] = $RCI->config['log_dir'] ? $RCI->config['log_dir'] : 'logs';
+}
foreach ($dirs as $dir) {
$dirpath = rcube_utils::is_absolute_path($dir) ? $dir : INSTALL_PATH . $dir;
@@ -151,14 +153,14 @@ else {
}
// initialize db with schema found in /SQL/*
-if ($db_working && $_POST['initdb']) {
+if ($db_working && !empty($_POST['initdb'])) {
if (!$RCI->init_db($DB)) {
$db_working = false;
echo '<p class="warning">Please try to inizialize the database manually as described in the INSTALL guide.
Make sure that the configured database extists and that the user as write privileges</p>';
}
}
-else if ($db_working && $_POST['updatedb']) {
+else if ($db_working && !empty($_POST['updatedb'])) {
if (!$RCI->update_db($_POST['version'])) {
echo '<p class="warning">Database schema update failed.</p>';
}
@@ -175,7 +177,7 @@ if ($db_working) {
else if ($err = $RCI->db_schema_check($DB, $update = !empty($_POST['updatedb']))) {
$RCI->fail('DB Schema', "Database schema differs");
echo '<ul style="margin:0"><li>' . join("</li>\n<li>", $err) . "</li></ul>";
- $select = $RCI->versions_select(array('name' => 'version'));
+ $select = $RCI->versions_select(['name' => 'version']);
$select->add('0.9 or newer', '');
echo '<p class="suggestion">You should run the update queries to get the schema fixed.<br/><br/>Version to update from: ' . $select->show('') . '&nbsp;<input type="submit" name="updatedb" value="Update" /></p>';
$db_working = false;
@@ -199,12 +201,12 @@ if ($db_working) {
. " (`sess_id`, `changed`, `ip`, `vars`) VALUES (?, ".$DB->now().", '127.0.0.1', 'foo')", $insert_id);
if ($db_write) {
- $RCI->pass('DB Write');
- $DB->query("DELETE FROM " . $DB->quote_identifier($RCI->config['db_prefix'] . 'session')
- . " WHERE `sess_id` = ?", $insert_id);
+ $RCI->pass('DB Write');
+ $DB->query("DELETE FROM " . $DB->quote_identifier($RCI->config['db_prefix'] . 'session')
+ . " WHERE `sess_id` = ?", $insert_id);
}
else {
- $RCI->fail('DB Write', $RCI->get_error());
+ $RCI->fail('DB Write', $RCI->get_error());
}
echo '<br />';
@@ -237,52 +239,52 @@ if ($db_working) {
<?php
if ($errors = $RCI->check_mime_detection()) {
- $RCI->fail('Fileinfo/mime_content_type configuration');
- if (!empty($RCI->config['mime_magic'])) {
- echo '<p class="hint">Try setting the <tt>mime_magic</tt> config option to <tt>null</tt>.</p>';
- }
- else {
- echo '<p class="hint">Check the <a href="http://www.php.net/manual/en/function.finfo-open.php">Fileinfo functions</a> of your PHP installation.<br/>';
- echo 'The path to the magic.mime file can be set using the <tt>mime_magic</tt> config option in Roundcube.</p>';
- }
+ $RCI->fail('Fileinfo/mime_content_type configuration');
+ if (!empty($RCI->config['mime_magic'])) {
+ echo '<p class="hint">Try setting the <tt>mime_magic</tt> config option to <tt>null</tt>.</p>';
+ }
+ else {
+ echo '<p class="hint">Check the <a href="http://www.php.net/manual/en/function.finfo-open.php">Fileinfo functions</a> of your PHP installation.<br/>';
+ echo 'The path to the magic.mime file can be set using the <tt>mime_magic</tt> config option in Roundcube.</p>';
+ }
}
else {
- $RCI->pass('Fileinfo/mime_content_type configuration');
- echo "<br/>";
+ $RCI->pass('Fileinfo/mime_content_type configuration');
+ echo "<br/>";
}
if ($errors = $RCI->check_mime_extensions()) {
- $RCI->fail('Mimetype to file extension mapping');
- echo '<p class="hint">Please set a valid path to your webserver\'s mime.types file to the <tt>mime_types</tt> config option.<br/>';
- echo 'If you can\'t find such a file, download it from <a href="http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types">svn.apache.org</a>.</p>';
+ $RCI->fail('Mimetype to file extension mapping');
+ echo '<p class="hint">Please set a valid path to your webserver\'s mime.types file to the <tt>mime_types</tt> config option.<br/>';
+ echo 'If you can\'t find such a file, download it from <a href="http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types">svn.apache.org</a>.</p>';
}
else {
- $RCI->pass('Mimetype to file extension mapping');
- echo "<br/>";
+ $RCI->pass('Mimetype to file extension mapping');
+ echo "<br/>";
}
$smtp_hosts = $RCI->get_hostlist('smtp_server');
if (!empty($smtp_hosts)) {
- $smtp_host_field = new html_select(array('name' => '_smtp_host', 'id' => 'smtp_server'));
- $smtp_host_field->add($smtp_hosts);
+ $smtp_host_field = new html_select(['name' => '_smtp_host', 'id' => 'smtp_server']);
+ $smtp_host_field->add($smtp_hosts);
}
else {
- $smtp_host_field = new html_inputfield(array('name' => '_smtp_host', 'id' => 'smtp_server'));
+ $smtp_host_field = new html_inputfield(['name' => '_smtp_host', 'id' => 'smtp_server']);
}
$user = $RCI->getprop('smtp_user', '(none)');
$pass = $RCI->getprop('smtp_pass', '(none)');
if ($user == '%u') {
- $user_field = new html_inputfield(array('name' => '_smtp_user', 'id' => 'smtp_user'));
- $user = $user_field->show($_POST['_smtp_user']);
+ $user_field = new html_inputfield(['name' => '_smtp_user', 'id' => 'smtp_user']);
+ $user = $user_field->show(isset($_POST['_smtp_user']) ? $_POST['_smtp_user'] : '');
}
else {
$user = html::quote($user);
}
if ($pass == '%p') {
- $pass_field = new html_passwordfield(array('name' => '_smtp_pass', 'id' => 'smtp_pass'));
+ $pass_field = new html_passwordfield(['name' => '_smtp_pass', 'id' => 'smtp_pass']);
$pass = $pass_field->show();
}
else {
@@ -298,7 +300,7 @@ else {
<tbody>
<tr>
<td><label for="smtp_server">Server</label></td>
- <td><?php echo $smtp_host_field->show($_POST['_smtp_host']); ?></td>
+ <td><?php echo $smtp_host_field->show(isset($_POST['_smtp_host']) ? $_POST['_smtp_host'] : ''); ?></td>
</tr>
<tr>
<td><label for="smtp_port">Port</label></td>
@@ -318,62 +320,63 @@ else {
<?php
-$from_field = new html_inputfield(array('name' => '_from', 'id' => 'sendmailfrom'));
-$to_field = new html_inputfield(array('name' => '_to', 'id' => 'sendmailto'));
+$from_field = new html_inputfield(['name' => '_from', 'id' => 'sendmailfrom']);
+$to_field = new html_inputfield(['name' => '_to', 'id' => 'sendmailto']);
if (isset($_POST['sendmail'])) {
- echo '<p>Trying to send email...<br />';
+ echo '<p>Trying to send email...<br />';
- $smtp_host = trim($_POST['_smtp_host']);
- $smtp_port = $RCI->getprop('smtp_port');
+ $smtp_host = trim($_POST['_smtp_host']);
+ $smtp_port = $RCI->getprop('smtp_port');
- $from = rcube_utils::idn_to_ascii(trim($_POST['_from']));
- $to = rcube_utils::idn_to_ascii(trim($_POST['_to']));
+ $from = rcube_utils::idn_to_ascii(trim($_POST['_from']));
+ $to = rcube_utils::idn_to_ascii(trim($_POST['_to']));
- if (preg_match('/^' . $RCI->email_pattern . '$/i', $from) &&
- preg_match('/^' . $RCI->email_pattern . '$/i', $to)
- ) {
- $headers = array(
- 'From' => $from,
- 'To' => $to,
- 'Subject' => 'Test message from Roundcube',
- );
+ if (
+ preg_match('/^' . $RCI->email_pattern . '$/i', $from)
+ && preg_match('/^' . $RCI->email_pattern . '$/i', $to)
+ ) {
+ $headers = [
+ 'From' => $from,
+ 'To' => $to,
+ 'Subject' => 'Test message from Roundcube',
+ ];
- $body = 'This is a test to confirm that Roundcube can send email.';
+ $body = 'This is a test to confirm that Roundcube can send email.';
- // send mail using configured SMTP server
- $CONFIG = $RCI->config;
+ // send mail using configured SMTP server
+ $CONFIG = $RCI->config;
- if (!empty($_POST['_smtp_user'])) {
- $CONFIG['smtp_user'] = $_POST['_smtp_user'];
- }
- if (!empty($_POST['_smtp_pass'])) {
- $CONFIG['smtp_pass'] = $_POST['_smtp_pass'];
- }
+ if (!empty($_POST['_smtp_user'])) {
+ $CONFIG['smtp_user'] = $_POST['_smtp_user'];
+ }
+ if (!empty($_POST['_smtp_pass'])) {
+ $CONFIG['smtp_pass'] = $_POST['_smtp_pass'];
+ }
- $mail_object = new Mail_mime();
- $send_headers = $mail_object->headers($headers);
- $head = $mail_object->txtHeaders($send_headers);
+ $mail_object = new Mail_mime();
+ $send_headers = $mail_object->headers($headers);
+ $head = $mail_object->txtHeaders($send_headers);
- $SMTP = new rcube_smtp();
- $SMTP->connect($smtp_host, $smtp_port, $CONFIG['smtp_user'], $CONFIG['smtp_pass']);
+ $SMTP = new rcube_smtp();
+ $SMTP->connect($smtp_host, $smtp_port, $CONFIG['smtp_user'], $CONFIG['smtp_pass']);
- $status = $SMTP->send_mail($headers['From'], $headers['To'], $head, $body);
- $smtp_response = $SMTP->get_response();
+ $status = $SMTP->send_mail($headers['From'], $headers['To'], $head, $body);
+ $smtp_response = $SMTP->get_response();
- if ($status) {
- $RCI->pass('SMTP send');
+ if ($status) {
+ $RCI->pass('SMTP send');
+ }
+ else {
+ $RCI->fail('SMTP send', join('; ', $smtp_response));
+ }
}
else {
- $RCI->fail('SMTP send', join('; ', $smtp_response));
+ $RCI->fail('SMTP send', 'Invalid sender or recipient');
}
- }
- else {
- $RCI->fail('SMTP send', 'Invalid sender or recipient');
- }
- echo '</p>';
+ echo '</p>';
}
?>
@@ -382,11 +385,11 @@ if (isset($_POST['sendmail'])) {
<tbody>
<tr>
<td><label for="sendmailfrom">Sender</label></td>
- <td><?php echo $from_field->show($_POST['_from']); ?></td>
+ <td><?php echo $from_field->show(isset($_POST['_from']) ? $_POST['_from'] : ''); ?></td>
</tr>
<tr>
<td><label for="sendmailto">Recipient</label></td>
- <td><?php echo $to_field->show($_POST['_to']); ?></td>
+ <td><?php echo $to_field->show(isset($_POST['_to']) ? $_POST['_to'] : ''); ?></td>
</tr>
</tbody>
</table>
@@ -400,15 +403,15 @@ if (isset($_POST['sendmail'])) {
$default_hosts = $RCI->get_hostlist();
if (!empty($default_hosts)) {
- $host_field = new html_select(array('name' => '_host', 'id' => 'imaphost'));
- $host_field->add($default_hosts);
+ $host_field = new html_select(['name' => '_host', 'id' => 'imaphost']);
+ $host_field->add($default_hosts);
}
else {
- $host_field = new html_inputfield(array('name' => '_host', 'id' => 'imaphost'));
+ $host_field = new html_inputfield(['name' => '_host', 'id' => 'imaphost']);
}
-$user_field = new html_inputfield(array('name' => '_user', 'id' => 'imapuser'));
-$pass_field = new html_passwordfield(array('name' => '_pass', 'id' => 'imappass'));
+$user_field = new html_inputfield(['name' => '_user', 'id' => 'imapuser']);
+$pass_field = new html_passwordfield(['name' => '_pass', 'id' => 'imappass']);
?>
@@ -416,7 +419,7 @@ $pass_field = new html_passwordfield(array('name' => '_pass', 'id' => 'imappass'
<tbody>
<tr>
<td><label for="imaphost">Server</label></td>
- <td><?php echo $host_field->show($_POST['_host']); ?></td>
+ <td><?php echo $host_field->show(isset($_POST['_host']) ? $_POST['_host'] : ''); ?></td>
</tr>
<tr>
<td>Port</td>
@@ -424,7 +427,7 @@ $pass_field = new html_passwordfield(array('name' => '_pass', 'id' => 'imappass'
</tr>
<tr>
<td><label for="imapuser">Username</label></td>
- <td><?php echo $user_field->show($_POST['_user']); ?></td>
+ <td><?php echo $user_field->show(isset($_POST['_user']) ? $_POST['_user'] : ''); ?></td>
</tr>
<tr>
<td><label for="imappass">Password</label></td>
@@ -437,39 +440,41 @@ $pass_field = new html_passwordfield(array('name' => '_pass', 'id' => 'imappass'
if (isset($_POST['imaptest']) && !empty($_POST['_host']) && !empty($_POST['_user'])) {
- echo '<p>Connecting to ' . rcube::Q($_POST['_host']) . '...<br />';
-
- $imap_host = trim($_POST['_host']);
- $imap_port = $RCI->getprop('default_port');
- $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'], array('ssl','imaps','tls'))) ? $a_host['scheme'] : null;
- if (isset($a_host['port']))
- $imap_port = $a_host['port'];
- else if ($imap_ssl && $imap_ssl != 'tls' && (!$imap_port || $imap_port == 143))
- $imap_port = 993;
- }
-
- $imap_host = rcube_utils::idn_to_ascii($imap_host);
- $imap_user = rcube_utils::idn_to_ascii($_POST['_user']);
-
- $imap = new rcube_imap;
- $imap->set_options(array(
- 'auth_type' => $RCI->getprop('imap_auth_type'),
- 'debug' => $RCI->getprop('imap_debug'),
- 'socket_options' => $RCI->getprop('imap_conn_options'),
- ));
-
- if ($imap->connect($imap_host, $imap_user, $_POST['_pass'], $imap_port, $imap_ssl)) {
- $RCI->pass('IMAP connect', 'SORT capability: ' . ($imap->get_capability('SORT') ? 'yes' : 'no'));
- $imap->close();
- }
- else {
- $RCI->fail('IMAP connect', $RCI->get_error());
- }
+ echo '<p>Connecting to ' . rcube::Q($_POST['_host']) . '...<br />';
+
+ $imap_host = trim($_POST['_host']);
+ $imap_port = $RCI->getprop('default_port');
+ $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;
+ if (isset($a_host['port'])) {
+ $imap_port = $a_host['port'];
+ }
+ else if ($imap_ssl && $imap_ssl != 'tls' && (!$imap_port || $imap_port == 143)) {
+ $imap_port = 993;
+ }
+ }
+
+ $imap_host = rcube_utils::idn_to_ascii($imap_host);
+ $imap_user = rcube_utils::idn_to_ascii($_POST['_user']);
+
+ $imap = new rcube_imap;
+ $imap->set_options([
+ 'auth_type' => $RCI->getprop('imap_auth_type'),
+ 'debug' => $RCI->getprop('imap_debug'),
+ 'socket_options' => $RCI->getprop('imap_conn_options'),
+ ]);
+
+ if ($imap->connect($imap_host, $imap_user, $_POST['_pass'], $imap_port, $imap_ssl)) {
+ $RCI->pass('IMAP connect', 'SORT capability: ' . ($imap->get_capability('SORT') ? 'yes' : 'no'));
+ $imap->close();
+ }
+ else {
+ $RCI->fail('IMAP connect', $RCI->get_error());
+ }
}
?>