diff --git a/history.txt b/history.txt index 93ece76..ac8fb70 100644 --- a/history.txt +++ b/history.txt @@ -1,5 +1,13 @@ =============================================================================== -== Version 2.1.5 (November 2018) +== Version 2.1.6 (February 2019) +=============================================================================== + +- Added support currencyconverterapi.com keys + + + +=============================================================================== +== Version 2.1.5 (November 2018) =============================================================================== - Added Bitcoin SV (BSV/BCHSV) @@ -159,4 +167,4 @@ Instruction - https://gourl.io/bitcoin-payment-gateway-api.html#p8 - Added Dutch Language (Thanks to Erik) - Several new enhancements - + \ No newline at end of file diff --git a/js/_source/ajax.js b/js/_source/ajax.js index 50540ed..fe528a9 100644 --- a/js/_source/ajax.js +++ b/js/_source/ajax.js @@ -4,7 +4,7 @@ * @category Javascript * @website https://gourl.io * @api https://gourl.io/api.html - * @version 2.1.5 + * @version 2.1.6 */ /** diff --git a/js/_source/cryptobox.js b/js/_source/cryptobox.js index 782c0bf..1cdf395 100644 --- a/js/_source/cryptobox.js +++ b/js/_source/cryptobox.js @@ -4,7 +4,7 @@ * @category Javascript * @website https://gourl.io * @api https://gourl.io/api.html - * @version 2.1.5 + * @version 2.1.6 */ /** diff --git a/js/_source/support.js b/js/_source/support.js index 371a244..76fa3aa 100644 --- a/js/_source/support.js +++ b/js/_source/support.js @@ -4,7 +4,7 @@ * @category Javascript * @website https://gourl.io * @api https://gourl.io/api.html - * @version 2.1.5 + * @version 2.1.6 */ /** diff --git a/lib/cryptobox.callback.php b/lib/cryptobox.callback.php index 1e0bd30..4b43181 100644 --- a/lib/cryptobox.callback.php +++ b/lib/cryptobox.callback.php @@ -11,7 +11,7 @@ * @copyright 2014-2019 Delta Consultants * @category Libraries * @website https://gourl.io - * @version 2.1.5 + * @version 2.1.6 * * * This file processes call-backs from Cryptocoin Payment Box server when new payment diff --git a/lib/cryptobox.class.php b/lib/cryptobox.class.php index 7a5bd6c..5dfa13d 100644 --- a/lib/cryptobox.class.php +++ b/lib/cryptobox.class.php @@ -15,7 +15,7 @@ * @example https://gourl.io/lib/examples/example_customize_box.php <---- * @gitHub https://github.com/cryptoapi/Payment-Gateway * @license Free GPLv2 - * @version 2.1.5 + * @version 2.1.6 * * * CLASS CRYPTOBOX - LIST OF METHODS: @@ -79,7 +79,7 @@ elseif (!defined('ABSPATH')) exit; // Wordpress -define("CRYPTOBOX_VERSION", "2.1.5"); +define("CRYPTOBOX_VERSION", "2.1.6"); // GoUrl supported crypto currencies define("CRYPTOBOX_COINS", json_encode(array('bitcoin', 'bitcoincash', 'bitcoinsv', 'litecoin', 'dash', 'dogecoin', 'speedcoin', 'reddcoin', 'potcoin', 'feathercoin', 'vertcoin', 'peercoin', 'monetaryunit', 'universalcurrency'))); @@ -1104,7 +1104,7 @@ public function display_cryptobox_bootstrap ($coins = array(), $def_coin = "", $ $tmp .= "
"; - if ($qrcodeSize) $tmp .= "
qrcode
"; + if ($qrcodeSize) $tmp .= "
qrcode
"; $tmp .= "

 

"; $tmp .= "
"; @@ -1782,9 +1782,10 @@ function get_country_name($countryID, $reverse = false) * * Currency Converter using live exchange rates websites * Example - convert_currency_live("EUR", "USD", 22.37) - convert 22.37euro to usd - convert_currency_live("EUR", "BTC", 22.37) - convert 22.37euro to bitcoin + convert_currency_live("EUR", "BTC", 22.37) - convert 22.37euro to bitcoin + optional - currencyconverterapi_key you can get on https://free.currencyconverterapi.com/free-api-key */ - function convert_currency_live($from_Currency, $to_Currency, $amount) + function convert_currency_live($from_Currency, $to_Currency, $amount, $currencyconverterapi_key = "") { static $arr = array(); @@ -1888,8 +1889,9 @@ function convert_currency_live($from_Currency, $to_Currency, $amount) // ---------------- if (!$val) { - $data = json_decode(get_url_contents("https://free.currencyconverterapi.com/api/v6/convert?q=".$key."&compact=y"), TRUE); - if (isset($data[$key]["val"]) && $data[$key]["val"] > 0) $val = $data[$key]["val"]; + $data = json_decode(get_url_contents("https://free.currencyconverterapi.com/api/v6/convert?q=".$key."&compact=ultra&apiKey=".$currencyconverterapi_key, 20, TRUE), TRUE); + if (isset($data[$key]) && $data[$key] > 0) $val = $data[$key]; + elseif(isset($data["error"])) echo "

Error in function convert_currency_live(...)! ". $data["error"] . "

"; } @@ -1917,7 +1919,7 @@ function convert_currency_live($from_Currency, $to_Currency, $amount) /* I. Get URL Data */ - function get_url_contents( $url, $timeout = 20 ) + function get_url_contents( $url, $timeout = 20, $ignore_httpcode = false ) { $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); @@ -1931,7 +1933,7 @@ function get_url_contents( $url, $timeout = 20 ) $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); - return ($httpcode>=200 && $httpcode<300) ? $data : false; + return (($httpcode>=200 && $httpcode<300) || $ignore_httpcode) ? $data : false; } @@ -2007,11 +2009,18 @@ function run_sql($sql) } } $mysqli = @mysqli_connect($dbhost, DB_USER, DB_PASSWORD, DB_NAME, $port, $socket); + $err = (mysqli_connect_errno()) ? mysqli_connect_error() : ""; + if ($err) + { + // try SSL connection + $mysqli = mysqli_init(); + $mysqli->real_connect ($dbhost, DB_USER, DB_PASSWORD, DB_NAME, $port, $socket, MYSQLI_CLIENT_SSL); + } if (mysqli_connect_errno()) { echo "
Error. Can't connect to your MySQL server. You need to have PHP 5.2+ and MySQL 5.5+ with mysqli extension activated. Instruction »\n"; if (!CRYPTOBOX_WORDPRESS) echo "
Also please check DB username/password in file cryptobox.config.php\n"; - die("
Server has returned error - ".mysqli_connect_error().""); + die("
Server has returned error - ".$err.""); } $mysqli->query("SET NAMES utf8"); } @@ -2274,6 +2283,6 @@ function run_sql($sql) foreach ($cryptobox_private_keys as $v) if (strpos($v, " ") !== false || strpos($v, "PRV") === false || strpos($v, "AA") === false || strpos($v, "77") === false) die("Invalid Private Key - ". (CRYPTOBOX_WORDPRESS ? "please setup it on your plugin settings page" : "$v in variable \$cryptobox_private_keys, file cryptobox.config.php.")); - unset($v); unset($cryptobox_private_keys); + unset($v); unset($cryptobox_private_keys); } ?> \ No newline at end of file diff --git a/readme.md b/readme.md index 1673655..f8bb60d 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ GoUrl.io Cryptocoin Payment Gateway API ----------------------------------------- -Version 2.1.5 +Version 2.1.6 **Accept Bitcoin, Bitcoin Cash, Bitcoin SV, Litecoin, Dash, Dogecoin, Speedcoin, Reddcoin, Potcoin, Feathercoin, Vertcoin, Peercoin, UniversalCurrency, MonetaryUnit Payments Online on your website**