From 8b30c8b2ebef4e2e00f549d484659d516368a68d Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Tue, 21 Jan 2014 16:38:29 +0000 Subject: [PATCH] Add getting plugin data via curl as alt method Not all servers can get external data using file_get_contents due to security retstrictions --- lib/plugins-manager.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/plugins-manager.php b/lib/plugins-manager.php index fd86972..c6eac5c 100644 --- a/lib/plugins-manager.php +++ b/lib/plugins-manager.php @@ -5,7 +5,13 @@ include("settings.php"); $pluginsDataSrc = "http://icecoder.net/plugin-data?format=JSON"; // Now get our plugin data and put into a PHP array -$pluginsDataJS = file_get_contents($pluginsDataSrc, false, $context); +if (ini_get('allow_url_fopen')) { + $pluginsDataJS = file_get_contents($pluginsDataSrc, false, $context); +} elseif (function_exists('curl_init')) { + $pDSrc = curl_init($pluginsDataSrc); + curl_setopt($pDSrc, CURLOPT_RETURNTRANSFER, true); + $pluginsDataJS = curl_exec($pDSrc); +} $pluginsData = json_decode($pluginsDataJS, true); // If we have an action to perform