Commit 2dec3829 authored by Chris Graham's avatar Chris Graham
Browse files

Fixed MANTIS-5205 (Fix Selectcode including in main_gallery_embed block)

parent b98d66e6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -104,14 +104,14 @@ class Block_main_gallery_embed
        }
        if ($map['select'] != '*') {
            require_code('selectcode');
            $where_sup .= ' AND ' . selectcode_to_sqlfragment($map['select'], 'id');
            $where_sup .= ' AND ' . selectcode_to_sqlfragment($map['select'], 'r.id');
        }
        if (!array_key_exists('video_select', $map)) {
            $map['video_select'] = '*';
        }
        if ($map['video_select'] != '*') {
            require_code('selectcode');
            $where_sup .= ' AND ' . selectcode_to_sqlfragment($map['video_select'], 'id');
            $where_sup .= ' AND ' . selectcode_to_sqlfragment($map['video_select'], 'r.id');
        }

        // Day filtering
+4 −4
Original line number Diff line number Diff line
@@ -177,7 +177,7 @@ function selectcode_to_sqlfragment($filter, $field_name, $parent_spec__table_nam
                $out_or .= ' OR ';
            }
            $out_or .= $field_name . '>=' . strval(intval($matches[1]));
        } elseif (preg_match('#^(.+)(\#|\*|>)$#', $token, $matches) != 0) { // e.g. '3#' or '3*' or '3>'
        } elseif (preg_match('#^(.+)(\#|\*|>)$#', $token, $matches) != 0 && $category_field_name !== null) { // e.g. '3#' or '3*' or '3>'
            if (($matches[2] == '#') || ($parent_spec__parent_name === null)) {
                if ($out_or != '') {
                    $out_or .= ' OR ';
@@ -209,7 +209,7 @@ function selectcode_to_sqlfragment($filter, $field_name, $parent_spec__table_nam
                    }
                }
            }
        } elseif (preg_match('#^(.+)\~$#', $token, $matches) != 0) { // e.g. '3~'
        } elseif (preg_match('#^(.+)\~$#', $token, $matches) != 0 && $category_field_name !== null) { // e.g. '3~'
            if ($parent_spec__parent_name === null) {
                if ($out_and != '') {
                    $out_and .= ' AND ';
@@ -351,7 +351,7 @@ function _selectcode_to_generic($filter, $field_name, $table_name, $ids_and_pare
                    }
                }
            }
        } elseif (preg_match('#^(.+)(\#|\*|>)$#', $token, $matches) != 0) { // e.g. '3#' or '3*' or '3>'
        } elseif (preg_match('#^(.+)(\#|\*|>)$#', $token, $matches) != 0 && $category_field_name !== null) { // e.g. '3#' or '3*' or '3>'
            _ensure_loaded__ids_and_parents($field_name, $table_name, $ids_and_parents, $ids_and_parents_callback, $category_field_name, $db);

            if ($matches[2] == '#') {
@@ -377,7 +377,7 @@ function _selectcode_to_generic($filter, $field_name, $table_name, $ids_and_pare
                    }
                }
            }
        } elseif (preg_match('#^(.+)\~$#', $token, $matches) != 0) { // e.g. '3~'
        } elseif (preg_match('#^(.+)\~$#', $token, $matches) != 0 && $category_field_name !== null) { // e.g. '3~'
            _ensure_loaded__ids_and_parents($field_name, $table_name, $ids_and_parents, $ids_and_parents_callback, $category_field_name, $db);

            $subtree = _selectcode_subtree_fetch($matches[1], $parent_spec__table_name, $parent_spec__parent_name, $parent_spec__field_name, $numeric_category_set_ids, $db, $cached_mappings);