PHP library mcrypt is no longer a thing

This commit is contained in:
kaetemi 2019-05-11 17:37:16 +08:00
parent c916df6922
commit cf9ee9113d
2 changed files with 2 additions and 16 deletions

View file

@ -35,13 +35,6 @@ require_once('setup/version.php');
printalert("danger", "No server roles selected"); printalert("danger", "No server roles selected");
$continue = false; $continue = false;
} }
if ($continue) {
if (!extension_loaded('mcrypt')) {
printalert("danger", "The mcrypt extension is missing. Please check your PHP configuration");
$continue = false;
}
}
if ($continue) { if ($continue) {
try { try {
@ -161,8 +154,8 @@ require_once('setup/version.php');
$config = str_replace("%nelDomainName%", addslashes($_POST["nelDomainName"]), $config); $config = str_replace("%nelDomainName%", addslashes($_POST["nelDomainName"]), $config);
$config = str_replace("%nelSetupVersion%", addslashes($NEL_SETUP_VERSION), $config); $config = str_replace("%nelSetupVersion%", addslashes($NEL_SETUP_VERSION), $config);
$cryptKeyLength = 16; $cryptKeyLength = 16;
$cryptKey = str_replace("=", "", base64_encode(mcrypt_create_iv(ceil(0.75 * $cryptKeyLength), MCRYPT_DEV_URANDOM))); $cryptKey = substr(str_replace(['+', '/', '='], '', base64_encode(random_bytes($cryptKeyLength * 2))), 0, $cryptKeyLength);
$cryptKeyIMAP = str_replace("=", "", base64_encode(mcrypt_create_iv(ceil(0.75 * $cryptKeyLength), MCRYPT_DEV_URANDOM))); $cryptKeyIMAP = substr(str_replace(['+', '/', '='], '', base64_encode(random_bytes($cryptKeyLength * 2))), 0, $cryptKeyLength);
$config = str_replace("%cryptKey%", addslashes($cryptKey), $config); $config = str_replace("%cryptKey%", addslashes($cryptKey), $config);
$config = str_replace("%cryptKeyIMAP%", addslashes($cryptKeyIMAP), $config); $config = str_replace("%cryptKeyIMAP%", addslashes($cryptKeyIMAP), $config);
if (file_put_contents("config.php", $config)) { if (file_put_contents("config.php", $config)) {

View file

@ -28,13 +28,6 @@ if (!isset($NEL_SETUP_VERSION_CONFIGURED)) {
require_once('database.php'); require_once('database.php');
if ($continue) {
if (!extension_loaded('mcrypt')) {
printalert("danger", "The mcrypt extension is missing. Please check your PHP configuration");
$continue = false;
}
}
if (file_exists("role_support")) { if (file_exists("role_support")) {
$continue = upgrade_support_databases($continue); $continue = upgrade_support_databases($continue);
} }