diff --git a/include/class.orm.php b/include/class.orm.php index cd30ffa974c1ed1cb95137b0d357a25b1d1b7610..34564f111873b22b62a10e087b3a2d3cf5a90d86 100644 --- a/include/class.orm.php +++ b/include/class.orm.php @@ -2584,6 +2584,7 @@ class SqlCompiler { } } $glue = $Q->ored ? ' OR ' : ' AND '; + $filter = array_filter($filter); $clause = implode($glue, $filter); if (($Q->negated || $parens) && count($filter) > 1) $clause = '(' . $clause . ')'; diff --git a/include/staff/emails.inc.php b/include/staff/emails.inc.php index 78c296ce27e5a23928c41300e1e4759286d39c11..c6f09c68fd76d60d21cab5c767d2c1562f21e930 100644 --- a/include/staff/emails.inc.php +++ b/include/staff/emails.inc.php @@ -36,8 +36,8 @@ $showing = $pageNav->showing().' '._N('email', 'emails', $count); $qstr = '&order='.($order=='DESC' ? 'ASC' : 'DESC'); $def_dept_id = $cfg->getDefaultDeptId(); -$def_dept_name = $cfg->getDefaultDept()->getName(); -$def_priority = $cfg->getDefaultPriority()->getDesc(); +$def_dept_name = ($d = $cfg->getDefaultDept()) ? $d->getName() : ''; +$def_priority = ($c = $cfg->getDefaultPriority()) ? $c->getDesc() : ''; ?> <form action="emails.php" method="POST" name="emails"> <div class="sticky bar opaque"> diff --git a/include/staff/staff.inc.php b/include/staff/staff.inc.php index 217daa065de2b514b2b11aac7b2cd246be4fde1f..f51d8ecfeaa85bf3a6ce0e21ac218a95540a6f32 100644 --- a/include/staff/staff.inc.php +++ b/include/staff/staff.inc.php @@ -538,6 +538,7 @@ foreach ($staff->dept_access as $dept_access) { } foreach ($staff->teams as $member) { + if (!$member->team) continue; echo sprintf('joinTeam(%d, %s, %d, %s);', $member->team_id, JsonDataEncoder::encode($member->team->getName()), $member->isAlertsEnabled(), diff --git a/login.php b/login.php index 5c4a713124bc6b55175f48d9f2926e4676f631ec..512465c0e6bd925785ff3c5ed56296846e4876c4 100644 --- a/login.php +++ b/login.php @@ -90,10 +90,16 @@ elseif ($_POST && isset($_POST['lticket'])) { // We're using authentication backend so we can guard aganist brute // force attempts (which doesn't buy much since the link is emailed) - $ticket->sendAccessLink($user); - $msg = sprintf(__("%s - access link sent to your email!"), - Format::htmlchars($user->getName()->getFirst())); - $_POST = null; + if ($ticket) { + $ticket->sendAccessLink($user); + $msg = sprintf(__("%s - access link sent to your email!"), + Format::htmlchars($user->getName()->getFirst())); + $_POST = null; + } else { + $errors['err'] = sprintf('%s - %s', + __('Invalid email or ticket number'), + __('Please try again!')); + } } elseif(!$errors['err']) { $errors['err'] = sprintf('%s - %s', __('Invalid email or ticket number'), __('Please try again!')); } diff --git a/scp/profile.php b/scp/profile.php index 0a46875e7f3ae2812c366facb72f27702e7eaebb..193aad58ac8e1eb8540ac69f0a500b89dbd83a20 100644 --- a/scp/profile.php +++ b/scp/profile.php @@ -48,7 +48,8 @@ elseif($thisstaff->onVacation() && !$warn) $warn=sprintf(__("<b>Welcome back %s</b>! You are listed as 'on vacation' Please let your manager know that you are back."),$thisstaff->getFirstName()); $inc='profile.inc.php'; -$nav->setTabActive('dashboard'); +if ($nav) + $nav->setTabActive('dashboard'); $ost->addExtraHeader('<meta name="tip-namespace" content="dashboard.my_profile" />', "$('#content').data('tipNamespace', 'dashboard.my_profile');"); require_once(STAFFINC_DIR.'header.inc.php');