check for mcrypt during install, allow admin email account to be admin *if* it's the first account.
This commit is contained in:
parent
1dbd160392
commit
4c5d2fe0fe
@ -86,6 +86,13 @@ function check_account_admin($arr) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function account_total() {
|
||||||
|
$r = q("select account_id from account where 1");
|
||||||
|
if(is_array($r))
|
||||||
|
return count($r);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function create_account($arr) {
|
function create_account($arr) {
|
||||||
|
|
||||||
@ -110,6 +117,8 @@ function create_account($arr) {
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// prevent form hackery
|
||||||
|
|
||||||
if($roles & ACCOUNT_ROLE_ADMIN) {
|
if($roles & ACCOUNT_ROLE_ADMIN) {
|
||||||
$admin_result = check_account_admin($arr);
|
$admin_result = check_account_admin($arr);
|
||||||
if(! $admin_result) {
|
if(! $admin_result) {
|
||||||
@ -117,6 +126,13 @@ function create_account($arr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// allow the admin_email account to be admin, but only if it's the first account.
|
||||||
|
|
||||||
|
$c = account_total();
|
||||||
|
if((c === 0) && (check_account_admin($arr)))
|
||||||
|
$roles |= ACCOUNT_ROLE_ADMIN;
|
||||||
|
|
||||||
|
|
||||||
$invite_result = check_account_invite($invite_code);
|
$invite_result = check_account_invite($invite_code);
|
||||||
if($invite_result['error']) {
|
if($invite_result['error']) {
|
||||||
$result['message'] = $invite_result['message'];
|
$result['message'] = $invite_result['message'];
|
||||||
|
@ -387,6 +387,7 @@ function check_funcs(&$checks) {
|
|||||||
check_add($ck_funcs, t('OpenSSL PHP module'), true, true, "");
|
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('mysqli PHP module'), true, true, "");
|
||||||
check_add($ck_funcs, t('mb_string 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')){
|
if(function_exists('apache_get_modules')){
|
||||||
@ -417,6 +418,10 @@ function check_funcs(&$checks) {
|
|||||||
$ck_funcs[4]['status']= false;
|
$ck_funcs[4]['status']= false;
|
||||||
$ck_funcs[4]['help']= t('Error: mb_string PHP module required but not installed.');
|
$ck_funcs[4]['help']= t('Error: mb_string PHP module required but not installed.');
|
||||||
}
|
}
|
||||||
|
if(! function_exists('mcrypt_encrypt')){
|
||||||
|
$ck_funcs[4]['status']= false;
|
||||||
|
$ck_funcs[4]['help']= t('Error: mcrypt PHP module required but not installed.');
|
||||||
|
}
|
||||||
|
|
||||||
$checks = array_merge($checks, $ck_funcs);
|
$checks = array_merge($checks, $ck_funcs);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user