diff --git a/actions/admin/settings/210.security.php b/actions/admin/settings/210.security.php index 2deddcd5..4456b6e1 100644 --- a/actions/admin/settings/210.security.php +++ b/actions/admin/settings/210.security.php @@ -45,7 +45,7 @@ return array( 'type' => 'option', 'default' => 0, 'option_mode' => 'one', - 'option_options' => array(0 => $lng['serversettings']['systemdefault'], 1 => 'MD5', 2 => 'BLOWFISH', 3 => 'SHA-256', 4 => 'SHA-512'), + 'option_options_method' => 'getAvailablePasswordHashes', 'save_method' => 'storeSettingField', ), 'system_allow_error_report_admin' => array( diff --git a/lib/functions/system/function.getAvailablePasswordHashes.php b/lib/functions/system/function.getAvailablePasswordHashes.php new file mode 100644 index 00000000..4975d264 --- /dev/null +++ b/lib/functions/system/function.getAvailablePasswordHashes.php @@ -0,0 +1,46 @@ + (2014-) + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package Functions + * + * @since 0.9.33.1 + */ + +/** + * return an array of available hashes for the crypt() function + * + * @return array + */ +function getAvailablePasswordHashes() +{ + global $lng; + + // get available pwd-hases + $available_pwdhashes = array( + 0 => $lng['serversettings']['systemdefault'] + ); + if (defined('CRYPT_MD5') && CRYPT_MD5 == 1) { + $available_pwdhashes[1] = 'MD5'; + } + if (defined('CRYPT_BLOWFISH') && CRYPT_BLOWFISH == 1) { + $available_pwdhashes[2] = 'BLOWFISH'; + } + if (defined('CRYPT_SHA256') && CRYPT_SHA256 == 1) { + $available_pwdhashes[3] = 'SHA-256'; + } + if (defined('CRYPT_SHA512') && CRYPT_SHA512 == 1) { + $available_pwdhashes[4] = 'SHA-512'; + } + + return $available_pwdhashes; +}