composer install to fetch dependant libraries."); } /** * Stripped ini sequence */ require_once ROOT_DIR . 'vendor/autoload.php'; require_once ROOT_DIR . 'vendor/o80/i18n/src/shortcuts.php'; require_once ROOT_DIR . 'app/inc/constants.php'; if (session_id() === '') { session_start(); } $ALLOWED_LANGUAGES = [ 'fr' => 'Français', 'en' => 'English', 'oc' => 'Occitan', 'es' => 'Español', 'de' => 'Deutsch', 'it' => 'Italiano', 'br' => 'Brezhoneg', ]; const DEFAULT_LANGUAGE = 'en'; require_once ROOT_DIR . 'app/inc/i18n.php'; /** * Function to sort messages by type (priorise errors on warning, warning on info, etc.) * * @param Message $a * @param Message $b * @return int */ function compareCheckMessage(Message $a, Message $b) { $values = [ 'danger' => 0, 'warning' => 1, 'info' => 2, 'success' => 3 ]; $vA = $values[$a->type]; $vB = $values[$b->type]; if ($vA === $vB) { return 0; } return ($vA < $vB) ? -1 : 1; } /** * Vars */ $messages = []; $inc_directory = ROOT_DIR . 'app/inc/'; $conf_filename = $inc_directory . 'config.php'; /** * Messages */ // PHP Version if (version_compare(PHP_VERSION, PHP_NEEDED_VERSION) >= 0) { $messages[] = new Message('info', __f('Check','PHP version %s is enough (needed at least PHP %s).', PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION, PHP_NEEDED_VERSION)); } else { $messages[] = new Message('danger', __f('Check','Your PHP version (%s) is too old. This application needs at least PHP %s.', phpversion(), PHP_NEEDED_VERSION)); } // INTL extension if (extension_loaded('intl')) { $messages[] = new Message('info', __('Check','PHP Intl extension is enabled.')); } else { $messages[] = new Message('danger', __('Check','You need to enable the PHP Intl extension.')); } // Is template compile dir exists and writable ? if (!file_exists(ROOT_DIR . COMPILE_DIR)) { $messages[] = new Message('danger', __f('Check','The template compile directory (%s) doesn\'t exist in "%s". Retry the installation process.', COMPILE_DIR, realpath(ROOT_DIR))); } elseif (is_writable(ROOT_DIR . COMPILE_DIR)) { $messages[] = new Message('info', __f('Check','The template compile directory (%s) is writable.', realpath(ROOT_DIR . COMPILE_DIR))); } else { $messages[] = new Message('danger', __f('Check','The template compile directory (%s) is not writable.', realpath(ROOT_DIR . COMPILE_DIR))); } // Does config.php exists or is writable ? if (file_exists($conf_filename)) { $messages[] = new Message('info', __('Check','The config file exists.')); } elseif (is_writable($inc_directory)) { $messages[] = new Message('info', __f('Check','The config file directory (%s) is writable.', $inc_directory)); } else { $messages[] = new Message('danger', __f('Check','The config file directory (%s) is not writable and the config file (%s) does not exists.', $inc_directory, $conf_filename)); } // Security if (extension_loaded('openssl')) { $messages[] = new Message('info', __('Check','OpenSSL extension loaded.')); } else { $messages[] = new Message('warning', __('Check','Consider enabling the PHP extension OpenSSL for increased security.')); } if (ini_get('session.cookie_httponly') === '1') { $messages[] = new Message('info', __('Check', 'Cookies are served from HTTP only.')); } else { $messages[] = new Message('warning', __('Check', "Consider setting « session.cookie_httponly = 1 » inside your php.ini or add « php_value session.cookie_httponly 1 » to your .htaccess so that cookies can't be accessed through Javascript.")); } // Datetime $timezone = ini_get('date.timezone'); if (!empty($timezone)) { $messages[] = new Message('info', __('Check','date.timezone is set.')); } else { $messages[] = new Message('warning', __('Check','Consider setting the date.timezone in php.ini.')); } // The percentage of steps needed to be ready to launch the application $errors = 0; $warnings = 0; foreach ($messages as $message) { if ($message->type === 'danger') { $errors++; } else if ($message->type === 'warning') { $warnings++; } } $readyPercentage = round((count($messages)-$errors)*100/count($messages)); if ($errors > 0) { $readyClass = 'danger'; } else if ($warnings > 0) { $readyClass = 'warning'; } else { $readyClass = 'success'; } usort($messages, 'compareCheckMessage'); ?> <?=__('Check', 'Installation checking') ?>

%
type . '" role="alert">'; echo Utils::htmlEscape($message->message); echo '' . $message->type . ''; echo '
'; } ?>