Test for null in user before testing for access in CanEdit et all

This commit is contained in:
Isaac Connor 2019-12-07 12:39:28 -05:00
parent 4632bbd124
commit 0de6396a5b
1 changed files with 3 additions and 3 deletions

View File

@ -220,19 +220,19 @@ function generateAuthHash($useRemoteAddr, $force=false) {
function visibleMonitor($mid) {
global $user;
return ( empty($user['MonitorIds']) || in_array($mid, explode(',', $user['MonitorIds'])) );
return ( $user && empty($user['MonitorIds']) || in_array($mid, explode(',', $user['MonitorIds'])) );
}
function canView($area, $mid=false) {
global $user;
return ( ($user[$area] == 'View' || $user[$area] == 'Edit') && ( !$mid || visibleMonitor($mid) ) );
return ( $user && ($user[$area] == 'View' || $user[$area] == 'Edit') && ( !$mid || visibleMonitor($mid) ) );
}
function canEdit($area, $mid=false) {
global $user;
return ( $user[$area] == 'Edit' && ( !$mid || visibleMonitor($mid) ));
return ( $user && ($user[$area] == 'Edit') && ( !$mid || visibleMonitor($mid) ));
}
function userFromSession() {