forked from szerko/Respond2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
283 lines (235 loc) · 8.53 KB
/
test.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<?php
include 'app.php';
$language = 'en';
// test for gettext
if (function_exists("gettext")){
// set language to preferred language (HTTP_ACCEPT_LANGUAGE)
$supported = Utilities::GetSupportedLanguages('');
$language = Utilities::GetPreferredLanguage($supported);
Utilities::SetLanguage($language);
}
else{
// fallback for gettext
function _($str){
return $str;
}
}
?>
<!DOCTYPE html>
<html lang="<?php print str_replace('_', '-', $language) ?>">
<head>
<title><?php print _("Test Installation"); ?>—<?php print BRAND; ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- include styles -->
<link href="<?php print FONT; ?>" rel="stylesheet" type="text/css">
<link href="<?php print BOOTSTRAP_CSS; ?>" rel="stylesheet">
<link href="<?php print FONTAWESOME_CSS; ?>" rel="stylesheet">
<link type="text/css" href="css/app.css?v=<?php print VERSION; ?>" rel="stylesheet">
<link type="text/css" href="css/messages.css?v=<?php print VERSION; ?>" rel="stylesheet">
<link type="text/css" href="css/login.css?v=<?php print VERSION; ?>" rel="stylesheet">
</head>
<body id="test-page">
<!-- begin content -->
<div class="content">
<h1><span class="brand"><?php print BRAND; ?></span></h1>
<div>
<p>
<?php print _("Below are some tests to help troubleshoot common problems with your installation."); ?>
</p>
<p>
<i class="fa fa-check-circle"></i> = <?php print _("success"); ?> and <i class="fa fa-times-circle"></i> = <?php print _("failure"); ?>.
</p>
<table class="test pdo">
<tr class="pdo">
<td class="test"><?php print _("PDO Enabled"); ?></td>
<td class="result">
<?php
if (class_exists('PDO')){
print '<i title="PDO enabled" class="fa fa-check-circle"></i>';
}
else{
print '<i title="PDO disabled" class="fa fa-times-circle"></i>';
}
?>
</td>
</tr>
<!-- /.pdo -->
<tr class="dir">
<td class="test"><?php print _("Sites Directory is Writeable"); ?></td>
<td class="result">
<?php
if (is_writable('sites')){
print '<i title="Directory is writeable" class="fa fa-check-circle"></i>';
}
else{
print '<i title="Directory is not writeable" class="fa fa-times-circle"></i>';
}
?>
</td>
</tr>
<!-- /.dir -->
<tr class="gd">
<td class="test"><?php print _("GD Library is installed"); ?></td>
<td class="result">
<?php
if (extension_loaded('gd') && function_exists('gd_info')) {
print '<i title="GD library is installed" class="fa fa-check-circle"></i>';
}
else{
print '<i title="GD library is not installed" class="fa fa-times-circle"></i>';
}
?>
</td>
</tr>
<!-- /.gd -->
<tr class="version">
<td class="test"><?php print _("PHP Version is greater than 5.3"); ?></td>
<td class="result">
<?php
if (!defined('PHP_VERSION_ID')) {
$version = explode('.', PHP_VERSION);
define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
}
if (PHP_VERSION_ID > 50300) {
print '<i title="Greater than 5.3" class="fa fa-check-circle"></i>';
}
else{
print '<i title="Greater than 5.3" class="fa fa-times-circle"></i>';
}
?>
</td>
</tr>
<!-- /.version -->
<tr class="db">
<td class="test"><?php print _("Database connection works"); ?></td>
<td class="result">
<?php
try{
$db = DB::get();
print '<i title="Database connection works" class="fa fa-check-circle"></i>';
}
catch(PDOException $e){
print '<i title="Database not connected" class="fa fa-times-circle"></i>';
}
?>
</td>
</tr>
<!-- /.db -->
<tr class="curl">
<td class="test"><?php print _("CURL enabled"); ?></td>
<td class="result">
<?php
if (function_exists('curl_version')) {
print '<i title="Curl is installed" class="fa fa-check-circle"></i>';
}
else{
print '<i title="Curl is not installed" class="fa fa-times-circle"></i>';
}
?>
</td>
</tr>
<!-- /.curl -->
<tr class="app-url">
<td class="test"><?php print _("APP_URL is set in app.php"); ?></td>
<td class="result">
<?php
if (APP_URL != 'http://urloftheapp.com') {
print '<i title="APP_URL is set" class="fa fa-check-circle"></i>';
}
else{
print '<i title="APP_URL is set" class="fa fa-times-circle"></i>';
}
?>
</td>
</tr>
<!-- /.app-url -->
<tr class="mod-rewrite">
<td class="test"><?php print _("MOD_REWRITE is working"); ?></td>
<td class="result">
<?php
$url = APP_URL.'/create';
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE);
/* Get the HTML or whatever is linked in $url. */
$response = curl_exec($handle);
/* Check for 200*/
$httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
if($httpCode == 200) {
print '<i title="MOD_REWRITE working" class="fa fa-check-circle"></i>';
}
else{
print '<i title="MOD_REWRITE not working" class="fa fa-times-circle"></i>';
}
?>
</td>
</tr>
<!-- /.mod-rewrite -->
<tr class="api">
<td class="test"><?php print _("API is working"); ?></td>
<td class="result">
<?php
$url = APP_URL.'/api/site/test';
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE);
/* Get the HTML or whatever is linked in $url. */
$response = curl_exec($handle);
/* Check for 200*/
$httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
if($httpCode == 200 && $response=='API works!') {
print '<i title="API working" class="fa fa-check-circle"></i>';
}
else{
print '<i title="API not working" class="fa fa-times-circle"></i>';
}
?>
</td>
</tr>
<!-- /.api -->
<tr class="api">
<td class="test"><?php print _("Gettext is installed"); ?></td>
<td class="result">
<?php
if (function_exists("gettext")){
print '<i title="Gettext is working" class="fa fa-check-circle"></i>';
}
else{
print '<i title="Gettext is not working" class="fa fa-times-circle"></i>';
}
?> </td>
</tr>
<!-- /.gettext -->
<tr class="magic-quotes">
<td class="test"><?php print _("Magic Quotes not automatically Escaping"); ?></td>
<td class="result">
<?php
// #ref: http://stackoverflow.com/questions/5801951/does-php-auto-escapes-quotes-in-string-which-is-passed-by-get-or-post
if (get_magic_quotes_gpc() === 1) {
print '<i title="Magic Quotes Enabled" class="fa fa-times-circle"></i>';
}
else{
print '<i title="Magic Quotes Enabled" class="fa fa-check-circle"></i>';
}
?>
</td>
</tr>
<!-- /.magic-quotes -->
</table>
<p>
<?php print _("For help troubleshooting your installation, visit:"); ?>
<a href="http://respondcms.com/documentation/troubleshooting-installation">respondcms.com/documentation/troubleshooting-installation</a>
</p>
</div>
<small><?php print COPY; ?></small>
</div>
<!-- /.content -->
</body>
<!-- include js -->
<script type="text/javascript" src="<?php print JQUERY_JS; ?>"></script>
<script type="text/javascript" src="<?php print JQUERYUI_JS; ?>"></script>
<script type="text/javascript" src="<?php print BOOTSTRAP_JS; ?>"></script>
<script type="text/javascript" src="<?php print KNOCKOUT_JS; ?>"></script>
<script type="text/javascript" src="js/helper/moment.min.js?v=<?php print VERSION; ?>"></script>
<script type="text/javascript" src="js/global.js?v=<?php print VERSION; ?>"></script>
<script type="text/javascript" src="js/messages.js?v=<?php print VERSION; ?>"></script>
<script type="text/javascript" src="js/viewModels/createModel.js?v=<?php print VERSION; ?>"></script>
</html>