Commit a5cf644e authored by Francois Marier's avatar Francois Marier
Browse files

Move site closure check to a separate function



This allows third-party authentication plugins to use the same code
when performing this check.

Change-Id: I3b7d5f6a7cd4064617baa5e9b4563563d16e161b
Signed-off-by: default avatarFrancois Marier <francois@catalyst.net.nz>
parent bcdb22cf
......@@ -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