| | |
| | | |
| | | // test database |
| | | if ($db_working) { |
| | | $db_read = $DB->query("SELECT count(*) FROM {$RCI->config['db_prefix']}users"); |
| | | $db_read = $DB->query("SELECT count(*) FROM " . $DB->quote_identifier($RCI->config['db_prefix'] . 'users')); |
| | | if ($DB->is_error()) { |
| | | $RCI->fail('DB Schema', "Database not initialized"); |
| | | echo '<p><input type="submit" name="initdb" value="Initialize database" /></p>'; |
| | |
| | | if ($db_working) { |
| | | // write test |
| | | $insert_id = md5(uniqid()); |
| | | $db_write = $DB->query("INSERT INTO {$RCI->config['db_prefix']}session (sess_id, created, ip, vars) VALUES (?, ".$DB->now().", '127.0.0.1', 'foo')", $insert_id); |
| | | $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); |
| | | |
| | | if ($db_write) { |
| | | $RCI->pass('DB Write'); |
| | | $DB->query("DELETE FROM {$RCI->config['db_prefix']}session WHERE sess_id=?", $insert_id); |
| | | $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()); |
| | | } |
| | | echo '<br />'; |
| | | |
| | | |
| | | // check timezone settings |
| | | $tz_db = 'SELECT ' . $DB->unixtimestamp($DB->now()) . ' AS tz_db'; |
| | | $tz_db = $DB->query($tz_db); |
| | |
| | | |
| | | <h3>Test filetype detection</h3> |
| | | |
| | | <p> |
| | | <?php |
| | | |
| | | if ($errors = $RCI->check_mime_detection()) { |
| | |
| | | } |
| | | else { |
| | | $RCI->pass('Fileinfo/mime_content_type configuration'); |
| | | echo "<br/>"; |
| | | } |
| | | |
| | | ?> |
| | | </p> |
| | | <p> |
| | | <?php |
| | | |
| | | if ($errors = $RCI->check_mime_extensions()) { |
| | | $RCI->fail('Mimetype to file extension mapping'); |
| | |
| | | } |
| | | else { |
| | | $RCI->pass('Mimetype to file extension mapping'); |
| | | echo "<br/>"; |
| | | } |
| | | |
| | | ?> |
| | |
| | | <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', 'PHP mail()')); ?><br /> |
| | | Port: <?php echo $RCI->getprop('smtp_port'); ?><br /> |
| | | |
| | | <?php |
| | |
| | | $send_headers = $mail_object->headers($headers); |
| | | |
| | | $SMTP = new rcube_smtp(); |
| | | $SMTP->connect(rcube_parse_host($RCI->getprop('smtp_server')), |
| | | $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'], |
| | |
| | | $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'; |
| | | } |
| | |
| | | else { |
| | | $RCI->fail('SMTP send', 'Invalid sender or recipient'); |
| | | } |
| | | |
| | | |
| | | echo '</p>'; |
| | | } |
| | | |
| | |
| | | |
| | | 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'); |
| | |
| | | $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)) { |