define('WT_DATA_DIR', 'data/'); define('WT_DEBUG_SQL', false); define('WT_REQUIRED_MYSQL_VERSION', '5.0.13'); define('WT_REQUIRED_PHP_VERSION', '5.3.2'); define('WT_MODULES_DIR', 'modules_v3/'); define('WT_ROOT', ''); define('WT_CLIENT_IP', $_SERVER['REMOTE_ADDR']); if (file_exists(WT_DATA_DIR . WT_CONFIG_FILE)) { header('Location: index.php'); return; } if (version_compare(PHP_VERSION, WT_REQUIRED_PHP_VERSION) < 0) { echo '<h1>Sorry, the setup wizard cannot start.</h1>', '<p>This server is running PHP version ', PHP_VERSION, '</p>', '<p>PHP ', WT_REQUIRED_PHP_VERSION, ' (or any later version) is required</p>'; return; } Session::start(); define('WT_LOCALE', I18N::init(Filter::post('lang', '[a-zA-Z-]+', Filter::get('lang', '[a-zA-Z-]+')))); header('Content-Type: text/html; charset=UTF-8'); ?> <!DOCTYPE html> <html <?php echo I18N::htmlAttributes(); ?> > <head> <meta charset="UTF-8"> <title> webtrees setup wizard </title> <style type="text/css"> body {color: black; background-color: white; font: 14px tahoma, arial, helvetica, sans-serif; padding:10px; }
}, function () { return true; }, function ($id) { return Database::prepare("SELECT session_data FROM `##session` WHERE session_id=?")->execute(array($id))->fetchOne(); }, function ($id, $data) { // Only update the session table once per minute, unless the session data has actually changed. Database::prepare("INSERT INTO `##session` (session_id, user_id, ip_address, session_data, session_time)" . " VALUES (?, ?, ?, ?, CURRENT_TIMESTAMP - SECOND(CURRENT_TIMESTAMP))" . " ON DUPLICATE KEY UPDATE" . " user_id = VALUES(user_id)," . " ip_address = VALUES(ip_address)," . " session_data = VALUES(session_data)," . " session_time = CURRENT_TIMESTAMP - SECOND(CURRENT_TIMESTAMP)")->execute(array($id, (int) Auth::id(), WT_CLIENT_IP, $data)); return true; }, function ($id) { Database::prepare("DELETE FROM `##session` WHERE session_id=?")->execute(array($id)); return true; }, function ($maxlifetime) { Database::prepare("DELETE FROM `##session` WHERE session_time < DATE_SUB(NOW(), INTERVAL ? SECOND)")->execute(array($maxlifetime)); return true; }); Session::start(array('gc_maxlifetime' => Site::getPreference('SESSION_TIME'), 'cookie_path' => parse_url(WT_BASE_URL, PHP_URL_PATH))); if (!Auth::isSearchEngine() && !Session::get('initiated')) { // A new session, so prevent session fixation attacks by choosing a new PHPSESSID. Session::regenerate(false); Session::put('initiated', true); } else { // An existing session } // Set the tree for the page; (1) the request, (2) the session, (3) the site default, (4) any tree foreach (array(Filter::post('ged'), Filter::get('ged'), Session::get('GEDCOM'), Site::getPreference('DEFAULT_GEDCOM')) as $tree_name) { $WT_TREE = Tree::findByName($tree_name); if ($WT_TREE) { Session::put('GEDCOM', $tree_name); break; } }