A free, self-hostable news aggregator…
Test si crypt() fonctionne pour PHP 5.3.3
Alexandre Alapetitedb120b4ed415
diff --git a/README.md b/README.mdindex 519db7e76..2b54ff9d5 100644--- a/README.md+++ b/README.md@@ -43,7 +43,7 @@ Privilégiez pour cela des demandes sur GitHub# Contrôle d’accèsIl est requis pour le mode multi-utilisateur, et recommandé dans tous les cas, de limiter l’accès à votre FreshRSS. Au choix :-* En utilisant l’identification par formulaire (requiert PHP 5.3.4+ et JavaScript)+* En utilisant l’identification par formulaire (requiert JavaScript, et PHP 5.3.7+ recommandé – fonctionne avec certaines versions de PHP5.3.3+)* En utilisant l’identification par [Mozilla Persona](https://login.persona.org/about) incluse dans FreshRSS* En utilisant un contrôle d’accès HTTP défini par votre serveur Web* Voir par exemple la [documentation d’Apache sur l’authentification](http://httpd.apache.org/docs/trunk/howto/auth.html)diff --git a/app/views/configure/users.phtml b/app/views/configure/users.phtmlindex 18e4dd091..0677db881 100644--- a/app/views/configure/users.phtml+++ b/app/views/configure/users.phtml@@ -52,7 +52,7 @@<?php if (!in_array(Minz_Configuration::authType(), array('form', 'persona', 'http_auth', 'none'))) { ?><option selected="selected"></option><?php } ?>- <option value="form"<?php echo Minz_Configuration::authType() === 'form' ? ' selected="selected"' : '', version_compare(PHP_VERSION, '5.3.4', '<') ? ' disabled="disabled"' : ''; ?>><?php echo Minz_Translate::t('auth_form'); ?></option>+ <option value="form"<?php echo Minz_Configuration::authType() === 'form' ? ' selected="selected"' : '', cryptAvailable() ? '' : ' disabled="disabled"'; ?>><?php echo Minz_Translate::t('auth_form'); ?></option><option value="persona"<?php echo Minz_Configuration::authType() === 'persona' ? ' selected="selected"' : '', $this->conf->mail_login == '' ? ' disabled="disabled"' : ''; ?>><?php echo Minz_Translate::t('auth_persona'); ?></option><option value="http_auth"<?php echo Minz_Configuration::authType() === 'http_auth' ? ' selected="selected"' : '', httpAuthUser() == '' ? ' disabled="disabled"' : ''; ?>><?php echo Minz_Translate::t('http_auth'); ?> (REMOTE_USER = '<?php echo httpAuthUser(); ?>')</option><option value="none"<?php echo Minz_Configuration::authType() === 'none' ? ' selected="selected"' : ''; ?>><?php echo Minz_Translate::t('auth_none'); ?></option>diff --git a/lib/lib_rss.php b/lib/lib_rss.phpindex a13d9e951..8c6fb5543 100644--- a/lib/lib_rss.php+++ b/lib/lib_rss.php@@ -233,3 +233,14 @@ function listUsers() {function httpAuthUser() {return isset($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'] : '';}++function cryptAvailable() {+ if (version_compare(PHP_VERSION, '5.3.3', '>=')) {+ try {+ $hash = '$2y$04$usesomesillystringfore7hnbRJHxXVLeakoG8K30oukPsA.ztMG';+ return $hash === @crypt('password', $hash);+ } catch (Exception $e) {+ }+ }+ return false;+}diff --git a/p/i/install.php b/p/i/install.phpindex dd38fab1f..720813323 100644--- a/p/i/install.php+++ b/p/i/install.php@@ -837,7 +837,7 @@ function printStep2 () {<?php if (!in_array($_SESSION['auth_type'], array('form', 'persona', 'http_auth', 'none'))) { ?><option selected="selected"></option><?php } ?>- <option value="form"<?php echo $_SESSION['auth_type'] === 'form' ? ' selected="selected"' : '', version_compare(PHP_VERSION, '5.3.4', '<') ? ' disabled="disabled"' : ''; ?>><?php echo _t('auth_form'); ?></option>+ <option value="form"<?php echo $_SESSION['auth_type'] === 'form' ? ' selected="selected"' : '', cryptAvailable() ? '' : ' disabled="disabled"'; ?>><?php echo _t('auth_form'); ?></option><option value="persona"<?php echo $_SESSION['auth_type'] === 'persona' ? ' selected="selected"' : ''; ?>><?php echo _t('auth_persona'); ?></option><option value="http_auth"<?php echo $_SESSION['auth_type'] === 'http_auth' ? ' selected="selected"' : '', httpAuthUser() == '' ? ' disabled="disabled"' : ''; ?>><?php echo _t('http_auth'); ?> (REMOTE_USER = '<?php echo httpAuthUser(); ?>')</option><option value="none"<?php echo $_SESSION['auth_type'] === 'none' ? ' selected="selected"' : ''; ?>><?php echo _t('auth_none'); ?></option>