[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/ -> account_newsletters.php (source)

   1  <?php
   2  /*

   3  $Id: account_newsletters.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_NEWSLETTERS);
  27  
  28    $newsletter_query = tep_db_query("select customers_newsletter from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
  29    $newsletter = tep_db_fetch_array($newsletter_query);
  30  
  31    if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process')) {
  32      if (isset($HTTP_POST_VARS['newsletter_general']) && is_numeric($HTTP_POST_VARS['newsletter_general'])) {
  33        $newsletter_general = tep_db_prepare_input($HTTP_POST_VARS['newsletter_general']);
  34      } else {
  35        $newsletter_general = '0';
  36      }
  37  
  38      if ($newsletter_general != $newsletter['customers_newsletter']) {
  39        $newsletter_general = (($newsletter['customers_newsletter'] == '1') ? '0' : '1');
  40  
  41        tep_db_query("update " . TABLE_CUSTOMERS . " set customers_newsletter = '" . (int)$newsletter_general . "' where customers_id = '" . (int)$customer_id . "'");
  42      }
  43  
  44      $messageStack->add_session('account', SUCCESS_NEWSLETTER_UPDATED, 'success');
  45  
  46      tep_redirect(tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));
  47    }
  48  
  49    $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));
  50    $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_ACCOUNT_NEWSLETTERS, '', 'SSL'));
  51  
  52    $content = CONTENT_ACCOUNT_NEWSLETTERS;
  53    $javascript = $content . '.js';
  54  
  55    include (bts_select('main', $content_template)); // BTSv1.5

  56  
  57    require (DIR_WS_INCLUDES . 'application_bottom.php');
  58  ?>


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