forked from statamic/Check
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check.php
163 lines (144 loc) · 5 KB
/
check.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
/* If you see this text, it means that your server is not running PHP, which means that you can’t run Cinematico. Ask your system administrator to install PHP. */
?>
<?php
$is_ready = true;
if (version_compare(PHP_VERSION, '5.3.6', '>=') != true) $is_ready = false;
$have_rewrite = apache_is_module_loaded('mod_rewrite');
if ($have_rewrite != true) $is_ready = false;
?>
<!doctype html>
<html>
<head>
<title>Cinematico Server Check</title>
<link href="http://fonts.googleapis.com/css?family=Lato:300,400,700,400italic,700italic" rel="stylesheet" type="text/css">
<style>
body {
background: #ffffff;
font-family: 'Lato', sans-serif;
font-size: 14px;
line-height: 20px;
color: #404040;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-webkit-text-size-adjust: 100%;
width: auto;
height: auto;
margin: 0;
padding: 0;
}
#container {
width: 520px;
padding: 150px;
}
hr {
border: none;
background-color: #ebebeb;
height: 1px;
margin: 40px 0;
}
h2 {
font-size: 34px;
color: #202020;
margin: 0 0 20px 0;
padding: 0;
}
h3 {
font-size: 16px;
color: #202020;
margin: 0 0 10px 0;
padding: 0;
}
p {
padding: 0;
}
ul {
list-style: none;
margin: 0 0 40px 0;
padding: 0;
}
.pass {
color: #60b86b;
}
.button {
background-color: #60b86b;
font-size: 14px;
line-height: 20px;
color: #ffffff;
text-decoration: none;
margin: 0 0 5px 0;
padding: 8px 14px 10px;
display: inline-block;
}
</style>
</head>
<body>
<div id="container">
<h2>Cinematico Server Check</h2>
<?php if ($is_ready): ?>
<p>Congrats! Your server seems worthy. You are ready for Cinematico.</p>
<a class="button" href="http://cinemati.co">Get Cinematico</a>
<?php else: ?>
<?php if ($have_rewrite): ?>
<p>It seems that your server may not be ready for Cinematico.</p>
<?php else: ?>
<p>Curious, it seems that your server may not be ready. We could not determine if Mod Rewrite was enabled or not.</p>
<?php endif ?>
<?php endif; ?>
<hr>
<h3>PHP Version</h3>
<?php if (version_compare(PHP_VERSION, '5.3', '>=')): ?>
<ul>
<li class="pass">Pass</li>
</ul>
<?php else: $failed = TRUE ?>
<ul>
<li class="fail">Failed: <?php echo PHP_VERSION ?></li>
<li class="note">Cinematico requires PHP 5.3 or newer.</li>
</ul>
<?php endif ?>
<hr>
<h3>Mod Rewrite</h3>
<?php $have_module = apache_is_module_loaded('mod_rewrite'); ?>
<?php if ($have_module): ?>
<ul>
<li class="pass">Pass</li>
</ul>
<?php elseif ($have_module == null): ?>
<ul>
<li class="unknown">Unknown</li>
<li class="note">We could not determine if Mod Rewrite was enabled or not.</li>
</ul>
<?php else: ?>
<ul>
<li class="fail">Failed</li>
<li class="note">Ask your system administrator to enable Mod Rewrite for your site.</li>
</ul>
<?php endif ?>
<hr>
<h3>cURL</h3>
<?php $have_curl = function_exists('curl_version') ? true : false; ?>
<?php if ($have_curl): ?>
<ul>
<li class="pass">Pass</li>
</ul>
<?php else: ?>
<ul>
<li class="fail">Failed</li>
<li class="note">Ask your system administrator to enable cURL for your site</li>
</ul>
<?php endif ?>
<hr>
</div>
</body>
</html>
<?php
function apache_is_module_loaded($mod_name) {
if (function_exists('apache_get_modules')) {
$modules = apache_get_modules();
return in_array($mod_name, $modules);
} else {
return null;
}
}
?>