-
Notifications
You must be signed in to change notification settings - Fork 16
/
report.php
121 lines (117 loc) · 3.96 KB
/
report.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
<?php
/**
* RESTfm - FileMaker RESTful Web Service
*
* @copyright
* Copyright (c) 2011-2017 Goya Pty Ltd.
*
* @license
* Licensed under The MIT License. For full copyright and license information,
* please see the LICENSE file distributed with this package.
* Redistributions of files must retain the above copyright notice.
*
* @link
* http://restfm.com
*
* @author
* Gavin Stewart
*/
/**
* @file
* Initial setup and diagnostic report.
*/
require_once('lib/RESTfm/Diagnostics.php');
require_once('lib/RESTfm/Config.php');
require_once('lib/RESTfm/Version.php');
$diagnostics = new RESTfm\Diagnostics();
$diagnostics->setCallingFilename('report.php');
$diagnostics->setDocumentRoot(dirname($_SERVER['SCRIPT_FILENAME']));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>RESTfm report</title>
<style type="text/css">
body {
font-family: Lucida Grande, Lucida Sans, Arial, sans-serif;
font-size: 62.5%;
}
#logo {
float: right;
font-size: 1.0em;
}
#logo > a {
display: block;
}
#logo > span {
float: right;
margin-top: -7px;
}
div {
font-size: 1.3em;
}
table {
border: 1px solid #CCCCCC;
border-collapse: collapse;
}
tr { border-bottom: 1px solid #CCCCCC }
td {
border-right: 1px solid #CCCCCC;
padding: 6px;
vertical-align: top;
}
pre {
overflow: auto;
margin: 0px;
}
.OK { background-color: #E5FFE2 }
.INFO { background-color: #D3EDFF }
.WARN { background-color: #FFFCE5 }
.ERROR { background-color: #FFD2D6 }
</style>
</head>
<body>
<?php if (RESTfm\Config::getVar('settings', 'diagnostics') === TRUE): // Diagnostics enabled. ?>
<div id="logo">
<a target="_blank" href="https://restfm.com"><img width="106" height="33" src="css/RESTfm.logo.png" alt="RESTfm logo"></a>
<span><?php echo RESTfm\Version::getRelease() ?></span>
</div>
<h2>RESTfm report</h2>
<?php
$diagnostics->run();
if ($diagnostics->hasErrors) {
echo '<h3>RESTfm is not working. Errors have been detected.</h3>' . "\n";
echo '<h3>Start by correcting the topmost error first, and reloading the page each time.</h3>' . "\n";
} else {
// Safari cannot get no-cache right, so we force it with a
// random parameter that does nothing other than make the browser
// request the page again rather than use it from cache.
$safariNoCache="";
if ( stripos($_SERVER['HTTP_USER_AGENT'], 'Safari') !== FALSE &&
stripos($_SERVER['HTTP_USER_AGENT'], 'Chrome') === FALSE ) {
# User agent string has 'Safari' in it, but not 'Chrome'
$safariNoCache = "?safariNoCache=" . md5(uniqid());
}
echo '<h3>RESTfm is working! Click <a href="' . RESTfm\Config::getVar('settings', 'baseURI') . $safariNoCache . '">here</a> to start browsing with RESTfm.</h3>' . "\n";
}
$report = $diagnostics->getReport();
echo $report;
?>
<br>
<div>
Copy and Paste this text report when contacting support:<br>
<textarea rows="10" cols="100" readonly="readonly" id="text_report">
<?php
$report->setFormat('text');
echo $report;
?>
</textarea>
</div>
<?php else: // Diagnostics disabled. ?>
<div>
Diagnostics disabled.
</div>
<?php endif; // Diagnostics. ?>
</body>
</html>