From cbeac572f556be6a999987792cb71ddc5bf88be6 Mon Sep 17 00:00:00 2001 From: Markus Birth Date: Mon, 25 Mar 2013 20:16:58 +0100 Subject: [PATCH 1/2] Added cURL support for version check if allow_url_fopen is disabled --- index.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index 698cf0a..c3678b1 100644 --- a/index.php +++ b/index.php @@ -8,7 +8,13 @@ if (!in_array($_SERVER["REMOTE_ADDR"], $_SESSION['allowedIPs']) && !in_array("*" $updateMsg = ''; // Check for updates if ($ICEcoder["checkUpdates"]) { - $icv = explode("\n",file_get_contents("http://icecoder.net/latest-version?thisVersion=".$ICEcoder["versionNo"])); + if (ini_get('allow_url_fopen')) { + $icv = explode("\n",file_get_contents("http://icecoder.net/latest-version?thisVersion=".$ICEcoder["versionNo"])); + } elseif (function_exists('curl_init')) { + $ch = curl_init("http://icecoder.net/latest-version?thisVersion=".$ICEcoder["versionNo"]); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + $icv = explode("\n", curl_exec($ch)); + } $icv = $icv[0]; if ($ICEcoder["versionNo"]<$icv) { $updateMsg = ";top.ICEcoder.dataMessage('UPDATE INFO: ICEcoder v ".$icv." now available. (Your version is v ".$ICEcoder["versionNo"]."). Get it free from icecoder.net');"; From f4b98cd4ffa37b1146958149e358c3bf1086aa99 Mon Sep 17 00:00:00 2001 From: Markus Birth Date: Mon, 25 Mar 2013 21:23:57 +0100 Subject: [PATCH 2/2] Versioncheck URL in variable to be re-used --- index.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index c3678b1..b4ea254 100644 --- a/index.php +++ b/index.php @@ -8,10 +8,11 @@ if (!in_array($_SERVER["REMOTE_ADDR"], $_SESSION['allowedIPs']) && !in_array("*" $updateMsg = ''; // Check for updates if ($ICEcoder["checkUpdates"]) { + $icv_url = "http://icecoder.net/latest-version?thisVersion=".$ICEcoder["versionNo"]; if (ini_get('allow_url_fopen')) { - $icv = explode("\n",file_get_contents("http://icecoder.net/latest-version?thisVersion=".$ICEcoder["versionNo"])); + $icv = explode("\n",file_get_contents($icv_url)); } elseif (function_exists('curl_init')) { - $ch = curl_init("http://icecoder.net/latest-version?thisVersion=".$ICEcoder["versionNo"]); + $ch = curl_init($icv_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $icv = explode("\n", curl_exec($ch)); }