<?php /** * initialise currencies * see {@link http://www.zen-cart.com/wiki/index.php/Developers_API_Tutorials#InitSystem wikitutorials} for more details. * * @package initSystem * @copyright Copyright 2003-2005 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: init_currencies.php 2753 2005-12-31 19:17:17Z wilt $ */ if (!defined('IS_ADMIN_FLAG')) { die('Illegal Access'); } if (!isset($_SESSION['currency']) || isset($_GET['currency']) || USE_DEFAULT_LANGUAGE_CURRENCY == 'true' && LANGUAGE_CURRENCY != $_SESSION['currency']) { if (isset($_GET['currency'])) { if (!($_SESSION['currency'] = zen_currency_exists($_GET['currency']))) { $_SESSION['currency'] = USE_DEFAULT_LANGUAGE_CURRENCY == 'true' ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY; } } else { $_SESSION['currency'] = USE_DEFAULT_LANGUAGE_CURRENCY == 'true' ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY; } }
* @copyright Copyright 2003-2007 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: init_currencies.php 6300 2007-05-11 15:49:41Z drbyte $ */ if (!defined('IS_ADMIN_FLAG')) { die('Illegal Access'); } // If no currency is set, use appropriate default if (!isset($_SESSION['currency']) && !isset($_GET['currency'])) { $_SESSION['currency'] = DEFAULT_CURRENCY; } // Validate selected new currency, if any. Is false if valid not found. $new_currency = isset($_GET['currency']) ? zen_currency_exists($_GET['currency']) : zen_currency_exists($_SESSION['currency']); // Validate language-currency and default-currency if relevant. Is false if valid not found. if ($new_currency == false || isset($_GET['language'])) { $new_currency = USE_DEFAULT_LANGUAGE_CURRENCY == 'true' ? zen_currency_exists(LANGUAGE_CURRENCY) : $new_currency; } // Final check -- if selected currency is bad and the "default" is bad, default to the first-found currency in order of exch rate. if ($new_currency == false) { $new_currency = zen_currency_exists(DEFAULT_CURRENCY, true); } //echo '<br />NEW = ' . $new_currency . '<br />'; // Now apply currency update if (isset($_GET['currency']) || isset($_GET['language']) && USE_DEFAULT_LANGUAGE_CURRENCY == 'true' && LANGUAGE_CURRENCY != $_SESSION['currency']) { $_SESSION['currency'] = $new_currency; // redraw the page without the currency/language info in the URL if (isset($_GET['currency']) || isset($_GET['language'])) { zen_redirect(zen_href_link($current_page_base, zen_get_all_get_params(array('currency', 'language')))); } }
define('DIR_WS_TEMPLATE_IMAGES', DIR_WS_TEMPLATE . 'images/'); define('DIR_WS_TEMPLATE_ICONS', DIR_WS_TEMPLATE_IMAGES . 'icons/'); require DIR_FS_CLASSES . 'template_func.php'; $template = new template_func(DIR_WS_TEMPLATE); $gBitSmarty->assign_by_ref('commerceTemplate', $template); // include the language translations // include template specific language files if (file_exists(DIR_WS_LANGUAGES . $template_dir . '/' . $gBitCustomer->getLanguage() . '.php')) { $template_dir_SELECT = $template_dir . '/'; //die('Yes ' . DIR_WS_LANGUAGES . $template_dir . '/' . $gBitCustomer->getLanguage() . '.php'); } else { //die('NO ' . DIR_WS_LANGUAGES . $template_dir . '/' . $gBitCustomer->getLanguage() . '.php'); $template_dir_SELECT = ''; } $langFile = DIR_WS_LANGUAGES . $template_dir_SELECT . $gBitCustomer->getLanguage() . '.php'; if (!file_exists($langFile)) { $langFile = DIR_WS_LANGUAGES . $template_dir_SELECT . 'en.php'; } require $langFile; // include the extra language translations include DIR_FS_MODULES . 'extra_definitions.php'; // currency if (empty($_SESSION['currency']) || isset($_REQUEST['currency']) || USE_DEFAULT_LANGUAGE_CURRENCY == 'true' && LANGUAGE_CURRENCY != $_SESSION['currency']) { if (isset($_REQUEST['currency'])) { if (zen_currency_exists($_REQUEST['currency'])) { $_SESSION['currency'] = $_REQUEST['currency']; } else { $_SESSION['currency'] = USE_DEFAULT_LANGUAGE_CURRENCY == 'true' ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY; } } }