A free, self-hostable news aggregator…
Test HTTP REFERER in install.php
Marien Fressinaud75bf305b2f08
diff --git a/app/i18n/install.en.php b/app/i18n/install.en.phpindex 50208fcef..487b5073a 100644--- a/app/i18n/install.en.php+++ b/app/i18n/install.en.php@@ -42,6 +42,8 @@ return array ('data_is_ok' => 'Permissions on data directory are good','persona_is_ok' => 'Permissions on Mozilla Persona directory are good','file_is_nok' => 'Check permissions on <em>%s</em> directory. HTTP server must have rights to write into',+ 'http_referer_is_ok' => 'Your HTTP REFERER is known and corresponds to your server.',+ 'http_referer_is_nok' => 'Please check you are not altering your HTTP REFERER.','fix_errors_before' => 'Fix errors before skip to the next step.','general_conf_is_ok' => 'General configuration has been saved.',diff --git a/app/i18n/install.fr.php b/app/i18n/install.fr.phpindex 9c039f904..785c02459 100644--- a/app/i18n/install.fr.php+++ b/app/i18n/install.fr.php@@ -42,6 +42,8 @@ return array ('data_is_ok' => 'Les droits sur le répertoire de data sont bons','persona_is_ok' => 'Les droits sur le répertoire de Mozilla Persona sont bons','file_is_nok' => 'Veuillez vérifier les droits sur le répertoire <em>%s</em>. Le serveur HTTP doit être capable d’écrire dedans',+ 'http_referer_is_ok' => 'Le HTTP REFERER est connu et semble correspondre à votre serveur.',+ 'http_referer_is_nok' => 'Veuillez vérifier que vous ne modifiez pas votre HTTP REFERER.','fix_errors_before' => 'Veuillez corriger les erreurs avant de passer à l’étape suivante.','general_conf_is_ok' => 'La configuration générale a été enregistrée.',diff --git a/app/install.php b/app/install.phpindex 8986e9965..f31764545 100644--- a/app/install.php+++ b/app/install.php@@ -307,6 +307,7 @@ function checkStep1() {$log = LOG_PATH && is_writable(LOG_PATH);$favicons = is_writable(DATA_PATH . '/favicons');$persona = is_writable(DATA_PATH . '/persona');+ $http_referer = !empty($_SERVER['HTTP_REFERER']);return array('php' => $php ? 'ok' : 'ko',@@ -323,8 +324,10 @@ function checkStep1() {'log' => $log ? 'ok' : 'ko','favicons' => $favicons ? 'ok' : 'ko','persona' => $persona ? 'ok' : 'ko',+ 'http_referer' => $http_referer ? 'ok' : 'ko','all' => $php && $minz && $curl && $pdo && $pcre && $ctype && $dom &&- $data && $cache && $log && $favicons && $persona ? 'ok' : 'ko'+ $data && $cache && $log && $favicons && $persona && $http_referer ?+ 'ok' : 'ko');}@@ -548,6 +551,12 @@ function printStep1() {<p class="alert alert-error"><span class="alert-head"><?php echo _t('damn'); ?></span> <?php echo _t('file_is_nok', DATA_PATH . '/persona'); ?></p><?php } ?>+ <?php if ($res['http_referer'] == 'ok') { ?>+ <p class="alert alert-success"><span class="alert-head"><?php echo _t('ok'); ?></span> <?php echo _t('http_referer_is_ok'); ?></p>+ <?php } else { ?>+ <p class="alert alert-error"><span class="alert-head"><?php echo _t('damn'); ?></span> <?php echo _t('http_referer_is_nok'); ?></p>+ <?php } ?>+<?php if ($res['all'] == 'ok') { ?><a class="btn btn-important next-step" href="?step=2"><?php echo _t('next_step'); ?></a><?php } else { ?>