From f046cbdf95b1490fc5dcbfef2901f7c0a66753ae Mon Sep 17 00:00:00 2001 From: Antonin Date: Wed, 4 May 2016 00:57:45 +0200 Subject: [PATCH 1/5] Check.php --- admin/check.php | 221 ++++++++++++++++++++++++++++++++++++++++ app/inc/constants.php | 6 ++ app/inc/php_version.php | 29 ++++++ app/inc/smarty.php | 2 +- locale/de.json | 18 ++++ locale/en.json | 20 +++- locale/es.json | 20 +++- locale/fr.json | 18 ++++ locale/it.json | 20 +++- locale/oc.json | 20 +++- 10 files changed, 369 insertions(+), 5 deletions(-) create mode 100644 admin/check.php create mode 100644 app/inc/php_version.php diff --git a/admin/check.php b/admin/check.php new file mode 100644 index 0000000..d389007 --- /dev/null +++ b/admin/check.php @@ -0,0 +1,221 @@ +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', +]; +const DEFAULT_LANGUAGE = 'en'; +require_once ROOT_DIR . 'app/inc/i18n.php'; +require_once '../app/inc/php_version.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 = array( + '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 = array(); +$inc_directory = ROOT_DIR. 'app/inc/'; +$conf_filename = $inc_directory . 'config.php'; + +/** + * Messages + */ + +// PHP Version +if (PHP_VERSION_ID >= php_string_to_version_id(PHP_NEEDED_VERSION)) { + $messages[] = new Message('info', __f('Check','PHP version %s is enough (needed at least PHP %s).',phpversion(), 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 writable ? +if (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', __('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) dos 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.')); +} + +// Datetime +if (!empty(ini_get('date.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)); +$readyClass = 'success'; +if ($errors > 0) { + $readyClass = 'danger'; +} else if ($warnings > 0) { + $readyClass = 'warning'; +} + +usort($messages, 'compareCheckMessage'); + +?> + + + + + + <?=__('Check', 'Installation checking') ?> + + + + + + +
+
+
+
+ + + + +
+
+
+
+
+

+
+
+
+ % +
+
+
+
+ type .'" role="alert">'; + echo Utils::htmlEscape($message->message); + echo ''. $message->type .''; + echo '
'; + } + ?> +
+
+
+ + + + + + +
+
+ + \ No newline at end of file diff --git a/app/inc/constants.php b/app/inc/constants.php index 642072f..c559860 100644 --- a/app/inc/constants.php +++ b/app/inc/constants.php @@ -20,6 +20,12 @@ // FRAMADATE version const VERSION = '1.0'; +// PHP Needed version +const PHP_NEEDED_VERSION = '5.4.4'; + +// Config constants +const COMPILE_DIR = '/tpl_c/'; + // Regex const POLL_REGEX = '/^[a-z0-9-]*$/i'; const ADMIN_POLL_REGEX = '/^[a-z0-9]{24}$/i'; diff --git a/app/inc/php_version.php b/app/inc/php_version.php new file mode 100644 index 0000000..c837b9a --- /dev/null +++ b/app/inc/php_version.php @@ -0,0 +1,29 @@ + \ No newline at end of file diff --git a/app/inc/smarty.php b/app/inc/smarty.php index 7dfb2a4..39f191c 100644 --- a/app/inc/smarty.php +++ b/app/inc/smarty.php @@ -21,7 +21,7 @@ use Framadate\Utils; require_once __DIR__ . '/../../vendor/smarty/smarty/libs/Smarty.class.php'; $smarty = new \Smarty(); $smarty->setTemplateDir(ROOT_DIR . '/tpl/'); -$smarty->setCompileDir(ROOT_DIR . '/tpl_c/'); +$smarty->setCompileDir(ROOT_DIR . COMPILE_DIR); $smarty->setCacheDir(ROOT_DIR . '/cache/'); $smarty->caching = false; diff --git a/locale/de.json b/locale/de.json index 48f5d5d..6d7ce50 100644 --- a/locale/de.json +++ b/locale/de.json @@ -384,5 +384,23 @@ "Passwords do not match": "DE_Les mot de passes ne correspondent pas.", "Poll id already used": "DE_L'identifiant est déjà utilisé", "You can't select more than %d dates": "DE_Vous ne pouvez pas choisir plus de %d dates" + }, + "Check": { + "Installation checking": "DE_Vérifications de l'installation", + "Your PHP version (%s) is too old. This application needs at least PHP %s.": "DE_Votre version de PHP (%s) est trop vieille. Cette application a besoin de PHP %s au moins.", + "PHP version %s is enough (needed at least PHP %s).": "DE_Version de PHP %s suffisante (nécessite au moins PHP %s).", + "You need to enable the PHP Intl extension.": "DE_Vous devez activer l'extension PHP Intl.", + "PHP Intl extension is enabled.": "DE_L'extension PHP Intl est activée.", + "The template compile directory (%s) is not writable.": "DE_Le dossier de compilation des templates (%s) n'est pas accessible en écriture.", + "The template compile directory (%s) is writable.": "DE_Le dossier de compilation des templates (%s) est accessible en écriture.", + "The config file directory (%s) is not writable and the config file (%s) dos not exists.": "DE_Le dossier du fichier de configuration (%s) n'est pas accessible en écriture et le fichier de configuration (%s) n'éxiste pas.", + "The config file exists.": "DE_Le fichier de configuration existe.", + "The config file directory (%s) is writable.": "DE_Le dossier du fichier de configuration (%s) est accessible en écriture.", + "OpenSSL extension loaded.": "DE_L'extension PHP OpenSSL est chargée.", + "Consider enabling the PHP extension OpenSSL for increased security.": "DE_Veuillez considérer l'activation de l'extension PHP OpenSSL pour améliorer la sécurité.", + "date.timezone is set.": "DE_date.timezone est défini.", + "Consider setting the date.timezone in php.ini.": "DE_Veuillez considérer la définition de date.timezone dans le php.ini.", + "Check again": "DE_Vérifier à nouveau", + "Continue the installation": "DE_Continuer l'installation" } } diff --git a/locale/en.json b/locale/en.json index c596ea1..2921bdc 100644 --- a/locale/en.json +++ b/locale/en.json @@ -385,5 +385,23 @@ "Passwords do not match": "Passwords do not match.", "Poll id already used": "Identifier is already used", "You can't select more than %d dates": "You can't select more than %d dates" - } + }, + "Check": { + "Installation checking": "Installation checking", + "Your PHP version (%s) is too old. This application needs at least PHP %s.": "Your PHP version (%s) is too old. This application needs at least PHP %s.", + "PHP version %s is enough (needed at least PHP %s).": "PHP version %s is enough (needed at least PHP %s).", + "You need to enable the PHP Intl extension.": "You need to enable the PHP Intl extension.", + "PHP Intl extension is enabled.": "PHP Intl extension is enabled.", + "The template compile directory (%s) is not writable.": "The template compile directory (%s) is not writable.", + "The template compile directory (%s) is writable.": "The template compile directory (%s) is writable.", + "The config file directory (%s) is not writable and the config file (%s) dos not exists.": "The config file directory (%s) is not writable and the config file (%s) dos not exists.", + "The config file exists.": "The config file exists.", + "The config file directory (%s) is writable.": "The config file directory (%s) is writable.", + "OpenSSL extension loaded.": "OpenSSL extension loaded.", + "Consider enabling the PHP extension OpenSSL for increased security.": "Consider enabling the PHP extension OpenSSL for increased security.", + "date.timezone is set.": "date.timezone is set.", + "Consider setting the date.timezone in php.ini.": "Consider setting the date.timezone in php.ini.", + "Check again": "Check again", + "Continue the installation": "Continue the installation" + } } \ No newline at end of file diff --git a/locale/es.json b/locale/es.json index 8294599..5eec32a 100644 --- a/locale/es.json +++ b/locale/es.json @@ -384,5 +384,23 @@ "Passwords do not match": "ES_Les mot de passes ne correspondent pas.", "Poll id already used": "ES_L'identifiant est déjà utilisé", "You can't select more than %d dates": "ES_Vous ne pouvez pas choisir plus de %d dates" - } + }, + "Check": { + "Installation checking": "ES_Vérifications de l'installation", + "Your PHP version (%s) is too old. This application needs at least PHP %s.": "ES_Votre version de PHP (%s) est trop vieille. Cette application a besoin de PHP %s au moins.", + "PHP version %s is enough (needed at least PHP %s).": "ES_Version de PHP %s suffisante (nécessite au moins PHP %s).", + "You need to enable the PHP Intl extension.": "ES_Vous devez activer l'extension PHP Intl.", + "PHP Intl extension is enabled.": "ES_L'extension PHP Intl est activée.", + "The template compile directory (%s) is not writable.": "ES_Le dossier de compilation des templates (%s) n'est pas accessible en écriture.", + "The template compile directory (%s) is writable.": "ES_Le dossier de compilation des templates (%s) est accessible en écriture.", + "The config file directory (%s) is not writable and the config file (%s) dos not exists.": "ES_Le dossier du fichier de configuration (%s) n'est pas accessible en écriture et le fichier de configuration (%s) n'éxiste pas.", + "The config file exists.": "ES_Le fichier de configuration existe.", + "The config file directory (%s) is writable.": "ES_Le dossier du fichier de configuration (%s) est accessible en écriture.", + "OpenSSL extension loaded.": "ES_L'extension PHP OpenSSL est chargée.", + "Consider enabling the PHP extension OpenSSL for increased security.": "ES_Veuillez considérer l'activation de l'extension PHP OpenSSL pour améliorer la sécurité.", + "date.timezone is set.": "ES_date.timezone est défini.", + "Consider setting the date.timezone in php.ini.": "ES_Veuillez considérer la définition de date.timezone dans le php.ini.", + "Check again": "ES_Vérifier à nouveau", + "Continue the installation": "ES_Continuer l'installation" + } } diff --git a/locale/fr.json b/locale/fr.json index ae6515e..7ce19f9 100644 --- a/locale/fr.json +++ b/locale/fr.json @@ -398,5 +398,23 @@ "Passwords do not match": "Les mots de passe ne correspondent pas.", "Poll id already used": "L'identifiant est déjà utilisé", "You can't select more than %d dates": "Vous ne pouvez pas choisir plus de %d dates" + }, + "Check": { + "Installation checking": "Vérifications de l'installation", + "Your PHP version (%s) is too old. This application needs at least PHP %s.": "Votre version de PHP (%s) est trop vieille. Cette application a besoin de PHP %s au moins.", + "PHP version %s is enough (needed at least PHP %s).": "Version de PHP %s suffisante (nécessite au moins PHP %s).", + "You need to enable the PHP Intl extension.": "Vous devez activer l'extension PHP Intl.", + "PHP Intl extension is enabled.": "L'extension PHP Intl est activée.", + "The template compile directory (%s) is not writable.": "Le dossier de compilation des templates (%s) n'est pas accessible en écriture.", + "The template compile directory (%s) is writable.": "Le dossier de compilation des templates (%s) est accessible en écriture.", + "The config file directory (%s) is not writable and the config file (%s) dos not exists.": "Le dossier du fichier de configuration (%s) n'est pas accessible en écriture et le fichier de configuration (%s) n'éxiste pas.", + "The config file exists.": "Le fichier de configuration existe.", + "The config file directory (%s) is writable.": "Le dossier du fichier de configuration (%s) est accessible en écriture.", + "OpenSSL extension loaded.": "L'extension PHP OpenSSL est chargée.", + "Consider enabling the PHP extension OpenSSL for increased security.": "Veuillez considérer l'activation de l'extension PHP OpenSSL pour améliorer la sécurité.", + "date.timezone is set.": "date.timezone est défini.", + "Consider setting the date.timezone in php.ini.": "Veuillez considérer la définition de date.timezone dans le php.ini.", + "Check again": "Vérifier à nouveau", + "Continue the installation": "Continuer l'installation" } } \ No newline at end of file diff --git a/locale/it.json b/locale/it.json index bd35988..5595587 100644 --- a/locale/it.json +++ b/locale/it.json @@ -382,5 +382,23 @@ "CANT_CONNECT_TO_DATABASE": "Impossibile connettersi al database", "Poll id already used": "IT_L'identifiant est déjà utilisé", "You can't select more than %d dates": "IT_Vous ne pouvez pas choisir plus de %d dates" - } + }, + "Check": { + "Installation checking": "IT_Vérifications de l'installation", + "Your PHP version (%s) is too old. This application needs at least PHP %s.": "IT_Votre version de PHP (%s) est trop vieille. Cette application a besoin de PHP %s au moins.", + "PHP version %s is enough (needed at least PHP %s).": "IT_Version de PHP %s suffisante (nécessite au moins PHP %s).", + "You need to enable the PHP Intl extension.": "IT_Vous devez activer l'extension PHP Intl.", + "PHP Intl extension is enabled.": "IT_L'extension PHP Intl est activée.", + "The template compile directory (%s) is not writable.": "IT_Le dossier de compilation des templates (%s) n'est pas accessible en écriture.", + "The template compile directory (%s) is writable.": "IT_Le dossier de compilation des templates (%s) est accessible en écriture.", + "The config file directory (%s) is not writable and the config file (%s) dos not exists.": "IT_Le dossier du fichier de configuration (%s) n'est pas accessible en écriture et le fichier de configuration (%s) n'éxiste pas.", + "The config file exists.": "IT_Le fichier de configuration existe.", + "The config file directory (%s) is writable.": "IT_Le dossier du fichier de configuration (%s) est accessible en écriture.", + "OpenSSL extension loaded.": "IT_L'extension PHP OpenSSL est chargée.", + "Consider enabling the PHP extension OpenSSL for increased security.": "IT_Veuillez considérer l'activation de l'extension PHP OpenSSL pour améliorer la sécurité.", + "date.timezone is set.": "IT_date.timezone est défini.", + "Consider setting the date.timezone in php.ini.": "IT_Veuillez considérer la définition de date.timezone dans le php.ini.", + "Check again": "IT_Vérifier à nouveau", + "Continue the installation": "IT_Continuer l'installation" + } } diff --git a/locale/oc.json b/locale/oc.json index 765629b..e885df1 100644 --- a/locale/oc.json +++ b/locale/oc.json @@ -380,5 +380,23 @@ "MISSING_VALUES": "Mancan de valors", "CANT_CONNECT_TO_DATABASE": "Impossible de se connectar a la banca de donadas", "You can't select more than %d dates": "OC_Vous ne pouvez pas choisir plus de %d dates" - } + }, + "Check": { + "Installation checking": "OC_Vérifications de l'installation", + "Your PHP version (%s) is too old. This application needs at least PHP %s.": "OC_Votre version de PHP (%s) est trop vieille. Cette application a besoin de PHP %s au moins.", + "PHP version %s is enough (needed at least PHP %s).": "OC_Version de PHP %s suffisante (nécessite au moins PHP %s).", + "You need to enable the PHP Intl extension.": "OC_Vous devez activer l'extension PHP Intl.", + "PHP Intl extension is enabled.": "OC_L'extension PHP Intl est activée.", + "The template compile directory (%s) is not writable.": "OC_Le dossier de compilation des templates (%s) n'est pas accessible en écriture.", + "The template compile directory (%s) is writable.": "OC_Le dossier de compilation des templates (%s) est accessible en écriture.", + "The config file directory (%s) is not writable and the config file (%s) dos not exists.": "OC_Le dossier du fichier de configuration (%s) n'est pas accessible en écriture et le fichier de configuration (%s) n'éxiste pas.", + "The config file exists.": "OC_Le fichier de configuration existe.", + "The config file directory (%s) is writable.": "OC_Le dossier du fichier de configuration (%s) est accessible en écriture.", + "OpenSSL extension loaded.": "OC_L'extension PHP OpenSSL est chargée.", + "Consider enabling the PHP extension OpenSSL for increased security.": "OC_Veuillez considérer l'activation de l'extension PHP OpenSSL pour améliorer la sécurité.", + "date.timezone is set.": "OC_date.timezone est défini.", + "Consider setting the date.timezone in php.ini.": "OC_Veuillez considérer la définition de date.timezone dans le php.ini.", + "Check again": "OC_Vérifier à nouveau", + "Continue the installation": "OC_Continuer l'installation" + } } \ No newline at end of file From 77de8f38e7ef26d4c269aaae12f6cf6dfad8f1c3 Mon Sep 17 00:00:00 2001 From: Antonin Date: Wed, 4 May 2016 00:58:31 +0200 Subject: [PATCH 2/5] Check.php is used first at install and available in admin --- index.php | 2 +- tpl/admin/index.tpl | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index 8ee6b6f..eae8073 100644 --- a/index.php +++ b/index.php @@ -23,7 +23,7 @@ use Framadate\Utils; include_once __DIR__ . '/app/inc/init.php'; if (!is_file(CONF_FILENAME)) { - header(('Location: ' . Utils::get_server_name() . 'admin/install.php')); + header(('Location: ' . Utils::get_server_name() . 'admin/check.php')); exit; } diff --git a/tpl/admin/index.tpl b/tpl/admin/index.tpl index 7d6eedb..d38e1b6 100644 --- a/tpl/admin/index.tpl +++ b/tpl/admin/index.tpl @@ -11,6 +11,9 @@ + {if $logsAreReadable}

{__('Admin', 'Logs')}

From 59f437d80e8f91ffdbfa1f410d0dad93bf02a670 Mon Sep 17 00:00:00 2001 From: Antonin Date: Wed, 4 May 2016 01:01:11 +0200 Subject: [PATCH 3/5] Updating config.tpl from config.template.php --- tpl/admin/config.tpl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tpl/admin/config.tpl b/tpl/admin/config.tpl index 9cafc7b..bb5d9dc 100644 --- a/tpl/admin/config.tpl +++ b/tpl/admin/config.tpl @@ -53,6 +53,7 @@ const DEFAULT_LANGUAGE = '{$defaultLanguage}'; $ALLOWED_LANGUAGES = [ 'fr' => 'Français', 'en' => 'English', + 'oc' => 'Occitan', 'es' => 'Español', 'de' => 'Deutsch', 'it' => 'Italiano', @@ -73,6 +74,12 @@ const LOG_FILE = 'admin/stdout.log'; // Days (after expiration date) before purge a poll const PURGE_DELAY = 60; +// Max slots per poll +const MAX_SLOTS_PER_POLL = 366; + +// Number of seconds before we allow to resend an "Remember Edit Link" email. +const TIME_EDIT_LINK_EMAIL = 60; + // Config $config = [ /* general config */ @@ -85,5 +92,4 @@ $config = [ 'default_poll_duration' => 180, // default values for the new poll duration (number of days). /* create_classic_poll.php */ 'user_can_add_img_or_link' => true, // user can add link or URL when creating his poll. -]; - +]; \ No newline at end of file From b739683d96335fcd2e6efde8f24b42325c94b046 Mon Sep 17 00:00:00 2001 From: Antonin Date: Wed, 4 May 2016 01:27:51 +0200 Subject: [PATCH 4/5] Install : check that the config.php file is written. --- app/classes/Framadate/Services/InstallService.php | 14 ++++++++------ app/inc/init.php | 4 ++-- locale/de.json | 3 ++- locale/en.json | 3 ++- locale/es.json | 3 ++- locale/fr.json | 3 ++- locale/it.json | 3 ++- locale/oc.json | 3 ++- 8 files changed, 22 insertions(+), 14 deletions(-) diff --git a/app/classes/Framadate/Services/InstallService.php b/app/classes/Framadate/Services/InstallService.php index 0db9f1f..65527ad 100644 --- a/app/classes/Framadate/Services/InstallService.php +++ b/app/classes/Framadate/Services/InstallService.php @@ -4,16 +4,16 @@ * is not distributed with this file, you can obtain one at * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt * - * Authors of STUdS (initial project): Guilhem BORGHESI (borghesi@unistra.fr) and Raphaël DROZ + * Authors of STUdS (initial project): Guilhem BORGHESI (borghesi@unistra.fr) and Rapha�l DROZ * Authors of Framadate/OpenSondate: Framasoft (https://github.com/framasoft) * * ============================= * - * Ce logiciel est régi par la licence CeCILL-B. Si une copie de cette licence + * Ce logiciel est r�gi par la licence CeCILL-B. Si une copie de cette licence * ne se trouve pas avec ce fichier vous pouvez l'obtenir sur * http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.txt * - * Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Raphaël DROZ + * Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Rapha�l DROZ * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft) */ namespace Framadate\Services; @@ -62,7 +62,9 @@ class InstallService { } // Write configuration to conf.php file - $this->writeConfiguration($smarty); + if ($this->writeConfiguration($smarty) === false) { + return $this->error(__f('Error', "Can't create the config.php file in '%s'.", CONF_FILENAME)); + } return $this->ok(); } @@ -85,14 +87,14 @@ class InstallService { $content = $smarty->fetch('admin/config.tpl'); - $this->writeToFile($content); + return $this->writeToFile($content); } /** * @param $content */ function writeToFile($content) { - file_put_contents(CONF_FILENAME, $content); + return @file_put_contents(CONF_FILENAME, $content); } /** diff --git a/app/inc/init.php b/app/inc/init.php index 8879bae..35a6ac1 100644 --- a/app/inc/init.php +++ b/app/inc/init.php @@ -34,9 +34,9 @@ if (ini_get('date.timezone') == '') { define('ROOT_DIR', __DIR__ . '/../../'); define('CONF_FILENAME', ROOT_DIR . '/app/inc/config.php'); -if (is_file(CONF_FILENAME)) { +require_once __DIR__ . '/constants.php'; - require_once __DIR__ . '/constants.php'; +if (is_file(CONF_FILENAME)) { @include_once __DIR__ . '/config.php'; // Connection to database diff --git a/locale/de.json b/locale/de.json index 6d7ce50..f80fd65 100644 --- a/locale/de.json +++ b/locale/de.json @@ -383,7 +383,8 @@ "Password is empty": "DE_Le mot de passe est vide.", "Passwords do not match": "DE_Les mot de passes ne correspondent pas.", "Poll id already used": "DE_L'identifiant est déjà utilisé", - "You can't select more than %d dates": "DE_Vous ne pouvez pas choisir plus de %d dates" + "You can't select more than %d dates": "DE_Vous ne pouvez pas choisir plus de %d dates", + "Can't create the config.php file in '%s'.": "DE_Impossible de créer le fichier config.php dans '%s'." }, "Check": { "Installation checking": "DE_Vérifications de l'installation", diff --git a/locale/en.json b/locale/en.json index 2921bdc..2523649 100644 --- a/locale/en.json +++ b/locale/en.json @@ -384,7 +384,8 @@ "Password is empty": "Password is empty.", "Passwords do not match": "Passwords do not match.", "Poll id already used": "Identifier is already used", - "You can't select more than %d dates": "You can't select more than %d dates" + "You can't select more than %d dates": "You can't select more than %d dates", + "Can't create the config.php file in '%s'.": "Can't create the config.php file in '%s'." }, "Check": { "Installation checking": "Installation checking", diff --git a/locale/es.json b/locale/es.json index 5eec32a..7d777c3 100644 --- a/locale/es.json +++ b/locale/es.json @@ -383,7 +383,8 @@ "Password is empty": "ES_Le mot de passe est vide.", "Passwords do not match": "ES_Les mot de passes ne correspondent pas.", "Poll id already used": "ES_L'identifiant est déjà utilisé", - "You can't select more than %d dates": "ES_Vous ne pouvez pas choisir plus de %d dates" + "You can't select more than %d dates": "ES_Vous ne pouvez pas choisir plus de %d dates", + "Can't create the config.php file in '%s'.": "ES_Impossible de créer le fichier config.php dans '%s'." }, "Check": { "Installation checking": "ES_Vérifications de l'installation", diff --git a/locale/fr.json b/locale/fr.json index 7ce19f9..1802c24 100644 --- a/locale/fr.json +++ b/locale/fr.json @@ -397,7 +397,8 @@ "Password is empty": "Le mot de passe est vide.", "Passwords do not match": "Les mots de passe ne correspondent pas.", "Poll id already used": "L'identifiant est déjà utilisé", - "You can't select more than %d dates": "Vous ne pouvez pas choisir plus de %d dates" + "You can't select more than %d dates": "Vous ne pouvez pas choisir plus de %d dates", + "Can't create the config.php file in '%s'.": "Impossible de créer le fichier config.php dans '%s'." }, "Check": { "Installation checking": "Vérifications de l'installation", diff --git a/locale/it.json b/locale/it.json index 5595587..e55392b 100644 --- a/locale/it.json +++ b/locale/it.json @@ -381,7 +381,8 @@ "MISSING_VALUES": "Valori mancanti", "CANT_CONNECT_TO_DATABASE": "Impossibile connettersi al database", "Poll id already used": "IT_L'identifiant est déjà utilisé", - "You can't select more than %d dates": "IT_Vous ne pouvez pas choisir plus de %d dates" + "You can't select more than %d dates": "IT_Vous ne pouvez pas choisir plus de %d dates", + "Can't create the config.php file in '%s'.": "IT_Impossible de créer le fichier config.php dans '%s'." }, "Check": { "Installation checking": "IT_Vérifications de l'installation", diff --git a/locale/oc.json b/locale/oc.json index e885df1..fea5973 100644 --- a/locale/oc.json +++ b/locale/oc.json @@ -379,7 +379,8 @@ "The column already exists": "La colomna existís ja", "MISSING_VALUES": "Mancan de valors", "CANT_CONNECT_TO_DATABASE": "Impossible de se connectar a la banca de donadas", - "You can't select more than %d dates": "OC_Vous ne pouvez pas choisir plus de %d dates" + "You can't select more than %d dates": "OC_Vous ne pouvez pas choisir plus de %d dates", + "Can't create the config.php file in '%s'.": "OC_Impossible de créer le fichier config.php dans '%s'." }, "Check": { "Installation checking": "OC_Vérifications de l'installation", From 5dead9e9e4b0424762960a96d40bc48e038e0d25 Mon Sep 17 00:00:00 2001 From: Antonin Date: Wed, 4 May 2016 11:12:59 +0200 Subject: [PATCH 5/5] Corrections following Olivier's comments --- admin/check.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/admin/check.php b/admin/check.php index d389007..878e284 100644 --- a/admin/check.php +++ b/admin/check.php @@ -138,15 +138,18 @@ $warnings = 0; foreach ($messages as $message) { if ($message->type == 'danger') { $errors++; - } else if ($message->type == 'warning') + } else if ($message->type == 'warning') { $warnings++; + } } $readyPercentage = round((count($messages)-$errors)*100/count($messages)); -$readyClass = 'success'; + if ($errors > 0) { $readyClass = 'danger'; } else if ($warnings > 0) { $readyClass = 'warning'; +} else { + $readyClass = 'success'; } usort($messages, 'compareCheckMessage'); @@ -157,7 +160,7 @@ usort($messages, 'compareCheckMessage'); - <?=__('Check', 'Installation checking') ?> + <?=__('Check', 'Installation checking') ?>