function tep_expire_banners() { $OSCOM_Db = Registry::get('Db'); $Qbanners = $OSCOM_Db->query('select b.banners_id, sum(bh.banners_shown) as banners_shown from :table_banners b, :table_banners_history bh where b.status = 1 and b.banners_id = bh.banners_id and ((b.expires_date is not null and now() >= b.expires_date) or (b.expires_impressions >= banners_shown)) group by b.banners_id'); if ($Qbanners->fetch() !== false) { do { tep_set_banner_status($Qbanners->valueInt('banners_id'), 0); } while ($Qbanners->fetch()); } }
function tep_expire_banners() { $banners_query = tep_db_query("select b.banners_id, b.expires_date, b.expires_impressions, sum(bh.banners_shown) as banners_shown from " . TABLE_BANNERS . " b, " . TABLE_BANNERS_HISTORY . " bh where b.status = '1' and b.banners_id = bh.banners_id group by b.banners_id"); if (tep_db_num_rows($banners_query)) { while ($banners = tep_db_fetch_array($banners_query)) { if (tep_not_null($banners['expires_date'])) { if (date('Y-m-d H:i:s') >= $banners['expires_date']) { tep_set_banner_status($banners['banners_id'], '0'); } } elseif (tep_not_null($banners['expires_impressions'])) { if ($banners['expires_impressions'] > 0 && $banners['banners_shown'] >= $banners['expires_impressions']) { tep_set_banner_status($banners['banners_id'], '0'); } } } } }
osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require 'includes/application_top.php'; $action = isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : ''; $banner_extension = tep_banner_image_extension(); if (tep_not_null($action)) { switch ($action) { case 'setflag': if ($HTTP_GET_VARS['flag'] == '0' || $HTTP_GET_VARS['flag'] == '1') { tep_set_banner_status($HTTP_GET_VARS['bID'], $HTTP_GET_VARS['flag']); $messageStack->add_session(SUCCESS_BANNER_STATUS_UPDATED, 'success'); } else { $messageStack->add_session(ERROR_UNKNOWN_STATUS_FLAG, 'error'); } tep_redirect(tep_href_link(FILENAME_BANNER_MANAGER, 'page=' . $HTTP_GET_VARS['page'] . '&bID=' . $HTTP_GET_VARS['bID'])); break; case 'insert': case 'update': if (isset($HTTP_POST_VARS['banners_id'])) { $banners_id = tep_db_prepare_input($HTTP_POST_VARS['banners_id']); } $banners_title = tep_db_prepare_input($HTTP_POST_VARS['banners_title']); $banners_url = tep_db_prepare_input($HTTP_POST_VARS['banners_url']); $new_banners_group = tep_db_prepare_input($HTTP_POST_VARS['new_banners_group']); $banners_group = empty($new_banners_group) ? tep_db_prepare_input($HTTP_POST_VARS['banners_group']) : $new_banners_group;
<?php require 'includes/application_top.php'; $action = isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : ''; $banner_extension = tep_banner_image_extension(); if (tep_not_null($action)) { switch ($action) { case 'setflag': if ($_GET['flag'] == '0' || $_GET['flag'] == '1') { tep_set_banner_status($_GET['bID'], $_GET['flag']); $messageStack->add_session(SUCCESS_BANNER_STATUS_UPDATED, 'success'); } else { $messageStack->add_session(ERROR_UNKNOWN_STATUS_FLAG, 'error'); } tep_redirect(tep_href_link(FILENAME_BANNER_MANAGER, 'page=' . $HTTP_GET_VARS['page'] . '&bID=' . $HTTP_GET_VARS['bID'])); break; case 'insert': case 'update': if (isset($HTTP_POST_VARS['banners_id'])) { $banners_id = tep_db_prepare_input($HTTP_POST_VARS['banners_id']); } $banners_title = tep_db_prepare_input($HTTP_POST_VARS['banners_title']); $banners_url = tep_db_prepare_input($HTTP_POST_VARS['banners_url']); if (isset($HTTP_POST_VARS['banners_group_section'])) { $banners_group_section = $HTTP_POST_VARS['banners_group_section']; if (isset($HTTP_POST_VARS['banners_group_' . $banners_group_section . '_id'])) { $banners_group_id = $HTTP_POST_VARS['banners_group_' . $banners_group_section . '_id']; $cat_query = tep_db_query("SELECT parent_id FROM categories WHERE categories_id = '" . $banners_group_id . "'") or die(mysql_error()); $cat = tep_db_fetch_array($cat_query); if ($cat['parent_id'] > '0') { if ($banners_group_id) {
$Id$ osCmax e-Commerce http://www.oscmax.com Copyright 2000 - 2011 osCmax Released under the GNU General Public License */ require 'includes/application_top.php'; $affiliate_banner_extension = tep_banner_image_extension(); if ($_GET['action']) { switch ($_GET['action']) { case 'setaffiliate_flag': if ($_GET['affiliate_flag'] == '0' || $_GET['affiliate_flag'] == '1') { tep_set_banner_status($_GET['abID'], $_GET['affiliate_flag']); $messageStack->add_session(SUCCESS_BANNER_STATUS_UPDATED, 'success'); } else { $messageStack->add_session(ERROR_UNKNOWN_STATUS_FLAG, 'error'); } tep_redirect(tep_href_link(FILENAME_AFFILIATE_BANNER_MANAGER, 'selected_box=affiliate&page=' . $_GET['page'] . '&abID=' . $_GET['abID'])); break; case 'insert': case 'update': $affiliate_banners_id = tep_db_prepare_input($_POST['affiliate_banners_id']); $affiliate_banners_title = tep_db_prepare_input($_POST['affiliate_banners_title']); $affiliate_products_id = tep_db_prepare_input($_POST['affiliate_products_id']); // Added Category Banners $affiliate_category_id = tep_db_prepare_input($_POST['affiliate_category_id']); // End Category Banners $new_affiliate_banners_group = tep_db_prepare_input($_POST['new_affiliate_banners_group']);
<?php require 'includes/application_top.php'; $affiliate_banner_extension = tep_banner_image_extension(); if ($HTTP_GET_VARS['action']) { switch ($HTTP_GET_VARS['action']) { case 'setaffiliate_flag': if ($HTTP_GET_VARS['affiliate_flag'] == '0' || $HTTP_GET_VARS['affiliate_flag'] == '1') { tep_set_banner_status($HTTP_GET_VARS['abID'], $HTTP_GET_VARS['affiliate_flag']); $messageStack->add_session(SUCCESS_BANNER_STATUS_UPDATED, 'success'); } else { $messageStack->add_session(ERROR_UNKNOWN_STATUS_FLAG, 'error'); } tep_redirect(tep_href_link(FILENAME_AFFILIATE_BANNER_MANAGER, 'selected_box=affiliate&page=' . $HTTP_GET_VARS['page'] . '&abID=' . $HTTP_GET_VARS['abID'])); break; case 'insert': case 'update': $affiliate_banners_id = tep_db_prepare_input($HTTP_POST_VARS['affiliate_banners_id']); $affiliate_banners_title = tep_db_prepare_input($HTTP_POST_VARS['affiliate_banners_title']); $affiliate_products_id = tep_db_prepare_input($HTTP_POST_VARS['affiliate_products_id']); // Added Category Banners $affiliate_category_id = tep_db_prepare_input($HTTP_POST_VARS['affiliate_category_id']); // End Category Banners $new_affiliate_banners_group = tep_db_prepare_input($HTTP_POST_VARS['new_affiliate_banners_group']); $affiliate_banners_group = empty($new_affiliate_banners_group) ? tep_db_prepare_input($HTTP_POST_VARS['affiliate_banners_group']) : $new_affiliate_banners_group; $affiliate_banners_image_target = tep_db_prepare_input($HTTP_POST_VARS['affiliate_banners_image_target']); $affiliate_html_text = tep_db_prepare_input($HTTP_POST_VARS['affiliate_html_text']); $affiliate_banners_image_local = tep_db_prepare_input($HTTP_POST_VARS['affiliate_banners_image_local']); $affiliate_banners_image_target = tep_db_prepare_input($HTTP_POST_VARS['affiliate_banners_image_target']); $db_image_location = ''; $affiliate_banner_error = false;