A free, self-hostable news aggregator…
Check that PHP session is working during install (#3430)
Alexandre Alapetitea626e5fff8d1
diff --git a/app/i18n/cz/install.php b/app/i18n/cz/install.phpindex 4d97a92bf..cebad4aee 100644--- a/app/i18n/cz/install.php+++ b/app/i18n/cz/install.php@@ -121,6 +121,9 @@ return array(),'not_deleted' => 'Nastala chyba, soubor <em>%s</em> musíte smazat ručně.','ok' => 'Instalace byla úspěšná.',+ 'session' => array(+ 'nok' => 'The web server seems to be incorrectly configured for cookies required for PHP sessions!', // TODO - Translation+ ),'step' => 'krok %d','steps' => 'Kroky','this_is_the_end' => 'Konec',diff --git a/app/i18n/de/install.php b/app/i18n/de/install.phpindex 693b0b2d7..8aad28ad2 100644--- a/app/i18n/de/install.php+++ b/app/i18n/de/install.php@@ -121,6 +121,9 @@ return array(),'not_deleted' => 'Etwas ist schiefgelaufen; Sie müssen die Datei <em>%s</em> manuell löschen.','ok' => 'Der Installationsvorgang war erfolgreich.',+ 'session' => array(+ 'nok' => 'The web server seems to be incorrectly configured for cookies required for PHP sessions!', // TODO - Translation+ ),'step' => 'Schritt %d','steps' => 'Schritte','this_is_the_end' => 'Das ist das Ende',diff --git a/app/i18n/en-us/install.php b/app/i18n/en-us/install.phpindex 9e8b0ff9e..6808a8c77 100644--- a/app/i18n/en-us/install.php+++ b/app/i18n/en-us/install.php@@ -121,6 +121,9 @@ return array(),'not_deleted' => 'Something went wrong; you must delete the file <em>%s</em> manually.','ok' => 'The installation process was successful.',+ 'session' => array(+ 'nok' => 'The web server seems to be incorrectly configured for cookies required for PHP sessions!',+ ),'step' => 'step %d','steps' => 'Steps','this_is_the_end' => 'This is the end',diff --git a/app/i18n/en/install.php b/app/i18n/en/install.phpindex 9551d1d75..b06e47bb2 100644--- a/app/i18n/en/install.php+++ b/app/i18n/en/install.php@@ -121,6 +121,9 @@ return array(),'not_deleted' => 'Something went wrong; you must delete the file <em>%s</em> manually.','ok' => 'The installation process was successful.',+ 'session' => array(+ 'nok' => 'The web server seems to be incorrectly configured for cookies required for PHP sessions!',+ ),'step' => 'step %d','steps' => 'Steps','this_is_the_end' => 'This is the end',diff --git a/app/i18n/es/install.php b/app/i18n/es/install.phpindex cbe7140b3..fe4538cb5 100755--- a/app/i18n/es/install.php+++ b/app/i18n/es/install.php@@ -121,6 +121,9 @@ return array(),'not_deleted' => 'Parece que ha habido un error. Debes eliminar el archivo <em>%s</em> de forma manual.','ok' => 'La instalación se ha completado correctamente.',+ 'session' => array(+ 'nok' => 'The web server seems to be incorrectly configured for cookies required for PHP sessions!', // TODO - Translation+ ),'step' => 'paso %d','steps' => 'Pasos','this_is_the_end' => '¡Terminamos!',diff --git a/app/i18n/fr/install.php b/app/i18n/fr/install.phpindex 6b36d2b7b..c92bd3ca2 100644--- a/app/i18n/fr/install.php+++ b/app/i18n/fr/install.php@@ -121,6 +121,9 @@ return array(),'not_deleted' => 'Quelque chose s’est mal passé, vous devez supprimer le fichier <em>%s</em> à la main.','ok' => 'L’installation s’est bien passée.',+ 'session' => array(+ 'nok' => 'Le serveur Web semble mal configué pour les cookies nécessaires aux sessions PHP!',+ ),'step' => 'étape %d','steps' => 'Étapes','this_is_the_end' => 'This is the end',diff --git a/app/i18n/he/install.php b/app/i18n/he/install.phpindex e36ff6226..1cc289c14 100644--- a/app/i18n/he/install.php+++ b/app/i18n/he/install.php@@ -121,6 +121,9 @@ return array(),'not_deleted' => 'משהו נכשל; יש צורך למחוק את הקובץ <em>%s</em> ידנית.','ok' => 'The installation process was successful.', // TODO - Translation+ 'session' => array(+ 'nok' => 'The web server seems to be incorrectly configured for cookies required for PHP sessions!', // TODO - Translation+ ),'step' => 'step %d', // TODO - Translation'steps' => 'שלבים','this_is_the_end' => 'סיום',diff --git a/app/i18n/it/install.php b/app/i18n/it/install.phpindex e1eab2ca4..7f5de42d8 100644--- a/app/i18n/it/install.php+++ b/app/i18n/it/install.php@@ -121,6 +121,9 @@ return array(),'not_deleted' => 'Qualcosa non ha funzionato; devi cancellare il file <em>%s</em> manualmente.','ok' => 'Processo di installazione terminato con successo.',+ 'session' => array(+ 'nok' => 'The web server seems to be incorrectly configured for cookies required for PHP sessions!', // TODO - Translation+ ),'step' => 'Passaggio %d','steps' => 'Passaggi','this_is_the_end' => 'Fine',diff --git a/app/i18n/kr/install.php b/app/i18n/kr/install.phpindex 64e1680a4..b0afe532c 100644--- a/app/i18n/kr/install.php+++ b/app/i18n/kr/install.php@@ -121,6 +121,9 @@ return array(),'not_deleted' => '무언가 잘못되었습니다; <em>%s</em> 파일을 직접 삭제해주세요.','ok' => '설치 과정이 성공적으로 끝났습니다.',+ 'session' => array(+ 'nok' => 'The web server seems to be incorrectly configured for cookies required for PHP sessions!', // TODO - Translation+ ),'step' => '단계 %d','steps' => '단계','this_is_the_end' => '마침',diff --git a/app/i18n/nl/install.php b/app/i18n/nl/install.phpindex 739eb44c7..dcab37fdd 100644--- a/app/i18n/nl/install.php+++ b/app/i18n/nl/install.php@@ -121,6 +121,9 @@ return array(),'not_deleted' => 'Er ging iets fout! U moet het bestand <em>%s</em> handmatig verwijderen.','ok' => 'De installatieprocedure is geslaagd.',+ 'session' => array(+ 'nok' => 'The web server seems to be incorrectly configured for cookies required for PHP sessions!', // TODO - Translation+ ),'step' => 'stap %d','steps' => 'Stappen','this_is_the_end' => 'Dit is het einde',diff --git a/app/i18n/oc/install.php b/app/i18n/oc/install.phpindex 80817f808..770b1aebc 100644--- a/app/i18n/oc/install.php+++ b/app/i18n/oc/install.php@@ -121,6 +121,9 @@ return array(),'not_deleted' => 'Quicòm a trucat, sembla qu’avètz suprimit <em>%s</em> a la man.','ok' => 'L’installacion s’es corrèctament passada.',+ 'session' => array(+ 'nok' => 'The web server seems to be incorrectly configured for cookies required for PHP sessions!', // TODO - Translation+ ),'step' => 'etapa %d','steps' => 'Etapas','this_is_the_end' => 'Es la fin',diff --git a/app/i18n/pl/install.php b/app/i18n/pl/install.phpindex 658744453..c8f7c98e3 100644--- a/app/i18n/pl/install.php+++ b/app/i18n/pl/install.php@@ -121,6 +121,9 @@ return array(),'not_deleted' => 'Something went wrong; you must delete the file <em>%s</em> manually.', // TODO - Translation'ok' => 'The installation process was successful.', // TODO - Translation+ 'session' => array(+ 'nok' => 'The web server seems to be incorrectly configured for cookies required for PHP sessions!', // TODO - Translation+ ),'step' => 'step %d', // TODO - Translation'steps' => 'Steps', // TODO - Translation'this_is_the_end' => 'This is the end', // TODO - Translationdiff --git a/app/i18n/pt-br/install.php b/app/i18n/pt-br/install.phpindex e74add675..abb5f6982 100644--- a/app/i18n/pt-br/install.php+++ b/app/i18n/pt-br/install.php@@ -121,6 +121,9 @@ return array(),'not_deleted' => 'Algo deu errado; você deve deletar o arquivo <em>%s</em> manualmente.','ok' => 'O processo de instalação foi um sucesso.',+ 'session' => array(+ 'nok' => 'The web server seems to be incorrectly configured for cookies required for PHP sessions!', // TODO - Translation+ ),'step' => 'passo %d','steps' => 'Passos','this_is_the_end' => 'Este é o final',diff --git a/app/i18n/ru/install.php b/app/i18n/ru/install.phpindex 7925a609e..a8db3f436 100644--- a/app/i18n/ru/install.php+++ b/app/i18n/ru/install.php@@ -121,6 +121,9 @@ return array(),'not_deleted' => 'Что-то пошло не так; удалите файл <em>%s</em> вручную.','ok' => 'Установка успешна.',+ 'session' => array(+ 'nok' => 'The web server seems to be incorrectly configured for cookies required for PHP sessions!', // TODO - Translation+ ),'step' => '%d этап','steps' => 'Этапы','this_is_the_end' => 'Это конец',diff --git a/app/i18n/sk/install.php b/app/i18n/sk/install.phpindex 9cf9a7f45..998119102 100644--- a/app/i18n/sk/install.php+++ b/app/i18n/sk/install.php@@ -121,6 +121,9 @@ return array(),'not_deleted' => 'Niečo sa nepodarilo. Musíte ručne zmazať súbor <em>%s</em>.','ok' => 'Inštalácia bola úspešná.',+ 'session' => array(+ 'nok' => 'The web server seems to be incorrectly configured for cookies required for PHP sessions!', // TODO - Translation+ ),'step' => 'krok %d','steps' => 'Kroky','this_is_the_end' => 'Toto je koniec',diff --git a/app/i18n/tr/install.php b/app/i18n/tr/install.phpindex fe5991939..e4c9bd10d 100644--- a/app/i18n/tr/install.php+++ b/app/i18n/tr/install.php@@ -121,6 +121,9 @@ return array(),'not_deleted' => 'Hata meydana geldi; <em>%s</em> dosyasını elle silmelisiniz.','ok' => 'Kurulum başarıyla tamamlandı.',+ 'session' => array(+ 'nok' => 'The web server seems to be incorrectly configured for cookies required for PHP sessions!', // TODO - Translation+ ),'step' => 'adım %d','steps' => 'Adımlar','this_is_the_end' => 'Son Adım',diff --git a/app/i18n/zh-cn/install.php b/app/i18n/zh-cn/install.phpindex a06ac6e9c..fa6fd9f90 100644--- a/app/i18n/zh-cn/install.php+++ b/app/i18n/zh-cn/install.php@@ -121,6 +121,9 @@ return array(),'not_deleted' => '出错!你必须手动删除文件 <em>%s</em>','ok' => '安装成功',+ 'session' => array(+ 'nok' => 'The web server seems to be incorrectly configured for cookies required for PHP sessions!', // TODO - Translation+ ),'step' => '步骤 %d','steps' => '步骤','this_is_the_end' => '最后一步',diff --git a/app/install.php b/app/install.phpindex 76183e3cc..366fa9a36 100644--- a/app/install.php+++ b/app/install.php@@ -56,6 +56,7 @@ function saveLanguage() {}Minz_Session::_param('language', $_POST['language']);+ Minz_Session::_param('sessionWorking', 'ok');header('Location: index.php?step=1');}@@ -242,13 +243,13 @@ function checkStep() {$s1 = checkRequirements();$s2 = checkStep2();$s3 = checkStep3();- if (STEP > 0 && $s0['all'] != 'ok') {+ if (STEP > 0 && $s0['all'] !== 'ok') {header('Location: index.php?step=0');- } elseif (STEP > 1 && $s1['all'] != 'ok') {+ } elseif (STEP > 1 && $s1['all'] !== 'ok') {header('Location: index.php?step=1');- } elseif (STEP > 2 && $s2['all'] != 'ok') {+ } elseif (STEP > 2 && $s2['all'] !== 'ok') {header('Location: index.php?step=2');- } elseif (STEP > 3 && $s3['all'] != 'ok') {+ } elseif (STEP > 3 && $s3['all'] !== 'ok') {header('Location: index.php?step=3');}Minz_Session::_param('actualize_feeds', true);@@ -257,10 +258,12 @@ function checkStep() {function checkStep0() {$languages = Minz_Translate::availableLanguages();$language = Minz_Session::param('language') != '' && in_array(Minz_Session::param('language'), $languages);+ $sessionWorking = Minz_Session::param('sessionWorking') === 'ok';return array('language' => $language ? 'ok' : 'ko',- 'all' => $language ? 'ok' : 'ko'+ 'sessionWorking' => $sessionWorking ? 'ok' : 'ko',+ 'all' => $language && $sessionWorking ? 'ok' : 'ko');}@@ -329,9 +332,12 @@ function checkStep3() {function printStep0() {$actual = Minz_Translate::language();$languages = Minz_Translate::availableLanguages();+ $s0 = checkStep0();?>- <?php $s0 = checkStep0(); if ($s0['all'] == 'ok') { ?>+ <?php if ($s0['all'] === 'ok') { ?><p class="alert alert-success"><span class="alert-head"><?= _t('gen.short.ok') ?></span> <?= _t('install.language.defined') ?></p>+ <?php } else if (!empty($_POST) && $s0['sessionWorking'] !== 'ok') { ?>+ <p class="alert alert-error"><span class="alert-head"><?= _t('gen.short.damn') ?></span> <?= _t('install.session.nok') ?></p><?php } ?><form action="index.php?step=0" method="post">diff --git a/cli/i18n/ignore/en-us.php b/cli/i18n/ignore/en-us.phpindex c8432e83e..5db330fb4 100644--- a/cli/i18n/ignore/en-us.php+++ b/cli/i18n/ignore/en-us.php@@ -690,6 +690,7 @@ return array('install.language.defined','install.not_deleted','install.ok',+ 'install.session.nok','install.step','install.steps','install.this_is_the_end',