[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/ -> account_notifications.php (source)

   1  <?php
   2  /*

   3  $Id: account_notifications.php 3 2006-05-27 04:59:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax

   9  

  10    Released under the GNU General Public License

  11  */
  12  
  13  // Most of this file is changed or moved to BTS - Basic Template System - format.

  14  // For adding in contribution or modification - parts of this file has been moved to: catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).

  15  //       catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).

  16  // (Sub 'fallback' with your current template to see if there is a template specific file.)

  17  
  18    require ('includes/application_top.php');
  19  
  20    if (!tep_session_is_registered('customer_id')) {
  21      $navigation->set_snapshot();
  22      tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
  23    }
  24  
  25  // needs to be included earlier to set the success message in the messageStack

  26    require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ACCOUNT_NOTIFICATIONS);
  27  
  28    $global_query = tep_db_query("select global_product_notifications from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customer_id . "'");
  29    $global = tep_db_fetch_array($global_query);
  30  
  31    if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process')) {
  32      if (isset($HTTP_POST_VARS['product_global']) && is_numeric($HTTP_POST_VARS['product_global'])) {
  33        $product_global = tep_db_prepare_input($HTTP_POST_VARS['product_global']);
  34      } else {
  35        $product_global = '0';
  36      }
  37  
  38      (array)$products = $HTTP_POST_VARS['products'];
  39  
  40      if ($product_global != $global['global_product_notifications']) {
  41        $product_global = (($global['global_product_notifications'] == '1') ? '0' : '1');
  42  
  43        tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set global_product_notifications = '" . (int)$product_global . "' where customers_info_id = '" . (int)$customer_id . "'");
  44      } elseif (sizeof($products) > 0) {
  45        $products_parsed = array();
  46        reset($products);
  47        while (list(, $value) = each($products)) {
  48          if (is_numeric($value)) {
  49            $products_parsed[] = $value;
  50          }
  51        }
  52  
  53        if (sizeof($products_parsed) > 0) {
  54          $check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int)$customer_id . "' and products_id not in (" . implode(',', $products_parsed) . ")");
  55          $check = tep_db_fetch_array($check_query);
  56  
  57          if ($check['total'] > 0) {
  58            tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int)$customer_id . "' and products_id not in (" . implode(',', $products_parsed) . ")");
  59          }
  60        }
  61      } else {
  62        $check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int)$customer_id . "'");
  63        $check = tep_db_fetch_array($check_query);
  64  
  65        if ($check['total'] > 0) {
  66          tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int)$customer_id . "'");
  67        }
  68      }
  69  
  70      $messageStack->add_session('account', SUCCESS_NOTIFICATIONS_UPDATED, 'success');
  71  
  72      tep_redirect(tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));
  73    }
  74  
  75    $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));
  76    $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_ACCOUNT_NOTIFICATIONS, '', 'SSL'));
  77  
  78    $content = CONTENT_ACCOUNT_NOTIFICATIONS;
  79    $javascript = $content . '.js';
  80  
  81    include (bts_select('main', $content_template)); // BTSv1.5

  82  
  83    require (DIR_WS_INCLUDES . 'application_bottom.php');
  84  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7