Commit 224e2ce7 by Scott

Further simplify qa_permit_value_error

parent 1d3a0ed9
...@@ -878,56 +878,44 @@ ...@@ -878,56 +878,44 @@
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
if ($permit >= QA_PERMIT_ALL) { if (!isset($userid) && $permit < QA_PERMIT_ALL)
$error = false;
}
elseif (!isset($userid)) {
return 'login'; return 'login';
}
elseif ($permit >= QA_PERMIT_USERS) $levelError =
$error = false; ($permit <= QA_PERMIT_SUPERS && $userlevel < QA_USER_LEVEL_SUPER) ||
($permit <= QA_PERMIT_ADMINS && $userlevel < QA_USER_LEVEL_ADMIN) ||
($permit <= QA_PERMIT_MODERATORS && $userlevel < QA_USER_LEVEL_MODERATOR) ||
($permit <= QA_PERMIT_EDITORS && $userlevel < QA_USER_LEVEL_EDITOR) ||
($permit <= QA_PERMIT_EXPERTS && $userlevel < QA_USER_LEVEL_EXPERT);
if ($levelError)
return 'level';
if (isset($userid) && ($userflags & QA_USER_FLAGS_USER_BLOCKED))
return 'userblock';
elseif ($permit >= QA_PERMIT_CONFIRMED) { if ($permit >= QA_PERMIT_USERS)
return false;
if ($permit >= QA_PERMIT_CONFIRMED) {
$confirmed = ($userflags & QA_USER_FLAGS_EMAIL_CONFIRMED);
if ( if (
QA_FINAL_EXTERNAL_USERS || // not currently supported by single sign-on integration !QA_FINAL_EXTERNAL_USERS && // not currently supported by single sign-on integration
$userlevel >= QA_USER_LEVEL_APPROVED || // if user approved or assigned to a higher level, no need qa_opt('confirm_user_emails') && // if this option off, we can't ask it of the user
($userflags & QA_USER_FLAGS_EMAIL_CONFIRMED) || // actual confirmation $userlevel < QA_USER_LEVEL_APPROVED && // if user approved or assigned to a higher level, no need
!qa_opt('confirm_user_emails') // if this option off, we can't ask it of the user !$confirmed // actual confirmation
) )
$error = false; return 'confirm';
else
$error = 'confirm';
} }
elseif ($permit >= QA_PERMIT_APPROVED) { elseif ($permit >= QA_PERMIT_APPROVED) {
if ( if (
$userlevel >= QA_USER_LEVEL_APPROVED || // user has been approved qa_opt('moderate_users') && // if this option off, we can't ask it of the user
!qa_opt('moderate_users') // if this option off, we can't ask it of the user $userlevel < QA_USER_LEVEL_APPROVED // user has not been approved
) )
$error = false; return 'approve';
else
$error = 'approve';
} }
else { return false;
$hasLevel =
($permit >= QA_PERMIT_EXPERTS && $userlevel >= QA_USER_LEVEL_EXPERT) ||
($permit >= QA_PERMIT_EDITORS && $userlevel >= QA_USER_LEVEL_EDITOR) ||
($permit >= QA_PERMIT_MODERATORS && $userlevel >= QA_USER_LEVEL_MODERATOR) ||
($permit >= QA_PERMIT_ADMINS && $userlevel >= QA_USER_LEVEL_ADMIN) ||
$userlevel >= QA_USER_LEVEL_SUPER;
if (!$hasLevel)
return 'level';
$error = false;
}
if (isset($userid) && ($userflags & QA_USER_FLAGS_USER_BLOCKED))
$error = 'userblock';
return $error;
} }
......
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