Rev 444 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
346 | daniel-mar | 1 | <?php |
2 | |||
3 | /* |
||
4 | * OIDplus 2.0 |
||
5 | * Copyright 2019 Daniel Marschall, ViaThinkSoft |
||
6 | * |
||
7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
||
8 | * you may not use this file except in compliance with the License. |
||
9 | * You may obtain a copy of the License at |
||
10 | * |
||
11 | * http://www.apache.org/licenses/LICENSE-2.0 |
||
12 | * |
||
13 | * Unless required by applicable law or agreed to in writing, software |
||
14 | * distributed under the License is distributed on an "AS IS" BASIS, |
||
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||
16 | * See the License for the specific language governing permissions and |
||
17 | * limitations under the License. |
||
18 | */ |
||
19 | |||
20 | class OIDplusPageAdminSysteminfo extends OIDplusPagePluginAdmin { |
||
21 | |||
22 | public function action($actionID, $params) { |
||
23 | } |
||
24 | |||
25 | public function init($html=true) { |
||
26 | } |
||
27 | |||
28 | public function gui($id, &$out, &$handled) { |
||
29 | if ($id === 'oidplus:systeminfo') { |
||
30 | $handled = true; |
||
360 | daniel-mar | 31 | $out['title'] = _L('System information'); |
346 | daniel-mar | 32 | $out['icon'] = OIDplus::webpath(__DIR__).'icon_big.png'; |
33 | |||
34 | if (!OIDplus::authUtils()::isAdminLoggedIn()) { |
||
35 | $out['icon'] = 'img/error_big.png'; |
||
360 | daniel-mar | 36 | $out['text'] = '<p>'._L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login')).'</p>'; |
346 | daniel-mar | 37 | return; |
38 | } |
||
39 | |||
40 | $out['text'] = ''; |
||
41 | |||
42 | # --- |
||
43 | |||
360 | daniel-mar | 44 | $out['text'] .= '<h2>'._L('OIDplus').'</h2>'; |
348 | daniel-mar | 45 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
46 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
47 | $out['text'] .= ' <tr>'; |
||
360 | daniel-mar | 48 | $out['text'] .= ' <th width="50%">'._L('Attribute').'</th>'; |
49 | $out['text'] .= ' <th width="50%">'._L('Value').'</th>'; |
||
348 | daniel-mar | 50 | $out['text'] .= ' </tr>'; |
51 | $out['text'] .= ' <tr>'; |
||
360 | daniel-mar | 52 | |
346 | daniel-mar | 53 | $sysid_oid = OIDplus::getSystemId(true); |
360 | daniel-mar | 54 | $out['text'] .= ' <td>'._L('System OID').'</td>'; |
55 | $out['text'] .= ' <td>'.(!$sysid_oid ? '<i>'._L('unknown').'</i>' : htmlentities($sysid_oid)).'</td>'; |
||
348 | daniel-mar | 56 | $out['text'] .= ' </tr>'; |
360 | daniel-mar | 57 | |
496 | daniel-mar | 58 | $sys_url = OIDplus::webpath(); |
348 | daniel-mar | 59 | $out['text'] .= ' <tr>'; |
360 | daniel-mar | 60 | $out['text'] .= ' <td>'._L('System URL').'</td>'; |
61 | $out['text'] .= ' <td>'.htmlentities($sys_url).'</td>'; |
||
348 | daniel-mar | 62 | $out['text'] .= ' </tr>'; |
360 | daniel-mar | 63 | |
346 | daniel-mar | 64 | $sys_ver = OIDplus::getVersion(); |
348 | daniel-mar | 65 | $out['text'] .= ' <tr>'; |
360 | daniel-mar | 66 | $out['text'] .= ' <td>'._L('System version').'</td>'; |
67 | $out['text'] .= ' <td>'.(!$sys_ver ? '<i>'._L('unknown').'</i>' : htmlentities($sys_ver)).'</td>'; |
||
348 | daniel-mar | 68 | $out['text'] .= ' </tr>'; |
360 | daniel-mar | 69 | |
346 | daniel-mar | 70 | $sys_install_type = OIDplus::getInstallType(); |
348 | daniel-mar | 71 | $out['text'] .= ' <tr>'; |
360 | daniel-mar | 72 | $out['text'] .= ' <td>'._L('Installation type').'</td>'; |
73 | $out['text'] .= ' <td>'.htmlentities($sys_install_type).'</td>'; |
||
348 | daniel-mar | 74 | $out['text'] .= ' </tr>'; |
360 | daniel-mar | 75 | |
346 | daniel-mar | 76 | $sys_title = OIDplus::config()->getValue('system_title'); |
348 | daniel-mar | 77 | $out['text'] .= ' <tr>'; |
360 | daniel-mar | 78 | $out['text'] .= ' <td>'._L('System title').'</td>'; |
79 | $out['text'] .= ' <td>'.htmlentities($sys_title).'</td>'; |
||
348 | daniel-mar | 80 | $out['text'] .= ' </tr>'; |
360 | daniel-mar | 81 | |
82 | $out['text'] .= ' <tr>'; |
||
83 | $out['text'] .= ' <td>'._L('System directory').'</td>'; |
||
84 | $out['text'] .= ' <td>'.(isset($_SERVER['SCRIPT_FILENAME']) ? htmlentities(dirname($_SERVER['SCRIPT_FILENAME'])) : '<i>'._L('unknown').'</i>').'</td>'; |
||
85 | $out['text'] .= ' </tr>'; |
||
86 | |||
348 | daniel-mar | 87 | $out['text'] .= '</table>'; |
88 | $out['text'] .= '</div></div>'; |
||
346 | daniel-mar | 89 | |
90 | # --- |
||
91 | |||
360 | daniel-mar | 92 | $out['text'] .= '<h2>'._L('PHP').'</h2>'; |
348 | daniel-mar | 93 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
94 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
95 | $out['text'] .= ' <tr>'; |
||
360 | daniel-mar | 96 | $out['text'] .= ' <th width="50%">'._L('Attribute').'</th>'; |
97 | $out['text'] .= ' <th width="50%">'._L('Value').'</th>'; |
||
348 | daniel-mar | 98 | $out['text'] .= ' </tr>'; |
99 | $out['text'] .= ' <tr>'; |
||
360 | daniel-mar | 100 | $out['text'] .= ' <td>'._L('PHP version').'</td>'; |
444 | daniel-mar | 101 | $out['text'] .= ' <td>'.PHP_VERSION.'</td>'; |
348 | daniel-mar | 102 | $out['text'] .= ' </tr>'; |
103 | $out['text'] .= '</table>'; |
||
104 | $out['text'] .= '</div></div>'; |
||
346 | daniel-mar | 105 | |
106 | # --- |
||
107 | |||
360 | daniel-mar | 108 | $out['text'] .= '<h2>'._L('Webserver').'</h2>'; |
348 | daniel-mar | 109 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
110 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
111 | $out['text'] .= ' <tr>'; |
||
360 | daniel-mar | 112 | $out['text'] .= ' <th width="50%">'._L('Attribute').'</th>'; |
113 | $out['text'] .= ' <th width="50%">'._L('Value').'</th>'; |
||
348 | daniel-mar | 114 | $out['text'] .= ' </tr>'; |
115 | $out['text'] .= ' <tr>'; |
||
360 | daniel-mar | 116 | $out['text'] .= ' <td>'._L('Server software').'</td>'; |
117 | $out['text'] .= ' <td>'.(isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : '<i>'._L('unknown').'</i>').'</td>'; |
||
348 | daniel-mar | 118 | $out['text'] .= ' </tr>'; |
119 | $out['text'] .= '</table>'; |
||
120 | $out['text'] .= '</div></div>'; |
||
346 | daniel-mar | 121 | |
122 | # --- |
||
123 | |||
360 | daniel-mar | 124 | $out['text'] .= '<h2>'._L('Operating System').'</h2>'; |
348 | daniel-mar | 125 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
126 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
127 | $out['text'] .= ' <tr>'; |
||
360 | daniel-mar | 128 | $out['text'] .= ' <th width="50%">'._L('Attribute').'</th>'; |
129 | $out['text'] .= ' <th width="50%">'._L('Value').'</th>'; |
||
348 | daniel-mar | 130 | $out['text'] .= ' </tr>'; |
131 | $out['text'] .= ' <tr>'; |
||
360 | daniel-mar | 132 | $out['text'] .= ' <td>'._L('Operating System').'</td>'; |
133 | $out['text'] .= ' <td>'.htmlentities(php_uname("s").' '.php_uname("r").' '.php_uname("v")).'</td>'; |
||
134 | $out['text'] .= ' </tr>'; |
||
135 | $out['text'] .= ' <tr>'; |
||
136 | $out['text'] .= ' <td>'._L('Machine type').'</td>'; |
||
137 | $out['text'] .= ' <td>'.htmlentities(php_uname("m")).'</td>'; |
||
138 | $out['text'] .= ' </tr>'; |
||
139 | $out['text'] .= ' <tr>'; |
||
140 | $out['text'] .= ' <td>'._L('Hostname').'</td>'; |
||
141 | $out['text'] .= ' <td>'.htmlentities(php_uname("n")).'</td>'; |
||
142 | $out['text'] .= ' </tr>'; |
||
143 | $out['text'] .= '</table>'; |
||
144 | $out['text'] .= '</div></div>'; |
||
145 | |||
146 | # --- |
||
147 | |||
148 | $out['text'] .= '<h2>'._L('Database').'</h2>'; |
||
149 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
||
150 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
151 | $out['text'] .= ' <tr>'; |
||
152 | $out['text'] .= ' <th width="50%">'._L('Attribute').'</th>'; |
||
153 | $out['text'] .= ' <th width="50%">'._L('Value').'</th>'; |
||
154 | $out['text'] .= ' </tr>'; |
||
155 | |||
156 | $out['text'] .= ' <tr>'; |
||
157 | $out['text'] .= ' <td>'._L('Database provider').'</td>'; |
||
348 | daniel-mar | 158 | $out['text'] .= ' <td>'.OIDplus::db()->getPlugin()->getManifest()->getName().'</td>'; |
159 | $out['text'] .= ' </tr>'; |
||
360 | daniel-mar | 160 | |
348 | daniel-mar | 161 | $out['text'] .= ' <tr>'; |
360 | daniel-mar | 162 | $out['text'] .= ' <td>'._L('SQL slang').'</td>'; |
348 | daniel-mar | 163 | $out['text'] .= ' <td>'.OIDplus::db()->getSlang()->getManifest()->getName().'</td>'; |
164 | $out['text'] .= ' </tr>'; |
||
360 | daniel-mar | 165 | |
166 | $table_prefix = OIDplus::baseConfig()->getValue('TABLENAME_PREFIX'); |
||
167 | $out['text'] .= ' <tr>'; |
||
168 | $out['text'] .= ' <td>'._L('Table name prefix').'</td>'; |
||
169 | $out['text'] .= ' <td>'.(!empty($table_prefix) ? htmlentities($table_prefix) : '<i>'._L('none').'</i>').'</td>'; |
||
170 | $out['text'] .= ' </tr>'; |
||
348 | daniel-mar | 171 | $out['text'] .= '</table>'; |
172 | $out['text'] .= '</div></div>'; |
||
346 | daniel-mar | 173 | |
174 | // TODO: can we somehow get the DBMS version, connection string etc? |
||
175 | |||
176 | # --- |
||
177 | |||
178 | } |
||
179 | } |
||
180 | |||
181 | public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') { |
||
182 | if (!OIDplus::authUtils()::isAdminLoggedIn()) return false; |
||
183 | |||
184 | if (file_exists(__DIR__.'/treeicon.png')) { |
||
185 | $tree_icon = OIDplus::webpath(__DIR__).'treeicon.png'; |
||
186 | } else { |
||
187 | $tree_icon = null; // default icon (folder) |
||
188 | } |
||
189 | |||
190 | $json[] = array( |
||
191 | 'id' => 'oidplus:systeminfo', |
||
192 | 'icon' => $tree_icon, |
||
360 | daniel-mar | 193 | 'text' => _L('System information') |
346 | daniel-mar | 194 | ); |
195 | |||
196 | return true; |
||
197 | } |
||
198 | |||
199 | public function tree_search($request) { |
||
200 | return false; |
||
201 | } |
||
202 | |||
203 | public function implementsFeature($id) { |
||
204 | return false; |
||
205 | } |
||
360 | daniel-mar | 206 | } |