function olc_display_banner($action, $identifier)
{
    if ($action == 'dynamic') {
        $banners_query = olc_db_query(SELECT_COUNT . " as count from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . APOS);
        $banners = olc_db_fetch_array($banners_query);
        if ($banners['count'] > 0) {
            $banner = olc_random_select("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . APOS);
        } else {
            return '<b>OLC ERROR! (olc_display_banner(' . $action . ', ' . $identifier . ') -> No banners with group \'' . $identifier . '\' found!</b>';
        }
    } elseif ($action == 'static') {
        if (is_array($identifier)) {
            $banner = $identifier;
        } else {
            $banner_query = olc_db_query("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_id = '" . $identifier . APOS);
            if (olc_db_num_rows($banner_query)) {
                $banner = olc_db_fetch_array($banner_query);
            } else {
                return '<b>OLC ERROR! (olc_display_banner(' . $action . ', ' . $identifier . ') -> Banner with id \'' . $identifier . '\' not found, or status inactive</b>';
            }
        }
    } else {
        return '<b>OLC ERROR! (olc_display_banner(' . $action . ', ' . $identifier . ') -> Unknown $action parameter value - it must be either \'dynamic\' or \'static\'' . HTML_B_END;
    }
    if (olc_not_null($banner['banners_html_text'])) {
        $banner_string = $banner['banners_html_text'];
    } else {
        $banner_string = HTML_A_START . olc_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_blank">' . olc_image(DIR_WS_IMAGES . 'banner/' . $banner['banners_image'], $banner['banners_title']) . HTML_A_END;
    }
    olc_update_banner_display_count($banner['banners_id']);
    return $banner_string;
}
function olc_banner_exists($action, $identifier)
{
    $sql = "select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . APOS;
    if ($action == 'dynamic') {
        return olc_random_select($sql);
    } elseif ($action == 'static') {
        return olc_db_fetch_array(olc_db_query($sql));
    } else {
        return false;
    }
}
    require_once DIR_FS_INC . 'olc_break_string.inc.php';
    //fsk18 lock
    if ($_SESSION['customers_status']['customers_fsk18_display'] == '0') {
        $fsk_lock = ' and p.products_fsk18!=1';
    } else {
        $fsk_lock = EMPTY_STRING;
    }
    $languages_id = "languages_id = '" . SESSION_LANGUAGE_ID . APOS;
    $language_id = "language_id = '" . SESSION_LANGUAGE_ID . APOS;
    $review_select = SELECT . "r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd\n\twhere\n\tp.products_status = '1' and\n\tp.products_id = r.products_id " . $fsk_lock . " and\n\tr.reviews_id = rd.reviews_id and\n\trd." . $languages_id . " and\n\tp.products_id = pd.products_id and\n\tpd." . $language_id;
    $products_id = (int) $_GET['products_id'];
    if ($products_id) {
        $review_select .= " and p.products_id = '" . $products_id . APOS;
    }
    $review_select .= " order by r.reviews_id desc limit " . MAX_RANDOM_SELECT_REVIEWS;
    $random_product = olc_random_select($review_select);
    if ($random_product && sizeof($random_product) > 0) {
        // display random review box
        $reviews_id = $random_product['reviews_id'];
        $review_query = olc_db_query(SELECT . "substring(reviews_text, 1, 60) as reviews_text from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . $reviews_id . "' and " . $languages_id);
        $review = olc_db_fetch_array($review_query);
        $review = htmlspecialchars($review['reviews_text']);
        $review = olc_break_string($review, 15, DASH . HTML_BR);
        $parameters = $products_id_text . $random_product['products_id'] . '&reviews_id=' . $reviews_id;
        $link = olc_href_link(FILENAME_PRODUCT_REVIEWS_INFO, $parameters);
        $link = HTML_A_START . $link . '">';
        $products_name = $random_product['products_name'];
        $reviews_rating = $random_product['reviews_rating'];
        $box_content = '
<div align="center">
' . $link . olc_image(DIR_WS_THUMBNAIL_IMAGES . $random_product['products_image'], $products_name) . '
    $additional_selection .= "\n\tand p." . SQL_GROUP_CONDITION;
}
if ($_SESSION['customers_status']['customers_fsk18_display'] == '0') {
    $additional_selection .= "\n\t and p.products_fsk18!=1";
}
$products_listing_sql = str_replace("#group_fsk18#", $additional_selection, $products_listing_sql);
$products_listing_split = new splitPageResults($products_listing_sql, $_GET['page'], $Entries, 'p.products_id');
$my_products_listing_entries = $products_listing_split->number_of_rows;
if ($my_products_listing_entries > 0) {
    if ($products_listing_simple) {
        if ($first_run && !$products_use_random_data) {
            $products_listing_query = olc_db_query($products_listing_sql);
            $my_products_listing_entries = olc_db_num_rows($products_listing_query);
        } else {
            $total_records = (require_once DIR_FS_INC . 'olc_random_select.inc.php');
            $products_listing_query = olc_random_select($products_listing_sql, $random_records);
            //		$my_products_listing_entries=sizeof($products_listing_query);
        }
    } else {
        $products_listing_query = olc_db_query($products_listing_split->sql_query);
    }
    if (NO_TAX_RAISED) {
        $price_disclaimer = PRICE_DISCLAIMER_NO_TAX;
    } else {
        if (CUSTOMER_SHOW_PRICE_TAX) {
            $get_price_disclaimer = true;
        } else {
            $price_disclaimer = PRICE_DISCLAIMER_EXCL;
        }
    }
    $is_array = is_array($products_listing_query);