}
            }
        }
        db_free_result($result);
        break;
    }
    if (!zerolen($image_path) && !is_url($image_path)) {
        if (!file_exists($image_path) || !is_readable($image_path)) {
            $image_path = "";
        } elseif ($config['setup_images'][$type]['md5_check'] == 'Y') {
            $image_md5 = md5_file($image_path);
        }
    }
    if (!zerolen($image_path) && $config['setup_images'][$type]['md5_check'] == 'Y' && $image_md5 !== $md5) {
        $image_path = "";
    }
}
if (zerolen($image_path)) {
    # when image is not available, use the "default image"
    $type = $orig_type;
    $image_path = cw_get_default_image($type);
    $tmp = cw_get_image_size($image_path);
    $image_size = $tmp[0];
    $image_type = empty($tmp[3]) ? "image/gif" : $tmp[3];
}
header("Content-Type: " . $image_type);
if ($image_size > 0) {
    header("Content-Length: " . $image_size);
}
cw_readfile($image_path, true);
exit;
<?php

cw_load('files', 'user');
$filename = $_GET['file'];
$file_exists = false;
#
# Check if file exists
#
$allowed_path = realpath(cw_user_get_files_location());
if (!@file_exists($filename)) {
    $filename = realpath($allowed_path . DIRECTORY_SEPARATOR . $filename);
    $file_exists = file_exists($filename);
} else {
    $filename = realpath($filename);
    $file_exists = !strncmp($filename, $allowed_path, strlen($allowed_path));
}
if ($file_exists) {
    #
    # Output file content
    #
    $imageinfo = cw_get_image_size($filename);
    if (!empty($imageinfo)) {
        header("Content-type: " . ($imageinfo[3] ? $imageinfo[3] : "application/octet-stream"));
    } else {
        header("Content-type: application/force-download");
        header("Content-Disposition: attachment; filename=" . basename($filename));
    }
    cw_readfile($filename);
}
exit;
<?php

define('AREA_TYPE', 'C');
$current_area = AREA_TYPE;
cw_load('files', 'speed_bar', 'sections', 'tabs', 'image');
$session_failed_transaction =& cw_session_register("session_failed_transaction");
$add_to_cart_time =& cw_session_register("add_to_cart_time");
$always_allow_shop =& cw_session_register("always_allow_shop");
if (!empty($_GET['shopkey'])) {
    $always_allow_shop = !empty($config['General']['shop_closed_key']) && $_GET['shopkey'] == $config['General']['shop_closed_key'];
}
if ($config['General']['shop_closed'] == "Y" && !$always_allow_shop) {
    if (!cw_readfile($app_dir . DIRECTORY_SEPARATOR . $shop_closed_file, true)) {
        echo cw_get_langvar_by_name("txt_shop_temporarily_unaccessible", false, false, true);
    }
    exit;
}
if (!defined('HTTPS_CHECK_SKIP')) {
    cw_include('customer/https.php');
}
$cat = intval(@$cat);
$page = intval(@$page);
if ($target != 'image') {
    cw_include('customer/referer.php');
    cw_include('include/check_useraccount.php');
    cw_include('init/lng.php');
    cw_include('include/settings.php');
}
$location = array();
$location[] = array($config['Company']['company_name'], $app_web_dir . '/index.php');
if ($addons['interneka']) {
<?php

cw_load('files');
if (!$addons['Salesman']) {
    exit;
}
if ($campaign_id) {
    if (cw_query_first_cell("SELECT COUNT(*) FROM {$tables['salesman_adv_campaigns']} WHERE campaign_id = '{$campaign_id}'")) {
        db_query("INSERT INTO {$tables['salesman_adv_clicks']} VALUES ('{$campaign_id}', '" . time() . "')");
    }
}
header("Content-type: image/gif");
cw_readfile($smarty->template_dir . "/images/spacer.gif", true);