Skip to content

Commit

Permalink
Merge pull request #454 from dmjohnsson23/bugfix
Browse files Browse the repository at this point in the history
Fix 2 bugs
  • Loading branch information
craigk5n authored Jan 23, 2024
2 parents 8280cc7 + 16571ee commit b757230
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ function date_selection($prefix, $date, $trigger = false, $num_years = 20)
* @return int Timestamp representing, in UTC or LOCAL time.
*/
function date_to_epoch( $d, $gmt = true ) {
if ( $d == 0 )
if ( $d == 0 || $d === '' )
return 0;

$dH = $di = $ds = 0;
Expand Down Expand Up @@ -2580,7 +2580,13 @@ function get_groups($user, $includeUserlist=false)
$sql = 'SELECT cal_login FROM webcal_group_user WHERE cal_group_id = ? ORDER BY cal_login';
$res = dbi_execute($sql, [$groups[$i]['cal_group_id']]);
while ($row = dbi_fetch_row($res)) {
$users[] = $users_by_name[$row[0]];
if (isset($users_by_name[$row[0]])){
// It is possible some users assigned to this group may not exist,
// so we skip those that don't. For example, if users are fetched
// from an external source via user-app-*.php, and one of those
// users is deleted externally.
$users[] = $users_by_name[$row[0]];
}
}
$groups[$i]['cal_users'] = $users;
}
Expand Down

0 comments on commit b757230

Please sign in to comment.