Commit e8cd1927 authored by Francois Marier's avatar Francois Marier Committed by Gerrit Code Review
Browse files

Merge "Move site closure check to a separate function"

parents b584959f a5cf644e
......@@ -1131,15 +1131,7 @@ class LiveUser extends User {
return false;
}
$siteclosedforupgrade = get_config('siteclosed');
if ($siteclosedforupgrade && get_config('disablelogin')) {
global $SESSION;
$SESSION->add_error_msg(get_string('siteclosedlogindisabled', 'mahara', get_config('wwwroot') . 'admin/upgrade.php'), false);
return false;
}
if (!$user->admin && ($siteclosedforupgrade || get_config('siteclosedbyadmin'))) {
global $SESSION;
$SESSION->add_error_msg(get_string('siteclosed'));
if (is_site_closed($user->admin)) {
return false;
}
......@@ -1473,3 +1465,20 @@ class LiveUser extends User {
));
}
}
function is_site_closed($adminuser) {
$siteclosedforupgrade = get_config('siteclosed');
if ($siteclosedforupgrade && get_config('disablelogin')) {
global $SESSION;
$SESSION->add_error_msg(get_string('siteclosedlogindisabled', 'mahara', get_config('wwwroot') . 'admin/upgrade.php'), false);
return true;
}
if (!$adminuser && ($siteclosedforupgrade || get_config('siteclosedbyadmin'))) {
global $SESSION;
$SESSION->add_error_msg(get_string('siteclosed'));
return true;
}
return false;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment