Mercurial > hg > rc2
diff installer/test.php @ 8:bf99236cc5cd
try to recover from upgrade fail
author | Charlie Root |
---|---|
date | Sat, 29 Dec 2018 07:07:34 -0500 |
parents | 4681f974d28b |
children |
line wrap: on
line diff
--- a/installer/test.php Sat Dec 29 06:32:49 2018 -0500 +++ b/installer/test.php Sat Dec 29 07:07:34 2018 -0500 @@ -179,7 +179,7 @@ // write test $insert_id = md5(uniqid()); $db_write = $DB->query("INSERT INTO " . $DB->quote_identifier($RCI->config['db_prefix'] . 'session') - . " (`sess_id`, `created`, `ip`, `vars`) VALUES (?, ".$DB->now().", '127.0.0.1', 'foo')", $insert_id); + . " (`sess_id`, `changed`, `ip`, `vars`) VALUES (?, ".$DB->now().", '127.0.0.1', 'foo')", $insert_id); if ($db_write) { $RCI->pass('DB Write'); @@ -246,7 +246,7 @@ <h3>Test SMTP config</h3> <p> -Server: <?php echo rcube_parse_host($RCI->getprop('smtp_server', 'PHP mail()')); ?><br /> +Server: <?php echo rcube_utils::parse_host($RCI->getprop('smtp_server', 'localhost')); ?><br /> Port: <?php echo $RCI->getprop('smtp_port'); ?><br /> <?php @@ -254,7 +254,7 @@ if ($RCI->getprop('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')); $user = $user_field->show($_POST['_smtp_user']); @@ -263,7 +263,7 @@ $pass_field = new html_passwordfield(array('name' => '_smtp_pass')); $pass = $pass_field->show(); } - + echo "User: $user<br />"; echo "Password: $pass<br />"; } @@ -293,42 +293,27 @@ ); $body = 'This is a test to confirm that Roundcube can send email.'; - $smtp_response = array(); // send mail using configured SMTP server - if ($RCI->getprop('smtp_server')) { - $CONFIG = $RCI->config; + $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']; - } - - $mail_object = new Mail_mime(); - $send_headers = $mail_object->headers($headers); - - $SMTP = new rcube_smtp(); - $SMTP->connect(rcube_parse_host($RCI->getprop('smtp_server')), - $RCI->getprop('smtp_port'), $CONFIG['smtp_user'], $CONFIG['smtp_pass']); + if (!empty($_POST['_smtp_user'])) { + $CONFIG['smtp_user'] = $_POST['_smtp_user']; + } + if (!empty($_POST['_smtp_pass'])) { + $CONFIG['smtp_pass'] = $_POST['_smtp_pass']; + } - $status = $SMTP->send_mail($headers['From'], $headers['To'], - ($foo = $mail_object->txtHeaders($send_headers)), $body); + $mail_object = new Mail_mime(); + $send_headers = $mail_object->headers($headers); + $head = $mail_object->txtHeaders($send_headers); - $smtp_response = $SMTP->get_response(); - } - else { // use mail() - $header_str = 'From: ' . $headers['From']; - - if (ini_get('safe_mode')) - $status = mail($headers['To'], $headers['Subject'], $body, $header_str); - else - $status = mail($headers['To'], $headers['Subject'], $body, $header_str, '-f'.$headers['From']); - - if (!$status) - $smtp_response[] = 'Mail delivery with mail() failed. Check your error logs for details'; - } + $SMTP = new rcube_smtp(); + $SMTP->connect(rcube_utils::parse_host($RCI->getprop('smtp_server')), + $RCI->getprop('smtp_port'), $CONFIG['smtp_user'], $CONFIG['smtp_pass']); + + $status = $SMTP->send_mail($headers['From'], $headers['To'], $head, $body); + $smtp_response = $SMTP->get_response(); if ($status) { $RCI->pass('SMTP send'); @@ -340,7 +325,7 @@ else { $RCI->fail('SMTP send', 'Invalid sender or recipient'); } - + echo '</p>'; } @@ -405,7 +390,7 @@ if (isset($_POST['imaptest']) && !empty($_POST['_host']) && !empty($_POST['_user'])) { - echo '<p>Connecting to ' . Q($_POST['_host']) . '...<br />'; + echo '<p>Connecting to ' . rcube::Q($_POST['_host']) . '...<br />'; $imap_host = trim($_POST['_host']); $imap_port = $RCI->getprop('default_port');