Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Use cURL for version check if allow_url_fopen is disabled #210

Merged
merged 2 commits into from

2 participants

Markus Birth Matt Pass
Markus Birth

ICEcoder gave an error message on a server where allow_url_fopen is disabled. And it didn't notify about a new version. This change adds cURL support as an alternative.

Matt Pass
Owner

@mbirth This looks like a great idea, tho setting the URL in a var and using that would be better than having it hardcoded twice and save a few bytes?

Markus Birth

You mean like this? ;)

Matt Pass
Owner

Perfect! Many thanks :)

Matt Pass mattpass merged commit c1549fa into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 1 deletion.
  1. +8 −1 index.php
9 index.php
View
@@ -8,7 +8,14 @@
$updateMsg = '';
// Check for updates
if ($ICEcoder["checkUpdates"]) {
- $icv = explode("\n",file_get_contents("http://icecoder.net/latest-version?thisVersion=".$ICEcoder["versionNo"]));
+ $icv_url = "http://icecoder.net/latest-version?thisVersion=".$ICEcoder["versionNo"];
+ if (ini_get('allow_url_fopen')) {
+ $icv = explode("\n",file_get_contents($icv_url));
+ } elseif (function_exists('curl_init')) {
+ $ch = curl_init($icv_url);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ $icv = explode("\n", curl_exec($ch));
+ }
$icv = $icv[0];
if ($ICEcoder["versionNo"]<$icv) {
$updateMsg = ";top.ICEcoder.dataMessage('<b>UPDATE INFO:</b> ICEcoder v ".$icv." now available. (Your version is v ".$ICEcoder["versionNo"]."). Get it free from <a href=\\'http://icecoder.net\\' target=\\'_blank\\' style=\\'color:#ddd\\'>icecoder.net</a>');";
Something went wrong with that request. Please try again.