* * This file is part of AgenDAV. * * AgenDAV is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * AgenDAV is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with AgenDAV. If not, see . */ /* * Set this to TRUE to enable config test (disabled by default) * Remember to disable it again when finished */ define('ENABLE_SETUP_TESTS', FALSE); /* * Checks: * * - PHP >= 5.3.0 * - magic_quotes_gpc and magic_quotes_runtime disabled * - php-mbstring available * - php-curl available * - Correctly configured config.php, database.php and caldav.php * - PHP database module (mysql, mysqli or postgresql) * - Existing log directory and writable by current user */ if (ENABLE_SETUP_TESTS === FALSE) { echo "Access to setup tests is disabled"; exit; } // Abort tests on error (e.g. syntax errors) set_error_handler('error_abort_tests'); $tests = array(); $keep_checking = TRUE; // PHP version $cmp = version_compare(phpversion(), '5.3.0'); $tests[] = array('PHP version', phpversion(), ($cmp >= 0) ? 'OK' : 'PHP 5.3.0 or later required'); // magic_quotes_gpc $res_magic_quotes_gpc = (get_magic_quotes_gpc() == 0); $tests[] = array('magic_quotes_gpc', $res_magic_quotes_gpc ? 'Disabled' : 'Enabled', $res_magic_quotes_gpc ? 'OK' : 'Disable it inside php.ini'); // magic_quotes_runtime $res_magic_quotes_runtime = (get_magic_quotes_runtime() == 0); $tests[] = array('magic_quotes_runtime', $res_magic_quotes_runtime ? 'Disabled' : 'Enabled', $res_magic_quotes_runtime ? 'OK' : 'Disable it inside php.ini'); // PHP cURL if (extension_loaded('curl')) { $tests[] = array('cURL extension', 'Available', 'OK'); } else { $tests[] = array('cURL extension', 'Not installed', 'cURL extension is needed by AgenDAV'); } // PHP mbstring if (extension_loaded('mbstring')) { $tests[] = array('mbstring extension', 'Available', 'OK'); } else { $tests[] = array('mbstring extension', 'Not installed', 'mbstring extension is needed by AgenDAV'); } // Configuration files: config.php, database.php and caldav.php $cwd = dirname(__FILE__); $configdir = preg_replace('/public$/', 'application/config', $cwd); $test_subj = 'File config.php'; if (!file_exists($configdir . '/config.php')) { $tests[] = array($test_subj, 'Not present or readable', 'Create it using template config.php.template'); $keep_checking = FALSE; } else { $tests[] = array($test_subj, 'Exists', 'OK'); } $test_subj = 'File database.php'; if ($keep_checking && !file_exists($configdir . '/database.php')) { $tests[] = array($test_subj, 'Not present or readable', 'Create it using template database.php.template'); $keep_checking = FALSE; } elseif ($keep_checking) { $tests[] = array($test_subj, 'Exists', 'OK'); } $test_subj = 'File caldav.php'; if ($keep_checking && !file_exists($configdir . '/caldav.php')) { $tests[] = array($test_subj, 'Not present or readable', 'Create it using template caldav.php.template'); $keep_checking = FALSE; } elseif ($keep_checking) { $tests[] = array($test_subj, 'Exists', 'OK'); } // Fool CodeIgniter and load configuration files define('BASEPATH', '/tmp'); include($configdir .'/config.php'); include($configdir .'/database.php'); if ($keep_checking) { // Database switch ($db['default']['dbdriver']) { case 'mysql': $check_sql_ext = 'mysql'; break; case 'mysqli': $check_sql_ext = 'mysqli'; break; case 'postgre': $check_sql_ext = 'pgsql'; break; default: $tests[] = array('SQL driver', 'Unsupported ' . $db['default']['dbdriver'], 'AgenDAV requires a MySQL or PostgreSQL database'); $keep_checking = FALSE; } if ($keep_checking) { if (!extension_loaded($check_sql_ext)) { $tests[] = array('PHP supported database', 'Not available', 'Configured DB driver inside database.php (' . $db['default']['dbdriver'] . ') is not' . ' available to PHP'); } else { $tests[] = array('PHP supported database', 'Yes ('.$check_sql_ext.')', 'OK'); } } // Log directory $test_subj = 'Log directory'; if (!is_writable($config['log_path'])) { $tests[] = array($test_subj, 'Does not exist or is not writable by web server', 'Check directory '.$config['log_path'].''); } else { $tests[] = array($test_subj, 'All right', 'OK'); } // ---- Tests end ----- } // $keep_checking ?> AgenDAV configuration test

Configuration test

Test Result Comments
There is an error on " . $errfile . " @ line " . $errline; echo ':

'; echo '
' . $errstr . '
'; exit; } ?>