File: system_info.php

package info (click to toggle)
extplorer 2.1.0b6%2Bdfsg.2-1%2Bsqueeze2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,124 kB
  • ctags: 2,046
  • sloc: php: 14,873; xml: 884; makefile: 122; sh: 35
file content (334 lines) | stat: -rw-r--r-- 10,380 bytes parent folder | download | duplicates (3)
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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
<?php
// ensure this file is being included by a parent file
if( !defined( '_JEXEC' ) && !defined( '_VALID_MOS' ) ) die( 'Restricted access' );
/**
 * @version $Id: system_info.php 154 2009-07-28 19:27:23Z soeren $
 * @package eXtplorer
 * @copyright soeren 2007-2009
 * @author The eXtplorer project (http://sourceforge.net/projects/extplorer)
 * 
 * @license
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 * 
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 * 
 * Alternatively, the contents of this file may be used under the terms
 * of the GNU General Public License Version 2 or later (the "GPL"), in
 * which case the provisions of the GPL are applicable instead of
 * those above. If you wish to allow use of your version of this file only
 * under the terms of the GPL and not to allow others to use
 * your version of this file under the MPL, indicate your decision by
 * deleting  the provisions above and replace  them with the notice and
 * other provisions required by the GPL.  If you do not delete
 * the provisions above, a recipient may use your version of this file
 * under either the MPL or the GPL."
 * 
 */

function get_php_setting($val, $recommended=1) {
	$value = ini_get($val);
	$r = ( $value == $recommended ? 1 : 0);
	if( empty($value)) {
		$onoff = 1;
	}
	else {
		$onoff = 0;
	}
	return $r ? '<span style="color: green;">' . $GLOBALS['messages']['sionoff'][$onoff] . '</span>' : '<span style="color: red;">' . $GLOBALS['messages']['sionoff'][$onoff] . '</span>';
}

function get_server_software() {
	if (isset($_SERVER['SERVER_SOFTWARE'])) {
		return $_SERVER['SERVER_SOFTWARE'];
	} else if (($sf = getenv('SERVER_SOFTWARE'))) {
		return $sf;
	} else {
		return 'n/a';
	}
}

function system_info() {
	$version = $GLOBALS['ext_version'];
	//$tab = extGetParam( $_REQUEST, 'tab', 'tab1' );
	$width = 400;	// width of 100%

	switch( extGetParam($GLOBALS['__POST'],'action2', 'panel') ) {
		case 'systeminfo':
		?>
		<div class="body-wrap">
		  <table class="member-table">
			<tr>
				<td valign="top" width="250" style="font-weight:bold;">
				Logged in as:
				</td>
				<td><?php echo $_SESSION['credentials_extplorer']['username'] ?></td>
			<tr>
				<td valign="top" width="250" style="font-weight:bold;">
					<?php echo ext_lang::msg( 'sibuilton' ); ?>:
				</td>
				<td>
				<?php echo php_uname(); ?>
				</td>
			</tr>
			<tr>
				<td valign="top" style="font-weight:bold;">
					<?php echo ext_lang::msg( 'siphpversion' ); ?>:
				</td>
				<td>
				<?php echo phpversion(); ?>
				&nbsp;
				<?php echo phpversion() >= '4.3' ? '' : $GLOBALS['messages']['siphpupdate']; ?>
				</td>
			</tr>
			<tr>
				<td style="font-weight:bold;">
					<?php echo ext_lang::msg( 'siwebserver' ); ?>:
				</td>
				<td>
				<?php echo get_server_software(); ?>
				</td>
			</tr>
			<tr>
				<td style="font-weight:bold;">
					<?php echo ext_lang::msg( 'siwebsphpif' ); ?>:
				</td>
				<td>
				<?php echo php_sapi_name(); ?>
				</td>
			</tr>
			<tr>
				<td style="font-weight:bold;">
					<?php echo ext_lang::msg( 'simamboversion' ); ?>:
				</td>
				<td>
				<?php echo $version; ?>
				</td>
			</tr>
			<tr>
				<td style="font-weight:bold;">
					<?php echo ext_lang::msg( 'siuseragent' ); ?>:
				</td>
				<td>
				<?php echo phpversion() <= "4.2.1" ? getenv( "HTTP_USER_AGENT" ) : $_SERVER['HTTP_USER_AGENT'];?>
				</td>
			</tr>
			<tr>
				<td valign="top" style="font-weight:bold;">
					<?php echo ext_lang::msg( 'sirelevantsettings' ); ?>:
				</td>
				<td>
					<table cellspacing="1" cellpadding="1" border="0">
					<tr>
						<td valign="top">
							<?php echo ext_lang::msg( 'sisafemode' ); ?>:
						</td>
						<td>
						<?php echo get_php_setting('safe_mode', 0); ?>
						</td>
					</tr>
					<tr>
						<td>
							<?php echo ext_lang::msg( 'sibasedir' ); ?>:
						</td>
						<td>
						<?php echo (($ob = ini_get('open_basedir')) ? $ob : 'none'); ?>
						</td>
					</tr>
					<tr>
						<td>
							<?php echo ext_lang::msg( 'sidisplayerrors' ); ?>:
						</td>
						<td>
						<?php echo get_php_setting('display_errors', 0 ); ?>
						</td>
					</tr>
					<tr>
						<td>
							<?php echo ext_lang::msg( 'sishortopentags' ); ?>:
						</td>
						<td>
						<?php echo get_php_setting('short_open_tag', 0 ); ?>
						</td>
					</tr>
					<tr>
						<td>
							<?php echo ext_lang::msg( 'sifileuploads' ); ?>:
						</td>
						<td>
						<?php echo get_php_setting('file_uploads'); ?>
						</td>
					</tr>
					<tr>
						<td>
							<?php echo ext_lang::msg( 'simagicquotes' ); ?>:
						</td>
						<td>
						<?php echo get_php_setting('magic_quotes_gpc'); ?>
						</td>
					</tr>
					<tr>
						<td>
							<?php echo ext_lang::msg( 'siregglobals' ); ?>:
						</td>
						<td>
						<?php echo get_php_setting('register_globals', 0); ?>
						</td>
					</tr>
					<tr>
						<td>
							<?php echo ext_lang::msg( 'sioutputbuf' ); ?>:
						</td>
						<td>
						<?php echo get_php_setting('output_buffering', 0); ?>
						</td>
					</tr>
					<tr>
						<td>
							<?php echo ext_lang::msg( 'sisesssavepath' ); ?>:
						</td>
						<td>
						<?php echo (( $sp=ini_get( 'session.save_path' )) ? $sp : 'none' ); ?>
						</td>
					</tr>
					<tr>
						<td>
							<?php echo ext_lang::msg( 'sisessautostart' ); ?>:
						</td>
						<td>
						<?php echo intval( ini_get( 'session.auto_start' ) ); ?>
						</td>
					</tr>
					<tr>
						<td>
							<?php echo ext_lang::msg( 'sixmlenabled' ); ?>:
						</td>
						<td>
							<?php echo extension_loaded('xml') ? '<font style="color: green;">' . $GLOBALS['messages']['miscyesno'][0] . '</font>' : '<font style="color: red;">' . $GLOBALS['messages']['miscyesno'][1] . '</font>'; ?>
						</td>
					</tr>
					<tr>
						<td>
							<?php echo ext_lang::msg( 'sizlibenabled' ); ?>:
						</td>
						<td>
						<?php echo extension_loaded('zlib') ? '<font style="color: green;">' . $GLOBALS['messages']['miscyesno'][0] . '</font>' : '<font style="color: red;">' . $GLOBALS['messages']['miscyesno'][1] . '</font>'; ?>
						</td>
					</tr>
					<tr>
						<td>
							<?php echo ext_lang::msg( 'sidisabledfuncs' ); ?>:
						</td>
						<td>
						<?php echo (( $df=ini_get('disable_functions' )) ? $df : 'none' ); ?>
						</td>
					</tr>
					</table>
				</td>
			</tr>
			</table>
		</div>
			<?php 
			break;
		case 'phpinfo':

			ob_start();
			phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES);
			$phpinfo = ob_get_contents();
			ob_end_clean();
			preg_match_all('#<body[^>]*>(.*)</body>#siU', $phpinfo, $output);
			$output = preg_replace('#<table#', '<table class="member-table" align="center"', $output[1][0]);
			$output = '<div class="body-wrap">'.$output.'</div>';
			$output = preg_replace('#(\w),(\w)#', '\1, \2', $output);
			$output = preg_replace('#border="0" cellpadding="3" width="600"#', 'border="0" cellspacing="1" cellpadding="4" width="95%"', $output);
			$output = preg_replace('#<hr />#', '', $output);
			echo $output;
					
			break;
			
		case 'about':
			show_about();
			break;
			
		default:
			?>
			{
				"xtype": "tabpanel",
				
				"height": 350,
				"activeTab": 0,
				"items": [{
					"title": "<?php echo ext_Lang::msg( 'aboutlink' ) ?>",
					"autoScroll": true,
					"autoLoad": { 
						"url": "<?php echo $GLOBALS['script_name'] ?>",
						"params": {
							"option": "com_extplorer",
							"action": "get_about",
							"action2": "about"
						}
					}
				},{
					"title": "<?php echo ext_Lang::msg( 'sisysteminfo' ) ?>",
					"autoScroll": true,
					"autoLoad": { 
						"url": "<?php echo $GLOBALS['script_name'] ?>",
						"params": {
							"option": "com_extplorer",
							"action": "get_about",
							"action2": "systeminfo"
						}
					}
				},{
					"title": "<?php echo ext_Lang::msg('siphpinfo' ); ?>",
					"autoScroll": true,
					"autoLoad": { 
						"url": "<?php echo $GLOBALS['script_name'] ?>",
						"params": {
							"option": "com_extplorer",
							"action": "get_about",
							"action2": "phpinfo"
						}
					}
				}]
			}
			<?php
	}
	
}
function show_about() {			// footer for html-page
	echo "\n<div id=\"ext_footer\" style=\"text-align:center;\">
	<img src=\""._EXT_URL."/images/eXtplorer.gif\" align=\"middle\" alt=\"eXtplorer Logo\" />
	<br />
	".ext_Lang::msg('your_version').": <a href=\"".$GLOBALS['ext_home']."\" target=\"_blank\">eXtplorer {$GLOBALS['ext_version']}</a>
	<br />
 (<a href=\"http://virtuemart.net/index2.php?option=com_versions&amp;catid=5&amp;myVersion=". $GLOBALS['ext_version'] ."\" onclick=\"javascript:void window.open('http://virtuemart.net/index2.php?option=com_versions&catid=5&myVersion=". $GLOBALS['ext_version'] ."', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=580,directories=no,location=no'); return false;\" title=\"".$GLOBALS["messages"]["check_version"]."\">".$GLOBALS["messages"]["check_version"]."</a>)

	";
	
	$size = disk_free_space($GLOBALS['home_dir']. $GLOBALS['separator']);
	$free=parse_file_size($size);

	echo '<br />'.$GLOBALS["messages"]["miscfree"].": ".$free." \n";
	if( extension_loaded( "posix" )) {
		$owner_info = '<br /><br />'.ext_Lang::msg('current_user').' ';
		if( ext_isFTPMode() ) {
			$my_user_info = posix_getpwnam( $_SESSION['ftp_login'] );
			$my_group_info = posix_getgrgid( $my_user_info['gid'] );
		} else {
			$my_user_info = posix_getpwuid( posix_geteuid() );
			$my_group_info = posix_getgrgid(posix_getegid() );
		}
		$owner_info .= $my_user_info['name'].' ('. $my_user_info['uid'].'), '. $my_group_info['name'].' ('. $my_group_info['gid'].')'; 

		echo $owner_info;
	}
	echo "
	</div>";
}
?>