. */ namespace Fisharebest\Webtrees; use Fisharebest\Webtrees\Functions\FunctionsEdit; use PDOException; error_reporting(E_ALL); define('WT_SCRIPT_NAME', 'setup.php'); define('WT_CONFIG_FILE', 'config.ini.php'); require 'vendor/autoload.php'; // This script (uniquely) does not load session.php. // session.php won’t run until a configuration file exists… // This next block of code is a minimal version of session.php define('WT_WEBTREES', 'webtrees'); define('WT_BASE_URL', ''); 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']); // Convert PHP errors into exceptions set_error_handler(function ($errno, $errstr, $errfile, $errline) { if (error_reporting() & $errno) { throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); } else { return false; } }); 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 '
This server is running PHP version ', PHP_VERSION, '
', 'PHP ', WT_REQUIRED_PHP_VERSION, ' (or any later version) is required
'; return; } 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'); ?> >', I18N::translate('Language'), ' ', FunctionsEdit::selectEditControl('change_lang', $installed_languages, null, WT_LOCALE, 'onchange="window.location=\'' . WT_SCRIPT_NAME . '?lang=\'+this.value;">'), '
', '', /* I18N: %s is a PHP function/module/setting */ I18N::translate('%s is disabled on this server. You cannot install webtrees until it is enabled. Please ask your server’s administrator to enable it.', $function . '()'), '
'; $errors = true; } } // Mandatory extensions foreach (array('pcre', 'pdo', 'pdo_mysql', 'session', 'iconv') as $extension) { if (!extension_loaded($extension)) { echo '', I18N::translate('PHP extension “%s” is disabled. You cannot install webtrees until this is enabled. Please ask your server’s administrator to enable it.', $extension), '
'; $errors = true; } } // Recommended extensions foreach (array( 'gd' => /* I18N: a program feature */ I18N::translate('creating thumbnails of images'), 'xml' => /* I18N: a program feature */ I18N::translate('reporting'), 'simplexml' => /* I18N: a program feature */ I18N::translate('reporting'), ) as $extension => $features) { if (!extension_loaded($extension)) { echo '', I18N::translate('PHP extension “%1$s” is disabled. Without it, the following features will not work: %2$s. Please ask your server’s administrator to enable it.', $extension, $features), '
'; $warnings = true; } } // Settings foreach (array( 'file_uploads' => /* I18N: a program feature */ I18N::translate('file upload capability'), ) as $setting => $features) { if (!ini_get($setting)) { echo '', I18N::translate('PHP setting “%1$s” is disabled. Without it, the following features will not work: %2$s. Please ask your server’s administrator to enable it.', $setting, $features), '
'; $warnings = true; } } if (!$warnings && !$errors) { echo '', I18N::translate('The server configuration is OK.'), '
'; } echo '',
I18N::translate('The memory and CPU time requirements depend on the number of individuals in your family tree.'),
'
',
I18N::translate('The following list shows typical requirements.'),
'
',
I18N::translate('Small systems (500 individuals): 16–32 MB, 10–20 seconds'),
'
',
I18N::translate('Medium systems (5,000 individuals): 32–64 MB, 20–40 seconds'),
'
',
I18N::translate('Large systems (50,000 individuals): 64–128 MB, 40–80 seconds'),
'
' : '
', I18N::translate('This server’s memory limit is %s MB and its CPU time limit is %s seconds.', I18N::number($memory_limit), I18N::number($max_execution_time)), '
', I18N::translate('If you try to exceed these limits, you may experience server time-outs and blank pages.'), '
', I18N::translate('If your server’s security policy permits it, you will be able to request increased memory or CPU time using the webtrees administration page. Otherwise, you will need to contact your server’s administrator.'), '
'; if (!$errors) { echo '', I18N::translate('Oops! webtrees was unable to create files in this folder.'), '
'; echo '', I18N::translate('This usually means that you need to change the folder permissions to 777.'), '
'; echo '', I18N::translate('You must change this before you can continue.'), '
'; echo '