= 5.1.3 is required to run this application");
}
error_reporting(E_ALL);
ini_set('display_errors', 0);
session_start();
$root = getcwd();
chdir('..');
$top = getcwd();
chdir($root);
ini_set('include_path', "$top:$top/navigate:$top/utils:$top/include:$top/caldav:$top/caldav/awl:$top/templates:$top/events");
include_once "$top/utils/timezone.php";
include_once "$top/utils/helper.php";
$db_drivers = array('sqlite','pgsql');
/* Test for an existing config.inc.php */
function remove_config() {
if (file_exists("../config.inc.php")) {
$postfix = date("c");
copy("../config.inc.php", "../$postfix-config.inc.php");
unlink("../config.inc.php");
}
}
$config_inc = <<<_CONFIG
/*******************************************************************
* Change only below this line.
* But in generel you should not changes these settings
* except via the setup script.
******************************************************************/
define('TITLE', __TITLE__);
define('TIMEZONE', __TIMEZONE__);
define('ERROR_DISPLAY', __ERROR_DISPLAY__);
define('ERROR_LOG', __ERROR_LOG__);
define('LOG_FILE', __LOG_FILE__);
define('TOP_FOLDER', __TOP_FOLDER__);
/* / at the end of WEB_ROOT is mandatory */
define('WEB_ROOT', __WEB_ROOT__);
define('DBDRIVER', __DBDRIVER__);
define('DNS', __DNS__);
define('ADMIN_MAIL', __ADMIN_MAIL__);
/* Settings which can be change by individual users.
* Settings are change in config from the menu
*/
define('VIEW_STYLE', __VIEW_STYLE__);
define('TIMEOUT', __TIMEOUT__);
define('WEEK_START_SUNDAY', __WEEK_START_SUNDAY__);
define('START_HOUR', __START_HOUR__);
define('END_HOUR', __END_HOUR__);
/*******************************************************************
* Do not change below this line
* All changes should be done above
******************************************************************/
require_once 'include/user_settings.inc.php';
require_once 'utils/authenticate.php';
require_once 'utils/helper.php';
session_cache_limiter('private');
if (isset(\$_COOKIE['WEBCAL_EXPIRE'])) {
\$expire = \$_COOKIE['WEBCAL_EXPIRE'];
session_cache_expire(\$expire);
unset(\$_COOKIE['WEBCAL_EXPIRE']);
setcookie('WEBCAL_EXPIRE', FALSE);
}
else
session_cache_expire(TIMEOUT);
session_start();
header('Cache-Control: private');
\$_SESSION['WEB_ROOT'] = WEB_ROOT;
error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE);
if (isset(\$_SESSION['user_settings'])) {
ini_set('date.timezone', \$_SESSION['user_settings']->getTimezone());
}
else if (defined('TIMEZONE')) {
ini_set('date.timezone', TIMEZONE);
}
else {
ini_set('date.timezone', 'Etc/UTC');
}
if (defined('ERROR_DISPLAY')) {
if (ERROR_DISPLAY) {
ini_set('display_errors', 'on');
}
else {
ini_set('display_errors', 'off');
}
}
if (defined('ERROR_LOG') && ERROR_LOG) {
ini_set('log_errors', 'on');
ini_set('error_log', LOG_FILE);
}
if (! isset(\$_SESSION['isTimeout'])) {
if (isset(\$_SESSION['user_settings']))
\$_SESSION['user_settings']->isTimeout();
}
else
unset(\$_SESSION['isTimeout']);
_CONFIG;
$config_apache = <<<_CONFIG
Alias __ALIAS__ "__TOP__"
Options Multiviews SymLinksIfOwnerMatch
php_value include_path '.:__TOP__:__TOP__navigate:__TOP__utils:__TOP__include:__TOP__caldav:__TOP__caldav/awl:__TOP__templates:__TOP__events'
_CONFIG;
$htaccess = <<<_HTACCESS
Options None
Order deny,allow
Deny from all
Allow from 127.0.0.1/32 ::1/128
_HTACCESS;
$head = <<<_HEAD
Web Calendar Installation
DAViCal Web Calendar - A Web Interface for DAViCal
_HEAD;
$foot = <<<_FOOTER
_FOOTER;
function shutdown() {
global $head, $foot;
$isError = false;
if ($error = error_get_last()) {
switch($error['type']) {
case E_ERROR:
case E_CORE_ERROR:
case E_COMPILE_ERROR:
case E_USER_ERROR:
$isError = true;
break;
}
}
if ($isError) {
print $head;
print '
';
if ($error['message'] == "Class 'PDO' not found") {
echo '
This install cannot continue because the module PDO is not installed
';
}
else
echo "
Script execution halted ({$error['message']})
";
print '
';
print $foot;
}
remove_config();
}
register_shutdown_function('shutdown');
function get_server_timezone() {
$tz_abbr = date('T');
return timezone_name_from_abbr($tz_abbr);
}
function stage_1() {
switch ($_POST['driver']) {
case 'sqlite':
$dns = <<<_DNS
Database file
_DNS;
break;
case 'pgsql':
$dns = <<<_DNS
Below you will find reasonable default values for most. database name: Name of an exiting database used as template
on Postgresql this database is normally named template1
You should normally not need any other information than the following: postgresql dba: An existing postgresql user with permission to create
new databases and users. postgresql dba password: Password for this user Password for webcal admin: Password for the webcal admin user