Permalink
Browse files

Revert "Use cURL Server Recommendation in localizations"

file gives back array
This reverts commit 86c25ec.
  • Loading branch information...
1 parent 86c25ec commit 1beed074cc9cb3c57382d2a25e499cbe32552e1a @tgely committed Sep 8, 2010
@@ -1,31 +1,23 @@
<?php
/*
- osCommerce Online Merchant $osCommerce-SIG$
- Copyright (c) 2010 osCommerce (http://www.oscommerce.com)
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2003 osCommerce
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License v2 (1991)
as published by the Free Software Foundation.
*/
function quote_oanda_currency($code, $base = DEFAULT_CURRENCY) {
- if (function_exists('curl_init')) {
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, 'http://www.oanda.com/convert/fxdaily?value=1&redirected=1&exch=' . $code . '&format=CSV&dest=Get+Table&sel_list=' . $base);
- curl_setopt($curl, CURLOPT_HEADER, 0);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($curl, CURLOPT_TRANSFERTEXT, 1);
- $page = curl_exec($curl);
- curl_close($curl);
- } elseif (function_exists('allow_url_fopen')) {
- $page = file('http://www.oanda.com/convert/fxdaily?value=1&redirected=1&exch=' . $code . '&format=CSV&dest=Get+Table&sel_list=' . $base);
- } else {
- $page = "";
- }
+ $page = file('http://www.oanda.com/convert/fxdaily?value=1&redirected=1&exch=' . $code . '&format=CSV&dest=Get+Table&sel_list=' . $base);
$match = array();
- preg_match('/(.+),(\w{3}),([0-9.]+),([0-9.]+)/i', $page, $match);
+ preg_match('/(.+),(\w{3}),([0-9.]+),([0-9.]+)/i', implode('', $page), $match);
if (sizeof($match) > 0) {
return $match[3];
@@ -35,23 +27,11 @@ function quote_oanda_currency($code, $base = DEFAULT_CURRENCY) {
}
function quote_xe_currency($to, $from = DEFAULT_CURRENCY) {
- if (function_exists('curl_init')) {
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, 'http://www.xe.com/ucc/convert.cgi?Amount=1&From=' . $from . '&To=' . $to);
- curl_setopt($curl, CURLOPT_HEADER, 0);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($curl, CURLOPT_TRANSFERTEXT, 1);
- $page = curl_exec($curl);
- curl_close($curl);
- } elseif (function_exists('allow_url_fopen')) {
- $page = file('http://www.xe.net/ucc/convert.cgi?Amount=1&From=' . $from . '&To=' . $to);
- } else {
- $page = "";
- }
+ $page = file('http://www.xe.net/ucc/convert.cgi?Amount=1&From=' . $from . '&To=' . $to);
$match = array();
- preg_match('/[0-9.]+\s*' . $from . '\s*=\s*([0-9.]+)\s*' . $to . '/', $page, $match);
+ preg_match('/[0-9.]+\s*' . $from . '\s*=\s*([0-9.]+)\s*' . $to . '/', implode('', $page), $match);
if (sizeof($match) > 0) {
return $match[1];
@@ -45,4 +45,4 @@
ms_success_currency_updated = Success: The currency exchange rate for %s (%s) has been successfully updated.
-ms_error_invalid_currency = Error: The currency exchange rate for %s (%s) was not updated. Please verify the currency code or server recommended functions and try again.
+ms_error_invalid_currency = Error: The currency exchange rate for %s (%s) was not updated. Please verify the currency code and try again.

0 comments on commit 1beed07

Please sign in to comment.