From cf9ee9113d32a2f8b2d8a6344fd8b6486a037892 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 11 May 2019 17:37:16 +0800 Subject: [PATCH] PHP library mcrypt is no longer a thing --- code/web/public_php/setup/install.php | 11 ++--------- code/web/public_php/setup/upgrade.php | 7 ------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/code/web/public_php/setup/install.php b/code/web/public_php/setup/install.php index 438a5c332..67f27f5c0 100644 --- a/code/web/public_php/setup/install.php +++ b/code/web/public_php/setup/install.php @@ -35,13 +35,6 @@ require_once('setup/version.php'); printalert("danger", "No server roles selected"); $continue = false; } - - if ($continue) { - if (!extension_loaded('mcrypt')) { - printalert("danger", "The mcrypt extension is missing. Please check your PHP configuration"); - $continue = false; - } - } if ($continue) { try { @@ -161,8 +154,8 @@ require_once('setup/version.php'); $config = str_replace("%nelDomainName%", addslashes($_POST["nelDomainName"]), $config); $config = str_replace("%nelSetupVersion%", addslashes($NEL_SETUP_VERSION), $config); $cryptKeyLength = 16; - $cryptKey = str_replace("=", "", base64_encode(mcrypt_create_iv(ceil(0.75 * $cryptKeyLength), MCRYPT_DEV_URANDOM))); - $cryptKeyIMAP = 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 = substr(str_replace(['+', '/', '='], '', base64_encode(random_bytes($cryptKeyLength * 2))), 0, $cryptKeyLength); $config = str_replace("%cryptKey%", addslashes($cryptKey), $config); $config = str_replace("%cryptKeyIMAP%", addslashes($cryptKeyIMAP), $config); if (file_put_contents("config.php", $config)) { diff --git a/code/web/public_php/setup/upgrade.php b/code/web/public_php/setup/upgrade.php index cc157a997..b29c04e2c 100644 --- a/code/web/public_php/setup/upgrade.php +++ b/code/web/public_php/setup/upgrade.php @@ -28,13 +28,6 @@ if (!isset($NEL_SETUP_VERSION_CONFIGURED)) { 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")) { $continue = upgrade_support_databases($continue); }