function xtc_display_banner($action, $identifier)
{
    if ($action == 'dynamic') {
        $banners_query = xtc_db_query("select count(*) as count from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . xtc_db_input($identifier) . "'");
        $banners = xtc_db_fetch_array($banners_query);
        if ($banners['count'] > 0) {
            $banner = xtc_random_select("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . xtc_db_input($identifier) . "'");
        } else {
            return '<strong>XTC ERROR! (xtc_display_banner(' . $action . ', ' . $identifier . ') -> No banners with group \'' . $identifier . '\' found!</strong>';
        }
    } elseif ($action == 'static') {
        if (is_array($identifier)) {
            $banner = $identifier;
        } else {
            $banner_query = xtc_db_query("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_id = '" . xtc_db_input($identifier) . "'");
            if (xtc_db_num_rows($banner_query)) {
                $banner = xtc_db_fetch_array($banner_query);
            } else {
                return '<strong>XTC ERROR! (xtc_display_banner(' . $action . ', ' . $identifier . ') -> Banner with ID \'' . $identifier . '\' not found, or status inactive</strong>';
            }
        }
    } else {
        return '<strong>XTC ERROR! (xtc_display_banner(' . $action . ', ' . $identifier . ') -> Unknown $action parameter value - it must be either \'dynamic\' or \'static\'</strong>';
    }
    if (xtc_not_null($banner['banners_html_text'])) {
        $banner_string = $banner['banners_html_text'];
    } else {
        $banner_string = '<a href="' . xtc_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" onclick="window.open(this.href); return false;">' . xtc_image(DIR_WS_IMAGES . 'banner/' . $banner['banners_image'], $banner['banners_title']) . '</a>';
    }
    xtc_update_banner_display_count($banner['banners_id']);
    return $banner_string;
}
function xtc_banner_exists($action, $identifier)
{
    if ($action == 'dynamic') {
        return xtc_random_select("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . xtc_db_input($identifier) . "'");
    } elseif ($action == 'static') {
        $banner_query = xtc_db_query("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_id = '" . xtc_db_input($identifier) . "'");
        return xtc_db_fetch_array($banner_query);
    } else {
        return false;
    }
}
Пример #3
0
   Released under the GNU General Public License 
   ---------------------------------------------------------------------------------------*/
$box_smarty = new smarty();
$box_smarty->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
$box_content = '';
// include needed functions
require_once DIR_FS_INC . 'xtc_random_select.inc.php';
//fsk18 lock
$fsk_lock = '';
if ($_SESSION['customers_status']['customers_fsk18_display'] == '0') {
    $fsk_lock = ' and p.products_fsk18!=1';
}
if (GROUP_CHECK == 'true') {
    $group_check = " and p.group_permission_" . $_SESSION['customers_status']['customers_status_id'] . "=1 ";
}
if ($random_product = xtc_random_select("select\n                                           p.products_id,\n                                           pd.products_name,\n                                           p.products_price,\n                                           p.products_tax_class_id,\n                                           p.products_image,\n                                           s.expires_date,\n                                           p.products_vpe,\n\t\t\t\t                           p.products_vpe_status,\n\t\t\t\t                           p.products_vpe_value,\n                                           s.specials_new_products_price\n                                           from " . TABLE_PRODUCTS . " p,\n                                           " . TABLE_PRODUCTS_DESCRIPTION . " pd,\n                                           " . TABLE_SPECIALS . " s where p.products_status = '1'\n                                           and p.products_id = s.products_id\n                                           and pd.products_id = s.products_id\n                                           and pd.language_id = '" . $_SESSION['languages_id'] . "'\n                                           and s.status = '1'\n                                           " . $group_check . "\n                                           " . $fsk_lock . "                                             \n                                           order by s.specials_date_added\n                                           desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {
    $box_smarty->assign('box_content', $product->buildDataArray($random_product));
    $box_smarty->assign('SPECIALS_LINK', xtc_href_link(FILENAME_SPECIALS));
    $box_smarty->assign('language', $_SESSION['language']);
    if ($random_product["products_id"] != '') {
        // set cache ID
        if (!CacheCheck()) {
            $box_smarty->caching = 0;
            $box_specials = $box_smarty->fetch(CURRENT_TEMPLATE . '/boxes/box_specials.html');
        } else {
            $box_smarty->caching = 1;
            $box_smarty->cache_lifetime = CACHE_LIFETIME;
            $box_smarty->cache_modified_check = CACHE_CHECK;
            $cache_id = $_SESSION['language'] . $random_product["products_id"] . $_SESSION['customers_status']['customers_status_name'];
            $box_specials = $box_smarty->fetch(CURRENT_TEMPLATE . '/boxes/box_specials.html', $cache_id);
        }
Пример #4
0
   ---------------------------------------------------------------------------------------*/
$box_smarty = new smarty();
$box_smarty->assign('tpl_path', DIR_WS_BASE . 'templates/' . CURRENT_TEMPLATE . '/');
// include needed functions
require_once DIR_FS_INC . 'xtc_random_select.inc.php';
// query restrictions
$fsk_lock = $_SESSION['customers_status']['customers_fsk18_display'] == '0' ? 'AND p.products_fsk18 != 1' : '';
$group_check = GROUP_CHECK == 'true' ? 'AND p.group_permission_' . $_SESSION['customers_status']['customers_status_id'] . ' = 1' : '';
$current_prd = isset($_GET['products_id']) && (int) $_GET['products_id'] > 0 ? 'AND p.products_id != ' . (int) $_GET['products_id'] : '';
if (MAX_DISPLAY_NEW_PRODUCTS_DAYS != '0') {
    $days = "AND p.products_date_added > '" . date("Y.m.d", mktime(1, 1, 1, date("m"), date("d") - MAX_DISPLAY_NEW_PRODUCTS_DAYS, date("Y"))) . "'";
} else {
    $days = '';
}
// get random product data
if ($random_product = xtc_random_select("-- templates/xtc5/source/boxes/whats_new.php\n                                        SELECT distinct\n                                              p.products_id,\n                                              p.products_image,                                              \n                                              p.products_tax_class_id,\n                                              p.products_vpe,\n                                              p.products_vpe_status,\n                                              p.products_vpe_value,\n                                              p.products_price,\n                                              pd.products_name\n                                         FROM " . TABLE_PRODUCTS . " p\n                                    LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd \n                                           ON (p.products_id = pd.products_id AND pd.language_id = '" . (int) $_SESSION['languages_id'] . "' AND pd.products_name != '')\n                                    LEFT JOIN " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n                                           ON p.products_id = p2c.products_id\n                                    LEFT JOIN " . TABLE_CATEGORIES . " c\n                                           ON c.categories_id = p2c.categories_id AND c.categories_status = 1\n                                        WHERE p.products_status = 1\n                                          " . $fsk_lock . "\n                                          " . $group_check . "\n                                          " . $current_prd . "\n                                          " . $days . "                                           \n                                     ORDER BY p.products_date_added desc\n                                        LIMIT " . MAX_RANDOM_SELECT_NEW)) {
    $whats_new_price = $xtPrice->xtcGetPrice($random_product['products_id'], $format = true, 1, $random_product['products_tax_class_id'], $random_product['products_price']);
    $box_smarty->assign('box_content', $product->buildDataArray($random_product));
    $box_smarty->assign('LINK_NEW_PRODUCTS', xtc_href_link(FILENAME_PRODUCTS_NEW));
    $box_smarty->assign('language', $_SESSION['language']);
    // set cache ID
    if (!CacheCheck()) {
        $box_smarty->caching = 0;
        $box_whats_new = $box_smarty->fetch(CURRENT_TEMPLATE . '/boxes/box_whatsnew.html');
    } else {
        $box_smarty->caching = 1;
        $box_smarty->cache_lifetime = CACHE_LIFETIME;
        $box_smarty->cache_modified_check = CACHE_CHECK;
        $cache_id = $_SESSION['language'] . $random_product['products_id'] . $_SESSION['customers_status']['customers_status_name'];
        $box_whats_new = $box_smarty->fetch(CURRENT_TEMPLATE . '/boxes/box_whatsnew.html', $cache_id);
    }
Пример #5
0
$box_smarty->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
$box_content = '';
// include needed functions
require_once DIR_FS_INC . 'xtc_random_select.inc.php';
require_once DIR_FS_INC . 'xtc_break_string.inc.php';
//fsk18 lock
$fsk_lock = '';
if ($_SESSION['customers_status']['customers_fsk18_display'] == '0') {
    $fsk_lock = ' and p.products_fsk18!=1';
}
$random_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 where p.products_status = '1' and p.products_id = r.products_id " . $fsk_lock . " and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int) $_SESSION['languages_id'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'";
if ($product->isProduct()) {
    $random_select .= " and p.products_id = '" . $product->data['products_id'] . "'";
}
$random_select .= " order by r.reviews_id desc limit " . MAX_RANDOM_SELECT_REVIEWS;
$random_product = xtc_random_select($random_select);
if ($random_product) {
    // display random review box
    $review_query = "select substring(reviews_text, 1, 60) as reviews_text from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . $random_product['reviews_id'] . "' and languages_id = '" . $_SESSION['languages_id'] . "'";
    $review_query = xtDBquery($review_query);
    $review = xtc_db_fetch_array($review_query, true);
    $review = encode_htmlspecialchars($review['reviews_text']);
    $review = xtc_break_string($review, 15, '-<br />');
    //BOF - Dokuman - 2010-01-29 - show review stars in box
    //$box_content = '<div align="center" class="bewert"><a href="' . xtc_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id']) . '">' . xtc_image(DIR_WS_THUMBNAIL_IMAGES . $random_product['products_image'], $random_product['products_name']) . '</a></div><a href="' . xtc_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id']) . '">' . $review . ' ..</a><br />';
    $box_content = '<div align="center" class="bewert"><a href="' . xtc_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&amp;reviews_id=' . $random_product['reviews_id']) . '">' . xtc_image(DIR_WS_THUMBNAIL_IMAGES . $random_product['products_image'], $random_product['products_name']) . '</a></div><a href="' . xtc_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&amp;reviews_id=' . $random_product['reviews_id']) . '">' . $review . ' ..</a><br /><div align="center">' . xtc_image('templates/' . CURRENT_TEMPLATE . '/img/stars_' . $random_product['reviews_rating'] . '.gif', sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $random_product['reviews_rating'])) . '</div>';
    //EOF - Dokuman - 2010-01-29 - show review stars in box
} elseif ($product->isProduct()) {
    // Verhindern das Gäste oder Spamer bewerten können. www.aranowa.de
    if (isset($_SESSION['customer_id'])) {
        // display 'write a review' box