1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Checks whether php version is compatible with Rudolf. |
5
|
|
|
* |
6
|
|
|
* @param float $minimumVersionPHP |
7
|
|
|
*/ |
8
|
|
|
function php_compatibility_check($minimumVersionPHP) |
9
|
|
|
{ |
10
|
|
|
$phpVersion = PHP_VERSION; |
11
|
|
|
|
12
|
|
|
if (version_compare($phpVersion, $minimumVersionPHP, '<')) { |
13
|
|
|
php_compatibility_error($minimumVersionPHP); |
14
|
|
|
} |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Displays an error if the PHP version is too low. |
19
|
|
|
* |
20
|
|
|
* Calling this function kills execution immediately. |
21
|
|
|
* |
22
|
|
|
* @param float $minimumVersionPHP |
23
|
|
|
*/ |
24
|
|
|
function php_compatibility_error($minimumVersionPHP) |
25
|
|
|
{ |
26
|
|
|
$pageTitle = 'Error to start the Rudolf!'; |
27
|
|
|
$shortText = 'Your host needs to use PHP '.$minimumVersionPHP.' or higher to run this version of Rudolf!'; |
28
|
|
|
$longText = 'To run Rudolf, you must upgrade your copy of PHP.'; |
29
|
|
|
|
30
|
|
|
php_compatibility_error_display($pageTitle, $shortText, $longText); |
31
|
|
|
|
32
|
|
|
die(1); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Display user-friendly error. |
37
|
|
|
* |
38
|
|
|
* @param string $pageTitle |
39
|
|
|
* @param string $shortText |
40
|
|
|
* @param string $longText |
41
|
|
|
*/ |
42
|
|
|
function php_compatibility_error_display($pageTitle, $shortText, $longText) |
43
|
|
|
{ |
44
|
|
|
header('Content-type: text/html; charset=UTF-8'); |
45
|
|
|
header('Cache-control: none'); |
46
|
|
|
header('Pragma: no-cache'); ?><!DOCTYPE html> |
47
|
|
|
<html> |
48
|
|
|
<head> |
49
|
|
|
<meta charset="utf-8"> |
50
|
|
|
<title><?php echo $pageTitle; ?></title> |
51
|
|
|
<style type="text/css"> |
52
|
|
|
body { |
53
|
|
|
background: #f1f1f1; |
54
|
|
|
font-family: Arial, sans-serif; |
55
|
|
|
color: #444; |
56
|
|
|
} |
57
|
|
|
.centered { |
58
|
|
|
max-width: 500px; |
59
|
|
|
min-width: 200px; |
60
|
|
|
margin: 40px auto; |
61
|
|
|
padding: 15px; |
62
|
|
|
background: #fff; |
63
|
|
|
box-shadow: 1px 2px 3px #aaa; |
64
|
|
|
} |
65
|
|
|
h1 { |
66
|
|
|
font-weight: normal; |
67
|
|
|
margin: 5px 10px 20px; |
68
|
|
|
} |
69
|
|
|
p { |
70
|
|
|
margin: 10px; |
71
|
|
|
color: #555; |
72
|
|
|
} |
73
|
|
|
</style> |
74
|
|
|
</head> |
75
|
|
|
<body> |
76
|
|
|
<div class="centered"> |
77
|
|
|
<h1><?php echo $pageTitle; ?></h1> |
78
|
|
|
<p><?php echo $shortText; ?></p> |
79
|
|
|
<p><?php echo $longText; ?></p> |
80
|
|
|
</div> |
81
|
|
|
</body> |
82
|
|
|
</html><?php |
83
|
|
|
} |
84
|
|
|
|