public function SetPanelSettings() { // Have we only got one currency? Don't show anything $currencyCache = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('Currencies'); if (empty($currencyCache) || count($currencyCache) <= 2) { $this->DontDisplay = true; return; } $GLOBALS['SNIPPETS']['ChooseCurrencyList'] = ''; $query = "\n\t\t\t\tSELECT cu.currencyid, cu.currencycode, cu.currencyname, IFNULL(co.countryname, cr.couregname) AS countryname, IFNULL(co.countryiso2, cr.couregiso2) AS countryflagname,\n\t\t\t\t IF(co.countryid IS NOT NULL, 0, 1) AS currencyisregion\n\t\t\t\tFROM [|PREFIX|]currencies cu\n\t\t\t\tLEFT JOIN [|PREFIX|]countries co ON cu.currencycountryid = co.countryid\n\t\t\t\tLEFT JOIN [|PREFIX|]country_regions cr ON cu.currencycouregid = cr.couregid\n\t\t\t\tWHERE cu.currencystatus = 1\n\t\t\t\tORDER BY cu.currencyisdefault DESC, cu.currencyname ASC\n\t\t\t"; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $total = $GLOBALS['ISC_CLASS_DB']->CountResult($result); $currencyLink = GetCurrentLocation(); $currencyLink = preg_replace("#setCurrencyId=[0-9]+#", "", $currencyLink); if (strpos($currencyLink, '?') === false) { $currencyLink .= '?'; } else { if (strpos($currencyLink, '?') != strlen($currencyLink) - 1 && substr($currencyLink, -1) !== '&') { $currencyLink .= '&'; } } $currencyLink .= 'setCurrencyId='; for ($i = 1; $row = $GLOBALS['ISC_CLASS_DB']->Fetch($result); $i++) { $GLOBALS['CurrencySelected'] = ''; $GLOBALS['CurrencySwitchLink'] = isc_html_escape($currencyLink . $row['currencyid']); if ($row['currencyid'] == $GLOBALS['CurrentCurrency']) { $GLOBALS['CurrencySelected'] = 'Sel'; $GLOBALS['SelectedCurrencyID'] = $row['currencyid']; } // This needs to be in a separate general function for getting the flag if ($row['currencyisregion']) { $parts = "regions/"; } else { $parts = ""; } if (file_exists(ISC_BASE_PATH . "/lib/flags/" . $parts . strtolower($row['countryflagname']) . ".gif")) { $GLOBALS['CurrencyFlag'] = '<img src="' . GetConfig("ShopPath") . '/lib/flags/' . $parts . strtolower($row['countryflagname']) . '.gif" border="0" alt="' . isc_html_escape($row['countryname']) . '" />'; } else { $GLOBALS['CurrencyFlag'] = ''; } $GLOBALS['CurrencyID'] = $row['currencyid']; $GLOBALS['CurrencyName'] = isc_html_escape($row['currencyname']); $GLOBALS['CurrencyFlagStyle'] = ''; if ($i < $total) { $GLOBALS['CurrencyFlagStyle'] = 'border-bottom: 0px;'; } $GLOBALS['SNIPPETS']['ChooseCurrencyList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideCurrencySelectorCurrency"); } }
$GLOBALS['Year'] = isc_date('Y'); header("Content-Type: text/html; charset=" . GetConfig('CharacterSet')); STSSetEncoding(GetConfig('CharacterSet')); // Connect to the database - MySQL or PostgreSQL if (GetConfig('isSetup')) { NormalizeSSLSettings(); // Are they accessing the store via an alternate URL? if(!empty($_SERVER['HTTP_HOST'])) { $protocol = 'http'; if($_SERVER['HTTPS'] == 'on') { $protocol = 'https'; } $currentLocation = $protocol.'://'.$_SERVER['HTTP_HOST'].'/'.trim(GetCurrentLocation(), '/').'/'; $alternateUrls = GetConfig('AlternateURLs'); if(!empty($alternateUrls) && strpos($currentLocation, GetConfig('ShopPath').'/') === false) { foreach(GetConfig('AlternateURLs') as $url) { $url = rtrim($url, '/').'/'; if(strpos($currentLocation, $url) !== false) { $parsedLocation = ParseShopPath($url); $GLOBALS['ISC_CFG']['ShopPath'] = $parsedLocation['shopPath']; break; } } } } // Setup SSL options and links SetupSSLOptions();
/** * Get the current URL of the current visitor. * * @return string The current URL */ function GetCurrentURL() { if ($_SERVER['HTTPS'] == 'on') { $url = 'https://'; } else { $url = 'http://'; } $url .= $_SERVER['SERVER_NAME']; $url .= GetCurrentLocation(); return $url; }