Explorar el Código

Merge branch 'VersionChecks' of https://github.com/logmanoriginal/rss-bridge

logmanoriginal hace 7 años
padre
commit
d06006d681
Se han modificado 1 ficheros con 15 adiciones y 1 borrados
  1. 15 1
      index.php

+ 15 - 1
index.php

@@ -10,6 +10,9 @@ TODO :
 - implement header('X-Cached-Version: '.date(DATE_ATOM, filemtime($cachefile)));
 */
 
+// Defines the minimum required PHP version for RSS-Bridge
+define('PHP_VERSION_REQUIRED', '5.6.0');
+
 //define('PROXY_URL', 'tcp://192.168.0.0:28');
 // Set to true if you allow users to disable proxy usage for specific bridges
 define('PROXY_BYBRIDGE', false);
@@ -50,10 +53,21 @@ if(file_exists('DEBUG')){
 
 require_once __DIR__ . '/lib/RssBridge.php';
 
+// Check PHP version
+if(version_compare(PHP_VERSION, PHP_VERSION_REQUIRED) === -1)
+	die('RSS-Bridge requires at least PHP version ' . PHP_VERSION_REQUIRED . '!');
+
 // extensions check
 if(!extension_loaded('openssl'))
 	die('"openssl" extension not loaded. Please check "php.ini"');
 
+if(!extension_loaded('libxml'))
+	die('"libxml" extension not loaded. Please check "php.ini"');
+
+// configuration checks
+if(ini_get('allow_url_fopen') !== "1")
+	die('"allow_url_fopen" is not set to "1". Please check "php.ini');
+
 // FIXME : beta test UA spoofing, please report any blacklisting by PHP-fopen-unfriendly websites
 ini_set('user_agent', 'Mozilla/5.0(X11; Linux x86_64; rv:30.0)
  Gecko/20121202 Firefox/30.0(rss-bridge/0.1;
@@ -126,7 +140,7 @@ try {
 		}
 
 		$params = $_GET;
-		
+
 		// Initialize cache
 		$cache = Cache::create('FileCache');
 		$cache->setPath(CACHE_DIR);