Source for file class.parseProgs.inc.php
Documentation is available at class.parseProgs.inc.php
/***************************************************************************
* Copyright (C) 2006 by phpSysInfo - A PHP System Information Script *
* http://phpsysinfo.sourceforge.net/ *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
// $Id: class.parseProgs.inc.php,v 1.12 2007/02/01 17:37:06 bigmichi1 Exp $
$arrLines =
split( "\n", $strBuff );
foreach( $arrLines as $strLine ) {
list
( $strAddr, $strName) =
explode( ' ', trim( $strLine ), 2 );
$arrResults[] =
$strName;
if( empty( $arrResults ) ) {
$arrLines =
explode( "\n", $strBuff );
foreach( $arrLines as $strLine ) {
if( preg_match( "/(.*) = '(.*)'/", $strLine, $arrParts ) ) {
if( trim( $arrParts[1] ) ==
"vendor" ) {
$arrResults[$intS] =
trim( $arrParts[2] );
} elseif( trim( $arrParts[1]) ==
"device" ) {
$arrResults[$intS] .=
" - " .
trim( $arrParts[2] );
if( empty( $arrResults ) ) {
global $show_bind, $show_inodes;
$df =
preg_split("/\n/", $df, -
1, PREG_SPLIT_NO_EMPTY);
$df2 =
preg_split("/\n/", $df2, -
1, PREG_SPLIT_NO_EMPTY);
$mount =
preg_split("/\n/", $mount, -
1, PREG_SPLIT_NO_EMPTY);
foreach( $df as $df_line) {
if( count($df_buf1) !=
2) {
preg_match("/(.*)(\s+)(([0-9]+)(\s+)([0-9]+)(\s+)([0-9]+)(\s+)([0-9]+)$)/", $df_buf1[0], $df_buf2);
$df_buf =
array($df_buf2[1], $df_buf2[4], $df_buf2[6], $df_buf2[8], $df_buf2[10], $df_buf1[1]);
preg_match_all("/([0-9]+)%/", $df2[$j +
1], $inode_buf, PREG_SET_ORDER);
if( count($df_buf) ==
6 ) {
$df_buf[5] =
trim( $df_buf[5] );
foreach( $mount as $mount_line ) {
if ( preg_match("#" .
$df_buf[0] .
" on " .
$df_buf[5] .
" type (.*) \((.*)\)#", $mount_line, $mount_buf) ) {
$mount_buf[1] .=
"," .
$mount_buf[2];
} elseif ( !preg_match("#" .
$df_buf[0] .
"(.*) on " .
$df_buf[5] .
" \((.*)\)#", $mount_line, $mount_buf) ) {
$strFstype =
substr( $mount_buf[1], 0, strpos( $mount_buf[1], "," ) );
if( $show_bind ||
!stristr($mount_buf[2], "bind")) {
$results[$j]['disk'] =
str_replace( "\\$", "\$", $df_buf[0] );
$results[$j]['size'] =
$df_buf[1];
$results[$j]['used'] =
$df_buf[2];
$results[$j]['free'] =
$df_buf[3];
if( $results[$j]['used'] <
0 ) {
$results[$j]['size'] =
$results[$j]['free'];
$results[$j]['free'] =
0;
$results[$j]['used'] =
$results[$j]['size'];
if( $results[$j]['size'] ==
0 ) {
$results[$j]['percent'] =
round(($results[$j]['used'] *
100) /
$results[$j]['size']);
$results[$j]['mount'] =
$df_buf[5];
$results[$j]['fstype'] =
$strFstype;
$results[$j]['options'] =
substr( $mount_buf[1], strpos( $mount_buf[1], "," ) +
1, strlen( $mount_buf[1] ) );
if( $show_inodes && isset
($inode_buf[ count( $inode_buf ) -
1][1]) ) {
$results[$j]['inodes'] =
$inode_buf[ count( $inode_buf ) -
1][1];
unset
( $mount[$current -
1] );
Documentation generated on Mon, 17 Nov 2008 01:10:26 +0100 by phpDocumentor 1.4.0