-
Notifications
You must be signed in to change notification settings - Fork 0
/
details.php
291 lines (193 loc) · 16.6 KB
/
details.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
284
285
286
287
288
289
290
291
<?php
include_once 'data.php';
if (isset($_SESSION['auth']) && isset($_SESSION['permissions']) && $_SESSION['permissions'] == 'A') {
session_write_close();
include_once 'functions.php';
print '<b> Installation Details:</b>';
print '<table border="0" cellpadding="0" cellspacing="0" style="width: 100%">';
print "<tr><td class=\"details alternating_row\" style=\"width: 100%\" colspan=4>Required software:</td></tr>";
print "<tr><td class=\"details\" style=\"white-space: nowrap\">PHP version</td>";
print "<td class=\"details\">>5.2.0 (>5.3.0 recommended)</td><td class=\"details\">" . PHP_VERSION . "</td>";
print "<td class=\"details\">";
print version_compare(PHP_VERSION, "5.2.0", "<") ? "<span style=\"color: red; font-weight: bold\">!!!</span>" : "<span style=\"color: green; font-weight: bold\">OK</span>";
print "</td></tr>";
database_connect($database_path, 'library');
$sqlite_version = $dbHandle->query("SELECT sqlite_version()");
$dbHandle = null;
$sqlite_version = $sqlite_version->fetchColumn();
print "<tr><td class=\"details\" style=\"white-space: nowrap\">SQLite database version</td>";
print "<td class=\"details\">>3.3.0 (>3.7.0 recommended)</td><td class=\"details\">$sqlite_version</td>";
print "<td class=\"details\" style=\"\">";
print version_compare($sqlite_version, "3.3.0", "<") ? "<span style=\"color: red; font-weight: bold\">!!!</span>" : "<span style=\"color: green; font-weight: bold\">OK</span>";
print "</td></tr>";
print "<tr><td class=\"details alternating_row\" style=\"width: 100%\" colspan=4>Required PHP extensions:</td></tr>";
$extensions = array('pdo' => 'built-in database',
'pdo_sqlite' => 'built-in database');
while (list($extension, $feature) = each($extensions)) {
print "<tr><td class=\"details\" style=\"white-space: nowrap\">$extension</td><td class=\"details\" style=\"white-space: nowrap\">$feature</td>";
if (extension_loaded($extension)) {
print "<td class=\"details\">installed</td><td class=\"details\" style=\"color: green; font-weight: bold\">OK</td></tr>";
} else {
print "<td class=\"details\">not installed</td><td class=\"details\" style=\"color: red; font-weight: bold\">!!!</td></tr>";
}
}
print "<tr><td class=\"details alternating_row\" style=\"width: 100%\" colspan=4>Recommended PHP extensions:</td></tr>";
$extensions = array('zip' => 'export to ZIP',
'gd' => 'icon views, and PDF viewer',
'apc' => 'caching - increased speed');
while (list($extension, $feature) = each($extensions)) {
print "<tr><td class=\"details\" style=\"white-space: nowrap\">$extension</td><td class=\"details\" style=\"white-space: nowrap\">$feature</td>";
if (extension_loaded($extension)) {
print "<td class=\"details\">installed</td><td class=\"details\" style=\"color: green; font-weight: bold\">OK</td></tr>";
} else {
print "<td class=\"details\">not installed</td><td class=\"details\" style=\"color: orange; font-weight: bold\">!!!</td></tr>";
}
}
print "<tr><td class=\"details alternating_row\" style=\"width: 100%\" colspan=4>";
print "Required <a href=\"http://www.php.net/manual/en/ini.php\" target=\"_blank\">" . (version_compare(PHP_VERSION, "5.2.4", ">") ? php_ini_loaded_file() : "php.ini") . "</a> settings:</td></tr>";
$directives = array('file_uploads' => '1', 'upload_max_filesize' => '200M', 'post_max_size' => '800M', 'max_input_time' => '60');
while (list($directive, $value) = each($directives)) {
if (intval(ini_get($directive)) < intval($value)) {
print "<tr><td class=\"details\" style=\"white-space: nowrap\">$directive</td>";
print "<td class=\"details\" style=\"\">recommended $value</td>";
print "<td class=\"details\" style=\"\">" . ini_get($directive) . "</td>";
print "<td class=\"details\" style=\"color: red; font-weight: bold\">!!!</td></tr>";
} else {
print "<tr><td class=\"details\" style=\"white-space: nowrap\">$directive</td>";
print "<td class=\"details\" style=\"\">recommended $value</td>";
print "<td class=\"details\" style=\"\">" . ini_get($directive) . "</td>";
print "<td class=\"details\" style=\"color: green; font-weight: bold\">OK</td></tr>";
}
}
if (ini_get('open_basedir') != false) {
print "<tr><td class=\"details\" style=\"white-space: nowrap\">open_basedir</td>";
print "<td class=\"details\" style=\"\">required disabled</td>";
print "<td class=\"details\" style=\"\">" . ini_get('open_basedir') . "</td>";
print "<td class=\"details\" style=\"color: red; font-weight: bold\">!!!</td></tr>";
} else {
print "<tr><td class=\"details\" style=\"white-space: nowrap\">open_basedir</td>";
print "<td class=\"details\" style=\"\">required disabled</td>";
print "<td class=\"details\" style=\"\">disabled</td>";
print "<td class=\"details\" style=\"color: green; font-weight: bold\">OK</td></tr>";
}
if (ini_get('allow_url_fopen') != true) {
print "<tr><td class=\"details\" style=\"white-space: nowrap\">allow_url_fopen</td>";
print "<td class=\"details\" style=\"\">required On</td>";
print "<td class=\"details\" style=\"\">Off</td>";
print "<td class=\"details\" style=\"color: red; font-weight: bold\">!!!</td></tr>";
} else {
print "<tr><td class=\"details\" style=\"white-space: nowrap\">allow_url_fopen</td>";
print "<td class=\"details\" style=\"\">required On</td>";
print "<td class=\"details\" style=\"\">On</td>";
print "<td class=\"details\" style=\"color: green; font-weight: bold\">OK</td></tr>";
}
print "<tr><td class=\"details alternating_row\" style=\"width: 100%\" colspan=4>Required binary executables:</td></tr>";
print "<tr><td class=\"details\" style=\"white-space: nowrap;height:19px;line-height:19px\">Pdftotext</td>";
print "<td class=\"details\" style=\"white-space: nowrap;height:19px;line-height:19px\">PDF full-text search</td>";
print '<td class="details" id="details-1" style="white-space: nowrap;height:19px;line-height:19px"><img src="img/ajaxloader2.gif" style="vertical-align:middle"></td>';
print '<td class="details" id="details-2" style="font-weight: bold;height:19px;line-height:19px"><img src="img/ajaxloader2.gif" style="vertical-align:middle"></td>';
print '</tr>';
print "<tr><td class=\"details\" style=\"white-space: nowrap;height:19px;line-height:19px\">Pdfinfo</td>";
print "<td class=\"details\" style=\"white-space: nowrap;height:19px;line-height:19px\">built-in PDF viewer</td>";
print '<td class="details" id="details-3" style="white-space: nowrap;height:19px;line-height:19px"><img src="img/ajaxloader2.gif" style="vertical-align:middle"></td>';
print '<td class="details" id="details-4" style="font-weight: bold;height:19px;line-height:19px"><img src="img/ajaxloader2.gif" style="vertical-align:middle"></td>';
print '</tr>';
print "<tr><td class=\"details\" style=\"white-space: nowrap;height:19px;line-height:19px\">Pdftohtml</td>";
print "<td class=\"details\" style=\"white-space: nowrap;height:19px;line-height:19px\">PDF search in the built-in PDF viewer</td>";
print '<td class="details" id="details-5" style="white-space: nowrap;height:19px;line-height:19px"><img src="img/ajaxloader2.gif" style="vertical-align:middle"></td>';
print '<td class="details" id="details-6" style="font-weight: bold;height:19px;line-height:19px"><img src="img/ajaxloader2.gif" style="vertical-align:middle"></td>';
print '</tr>';
print "<tr><td class=\"details\" style=\"white-space: nowrap;height:19px;line-height:19px\">Ghostscript</td>";
print "<td class=\"details\" style=\"white-space: nowrap;height:19px;line-height:19px\">icon views, built-in PDF viewer</td>";
print '<td class="details" id="details-7" style="white-space: nowrap;height:19px;line-height:19px"><img src="img/ajaxloader2.gif" style="vertical-align:middle"></td>';
print '<td class="details" id="details-8" style="font-weight: bold;height:19px;line-height:19px"><img src="img/ajaxloader2.gif" style="vertical-align:middle"></td>';
print '</tr>';
print "<tr><td class=\"details\" style=\"white-space: nowrap;height:19px;line-height:19px\">Bibutils</td>";
print "<td class=\"details\" style=\"white-space: nowrap;height:19px;line-height:19px\">Bibtex export/import</td>";
print '<td class="details" id="details-9" style="white-space: nowrap;height:19px;line-height:19px"><img src="img/ajaxloader2.gif" style="vertical-align:middle"></td>';
print '<td class="details" id="details-10" style="font-weight: bold;height:19px;line-height:19px"><img src="img/ajaxloader2.gif" style="vertical-align:middle"></td>';
print '</tr>';
print "<tr><td class=\"details\" style=\"white-space: nowrap;height:19px;line-height:19px\">Pdftk</td>";
print "<td class=\"details\" style=\"white-space: nowrap;height:19px;line-height:19px\">PDF bookmarks and watermarks</td>";
print '<td class="details" id="details-11" style="white-space: nowrap;height:19px;line-height:19px"><img src="img/ajaxloader2.gif" style="vertical-align:middle"></td>';
print '<td class="details" id="details-12" style="font-weight: bold;height:19px;line-height:19px"><img src="img/ajaxloader2.gif" style="vertical-align:middle"></td>';
print '</tr>';
print "<tr><td class=\"details alternating_row\" style=\"width: 100%\" colspan=4>I, Librarian " . $version . " is installed in \"" . dirname(__FILE__) . "\":</td></tr>";
print "<tr><td class=\"details\" style=\"white-space: nowrap\">Path to PDF files:</td><td class=\"details\" style=\"font-size: 11px\">" . dirname(__FILE__) . DIRECTORY_SEPARATOR . "library</td>";
if (is_writable(dirname(__FILE__) . DIRECTORY_SEPARATOR . "library") && @file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . "library" . DIRECTORY_SEPARATOR . '.')) {
print "<td class=\"details\" style=\"white-space: nowrap\">writable, executable</td><td class=\"details\" style=\"color: green; font-weight: bold\">OK</td></tr>";
} else {
print "<td class=\"details\" style=\"white-space: nowrap\">not writable or executable</td><td class=\"details\" style=\"color: red; font-weight: bold\">!!!</td></tr>";
}
print "<tr><td class=\"details\" style=\"white-space: nowrap\">Path to supplementary files:</td><td class=\"details\" style=\"font-size: 11px\">" . dirname(__FILE__) . DIRECTORY_SEPARATOR . "library" . DIRECTORY_SEPARATOR . "supplement</td>";
if (is_writable(dirname(__FILE__) . DIRECTORY_SEPARATOR . "library" . DIRECTORY_SEPARATOR . "supplement") && @file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . "library" . DIRECTORY_SEPARATOR . "supplement" . DIRECTORY_SEPARATOR . '.')) {
print "<td class=\"details\" style=\"white-space: nowrap\">writable, executable</td><td class=\"details\" style=\"color: green; font-weight: bold\">OK</td></tr>";
} else {
print "<td class=\"details\" style=\"white-space: nowrap\">not writable or executable</td><td class=\"details\" style=\"color: red; font-weight: bold\">!!!</td></tr>";
}
print "<tr><td class=\"details\" style=\"white-space: nowrap\">Path to database files:</td><td class=\"details\" style=\"font-size: 11px\">" . dirname(__FILE__) . DIRECTORY_SEPARATOR . "library" . DIRECTORY_SEPARATOR . "database</td>";
if (is_writable(dirname(__FILE__) . DIRECTORY_SEPARATOR . "library" . DIRECTORY_SEPARATOR . "database") && @file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . "library" . DIRECTORY_SEPARATOR . "database" . DIRECTORY_SEPARATOR . '.')) {
print "<td class=\"details\" style=\"white-space: nowrap\">writable, executable</td><td class=\"details\" style=\"color: green; font-weight: bold\">OK</td></tr>";
} else {
print "<td class=\"details\" style=\"white-space: nowrap\">not writable or executable</td><td class=\"details\" style=\"color: red; font-weight: bold\">!!!</td></tr>";
}
print "<tr><td class=\"details\" style=\"white-space: nowrap\">Path to PNG images:</td><td class=\"details\" style=\"font-size: 11px\">" . dirname(__FILE__) . DIRECTORY_SEPARATOR . "library" . DIRECTORY_SEPARATOR . "pngs</td>";
if (is_writable(dirname(__FILE__) . DIRECTORY_SEPARATOR . "library" . DIRECTORY_SEPARATOR . "pngs") && @file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . "library" . DIRECTORY_SEPARATOR . "pngs" . DIRECTORY_SEPARATOR . '.')) {
print "<td class=\"details\" style=\"white-space: nowrap\">writable, executable</td><td class=\"details\" style=\"color: green; font-weight: bold\">OK</td></tr>";
} else {
print "<td class=\"details\" style=\"white-space: nowrap\">not writable or executable</td><td class=\"details\" style=\"color: red; font-weight: bold\">!!!</td></tr>";
}
print "<tr><td class=\"details\" style=\"white-space: nowrap\">Temporary directory:</td><td class=\"details\" style=\"font-size: 11px\">" . $temp_dir . "</td>";
if (is_writable($temp_dir) && @file_exists($temp_dir . DIRECTORY_SEPARATOR . '.')) {
print "<td class=\"details\" style=\"white-space: nowrap\">writable, executable</td><td class=\"details\" style=\"color: green; font-weight: bold\">OK</td></tr>";
} else {
print "<td class=\"details\" style=\"white-space: nowrap\">not writable or executable</td><td class=\"details\" style=\"color: red; font-weight: bold\">!!!</td></tr>";
}
print "<tr><td class=\"details alternating_row\" style=\"width: 100%\" colspan=4>SQLite database files:</td></tr>";
$database_files = scandir(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'database');
while (list($key, $database_file) = each($database_files)) {
if (substr($database_file, -4) == '.sq3') {
$dbsize = filesize(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'database' . DIRECTORY_SEPARATOR . $database_file);
if ($dbsize < 1048576) $dbsize2 = round($dbsize / 1024, 1).' kB';
if ($dbsize >= 1048576) $dbsize2 = round($dbsize / 1048576, 1).' MB';
if ($dbsize >= 1073741824) $dbsize2 = round($dbsize / 1073741824, 1).' GB';
print "<tr><td class=\"details\">$database_file</td>";
print "<td class=\"details\"><div class=\"file-size\" style=\"width:7em;float:left\">" . $dbsize2. "</div>";
if ($database_file == 'library.sq3')
print ' <span class="ui-state-highlight integrity" data-db="library"> Check Integrity </span>';
if ($database_file == 'fulltext.sq3')
print ' <span class="ui-state-highlight integrity" data-db="fulltext"> Check Integrity </span>';
if ($database_file == 'users.sq3')
print ' <span class="ui-state-highlight integrity" data-db="users"> Check Integrity </span>';
if ($database_file == 'library.sq3')
print ' <span class="ui-state-highlight vacuum" data-db="library"> Vacuum </span>';
if ($database_file == 'fulltext.sq3')
print ' <span class="ui-state-highlight vacuum" data-db="fulltext"> Vacuum </span>';
if ($database_file == 'users.sq3')
print ' <span class="ui-state-highlight vacuum" data-db="users"> Vacuum </span>';
print '</td>';
if (is_writable(dirname(__FILE__) . DIRECTORY_SEPARATOR . "library" . DIRECTORY_SEPARATOR . "database" . DIRECTORY_SEPARATOR . $database_file)) {
print "<td class=\"details\" style=\"white-space: nowrap\">writable</td><td class=\"details\" style=\"color: green; font-weight: bold\">OK</td></tr>";
} else {
print "<td class=\"details\" style=\"white-space: nowrap\">not writable</td><td class=\"details\" style=\"color: red; font-weight: bold\">!!!</td></tr>";
}
}
}
$isapc = ini_get('apc.enabled');
if (!empty($isapc)) {
$mem = apc_sma_info();
$apc_size=($mem['num_seg']*$mem['seg_size'])/(1024*1024);
$apc_used=$apc_size-($mem['avail_mem']/(1024*1024));
$apc_perc = 100*$apc_used/$apc_size;
print '<tr><td class="details alternating_row" colspan=4>APC Caching:</td></tr>';
print '<tr><td> Shared memory usage:</td colspan=3><td>'
. round($apc_perc,1).'% ('
. round($apc_used,1)
. ' MB out of '
. round($apc_size) .' MB)</td></tr>';
}
print '</table><br>';
} else {
print 'Super User authorization required.';
}
?>