/
server_info.php
156 lines (127 loc) · 4.48 KB
/
server_info.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
<?php
/*
$Id$
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2010 osCommerce
Released under the GNU General Public License
*/
use OSC\OM\HTML;
use OSC\OM\HTTP;
use OSC\OM\OSCOM;
require('includes/application_top.php');
$OSCOM_Language->loadDefinitions('server_info');
$info = tep_get_system_information();
$server = parse_url(OSCOM::getConfig('http_server'));
$action = (isset($_GET['action']) ? $_GET['action'] : '');
switch ($action) {
case 'getPhpInfo':
phpinfo();
exit;
break;
case 'submit':
$response = HTTP::getResponse([
'url' => 'https://www.oscommerce.com/index.php?RPC&Website&Index&SaveUserServerInfo&v=2',
'parameters' => [
'info' => json_encode($info)
]
]);
if ($response != 'OK') {
$OSCOM_MessageStack->add(OSCOM::getDef('error_info_submit'), 'error');
} else {
$OSCOM_MessageStack->add(OSCOM::getDef('success_info_submit'), 'success');
}
OSCOM::redirect('server_info.php');
break;
case 'save':
$info_file = 'server_info-' . date('YmdHis') . '.txt';
header('Content-type: text/plain');
header('Content-disposition: attachment; filename=' . $info_file);
echo tep_format_system_info_array($info);
exit;
break;
}
require($oscTemplate->getFile('template_top.php'));
if (!isset($_GET['action'])) {
?>
<div class="pull-right">
<?= HTML::button(IMAGE_EXPORT, 'fa fa-upload', OSCOM::link('server_info.php', 'action=export'), null, 'btn-info'); ?>
<?= HTML::button(OSCOM::getDef('button_php_info'), 'fa fa-info-circle', OSCOM::link('server_info.php', 'action=getPhpInfo'), ['newwindow' => true], 'btn-info'); ?>
</div>
<?php
}
?>
<h2><i class="fa fa-tasks"></i> <a href="<?= OSCOM::link('server_info.php'); ?>"><?= OSCOM::getDef('heading_title'); ?></a></h2>
<?php
if ($action == 'export') {
?>
<p>
<?=
OSCOM::getDef('text_export_intro', [
'button_submit_to_oscommerce' => OSCOM::getDef('button_submit_to_oscommerce'),
'button_save' => IMAGE_SAVE
]);
?>
</p>
<p>
<?= HTML::textareaField('server_settings', '100', '15', tep_format_system_info_array($info), 'readonly', false); ?>
</p>
<p>
<?= HTML::button(OSCOM::getDef('button_submit_to_oscommerce'), 'fa fa-upload', OSCOM::link('server_info.php', 'action=submit'), null, 'btn-info') . ' ' . HTML::button(IMAGE_SAVE, 'fa fa-save', OSCOM::link('server_info.php', 'action=save'), null, 'btn-info'); ?>
</p>
<?php
} else {
?>
<table class="table table-hover">
<tbody>
<tr>
<td><strong><?= OSCOM::getDef('title_oscom_version'); ?></strong></td>
<td><?= OSCOM::getVersion(); ?></td>
</tr>
<tr>
<td><strong><?= OSCOM::getDef('title_http_server'); ?></strong></td>
<td><?= $info['system']['http_server']; ?></td>
</tr>
<tr>
<td><strong><?= OSCOM::getDef('title_php_version'); ?></strong></td>
<td><?= $info['php']['version'] . ' (' . OSCOM::getDef('title_zend_version') . ' ' . $info['php']['zend'] . ')'; ?></td>
</tr>
<tr>
<td><strong><?= OSCOM::getDef('title_server_host'); ?></strong></td>
<td><?= $server['host'] . ' (' . gethostbyname($server['host']) . ')'; ?></td>
</tr>
<tr>
<td><strong><?= OSCOM::getDef('title_server_os'); ?></strong></td>
<td><?= $info['system']['os'] . ' ' . $info['system']['kernel']; ?></td>
</tr>
<tr>
<td><strong><?= OSCOM::getDef('title_server_date'); ?></strong></td>
<td><?= $info['system']['date']; ?></td>
</tr>
<tr>
<td><strong><?= OSCOM::getDef('title_server_up_time'); ?></strong></td>
<td><?= $info['system']['uptime']; ?></td>
</tr>
<tr>
<td><strong><?= OSCOM::getDef('title_database_host'); ?></strong></td>
<td><?= OSCOM::getConfig('db_server') . ' (' . gethostbyname(OSCOM::getConfig('db_server')) . ')'; ?></td>
</tr>
<tr>
<td><strong><?= OSCOM::getDef('title_database'); ?></strong></td>
<td><?= 'MySQL ' . $info['mysql']['version']; ?></td>
</tr>
<tr>
<td><strong><?= OSCOM::getDef('title_database_date'); ?></strong></td>
<td><?= $info['mysql']['date']; ?></td>
</tr>
<tr>
<td><strong><?= OSCOM::getDef('title_database_name'); ?></strong></td>
<td><?= OSCOM::getConfig('db_database'); ?></td>
</tr>
</tbody>
</table>
<?php
}
require($oscTemplate->getFile('template_bottom.php'));
require('includes/application_bottom.php');
?>