svncommit
2008-02-16 cf436eeb7295e4a6baee2de2e409d08b0b56f734
check.php-dist
@@ -58,23 +58,35 @@
define('CHECK_OK', '<span class="success">OK</span>');
define('CHECK_NOK', '<span class="fail">NOT OK</span>');
define('CHECK_NA', '<span class="na">NOT AVAILABLE</span>');
error_reporting(E_ALL ^E_NOTICE);
$include_path  = dirname(__FILE__) . '/program/lib/';
$include_path  = dirname(__FILE__) . '/program/lib';
$include_path .= PATH_SEPARATOR;
$include_path .= dirname(__FILE__) . '/program/';
$include_path .= dirname(__FILE__) . '/program';
$include_path .= PATH_SEPARATOR;
$include_path .= get_include_path();
@ini_set('display_errors', 1);
set_include_path($include_path);
$create_files  = array('config/db.inc.php', 'config/main.inc.php');
$required_libs = array('PEAR' => 'PEAR.php', 'DB' => 'DB.php', 'Net_SMTP' => 'Net/SMTP.php', 'Mail_mime' => 'Mail/mime.php', 'iilConnection' => 'lib/imap.inc');
$create_files = array('config/db.inc.php', 'config/main.inc.php');
$required_libs = array('PEAR' => 'PEAR.php', 'DB' => 'DB.php',
    'Net_SMTP' => 'Net/SMTP.php', 'Mail_mime' => 'Mail/mime.php',
    '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');
$supported_dbs = array('MySQL' => 'mysql', 'MySQLi' => 'mysqli',
    'PostgreSQL' => 'pgsql', 'SQLite (v2)' => 'sqlite');
$path  = dirname(__FILE__) . '/';
$check = basename(__FILE__);
include_once 'include/bugs.inc';
?>
<!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">
@@ -88,6 +100,7 @@
    h4 { margin-bottom: 0.2em; }
    .success { color:#006400;font-weight:bold !important; }
    .fail { color:#ff0000 !important;font-weight:bold !important; }
    .na { color:#f60; font-weight:bold; }
    /* ]]> */
    </style>
    <title>RoundCube :: check</title>
@@ -102,19 +115,41 @@
    echo CHECK_NOK;
} else {
    echo $rctest_config['from'] . '<br /><br />';
    echo '<i>We do not check if this is a <b>valid</b> email address. Since this serves as from &amp; to, make sure it is correct!</i>';
    echo '<i><b>Note:</b> We do not check if this is a <b>valid</b> email address.';
    echo ' Because this settings serves as from &amp; to, make sure it is correctly set!</i>';
}
echo '<h3>Checking available databases</h3>';
echo '<p>Checks if the extension is loaded.</p>';
$prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';
foreach ($supported_dbs AS $database => $ext) {
    echo "$database: ";
    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 {
            echo ' (<b>Not</b> installed.)';
        }
    }
    echo '<br />';
}
echo '<h3>Check for required 3rd party libs</h3>';
echo '<p>This also checks if the include path is set correctly.</p>';
foreach ($required_libs as $classname => $file) {
    @include_once $file;
    require_once $file;
    echo "$classname: ";
    if (class_exists($classname))
    if (class_exists($classname)) {
        echo CHECK_OK;
    else
    } else {
        echo CHECK_NOK . "; Failed to load $file";
    }
    echo "<br />";
}
@@ -154,18 +189,42 @@
@include $path . 'config/db.inc.php';
$db_working = false;
if (isset($rcmail_config)) {
    echo 'DB settings: ';
    include_once 'MDB2.php';
    $db = MDB2::connect($rcmail_config['db_dsnw']);
    if (!MDB2::IsError($db)) {
        echo CHECK_OK;
        $db->disconnect();
        $db_working = true;
if (isset($rcmail_config) && is_array($rcmail_config)) {
    echo 'Selected backend: ';
    if ($rcmail_config['db_backend'] != '') {
        echo 'PEAR::' . strtoupper($rcmail_config['db_backend']) . '<br />';
        $_class = 'rcube_' . strtolower($rcmail_config['db_backend']);
        require_once 'include/' . $_class . '.inc';
        echo 'DSN (standard): ';
        $DB = new $_class($rcmail_config['db_dsnw'], '', false);
        $DB->db_connect('w');
        if (!($db_error_msg = $DB->is_error())) {
            echo CHECK_OK;
            $db_working = true;
        } else {
            echo CHECK_NOK . " (Error: $db_error_msg)";
        }
        echo '<br />';
        echo 'DSN (read-only, optional): ';
        if ($rcmail_config['db_dsnr'] != '') {
            $DB_READ = new $_class($rcmail_config['db_dsnr'], '', false);
            $DB_READ->db_connect('w');
            if (!($db_error_msg = $DB_READ->is_error())) {
                echo CHECK_OK;
            } else {
                echo CHECK_NOK . " (Error: $db_error_msg)";
            }
        } else {
            echo CHECK_NA;
        }
        echo '<br />';
    } else {
        echo CHECK_NOK;
        echo CHECK_NOK . ' (not set)';
    }
    echo '<br />';
} else {
    echo 'Could not open db.inc.php config file, or file is empty.<br />';
}
@@ -174,10 +233,6 @@
echo 'Checks if web- and databaseserver are in the same timezone.<br /><br />';
echo 'Status: ';
if ($db_working === true) {
    require_once 'include/rcube_mdb2.inc';
    $DB = new rcube_mdb2($rcmail_config['db_dsnw'], '', false);
    $DB->db_connect('w');
    $tz_db    = "SELECT " . $DB->unixtimestamp($DB->now()) . " AS tz_db";
    $tz_db    = $DB->query($tz_db);
    $tz_db    = $DB->fetch_assoc($tz_db);
@@ -197,45 +252,21 @@
echo '<h3>Checking .ini settings</h3>';
$auto_start   = ini_get('session.auto_start');
$file_uploads = ini_get('file_uploads');
$ini_array = array('session.auto_start' => 0, 'file_uploads' => 1,
    'magic_quotes_sybase' => 0, 'magic_quotes_gpc' => 0);
echo '<h4>session.auto_start = 0</h4>';
echo 'status: ';
if ($auto_start == 1) {
    echo CHECK_NOK;
} else {
    echo CHECK_OK;
}
echo '<br />';
foreach ($ini_array AS $var => $val) {
    $status = ini_get($var);
echo '<h4>file_uploads = On</h4>';
echo 'status: ';
if ($file_uploads == 1) {
    echo CHECK_OK;
} else {
    echo CHECK_NOK;
}
/*
 * Probably not needed because we have a custom handler
echo '<h4>session.save_path <i>is set</i></h4>';
echo 'status: ';
$save_path = ini_get('session.save_path');
if (empty($save_path)) {
    echo CHECK_NOK;
} else {
    echo CHECK_OK . ": $save_path";
    if (!file_exists($save_path)) {
        echo ', but it does not exist';
    echo "<h4>$var = $val</h4>";
    echo 'status: ';
    if ($status != $val) {
        echo CHECK_NOK;
    } else {
        if (!is_readable($save_path) || !is_writable($save_path)) {
            echo ', but permissions to read and/or write are missing';
        }
        echo CHECK_OK;
    }
    echo '<br />';
}
echo '<br />';
 */
@include $path . 'config/main.inc.php';
?>
@@ -360,4 +391,4 @@
}
?>
</body>
</html>
</html>