clearCache(); if (!$config['currecyAuto']) { if (function_exists('curl_init')) { $curl_handle = curl_init(); curl_setopt($curl_handle, CURLOPT_URL, 'http://download.finance.yahoo.com/d/quotes.csv?s='.$config['defaultCurrency'].$_GET['currencyISO'].'=X&f=sl1d1t1c1ohgv&e=.csv'); curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); $contents = curl_exec($curl_handle); curl_close($curl_handle); } else { if (!$handle = fopen("http://finance.yahoo.com/d/quotes.csv?s=".$config['defaultCurrency'].$_GET['currencyISO']."=X&f=sl1d1t1c1ohgv&e=.csv", "rb")) { $handle = fopen("http://uk.old.finance.yahoo.com/d/quotes.csv?s=".$config['defaultCurrency'].$_GET['currencyISO']."=X&f=sl1d1t1c1ohgv&e=.csv", "rb"); } if (function_exists('stream_get_contents')) { $contents = stream_get_contents($handle); } else { while (!feof($handle)) { $contents .= fread($handle, 8192); } } fclose($handle); } $pieces = explode(',', $contents); $rate = $pieces[1]; } $where = "code = ".$db->mySQLSafe($_GET['currencyISO']); $record['value'] = $db->mySQLSafe($rate); $record['lastUpdated'] = $db->mySQLSafe(time()); $update = $db->update($glob['dbprefix']."CubeCart_currencies", $record, $where); // clear cache $cache = new cache('glob.currencyVars.'.$_GET['currencyISO']); $cache->clearCache(); if($update == TRUE) { $msg = '

"' .$_GET['currencyISO']."' ".$lang['admin']['settings_update_success']."

"; } else { $msg = "

'".$_GET['currencyISO']."' ".$lang['admin']['settings_update_fail']."

"; } } elseif(isset($_POST['currencyId'])) { $cache = new cache(); $cache->clearCache(); $record["code"] = $db->mySQLSafe($_POST['code']); $record["name"] = $db->mySQLSafe($_POST['name']); $record["symbolLeft"] = $db->mySQLSafe(validHTML($_POST['symbolLeft'])); $record["symbolRight"] = $db->mySQLSafe(validHTML($_POST['symbolRight'])); $record["value"] = $db->mySQLSafe($_POST['value']); $record["decimalPlaces"] = $db->mySQLSafe($_POST['decimalPlaces']); $record["decimalSymbol"] = $db->mySQLSafe($_POST['decimalSymbol']); $record["lastUpdated"] = $db->mySQLSafe(time()); if($_POST['currencyId']>0) { $where = "currencyId = ".$db->mySQLSafe($_POST['currencyId']); $update = $db->update($glob['dbprefix']."CubeCart_currencies", $record, $where); if($update == TRUE) { $msg = "

'".$_POST['name']."' ".$lang['admin']['settings_update_success']."

"; } else { $msg = "

'".$_POST['name']."' ".$lang['admin']['settings_update_fail']."

"; } } else { $insert =$db->insert($glob['dbprefix']."CubeCart_currencies", $record); if($insert == TRUE) { $msg = "

'".$_POST['name']."' ".$lang['admin']['settings_add_success']."

"; } else { $msg = "

'".$_POST['name']."' ".$lang['admin']['settings_add_fail']."

"; } } } elseif(isset($_GET['deleteCurrency'])) { $cache = new cache(); $cache->clearCache(); $where = "currencyId = ".$db->mySQLSafe($_GET['deleteCurrency']); $delete = $db->delete($glob['dbprefix']."CubeCart_currencies", $where, ""); if($delete == TRUE) { $msg = "

".$lang['admin']['settings_delete_success']."

"; } else { $msg = "

".$lang['admin']['settings_delete_failed']."

"; } } elseif(isset($_GET['active']) && $_GET['currencyId']>0) { $cache = new cache(); $cache->clearCache(); $record["active"] = $_GET['active']; $where = "currencyId = ".$db->mySQLSafe($_GET['currencyId']); $update =$db->update($glob['dbprefix']."CubeCart_currencies", $record, $where); } $currenciesPerPage = 20; // get countries $query ="SELECT * FROM ".$glob['dbprefix']."CubeCart_currencies ORDER BY name ASC"; if(isset($_GET['page'])) { $page = $_GET['page']; } else { $page = 0; } $currencies = $db->select($query, $currenciesPerPage, $page); $numrows = $db->numrows($query); $pagination = paginate($numrows, $currenciesPerPage, $page, "page"); require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php"); ?>

0) { $editCurrency = $db->select("select * FROM ".$glob['dbprefix']."CubeCart_currencies WHERE currencyId = ".$db->mySQLsafe($_GET['editCurrency'])); } ?>

href="?_g=settings/currency&currencyISO=" class="txtLink">
0){ ?> href="?_g=settings/currency&currencyId=&code=&active=0" class="txtLink"> href="?_g=settings/currency&currencyId=&code=&active=1" class="txtLink">
href="?_g=settings/currency&editCurrency=" class="txtLink">
href="javascript:decision('','?_g=settings/currency&deleteCurrency=&code=');" class="txtLink">