From 10aea6b68a8f2a852098c8f8b1c6d1b549606ba4 Mon Sep 17 00:00:00 2001 From: Wruczek Date: Fri, 1 Jul 2016 03:03:44 +0200 Subject: [PATCH] Added PHP version check --- include/modulecheck.php | 19 ++++++++++++++++++- index.php | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/include/modulecheck.php b/include/modulecheck.php index 1cbeda6..03f55e2 100644 --- a/include/modulecheck.php +++ b/include/modulecheck.php @@ -30,6 +30,23 @@ service apache2 reload } */ +function isPHPVersionSupported() { + if (!defined('PHP_VERSION_ID')) { + $version = explode('.', PHP_VERSION); + define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2])); + } + + return PHP_VERSION_ID >= 50300; +} + +if (!isPHPVersionSupported()) { + $title = 'Niewspierana wersja PHP'; + + $text = '

Posiadasz starą, niewspieraną wersję PHP.

Twoja wersja PHP: ' . phpversion() . ', minimalna wymagana wersja PHP: 5.3.0.

Zaktualizuj PHP i spróbuj ponownie.

'; + + die(showError($title, $text)); +} + if(!file_exists(__DIR__ . "/../config/config.php")) { $title = 'Brak pliku config.php'; @@ -84,7 +101,7 @@ function showError($title, $text) { ?> diff --git a/index.php b/index.php index 903c281..d5ef228 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,5 @@