فهرست منبع

Check that PHP session is working during install (#3430)

* Check that PHP session is working during install

#fix https://github.com/FreshRSS/FreshRSS/issues/3198

* Minor whitespace

* Missing he
Alexandre Alapetite 5 سال پیش
والد
کامیت
a626e5fff8

+ 3 - 0
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',

+ 3 - 0
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',

+ 3 - 0
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',

+ 3 - 0
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',

+ 3 - 0
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!',

+ 3 - 0
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',

+ 3 - 0
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' => 'סיום',

+ 3 - 0
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',

+ 3 - 0
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' => '마침',

+ 3 - 0
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',

+ 3 - 0
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',

+ 3 - 0
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 - Translation

+ 3 - 0
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',

+ 3 - 0
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' => 'Это конец',

+ 3 - 0
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',

+ 3 - 0
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',

+ 3 - 0
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' => '最后一步',

+ 12 - 6
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">

+ 1 - 0
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',