diff --git a/includes/functions.php b/includes/functions.php index c4993b46d..93b190179 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -2471,7 +2471,7 @@ function get_categories_by_id ( $id, $user, $asterisk = false ) { $res = dbi_execute ( 'SELECT wc.cat_name, wc.cat_id, wec.cat_owner FROM webcal_categories wc, webcal_entry_categories wec WHERE wec.cal_id = ? - AND wec.cat_id = wc.cat_id AND ( wc.cat_owner = ? OR wc.cat_owner = \'\' ) + AND wec.cat_id = wc.cat_id AND ( wc.cat_owner = ? OR (wc.cat_owner = \'\' OR wc.cat_owner IS NULL) ) ORDER BY wec.cat_order', [$id, ( empty ( $user ) ? $login : $user )] ); while ( $row = dbi_fetch_row ( $res ) ) { $categories[ ( empty ( $row[2] ) ? - $row[1] : $row[1] ) ] = $row[0] @@ -4207,10 +4207,11 @@ function load_user_categories ( $ex_global = '' ) { $query_params = []; $query_params[] = ( ( ! empty ( $user ) && strlen ( $user ) ) && ( $is_assistant || $is_admin ) ? $user : $login ); - $rows = dbi_get_cached_rows ( 'SELECT cat_id, cat_name, cat_owner, cat_color, cat_icon_mime + $sql = 'SELECT cat_id, cat_name, cat_owner, cat_color, cat_icon_mime FROM webcal_categories WHERE ( cat_owner = ? ) ' . ( $ex_global == '' - ? 'OR ( cat_owner = \'\' ) ORDER BY cat_owner,' : 'ORDER BY' ) - . ' cat_name', $query_params ); + ? 'OR ( cat_owner = \'\' OR cat_owner IS NULL ) ORDER BY cat_owner,' : 'ORDER BY' ) + . ' cat_name'; + $rows = dbi_get_cached_rows ($sql, $query_params); if ( $rows ) { for ( $i = 0, $cnt = count ( $rows ); $i < $cnt; $i++ ) { $row = $rows[$i];