| | |
| | | 'MDB2' => 'MDB2.php', 'iilConnection' => 'lib/imap.inc'); |
| | | |
| | | $supported_drivers = array('MDB2#mysql' => 'MDB2/Driver/mysql.php', |
| | | 'MDB2#pgsql' => 'MDB2/Driver/pgsql.php', 'MDB2#sqlite' => 'MDB2/Driver/sqlite.php'); |
| | | 'MDB2#pgsql' => 'MDB2/Driver/pgsql.php', |
| | | 'MDB2#sqlite' => 'MDB2/Driver/sqlite.php'); |
| | | |
| | | $supported_dbs = array('MySQL' => 'mysql', 'MySQLi' => 'mysqli', |
| | | 'PostgreSQL' => 'pgsql', 'SQLite (v2)' => 'sqlite'); |
| | | |
| | | $required_php_exts = array('Session' => 'session', |
| | | 'PCRE' => 'pcre', 'Sockets' => 'sockets'); |
| | | |
| | | $optional_php_exts = array('FileInfo' => 'fileinfo', 'Libiconv' => 'iconv', |
| | | 'Multibyte' => 'mbstring', 'OpenSSL' => 'openssl', 'GD' => 'gd'); |
| | | |
| | | $source_urls = array( |
| | | 'Socket' => 'http://www.php.net/manual/en/ref.sockets.php', |
| | | 'Session' => 'http://www.php.net/manual/en/ref.session.php', |
| | | 'PCRE' => 'http://www.php.net/manual/en/ref.pcre.php', |
| | | 'FileInfo' => 'http://www.php.net/manual/en/ref.fileinfo.php', |
| | | 'Libiconv' => 'http://www.php.net/manual/en/ref.iconv.php', |
| | | 'Multibyte' => 'http://www.php.net/manual/en/ref.mbstring.php', |
| | | 'OpenSSL' => 'http://www.php.net/manual/en/ref.openssl.php', |
| | | 'PEAR' => 'http://pear.php.net', |
| | | 'MDB2' => 'http://pear.php.net/package/MDB2', |
| | | 'Net_SMTP' => 'http://pear.php.net/package/Net_SMTP', |
| | | 'Mail_mime' => 'http://pear.php.net/package/Mail_mime' |
| | | ); |
| | | |
| | | $path = dirname(__FILE__) . '/'; |
| | | $check = basename(__FILE__); |
| | | |
| | | require_once 'include/bugs.inc'; |
| | | |
| | | function show_hint($key) { |
| | | global $source_urls; |
| | | if ($source_urls[$key]) { |
| | | echo '<span class="indent">(See <a href="' . $source_urls[$key] . '">'; |
| | | echo $source_urls[$key] . '</a>)</span>'; |
| | | } |
| | | } |
| | | |
| | | ?> |
| | | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-transitional.dtd"> |
| | | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| | |
| | | color: #f60; |
| | | font-weight: bold; |
| | | } |
| | | |
| | | .indent { |
| | | padding-left: 0.8em; |
| | | } |
| | | /* ]]> */ |
| | | </style> |
| | | <title>RoundCube :: check</title> |
| | |
| | | } |
| | | |
| | | echo '<h3>Checking available databases</h3>'; |
| | | echo '<p>Checks if the extension is loaded.</p>'; |
| | | echo '<p>Checks if the extension is loaded. At least one of them is required.</p>'; |
| | | |
| | | $prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : ''; |
| | | foreach ($supported_dbs AS $database => $ext) { |
| | |
| | | } else { |
| | | $_ext = $prefix . $ext . '.' . PHP_SHLIB_SUFFIX; |
| | | echo CHECK_NA; |
| | | if (dl($_ext)) { |
| | | if (@dl($_ext)) { |
| | | echo ' (<i>Could</i> be loaded. Please add in php.ini, if you plan on using it.)'; |
| | | } else { |
| | | echo ' (<b>Not</b> installed.)'; |
| | | } |
| | | } |
| | | echo '<br />'; |
| | | } |
| | | |
| | | echo '<h3>Checking PHP extensions</h3>'; |
| | | echo '<p>The following modules/extensions are <em>required</em> to run RoundCube</p>'; |
| | | |
| | | $prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : ''; |
| | | foreach ($required_php_exts AS $name => $ext) { |
| | | echo "$name: "; |
| | | if (extension_loaded($ext)) { |
| | | echo CHECK_OK; |
| | | } else { |
| | | $_ext = $prefix . $ext . '.' . PHP_SHLIB_SUFFIX; |
| | | echo CHECK_NA; |
| | | if (@dl($_ext)) { |
| | | echo ' (<i>Could</i> be loaded. Please add in php.ini.)'; |
| | | } else { |
| | | show_hint($name); |
| | | } |
| | | } |
| | | echo '<br />'; |
| | | } |
| | | |
| | | echo '<p>These extensions are <em>optional</em> but recommended to get the best performance.</p>'; |
| | | |
| | | foreach ($optional_php_exts AS $name => $ext) { |
| | | echo "$name: "; |
| | | if (extension_loaded($ext)) { |
| | | echo CHECK_OK; |
| | | } else { |
| | | $_ext = $prefix . $ext . '.' . PHP_SHLIB_SUFFIX; |
| | | echo CHECK_NA; |
| | | if (@dl($_ext)) { |
| | | echo ' (<i>Could</i> be loaded. Please add in php.ini, if you plan on using it.)'; |
| | | } else { |
| | | show_hint($name); |
| | | } |
| | | } |
| | | echo '<br />'; |
| | |
| | | if (class_exists($classname)) { |
| | | echo CHECK_OK; |
| | | } else { |
| | | echo CHECK_NOK . "; Failed to load $file"; |
| | | echo CHECK_NOK . " (Failed to load $file.)"; |
| | | show_hint($classname); |
| | | } |
| | | echo "<br />"; |
| | | } |
| | |
| | | if (is_array($rctest_config) && count($rctest_config)) { |
| | | ?> |
| | | <table border="0"> |
| | | <tr> |
| | | <th> |
| | | <h4>SMTP Settings</h4> |
| | | </th> |
| | | <th> |
| | | <h4>IMAP Settings</h4> |
| | | </th> |
| | | </tr> |
| | | <tr> |
| | | <td valign="top"><?php |
| | | echo 'SMTP: ' . CHECK_OK . '<br />'; |
| | | echo 'server: '.(isset($rctest_config['smtp_server']) && !empty($rctest_config['smtp_server']) ? $rctest_config['smtp_server'] : '<i>not set</i>').'<br />'; |
| | | echo 'port: '.(isset($rctest_config['smtp_port']) && !empty($rctest_config['smtp_port']) ? $rctest_config['smtp_port'] : '<i>not set</i>').'<br />'; |
| | | if (isset($rctest_config['smtp_user']) && !empty($rctest_config['smtp_user'])) { |
| | | echo 'user: '.$rctest_config['smtp_user'].'<br/>'; |
| | | } elseif ($rctest_config['smtp_user'] == '%u') { |
| | | echo 'user: <i>use current session</i><br/>'; |
| | | } else { |
| | | echo 'user: <i>not set</i><br/>'; |
| | | } |
| | | if (isset($rctest_config['smtp_pass']) && !empty($rctest_config['smtp_pass'])) { |
| | | echo 'pass: '.$rctest_config['smtp_pass'].'<br/>'; |
| | | } elseif (isset($rctest_config['smtp_pass']) && $rctest_config['smtp_pass'] == '%p') { |
| | | echo 'pass: <i>use current session</i><br/>'; |
| | | } else { |
| | | echo 'pass: <i>not set</i><br/>'; |
| | | } |
| | | ?></td> |
| | | <td valign="top"><?php |
| | | echo 'IMAP: ' . CHECK_OK . '<br />'; |
| | | if (isset($rctest_config['default_host']) && is_array($rctest_config['default_host'])) { |
| | | echo 'server: '.var_export($rctest_config['default_host'], true).'<br/>'; |
| | | } elseif (isset($rctest_config['default_host']) && !empty($rctest_config['default_host'])) { |
| | | echo 'server: '.$rctest_config['default_host'].'<br/>'; |
| | | } else { |
| | | echo 'server: <i>not set</i><br/>'; |
| | | } |
| | | echo 'port: '.(isset($rctest_config['default_port']) && !empty($rctest_config['default_port']) ? $rctest_config['default_port'] : '<i>not set</i>').'<br />'; |
| | | ?></td> |
| | | </tr> |
| | | <tr> |
| | | <th><h4>SMTP Settings</h4></th> |
| | | <th><h4>IMAP Settings</h4></th> |
| | | </tr> |
| | | <tr> |
| | | <td valign="top"><?php |
| | | echo 'SMTP: ' . CHECK_OK . '<br />'; |
| | | echo 'server: '.(isset($rctest_config['smtp_server']) && !empty($rctest_config['smtp_server']) ? $rctest_config['smtp_server'] : '<i>not set</i>').'<br />'; |
| | | echo 'port: '.(isset($rctest_config['smtp_port']) && !empty($rctest_config['smtp_port']) ? $rctest_config['smtp_port'] : '<i>not set</i>').'<br />'; |
| | | if (isset($rctest_config['smtp_user']) && !empty($rctest_config['smtp_user'])) { |
| | | echo 'user: '.$rctest_config['smtp_user'].'<br/>'; |
| | | } elseif ($rctest_config['smtp_user'] == '%u') { |
| | | echo 'user: <i>use current session</i><br/>'; |
| | | } else { |
| | | echo 'user: <i>not set</i><br/>'; |
| | | } |
| | | if (isset($rctest_config['smtp_pass']) && !empty($rctest_config['smtp_pass'])) { |
| | | echo 'pass: '.$rctest_config['smtp_pass'].'<br/>'; |
| | | } elseif (isset($rctest_config['smtp_pass']) && $rctest_config['smtp_pass'] == '%p') { |
| | | echo 'pass: <i>use current session</i><br/>'; |
| | | } else { |
| | | echo 'pass: <i>not set</i><br/>'; |
| | | } |
| | | ?></td> |
| | | <td valign="top"> |
| | | <?php |
| | | echo 'IMAP: ' . CHECK_OK . '<br />'; |
| | | if (isset($rctest_config['default_host']) && is_array($rctest_config['default_host'])) { |
| | | echo 'server: '.var_export($rctest_config['default_host'], true).'<br/>'; |
| | | } elseif (isset($rctest_config['default_host']) && !empty($rctest_config['default_host'])) { |
| | | echo 'server: '.$rctest_config['default_host'].'<br/>'; |
| | | } else { |
| | | echo 'server: <i>not set</i><br/>'; |
| | | } |
| | | echo 'port: '.(isset($rctest_config['default_port']) && !empty($rctest_config['default_port']) ? $rctest_config['default_port'] : '<i>not set</i>').'<br />'; |
| | | ?></td> |
| | | </tr> |
| | | </table> |
| | | <h3>Test SMTP settings - send an email</h3> |
| | | <p>Don't abuse this!</p> |
| | |
| | | ?> Recipient:<br /> |
| | | <?php echo $rctest_config['from']; ?><br /> |
| | | <br /> |
| | | <input type="hidden" name="action" value="smtp" /> <input type="submit" |
| | | value="send an email" /></form> |
| | | <?php if (!empty($rctest_config['smtp_server'])): ?> |
| | | <input type="hidden" name="action" value="smtp" /> |
| | | <input type="submit" value="send an email" /> |
| | | <?php else: ?> |
| | | <i>Because you did not configure SMTP, you cannot test it!</i> |
| | | <?php endif; ?> |
| | | </form> |
| | | <?php |
| | | if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['action'] == 'smtp') { |
| | | |
| | |
| | | echo CHECK_NOK . '<br />'; |
| | | echo '<i>Please edit $rctest_config in ' . basename(__FILE__) . '</i><br />'; |
| | | } else { |
| | | |
| | | $data = $_POST['smtp_test']; |
| | | $data = null; |
| | | $CONFIG = $rctest_config; |
| | | if (isset($_POST['smtp_test'])) { |
| | | $data = $_POST['smtp_test']; |
| | | |
| | | // inject into config array |
| | | $CONFIG['smtp_user'] = $data['user']; |
| | | $CONFIG['smtp_pass'] = $data['pass']; |
| | | } |
| | | |
| | | require_once 'lib/rc_mail_mime.inc'; |
| | | require_once 'include/rcube_smtp.inc'; |
| | |
| | | |
| | | $body = 'This is a test to confirm that RoundCube can send email.'; |
| | | |
| | | $mail_object = new rc_mail_mime(); |
| | | $mail_object->headers($headers); |
| | | $mail_object = new rc_mail_mime(); |
| | | $send_headers = $mail_object->headers($headers); |
| | | |
| | | $smtp_response = array(); |
| | | if (smtp_mail($rctest_config['from'], $recipients, ($foo = $mail_object->txtHeaders($send_headers)), $body, $smtp_response)) { |
| | | |
| | | $status = smtp_mail($rctest_config['from'], $recipients, |
| | | ($foo = $mail_object->txtHeaders($send_headers)), |
| | | $body, $smtp_response); |
| | | |
| | | if ($status) { |
| | | echo CHECK_OK . '<br />'; |
| | | } else { |
| | | echo CHECK_NOK; |
| | |
| | | } |
| | | ?> |
| | | </body> |
| | | </html> |
| | | </html> |