From: Fabrixxm Date: Tue, 22 Sep 2015 07:50:24 +0000 (+0200) Subject: Adds checks for mcrypt module for RINO2 X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=554948c22ae1783876e28793073341a3027a5e4d;p=friendica.git Adds checks for mcrypt module for RINO2 - check for module on install - check for module when RINO2 is enabled in admin - check for module when RINO2 is used in communications --- diff --git a/include/items.php b/include/items.php index b00942b5ae..6378267570 100644 --- a/include/items.php +++ b/include/items.php @@ -2000,6 +2000,8 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) { $rino = get_config('system','rino_encrypt'); $rino = intval($rino); + // use RINO1 if mcrypt isn't installed and RINO2 was selected + if ($rino==2 and !function_exists('mcrypt_create_iv')) $rino=1; logger("Local rino version: ". $rino, LOGGER_DEBUG); diff --git a/mod/admin.php b/mod/admin.php index 002d332cb6..878508a23f 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -551,7 +551,12 @@ function admin_page_site_post(&$a){ set_config('system','old_pager', $old_pager); set_config('system','only_tag_search', $only_tag_search); - set_config('system','rino_encrypt', $rino); + + if ($rino==2 and !function_exists('mcrypt_create_iv')){ + notice(t("RINO2 needs mcrypt php extension to work.")); + } else { + set_config('system','rino_encrypt', $rino); + } set_config('system','embedly', $embedly); diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index fe7adca413..fcc5726548 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -137,6 +137,8 @@ function dfrn_notify_post(&$a) { $rino = get_config('system','rino_encrypt'); $rino = intval($rino); + // use RINO1 if mcrypt isn't installed and RINO2 was selected + if ($rino==2 and !function_exists('mcrypt_create_iv')) $rino=1; logger("Local rino version: ". $rino, LOGGER_DEBUG); @@ -307,7 +309,9 @@ function dfrn_notify_content(&$a) { $rino = get_config('system','rino_encrypt'); $rino = intval($rino); - + // use RINO1 if mcrypt isn't installed and RINO2 was selected + if ($rino==2 and !function_exists('mcrypt_create_iv')) $rino=1; + logger("Local rino version: ". $rino, LOGGER_DEBUG); // if requested rino is lower than enabled local rino, lower local rino version diff --git a/mod/install.php b/mod/install.php index 99ebfc6bab..182495d258 100755 --- a/mod/install.php +++ b/mod/install.php @@ -392,6 +392,7 @@ function check_funcs(&$checks) { check_add($ck_funcs, t('OpenSSL PHP module'), true, true, ""); check_add($ck_funcs, t('mysqli PHP module'), true, true, ""); check_add($ck_funcs, t('mb_string PHP module'), true, true, ""); + check_add($ck_funcs, t('mcrypt PHP module'), true, true, ""); if(function_exists('apache_get_modules')){ @@ -422,7 +423,13 @@ function check_funcs(&$checks) { $ck_funcs[4]['status']= false; $ck_funcs[4]['help']= t('Error: mb_string PHP module required but not installed.'); } + if(! function_exists('mcrypt_create_iv')){ + $ck_funcs[5]['status']= false; + $ck_funcs[5]['help']= t('Error: mcrypt PHP module required but not installed.'); + } + + $checks = array_merge($checks, $ck_funcs); /*if((x($_SESSION,'sysmsg')) && is_array($_SESSION['sysmsg']) && count($_SESSION['sysmsg']))