Subversion Repositories ALCASAR

Compare Revisions

No changes between revisions

Ignore whitespace Rev 2769 → Rev 2770

/alcasar.sh
588,7 → 588,7
echo "DOMAIN=$DOMAIN" >> $CONF_FILE
echo "EXTIF=$EXTIF" >> $CONF_FILE
echo "INTIF=$INTIF" >> $CONF_FILE
######## Récupération des interfaces du ou des réseaux de consultation supplémentaires #################
# Retrieve NIC name of other consultation LAN
INTERFACES=`/usr/sbin/ip link|grep '^[[:digit:]]:'|grep -v "^lo\|$EXTIF\|tun0"|cut -d " " -f2|tr -d ":"`
for i in $INTERFACES
do
604,7 → 604,6
elif [ -n "$LANIF" ]
then echo "LANIF=$LANIF" >> $CONF_FILE
fi
#########################################################################################################
IP_SETTING=`grep BOOTPROTO /etc/sysconfig/network-scripts/ifcfg-$EXTIF|cut -d"=" -f2` # test static or dynamic
if [ $IP_SETTING == "dhcp" ]
then
733,7 → 732,6
USERCTL=no
EOF
fi
#########################################################################################################
# write hosts.allow & hosts.deny
[ -e /etc/hosts.allow.default ] || cp /etc/hosts.allow /etc/hosts.allow.default
cat <<EOF > /etc/hosts.allow
787,10 → 785,11
# Copy & adapt ACC files
cp -rf $DIR_INSTALL/web/* $DIR_WEB/
$SED "s?99/99/9999?$DATE_SHORT?g" $DIR_ACC/menu.php
$SED "s?\$DB_RADIUS = .*?\$DB_RADIUS = \"$DB_RADIUS\"\;?g" $DIR_ACC/phpsysinfo/includes/xml/portail.php
$SED "s?\$DB_USER = .*?\$DB_USER = \"$DB_USER\"\;?g" $DIR_ACC/phpsysinfo/includes/xml/portail.php
$SED "s?\$radiuspwd = .*?\$radiuspwd = \"$radiuspwd\"\;?g" $DIR_ACC/phpsysinfo/includes/xml/portail.php
chmod 640 $DIR_ACC/phpsysinfo/includes/xml/portail.php
# Waiting for new phpsysinfo special page
#$SED "s?\$DB_RADIUS = .*?\$DB_RADIUS = \"$DB_RADIUS\"\;?g" $DIR_ACC/phpsysinfo/includes/xml/portail.php
#$SED "s?\$DB_USER = .*?\$DB_USER = \"$DB_USER\"\;?g" $DIR_ACC/phpsysinfo/includes/xml/portail.php
#$SED "s?\$radiuspwd = .*?\$radiuspwd = \"$radiuspwd\"\;?g" $DIR_ACC/phpsysinfo/includes/xml/portail.php
#chmod 640 $DIR_ACC/phpsysinfo/includes/xml/portail.php
chown -R apache:apache $DIR_WEB/*
# copy & adapt "freeradius-web" files
cp -rf $DIR_CONF/freeradius-web/ /etc/
1058,6 → 1057,7
/usr/bin/systemctl daemon-reload
# Allow apache to change some conf files (ie : ldap on/off)
chgrp apache /etc/raddb /etc/raddb/sites-available /etc/raddb/mods-available
chmod 750 /etc/raddb /etc/raddb/sites-available /etc/raddb/mods-available
} # End of freeradius()
 
#############################################################################
1840,10 → 1840,7
touch $DIR_DG/lists/blacklists/ossi-wl/domains
echo "ossi-wl" >> $DIR_DEST_ETC/alcasar-wl-categories-enabled
# add additional BL files
# download C&C BL, install it and enable it by default
$DIR_DEST_BIN/alcasar-bl.sh --install_ossi_candc
# copy all other additional BL
for x in $(ls $DIR_BLACKLIST | grep -v "^blacklist")
for x in $(ls $DIR_BLACKLIST | grep -v "^blacklists")
do
mkdir $DIR_DG/lists/blacklists/ossi-bl-$x
cp $DIR_BLACKLIST/$x $DIR_DG/lists/blacklists/ossi-bl-$x/domains
2191,6 → 2188,7
echo "BL_PUREIP=on" >> $CONF_FILE
echo "BL_SAFESEARCH=off" >> $CONF_FILE
echo "WL_SAFESEARCH=off" >> $CONF_FILE
echo "IOT_CAPTURE=off" >> $CONF_FILE
# Prompt customisation (colors)
[ -e /etc/bashrc.default ] || cp /etc/bashrc /etc/bashrc.default
cp -f $DIR_CONF/bashrc /etc/. ; chmod 644 /etc/bashrc ; chown root:root /etc/bashrc
/blacklist/blacklists.readme
0,0 → 1,20
#!/bin/bash
## dans alcasar-bl.sh
# C&C-Server node
CNC_BL_NAME="ossi-bl-candc"
## download
/usr/local/bin/alcasar-bl-autoupdate.sh --update_ossi-bl-candc
## enable blacklist by default by creating symlinks
if [ -e ${DIR_DNS_BL_ENABLED}/${CNC_BL_NAME} ]; then
rm ${DIR_DNS_BL_ENABLED}/${CNC_BL_NAME}
fi
if [ -e ${DIR_IP_BL_ENABLED}/${CNC_BL_NAME} ]; then
rm ${DIR_IP_BL_ENABLED}/${CNC_BL_NAME}
fi
echo "Creating symlinks to enable blacklist"
ln -s ${DIR_DNS_BL}/${CNC_BL_NAME}.conf ${DIR_DNS_BL_ENABLED}/${CNC_BL_NAME}
ln -s ${DIR_IP_BL}/${CNC_BL_NAME} ${DIR_IP_BL_ENABLED}/${CNC_BL_NAME}
exit 0
;;
 
 
/conf/sudoers
30,6 → 30,7
Cmnd_Alias HTDIGEST=/usr/local/bin/alcasar-profil.sh # to manage htdigest groups
Cmnd_Alias LOG_GEN=/usr/local/bin/alcasar-generate_log.sh # to create log PDF from ACC
Cmnd_Alias LDAP=/usr/local/bin/alcasar-ldap.sh # to enable/disable LDAP connection
Cmnd_Alias IOT_CAPTURE=/usr/local/bin/alcasar-iot_capture.sh # to enable/disable raw capture of Iot (pcap) --> in activity ACC page
 
# Defaults specification
# Defaults syslog=auth
49,6 → 50,6
# %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users localhost=/sbin/shutdown -h now
 
ADMWEB LAN_ORG=(root) NOPASSWD: NET,SYSTEM_BACKUP,SQL,BL,NF,EXPORT,RADDB,LOGOUT,UAM,SERVICE,GAMMU,SSL,HTDIGEST,LOG_GEN,LDAP
ADMWEB LAN_ORG=(root) NOPASSWD: NET,SYSTEM_BACKUP,SQL,BL,NF,EXPORT,RADDB,LOGOUT,UAM,SERVICE,GAMMU,SSL,HTDIGEST,LOG_GEN,LDAP,IOT_CAPTURE
ADMIN LAN_ORG=(root) NOPASSWD: NET,URPMI,BYPASS,SYSTEM_BACKUP,SQL,EXPORT,SERVICE,SSL
SMS LAN_ORG=(root) NOPASSWD: GAMMU
/scripts/alcasar-bl-autoupdate.sh
20,8 → 20,8
DIR_IP_WL="$DIR_SHARE/iptables-wl" # IP ossi disabled WL
CNC_BL_NAME="ossi-bl-candc"
CNC_URL="https://osint.bambenekconsulting.com/feeds/"
CNC_DNS_BL_URL=${CNC_URL}c2-dommasterlist-high.txt
CNC_IP_BL_URL=${CNC_URL}c2-ipmasterlist-high.txt
CNC_DNS=${CNC_URL}c2-dommasterlist-high.txt
CNC_IP=${CNC_URL}c2-ipmasterlist-high.txt
SED="/bin/sed -i"
CURL="/usr/bin/curl"
 
94,18 → 94,18
-update_ossi-bl-candc | --update_ossi-bl-candc)
# check availability of the lists
echo "Downloading blacklists from ${CNC_URL}..."
STATUS_URL_BL=$(${CURL} --connect-timeout 5 --write-out %{http_code} --silent --output /dev/null ${CNC_DNS_BL_URL})
STATUS_IP_BL=$(${CURL} --connect-timeout 5 --write-out %{http_code} --silent --output /dev/null ${CNC_IP_BL_URL})
STATUS_DNS_BL=$(${CURL} --connect-timeout 5 --write-out %{http_code} --silent --output /dev/null ${CNC_DNS})
STATUS_IP_BL=$(${CURL} --connect-timeout 5 --write-out %{http_code} --silent --output /dev/null ${CNC_IP})
# if downloaded successfully
if [ $STATUS_URL_BL = 200 ] && [ $STATUS_IP_BL = 200 ]; then
if [ $STATUS_DNS_BL = 200 ] && [ $STATUS_IP_BL = 200 ]; then
## parse domain names and ips from feed (cut first 19 lines (comments) and extract first column)
CNC_URLS=$($CURL $CNC_DNS_BL_URL | tail -n +19 | awk -F, '{print $1}')
CNC_IPS=$($CURL $CNC_IP_BL_URL | tail -n +19 | awk -F, '{print $1}')
CNC_DOMAINS=$($CURL $CNC_DNS | tail -n +19 | awk -F, '{print $1}')
CNC_IPS=$($CURL $CNC_IP | tail -n +19 | awk -F, '{print $1}')
## create files and adapt downloaded data to alcasar structure (add newlines after each ip/domain)
BL_DIR=${DIR_DG_BL}/${CNC_BL_NAME}
rm -rf ${BL_DIR}
mkdir $BL_DIR
echo $CNC_URLS | tr " " "\n" > ${BL_DIR}/urls
echo $CNC_DOMAINS | tr " " "\n" > ${BL_DIR}/urls
echo $CNC_IPS | tr " " "\n" > ${BL_DIR}/domains
## reload ossi-blacklists to add the created blacklist to ALCASAR
echo "Download successfull."
114,13 → 114,13
# if server responded with a code different than 200
else
## 000 means that curl failed
if [ $STATUS_URL_BL = 000 ] || [ $STATUS_IP_BL = 000 ]; then
if [ $STATUS_DNS_BL = 000 ] || [ $STATUS_IP_BL = 000 ]; then
echo "ERROR: curl could not access the internet to download blacklists."
echo "This appears to be an error on your side: please check the connection to the internet."
else
echo "ERROR: could not donwload blacklists: Server returned non-200 codes:"
echo "${CNC_DNS_BL_URL} returned ${STATUS_URL_BL}"
echo "${CNC_IP_BL_URL} returned ${STATUS_IP_BL}"
echo "${CNC_DNS} returned ${STATUS_DNS_BL}"
echo "${CNC_IP} returned ${STATUS_IP_BL}"
echo "Check the availability of the sites. Maybe the server removed its content or changed its address."
fi
exit 1
/scripts/alcasar-bl.sh
33,7 → 33,6
DIR_IP_BL_ENABLED="$DIR_SHARE/iptables-bl-enabled" # ' ' ip BL (only enabled categories)
DIR_IP_WL_ENABLED="$DIR_SHARE/iptables-wl-enabled" # ' ' ip WL (ossi and ossi-* imported from ACC)
REHABILITATED_DNS_FILE="/etc/unbound/conf.d/blacklist/rehabilitated.conf"
CNC_BL_NAME="ossi-bl-candc"
BL_SERVER="dsi.ut-capitole.fr"
SED="/bin/sed -i"
 
110,7 → 109,7
# search for correction egrep "([a-zA-Z0-9_-.]+\.){1,2}[a-zA-Z]{2,$MAX_TLD}" $ossi_custom_dir/domains > $FILE_tmp
}
 
usage="Usage: alcasar-bl.sh { -cat_choice or --cat_choice } | { -download or --download } | { -adapt or --adapt } | { -reload or --reload } | { -install_ossi_candc or --install_ossi_candc }"
usage="Usage: alcasar-bl.sh { -cat_choice or --cat_choice } | { -download or --download } | { -adapt or --adapt } | { -reload or --reload }"
nb_args=$#
args=$1
if [ $nb_args -eq 0 ]
282,22 → 281,6
rm -f $FILE_tmp $FILE_ip_tmp
rm -rf $DIR_tmp
;;
# install C&C-Server Blacklist.
-install_ossi_candc | --install_ossi_candc)
## download
/usr/local/bin/alcasar-bl-autoupdate.sh --update_ossi-bl-candc
## enable blacklist by default by creating symlinks
if [ -e ${DIR_DNS_BL_ENABLED}/${CNC_BL_NAME} ]; then
rm ${DIR_DNS_BL_ENABLED}/${CNC_BL_NAME}
fi
if [ -e ${DIR_IP_BL_ENABLED}/${CNC_BL_NAME} ]; then
rm ${DIR_IP_BL_ENABLED}/${CNC_BL_NAME}
fi
echo "Creating symlinks to enable blacklist"
ln -s ${DIR_DNS_BL}/${CNC_BL_NAME}.conf ${DIR_DNS_BL_ENABLED}/${CNC_BL_NAME}
ln -s ${DIR_IP_BL}/${CNC_BL_NAME} ${DIR_IP_BL_ENABLED}/${CNC_BL_NAME}
exit 0
;;
# reload when selected categories are changed or when ossi change his custom files
-reload | --reload)
# for E2Gardian
/scripts/alcasar-iot_capture.sh
0,0 → 1,60
#!/bin/bash
 
# alcasar-iot_capture.sh
# by Guillaume Gellusseau, Dorian Lemoine & REXY
# This script is distributed under the Gnu General Public License (GPL)
 
# Ce script lance une capture de flux réseau en fonction d'une adresse IP source ($1)
# This script performs a network flow capture based on source ip address ($1)
 
CONF_FILE="/usr/local/etc/alcasar.conf"
INTIF=`grep ^INTIF= $CONF_FILE|cut -d"=" -f2` # INTernal InterFace
 
function info
{
_PID=$(ps -ef | grep tcpdump | grep $1 | awk {'print $2'})
if [[ -n $_PID ]]
then
echo "CaptureON"
else
echo "CaptureOFF"
fi
}
 
function kill
{
_PID=$(ps -ef | grep tcpdump | grep $1 | awk {'print $2'})
sudo kill -2 $_PID
}
 
function launch
{
tcpdump ether host $1 -i $INTIF -n -w /tmp/capture_$1.pcap
}
 
function flush
{
sudo rm /tmp/capture_$1.pcap -f
}
 
 
while getopts "l k i f" option; do
 
case "${option}" in
 
l)
launch $2
;;
k)
kill $2
;;
i)
info $2
;;
f)
flush $2
;;
esac
done
 
#End
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:executable
+*
\ No newline at end of property
/scripts/alcasar-urpmi.sh
15,7 → 15,7
KERNEL="kernel-server-5.3.7-4.mga7-1-1.mga7"
# ****** Alcasar needed RPMS - paquetages nécessaires au fonctionnement d'Alcasar ******
# perl-Socket6 : needed by nfsen
PACKAGES="vim-enhanced freeradius freeradius-mysql freeradius-ldap lighttpd lighttpd-mod_auth php-fpm php-gd php-ldap php-mysqli php-mbstring php-sockets php-curl php-pdo_sqlite unbound e2guardian postfix mariadb ntp bind-utils openssh-server rng-utils rsync clamav perl-rrdtool perl-MailTools fail2ban gnupg2 ulogd pm-fallback-policy ipset usb_modeswitch tinyproxy vnstat dos2unix p7zip msec kernel-userspace-headers kernel-firmware-nonfree dnsmasq dhcp-server gammu wkhtmltopdf perl-Socket6"
PACKAGES="vim-enhanced freeradius freeradius-mysql freeradius-ldap lighttpd lighttpd-mod_auth php-fpm php-gd php-ldap php-mysqli php-mbstring php-sockets php-curl php-pdo_sqlite unbound e2guardian postfix mariadb ntp bind-utils openssh-server rng-utils rsync clamav perl-rrdtool perl-MailTools fail2ban gnupg2 ulogd pm-fallback-policy ipset usb_modeswitch tinyproxy vnstat dos2unix p7zip msec kernel-userspace-headers kernel-firmware-nonfree dnsmasq dhcp-server wkhtmltopdf perl-Socket6 tcpdump"
 
rpm_repository_sync ()
{
/web/acc/manager/htdocs/activity.php
48,9 → 48,14
$l_action = "Action";
$l_dissociate = "Dissocier @IP";
$l_disconnect = "Déconnecter";
$l_stop_capture_disconnect = "Arrêter la capture et se déconnecter";
$l_refresh = "Cette page est rafraichie toutes les 30 secondes";
$l_edit_user = "Editer l'utilisateur";
$l_edit_user = "Editer l'utilisateur";
$l_connect = "Autoriser temporairement";
$l_captureon = "Autoriser et capturer";
$l_captureoff = "Arrêter la capture";
$l_captureonly_on = "Capturer";
 
} else {
$l_activity = "Activity on the consultation LAN";
$l_ip_adr = "IP Adress";
61,17 → 66,44
$l_action = "Action";
$l_dissociate = "Dissociate @IP";
$l_disconnect = "Disconnect";
$l_stop_capture_disconnect = "Stop capture and disconnect";
$l_refresh = "This frame is refreshed every 30'";
$l_edit_user = "Edit user";
$l_edit_user = "Edit user";
$l_connect = "Temporarily authorize";
$l_captureon = "Authorize and capture";
$l_captureoff = "Stop capture";
$l_captureonly_on = "Capture";
 
}
 
if (isset($_POST['action'])){
switch ($_POST['action']){
case "$l_disconnect" :
$mac= $_POST['mac_addr'];
exec("sudo /usr/sbin/chilli_query logout ".escapeshellarg($_POST['mac_addr']));
unset($_POST['mac_addr']);
break;
case "$l_stop_capture_disconnect" :
$mac= $_POST['mac_addr'];
exec('sudo /usr/local/bin/alcasar-iot_capture.sh -k '.$mac.' &>/dev/null &');
$file = '/tmp/capture_'.$mac.'.pcap';
if (file_exists($file))
{
header('Content-Description : File Transfer');
header('Content-Type: application/octet-stream');
header('Content-disposition: attachement; filename='.basename($file).'');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Lenght: '.filesize($file));
readfile($file);
exec('sudo /usr/local/bin/alcasar-iot_capture.sh -f '.$macc);
exec("sudo /usr/sbin/chilli_query logout ".escapeshellarg($_POST['mac_addr']));
unset($_POST['mac_addr']);
exit;
}
 
break;
case "$l_dissociate" :
exec("sudo /usr/sbin/chilli_query dhcp-release ".escapeshellarg($_POST['mac_addr']));
unset($_POST['mac_addr']);
80,6 → 112,35
exec("sudo /usr/sbin/chilli_query authorize mac ".escapeshellarg($_POST['mac_addr']));
unset($_POST['mac_addr']);
break;
case "$l_captureon" :
$mac= $_POST['mac_addr'];
exec('sudo /usr/local/bin/alcasar-iot_capture.sh -l '.$mac.' &>/dev/null &');
exec("sudo /usr/sbin/chilli_query authorize mac ".escapeshellarg($_POST['mac_addr']));
unset($_POST['mac_addr']);
break;
case "$l_captureonly_on" :
$mac= $_POST['mac_addr'];
exec('sudo /usr/local/bin/alcasar-iot_capture.sh -l '.$mac.' &>/dev/null &');
break;
case "$l_captureoff" :
$mac= $_POST['mac_addr'];
exec('sudo /usr/local/bin/alcasar-iot_capture.sh -k '.$mac.' &>/dev/null &');
$file = '/tmp/capture_'.$mac.'.pcap';
if (file_exists($file))
{
header('Content-Description : File Transfer');
header('Content-Type: application/octet-stream');
header('Content-disposition: attachement; filename='.basename($file).'');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Lenght: '.filesize($file));
readfile($file);
exec('sudo /usr/local/bin/alcasar-iot_capture.sh -f '.$mac);
unset($_POST['mac_addr']);
exit;
}
break;
}
}
?>
107,6 → 168,7
<th><?= $l_action ?></th>
</tr>
<?php
$IoT_capture = $conf["IOT_CAPTURE"];
$output = array(); $detail = array(); $nb_ligne = 0;
exec("sudo /sbin/ip link show ".escapeshellarg($intif), $output); // retrieve ALCASAR MAC address
$detail = explode (" " , $output[1]);
145,7 → 207,7
unset ($found_users); unset ($cn);
$search = $login; $search_IN = 'username'; // is user in database ?
if (is_file("../lib/sql/find.php"))
include("../lib/sql/find.php");
include("../lib/sql/find.php");
if (isset ($found_users)) // user is in database
{
if (is_file("../lib/sql/user_info.php")) //retrieve user info (especialy $cn)
163,7 → 225,23
echo "</td><td>";
echo "<FORM action=\"".$_SERVER['PHP_SELF']."\" method=\"POST\">";
echo "<INPUT type=\"hidden\" name=\"mac_addr\" value=\"$detail[0]\">";
echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_disconnect\">";
 
if($IoT_capture == "on")
{
if(exec('sudo /usr/local/bin/alcasar-iot_capture.sh -i '.$detail[0]) == "CaptureON")
{
echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_stop_capture_disconnect\">";
echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_captureoff\">";
}
else
{
echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_disconnect\">";
echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_captureonly_on\">";
}
}
else
echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_disconnect\">";
 
echo "</FORM></TD>";
}
# Disable temporarily @MAC access
198,6 → 276,19
echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_dissociate\">"; // Dissociate only MAC not in ether file (dhcp)
}
echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_connect\">"; // Enable temporarily @MAC access
if($IoT_capture == "on")
{
if(exec('sudo /usr/local/bin/alcasar-iot_capture.sh -i '.$detail[0]) == "CaptureON")
{
echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_captureoff\">";
}
else
{
echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_captureon\">";
echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_captureonly_on\">";
}
}
echo "</FORM></TD>";
}
unset ($mac_in_ether_file);
/web/acc/phpsysinfo/images/Slackware.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Deleted: svn:mime-type
-image/png
\ No newline at end of property
/web/acc/phpsysinfo/images/Suse.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Deleted: svn:mime-type
-image/png
\ No newline at end of property
/web/acc/phpsysinfo/images/NetBSD.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Deleted: svn:mime-type
-image/png
\ No newline at end of property
/web/acc/phpsysinfo/images/Mandrake.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Deleted: svn:mime-type
-image/png
\ No newline at end of property
/web/acc/phpsysinfo/images/Debian.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Deleted: svn:mime-type
-image/png
\ No newline at end of property
/web/acc/phpsysinfo/images/Mageia.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Deleted: svn:mime-type
-image/png
\ No newline at end of property
/web/acc/phpsysinfo/images/Darwin.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Deleted: svn:mime-type
-image/png
\ No newline at end of property
/web/acc/phpsysinfo/images/lfs.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Deleted: svn:mime-type
-image/png
\ No newline at end of property
/web/acc/phpsysinfo/images/Rubix.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Deleted: svn:mime-type
-image/png
\ No newline at end of property
/web/acc/phpsysinfo/images/OpenBSD.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Deleted: svn:mime-type
-image/png
\ No newline at end of property
/web/acc/phpsysinfo/images/CentOS.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Deleted: svn:mime-type
-image/png
\ No newline at end of property
/web/acc/phpsysinfo/images/Gentoo.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Deleted: svn:mime-type
-image/png
\ No newline at end of property
/web/acc/phpsysinfo/images/Arch.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/web/acc/phpsysinfo/images/unknown.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Deleted: svn:mime-type
-image/png
\ No newline at end of property
/web/acc/phpsysinfo/images/PLD.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/web/acc/phpsysinfo/images/Fedora.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Deleted: svn:mime-type
-image/png
\ No newline at end of property
/web/acc/phpsysinfo/images/Ubuntu.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/web/acc/phpsysinfo/images/Trustix.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/web/acc/phpsysinfo/images/Cobalt.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Deleted: svn:mime-type
-image/png
\ No newline at end of property
/web/acc/phpsysinfo/images/free-eos.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Deleted: svn:mime-type
-image/png
\ No newline at end of property
/web/acc/phpsysinfo/images/Redhat.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Deleted: svn:mime-type
-image/png
\ No newline at end of property
/web/acc/phpsysinfo/images/SunOS.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Deleted: svn:mime-type
-image/png
\ No newline at end of property
/web/acc/phpsysinfo/images/xp.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/web/acc/phpsysinfo/images/FreeBSD.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes:
Deleted: svn:mime-type
-image/png
\ No newline at end of property
/web/acc/phpsysinfo/config.php
File deleted
/web/acc/phpsysinfo/readme
File deleted
/web/acc/phpsysinfo/ChangeLog
File deleted
/web/acc/phpsysinfo/distros.ini
File deleted
/web/acc/phpsysinfo/copying
File deleted
/web/acc/phpsysinfo/phpsysinfo.dtd
File deleted
/web/acc/phpsysinfo/CHANGELOG.md
0,0 → 1,417
Changelog of phpSysInfo
=======================
 
http://phpsysinfo.sourceforge.net/
 
phpSysInfo 3.3.2
----------------
 
- [UPD] Korean Translation ko.xml
 
- [ADD] Exherbo and EasyOS to detected distros
- [ADD] PCI devices list on SunOS
 
- [NEW] OS Type information
- [NEW] CPU manufacturer information
- [NEW] Frontend Bootstrap view in web app mode on mobile devices
 
phpSysInfo 3.3.1
----------------
 
- [UPD] bootstrap 4.3.1
- [UPD] bootstrap-ie 4.3.100
- [ADD] Indonesian Translation id.xml
 
- [NEW] HIDE_BOOTSTRAP_LOADER option
- [NEW] Uprecords plugin - DENOTE_BY_ASTERISK option
- [DEL] jQuery 3.3.1
 
phpSysInfo 3.3.0
----------------
 
- [UPD] Frontend Bootstrap3 to Bootstrap4 with IE8 and IE9 compatibility modules
 
- [ADD] Endless, Kali, Redcore and MX Linux to detected distros
- [ADD] SMART plugin - support for NVMe disks
- [ADD] Uprecords plugin - SHORT_MODE option
- [ADD] Raid plugin - IDRAC RAID status
- [NEW] NVMe devices list on Linux
- [NEW] Docker plugin - docker stats
- [NEW] SORT_NETWORK_INTERFACES_LIST and SORT_SENSORS_LIST options
- [NEW] IGNORE_FREE, IGNORE_USAGE and IGNORE_THRESHOLD_FS_TYPES options
 
phpSysInfo 3.2.10
----------------
 
- [UPD] jQuery 3.3.1
 
- [ADD] NuTyX to detected distros
 
- [FIX] Raid plugin - fixed zpool analize
 
phpSysInfo 3.2.9
----------------
 
- [UPD] Greek Translation gr.xml
 
- [ADD] BAT plugin - Model, Manufacturer and Serial Number information
- [ADD] BAT plugin - SHOW_SERIAL and UPOWER option
- [ADD] Springdale Linux to detected distros
 
- [NEW] SHOW_DEVICES_INFOS and SHOW_DEVICES_SERIAL options
- [NEW] Thinkpad - Lenovo Thinkpad sensors monitoring for Linux
- [NEW] StableBit plugin - StableBit Scanner info
- [NEW] HyperV plugin - Hyper-V info
- [NEW] Raid plugin - software, fake, zpool and megaraid RAID status
 
- [DEL] Removed deprecated MDStatus and DMRaid plugins
 
phpSysInfo 3.2.8
----------------
 
- [UPD] jQuery 3.2.1
- [UPD] French Translation fr.xml
- [UPD] CPU usage on WinNT
- [UPD] Ukrainian Translation uk.xml
 
- [FIX] Fixed incorrect network usage on FreeBSD 11
- [FIX] Fixed healthd sensors
- [FIX] Fixed displaying for code pages windows-932, windows-949 and windows-950 for WinNT
 
- [ADD] Container Linux, PureOS, OpenELEC, LibreELEC and Lakka to detected distros
- [ADD] FreeIPMI, IPMItool and IPMIutil other information
- [ADD] PS plugin - CPU usage
- [ADD] PS plugin - MEMORY_USAGE, CPU_USAGE and SHOW_PID1CHILD_EXPANDED options
- [ADD] SMART plugin - WMI access for WinNT
 
- [NEW] DATETIME_FORMAT option
- [NEW] BLOCKS option - order of data blocks
- [NEW] SHOW_NETWORK_ACTIVE_SPEED option
- [NEW] Ability to generate only part of the data
- [NEW] LOAD_BAR compact mode option
- [NEW] PingTest plugin
 
- [DEL] Removed deprecated IPMIinfo plugin
 
phpSysInfo 3.2.7
----------------
 
- [UPD] jQuery 3.1.1
- [UPD] Network interfaces info for WinNT
- [UPD] Turkish Translation tr.xml
- [UPD] Greek Translation gr.xml
- [UPD] Korean Translation ko.xml
- [UPD] Ukrainian Translation uk.xml
 
- [ADD] Devuan and SalentOS to detected distros
- [ADD] HIDE_NETWORK_MACADDR option
 
- [NEW] Raspberry Pi detection on Linux
 
phpSysInfo 3.2.6
----------------
 
- [UPD] jQuery 3.1.0 and jQuery 1.12.4
- [UPD] bootstrap 3.3.7
- [UPD] Swedish Translation sv.xml
- [UPD] Norwegian Translation no.xml
 
- [ADD] NeoKylin and Void to detected distros
- [ADD] schabau and lingruby template
- [ADD] DMRaid plugin - FreeBSD graid info
- [ADD] SNMPPInfo plugin - support for Ricoh printers
- [ADD] UpdateNotifier plugin - ACCESS option
 
- [NEW] sudo commands list
- [NEW] plugin Iptables - iptables rules list
 
phpSysInfo 3.2.5
----------------
 
- [UPD] jQuery 2.2.0 and jQuery 1.12.0
 
- [ADD] Show network interfaces infos for NetBSD and OpenBSD
- [ADD] SHOW_NETWORK_INFOS_EXPANDED option
- [ADD] SHOW_MEMORY_INFOS_EXPANDED option
- [ADD] QTS, OpenMamba and HipServ to detected distros
- [ADD] SNMPups - monitoring UPS via SNMP
 
- [NEW] reloading plugins also for frontend "bootstrap"
- [NEW] Network speed info on WinNT, Linux, Android, Darwin, NetBSD, OpenBSD and FreeBSD
- [NEW] Coretemp monitoring also on Linux
- [NEW] QTSsnmp - SNMP sensors monitoring for QTS Linux
- [NEW] Hwmon - sensors monitoring for Linux
- [NEW] SpeedFan - sensors monitoring for WinNT
- [NEW] Separate configuration sections for motherboard monitoring sensors programs
- [NEW] List of IP addresses of clients authorized to run
 
phpSysInfo 3.2.4
----------------
 
- [ADD] Solus to detected distros
- [ADD] Uprecords plugin - MAX_ENTRIES option - maximum number of entries to show
 
- [UPD] Refreshing status of all plugins for dynamic mode
- [UPD] bootstrap 3.3.6
 
- [NEW] language and template selection also for frontend "bootstrap"
 
- [FIX] PHP 7 class Error issues
 
phpSysInfo 3.2.3
----------------
 
- [UPD] jQuery 2.1.4 and jQuery 1.11.3
- [UPD] bootstrap 3.3.5
 
- [NEW] I2C devices list on Android and Linux
 
- [ADD] blue template
 
phpSysInfo 3.2.2
----------------
 
- [UPD] bootstrap 3.3.4
 
- [NEW] Thunderbolt (TB) devices list on Darwin
 
- [ADD] cleansyn template
- [ADD] PS plugin - support for Android
- [ADD] PS plugin - SHOW_KTHREADD_EXPANDED option
- [ADD] Qubes and HandyLinux to detected distros
 
- [FIX] PS plugin - fixed display of the processes tree
 
phpSysInfo 3.2.1
----------------
 
- [UPD] bootstrap 3.3.2
 
- [NEW] REFRESH parameter also for frontend "bootstrap"
 
- [ADD] pfSense to detected distros
 
- [FIX] Percentage memory usage
 
phpSysInfo 3.2.0
----------------
 
- [UPD] jQuery 2.1.3 and jQuery 1.11.2
 
- [NEW] Frontend "bootstrap" with Bootstrap3 and Transparency (JSON)
 
- [ADD] Catalan Translation ca.xml
- [ADD] Mer (core of Sailfish OS) and Tizen to detected distros
- [ADD] ThermalZone sensor support for Linux and Android
- [ADD] Temperature, voltage and current sensor for Banana Pi
 
- [UPD] German Translation de.xml
 
phpSysInfo 3.1.17
----------------
 
- [UPD] BAT plugin - capacity unit, cycle count, FreeBSD support
- [UPD] Brazilian Portuguese Translation pt-br.xml
 
- [ADD] Show the number of processes on Haiku
- [ADD] ThermalZone sensor support for WinNT
- [ADD] Tanglu to detected distros
- [ADD] Android and OS X version name
 
- [FIX] Fixed display of treetables
 
phpSysInfo 3.1.16
----------------
 
- [ADD] Show the number of processes
- [ADD] Lunar and 4MLinux to detected distros
 
phpSysInfo 3.1.15
----------------
 
- [ADD] CoreOS and Pisi Linux to detected distros
- [ADD] pmset - UPS support on Darwin (thanks to pelletierr)
- [ADD] lspci support on Darwin
- [ADD] SHOW_CPULIST_EXPANDED option
- [ADD] lxc/docker detection on Linux
- [ADD] ability to hide all disks and all network interfaces
 
- [FIX] Small CSS fix
 
- [UPD] Memory informations on Darwin systems
- [UPD] BAT plugin - Darwin support
 
phpSysInfo 3.1.14
----------------
 
- [ADD] FreeIPMI sensor program support
- [ADD] IPMIutil sensor program support
- [ADD] PowerSoftPlus (EVER) UPS program support
- [ADD] Line frequency for the UPS info
- [ADD] SENSOR_EVENTS option - show events of sensors
- [ADD] HIDE_RAID_DEVICES option for plugins MDStatus and DMRaid - list of RAID devices to hide
- [ADD] idash template
 
phpSysInfo 3.1.13
----------------
 
- [UPD] jQuery 2.1.1 and jQuery 1.11.1
- [UPD] Romanian Translation ro.xml
 
- [ADD] SHOW_CPUINFO_EXPANDED option
- [ADD] Machine detection on WINNT, Linux, Android and Darwin systems
 
phpSysInfo 3.1.12
----------------
 
- [ADD] GoboLinux, UltimateEdition, BOSS, Canaima, VortexBox, KaOS and NixOS to detected distros
- [ADD] OpenHardwareMonitor sensor program support
- [ADD] Possibility to define multiple UPS_PROGRAM
- [ADD] UPS_NUT_LIST option
 
- [FIX] Fixed incorrect network usage on FreeBSD
 
- [UPD] SMART plugin - Smartctl --device option value setting method
 
phpSysInfo 3.1.11
----------------
 
- [ADD] Add Access-Control-Allow-Origin on XML (JSON) interface for Ajax Load PR#47
- [ADD] Generations Linux and SliTaz to detected distros
- [ADD] IPMI and LMSensors currents information
- [ADD] Plugin IPMIInfo - added powers and currents values
- [ADD] Partial support of QNX
 
- [FIX] Reduce execution time on Linux systems when showing load average PR#47
 
phpSysInfo 3.1.10
----------------
 
- [ADD] Zenwalk and Raspbian to detected distros
 
- [FIX] /etc/os-release Linux distro detection
 
phpSysInfo 3.1.9
----------------
 
- [NEW] plugin DMRaid - software raid status
 
- [ADD] Calculate, Tails, SMEServer, Semplice, SolydXK, Parsix, RedFlag, Amazon, Korora, OpenMandriva, SteamOS, ROSA Enterprise Server and ROSA Desktop Fresh to detected distros
 
- [UPD] Rebuilding of the Linux distribution detection
- [UPD] jQuery 2.1.0 and jQuery 1.11.0
 
phpSysInfo 3.1.8
----------------
 
- [ADD] Add printers messages in the XML output
- [ADD] PSStatus plugin - added optional regular expression search in the process name
- [ADD] RedHatEnterpriseClient distro icon #40
- [ADD] Hebrew Translation he.xml
 
- [FIX] BAT plugin - fix for old and new kernel /proc/acpi and /sys/class/power_supply
 
- [UPD] LMSensors name for Mac hardware sensors
 
phpSysInfo 3.1.7
----------------
 
- [ADD] Ksplice support for Linux
- [ADD] Show CPU frequency max and min for Darwin (Mac OS X)
- [ADD] Show System Language and Code Page on Darwin (Mac OS X)
- [ADD] Show network interfaces infos for Minix and SunOS
- [ADD] SMS, gNewSense and Vector to detected distros
- [ADD] LMSensors power information
- [ADD] Battery installation date for the UPS info
 
- [UPD] Network interfaces infos and filesystems infos for FreeBSD
- [UPD] Updated support of SunOS
- [UPD] Memory informations on Darwin systems
- [UPD] BAT plugin - updated Linux support
- [UPD] Updated HWSensors - OpenBSD sensor program
 
phpSysInfo 3.1.6
----------------
 
- [ADD] Porteus, Peppermint, Manjaro, Netrunner and Salix to detected distros
- [ADD] Show CPU frequency max for WINNT
- [ADD] Show network interfaces infos for Darwin (Mac OS X)
 
- [UPD] SNMPPInfo plugin, ink level for some of the data
- [UPD] jQuery 2.0.3 and jQuery 1.10.2
- [UPD] Russian Translation ru.xml
- [UPD] BAT plugin - WINNT support
 
- [SEC] Fix JSONP
 
phpSysInfo 3.1.5
----------------
 
- [ADD] Possibility to define multiple SENSOR_PROGRAM
- [ADD] Added display of temperature and fan speed for IPMI sensor program
- [ADD] openSUSE and Eisfair to detected distros
- [ADD] Portuguese Translation pt-pt.xml
 
- [FIX] Fixed incorrect display of the minimum fan speed
- [FIX] Fix recovery detection of RAID arrays on debian systems #18
 
phpSysInfo 3.1.4
----------------
 
- [ADD] Option for reading the results of functions executeProgram() and rfts() from log
- [ADD] Show CPU frequency max and min for variable speed processors for Linux and Android
- [ADD] Filesystem usage warning on defined threshold FS_USAGE_THRESHOLD
 
- [UPD] BAT plugin - added temperature, condition and type of battery, Android support
- [UPD] jQuery 2.0.2 and jQuery 1.10.1
 
phpSysInfo 3.1.3
----------------
 
- [ADD] IPFire, Sabayon, PearOS, ClearOS, Frugalware, Fuduntu, Foresight, Tinycore, ALT Linux, ROSA Desktop Marathon and RedHatEnterpriseServer to detected distros
 
- [UPD] Added "username" to filtered mount credentials
- [UPD] jQuery 2.0 coexistent with jQuery 1.9.1 for old Internet Explorer browser versions (IE 6/7/8)
 
- [FIX] proc_open() malfunction on some PHP for Android by replacing by popen()
- [FIX] Run php-cs-fixer on php files (PSR-2 fixer)
 
phpSysInfo 3.1.2
----------------
 
- [ADD] Tempsensor and CPU frequency for Raspberry Pi (thanks to hawkeyexp)
- [ADD] Linaro to detected distros
- [ADD] Option for logging of functions executeProgram() and rfts()
- [ADD] Add support of JSONP
 
- [FIX] Incorrect display of chunk size for the plugin mdstatus for some results
 
phpSysInfo 3.1.1
----------------
 
- [ADD] SolusOS, Deepin and antiX to detected distros
- [ADD] Simplified Chinese translation
 
- [UPD] jQuery 1.9.1
 
phpSysInfo 3.1.0
----------------
 
- [NEW] Configuration moved from config.php and subdirs of "plugins" to one file phpsysinfo.ini
 
- [ADD] Turbolinux, Oracle Linux, CloudLinux, PCLinuxOS, StartOS, Trisquel, CRUX, Slax, Pear, Android, Zorin and elementary OS to detected distros
- [ADD] Show System Language and Code Page on Linux, Haiku and WINNT
- [ADD] Minor support of ReactOS
- [ADD] apcupsd-cgi support (thanks to duhast)
 
- [UPD] Plugin ipmi renamed to IPMIInfo and Update-Notifier to UpdateNotifier (to avoid name conflicts)
- [UPD] Case-insensitive for most of parameters
- [UPD] Detection of Mac OS X and Linux distribution
- [UPD] CPU detection on Mac OS X
 
- [FIX] Fixed UTF8 encoding for Linux
- [FIX] SMART plugin doesn't display for some results
- [FIX] Incorrect display of mountpoint on Mac OS X
/web/acc/phpsysinfo/CODE_OF_CONDUCT.md
0,0 → 1,46
# Contributor Covenant Code of Conduct
 
## Our Pledge
 
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
 
## Our Standards
 
Examples of behavior that contributes to creating a positive environment include:
 
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
 
Examples of unacceptable behavior by participants include:
 
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
 
## Our Responsibilities
 
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
 
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
 
## Scope
 
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
 
## Enforcement
 
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [phpsysinfo@yahoo.com](mailto:phpsysinfo@yahoo.com). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
 
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
 
## Attribution
 
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
 
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
/web/acc/phpsysinfo/CONTRIBUTING.md
0,0 → 1,7
# Contributing to phpSysInfo
First time contributing to phpSysInfo? Read our [Code of Conduct](https://github.com/phpsysinfo/phpsysinfo/blob/master/CODE_OF_CONDUCT.md).
 
### Propose a feature
 
If you have a great idea or want to help out, just create a pull request with your change proposal
in the [phpSysInfo](https://github.com/phpsysinfo/phpsysinfo) repository.
/web/acc/phpsysinfo/COPYING
0,0 → 1,339
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
 
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
 
Preamble
 
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
 
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
 
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
 
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
 
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
 
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
 
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
 
The precise terms and conditions for copying, distribution and
modification follow.
 
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
 
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
 
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
 
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
 
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
 
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
 
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
 
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
 
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
 
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
 
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
 
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
 
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
 
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
 
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
 
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
 
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
 
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
 
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
 
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
 
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
 
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
 
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
 
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
 
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
 
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
 
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
 
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
 
NO WARRANTY
 
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
 
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
 
END OF TERMS AND CONDITIONS
 
How to Apply These Terms to Your New Programs
 
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
 
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
 
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
 
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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
Also add information on how to contact you by electronic and paper mail.
 
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
 
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
 
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
 
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
 
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
 
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
 
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
/web/acc/phpsysinfo/Dockerfile
0,0 → 1,28
# phpSysInfo
# VERSION 3
 
FROM ubuntu:16.04
#FROM ubuntu:14.04
 
MAINTAINER phpSysInfo
 
# Update sources
#RUN echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" > /etc/apt/sources.list
RUN apt-get update
 
RUN apt-get install -y apache2 php7.0 php7.0-xml php7.0-mbstring libapache2-mod-php7.0 git pciutils
#RUN apt-get install -y apache2 php5 git pciutils
 
RUN git clone https://github.com/phpsysinfo/phpsysinfo.git /var/www/html/phpsysinfo
RUN cp /var/www/html/phpsysinfo/phpsysinfo.ini.new /var/www/html/phpsysinfo/phpsysinfo.ini
#RUN cat /var/www/html/phpsysinfo/phpsysinfo.ini.new | sed 's/^LOAD_BAR=false/LOAD_BAR=true/' >/var/www/html/phpsysinfo/phpsysinfo.ini
 
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_PID_FILE /var/run/apache2/apache2.pid
 
CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]
 
EXPOSE 80
/web/acc/phpsysinfo/ISSUE_TEMPLATE.md
0,0 → 1,16
# Issue template
 
First make sure you've read the README.md file completely, especially the
"INSTALLATION AND CONFIGURATION" section. If it still doesn't work then
you can:
 
Ask for help or submit a bug on Github (https://github.com/phpsysinfo/phpsysinfo/issues)
 
***!! If you have any problems, please set `DEBUG` to true in `phpsysinfo.ini`
and include any error messages in your bug report / help request !!***
 
OTHER NOTES
-----------
 
If you have a great idea or want to help out, just create a pull request with your change proposal
in the [phpSysInfo](https://github.com/phpsysinfo/phpsysinfo) repository.
/web/acc/phpsysinfo/README.md
0,0 → 1,127
phpSysInfo
==============
 
* Copyright (c), 1999-2008, Uriah Welcome ([sf.net/users/precision](https://sf.net/users/precision))
* Copyright (c), 1999-2009, Michael Cramer ([sf.net/users/bigmichi1](https://sf.net/users/bigmichi1))
* Copyright (c), 2007-2008, Audun Larsen ([sf.net/users/xqus](https://sf.net/users/xqus))
* Copyright (c), 2007-2015, Erkan Valentin ([github.com/rk4an](https://github.com/rk4an), [sf.net/users/jacky672](https://sf.net/users/jacky672))
* Copyright (c), 2009-2020, Mieczyslaw Nalewaj ([github.com/namiltd](https://github.com/namiltd), [sf.net/users/namiltd](https://sf.net/users/namiltd))
* Copyright (c), 2010-2012, Damien Roth ([sf.net/users/iysaak](https://sf.net/users/iysaak))
 
 
REQUIREMENTS
------------
 
PHP 5.1.3 or later with SimpleXML, PCRE, XML and DOM extension.
 
#### Suggested extensions:
- mbstring: Required for *nix non UTF-8 systems
- com_dotnet: Required for Windows environments
- xsl: Required for static mode
- json: Required for bootstrap mode
 
CURRENT TESTED PLATFORMS
------------------------
 
- Linux 2.6+
- FreeBSD 7+
- OpenBSD 2.8+
- NetBSD
- DragonFly
- HP-UX
- Darwin / Mac OS / OS X
- Windows 2000 / XP / 2003 / Vista / 2008 / 7 / 2011 / 2012 / 8 / 8.1 / 10 / 2016 / 2019
- Android
 
#### Platforms currently in progress:
- Haiku
- Minix
- SunOS
- ReactOS
- IBM AIX
- QNX
 
If your platform is not here try checking out the mailing list archives or
the message boards on SourceForge.
 
INSTALLATION AND CONFIGURATION
------------------------------
 
#### Typical installation
 
Just decompress and untar the source (which you should have done by now,
if you're reading this...), into your webserver's document root.
 
There is a configuration file called phpsysinfo.ini.new. If this a brand new
installation, you should copy this file to phpsysinfo.ini and edit it.
 
- make sure your `php.ini` file's `include_path` entry contains "."
- make sure your `php.ini` has `safe_mode` set to 'off'.
 
phpSysInfo require php-xml extension.
 
Please keep in the mind that because phpSysInfo requires access to many
files in `/proc` and other system binary you **MUST DISABLE** `php's safe_mode`.
Please see the PHP documentation for information on how you
can do this.
 
That's it. Restart your webserver (if you changed php.ini), and voila.
 
#### Docker container installation
 
- `sudo docker build -t phpsysinfo github.com/phpsysinfo/phpsysinfo`
- `sudo docker run -i -p 8080:80 -t phpsysinfo`
- go to http://localhost:8080/phpsysinfo/
 
KNOWN PROBLEMS
--------------
 
- phpSysInfo is not compatible with SELinux Systems
- small bug under FreeBSD with memory reporting
 
PLATFORM SPECIFIC ISSUES
------------------------
 
#### Windows with IIS
On Windows systems we get our informations through the WMI interface.
If you run phpSysInfo on the IIS webserver, phpSysInfo will not connect
to the WMI interface for security reasons. At this point you MUST set
an authentication mechanism for the directory in the IIS admin
interface for the directory where phpSysInfo is installed. Then you
will be asked for an user and a password when opening the page. At this
point it is necessary to log in with an user that will be able to
connect to the WMI interface. If you use the wrong user and/or password
you might get an "ACCESS DENIED ERROR".
 
SENSOR RELATED INFORMATION
---------------------------
 
#### MBM5
Make sure you set MBM5 Interval Logging to csv and to the data
directory of phpSysInfo. The file must be called MBM5. Also make sure
MBM5 doesn't add symbols to the values. This is a Quick MBM5 log parser,
need more csv logs to make it better.
 
WHAT TO DO IF IT DOESN'T WORK
-----------------------------
 
First make sure you've read this file completely, especially the
"INSTALLATION AND CONFIGURATION" section. If it still doesn't work then
you can:
 
Ask for help or submit a bug on Github (https://github.com/phpsysinfo/phpsysinfo/issues)
 
***!! If you have any problems, please set `DEBUG` to true in `phpsysinfo.ini`
and include any error messages in your bug report / help request !!***
 
OTHER NOTES
-----------
 
If you have a great idea or want to help out, just create a pull request with your change proposal
in the [phpSysInfo](https://github.com/phpsysinfo/phpsysinfo) repository.
 
LICENSING
---------
 
This program is released under the GNU Public License Version 2 or
(at your option) any later version, see [COPYING](COPYING) for details.
/web/acc/phpsysinfo/README_PLUGIN.md
0,0 → 1,134
phpSysInfo 3.1 - http://phpsysinfo.sourceforge.net/
===================================================
 
Document written by Michael Cramer (bigmichi1 at sourceforge.net)
 
!!Please read if you want to develop a plugin to understand our plugin system!!
 
 
Plugins
-------
 
Beginning with phpSysInfo 3.0, phpSysInfo can be extended by Plugins. So here is
a description that a developer of a plugin must take care of. Plugins can be
enabled through the `phpsysinfo.ini` in the PLUGINS variable. The name of the
plugin is essential for the function of the plugin system. Lets say you write a
plugin with the name 'pingtest', then this name is added to the PLUGINS
variable in `phpsysinfo.ini`. And this is also then the name which is everywhere in
the plugin system used, like creating the object, locate the needed files and
so on.
 
So if the name is now specified, phpSysInfo needs a special directory structure
to find the needed files. The directory structure for the example `pingtest`
plugin can be seen here:
 
```
-+ phpSysInfo root
|
+---+ plugins (directory in that plugins are installed)
| |
| +---+ pingtest (the real plugin directory, must have the same name like
| | | the plugin named in PLUGINS, else it won't be found)
| | |
| | +---+ js (directory in which the needed JavaScript file is located,
| | | | to generate the html output out of the xml)
| | | # pingtest.js (the js file must have the same name, like the
| | | plugin in PSI_PLUGINS with the extension js)
| | +---+ css (directory in which the needed style sheet information are
| | | | located, can exists, but it's up to the author)
| | | # pingtest.css (the css file must have the same name, like the
| | | plugin in PSI_PLUGINS with the extension css)
| | +---+ lang (directory where translations for the plugin are located)
| | | |
| | | # en.xml (at least an english translation file must exist)
| | |
| | # class.pingtest.inc.php (this is the core file of the plugin,
| | name must consists of 'class' +
| | name from PSI_PLUGINS + '.inc.php')
```
 
other files or directorys can be included in the plugin directory, but then
its up to the developer to include them in the plugin. So it might be possible
to have a 'gfx' directory in which some pics are located that are used in the
output.
 
If the directory structure is build up, then it's time to start programming.
 
Files
-----
 
An example implementation is the pingtest plugin, which is shipped with phpSysInfo
 
* en.xml - at least this file must exist to get the translation working, and the
the first entry in this file is normally the headline of the plugin.
So one translation migth exists everytime. Other translation files
are also in the same directory like the `en.xml` file.
The id's specified in the translation file SHOULD have the following
look `plugin_hdd_status_001`. First we say that this is a plugin
translation, then the name of plugin and at last a increasing number
for each translation. Please create your id's in that way, so that
other plugins don't redefine your translations. At the time of writing
this, there is no check to verify the id's, so be carfull.
 
* pingtest.css - here can all custom style sheet informations written down. The
names of the id's and classes SHOULD also begin, like the translation
id's, with `'plugin_' + pluginname`. If thats not the case it might be
possible that another plugin is overwriting your css definitions.
 
* class.pingtest.inc.php - this file MUST include a class with the plugin name
and also this class MUST extend the 'psi_plugin' class. A check that
such a class exist and also extends 'psi_plugin' will be included in
the near future. And if the check fails the plugin won't be loaded.
The psi_plugin class checks the existens of the js and the en.xml
files. Also an extra configuration of the plugin is loaded
automatically from `phpsysinfo.ini`, if present.
Through the extension of the psi_plugin class there is a need to
include at least two public function. These are the execute() function
and the xml() function. Other functions can be exist, that depends on
the plugin needs or the author of the class. The execute() function is
called to get the required information that should be later included
in the xml file. The xml() function is called when the xml output
should be generated. This function must return a simplexml object. This
object is then included in another xml at the right position or as a
standalone xml. So there is no need to do some special things, only
create a xml object for the plugin.
 
* pingtest.js - this file is called when the page is loaded. A block for the
plugin is automatically created. This one is a div container with the
id `'plugin_'+ pluginname ("plugin_pingtest")`. The entire output must be
placed in that container.
There is a helper function for creating the headline: buildBlock() that
can be called. This function returns a string with the html code of the
headline, this code can then be appended to the plugin block. The
generated headline can provide a reload icon for an ajax request. Only
the click action of that icon must be created. The id of this icon is
`'reload_' + pluginname + 'Table' ("reload_pingtestTable")`.
Everything that then is done to get the html output out of the xml is up
to the author.
To get the xml document the ajax request url is `'xml.php?plugin=' +
pluginname (xml.php?plugin=pingtest)`. This xml includes only the xml
from the plugin nothing more.
The last two executed commands should/must be the translation call and
the unhide of the filled div container.
The translation function that needs to be called is named
plugin_traslate() with one argument, that is the pluginname like in
`PSI_PLUGINS (plugin_translate("pingtest");)`.
To unhide the filled container call the .show() function of it.
`$("plugin_" + pluginname).show() ($("plugin_hdd_stat").show())`.
 
FAQ
---
 
Q: Is the plugin system ready to use?
 
A: It can be used, but it might change slightly in the future, if there are some
special needs.
 
SUGGESTION
----------
 
If anybody out there has some suggestions in improving the plugin system let us
know. We are looking forward to get some feedback, suggestions and patches and
more. Feel free to contact us on our website: http://phpsysinfo.sourceforge.net.
 
$Id: README_PLUGIN 463 2011-04-19 17:34:41Z namiltd $
/web/acc/phpsysinfo/composer.json
0,0 → 1,19
{
"name": "phpsysinfo/phpsysinfo",
"description": "phpSysInfo is a customizable PHP Script that parses /proc, and formats information nicely. It will display information about system facts like Uptime, CPU, Memory, PCI devices, SCSI devices, IDE devices, Network adapters, Disk usage, and more.",
"license": "GPL-2.0-or-later",
"homepage": "http://phpsysinfo.github.io/phpsysinfo/",
"require": {
"php": ">=5.1.3",
"ext-simplexml": "*",
"ext-pcre": "*",
"ext-xml": "*",
"ext-dom": "*"
},
"suggest": {
"ext-mbstring": "Required for *nix non UTF-8 systems",
"ext-com_dotnet": "Required for Windows environments",
"ext-xsl": "Required for static mode",
"ext-json": "Required for bootstrap mode"
}
}
/web/acc/phpsysinfo/includes/system_header.php
File deleted
/web/acc/phpsysinfo/includes/indicator.php
File deleted
/web/acc/phpsysinfo/includes/XPath.class.php
File deleted
\ No newline at end of file
/web/acc/phpsysinfo/includes/lang/br.php
File deleted
/web/acc/phpsysinfo/includes/lang/fr.php
File deleted
/web/acc/phpsysinfo/includes/lang/ar_utf8.php
File deleted
/web/acc/phpsysinfo/includes/lang/nl.php
File deleted
/web/acc/phpsysinfo/includes/lang/jp.php
File deleted
/web/acc/phpsysinfo/includes/lang/pl.php
File deleted
/web/acc/phpsysinfo/includes/lang/no.php
File deleted
/web/acc/phpsysinfo/includes/lang/hu.php
File deleted
/web/acc/phpsysinfo/includes/lang/lt.php
File deleted
/web/acc/phpsysinfo/includes/lang/ro.php
File deleted
/web/acc/phpsysinfo/includes/lang/lv.php
File deleted
/web/acc/phpsysinfo/includes/lang/pt.php
File deleted
/web/acc/phpsysinfo/includes/lang/ca.php
File deleted
/web/acc/phpsysinfo/includes/lang/pt-br.php
File deleted
/web/acc/phpsysinfo/includes/lang/tr.php
File deleted
/web/acc/phpsysinfo/includes/lang/ru.php
File deleted
/web/acc/phpsysinfo/includes/lang/tw.php
File deleted
/web/acc/phpsysinfo/includes/lang/id.php
File deleted
/web/acc/phpsysinfo/includes/lang/cn.php
File deleted
/web/acc/phpsysinfo/includes/lang/en.php
File deleted
/web/acc/phpsysinfo/includes/lang/cs.php
File deleted
/web/acc/phpsysinfo/includes/lang/pa_utf8.php
File deleted
/web/acc/phpsysinfo/includes/lang/ct.php
File deleted
/web/acc/phpsysinfo/includes/lang/es.php
File deleted
/web/acc/phpsysinfo/includes/lang/et.php
File deleted
/web/acc/phpsysinfo/includes/lang/gr.php
File deleted
/web/acc/phpsysinfo/includes/lang/ko.php
File deleted
/web/acc/phpsysinfo/includes/lang/eu.php
File deleted
/web/acc/phpsysinfo/includes/lang/is.php
File deleted
/web/acc/phpsysinfo/includes/lang/it.php
File deleted
/web/acc/phpsysinfo/includes/lang/sk.php
File deleted
/web/acc/phpsysinfo/includes/lang/da.php
File deleted
/web/acc/phpsysinfo/includes/lang/sr.php
File deleted
/web/acc/phpsysinfo/includes/lang/big5.php
File deleted
/web/acc/phpsysinfo/includes/lang/bg.php
File deleted
/web/acc/phpsysinfo/includes/lang/de.php
File deleted
/web/acc/phpsysinfo/includes/lang/sv.php
File deleted
/web/acc/phpsysinfo/includes/lang/ja.php
File deleted
/web/acc/phpsysinfo/includes/lang/he.php
File deleted
/web/acc/phpsysinfo/includes/lang/fi.php
File deleted
/web/acc/phpsysinfo/includes/system_footer.php
File deleted
/web/acc/phpsysinfo/includes/class.error.inc.php
File deleted
/web/acc/phpsysinfo/includes/class.Template.inc.php
File deleted
/web/acc/phpsysinfo/includes/common_functions.php
File deleted
/web/acc/phpsysinfo/includes/autoloader.inc.php
0,0 → 1,77
<?php
/**
* class autoloader
*
* PHP version 5
*
* @category PHP
* @package PSI
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: autoloader.inc.php 660 2012-08-27 11:08:40Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
 
error_reporting(E_ALL | E_STRICT);
 
/**
* automatic loading classes when using them
*
* @param string $class_name name of the class which must be loaded
*
* @return void
*/
function psi_autoload($class_name)
{
//$class_name = str_replace('-', '', $class_name);
 
/* case-insensitive folders */
$dirs = array('/plugins/'.strtolower($class_name).'/', '/includes/mb/', '/includes/ups/');
 
foreach ($dirs as $dir) {
if (file_exists(PSI_APP_ROOT.$dir.'class.'.strtolower($class_name).'.inc.php')) {
include_once PSI_APP_ROOT.$dir.'class.'.strtolower($class_name).'.inc.php';
 
return;
}
}
 
/* case-sensitive folders */
$dirs = array('/includes/', '/includes/interface/', '/includes/to/', '/includes/to/device/', '/includes/os/', '/includes/plugin/', '/includes/xml/', '/includes/web/', '/includes/error/', '/includes/js/', '/includes/output/');
 
foreach ($dirs as $dir) {
if (file_exists(PSI_APP_ROOT.$dir.'class.'.$class_name.'.inc.php')) {
include_once PSI_APP_ROOT.$dir.'class.'.$class_name.'.inc.php';
 
return;
}
}
 
$error = PSI_Error::singleton();
 
$error->addError("psi_autoload(\"".$class_name."\")", "autoloading of class file (class.".$class_name.".inc.php) failed!");
$error->errorsAsXML();
}
 
spl_autoload_register('psi_autoload');
 
/**
* sets a user-defined error handler function
*
* @param integer $level contains the level of the error raised, as an integer.
* @param string $message contains the error message, as a string.
* @param string $file which contains the filename that the error was raised in, as a string.
* @param integer $line which contains the line number the error was raised at, as an integer.
*
* @return void
*/
function errorHandlerPsi($level, $message, $file, $line)
{
$error = PSI_Error::singleton();
if (PSI_DEBUG || (($level !== 2) && ($level !== 8)) || !(preg_match("/^[^:]*: open_basedir /", $message) || preg_match("/^fopen\(/", $message) || preg_match("/^is_readable\(/", $message) || preg_match("/^file_exists\(/", $message) || preg_match("/^fgets\(/", $message))) { // disable open_basedir, fopen, is_readable, file_exists and fgets warnings and notices
$error->addPhpError("errorHandlerPsi : ", "Level : ".$level." Message : ".$message." File : ".$file." Line : ".$line);
}
}
 
set_error_handler('errorHandlerPsi');
/web/acc/phpsysinfo/includes/class.CommonFunctions.inc.php
0,0 → 1,756
<?php
/**
* common Functions class
*
* PHP version 5
*
* @category PHP
* @package PSI
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.CommonFunctions.inc.php 699 2012-09-15 11:57:13Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* class with common functions used in all places
*
* @category PHP
* @package PSI
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class CommonFunctions
{
/**
* holds codepage for chcp
*
* @var integer
*/
private static $_cp = null;
 
public static function setcp($cp)
{
CommonFunctions::$_cp = $cp;
}
 
private static function _parse_log_file($string)
{
if (defined('PSI_LOG') && is_string(PSI_LOG) && (strlen(PSI_LOG)>0) && ((substr(PSI_LOG, 0, 1)=="-") || (substr(PSI_LOG, 0, 1)=="+"))) {
$log_file = substr(PSI_LOG, 1);
if (file_exists($log_file)) {
$contents = @file_get_contents($log_file);
if ($contents && preg_match("/^\-\-\-[^-\r\n]+\-\-\- ".preg_quote($string, '/')."\r?\n/m", $contents, $matches, PREG_OFFSET_CAPTURE)) {
$findIndex = $matches[0][1];
if (preg_match("/\r?\n/m", $contents, $matches, PREG_OFFSET_CAPTURE, $findIndex)) {
$startIndex = $matches[0][1]+1;
if (preg_match("/^\-\-\-[^-\r\n]+\-\-\- /m", $contents, $matches, PREG_OFFSET_CAPTURE, $startIndex)) {
$stopIndex = $matches[0][1];
 
return substr($contents, $startIndex, $stopIndex-$startIndex);
} else {
return substr($contents, $startIndex);
}
}
}
}
}
 
return false;
}
 
/**
* Find a system program, do also path checking when not running on WINNT
* on WINNT we simply return the name with the exe extension to the program name
*
* @param string $strProgram name of the program
*
* @return string|null complete path and name of the program
*/
private static function _findProgram($strProgram)
{
$path_parts = pathinfo($strProgram);
if (empty($path_parts['basename'])) {
return null;
}
$arrPath = array();
 
if (empty($path_parts['dirname']) || ($path_parts['dirname'] == '.')) {
if ((PSI_OS == 'WINNT') && empty($path_parts['extension'])) {
$strProgram .= '.exe';
$path_parts = pathinfo($strProgram);
}
if (PSI_OS == 'WINNT') {
if (CommonFunctions::readenv('Path', $serverpath)) {
$arrPath = preg_split('/;/', $serverpath, -1, PREG_SPLIT_NO_EMPTY);
}
} else {
if (CommonFunctions::readenv('PATH', $serverpath)) {
$arrPath = preg_split('/:/', $serverpath, -1, PREG_SPLIT_NO_EMPTY);
}
}
if (defined('PSI_UNAMEO') && (PSI_UNAMEO === 'Android') && !empty($arrPath)) {
array_push($arrPath, '/system/bin'); // Termux patch
}
if (defined('PSI_ADD_PATHS') && is_string(PSI_ADD_PATHS)) {
if (preg_match(ARRAY_EXP, PSI_ADD_PATHS)) {
$arrPath = array_merge(eval(PSI_ADD_PATHS), $arrPath); // In this order so $addpaths is before $arrPath when looking for a program
} else {
$arrPath = array_merge(array(PSI_ADD_PATHS), $arrPath); // In this order so $addpaths is before $arrPath when looking for a program
}
}
} else { //directory defined
array_push($arrPath, $path_parts['dirname']);
$strProgram = $path_parts['basename'];
}
 
//add some default paths if we still have no paths here
if (empty($arrPath) && PSI_OS != 'WINNT') {
if (PSI_OS == 'Android') {
array_push($arrPath, '/system/bin');
} else {
array_push($arrPath, '/bin', '/sbin', '/usr/bin', '/usr/sbin', '/usr/local/bin', '/usr/local/sbin');
}
}
 
$exceptPath = "";
if ((PSI_OS == 'WINNT') && CommonFunctions::readenv('WinDir', $windir)) {
foreach ($arrPath as $strPath) {
if ((strtolower($strPath) == $windir."\\system32") && is_dir($windir."\\SysWOW64")) {
if (is_dir($windir."\\sysnative")) {
$exceptPath = $windir."\\sysnative"; //32-bit PHP on 64-bit Windows
} else {
$exceptPath = $windir."\\SysWOW64"; //64-bit PHP on 64-bit Windows
}
array_push($arrPath, $exceptPath);
break;
}
}
} elseif (PSI_OS == 'Android') {
$exceptPath = '/system/bin';
}
 
foreach ($arrPath as $strPath) {
// Path with and without trailing slash
if (PSI_OS == 'WINNT') {
$strPath = rtrim($strPath, "\\");
$strPathS = $strPath."\\";
} else {
$strPath = rtrim($strPath, "/");
$strPathS = $strPath."/";
}
if (($strPath !== $exceptPath) && !is_dir($strPath)) {
continue;
}
if (PSI_OS == 'WINNT') {
$strProgrammpath = $strPathS.$strProgram;
} else {
$strProgrammpath = $strPathS.$strProgram;
}
if (is_executable($strProgrammpath)) {
return $strProgrammpath;
}
}
 
return null;
}
 
/**
* Execute a system program. return a trim()'d result.
* does very crude pipe checking. you need ' | ' for it to work
* ie $program = CommonFunctions::executeProgram('netstat', '-anp | grep LIST');
* NOT $program = CommonFunctions::executeProgram('netstat', '-anp|grep LIST');
*
* @param string $strProgramname name of the program
* @param string $strArgs arguments to the program
* @param string &$strBuffer output of the command
* @param boolean $booErrorRep en- or disables the reporting of errors which should be logged
* @param integer $timeout timeout value in seconds (default value is PSI_EXEC_TIMEOUT_INT)
*
* @return boolean command successfull or not
*/
public static function executeProgram($strProgramname, $strArgs, &$strBuffer, $booErrorRep = true, $timeout = PSI_EXEC_TIMEOUT_INT)
{
if (defined('PSI_LOG') && is_string(PSI_LOG) && (strlen(PSI_LOG)>0) && ((substr(PSI_LOG, 0, 1)=="-") || (substr(PSI_LOG, 0, 1)=="+"))) {
$out = self::_parse_log_file("Executing: ".trim($strProgramname.' '.$strArgs));
if ($out == false) {
if (substr(PSI_LOG, 0, 1)=="-") {
$strBuffer = '';
 
return false;
}
} else {
$strBuffer = $out;
 
return true;
}
}
 
if ((PSI_OS !== 'WINNT') && preg_match('/^([^=]+=[^ \t]+)[ \t]+(.*)$/', $strProgramname, $strmatch)) {
$strSet = $strmatch[1].' ';
$strProgramname = $strmatch[2];
} else {
$strSet = '';
}
$strProgram = self::_findProgram($strProgramname);
$error = PSI_Error::singleton();
if (!$strProgram) {
if ($booErrorRep) {
$error->addError('find_program("'.$strProgramname.'")', 'program not found on the machine');
}
 
return false;
} else {
if (preg_match('/\s/', $strProgram)) {
$strProgram = '"'.$strProgram.'"';
}
}
 
if ((PSI_OS !== 'WINNT') && defined('PSI_SUDO_COMMANDS') && is_string(PSI_SUDO_COMMANDS)) {
if (preg_match(ARRAY_EXP, PSI_SUDO_COMMANDS)) {
$sudocommands = eval(PSI_SUDO_COMMANDS);
} else {
$sudocommands = array(PSI_SUDO_COMMANDS);
}
if (in_array($strProgramname, $sudocommands)) {
$sudoProgram = self::_findProgram("sudo");
if (!$sudoProgram) {
if ($booErrorRep) {
$error->addError('find_program("sudo")', 'program not found on the machine');
}
 
return false;
} else {
if (preg_match('/\s/', $sudoProgram)) {
$strProgram = '"'.$sudoProgram.'" '.$strProgram;
} else {
$strProgram = $sudoProgram.' '.$strProgram;
}
}
}
}
 
// see if we've gotten a |, if we have we need to do path checking on the cmd
if ($strArgs) {
$arrArgs = preg_split('/ /', $strArgs, -1, PREG_SPLIT_NO_EMPTY);
for ($i = 0, $cnt_args = count($arrArgs); $i < $cnt_args; $i++) {
if ($arrArgs[$i] == '|') {
$strCmd = $arrArgs[$i + 1];
$strNewcmd = self::_findProgram($strCmd);
$strArgs = preg_replace("/\| ".$strCmd.'/', '| "'.$strNewcmd.'"', $strArgs);
}
}
$strArgs = ' '.$strArgs;
}
 
$strBuffer = '';
$strError = '';
$pipes = array();
$descriptorspec = array(0=>array("pipe", "r"), 1=>array("pipe", "w"), 2=>array("pipe", "w"));
if (defined("PSI_MODE_POPEN") && PSI_MODE_POPEN === true) {
if (PSI_OS == 'WINNT') {
$process = $pipes[1] = popen($strSet.$strProgram.$strArgs." 2>nul", "r");
} else {
$process = $pipes[1] = popen($strSet.$strProgram.$strArgs." 2>/dev/null", "r");
}
} else {
$process = proc_open($strSet.$strProgram.$strArgs, $descriptorspec, $pipes);
}
if (is_resource($process)) {
$te = self::_timeoutfgets($pipes, $strBuffer, $strError, $timeout);
if (defined("PSI_MODE_POPEN") && PSI_MODE_POPEN === true) {
$return_value = pclose($pipes[1]);
} else {
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
// It is important that you close any pipes before calling
// proc_close in order to avoid a deadlock
if ($te) {
proc_terminate($process); // proc_close tends to hang if the process is timing out
$return_value = 0;
} else {
$return_value = proc_close($process);
}
}
} else {
if ($booErrorRep) {
$error->addError($strProgram, "\nOpen process error");
}
 
return false;
}
$strError = trim($strError);
$strBuffer = trim($strBuffer);
if (defined('PSI_LOG') && is_string(PSI_LOG) && (strlen(PSI_LOG)>0) && (substr(PSI_LOG, 0, 1)!="-") && (substr(PSI_LOG, 0, 1)!="+")) {
error_log("---".gmdate('r T')."--- Executing: ".trim($strProgramname.$strArgs)."\n".$strBuffer."\n", 3, PSI_LOG);
}
if (! empty($strError)) {
if ($booErrorRep) {
$error->addError($strProgram, $strError."\nReturn value: ".$return_value);
}
 
return $return_value == 0;
}
 
return true;
}
 
/**
* read a one-line value from a file with a similar name
*
* @return value if successfull or null if not
*/
public static function rolv($similarFileName, $match = "//", $replace = "")
{
$filename = preg_replace($match, $replace, $similarFileName);
if (CommonFunctions::fileexists($filename) && CommonFunctions::rfts($filename, $buf, 1, 4096, false) && (($buf=trim($buf)) != "")) {
return $buf;
} else {
return null;
}
}
 
/**
* read data from array $_SERVER
*
* @param string $strElem element of array
* @param string &$strBuffer output of the command
*
* @return string
*/
public static function readenv($strElem, &$strBuffer)
{
$strBuffer = '';
if (PSI_OS == 'WINNT') { //case insensitive
if (isset($_SERVER)) {
foreach ($_SERVER as $index=>$value) {
if (is_string($value) && (trim($value) !== '') && (strtolower($index) === strtolower($strElem))) {
$strBuffer = $value;
 
return true;
}
}
}
} else {
if (isset($_SERVER[$strElem]) && is_string($value = $_SERVER[$strElem]) && (trim($value) !== '')) {
$strBuffer = $value;
 
return true;
}
}
 
return false;
}
 
/**
* read a file and return the content as a string
*
* @param string $strFileName name of the file which should be read
* @param string &$strRet content of the file (reference)
* @param integer $intLines control how many lines should be read
* @param integer $intBytes control how many bytes of each line should be read
* @param boolean $booErrorRep en- or disables the reporting of errors which should be logged
*
* @return boolean command successfull or not
*/
public static function rfts($strFileName, &$strRet, $intLines = 0, $intBytes = 4096, $booErrorRep = true)
{
if (defined('PSI_LOG') && is_string(PSI_LOG) && (strlen(PSI_LOG)>0) && ((substr(PSI_LOG, 0, 1)=="-") || (substr(PSI_LOG, 0, 1)=="+"))) {
$out = self::_parse_log_file("Reading: ".$strFileName);
if ($out == false) {
if (substr(PSI_LOG, 0, 1)=="-") {
$strRet = '';
 
return false;
}
} else {
$strRet = $out;
 
return true;
}
}
 
$strFile = "";
$intCurLine = 1;
$error = PSI_Error::singleton();
if (file_exists($strFileName)) {
if (is_readable($strFileName)) {
if ($fd = fopen($strFileName, 'r')) {
while (!feof($fd)) {
$strFile .= fgets($fd, $intBytes);
if ($intLines <= $intCurLine && $intLines != 0) {
break;
} else {
$intCurLine++;
}
}
fclose($fd);
$strRet = $strFile;
if (defined('PSI_LOG') && is_string(PSI_LOG) && (strlen(PSI_LOG)>0) && (substr(PSI_LOG, 0, 1)!="-") && (substr(PSI_LOG, 0, 1)!="+")) {
if ((strlen($strRet)>0)&&(substr($strRet, -1)!="\n")) {
error_log("---".gmdate('r T')."--- Reading: ".$strFileName."\n".$strRet."\n", 3, PSI_LOG);
} else {
error_log("---".gmdate('r T')."--- Reading: ".$strFileName."\n".$strRet, 3, PSI_LOG);
}
}
} else {
if ($booErrorRep) {
$error->addError('fopen('.$strFileName.')', 'file can not read by phpsysinfo');
}
 
return false;
}
} else {
if ($booErrorRep) {
$error->addError('fopen('.$strFileName.')', 'file permission error');
}
 
return false;
}
} else {
if ($booErrorRep) {
$error->addError('file_exists('.$strFileName.')', 'the file does not exist on your machine');
}
 
return false;
}
 
return true;
}
 
/**
* file exists
*
* @param string $strFileName name of the file which should be check
*
* @return boolean command successfull or not
*/
public static function fileexists($strFileName)
{
if (defined('PSI_LOG') && is_string(PSI_LOG) && (strlen(PSI_LOG)>0) && ((substr(PSI_LOG, 0, 1)=="-") || (substr(PSI_LOG, 0, 1)=="+"))) {
$log_file = substr(PSI_LOG, 1);
if (file_exists($log_file)
&& ($contents = @file_get_contents($log_file))
&& preg_match("/^\-\-\-[^-\n]+\-\-\- ".preg_quote("Reading: ".$strFileName, '/')."\n/m", $contents)) {
return true;
} else {
if (substr(PSI_LOG, 0, 1)=="-") {
return false;
}
}
}
 
$exists = file_exists($strFileName);
if (defined('PSI_LOG') && is_string(PSI_LOG) && (strlen(PSI_LOG)>0) && (substr(PSI_LOG, 0, 1)!="-") && (substr(PSI_LOG, 0, 1)!="+")) {
if ((substr($strFileName, 0, 5) === "/dev/") && $exists) {
error_log("---".gmdate('r T')."--- Reading: ".$strFileName."\ndevice exists\n", 3, PSI_LOG);
}
}
 
return $exists;
}
 
/**
* reads a directory and return the name of the files and directorys in it
*
* @param string $strPath path of the directory which should be read
* @param boolean $booErrorRep en- or disables the reporting of errors which should be logged
*
* @return array content of the directory excluding . and ..
*/
public static function gdc($strPath, $booErrorRep = true)
{
$arrDirectoryContent = array();
$error = PSI_Error::singleton();
if (is_dir($strPath)) {
if ($handle = opendir($strPath)) {
while (($strFile = readdir($handle)) !== false) {
if ($strFile != "." && $strFile != "..") {
$arrDirectoryContent[] = $strFile;
}
}
closedir($handle);
} else {
if ($booErrorRep) {
$error->addError('opendir('.$strPath.')', 'directory can not be read by phpsysinfo');
}
}
} else {
if ($booErrorRep) {
$error->addError('is_dir('.$strPath.')', 'directory does not exist on your machine');
}
}
 
return $arrDirectoryContent;
}
 
/**
* Check for needed php extensions
*
* We need that extensions for almost everything
* This function will return a hard coded
* XML string (with headers) if the SimpleXML extension isn't loaded.
* Then it will terminate the script.
* See bug #1787137
*
* @param array $arrExt additional extensions for which a check should run
*
* @return void
*/
public static function checkForExtensions($arrExt = array())
{
if ((strcasecmp(PSI_SYSTEM_CODEPAGE, "UTF-8") == 0) || (strcasecmp(PSI_SYSTEM_CODEPAGE, "CP437") == 0))
$arrReq = array('simplexml', 'pcre', 'xml', 'dom');
elseif (PSI_OS == "WINNT")
$arrReq = array('simplexml', 'pcre', 'xml', 'dom', 'mbstring', 'com_dotnet');
else
$arrReq = array('simplexml', 'pcre', 'xml', 'dom', 'mbstring');
$extensions = array_merge($arrExt, $arrReq);
$text = "";
$error = false;
$text .= "<?xml version='1.0'?>\n";
$text .= "<phpsysinfo>\n";
$text .= " <Error>\n";
foreach ($extensions as $extension) {
if (!extension_loaded($extension)) {
$text .= " <Function>checkForExtensions</Function>\n";
$text .= " <Message>phpSysInfo requires the ".$extension." extension to php in order to work properly.</Message>\n";
$error = true;
}
}
$text .= " </Error>\n";
$text .= "</phpsysinfo>";
if ($error) {
header("Content-Type: text/xml\n\n");
echo $text;
die();
}
}
 
/**
* get the content of stdout/stderr with the option to set a timeout for reading
*
* @param array $pipes array of file pointers for stdin, stdout, stderr (proc_open())
* @param string &$out target string for the output message (reference)
* @param string &$err target string for the error message (reference)
* @param integer $timeout timeout value in seconds
*
* @return boolean timeout expired or not
*/
private static function _timeoutfgets($pipes, &$out, &$err, $timeout)
{
$w = null;
$e = null;
$te = false;
 
if (defined("PSI_MODE_POPEN") && PSI_MODE_POPEN === true) {
$pipe2 = false;
} else {
$pipe2 = true;
}
while (!(feof($pipes[1]) && (!$pipe2 || feof($pipes[2])))) {
if ($pipe2) {
$read = array($pipes[1], $pipes[2]);
} else {
$read = array($pipes[1]);
}
 
$n = stream_select($read, $w, $e, $timeout);
 
if ($n === false) {
error_log('stream_select: failed !');
break;
} elseif ($n === 0) {
error_log('stream_select: timeout expired !');
$te = true;
break;
}
 
foreach ($read as $r) {
if ($r == $pipes[1]) {
$out .= fread($r, 4096);
} elseif (feof($pipes[1]) && $pipe2 && ($r == $pipes[2])) {//read STDERR after STDOUT
$err .= fread($r, 4096);
}
}
}
 
return $te;
}
 
/**
* function for getting a list of values in the specified context
* optionally filter this list, based on the list from third parameter
*
* @param $wmi object holds the COM object that we pull the WMI data from
* @param string $strClass name of the class where the values are stored
* @param array $strValue filter out only needed values, if not set all values of the class are returned
*
* @return array content of the class stored in an array
*/
public static function getWMI($wmi, $strClass, $strValue = array())
{
$arrData = array();
if (gettype($wmi) === "object") {
$value = "";
try {
$objWEBM = $wmi->Get($strClass);
$arrProp = $objWEBM->Properties_;
$arrWEBMCol = $objWEBM->Instances_();
foreach ($arrWEBMCol as $objItem) {
if (is_array($arrProp)) {
reset($arrProp);
}
$arrInstance = array();
foreach ($arrProp as $propItem) {
$value = $objItem->{$propItem->Name}; //instead exploitable eval("\$value = \$objItem->".$propItem->Name.";");
if (empty($strValue)) {
if (is_string($value)) $arrInstance[$propItem->Name] = trim($value);
else $arrInstance[$propItem->Name] = $value;
} else {
if (in_array($propItem->Name, $strValue)) {
if (is_string($value)) $arrInstance[$propItem->Name] = trim($value);
else $arrInstance[$propItem->Name] = $value;
}
}
}
$arrData[] = $arrInstance;
}
} catch (Exception $e) {
if (PSI_DEBUG) {
$error = PSI_Error::singleton();
$error->addError("getWMI()", preg_replace('/<br\/>/', "\n", preg_replace('/<b>|<\/b>/', '', $e->getMessage())));
}
}
}
 
return $arrData;
}
 
/**
* get all configured plugins from phpsysinfo.ini (file must be included and processed before calling this function)
*
* @return array
*/
public static function getPlugins()
{
if (defined('PSI_PLUGINS') && is_string(PSI_PLUGINS)) {
if (preg_match(ARRAY_EXP, PSI_PLUGINS)) {
return eval(strtolower(PSI_PLUGINS));
} else {
return array(strtolower(PSI_PLUGINS));
}
} else {
return array();
}
}
 
/**
* name natural compare function
*
* @return comprasion result
*/
public static function name_natural_compare($a, $b)
{
return strnatcmp($a->getName(), $b->getName());
}
 
/**
* readReg function
*
* @return boolean command successfull or not
*/
public static function readReg($reg, $strName, &$strBuffer, $booErrorRep = true)
{
$strBuffer = '';
if ($reg === false) {
$last = strrpos($strName, "\\");
$keyname = substr($strName, $last + 1);
if (CommonFunctions::$_cp) {
if (CommonFunctions::executeProgram('cmd', '/c chcp '.CommonFunctions::$_cp.' && reg query "'.substr($strName, 0, $last).'" /v '.$keyname.' 2>&1', $strBuf, $booErrorRep) && (strlen($strBuf) > 0) && preg_match("/^\s*".$keyname."\s+REG_\S+\s+(.+)\s*$/mi", $strBuf, $buffer2)) {
$strBuffer = $buffer2[1];
} else {
return false;
}
} else {
if (CommonFunctions::executeProgram('reg', 'query "'.substr($strName, 0, $last).'" /v '.$keyname.' 2>&1', $strBuf, $booErrorRep) && (strlen($strBuf) > 0) && preg_match("/^\s*".$keyname."\s+REG_\S+\s+(.+)\s*$/mi", $strBuf, $buffer2)) {
$strBuffer = $buffer2[1];
} else {
return false;
}
}
} elseif (gettype($reg) === "object") {
try {
$strBuffer = $reg->RegRead($strName);
} catch (Exception $e) {
if ($booErrorRep) {
$error = PSI_Error::singleton();
$error->addError("readReg()", preg_replace('/<br\/>/', "\n", preg_replace('/<b>|<\/b>/', '', $e->getMessage())));
}
 
return false;
}
}
 
return true;
}
 
 
/**
* enumKey function
*
* @return boolean command successfull or not
*/
public static function enumKey($key, $strName, &$arrBuffer, $booErrorRep = true)
{
$_hkey = array('HKEY_CLASSES_ROOT'=>0x80000000, 'HKEY_CURRENT_USER'=>0x80000001, 'HKEY_LOCAL_MACHINE'=>0x80000002, 'HKEY_USERS'=>0x80000003, 'HKEY_PERFORMANCE_DATA'=>0x80000004, 'HKEY_PERFORMANCE_TEXT'=>0x80000050, 'HKEY_PERFORMANCE_NLSTEXT'=>0x80000060, 'HKEY_CURRENT_CONFIG'=>0x80000005, 'HKEY_DYN_DATA'=>0x80000006);
 
$arrBuffer = array();
if ($key === false) {
if (CommonFunctions::$_cp) {
if (CommonFunctions::executeProgram('cmd', '/c chcp '.CommonFunctions::$_cp.' && reg query "'.$strName.'" 2>&1', $strBuf, $booErrorRep) && (strlen($strBuf) > 0) && preg_match_all("/^".preg_replace("/\\\\/", "\\\\\\\\", $strName)."\\\\(.*)/mi", $strBuf, $buffer2)) {
foreach ($buffer2[1] as $sub_key) {
$arrBuffer[] = trim($sub_key);
}
} else {
return false;
}
} else {
if (CommonFunctions::executeProgram('reg', 'query "'.$strName.'" 2>&1', $strBuf, $booErrorRep) && (strlen($strBuf) > 0) && preg_match_all("/^".preg_replace("/\\\\/", "\\\\\\\\", $strName)."\\\\(.*)/mi", $strBuf, $buffer2)) {
foreach ($buffer2[1] as $sub_key) {
$arrBuffer[] = trim($sub_key);
}
} else {
return false;
}
}
} elseif (gettype($key) === "object") {
$first = strpos($strName, "\\");
$hkey = substr($strName, 0, $first);
if (isset($_hkey[$hkey])) {
$sub_keys = new VARIANT();
try {
$key->EnumKey(strval($_hkey[$hkey]), substr($strName, $first+1), $sub_keys);
} catch (Exception $e) {
if ($booErrorRep) {
$error = PSI_Error::singleton();
$error->addError("enumKey()", preg_replace('/<br\/>/', "\n", preg_replace('/<b>|<\/b>/', '', $e->getMessage())));;
}
 
return false;
}
foreach ($sub_keys as $sub_key) {
$arrBuffer[] = $sub_key;
}
} else {
return false;
}
}
 
return true;
}
}
/web/acc/phpsysinfo/includes/class.Parser.inc.php
0,0 → 1,275
<?php
/**
* parser Class
*
* PHP version 5
*
* @category PHP
* @package PSI
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.Parser.inc.php 604 2012-07-10 07:31:34Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* parser class with common used parsing metods
*
* @category PHP
* @package PSI
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class Parser
{
/**
* parsing the output of lspci command
*
* @param bool $debug
* @return array
*/
public static function lspci($debug = PSI_DEBUG)
{
$arrResults = array();
if (CommonFunctions::executeProgram("lspci", "", $strBuf, $debug)) {
$arrLines = preg_split("/\n/", $strBuf, -1, PREG_SPLIT_NO_EMPTY);
foreach ($arrLines as $strLine) {
$arrParams = preg_split('/ /', trim($strLine), 2);
if (count($arrParams) == 2)
$strName = $arrParams[1];
else
$strName = "unknown";
$strName = preg_replace('/\(.*\)/', '', $strName);
$dev = new HWDevice();
$dev->setName($strName);
$arrResults[] = $dev;
}
}
 
return $arrResults;
}
 
/**
* parsing the output of df command
*
* @param string $df_param additional parameter for df command
* @param bool $get_inodes
*
* @return array
*/
public static function df($df_param = "", $get_inodes = true)
{
$arrResult = array();
if (CommonFunctions::executeProgram('mount', '', $mount, PSI_DEBUG)) {
$mount = preg_split("/\n/", $mount, -1, PREG_SPLIT_NO_EMPTY);
foreach ($mount as $mount_line) {
if (preg_match("/(\S+) on ([\S ]+) type (.*) \((.*)\)/", $mount_line, $mount_buf)) {
$parm = array();
$parm['mountpoint'] = trim($mount_buf[2]);
$parm['fstype'] = $mount_buf[3];
$parm['name'] = $mount_buf[1];
if (PSI_SHOW_MOUNT_OPTION) $parm['options'] = $mount_buf[4];
$mount_parm[] = $parm;
} elseif (preg_match("/(\S+) is (.*) mounted on (\S+) \(type (.*)\)/", $mount_line, $mount_buf)) {
$parm = array();
$parm['mountpoint'] = trim($mount_buf[3]);
$parm['fstype'] = $mount_buf[4];
$parm['name'] = $mount_buf[1];
if (PSI_SHOW_MOUNT_OPTION) $parm['options'] = $mount_buf[2];
$mount_parm[] = $parm;
} elseif (preg_match("/(\S+) (.*) on (\S+) \((.*)\)/", $mount_line, $mount_buf)) {
$parm = array();
$parm['mountpoint'] = trim($mount_buf[3]);
$parm['fstype'] = $mount_buf[2];
$parm['name'] = $mount_buf[1];
if (PSI_SHOW_MOUNT_OPTION) $parm['options'] = $mount_buf[4];
$mount_parm[] = $parm;
} elseif (preg_match("/(\S+) on ([\S ]+) \((\S+)(,\s(.*))?\)/", $mount_line, $mount_buf)) {
$parm = array();
$parm['mountpoint'] = trim($mount_buf[2]);
$parm['fstype'] = $mount_buf[3];
$parm['name'] = $mount_buf[1];
if (PSI_SHOW_MOUNT_OPTION) $parm['options'] = isset($mount_buf[5]) ? $mount_buf[5] : '';
$mount_parm[] = $parm;
}
}
} elseif (CommonFunctions::rfts("/etc/mtab", $mount)) {
$mount = preg_split("/\n/", $mount, -1, PREG_SPLIT_NO_EMPTY);
foreach ($mount as $mount_line) {
if (preg_match("/(\S+) (\S+) (\S+) (\S+) ([0-9]+) ([0-9]+)/", $mount_line, $mount_buf)) {
$parm = array();
$mount_point = preg_replace("/\\\\040/i", ' ', $mount_buf[2]); //space as \040
$parm['mountpoint'] = $mount_point;
$parm['fstype'] = $mount_buf[3];
$parm['name'] = $mount_buf[1];
if (PSI_SHOW_MOUNT_OPTION) $parm['options'] = $mount_buf[4];
$mount_parm[] = $parm;
}
}
}
if (CommonFunctions::executeProgram('df', '-k '.$df_param, $df, PSI_DEBUG) && ($df!=="")) {
$df = preg_split("/\n/", $df, -1, PREG_SPLIT_NO_EMPTY);
if ($get_inodes && PSI_SHOW_INODES) {
if (CommonFunctions::executeProgram('df', '-i '.$df_param, $df2, PSI_DEBUG)) {
$df2 = preg_split("/\n/", $df2, -1, PREG_SPLIT_NO_EMPTY);
// Store inode use% in an associative array (df_inodes) for later use
foreach ($df2 as $df2_line) {
if (preg_match("/^(\S+).*\s([0-9]+)%/", $df2_line, $inode_buf)) {
$df_inodes[$inode_buf[1]] = $inode_buf[2];
}
}
}
}
foreach ($df as $df_line) {
$df_buf1 = preg_split("/(\%\s)/", $df_line, 3);
if (count($df_buf1) < 2) {
continue;
}
if (preg_match("/(.*)(\s+)(([0-9]+)(\s+)([0-9]+)(\s+)([\-0-9]+)(\s+)([0-9]+)$)/", $df_buf1[0], $df_buf2)) {
if (count($df_buf1) == 3) {
$df_buf = array($df_buf2[1], $df_buf2[4], $df_buf2[6], $df_buf2[8], $df_buf2[10], $df_buf1[2]);
} else {
$df_buf = array($df_buf2[1], $df_buf2[4], $df_buf2[6], $df_buf2[8], $df_buf2[10], $df_buf1[1]);
}
if (count($df_buf) == 6) {
$df_buf[5] = trim($df_buf[5]);
$dev = new DiskDevice();
$dev->setName(trim($df_buf[0]));
if ($df_buf[2] < 0) {
$dev->setTotal($df_buf[3] * 1024);
$dev->setUsed($df_buf[3] * 1024);
} else {
$dev->setTotal($df_buf[1] * 1024);
$dev->setUsed($df_buf[2] * 1024);
if ($df_buf[3]>0) {
$dev->setFree($df_buf[3] * 1024);
}
}
if (PSI_SHOW_MOUNT_POINT) $dev->setMountPoint($df_buf[5]);
 
$notwas = true;
if (isset($mount_parm)) {
foreach ($mount_parm as $mount_param) { //name and mountpoint find
if (($mount_param['name']===trim($df_buf[0])) && ($mount_param['mountpoint']===$df_buf[5])) {
$dev->setFsType($mount_param['fstype']);
if (PSI_SHOW_MOUNT_OPTION && (trim($mount_param['options'])!=="")) {
if (PSI_SHOW_MOUNT_CREDENTIALS) {
$dev->setOptions($mount_param['options']);
} else {
$mpo=$mount_param['options'];
 
$mpo=preg_replace('/(^guest,)|(^guest$)|(,guest$)/i', '', $mpo);
$mpo=preg_replace('/,guest,/i', ',', $mpo);
 
$mpo=preg_replace('/(^user=[^,]*,)|(^user=[^,]*$)|(,user=[^,]*$)/i', '', $mpo);
$mpo=preg_replace('/,user=[^,]*,/i', ',', $mpo);
 
$mpo=preg_replace('/(^username=[^,]*,)|(^username=[^,]*$)|(,username=[^,]*$)/i', '', $mpo);
$mpo=preg_replace('/,username=[^,]*,/i', ',', $mpo);
 
$mpo=preg_replace('/(^password=[^,]*,)|(^password=[^,]*$)|(,password=[^,]*$)/i', '', $mpo);
$mpo=preg_replace('/,password=[^,]*,/i', ',', $mpo);
 
$dev->setOptions($mpo);
}
}
$notwas = false;
break;
}
}
if ($notwas) foreach ($mount_parm as $mount_param) { //mountpoint find
if ($mount_param['mountpoint']===$df_buf[5]) {
$dev->setFsType($mount_param['fstype']);
if (PSI_SHOW_MOUNT_OPTION && (trim($mount_param['options'])!=="")) {
if (PSI_SHOW_MOUNT_CREDENTIALS) {
$dev->setOptions($mount_param['options']);
} else {
$mpo=$mount_param['options'];
 
$mpo=preg_replace('/(^guest,)|(^guest$)|(,guest$)/i', '', $mpo);
$mpo=preg_replace('/,guest,/i', ',', $mpo);
 
$mpo=preg_replace('/(^user=[^,]*,)|(^user=[^,]*$)|(,user=[^,]*$)/i', '', $mpo);
$mpo=preg_replace('/,user=[^,]*,/i', ',', $mpo);
 
$mpo=preg_replace('/(^username=[^,]*,)|(^username=[^,]*$)|(,username=[^,]*$)/i', '', $mpo);
$mpo=preg_replace('/,username=[^,]*,/i', ',', $mpo);
 
$mpo=preg_replace('/(^password=[^,]*,)|(^password=[^,]*$)|(,password=[^,]*$)/i', '', $mpo);
$mpo=preg_replace('/,password=[^,]*,/i', ',', $mpo);
 
$dev->setOptions($mpo);
}
}
$notwas = false;
break;
}
}
}
 
if ($notwas) {
$dev->setFsType('unknown');
}
 
if ($get_inodes && PSI_SHOW_INODES && isset($df_inodes[trim($df_buf[0])])) {
$dev->setPercentInodesUsed($df_inodes[trim($df_buf[0])]);
}
$arrResult[] = $dev;
}
}
}
} else {
if (isset($mount_parm)) {
foreach ($mount_parm as $mount_param) {
if (is_dir($mount_param['mountpoint'])) {
$total = disk_total_space($mount_param['mountpoint']);
if (($mount_param['fstype'] != 'none') && ($total > 0)) {
$dev = new DiskDevice();
$dev->setName($mount_param['name']);
$dev->setFsType($mount_param['fstype']);
 
if (PSI_SHOW_MOUNT_POINT) $dev->setMountPoint($mount_param['mountpoint']);
 
$dev->setTotal($total);
$free = disk_free_space($mount_param['mountpoint']);
if ($free > 0) {
$dev->setFree($free);
} else {
$free = 0;
}
if ($total > $free) $dev->setUsed($total - $free);
 
if (PSI_SHOW_MOUNT_OPTION) {
if (PSI_SHOW_MOUNT_CREDENTIALS) {
$dev->setOptions($mount_param['options']);
} else {
$mpo=$mount_param['options'];
 
$mpo=preg_replace('/(^guest,)|(^guest$)|(,guest$)/i', '', $mpo);
$mpo=preg_replace('/,guest,/i', ',', $mpo);
 
$mpo=preg_replace('/(^user=[^,]*,)|(^user=[^,]*$)|(,user=[^,]*$)/i', '', $mpo);
$mpo=preg_replace('/,user=[^,]*,/i', ',', $mpo);
 
$mpo=preg_replace('/(^username=[^,]*,)|(^username=[^,]*$)|(,username=[^,]*$)/i', '', $mpo);
$mpo=preg_replace('/,username=[^,]*,/i', ',', $mpo);
 
$mpo=preg_replace('/(^password=[^,]*,)|(^password=[^,]*$)|(,password=[^,]*$)/i', '', $mpo);
$mpo=preg_replace('/,password=[^,]*,/i', ',', $mpo);
 
$dev->setOptions($mpo);
}
}
$arrResult[] = $dev;
}
}
}
}
}
 
return $arrResult;
}
}
/web/acc/phpsysinfo/includes/mb/class.coretemp.inc.php
0,0 → 1,54
<?php
/**
* coretemp sensor class, getting hardware temperature information through sysctl on FreeBSD
* or from /sys/devices/platform/coretemp. on Linux
*
* PHP version 5
*
* @category PHP
* @package PSI_Sensor
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @author William Johansson <radar@radhuset.org>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class Coretemp extends Hwmon
{
/**
* get the information
*
* @see PSI_Interface_Sensor::build()
*
* @return Void
*/
public function build()
{
if (PSI_OS == 'Linux') {
$hwpaths = glob("/sys/devices/platform/coretemp.*/", GLOB_NOSORT);
if (is_array($hwpaths) && (count($hwpaths) > 0)) {
$hwpaths = array_merge($hwpaths, glob("/sys/devices/platform/coretemp.*/hwmon/hwmon*/", GLOB_NOSORT));
}
if (is_array($hwpaths) && (($totalh = count($hwpaths)) > 0)) {
for ($h = 0; $h < $totalh; $h++) {
$this->_temperature($hwpaths[$h]);
}
}
} else {
$smp = 1;
CommonFunctions::executeProgram('sysctl', '-n kern.smp.cpus', $smp);
for ($i = 0; $i < $smp; $i++) {
$temp = 0;
if (CommonFunctions::executeProgram('sysctl', '-n dev.cpu.'.$i.'.temperature', $temp)) {
$temp = preg_replace('/,/', '.', preg_replace('/C/', '', $temp));
$dev = new SensorDevice();
$dev->setName("CPU ".($i + 1));
$dev->setValue($temp);
// $dev->setMax(70);
$this->mbinfo->setMbTemp($dev);
}
}
}
}
}
/web/acc/phpsysinfo/includes/mb/class.freeipmi.inc.php
0,0 → 1,187
<?php
/**
* freeipmi sensor class, getting information from ipmi-sensors
*
* PHP version 5
*
* @category PHP
* @package PSI_Sensor
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
* @copyright 2014 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class FreeIPMI extends Sensors
{
/**
* content to parse
*
* @var array
*/
private $_lines = array();
 
/**
* fill the private content var through command or data access
*/
public function __construct()
{
parent::__construct();
switch (defined('PSI_SENSOR_FREEIPMI_ACCESS')?strtolower(PSI_SENSOR_FREEIPMI_ACCESS):'command') {
case 'command':
CommonFunctions::executeProgram('ipmi-sensors', '--output-sensor-thresholds', $lines);
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
break;
case 'data':
if (CommonFunctions::rfts(PSI_APP_ROOT.'/data/freeipmi.txt', $lines)) {
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
}
break;
default:
$this->error->addConfigError('__construct()', '[sensor_freeipmi] ACCESS');
break;
}
}
 
/**
* get temperature information
*
* @return void
*/
private function _temperature()
{
foreach ($this->_lines as $line) {
$buffer = preg_split("/\s*\|\s*/", $line);
if ($buffer[2] == "Temperature" && $buffer[11] != "N/A" && $buffer[4] == "C") {
$dev = new SensorDevice();
$dev->setName($buffer[1]);
$dev->setValue($buffer[3]);
if ($buffer[9] != "N/A") $dev->setMax($buffer[9]);
if ($buffer[11] != "'OK'") $dev->setEvent(trim($buffer[11], "'"));
$this->mbinfo->setMbTemp($dev);
}
}
}
 
/**
* get voltage information
*
* @return void
*/
private function _voltage()
{
foreach ($this->_lines as $line) {
$buffer = preg_split("/\s*\|\s*/", $line);
if ($buffer[2] == "Voltage" && $buffer[11] != "N/A" && $buffer[4] == "V") {
$dev = new SensorDevice();
$dev->setName($buffer[1]);
$dev->setValue($buffer[3]);
if ($buffer[6] != "N/A") $dev->setMin($buffer[6]);
if ($buffer[9] != "N/A") $dev->setMax($buffer[9]);
if ($buffer[11] != "'OK'") $dev->setEvent(trim($buffer[11], "'"));
$this->mbinfo->setMbVolt($dev);
}
}
}
 
/**
* get fan information
*
* @return void
*/
private function _fans()
{
foreach ($this->_lines as $line) {
$buffer = preg_split("/\s*\|\s*/", $line);
if ($buffer[2] == "Fan" && $buffer[11] != "N/A" && $buffer[4] == "RPM") {
$dev = new SensorDevice();
$dev->setName($buffer[1]);
$dev->setValue($buffer[3]);
if ($buffer[6] != "N/A") {
$dev->setMin($buffer[6]);
} elseif (($buffer[9] != "N/A") && ($buffer[9]<$buffer[3])) { //max instead min issue
$dev->setMin($buffer[9]);
}
if ($buffer[11] != "'OK'") $dev->setEvent(trim($buffer[11], "'"));
$this->mbinfo->setMbFan($dev);
}
}
}
 
/**
* get power information
*
* @return void
*/
private function _power()
{
foreach ($this->_lines as $line) {
$buffer = preg_split("/\s*\|\s*/", $line);
if ($buffer[2] == "Current" && $buffer[11] != "N/A" && $buffer[4] == "W") {
$dev = new SensorDevice();
$dev->setName($buffer[1]);
$dev->setValue($buffer[3]);
if ($buffer[9] != "N/A") $dev->setMax($buffer[9]);
if ($buffer[11] != "'OK'") $dev->setEvent(trim($buffer[11], "'"));
$this->mbinfo->setMbPower($dev);
}
}
}
 
/**
* get current information
*
* @return void
*/
private function _current()
{
foreach ($this->_lines as $line) {
$buffer = preg_split("/\s*\|\s*/", $line);
if ($buffer[2] == "Current" && $buffer[11] != "N/A" && $buffer[4] == "A") {
$dev = new SensorDevice();
$dev->setName($buffer[1]);
$dev->setValue($buffer[3]);
if ($buffer[6] != "N/A") $dev->setMin($buffer[6]);
if ($buffer[9] != "N/A") $dev->setMax($buffer[9]);
if ($buffer[11] != "'OK'") $dev->setEvent(trim($buffer[11], "'"));
$this->mbinfo->setMbCurrent($dev);
}
}
}
 
/**
* get other information
*
* @return void
*/
private function _other()
{
foreach ($this->_lines as $line) {
$buffer = preg_split("/\s*\|\s*/", $line);
if ($buffer[4] == "N/A"
&& $buffer[2] != "OEM Reserved" && $buffer[11] != "N/A") {
$dev = new SensorDevice();
$dev->setName($buffer[1].' ('.$buffer[2].')');
$dev->setValue(trim($buffer[11], '\''));
$this->mbinfo->setMbOther($dev);
}
}
}
 
/**
* get the information
*
* @see PSI_Interface_Sensor::build()
*
* @return Void
*/
public function build()
{
$this->_temperature();
$this->_voltage();
$this->_fans();
$this->_power();
$this->_current();
$this->_other();
}
}
/web/acc/phpsysinfo/includes/mb/class.hddtemp.inc.php
1,114 → 1,124
<?php
/**
* hddtemp sensor class, getting information from hddtemp
*
* PHP version 5
*
* @category PHP
* @package PSI_Sensor
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @author T.A. van Roermund <timo@van-roermund.nl>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class HDDTemp extends Sensors
{
/**
* get the temperature information from hddtemp
* access is available through tcp or command
*
* @return void
*/
private function _temperature()
{
$ar_buf = array();
switch (defined('PSI_SENSOR_HDDTEMP_ACCESS')?strtolower(PSI_SENSOR_HDDTEMP_ACCESS):'command') {
case 'tcp':
$lines = '';
// Timo van Roermund: connect to the hddtemp daemon, use a 5 second timeout.
$fp = @fsockopen('localhost', 7634, $errno, $errstr, 5);
// if connected, read the output of the hddtemp daemon
if ($fp) {
while (!feof($fp)) {
$lines .= fread($fp, 1024);
}
fclose($fp);
} else {
$this->error->addError("HDDTemp error", $errno.", ".$errstr);
}
$lines = str_replace("||", "|\n|", $lines);
$ar_buf = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
break;
case 'command':
$strDrives = "";
$strContent = "";
$hddtemp_value = "";
if (CommonFunctions::rfts("/proc/diskstats", $strContent, 0, 4096, false)) {
$arrContent = preg_split("/\n/", $strContent, -1, PREG_SPLIT_NO_EMPTY);
foreach ($arrContent as $strLine) {
preg_match("/^\s(.*)\s([a-z]*)\s(.*)/", $strLine, $arrSplit);
if (! empty($arrSplit[2])) {
$strDrive = '/dev/'.$arrSplit[2];
if (file_exists($strDrive)) {
$strDrives = $strDrives.$strDrive.' ';
}
}
}
} else {
if (CommonFunctions::rfts("/proc/partitions", $strContent, 0, 4096, false)) {
$arrContent = preg_split("/\n/", $strContent, -1, PREG_SPLIT_NO_EMPTY);
foreach ($arrContent as $strLine) {
if (!preg_match("/^\s(.*)\s([\/a-z0-9]*(\/disc))\s(.*)/", $strLine, $arrSplit)) {
preg_match("/^\s(.*)\s([a-z]*)\s(.*)/", $strLine, $arrSplit);
}
if (! empty($arrSplit[2])) {
$strDrive = '/dev/'.$arrSplit[2];
if (file_exists($strDrive)) {
$strDrives = $strDrives.$strDrive.' ';
}
}
}
}
}
if (trim($strDrives) == "") {
break;
}
if (CommonFunctions::executeProgram("hddtemp", $strDrives, $hddtemp_value, PSI_DEBUG)) {
$hddtemp_value = preg_split("/\n/", $hddtemp_value, -1, PREG_SPLIT_NO_EMPTY);
foreach ($hddtemp_value as $line) {
$temp = preg_split("/:\s/", $line, 3);
if (count($temp) == 3 && preg_match("/^[0-9]/", $temp[2])) {
preg_match("/^([0-9]*)(.*)/", $temp[2], $ar_temp);
$temp[2] = trim($ar_temp[1]);
$temp[3] = trim($ar_temp[2]);
array_push($ar_buf, "|".implode("|", $temp)."|");
}
}
}
break;
default:
$this->error->addConfigError("temperature()", "[sensor_hddtemp] ACCESS");
break;
}
// Timo van Roermund: parse the info from the hddtemp daemon.
foreach ($ar_buf as $line) {
$data = array();
if (preg_match("/\|(.*)\|(.*)\|(.*)\|(.*)\|/", $line, $data)) {
if (trim($data[3]) != "ERR") {
// get the info we need
$dev = new SensorDevice();
$dev->setName($data[1] . ' (' . (strpos($data[2], " ")?substr($data[2], 0, strpos($data[2], " ")):$data[2]) . ')');
if (is_numeric($data[3])) {
$dev->setValue($data[3]);
}
// $dev->setMax(60);
$this->mbinfo->setMbTemp($dev);
}
}
}
}
 
// 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.hddtemp.inc.php,v 1.7 2007/01/21 13:17:20 bigmichi1 Exp $
 
class hddtemp {
function temperature($hddtemp_avail) {
$ar_buf = array();
$results = array();
switch ($hddtemp_avail) {
case "tcp":
// Timo van Roermund: connect to the hddtemp daemon, use a 5 second timeout.
$fp = fsockopen('localhost', 7634, $errno, $errstr, 5);
// if connected, read the output of the hddtemp daemon
if ($fp) {
// read output of the daemon
$lines = '';
while (!feof($fp)) {
$lines .= fread($fp, 1024);
}
// close the connection
fclose($fp);
} else {
die("HDDTemp error: " . $errno . ", " . $errstr);
}
$lines = str_replace("||", "|\n|", $lines);
$ar_buf = explode("\n", $lines);
break;
case "suid":
$strDrives = "";
$strContent = rfts( "/proc/diskstats", 0, 4096, false );
if( $strContent != "ERROR" ) {
$arrContent = explode( "\n", $strContent );
foreach( $arrContent as $strLine ) {
preg_match( "/^\s(.*)\s([a-z]*)\s(.*)/", $strLine, $arrSplit );
if( !empty( $arrSplit[2] ) ) {
$strDrive = '/dev/' . $arrSplit[2];
if( file_exists( $strDrive ) ) {
$strDrives = $strDrives . $strDrive . ' ';
}
}
}
} else {
$strContent = rfts( "/proc/partitions", 0, 4096, false );
if( $strContent != "ERROR" ) {
$arrContent = explode( "\n", $strContent );
foreach( $arrContent as $strLine ) {
if( !preg_match( "/^\s(.*)\s([\/a-z0-9]*(\/disc))\s(.*)/", $strLine, $arrSplit ) ) {
preg_match( "/^\s(.*)\s([a-z]*)\s(.*)/", $strLine, $arrSplit );
}
if( !empty( $arrSplit[2] ) ) {
$strDrive = '/dev/' . $arrSplit[2];
if( file_exists( $strDrive ) ) {
$strDrives = $strDrives . $strDrive . ' ';
}
}
}
}
}
if( trim( $strDrives ) == "" ) {
return array();
}
 
$hddtemp_value = execute_program("hddtemp", $strDrives);
$hddtemp_value = explode("\n", $hddtemp_value);
foreach($hddtemp_value as $line) {
$temp = preg_split("/:\s/", $line, 3);
if(count($temp) == 3 && preg_match("/^[0-9]/", $temp[2])) {
list($temp[2], $temp[3]) = (preg_split("/\s/", $temp[2]));
array_push( $ar_buf, "|" . implode("|", $temp) . "|");
}
}
break;
default:
die("Bad hddtemp configuration in config.php");
}
// Timo van Roermund: parse the info from the hddtemp daemon.
$i = 0;
foreach($ar_buf as $line) {
$data = array();
if (ereg("\|(.*)\|(.*)\|(.*)\|(.*)\|", $line, $data)) {
if( trim($data[3]) != "ERR" ) {
// get the info we need
$results[$i]['label'] = $data[1];
$results[$i]['value'] = $data[3];
$results[$i]['model'] = $data[2];
$i++;
}
}
}
return $results;
}
/**
* get the information
*
* @see PSI_Interface_Sensor::build()
*
* @return Void
*/
public function build()
{
$this->_temperature();
}
}
?>
/web/acc/phpsysinfo/includes/mb/class.healthd.inc.php
1,116 → 1,157
<?php
<?php
/**
* healthd sensor class, getting information from healthd
*
* PHP version 5
*
* @category PHP
* @package PSI_Sensor
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class Healthd extends Sensors
{
/**
* content to parse
*
* @var array
*/
private $_values = array();
 
// phpSysInfo - A PHP System Information Script
// http://phpsysinfo.sourceforge.net/
/**
* fill the private content var through command or data access
*/
public function __construct()
{
parent::__construct();
switch (defined('PSI_SENSOR_HEALTHD_ACCESS')?strtolower(PSI_SENSOR_HEALTHD_ACCESS):'command') {
case 'command':
if (CommonFunctions::executeProgram('healthdc', '-t', $lines)) {
$lines0 = preg_split("/\n/", $lines, 1, PREG_SPLIT_NO_EMPTY);
if (count($lines0) == 1) {
$this->_values = preg_split("/\t+/", $lines0[0]);
}
}
break;
case 'data':
if (CommonFunctions::rfts(PSI_APP_ROOT.'/data/healthd.txt', $lines)) {
$lines0 = preg_split("/\n/", $lines, 1, PREG_SPLIT_NO_EMPTY);
if (count($lines0) == 1) {
$this->_values = preg_split("/\t+/", $lines0[0]);
}
}
break;
default:
$this->error->addConfigError('__construct()', '[sensor_healthd] ACCESS');
break;
}
}
 
// 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.
/**
* get temperature information
*
* @return void
*/
private function _temperature()
{
if (count($this->_values) == 14) {
$dev1 = new SensorDevice();
$dev1->setName('temp1');
$dev1->setValue($this->_values[1]);
// $dev1->setMax(70);
$this->mbinfo->setMbTemp($dev1);
$dev2 = new SensorDevice();
$dev2->setName('temp1');
$dev2->setValue($this->_values[2]);
// $dev2->setMax(70);
$this->mbinfo->setMbTemp($dev2);
$dev3 = new SensorDevice();
$dev3->setName('temp1');
$dev3->setValue($this->_values[3]);
// $dev3->setMax(70);
$this->mbinfo->setMbTemp($dev3);
}
}
 
// 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.healthd.inc.php,v 1.6 2007/02/18 19:11:31 bigmichi1 Exp $
 
class mbinfo {
var $lines;
 
function temperature() {
$ar_buf = array();
$results = array();
 
if (!isset($this->lines)) {
$this->lines = execute_program('healthdc', '-t');
/**
* get fan information
*
* @return void
*/
private function _fans()
{
if (count($this->_values) == 14) {
$dev1 = new SensorDevice();
$dev1->setName('fan1');
$dev1->setValue($this->_values[4]);
// $dev1->setMin(3000);
$this->mbinfo->setMbFan($dev1);
$dev2 = new SensorDevice();
$dev2->setName('fan2');
$dev2->setValue($this->_values[5]);
// $dev2->setMin(3000);
$this->mbinfo->setMbFan($dev2);
$dev3 = new SensorDevice();
$dev3->setName('fan3');
$dev3->setValue($this->_values[6]);
// $dev3->setMin(3000);
$this->mbinfo->setMbFan($dev3);
}
}
 
$ar_buf = preg_split("/\t+/", $this->lines);
 
$results[0]['label'] = 'temp1';
$results[0]['value'] = $ar_buf[1];
$results[0]['limit'] = '70.0';
$results[0]['percent'] = $results[0]['value'] * 100 / $results[0]['limit'];
$results[1]['label'] = 'temp2';
$results[1]['value'] = $ar_buf[2];
$results[1]['limit'] = '70.0';
$results[1]['percent'] = $results[1]['value'] * 100 / $results[1]['limit'];
$results[2]['label'] = 'temp3';
$results[2]['value'] = $ar_buf[3];
$results[2]['limit'] = '70.0';
$results[2]['percent'] = $results[2]['value'] * 100 / $results[2]['limit'];
return $results;
}
 
function fans() {
$ar_buf = array();
$results = array();
 
if (!isset($this->lines)) {
$this->lines = execute_program('healthdc', '-t');
/**
* get voltage information
*
* @return void
*/
private function _voltage()
{
if (count($this->_values) == 14) {
$dev1 = new SensorDevice();
$dev1->setName('Vcore1');
$dev1->setValue($this->_values[7]);
$this->mbinfo->setMbVolt($dev1);
$dev2 = new SensorDevice();
$dev2->setName('Vcore2');
$dev2->setValue($this->_values[8]);
$this->mbinfo->setMbVolt($dev2);
$dev3 = new SensorDevice();
$dev3->setName('3volt');
$dev3->setValue($this->_values[9]);
$this->mbinfo->setMbVolt($dev3);
$dev4 = new SensorDevice();
$dev4->setName('+5Volt');
$dev4->setValue($this->_values[10]);
$this->mbinfo->setMbVolt($dev4);
$dev5 = new SensorDevice();
$dev5->setName('+12Volt');
$dev5->setValue($this->_values[11]);
$this->mbinfo->setMbVolt($dev5);
$dev6 = new SensorDevice();
$dev6->setName('-12Volt');
$dev6->setValue($this->_values[12]);
$this->mbinfo->setMbVolt($dev6);
$dev7 = new SensorDevice();
$dev7->setName('-5Volt');
$dev7->setValue($this->_values[13]);
$this->mbinfo->setMbVolt($dev7);
}
}
 
$ar_buf = preg_split("/\t+/", $this->lines);
 
$results[0]['label'] = 'fan1';
$results[0]['value'] = $ar_buf[4];
$results[0]['min'] = '3000';
$results[1]['label'] = 'fan2';
$results[1]['value'] = $ar_buf[5];
$results[1]['min'] = '3000';
$results[2]['label'] = 'fan3';
$results[2]['value'] = $ar_buf[6];
$results[2]['min'] = '3000';
 
return $results;
}
 
function voltage() {
$ar_buf = array();
$results = array();
 
if (!isset($this->lines)) {
$this->lines = execute_program('healthdc', '-t');
/**
* get the information
*
* @see PSI_Interface_Sensor::build()
*
* @return Void
*/
public function build()
{
$this->_temperature();
$this->_fans();
$this->_voltage();
}
 
$ar_buf = preg_split("/\t+/", $this->lines);
 
$results[0]['label'] = 'Vcore1';
$results[0]['value'] = $ar_buf[7];
$results[0]['min'] = '0.00';
$results[0]['max'] = '0.00';
$results[1]['label'] = 'Vcore2';
$results[1]['value'] = $ar_buf[8];
$results[1]['min'] = '0.00';
$results[1]['max'] = '0.00';
$results[2]['label'] = '3volt';
$results[2]['value'] = $ar_buf[9];
$results[2]['min'] = '0.00';
$results[2]['max'] = '0.00';
$results[3]['label'] = '+5Volt';
$results[3]['value'] = $ar_buf[10];
$results[3]['min'] = '0.00';
$results[3]['max'] = '0.00';
$results[4]['label'] = '+12Volt';
$results[4]['value'] = $ar_buf[11];
$results[4]['min'] = '0.00';
$results[4]['max'] = '0.00';
$results[5]['label'] = '-12Volt';
$results[5]['value'] = $ar_buf[12];
$results[5]['min'] = '0.00';
$results[5]['max'] = '0.00';
$results[6]['label'] = '-5Volt';
$results[6]['value'] = $ar_buf[13];
$results[6]['min'] = '0.00';
$results[6]['max'] = '0.00';
 
return $results;
}
}
 
?>
}
/web/acc/phpsysinfo/includes/mb/class.hwmon.inc.php
0,0 → 1,256
<?php
/**
* hwmon sensor class, getting hardware sensors information from /sys/class/hwmon/hwmon
*
* PHP version 5
*
* @category PHP
* @package PSI_Sensor
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
* @copyright 2016 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class Hwmon extends Sensors
{
/**
* get temperature information
*
* @param string $hwpath
* @return void
*/
protected function _temperature($hwpath)
{
$sensor = glob($hwpath."temp*_input", GLOB_NOSORT);
if (is_array($sensor) && (($total = count($sensor)) > 0)) {
$buf = "";
for ($i = 0; $i < $total; $i++) if (($buf = CommonFunctions::rolv($sensor[$i]))!==null) {
$dev = new SensorDevice();
$dev->setValue($buf/1000);
if (($buf = CommonFunctions::rolv($sensor[$i], "/\/[^\/]*_input$/", "/name"))!==null) {
$name = " (".$buf.")";
} else {
$name = "";
}
if (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_label"))!==null) {
$dev->setName($buf.$name);
} else {
$labelname = trim(preg_replace("/_input$/", "", pathinfo($sensor[$i], PATHINFO_BASENAME)));
if ($labelname !== "") {
$dev->setName($labelname.$name);
} else {
$dev->setName('unknown'.$name);
}
}
if (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_crit"))!==null) {
$dev->setMax($buf/1000);
if (CommonFunctions::rolv($sensor[$i], "/_input$/", "_crit_alarm")==="1") {
$dev->setEvent("Critical Alarm");
}
} elseif (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_max"))!==null) {
$dev->setMax($buf/1000);
}
$this->mbinfo->setMbTemp($dev);
}
}
}
 
/**
* get voltage information
*
* @param string $hwpath
* @return void
*/
private function _voltage($hwpath)
{
$sensor = glob($hwpath."in*_input", GLOB_NOSORT);
if (is_array($sensor) && (($total = count($sensor)) > 0)) {
$buf = "";
for ($i = 0; $i < $total; $i++) if (($buf = CommonFunctions::rolv($sensor[$i]))!==null) {
$dev = new SensorDevice();
$dev->setValue($buf/1000);
if (($buf = CommonFunctions::rolv($sensor[$i], "/\/[^\/]*_input$/", "/name"))!==null) {
$name = " (".$buf.")";
} else {
$name = "";
}
if (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_label"))!==null) {
$dev->setName($buf.$name);
} else {
$labelname = trim(preg_replace("/_input$/", "", pathinfo($sensor[$i], PATHINFO_BASENAME)));
if ($labelname !== "") {
$dev->setName($labelname.$name);
} else {
$dev->setName('unknown'.$name);
}
}
if (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_max"))!==null) {
$dev->setMax($buf/1000);
}
if (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_min"))!==null) {
$dev->setMin($buf/1000);
}
if (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_alarm"))==="1") {
$dev->setEvent("Alarm");
}
$this->mbinfo->setMbVolt($dev);
}
}
}
 
/**
* get fan information
*
* @param string $hwpath
* @return void
*/
protected function _fans($hwpath)
{
$sensor = glob($hwpath."fan*_input", GLOB_NOSORT);
if (is_array($sensor) && (($total = count($sensor)) > 0)) {
$buf = "";
for ($i = 0; $i < $total; $i++) if (($buf = CommonFunctions::rolv($sensor[$i]))!==null) {
$dev = new SensorDevice();
$dev->setValue($buf);
if (($buf = CommonFunctions::rolv($sensor[$i], "/\/[^\/]*_input$/", "/name"))!==null) {
$name = " (".$buf.")";
} else {
$name = "";
}
if (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_label"))!==null) {
$dev->setName($buf.$name);
} else {
$labelname = trim(preg_replace("/_input$/", "", pathinfo($sensor[$i], PATHINFO_BASENAME)));
if ($labelname !== "") {
$dev->setName($labelname.$name);
} else {
$dev->setName('unknown'.$name);
}
}
if (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_full_speed"))!==null) {
$dev->setMax($buf);
} elseif (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_max"))!==null) {
$dev->setMax($buf);
}
if (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_min"))!==null) {
$dev->setMin($buf);
}
if (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_alarm"))==="1") {
$dev->setEvent("Alarm");
}
$this->mbinfo->setMbFan($dev);
}
}
}
 
/**
* get power information
*
* @param string $hwpath
* @return void
*/
private function _power($hwpath)
{
$sensor = glob($hwpath."power*_input", GLOB_NOSORT);
if (is_array($sensor) && (($total = count($sensor)) > 0)) {
$buf = "";
for ($i = 0; $i < $total; $i++) if (($buf = CommonFunctions::rolv($sensor[$i]))!==null) {
$dev = new SensorDevice();
$dev->setValue($buf/1000000);
if (($buf = CommonFunctions::rolv($sensor[$i], "/\/[^\/]*_input$/", "/name"))!==null) {
$name = " (".$buf.")";
} else {
$name = "";
}
if (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_label"))!==null) {
$dev->setName($buf.$name);
} else {
$labelname = trim(preg_replace("/_input$/", "", pathinfo($sensor[$i], PATHINFO_BASENAME)));
if ($labelname !== "") {
$dev->setName($labelname.$name);
} else {
$dev->setName('unknown'.$name);
}
}
if (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_max"))!==null) {
$dev->setMax($buf/1000000);
}
if (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_min"))!==null) {
$dev->setMin($buf/1000000);
}
if (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_alarm"))==="1") {
$dev->setEvent("Alarm");
}
$this->mbinfo->setMbPower($dev);
}
}
}
 
/**
* get current information
*
* @param string $hwpath
* @return void
*/
private function _current($hwpath)
{
$sensor = glob($hwpath."curr*_input", GLOB_NOSORT);
if (is_array($sensor) && (($total = count($sensor)) > 0)) {
$buf = "";
for ($i = 0; $i < $total; $i++) if (($buf = CommonFunctions::rolv($sensor[$i]))!==null) {
$dev = new SensorDevice();
$dev->setValue($buf/1000);
if (($buf = CommonFunctions::rolv($sensor[$i], "/\/[^\/]*_input$/", "/name"))!==null) {
$name = " (".$buf.")";
} else {
$name = "";
}
if (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_label"))!==null) {
$dev->setName($buf.$name);
} else {
$labelname = trim(preg_replace("/_input$/", "", pathinfo($sensor[$i], PATHINFO_BASENAME)));
if ($labelname !== "") {
$dev->setName($labelname.$name);
} else {
$dev->setName('unknown'.$name);
}
}
if (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_max"))!==null) {
$dev->setMax($buf/1000);
}
if (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_min"))!==null) {
$dev->setMin($buf/1000);
}
if (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_alarm"))==="1") {
$dev->setEvent("Alarm");
}
$this->mbinfo->setMbCurrent($dev);
}
}
}
 
/**
* get the information
*
* @see PSI_Interface_Sensor::build()
*
* @return Void
*/
public function build()
{
$hwpaths = glob("/sys/class/hwmon/hwmon*/", GLOB_NOSORT);
if (is_array($hwpaths) && (count($hwpaths) > 0)) {
$hwpaths = array_merge($hwpaths, glob("/sys/class/hwmon/hwmon*/device/", GLOB_NOSORT));
}
if (is_array($hwpaths) && (($totalh = count($hwpaths)) > 0)) {
for ($h = 0; $h < $totalh; $h++) {
$this->_temperature($hwpaths[$h]);
$this->_voltage($hwpaths[$h]);
$this->_fans($hwpaths[$h]);
$this->_power($hwpaths[$h]);
$this->_current($hwpaths[$h]);
}
}
}
}
/web/acc/phpsysinfo/includes/mb/class.hwsensors.inc.php
1,80 → 1,145
<?php
<?php
/**
* hwsensors sensor class, getting information from hwsensors
*
* PHP version 5
*
* @category PHP
* @package PSI_Sensor
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class HWSensors extends Sensors
{
/**
* content to parse
*
* @var array
*/
private $_lines = array();
 
// phpSysInfo - A PHP System Information Script
// http://phpsysinfo.sourceforge.net/
/**
* fill the private content var through command
*/
public function __construct()
{
parent::__construct();
$lines = "";
// CommonFunctions::executeProgram('sysctl', '-w hw.sensors', $lines);
CommonFunctions::executeProgram('sysctl', 'hw.sensors', $lines);
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
}
 
// 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.hwsensors.inc.php,v 1.4 2006/05/20 17:01:07 bigmichi1 Exp $
 
class mbinfo {
var $lines;
 
function mbinfo() {
$this->lines = execute_program('sysctl', '-w hw.sensors');
$this->lines = explode("\n", $this->lines);
/**
* get temperature information
*
* @return void
*/
private function _temperature()
{
foreach ($this->_lines as $line) {
if (preg_match('/^hw\.sensors\.[0-9]+=[^\s,]+,\s+([^,]+),\s+temp,\s+([0-9\.]+)\s+degC.*$/', $line, $ar_buf)) {
$dev = new SensorDevice();
$dev->setName($ar_buf[1]);
$dev->setValue($ar_buf[2]);
$this->mbinfo->setMbTemp($dev);
} elseif (preg_match('/^hw\.sensors\.[0-9]+=[^\s,]+,\s+([^,]+),\s+([0-9\.]+)\s+degC$/', $line, $ar_buf)) {
$dev = new SensorDevice();
$dev->setName($ar_buf[1]);
$dev->setValue($ar_buf[2]);
$this->mbinfo->setMbTemp($dev);
} elseif (preg_match('/^hw\.sensors\.[^\.]+\.(.*)=([0-9\.]+)\s+degC\s+\((.*)\)$/', $line, $ar_buf)) {
$dev = new SensorDevice();
$dev->setName($ar_buf[3]);
$dev->setValue($ar_buf[2]);
$this->mbinfo->setMbTemp($dev);
} elseif (preg_match('/^hw\.sensors\.[^\.]+\.(.*)=([0-9\.]+)\s+degC$/', $line, $ar_buf)) {
$dev = new SensorDevice();
$dev->setName($ar_buf[1]);
$dev->setValue($ar_buf[2]);
$this->mbinfo->setMbTemp($dev);
}
}
}
 
function temperature() {
$ar_buf = array();
$results = array();
 
foreach( $this->lines as $line ) {
$ar_buf = preg_split("/[\s,]+/", $line);
if( isset( $ar_buf[3] ) && $ar_buf[2] == 'temp') {
$results[$j]['label'] = $ar_buf[1];
$results[$j]['value'] = $ar_buf[3];
$results[$j]['limit'] = '70.0';
$results[$j]['percent'] = $results[$j]['value'] * 100 / $results[$j]['limit'];
$j++;
}
}
return $results;
/**
* get fan information
*
* @return void
*/
private function _fans()
{
foreach ($this->_lines as $line) {
if (preg_match('/^hw\.sensors\.[0-9]+=[^\s,]+,\s+([^,]+),\s+fanrpm,\s+([0-9\.]+)\s+RPM.*$/', $line, $ar_buf)) {
$dev = new SensorDevice();
$dev->setName($ar_buf[1]);
$dev->setValue($ar_buf[2]);
$this->mbinfo->setMbFan($dev);
} elseif (preg_match('/^hw\.sensors\.[0-9]+=[^\s,]+,\s+([^,]+),\s+([0-9\.]+)\s+RPM$/', $line, $ar_buf)) {
$dev = new SensorDevice();
$dev->setName($ar_buf[1]);
$dev->setValue($ar_buf[2]);
$this->mbinfo->setMbFan($dev);
} elseif (preg_match('/^hw\.sensors\.[^\.]+\.(.*)=([0-9\.]+)\s+RPM\s+\((.*)\)$/', $line, $ar_buf)) {
$dev = new SensorDevice();
$dev->setName($ar_buf[3]);
$dev->setValue($ar_buf[2]);
$this->mbinfo->setMbFan($dev);
} elseif (preg_match('/^hw\.sensors\.[^\.]+\.(.*)=([0-9\.]+)\s+RPM$/', $line, $ar_buf)) {
$dev = new SensorDevice();
$dev->setName($ar_buf[1]);
$dev->setValue($ar_buf[2]);
$this->mbinfo->setMbFan($dev);
}
}
}
 
function fans() {
$ar_buf = array();
$results = array();
 
foreach( $this->lines as $line ) {
$ar_buf = preg_split("/[\s,]+/", $line );
if( isset( $ar_buf[3] ) && $ar_buf[2] == 'fanrpm') {
$results[$j]['label'] = $ar_buf[1];
$results[$j]['value'] = $ar_buf[3];
$j++;
}
}
return $results;
/**
* get voltage information
*
* @return void
*/
private function _voltage()
{
foreach ($this->_lines as $line) {
if (preg_match('/^hw\.sensors\.[0-9]+=[^\s,]+,\s+([^,]+),\s+volts_dc,\s+([0-9\.]+)\s+V.*$/', $line, $ar_buf)) {
$dev = new SensorDevice();
$dev->setName($ar_buf[1]);
$dev->setValue($ar_buf[2]);
$this->mbinfo->setMbVolt($dev);
} elseif (preg_match('/^hw\.sensors\.[0-9]+=[^\s,]+,\s+([^,]+),\s+([0-9\.]+)\s+V\sDC$/', $line, $ar_buf)) {
$dev = new SensorDevice();
$dev->setName($ar_buf[1]);
$dev->setValue($ar_buf[2]);
$this->mbinfo->setMbVolt($dev);
} elseif (preg_match('/^hw\.sensors\.[^\.]+\.(.*)=([0-9\.]+)\s+VDC\s+\((.*)\)$/', $line, $ar_buf)) {
$dev = new SensorDevice();
$dev->setName($ar_buf[3]);
$dev->setValue($ar_buf[2]);
$this->mbinfo->setMbVolt($dev);
} elseif (preg_match('/^hw\.sensors\.[^\.]+\.(.*)=([0-9\.]+)\s+VDC$/', $line, $ar_buf)) {
$dev = new SensorDevice();
$dev->setName($ar_buf[1]);
$dev->setValue($ar_buf[2]);
$this->mbinfo->setMbVolt($dev);
}
}
}
 
function voltage() {
$ar_buf = array();
$results = array();
 
foreach( $this->lines as $line ) {
$ar_buf = preg_split("/[\s,]+/", $line );
if ( isset( $ar_buf[3] ) && $ar_buf[2] == 'volts_dc') {
$results[$j]['label'] = $ar_buf[1];
$results[$j]['value'] = $ar_buf[3];
$results[$j]['min'] = '0.00';
$results[$j]['max'] = '0.00';
$j++;
}
}
return $results;
/**
* get the information
*
* @see PSI_Interface_Sensor::build()
*
* @return Void
*/
public function build()
{
$this->_temperature();
$this->_voltage();
$this->_fans();
}
}
 
?>
/web/acc/phpsysinfo/includes/mb/class.ipmitool.inc.php
0,0 → 1,320
<?php
/**
* ipmitool sensor class, getting information from ipmitool
*
* PHP version 5
*
* @category PHP
* @package PSI_Sensor
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class IPMItool extends Sensors
{
/**
* content to parse
*
* @var array
*/
private $_buf = array();
 
/**
* fill the private content var through command or data access
*/
public function __construct()
{
parent::__construct();
$lines = "";
switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') {
case 'command':
CommonFunctions::executeProgram('ipmitool', 'sensor -v', $lines);
break;
case 'data':
CommonFunctions::rfts(PSI_APP_ROOT.'/data/ipmitool.txt', $lines);
break;
default:
$this->error->addConfigError('__construct()', '[sensor_ipmitool] ACCESS');
break;
}
if (trim($lines) !== "") {
if (preg_match("/^Sensor ID\s+/", $lines)) { //new data format ('ipmitool sensor -v')
$lines = preg_replace("/\n?Unable to read sensor/", "\nUnable to read sensor", $lines);
$sensors = preg_split("/Sensor ID\s+/", $lines, -1, PREG_SPLIT_NO_EMPTY);
foreach ($sensors as $sensor) {
if (preg_match("/^:\s*(.+)\s\((0x[a-f\d]+)\)\r?\n/", $sensor, $name) && (($name1 = trim($name[1])) !== "")) {
$sensorvalues = preg_split("/\r?\n/", $sensor, -1, PREG_SPLIT_NO_EMPTY);
unset($sensorvalues[0]); //skip first
$sens = array();
$was = false;
foreach ($sensorvalues as $sensorvalue) {
if (preg_match("/^\s+\[(.+)\]$/", $sensorvalue, $buffer) && (($buffer1 = trim($buffer[1])) !== "")) {
if (isset($sens['State'])) {
$sens['State'] .= ', '.$buffer1;
} else {
$sens['State'] = $buffer1;
}
$was = true;
} elseif (preg_match("/^([^:]+):(.+)$/", $sensorvalue, $buffer)
&& (($buffer1 = trim($buffer[1])) !== "")
&& (($buffer2 = trim($buffer[2])) !== "")) {
$sens[$buffer1] = $buffer2;
$was = true;
}
}
if ($was && !isset($sens['Unable to read sensor'])) {
$sens['Sensor'] = $name1;
if (isset($sens['Sensor Reading'])
&& preg_match("/^([\d\.]+)\s+\([^\)]*\)\s+(.+)$/", $sens['Sensor Reading'], $buffer)
&& (($buffer2 = trim($buffer[2])) !== "")) {
$sens['Value'] = $buffer[1];
$sens['Unit'] = $buffer2;
}
$this->_buf[intval($name[2], 0)] = $sens;
}
}
}
} else {
$lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
if (count($lines)>0) {
$buffer = preg_split("/\s*\|\s*/", $lines[0]);
if (count($buffer)>8) { //old data format ('ipmitool sensor')
foreach ($lines as $line) {
$buffer = preg_split("/\s*\|\s*/", $line);
if (count($buffer)>8) {
$sens = array();
$sens['Sensor'] = $buffer[0];
switch ($buffer[2]) {
case 'degrees C':
$sens['Value'] = $buffer[1];
$sens['Unit'] = $buffer[2];
$sens['Upper Critical'] = $buffer[8];
$sens['Sensor Type (Threshold)'] = 'Temperature';
break;
case 'Volts':
$sens['Value'] = $buffer[1];
$sens['Unit'] = $buffer[2];
$sens['Lower Critical'] = $buffer[5];
$sens['Upper Critical'] = $buffer[8];
$sens['Sensor Type (Threshold)'] = 'Voltage';
break;
case 'RPM':
$sens['Value'] = $buffer[1];
$sens['Unit'] = $buffer[2];
$sens['Lower Critical'] = $buffer[5];
$sens['Upper Critical'] = $buffer[8];
$sens['Sensor Type (Threshold)'] = 'Fan';
break;
case 'Watts':
$sens['Value'] = $buffer[1];
$sens['Unit'] = $buffer[2];
$sens['Upper Critical'] = $buffer[8];
$sens['Sensor Type (Threshold)'] = 'Current';
break;
case 'Amps':
$sens['Value'] = $buffer[1];
$sens['Unit'] = $buffer[2];
$sens['Lower Critical'] = $buffer[5];
$sens['Upper Critical'] = $buffer[8];
$sens['Sensor Type (Threshold)'] = 'Current';
break;
case 'discrete':
if (($buffer[1]==='0x0') || ($buffer[1]==='0x1')) {
$sens['State'] = $buffer[1];
$sens['Sensor Type (Discrete)'] = '';
$sens['State'] = $buffer[1];
}
break;
}
$this->_buf[] = $sens;
}
}
}
}
}
}
}
 
/**
* get temperature information
*
* @return void
*/
private function _temperature()
{
foreach ($this->_buf as $sensor) {
if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Temperature'))
||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Temperature')))
&& isset($sensor['Unit']) && ($sensor['Unit'] == 'degrees C')
&& isset($sensor['Value'])) {
$dev = new SensorDevice();
$dev->setName($sensor['Sensor']);
$dev->setValue($sensor['Value']);
if (isset($sensor['Upper Critical']) && (($max = $sensor['Upper Critical']) != "na")) {
$dev->setMax($max);
}
if (isset($sensor['Status']) && (($status = $sensor['Status']) != "ok")) {
$dev->setEvent($status);
}
$this->mbinfo->setMbTemp($dev);
}
}
}
 
/**
* get voltage information
*
* @return void
*/
private function _voltage()
{
foreach ($this->_buf as $sensor) {
if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Voltage'))
||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Voltage')))
&& isset($sensor['Unit']) && ($sensor['Unit'] == 'Volts')
&& isset($sensor['Value'])) {
$dev = new SensorDevice();
$dev->setName($sensor['Sensor']);
$dev->setValue($sensor['Value']);
if (isset($sensor['Upper Critical']) && (($max = $sensor['Upper Critical']) != "na")) {
$dev->setMax($max);
}
if (isset($sensor['Lower Critical']) && (($min = $sensor['Lower Critical']) != "na")) {
$dev->setMin($min);
}
if (isset($sensor['Status']) && (($status = $sensor['Status']) != "ok")) {
$dev->setEvent($status);
}
$this->mbinfo->setMbVolt($dev);
}
}
}
 
/**
* get fan information
*
* @return void
*/
private function _fans()
{
foreach ($this->_buf as $sensor) {
if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Fan'))
||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Fan')))
&& isset($sensor['Unit']) && ($sensor['Unit'] == 'RPM')
&& isset($sensor['Value'])) {
$dev = new SensorDevice();
$dev->setName($sensor['Sensor']);
$dev->setValue($value = $sensor['Value']);
if (isset($sensor['Lower Critical']) && (($min = $sensor['Lower Critical']) != "na")) {
$dev->setMin($min);
} elseif (isset($sensor['Upper Critical']) && (($max = $sensor['Upper Critical']) != "na")
&& ($max < $value)) { // max instead min issue
$dev->setMin($max);
}
if (isset($sensor['Status']) && (($status = $sensor['Status']) != "ok")) {
$dev->setEvent($status);
}
$this->mbinfo->setMbFan($dev);
}
}
}
 
/**
* get power information
*
* @return void
*/
private function _power()
{
foreach ($this->_buf as $sensor) {
if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Current'))
||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Current')))
&& isset($sensor['Unit']) && ($sensor['Unit'] == 'Watts')
&& isset($sensor['Value'])) {
$dev = new SensorDevice();
$dev->setName($sensor['Sensor']);
$dev->setValue($sensor['Value']);
if (isset($sensor['Upper Critical']) && (($max = $sensor['Upper Critical']) != "na")) {
$dev->setMax($max);
}
if (isset($sensor['Status']) && (($status = $sensor['Status']) != "ok")) {
$dev->setEvent($status);
}
$this->mbinfo->setMbPower($dev);
}
}
}
 
/**
* get current information
*
* @return void
*/
private function _current()
{
foreach ($this->_buf as $sensor) {
if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Current'))
||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Current')))
&& isset($sensor['Unit']) && ($sensor['Unit'] == 'Amps')
&& isset($sensor['Value'])) {
$dev = new SensorDevice();
$dev->setName($sensor['Sensor']);
$dev->setValue($sensor['Value']);
if (isset($sensor['Upper Critical']) && (($max = $sensor['Upper Critical']) != "na")) {
$dev->setMax($max);
}
if (isset($sensor['Lower Critical']) && (($min = $sensor['Lower Critical']) != "na")) {
$dev->setMin($min);
}
if (isset($sensor['Status']) && (($status = $sensor['Status']) != "ok")) {
$dev->setEvent($status);
}
$this->mbinfo->setMbCurrent($dev);
}
}
}
 
/**
* get other information
*
* @return void
*/
private function _other()
{
foreach ($this->_buf as $sensor) {
if (isset($sensor['Sensor Type (Discrete)'])) {
$dev = new SensorDevice();
if ($sensor['Sensor Type (Discrete)']!=='') {
$dev->setName($sensor['Sensor'].' ('.$sensor['Sensor Type (Discrete)'].')');
} else {
$dev->setName($sensor['Sensor']);
}
if (isset($sensor['State'])) {
$dev->setValue($sensor['State']);
} else {
$dev->setValue('0x0');
}
$this->mbinfo->setMbOther($dev);
}
}
}
 
/**
* get the information
*
* @see PSI_Interface_Sensor::build()
*
* @return Void
*/
public function build()
{
$this->_temperature();
$this->_voltage();
$this->_fans();
$this->_power();
$this->_current();
$this->_other();
}
}
/web/acc/phpsysinfo/includes/mb/class.ipmiutil.inc.php
0,0 → 1,265
<?php
/**
* ipmiutil sensor class, getting information from ipmi-sensors
*
* PHP version 5
*
* @category PHP
* @package PSI_Sensor
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
* @copyright 2014 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class IPMIutil extends Sensors
{
/**
* content to parse
*
* @var array
*/
private $_lines = array();
 
/**
* fill the private content var through command or data access
*/
public function __construct()
{
parent::__construct();
switch (defined('PSI_SENSOR_IPMIUTIL_ACCESS')?strtolower(PSI_SENSOR_IPMIUTIL_ACCESS):'command') {
case 'command':
CommonFunctions::executeProgram('ipmiutil', 'sensor -stw', $lines);
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
break;
case 'data':
if (CommonFunctions::rfts(PSI_APP_ROOT.'/data/ipmiutil.txt', $lines)) {
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
}
break;
default:
$this->error->addConfigError('__construct()', '[sensor_ipmiutil] ACCESS');
break;
}
}
 
/**
* get temperature information
*
* @return void
*/
private function _temperature()
{
foreach ($this->_lines as $line) {
$buffer = preg_split("/\s*\|\s*/", $line);
if (isset($buffer[2]) && $buffer[2] == "Temperature"
&& $buffer[1] == "Full"
&& isset($buffer[6]) && preg_match("/^(\S+)\sC$/", $buffer[6], $value)
&& $buffer[5] !== "Init") {
$dev = new SensorDevice();
$dev->setName($buffer[4]);
$dev->setValue($value[1]);
if (isset($buffer[7]) && $buffer[7] == "Thresholds") {
if ((isset($buffer[8]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[8], $limits))
||(isset($buffer[9]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[9], $limits))
||(isset($buffer[10]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[10], $limits))
||(isset($buffer[11]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[11], $limits))) {
$dev->setMax($limits[1]);
}
}
if ($buffer[5] != "OK") $dev->setEvent($buffer[5]);
$this->mbinfo->setMbTemp($dev);
}
}
}
 
/**
* get voltage information
*
* @return void
*/
private function _voltage()
{
foreach ($this->_lines as $line) {
$buffer = preg_split("/\s*\|\s*/", $line);
if (isset($buffer[2]) && $buffer[2] == "Voltage"
&& $buffer[1] == "Full"
&& isset($buffer[6]) && preg_match("/^(\S+)\sV$/", $buffer[6], $value)
&& $buffer[5] !== "Init") {
$dev = new SensorDevice();
$dev->setName($buffer[4]);
$dev->setValue($value[1]);
if (isset($buffer[7]) && $buffer[7] == "Thresholds") {
if ((isset($buffer[8]) && preg_match("/^lo-crit\s(\S+)\s*$/", $buffer[8], $limits))
||(isset($buffer[9]) && preg_match("/^lo-crit\s(\S+)\s*$/", $buffer[9], $limits))
||(isset($buffer[10]) && preg_match("/^lo-crit\s(\S+)\s*$/", $buffer[10], $limits))
||(isset($buffer[11]) && preg_match("/^lo-crit\s(\S+)\s*$/", $buffer[11], $limits))) {
$dev->setMin($limits[1]);
}
if ((isset($buffer[8]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[8], $limits))
||(isset($buffer[9]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[9], $limits))
||(isset($buffer[10]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[10], $limits))
||(isset($buffer[11]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[11], $limits))) {
$dev->setMax($limits[1]);
}
}
if ($buffer[5] != "OK") $dev->setEvent($buffer[5]);
$this->mbinfo->setMbVolt($dev);
}
}
}
 
/**
* get fan information
*
* @return void
*/
private function _fans()
{
foreach ($this->_lines as $line) {
$buffer = preg_split("/\s*\|\s*/", $line);
if (isset($buffer[2]) && $buffer[2] == "Fan"
&& $buffer[1] == "Full"
&& isset($buffer[6]) && preg_match("/^(\S+)\sRPM$/", $buffer[6], $value)
&& $buffer[5] !== "Init") {
$dev = new SensorDevice();
$dev->setName($buffer[4]);
$dev->setValue($value[1]);
if (isset($buffer[7]) && $buffer[7] == "Thresholds") {
if ((isset($buffer[8]) && preg_match("/^lo-crit\s(\S+)\s*$/", $buffer[8], $limits))
||(isset($buffer[9]) && preg_match("/^lo-crit\s(\S+)\s*$/", $buffer[9], $limits))
||(isset($buffer[10]) && preg_match("/^lo-crit\s(\S+)\s*$/", $buffer[10], $limits))
||(isset($buffer[11]) && preg_match("/^lo-crit\s(\S+)\s*$/", $buffer[11], $limits))) {
$dev->setMin($limits[1]);
} elseif ((isset($buffer[8]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[8], $limits))
||(isset($buffer[9]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[9], $limits))
||(isset($buffer[10]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[10], $limits))
||(isset($buffer[11]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[11], $limits))) {
if ($limits[1]<$value[1]) {//max instead min issue
$dev->setMin($limits[1]);
}
}
}
if ($buffer[5] != "OK") $dev->setEvent($buffer[5]);
$this->mbinfo->setMbFan($dev);
}
}
}
 
/**
* get power information
*
* @return void
*/
private function _power()
{
foreach ($this->_lines as $line) {
$buffer = preg_split("/\s*\|\s*/", $line);
if (isset($buffer[2]) && $buffer[2] == "Current"
&& $buffer[1] == "Full"
&& isset($buffer[6]) && preg_match("/^(\S+)\sW$/", $buffer[6], $value)
&& $buffer[5] !== "Init") {
$dev = new SensorDevice();
$dev->setName($buffer[4]);
$dev->setValue($value[1]);
if (isset($buffer[7]) && $buffer[7] == "Thresholds") {
if ((isset($buffer[8]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[8], $limits))
||(isset($buffer[9]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[9], $limits))
||(isset($buffer[10]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[10], $limits))
||(isset($buffer[11]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[11], $limits))) {
$dev->setMax($limits[1]);
}
}
if ($buffer[5] != "OK") $dev->setEvent($buffer[5]);
$this->mbinfo->setMbPower($dev);
}
}
}
 
/**
* get current information
*
* @return void
*/
private function _current()
{
foreach ($this->_lines as $line) {
$buffer = preg_split("/\s*\|\s*/", $line);
if (isset($buffer[2]) && $buffer[2] == "Current"
&& $buffer[1] == "Full"
&& isset($buffer[6]) && preg_match("/^(\S+)\sA$/", $buffer[6], $value)
&& $buffer[5] !== "Init") {
$dev = new SensorDevice();
$dev->setName($buffer[4]);
$dev->setValue($value[1]);
if (isset($buffer[7]) && $buffer[7] == "Thresholds") {
if ((isset($buffer[8]) && preg_match("/^lo-crit\s(\S+)\s*$/", $buffer[8], $limits))
||(isset($buffer[9]) && preg_match("/^lo-crit\s(\S+)\s*$/", $buffer[9], $limits))
||(isset($buffer[10]) && preg_match("/^lo-crit\s(\S+)\s*$/", $buffer[10], $limits))
||(isset($buffer[11]) && preg_match("/^lo-crit\s(\S+)\s*$/", $buffer[11], $limits))) {
$dev->setMin($limits[1]);
}
if ((isset($buffer[8]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[8], $limits))
||(isset($buffer[9]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[9], $limits))
||(isset($buffer[10]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[10], $limits))
||(isset($buffer[11]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[11], $limits))) {
$dev->setMax($limits[1]);
}
}
if ($buffer[5] != "OK") $dev->setEvent($buffer[5]);
$this->mbinfo->setMbCurrent($dev);
}
}
}
 
/**
* get other information
*
* @return void
*/
private function _other()
{
foreach ($this->_lines as $line) {
$buffer = preg_split("/\s*\|\s*/", $line);
if (isset($buffer[1]) && $buffer[1] == "Compact"
&& $buffer[5] !== "Init"
&& $buffer[5] !== "Unknown"
&& $buffer[5] !== "NotAvailable") {
$dev = new SensorDevice();
$dev->setName($buffer[4].' ('.$buffer[2].')');
 
$buffer5s = preg_split("/\s+/", $buffer5 = $buffer[5]);
if (isset($buffer5s[1])) {
$value = hexdec($buffer5s[0]) & 0xff;
if ($buffer5s[1] === 'DiscreteEvt') {
$dev->setValue('0x'.dechex($value));
} elseif (($buffer5s[1] === 'DiscreteUnit') && ($value > 0)) {
$dev->setValue('0x'.dechex($value - 1));
} else {
$dev->setValue($buffer5);
}
} else {
$dev->setValue($buffer5);
}
$this->mbinfo->setMbOther($dev);
}
}
}
 
/**
* get the information
*
* @see PSI_Interface_Sensor::build()
*
* @return Void
*/
public function build()
{
$this->_temperature();
$this->_voltage();
$this->_fans();
$this->_power();
$this->_current();
$this->_other();
}
}
/web/acc/phpsysinfo/includes/mb/class.k8temp.inc.php
0,0 → 1,80
<?php
/**
* K8Temp sensor class, getting information from k8temp
*
* PHP version 5
*
* @category PHP
* @package PSI_Sensor
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class K8Temp extends Sensors
{
/**
* content to parse
*
* @var array
*/
private $_lines = array();
 
/**
* fill the private array
*/
public function __construct()
{
parent::__construct();
switch (defined('PSI_SENSOR_K8TEMP_ACCESS')?strtolower(PSI_SENSOR_K8TEMP_ACCESS):'command') {
case 'command':
$lines = "";
CommonFunctions::executeProgram('k8temp', '', $lines);
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
break;
case 'data':
if (CommonFunctions::rfts(PSI_APP_ROOT.'/data/k8temp.txt', $lines)) {
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
}
break;
default:
$this->error->addConfigError('__construct()', '[sensor_k8temp] ACCESS');
break;
}
}
 
/**
* get temperature information
*
* @return void
*/
private function _temperature()
{
foreach ($this->_lines as $line) {
if (preg_match('/(.*):\s*(\d*)/', $line, $data)) {
if ($data[2] > 0) {
$dev = new SensorDevice();
$dev->setName($data[1]);
// $dev->setMax('70.0');
if ($data[2] < 250) {
$dev->setValue($data[2]);
}
$this->mbinfo->setMbTemp($dev);
}
}
}
}
 
/**
* get the information
*
* @see PSI_Interface_Sensor::build()
*
* @return Void
*/
public function build()
{
$this->_temperature();
}
}
/web/acc/phpsysinfo/includes/mb/class.lmsensors.inc.php
1,175 → 1,419
<?php
<?php
/**
* lmsensor sensor class, getting information from lmsensor
*
* PHP version 5
*
* @category PHP
* @package PSI_Sensor
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class LMSensors extends Sensors
{
/**
* content to parse
*
* @var array
*/
private $_lines = array();
 
// phpSysInfo - A PHP System Information Script
// http://phpsysinfo.sourceforge.net/
/**
* fill the private content var through command or data access
*/
public function __construct()
{
parent::__construct();
$lines = "";
switch (defined('PSI_SENSOR_LMSENSORS_ACCESS')?strtolower(PSI_SENSOR_LMSENSORS_ACCESS):'command') {
case 'command':
CommonFunctions::executeProgram("sensors", "", $lines);
break;
case 'data':
CommonFunctions::rfts(PSI_APP_ROOT.'/data/lmsensors.txt', $lines);
break;
default:
$this->error->addConfigError('__construct()', '[sensor_lmsensors] ACCESS');
break;
}
 
// 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.
if (trim($lines) !== "") {
$lines = str_replace(":\n", ":", $lines);
$lines = str_replace("\n\n", "\n", $lines);
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
}
}
 
// 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.
/**
* get temperature information
*
* @return void
*/
private function _temperature()
{
$applesmc = false;
$sname = '';
foreach ($this->_lines as $line) {
if ((trim($line) !== "") && (strpos($line, ':') === false)) {
//$applesmc = preg_match("/^applesmc-/", $line);
$sname = trim($line);
$applesmc = ($sname === "applesmc-isa-0300");
if (preg_match('/^([^-]+)-/', $sname, $snamebuf)) {
$sname = ' ('.$snamebuf[1].')';
} else {
$sname = '';
}
}
$data = array();
if (preg_match("/^(.+):(.+).C\s*\((.+)=(.+).C,(.+)=(.+).C\)(.*)\)/", $line, $data)) {
;
} elseif (preg_match("/^(.+):(.+).C\s*\((.+)=(.+).C,(.+)=(.+).C\)(.*)/", $line, $data)) {
;
} elseif (preg_match("/^(.+):(.+).C\s*\((.+)=(.+).C\)(.*)/", $line, $data)) {
;
} elseif (preg_match("/^(.+):(.+).C\s*\(/", $line, $data)) {
;
} else {
preg_match("/^(.+):(.+).C$/", $line, $data);
}
if (count($data)>2) {
foreach ($data as $key=>$value) {
if (preg_match("/^\+?(-?[0-9\.]+).?$/", trim($value), $newvalue)) {
$data[$key] = 0+trim($newvalue[1]);
} else {
$data[$key] = trim($value);
}
}
if ($applesmc && (strlen($data[1]) == 4)) {
if ($data[1][0] == "T") {
if ($data[1][1] == "A") {
$data[1] = $data[1] . " Ambient";
} elseif ($data[1][1] == "B") {
$data[1] = $data[1] . " Battery";
} elseif ($data[1][1] == "C") {
$data[1] = $data[1] . " CPU";
} elseif ($data[1][1] == "G") {
$data[1] = $data[1] . " GPU";
} elseif ($data[1][1] == "H") {
$data[1] = $data[1] . " Harddisk Bay";
} elseif ($data[1][1] == "h") {
$data[1] = $data[1] . " Heatpipe";
} elseif ($data[1][1] == "L") {
$data[1] = $data[1] . " LCD";
} elseif ($data[1][1] == "M") {
$data[1] = $data[1] . " Memory";
} elseif ($data[1][1] == "m") {
$data[1] = $data[1] . " Memory Contr.";
} elseif ($data[1][1] == "N") {
$data[1] = $data[1] . " Northbridge";
} elseif ($data[1][1] == "O") {
$data[1] = $data[1] . " Optical Drive";
} elseif ($data[1][1] == "p") {
$data[1] = $data[1] . " Power supply";
} elseif ($data[1][1] == "S") {
$data[1] = $data[1] . " Slot";
} elseif ($data[1][1] == "s") {
$data[1] = $data[1] . " Slot";
} elseif ($data[1][1] == "W") {
$data[1] = $data[1] . " Airport";
}
 
// 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.
if ($data[1][3] == "H") {
$data[1] = $data[1] . " Heatsink";
} elseif ($data[1][3] == "P") {
$data[1] = $data[1] . " Proximity";
} elseif ($data[1][3] == "D") {
$data[1] = $data[1] . " Die";
}
}
}
 
// $Id: class.lmsensors.inc.php,v 1.19 2007/02/18 19:11:31 bigmichi1 Exp $
if (!defined('IN_PHPSYSINFO')) {
die("No Hacking");
}
$dev = new SensorDevice();
$dev->setName($data[1].$sname);
$dev->setValue($data[2]);
if (isset($data[6]) && $data[2] <= $data[6]) {
$dev->setMax(max($data[4], $data[6]));
} elseif (isset($data[4]) && $data[2] <= $data[4]) {
$dev->setMax($data[4]);
}
if (preg_match("/\sALARM\s*$/", $line) || preg_match("/\sALARM\s+sensor\s+=/", $line)) {
$dev->setEvent("Alarm");
}
$this->mbinfo->setMbTemp($dev);
}
}
}
 
require_once(APP_ROOT . "/includes/common_functions.php");
 
class mbinfo {
var $lines;
 
function mbinfo() {
$lines = execute_program("sensors", "");
// Martijn Stolk: Dirty fix for misinterpreted output of sensors,
// where info could come on next line when the label is too long.
$lines = str_replace(":\n", ":", $lines);
$lines = str_replace("\n\n", "\n", $lines);
$this->lines = explode("\n", $lines);
}
function temperature() {
$ar_buf = array();
$results = array();
 
$sensors_value = $this->lines;
 
foreach($sensors_value as $line) {
$data = array();
if (ereg("(.*):(.*)\((.*)=(.*),(.*)=(.*)\)(.*)", $line, $data)) ;
elseif (ereg("(.*):(.*)\((.*)=(.*)\)(.*)", $line, $data)) ;
else (ereg("(.*):(.*)", $line, $data));
if (count($data) > 1) {
$temp = substr(trim($data[2]), -1);
switch ($temp) {
case "C";
case "F":
array_push($ar_buf, $line);
break;
/**
* get fan information
*
* @return void
*/
private function _fans()
{
$sname = '';
foreach ($this->_lines as $line) {
if ((trim($line) !== "") && (strpos($line, ':') === false)) {
$sname = trim($line);
if (preg_match('/^([^-]+)-/', $sname, $snamebuf)) {
$sname = ' ('.$snamebuf[1].')';
} else {
$sname = '';
}
}
$data = array();
if (preg_match("/^(.+):(.+) RPM\s*\((.+)=(.+) RPM,(.+)=(.+)\)(.*)\)/", $line, $data)) {
;
} elseif (preg_match("/^(.+):(.+) RPM\s*\((.+)=(.+) RPM,(.+)=(.+)\)(.*)/", $line, $data)) {
;
} elseif (preg_match("/^(.+):(.+) RPM\s*\((.+)=(.+) RPM\)(.*)/", $line, $data)) {
;
} elseif (preg_match("/^(.+):(.+) RPM\s*\(/", $line, $data)) {
;
} else {
preg_match("/^(.+):(.+) RPM$/", $line, $data);
}
if (count($data)>2) {
foreach ($data as $key=>$value) {
if (preg_match("/^\+?(-?[0-9\.]+).?$/", trim($value), $newvalue)) {
$data[$key] = 0+trim($newvalue[1]);
} else {
$data[$key] = trim($value);
}
}
$dev = new SensorDevice();
$dev->setName($data[1].$sname);
$dev->setValue(trim($data[2]));
if (isset($data[4])) {
$dev->setMin(trim($data[4]));
}
if (preg_match("/\sALARM\s*$/", $line)) {
$dev->setEvent("Alarm");
}
$this->mbinfo->setMbFan($dev);
}
}
}
}
 
$i = 0;
foreach($ar_buf as $line) {
unset($data);
if (ereg("(.*):(.*).C[ ]*\((.*)=(.*).C,(.*)=(.*).C\)(.*)\)", $line, $data)) ;
elseif (ereg("(.*):(.*).C[ ]*\((.*)=(.*).C,(.*)=(.*).C\)(.*)", $line, $data)) ;
elseif (ereg("(.*):(.*).C[ ]*\((.*)=(.*).C\)(.*)", $line, $data)) ;
else (ereg("(.*):(.*).C", $line, $data));
/**
* get voltage information
*
* @return void
*/
private function _voltage()
{
$sname = '';
foreach ($this->_lines as $line) {
if ((trim($line) !== "") && (strpos($line, ':') === false)) {
$sname = trim($line);
if (preg_match('/^([^-]+)-/', $sname, $snamebuf)) {
$sname = ' ('.$snamebuf[1].')';
} else {
$sname = '';
}
}
$data = array();
if (preg_match("/^(.+):(.+) V\s*\((.+)=(.+) V,(.+)=(.+) V\)(.*)\)/", $line, $data)) {
;
} elseif (preg_match("/^(.+):(.+) V\s*\((.+)=(.+) V,(.+)=(.+) V\)(.*)/", $line, $data)) {
;
} elseif (preg_match("/^(.+):(.+) V\s*\(/", $line, $data)) {
;
} else {
preg_match("/^(.+):(.+) V$/", $line, $data);
}
 
$results[$i]['label'] = $data[1];
$results[$i]['value'] = trim($data[2]);
if ( isset( $data[6] ) && trim( $data[2] ) > trim( $data[6] ) ) {
$results[$i]['limit'] = "+75";
$results[$i]['perce'] = "+75";
} else {
$results[$i]['limit'] = isset($data[4]) ? trim($data[4]) : "+75";
$results[$i]['perce'] = isset($data[6]) ? trim($data[6]) : "+75";
}
if ($results[$i]['limit'] < $results[$i]['perce']) {
$results[$i]['limit'] = $results[$i]['perce'];
}
$i++;
if (count($data)>2) {
foreach ($data as $key=>$value) {
if (preg_match("/^\+?(-?[0-9\.]+)$/", trim($value), $newvalue)) {
$data[$key] = 0+trim($newvalue[1]);
} else {
$data[$key] = trim($value);
}
}
$dev = new SensorDevice();
$dev->setName($data[1].$sname);
$dev->setValue($data[2]);
if (isset($data[4])) {
$dev->setMin($data[4]);
}
if (isset($data[6])) {
$dev->setMax($data[6]);
}
if (preg_match("/\sALARM\s*$/", $line)) {
$dev->setEvent("Alarm");
}
$this->mbinfo->setMbVolt($dev);
}
}
}
 
asort($results);
return array_values($results);
}
/**
* get power information
*
* @return void
*/
private function _power()
{
$sname = '';
foreach ($this->_lines as $line) {
if ((trim($line) !== "") && (strpos($line, ':') === false)) {
$sname = trim($line);
if (preg_match('/^([^-]+)-/', $sname, $snamebuf)) {
$sname = ' ('.$snamebuf[1].')';
} else {
$sname = '';
}
}
$data = array();
/* not tested yet
if (preg_match("/^(.+):(.+) W\s*\((.+)=(.+) W,(.+)=(.+) W\)(.*)\)/", $line, $data)) {
;
} elseif (preg_match("/^(.+):(.+) W\s*\((.+)=(.+) W,(.+)=(.+) W\)(.*)/", $line, $data)) {
;
} else
*/
if (preg_match("/^(.+):(.+) W\s*\((.+)=(.+) W\)(.*)/", $line, $data)) {
;
} elseif (preg_match("/^(.+):(.+) W\s*\(/", $line, $data)) {
;
} else {
preg_match("/^(.+):(.+) W$/", $line, $data);
}
if (count($data)>2) {
foreach ($data as $key=>$value) {
if (preg_match("/^\+?(-?[0-9\.]+).?$/", trim($value), $newvalue)) {
$data[$key] = 0+trim($newvalue[1]);
} else {
$data[$key] = trim($value);
}
}
$dev = new SensorDevice();
$dev->setName($data[1].$sname);
$dev->setValue($data[2]);
 
function fans() {
$ar_buf = array();
$results = array();
 
$sensors_value = $this->lines;
 
foreach($sensors_value as $line) {
$data = array();
if (ereg("(.*):(.*)\((.*)=(.*),(.*)=(.*)\)(.*)", $line, $data));
elseif (ereg("(.*):(.*)\((.*)=(.*)\)(.*)", $line, $data));
else ereg("(.*):(.*)", $line, $data);
 
if (count($data) > 1) {
$temp = explode(" ", trim($data[2]));
if (count($temp) == 1)
$temp = explode("\xb0", trim($data[2]));
if(isset($temp[1])) {
switch ($temp[1]) {
case "RPM":
array_push($ar_buf, $line);
break;
}
}
}
/* not tested yet
if (isset($data[6]) && $data[2] <= $data[6]) {
$dev->setMax(max($data[4], $data[6]));
} else
*/
if (isset($data[4]) && $data[2] <= $data[4]) {
$dev->setMax($data[4]);
}
if (preg_match("/\sALARM\s*$/", $line)) {
$dev->setEvent("Alarm");
}
$this->mbinfo->setMbPower($dev);
}
}
}
 
$i = 0;
foreach($ar_buf as $line) {
unset($data);
if (ereg("(.*):(.*) RPM \((.*)=(.*) RPM,(.*)=(.*)\)(.*)\)", $line, $data));
elseif (ereg("(.*):(.*) RPM \((.*)=(.*) RPM,(.*)=(.*)\)(.*)", $line, $data));
elseif (ereg("(.*):(.*) RPM \((.*)=(.*) RPM\)(.*)", $line, $data));
else ereg("(.*):(.*) RPM", $line, $data);
 
$results[$i]['label'] = trim($data[1]);
$results[$i]['value'] = trim($data[2]);
$results[$i]['min'] = isset($data[4]) ? trim($data[4]) : 0;
$i++;
/**
* get current information
*
* @return void
*/
private function _current()
{
$sname = '';
foreach ($this->_lines as $line) {
if ((trim($line) !== "") && (strpos($line, ':') === false)) {
$sname = trim($line);
if (preg_match('/^([^-]+)-/', $sname, $snamebuf)) {
$sname = ' ('.$snamebuf[1].')';
} else {
$sname = '';
}
}
$data = array();
if (preg_match("/^(.+):(.+) A\s*\((.+)=(.+) A,(.+)=(.+) A\)(.*)\)/", $line, $data)) {
;
} elseif (preg_match("/^(.+):(.+) A\s*\((.+)=(.+) A,(.+)=(.+) A\)(.*)/", $line, $data)) {
;
} elseif (preg_match("/^(.+):(.+) A\s*\(/", $line, $data)) {
;
} else {
preg_match("/^(.+):(.+) A$/", $line, $data);
}
if (count($data)>2) {
foreach ($data as $key=>$value) {
if (preg_match("/^\+?([0-9\.]+).?$/", trim($value), $newvalue)) {
$data[$key] = trim($newvalue[1]);
} else {
$data[$key] = trim($value);
}
}
$dev = new SensorDevice();
$dev->setName($data[1].$sname);
$dev->setValue($data[2]);
if (isset($data[4])) {
$dev->setMin($data[4]);
}
if (isset($data[6])) {
$dev->setMax($data[6]);
}
if (preg_match("/\sALARM\s*$/", $line)) {
$dev->setEvent("Alarm");
}
$this->mbinfo->setMbCurrent($dev);
}
}
}
 
asort($results);
return array_values($results);
}
 
function voltage() {
$ar_buf = array();
$results = array();
 
$sensors_value = $this->lines;
 
foreach($sensors_value as $line) {
$data = array();
if (ereg("(.*):(.*)\((.*)=(.*),(.*)=(.*)\)(.*)", $line, $data));
else ereg("(.*):(.*)", $line, $data);
if (count($data) > 1) {
$temp = explode(" ", trim($data[2]));
if (count($temp) == 1)
$temp = explode("\xb0", trim($data[2]));
if (isset($temp[1])) {
switch ($temp[1]) {
case "V":
array_push($ar_buf, $line);
break;
}
/**
* get other information
*
* @return void
*/
private function _other()
{
$sname = '';
foreach ($this->_lines as $line) {
if ((trim($line) !== "") && (strpos($line, ':') === false)) {
$sname = trim($line);
if (preg_match('/^([^-]+)-/', $sname, $snamebuf)) {
$sname = ' ('.$snamebuf[1].')';
} else {
$sname = '';
}
}
$data = array();
preg_match("/^(.+):\s*([^\-\+\d\s].+)$/", $line, $data);
if ((count($data)>2) && ($data[1]!=="Adapter")) {
$dev = new SensorDevice();
$dev->setName($data[1].$sname);
if (preg_match("/(.*\s*)ALARM\s*$/", $data[2], $aldata)) {
$dev->setEvent("Alarm");
if ((count($aldata)>1) && trim($aldata[1]!=="")) {
$dev->setValue(trim($aldata[1]));
} else {
$dev->setValue($data[2]);
}
} else {
$dev->setValue($data[2]);
}
$this->mbinfo->setMbOther($dev);
}
}
}
}
 
$i = 0;
foreach($ar_buf as $line) {
unset($data);
if (ereg("(.*):(.*) V \((.*)=(.*) V,(.*)=(.*) V\)(.*)\)", $line, $data));
elseif (ereg("(.*):(.*) V \((.*)=(.*) V,(.*)=(.*) V\)(.*)", $line, $data));
else ereg("(.*):(.*) V$", $line, $data);
if(isset($data[1])) {
$results[$i]['label'] = trim($data[1]);
$results[$i]['value'] = trim($data[2]);
$results[$i]['min'] = isset($data[4]) ? trim($data[4]) : 0;
$results[$i]['max'] = isset($data[6]) ? trim($data[6]) : 0;
$i++;
}
/**
* get the information
*
* @see PSI_Interface_Sensor::build()
*
* @return Void
*/
public function build()
{
$this->_temperature();
$this->_voltage();
$this->_fans();
$this->_power();
$this->_current();
$this->_other();
}
return $results;
}
}
 
?>
/web/acc/phpsysinfo/includes/mb/class.mbm5.inc.php
1,79 → 1,119
<?php
//
// 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.mbm5.inc.php,v 1.7 2007/02/18 19:11:31 bigmichi1 Exp $
<?php
/**
* MBM5 sensor class, getting information from Motherboard Monitor 5 information retrival through csv file
*
* PHP version 5
*
* @category PHP
* @package PSI_Sensor
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class MBM5 extends Sensors
{
/**
* array with the names of the labels
*
* @var array
*/
private $_buf_label = array();
 
class mbinfo {
var $buf_label;
var $buf_value;
/**
* array withe the values
*
* @var array
*/
private $_buf_value = array();
 
function mbinfo() {
$buffer = rfts( APP_ROOT . "/data/MBM5.csv" );
if( strpos( $buffer, ";") === false ) {
$delim = ",";
} else {
$delim = ";";
}
$buffer = explode( "\n", $buffer );
$this->buf_label = explode( $delim, $buffer[0] );
$this->buf_value = explode( $delim, $buffer[1] );
}
function temperature() {
$results = array();
$intCount = 0;
for( $intPosi = 3; $intPosi < 6; $intPosi++ ) {
$results[$intCount]['label'] = $this->buf_label[$intPosi];
$results[$intCount]['value'] = $this->buf_value[$intPosi];
$results[$intCount]['limit'] = '70.0';
$intCount++;
}
return $results;
}
function fans() {
$results = array();
$intCount = 0;
for( $intPosi = 13; $intPosi < 16; $intPosi++ ) {
$results[$intCount]['label'] = $this->buf_label[$intPosi];
$results[$intCount]['value'] = $this->buf_value[$intPosi];
$results[$intCount]['min'] = '3000';
$intCount++;
}
return $results;
}
function voltage() {
$results = array();
$intCount = 0;
for( $intPosi = 6; $intPosi < 13; $intPosi++ ) {
$results[$intCount]['label'] = $this->buf_label[$intPosi];
$results[$intCount]['value'] = $this->buf_value[$intPosi];
$results[$intCount]['min'] = '0.00';
$results[$intCount]['max'] = '0.00';
$intCount++;
}
return $results;
}
}
/**
* read the MBM5.csv file and fill the private arrays
*/
public function __construct()
{
parent::__construct();
$delim = "/;/";
CommonFunctions::rfts(PSI_APP_ROOT."/data/MBM5.csv", $buffer);
if (strpos($buffer, ";") === false) {
$delim = "/,/";
}
$buffer = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
$this->_buf_label = preg_split($delim, substr($buffer[0], 0, -2), -1, PREG_SPLIT_NO_EMPTY);
$this->_buf_value = preg_split($delim, substr($buffer[1], 0, -2), -1, PREG_SPLIT_NO_EMPTY);
}
 
?>
/**
* get temperature information
*
* @return void
*/
private function _temperature()
{
for ($intPosi = 3; $intPosi < 6; $intPosi++) {
if ($this->_buf_value[$intPosi] == 0) {
continue;
}
preg_match("/([0-9\.])*/", str_replace(",", ".", $this->_buf_value[$intPosi]), $hits);
$dev = new SensorDevice();
$dev->setName($this->_buf_label[$intPosi]);
$dev->setValue($hits[0]);
// $dev->setMax(70);
$this->mbinfo->setMbTemp($dev);
}
}
 
/**
* get fan information
*
* @return void
*/
private function _fans()
{
for ($intPosi = 13; $intPosi < 16; $intPosi++) {
if (!isset($this->_buf_value[$intPosi])) {
continue;
}
preg_match("/([0-9\.])*/", str_replace(",", ".", $this->_buf_value[$intPosi]), $hits);
$dev = new SensorDevice();
$dev->setName($this->_buf_label[$intPosi]);
$dev->setValue($hits[0]);
// $dev->setMin(3000);
$this->mbinfo->setMbFan($dev);
}
}
 
/**
* get voltage information
*
* @return void
*/
private function _voltage()
{
for ($intPosi = 6; $intPosi < 13; $intPosi++) {
if ($this->_buf_value[$intPosi] == 0) {
continue;
}
preg_match("/([0-9\.])*/", str_replace(",", ".", $this->_buf_value[$intPosi]), $hits);
$dev = new SensorDevice();
$dev->setName($this->_buf_label[$intPosi]);
$dev->setValue($hits[0]);
$this->mbinfo->setMbVolt($dev);
}
}
 
/**
* get the information
*
* @see PSI_Interface_Sensor::build()
*
* @return Void
*/
public function build()
{
$this->_fans();
$this->_temperature();
$this->_voltage();
}
}
/web/acc/phpsysinfo/includes/mb/class.mbmon.inc.php
1,99 → 1,132
<?php
/**
* mbmon sensor class, getting information from mbmon
*
* PHP version 5
*
* @category PHP
* @package PSI_Sensor
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class MBMon extends Sensors
{
/**
* content to parse
*
* @var array
*/
private $_lines = array();
 
// phpSysInfo - A PHP System Information Script
// http://phpsysinfo.sourceforge.net/
/**
* fill the private content var through tcp, command or data access
*/
public function __construct()
{
parent::__construct();
switch (defined('PSI_SENSOR_MBMON_ACCESS')?strtolower(PSI_SENSOR_MBMON_ACCESS):'command') {
case 'tcp':
$fp = fsockopen("localhost", 411, $errno, $errstr, 5);
if ($fp) {
$lines = "";
while (!feof($fp)) {
$lines .= fread($fp, 1024);
}
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
} else {
$this->error->addError("fsockopen()", $errno." ".$errstr);
}
break;
case 'command':
CommonFunctions::executeProgram('mbmon', '-c 1 -r', $lines, PSI_DEBUG);
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
break;
case 'data':
if (CommonFunctions::rfts(PSI_APP_ROOT.'/data/mbmon.txt', $lines)) {
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
}
break;
default:
$this->error->addConfigError('__construct()', '[sensor_mbmon] ACCESS');
break;
}
}
 
// 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.
 
// This class was created by Z. Frombach ( zoltan at frombach dot com )
 
// $Id: class.mbmon.inc.php,v 1.5 2007/02/18 19:11:31 bigmichi1 Exp $
 
class mbinfo {
var $lines;
 
function temperature() {
$results = array();
 
if (!isset($this->lines) ) {
$this->lines = explode("\n", execute_program('mbmon', '-c 1 -r'));
}
 
$i = 0;
foreach($this->lines as $line) {
if (preg_match('/^(TEMP\d*)\s*:\s*(.*)$/D', $line, $data)) {
if ($data[2]<>'0') {
$results[$i]['label'] = $data[1];
$results[$i]['limit'] = '70.0';
if($data[2] > 250) {
$results[$i]['value'] = 0;
$results[$i]['percent'] = 0;
} else {
$results[$i]['value'] = $data[2];
$results[$i]['percent'] = $results[$i]['value'] * 100 / $results[$i]['limit'];
}
$i++;
/**
* get temperature information
*
* @return void
*/
private function _temperature()
{
foreach ($this->_lines as $line) {
if (preg_match('/^(TEMP\d*)\s*:\s*(.*)$/D', $line, $data)) {
if ($data[2] <> '0') {
$dev = new SensorDevice();
$dev->setName($data[1]);
// $dev->setMax(70);
if ($data[2] < 250) {
$dev->setValue($data[2]);
}
$this->mbinfo->setMbTemp($dev);
}
}
}
}
}
return $results;
}
 
function fans() {
$results = array();
 
if (!isset($this->lines) ) {
$this->lines = explode("\n", execute_program('mbmon', '-c 1 -r'));
}
 
$i = 0;
foreach($this->lines as $line) {
if (preg_match('/^(FAN\d*)\s*:\s*(.*)$/D', $line, $data)) {
if ($data[2]<>'0') {
$results[$i]['label'] = $data[1];
$results[$i]['value'] = $data[2];
$results[$i]['min'] = '3000';
$i++;
/**
* get fan information
*
* @return void
*/
private function _fans()
{
foreach ($this->_lines as $line) {
if (preg_match('/^(FAN\d*)\s*:\s*(.*)$/D', $line, $data)) {
if ($data[2] <> '0') {
$dev = new SensorDevice();
$dev->setName($data[1]);
$dev->setValue($data[2]);
// $dev->setMax(3000);
$this->mbinfo->setMbFan($dev);
}
}
}
}
}
return $results;
}
 
function voltage() {
$results = array();
 
if (!isset($this->lines) ) {
$this->lines = explode("\n", execute_program('mbmon', '-c 1 -r'));
}
 
$i = 0;
foreach($this->lines as $line) {
if (preg_match('/^(V.*)\s*:\s*(.*)$/D', $line, $data)) {
if ($data[2]<>'+0.00') {
$results[$i]['label'] = $data[1];
$results[$i]['value'] = $data[2];
$results[$i]['min'] = '0.00';
$results[$i]['max'] = '0.00';
$i++;
/**
* get voltage information
*
* @return void
*/
private function _voltage()
{
foreach ($this->_lines as $line) {
if (preg_match('/^(V.*)\s*:\s*(.*)$/D', $line, $data)) {
if ($data[2] <> '+0.00') {
$dev = new SensorDevice();
$dev->setName($data[1]);
$dev->setValue($data[2]);
$this->mbinfo->setMbVolt($dev);
}
}
}
}
}
 
return $results;
}
/**
* get the information
*
* @see PSI_Interface_Sensor::build()
*
* @return void
*/
public function build()
{
$this->_temperature();
$this->_voltage();
$this->_fans();
}
}
 
?>
/web/acc/phpsysinfo/includes/mb/class.ohm.inc.php
0,0 → 1,122
<?php
/**
* Open Hardware Monitor sensor class, getting information from Open Hardware Monitor
*
* PHP version 5
*
* @category PHP
* @package PSI_Sensor
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
* @copyright 2014 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class OHM extends Sensors
{
/**
* holds the COM object that we pull all the WMI data from
*
* @var Object
*/
private $_buf = array();
 
/**
* fill the private content var
*/
public function __construct()
{
parent::__construct();
$_wmi = null;
try {
// initialize the wmi object
$objLocator = new COM('WbemScripting.SWbemLocator');
$_wmi = $objLocator->ConnectServer('', 'root\OpenHardwareMonitor');
} catch (Exception $e) {
$this->error->addError("WMI connect error", "PhpSysInfo can not connect to the WMI interface for OpenHardwareMonitor data.");
}
if ($_wmi) {
$tmpbuf = CommonFunctions::getWMI($_wmi, 'Sensor', array('Parent', 'Name', 'SensorType', 'Value'));
if ($tmpbuf) foreach ($tmpbuf as $buffer) {
if (!isset($this->_buf[$buffer['SensorType']]) || !isset($this->_buf[$buffer['SensorType']][$buffer['Parent'].' '.$buffer['Name']])) { // avoid duplicates
$this->_buf[$buffer['SensorType']][$buffer['Parent'].' '.$buffer['Name']] = $buffer['Value'];
}
}
}
}
 
/**
* get temperature information
*
* @return void
*/
private function _temperature()
{
if (isset($this->_buf['Temperature'])) foreach ($this->_buf['Temperature'] as $name=>$value) {
$dev = new SensorDevice();
$dev->setName($name);
$dev->setValue($value);
$this->mbinfo->setMbTemp($dev);
}
}
 
/**
* get voltage information
*
* @return void
*/
private function _voltage()
{
if (isset($this->_buf['Voltage'])) foreach ($this->_buf['Voltage'] as $name=>$value) {
$dev = new SensorDevice();
$dev->setName($name);
$dev->setValue($value);
$this->mbinfo->setMbVolt($dev);
}
}
 
/**
* get fan information
*
* @return void
*/
private function _fans()
{
if (isset($this->_buf['Fan'])) foreach ($this->_buf['Fan'] as $name=>$value) {
$dev = new SensorDevice();
$dev->setName($name);
$dev->setValue($value);
$this->mbinfo->setMbFan($dev);
}
}
 
/**
* get power information
*
* @return void
*/
private function _power()
{
if (isset($this->_buf['Power'])) foreach ($this->_buf['Power'] as $name=>$value) {
$dev = new SensorDevice();
$dev->setName($name);
$dev->setValue($value);
$this->mbinfo->setMbPower($dev);
}
}
 
/**
* get the information
*
* @see PSI_Interface_Sensor::build()
*
* @return Void
*/
public function build()
{
$this->_temperature();
$this->_voltage();
$this->_fans();
$this->_power();
}
}
/web/acc/phpsysinfo/includes/mb/class.pitemp.inc.php
0,0 → 1,64
<?php
/**
* pitemp sensor class
*
* PHP version 5
*
* @category PHP
* @package PSI_Sensor
* @author Marc Hillesheim <hawkeyexp@gmail.com>
* @copyright 2012 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class PiTemp extends Sensors
{
private function _temperature()
{
$temp = null;
$temp_max = null;
if (!CommonFunctions::rfts('/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input', $temp, 1, 4096, false)) { // Not Banana Pi
CommonFunctions::rfts('/sys/class/thermal/thermal_zone0/temp', $temp, 1);
CommonFunctions::rfts('/sys/class/thermal/thermal_zone0/trip_point_0_temp', $temp_max, 1, 4096, PSI_DEBUG);
}
if (!is_null($temp) && (($temp = trim($temp)) != "")) {
$dev = new SensorDevice();
$dev->setName("CPU 1");
$dev->setValue($temp / 1000);
if (!is_null($temp_max) && (($temp_max = trim($temp_max)) != "") && ($temp_max > 0)) {
$dev->setMax($temp_max / 1000);
}
$this->mbinfo->setMbTemp($dev);
}
}
 
private function _voltage()
{
$volt = null;
if (CommonFunctions::rfts('/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/voltage_now', $volt, 1, 4096, false) && !is_null($volt) && (($volt = trim($volt)) != "")) { // Banana Pi
$dev = new SensorDevice();
$dev->setName("Voltage 1");
$dev->setValue($volt / 1000000);
$this->mbinfo->setMbVolt($dev);
}
}
 
private function _current()
{
$current = null;
if (CommonFunctions::rfts('/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/current_now', $current, 1, 4096, false) && !is_null($current) && (($current = trim($current)) != "")) { // Banana Pi
$dev = new SensorDevice();
$dev->setName("Current 1");
$dev->setValue($current / 1000000);
$this->mbinfo->setMbCurrent($dev);
}
}
 
public function build()
{
$this->_temperature();
$this->_voltage();
$this->_current();
}
}
/web/acc/phpsysinfo/includes/mb/class.qtssnmp.inc.php
0,0 → 1,81
<?php
/**
* qtstemp sensor class, getting hardware temperature information through snmpwalk
*
* PHP version 5
*
* @category PHP
* @package PSI_Sensor
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
* @copyright 2016 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class QTSsnmp extends Sensors
{
/**
* get temperature information
*
* @return void
*/
private function _temperature()
{
if (CommonFunctions::executeProgram("snmpwalk", "-Ona -c public -v 1 -t ".PSI_SNMP_TIMEOUT_INT." -r ".PSI_SNMP_RETRY_INT." 127.0.0.1 .1.3.6.1.4.1.24681.1.2.5.0", $buffer, PSI_DEBUG)
&& preg_match('/^[\.\d]+ = STRING:\s\"?(\d+)\sC/', $buffer, $data)) {
$dev = new SensorDevice();
$dev->setName("CPU");
$dev->setValue($data[1]);
$this->mbinfo->setMbTemp($dev);
}
 
if (CommonFunctions::executeProgram("snmpwalk", "-Ona -c public -v 1 -t ".PSI_SNMP_TIMEOUT_INT." -r ".PSI_SNMP_RETRY_INT." 127.0.0.1 .1.3.6.1.4.1.24681.1.2.6.0", $buffer, PSI_DEBUG)
&& preg_match('/^[\.\d]+ = STRING:\s\"?(\d+)\sC/', $buffer, $data)) {
$dev = new SensorDevice();
$dev->setName("System");
$dev->setValue($data[1]);
$this->mbinfo->setMbTemp($dev);
}
 
if (CommonFunctions::executeProgram("snmpwalk", "-Ona -c public -v 1 -t ".PSI_SNMP_TIMEOUT_INT." -r ".PSI_SNMP_RETRY_INT." 127.0.0.1 .1.3.6.1.4.1.24681.1.2.11.1.3", $buffer, PSI_DEBUG)) {
$lines = preg_split('/\r?\n/', $buffer);
foreach ($lines as $line) if (preg_match('/^[\.\d]+\.(\d+) = STRING:\s\"?(\d+)\sC/', $line, $data)) {
$dev = new SensorDevice();
$dev->setName("HDD ".$data[1]);
$dev->setValue($data[2]);
$this->mbinfo->setMbTemp($dev);
}
}
}
 
/**
* get fan information
*
* @return void
*/
private function _fans()
{
if (CommonFunctions::executeProgram("snmpwalk", "-Ona -c public -v 1 -t ".PSI_SNMP_TIMEOUT_INT." -r ".PSI_SNMP_RETRY_INT." 127.0.0.1 .1.3.6.1.4.1.24681.1.2.15.1.3", $buffer, PSI_DEBUG)) {
$lines = preg_split('/\r?\n/', $buffer);
foreach ($lines as $line) if (preg_match('/^[\.\d]+\.(\d+) = STRING:\s\"?(\d+)\sRPM/', $line, $data)) {
$dev = new SensorDevice();
$dev->setName("Fan ".$data[1]);
$dev->setValue($data[2]);
$this->mbinfo->setMbFan($dev);
}
}
}
 
/**
* get the information
*
* @see PSI_Interface_Sensor::build()
*
* @return Void
*/
public function build()
{
$this->_temperature();
$this->_fans();
}
}
/web/acc/phpsysinfo/includes/mb/class.sensors.inc.php
0,0 → 1,64
<?php
/**
* Basic OS Class
*
* PHP version 5
*
* @category PHP
* @package PSI sensors class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.sensors.inc.php 661 2012-08-27 11:26:39Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* Basic OS functions for all OS classes
*
* @category PHP
* @package PSI sensors class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
abstract class Sensors implements PSI_Interface_Sensor
{
/**
* object for error handling
*
* @var PSI_Error
*/
protected $error;
 
/**
* object for the information
*
* @var MBInfo
*/
protected $mbinfo;
 
/**
* build the global Error object
*/
public function __construct()
{
$this->error = PSI_Error::singleton();
$this->mbinfo = new MBInfo();
}
 
/**
* get the filled or unfilled (with default values) MBInfo object
*
* @see PSI_Interface_Sensor::getMBInfo()
*
* @return MBInfo
*/
final public function getMBInfo()
{
$this->build();
 
return $this->mbinfo;
}
}
/web/acc/phpsysinfo/includes/mb/class.speedfan.inc.php
0,0 → 1,126
<?php
/**
* speedfan sensor class, getting hardware information through SpeedFanGet
*
* PHP version 5
*
* @category PHP
* @package PSI_Sensor
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
* @copyright 2016 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class SpeedFan extends Sensors
{
/*
* variable, which holds the content of the command
* @var array
*/
private $_filecontent = array();
 
public function __construct()
{
parent::__construct();
switch (defined('PSI_SENSOR_SPEEDFAN_ACCESS')?strtolower(PSI_SENSOR_SPEEDFAN_ACCESS):'command') {
case 'command':
if (CommonFunctions::executeProgram("SpeedFanGet.exe", "", $buffer, PSI_DEBUG) && (strlen($buffer) > 0)) {
if (preg_match("/^Temperatures:\s+(.+)$/m", $buffer, $out)) {
$this->_filecontent["temp"] = $out[1];
}
if (preg_match("/^Fans:\s+(.+)$/m", $buffer, $out)) {
$this->_filecontent["fans"] = $out[1];
}
if (preg_match("/^Voltages:\s+(.+)$/m", $buffer, $out)) {
$this->_filecontent["volt"] = $out[1];
}
}
break;
case 'data':
if (CommonFunctions::rfts(PSI_APP_ROOT.'/data/speedfan.txt', $buffer) && (strlen($buffer) > 0)) {
if (preg_match("/^Temperatures:\s+(.+)$/m", $buffer, $out)) {
$this->_filecontent["temp"] = $out[1];
}
if (preg_match("/^Fans:\s+(.+)$/m", $buffer, $out)) {
$this->_filecontent["fans"] = $out[1];
}
if (preg_match("/^Voltages:\s+(.+)$/m", $buffer, $out)) {
$this->_filecontent["volt"] = $out[1];
}
}
break;
default:
$this->error->addConfigError('__construct()', '[sensor_speedfan] ACCESS');
break;
}
}
 
/**
* get temperature information
*
* @return void
*/
private function _temperature()
{
if (isset($this->_filecontent["temp"]) && (trim($this->_filecontent["temp"]) !== "")) {
$values = preg_split("/ /", trim($this->_filecontent["temp"]));
foreach ($values as $id=>$value) {
$dev = new SensorDevice();
$dev->setName("temp".$id);
$dev->setValue($value);
$this->mbinfo->setMbTemp($dev);
}
}
}
 
/**
* get fan information
*
* @return void
*/
private function _fans()
{
if (isset($this->_filecontent["fans"]) && (trim($this->_filecontent["fans"]) !== "")) {
$values = preg_split("/ /", trim($this->_filecontent["fans"]));
foreach ($values as $id=>$value) {
$dev = new SensorDevice();
$dev->setName("fan".$id);
$dev->setValue($value);
$this->mbinfo->setMbFan($dev);
}
}
}
 
/**
* get voltage information
*
* @return void
*/
private function _voltage()
{
if (isset($this->_filecontent["volt"]) && (trim($this->_filecontent["volt"]) !== "")) {
$values = preg_split("/ /", trim($this->_filecontent["volt"]));
foreach ($values as $id=>$value) {
$dev = new SensorDevice();
$dev->setName("in".$id);
$dev->setValue($value);
$this->mbinfo->setMbVolt($dev);
}
}
}
 
/**
* get the information
*
* @see PSI_Interface_Sensor::build()
*
* @return Void
*/
public function build()
{
$this->_temperature();
$this->_fans();
$this->_voltage();
}
}
/web/acc/phpsysinfo/includes/mb/class.thermalzone.inc.php
0,0 → 1,139
<?php
/**
* Thermal Zone sensor class, getting information from Thermal Zone WMI class
*
* PHP version 5
*
* @category PHP
* @package PSI_Sensor
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
* @copyright 2014 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class ThermalZone extends Sensors
{
/**
* holds the COM object that we pull all the WMI data from
*
* @var Object
*/
private $_buf = array();
 
/**
* fill the private content var
*/
public function __construct()
{
parent::__construct();
if (PSI_OS == 'WINNT') {
$_wmi = null;
try {
// initialize the wmi object
$objLocator = new COM('WbemScripting.SWbemLocator');
$_wmi = $objLocator->ConnectServer('', 'root\WMI');
} catch (Exception $e) {
$this->error->addError("WMI connect error", "PhpSysInfo can not connect to the WMI interface for ThermalZone data.");
}
if ($_wmi) {
$this->_buf = CommonFunctions::getWMI($_wmi, 'MSAcpi_ThermalZoneTemperature', array('InstanceName', 'CriticalTripPoint', 'CurrentTemperature'));
}
}
}
 
/**
* get temperature information
*
* @return void
*/
private function _temperature()
{
if (PSI_OS == 'WINNT') {
if ($this->_buf) foreach ($this->_buf as $buffer) {
if (isset($buffer['CurrentTemperature']) && (($value = ($buffer['CurrentTemperature'] - 2732)/10) > -100)) {
$dev = new SensorDevice();
if (isset($buffer['InstanceName']) && preg_match("/([^\\\\ ]+)$/", $buffer['InstanceName'], $outbuf)) {
$dev->setName('ThermalZone '.$outbuf[1]);
} else {
$dev->setName('ThermalZone THM0_0');
}
$dev->setValue($value);
if (isset($buffer['CriticalTripPoint']) && (($maxvalue = ($buffer['CriticalTripPoint'] - 2732)/10) > 0)) {
$dev->setMax($maxvalue);
}
$this->mbinfo->setMbTemp($dev);
}
}
} else {
$notwas = true;
$thermalzones = glob('/sys/class/thermal/thermal_zone*/');
if (is_array($thermalzones) && (count($thermalzones) > 0)) foreach ($thermalzones as $thermalzone) {
$thermalzonetemp = $thermalzone.'temp';
$temp = null;
if (CommonFunctions::rfts($thermalzonetemp, $temp, 1, 4096, false) && !is_null($temp) && (($temp = trim($temp)) != "")) {
if ($temp >= 1000) {
$div = 1000;
} elseif ($temp >= 200) {
$div = 10;
} else {
$div = 1;
}
$temp = $temp / $div;
 
if ($temp > -40) {
$dev = new SensorDevice();
$dev->setValue($temp);
 
$temp_type = null;
if (CommonFunctions::rfts($thermalzone.'type', $temp_type, 1, 4096, false) && !is_null($temp_type) && (($temp_type = trim($temp_type)) != "")) {
$dev->setName($temp_type);
} else {
$dev->setName("ThermalZone");
}
 
$temp_max = null;
if (CommonFunctions::rfts($thermalzone.'trip_point_0_temp', $temp_max, 1, 4096, false) && !is_null($temp_max) && (($temp_max = trim($temp_max)) != "") && ($temp_max > -40)) {
$temp_max = $temp_max / $div;
if (($temp_max != 0) || ($temp != 0)) { // if non-zero values
$dev->setMax($temp_max);
$this->mbinfo->setMbTemp($dev);
}
} else {
$this->mbinfo->setMbTemp($dev);
}
$notwas = false;
}
}
}
if ($notwas) {
$thermalzones = glob('/proc/acpi/thermal_zone/TH*/temperature');
if (is_array($thermalzones) && (count($thermalzones) > 0)) foreach ($thermalzones as $thermalzone) {
$temp = null;
if (CommonFunctions::rfts($thermalzone, $temp, 1, 4096, false) && !is_null($temp) && (($temp = trim($temp)) != "")) {
$dev = new SensorDevice();
if (preg_match("/^\/proc\/acpi\/thermal_zone\/(.+)\/temperature$/", $thermalzone, $name)) {
$dev->setName("ThermalZone ".$name[1]);
} else {
$dev->setName("ThermalZone");
}
$dev->setValue(trim(substr($temp, 23, 4)));
$this->mbinfo->setMbTemp($dev);
}
}
}
}
}
 
/**
* get the information
*
* @see PSI_Interface_Sensor::build()
*
* @return Void
*/
public function build()
{
$this->_temperature();
}
}
/web/acc/phpsysinfo/includes/mb/class.thinkpad.inc.php
0,0 → 1,34
<?php
/**
* thinkpad sensor class, getting hardware temperature information and fan speed from /sys/devices/platform/thinkpad_hwmon/
*
* PHP version 5
*
* @category PHP
* @package PSI_Sensor
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
* @copyright 2017 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class Thinkpad extends Hwmon
{
/**
* get the information
*
* @see PSI_Interface_Sensor::build()
*
* @return Void
*/
public function build()
{
if (PSI_OS == 'Linux') {
$hwpaths = glob("/sys/devices/platform/thinkpad_hwmon/", GLOB_NOSORT);
if (is_array($hwpaths) && (count($hwpaths) == 1)) {
$this->_temperature($hwpaths[0]);
$this->_fans($hwpaths[0]);
}
}
}
}
/web/acc/phpsysinfo/includes/os/class.Linux.inc.php.default
File deleted
/web/acc/phpsysinfo/includes/os/class.HP-UX.inc.php
File deleted
/web/acc/phpsysinfo/includes/os/class.BSD.common.inc.php
File deleted
/web/acc/phpsysinfo/includes/os/class.parseProgs.inc.php
File deleted
/web/acc/phpsysinfo/includes/os/class.AIX.inc.php
0,0 → 1,362
<?php
/**
* IBM AIX System Class
*
* PHP version 5
*
* @category PHP
* @package PSI AIX OS class
* @author Krzysztof Paz (kpaz@gazeta.pl) based on HPUX of Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2011 Krzysztof Paz
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.AIX.inc.php 287 2009-06-26 12:11:59Z Krzysztof Paz, IBM POLSKA
* @link http://phpsysinfo.sourceforge.net
*/
/**
* IBM AIX sysinfo class
* get all the required information from IBM AIX system
*
* @category PHP
* @package PSI AIX OS class
* @author Krzysztof Paz (kpaz@gazeta.pl) based on Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2011 Krzysztof Paz
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class AIX extends OS
{
 
private $_aixdata = array();
 
/**
* Virtual Host Name
* @return void
*/
private function _hostname()
{
/* if (PSI_USE_VHOST === true) {
if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
} else {
if (CommonFunctions::executeProgram('hostname', '', $ret)) {
$this->sys->setHostname($ret);
}
} */
if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
 
}
 
/**
* IBM AIX Version
* @return void
*/
private function _kernel()
{
if (CommonFunctions::executeProgram('oslevel', '', $ret1) && CommonFunctions::executeProgram('oslevel', '-s', $ret2)) {
$this->sys->setKernel($ret1 . ' (' . $ret2 . ')');
}
}
 
/**
* UpTime
* time the system is running
* @return void
*/
private function _uptime()
{
if (CommonFunctions::executeProgram('uptime', '', $buf)) {
if (preg_match("/up (\d+) day[s]?,\s*(\d+):(\d+),/", $buf, $ar_buf)) {
$min = $ar_buf[3];
$hours = $ar_buf[2];
$days = $ar_buf[1];
$this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60);
}
}
}
 
/**
* Processor Load
* optionally create a loadbar
* @return void
*/
private function _loadavg()
{
if (CommonFunctions::executeProgram('uptime', '', $buf)) {
if (preg_match("/average: (.*), (.*), (.*)$/", $buf, $ar_buf)) {
$this->sys->setLoad($ar_buf[1].' '.$ar_buf[2].' '.$ar_buf[3]);
}
}
}
 
/**
* CPU information
* All of the tags here are highly architecture dependant
* @return void
*/
private function _cpuinfo()
{
$ncpu = 0;
$tcpu = "";
$vcpu = "";
$ccpu = "";
$scpu = "";
foreach ($this->readaixdata() as $line) {
if (preg_match("/^Number Of Processors:\s+(\d+)/", $line, $ar_buf)) {
$ncpu = $ar_buf[1];
}
if (preg_match("/^Processor Type:\s+(.+)/", $line, $ar_buf)) {
$tcpu = $ar_buf[1];
}
if (preg_match("/^Processor Version:\s+(.+)/", $line, $ar_buf)) {
$vcpu = $ar_buf[1];
}
if (preg_match("/^CPU Type:\s+(.+)/", $line, $ar_buf)) {
$ccpu = $ar_buf[1];
}
if (preg_match("/^Processor Clock Speed:\s+(\d+)\s/", $line, $ar_buf)) {
$scpu = $ar_buf[1];
}
}
for ($i = 0; $i < $ncpu; $i++) {
$dev = new CpuDevice();
if (trim($tcpu) != "") {
$cpu = trim($tcpu);
if (trim($vcpu) != "") $cpu .= " ".trim($vcpu);
if (trim($ccpu) != "") $cpu .= " ".trim($ccpu);
$dev->setModel($cpu);
}
if (trim($scpu) != "") {
$dev->setCpuSpeed(trim($scpu));
}
$this->sys->setCpus($dev);
}
}
 
/**
* PCI devices
* @return void
*/
private function _pci()
{
foreach ($this->readaixdata() as $line) {
if (preg_match("/^[\*\+]\s\S+\s+\S+\s+(.*PCI.*)/", $line, $ar_buf)) {
$dev = new HWDevice();
$dev->setName(trim($ar_buf[1]));
$this->sys->setPciDevices($dev);
}
}
}
 
/**
* IDE devices
* @return void
*/
private function _ide()
{
foreach ($this->readaixdata() as $line) {
if (preg_match("/^[\*\+]\s\S+\s+\S+\s+(.*IDE.*)/", $line, $ar_buf)) {
$dev = new HWDevice();
$dev->setName(trim($ar_buf[1]));
$this->sys->setIdeDevices($dev);
}
}
}
 
/**
* SCSI devices
* @return void
*/
private function _scsi()
{
foreach ($this->readaixdata() as $line) {
if (preg_match("/^[\*\+]\s\S+\s+\S+\s+(.*SCSI.*)/", $line, $ar_buf)) {
$dev = new HWDevice();
$dev->setName(trim($ar_buf[1]));
$this->sys->setScsiDevices($dev);
}
}
}
 
/**
* USB devices
* @return void
*/
private function _usb()
{
foreach ($this->readaixdata() as $line) {
if (preg_match("/^[\*\+]\s\S+\s+\S+\s+(.*USB.*)/", $line, $ar_buf)) {
$dev = new HWDevice();
$dev->setName(trim($ar_buf[1]));
$this->sys->setUsbDevices($dev);
}
}
}
 
/**
* Network devices
* includes also rx/tx bytes
* @return void
*/
private function _network()
{
if (CommonFunctions::executeProgram('netstat', '-ni | tail -n +2', $netstat)) {
$lines = preg_split("/\n/", $netstat, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
$ar_buf = preg_split("/\s+/", $line);
if (! empty($ar_buf[0]) && ! empty($ar_buf[3])) {
$dev = new NetDevice();
$dev->setName($ar_buf[0]);
$dev->setRxBytes($ar_buf[4]);
$dev->setTxBytes($ar_buf[6]);
$dev->setErrors($ar_buf[5] + $ar_buf[7]);
//$dev->setDrops($ar_buf[8]);
$this->sys->setNetDevices($dev);
}
}
}
}
 
/**
* Physical memory information and Swap Space information
* @return void
*/
private function _memory()
{
$mems = "";
$tswap = "";
$pswap = "";
foreach ($this->readaixdata() as $line) {
if (preg_match("/^Good Memory Size:\s+(\d+)\s+MB/", $line, $ar_buf)) {
$mems = $ar_buf[1];
}
if (preg_match("/^\s*Total Paging Space:\s+(\d+)MB/", $line, $ar_buf)) {
$tswap = $ar_buf[1];
}
if (preg_match("/^\s*Percent Used:\s+(\d+)%/", $line, $ar_buf)) {
$pswap = $ar_buf[1];
}
}
if (trim($mems) != "") {
$mems = $mems*1024*1024;
$this->sys->setMemTotal($mems);
$memu = 0;
$memf = 0;
if (CommonFunctions::executeProgram('svmon', '-G', $buf)) {
if (preg_match("/^memory\s+\d+\s+(\d+)\s+/", $buf, $ar_buf)) {
$memu = $ar_buf[1]*1024*4;
$memf = $mems - $memu;
}
}
$this->sys->setMemUsed($memu);
$this->sys->setMemFree($memf);
// $this->sys->setMemApplication($mems);
// $this->sys->setMemBuffer($mems);
// $this->sys->setMemCache($mems);
}
if (trim($tswap) != "") {
$dev = new DiskDevice();
$dev->setName("SWAP");
$dev->setFsType('swap');
$dev->setTotal($tswap * 1024 * 1024);
if (trim($pswap) != "") {
$dev->setUsed($dev->getTotal() * $pswap / 100);
}
$dev->setFree($dev->getTotal() - $dev->getUsed());
$this->sys->setSwapDevices($dev);
}
}
 
/**
* filesystem information
*
* @return void
*/
private function _filesystems()
{
if (CommonFunctions::executeProgram('df', '-kP', $df, PSI_DEBUG)) {
$mounts = preg_split("/\n/", $df, -1, PREG_SPLIT_NO_EMPTY);
if (CommonFunctions::executeProgram('mount', '-v', $s, PSI_DEBUG)) {
$lines = preg_split("/\n/", $s, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
$a = preg_split('/ /', $line, -1, PREG_SPLIT_NO_EMPTY);
$fsdev[$a[0]] = $a[4];
}
}
foreach ($mounts as $mount) {
$ar_buf = preg_split("/\s+/", $mount, 6);
$dev = new DiskDevice();
$dev->setName($ar_buf[0]);
$dev->setTotal($ar_buf[1] * 1024);
$dev->setUsed($ar_buf[2] * 1024);
$dev->setFree($ar_buf[3] * 1024);
$dev->setMountPoint($ar_buf[5]);
if (isset($fsdev[$ar_buf[0]])) {
$dev->setFsType($fsdev[$ar_buf[0]]);
}
$this->sys->setDiskDevices($dev);
}
}
}
 
/**
* Distribution
*
* @return void
*/
private function _distro()
{
$this->sys->setDistribution('IBM AIX');
$this->sys->setDistributionIcon('AIX.png');
}
 
/**
* IBM AIX informations by K.PAZ
* @return array
*/
private function readaixdata()
{
if (count($this->_aixdata) === 0) {
if (CommonFunctions::executeProgram('prtconf', '', $bufr)) {
$this->_aixdata = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
}
}
 
return $this->_aixdata;
}
 
/**
* get the information
*
* @see PSI_Interface_OS::build()
*
* @return Void
*/
public function build()
{
$this->error->addError("WARN", "The AIX version of phpSysInfo is a work in progress, some things currently don't work");
if (!$this->blockname || $this->blockname==='vitals') {
$this->_distro();
$this->_hostname();
$this->_kernel();
$this->_uptime();
$this->_users();
$this->_loadavg();
}
if (!$this->blockname || $this->blockname==='hardware') {
$this->_cpuinfo();
$this->_pci();
$this->_ide();
$this->_scsi();
$this->_usb();
}
if (!$this->blockname || $this->blockname==='network') {
$this->_network();
}
if (!$this->blockname || $this->blockname==='memory') {
$this->_memory();
}
if (!$this->blockname || $this->blockname==='filesystem') {
$this->_filesystems();
}
}
}
/web/acc/phpsysinfo/includes/os/class.Android.inc.php
0,0 → 1,274
<?php
/**
* Android System Class
*
* PHP version 5
*
* @category PHP
* @package PSI Android OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.Linux.inc.php 712 2012-12-05 14:09:18Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* Android sysinfo class
* get all the required information from Android system
*
* @category PHP
* @package PSI Android OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class Android extends Linux
{
/**
* holds the data from /system/build.prop file
*
* @var string
*/
private $_buildprop = null;
 
/**
* reads the data from /system/build.prop file
*
* @return string
*/
private function _get_buildprop()
{
if ($this->_buildprop === null) {
if (!CommonFunctions::rfts('/system/build.prop', $this->_buildprop, 0, 4096, false)) {
CommonFunctions::rfts('/system//build.prop', $this->_buildprop, 0, 4096, false); //fix some access issues
}
}
 
return $this->_buildprop;
}
 
/**
* Kernel Version
*
* @return void
*/
private function _kernel()
{
if (CommonFunctions::executeProgram('uname', '-r', $strBuf, false)) {
$result = $strBuf;
if (CommonFunctions::executeProgram('uname', '-v', $strBuf, PSI_DEBUG)) {
if (preg_match('/SMP/', $strBuf)) {
$result .= ' (SMP)';
}
}
if (CommonFunctions::executeProgram('uname', '-m', $strBuf, PSI_DEBUG)) {
$result .= ' '.$strBuf;
}
$this->sys->setKernel($result);
} elseif (CommonFunctions::rfts('/proc/version', $strBuf, 1) && preg_match('/version\s+(\S+)/', $strBuf, $ar_buf)) {
$result = $ar_buf[1];
if (preg_match('/SMP/', $strBuf)) {
$result .= ' (SMP)';
}
$this->sys->setKernel($result);
}
}
 
/**
* Number of Users
*
* @return void
*/
protected function _users()
{
$this->sys->setUsers(1);
}
 
/**
* filesystem information
*
* @return void
*/
private function _filesystems()
{
$notwas = true;
if (CommonFunctions::executeProgram('df', '2>/dev/null ', $df, PSI_DEBUG) && preg_match("/\s+[0-9\.]+[KMGT]\s+/", $df)) {
$df = preg_split("/\n/", $df, -1, PREG_SPLIT_NO_EMPTY);
if (CommonFunctions::executeProgram('mount', '', $mount, PSI_DEBUG)) {
$mount = preg_split("/\n/", $mount, -1, PREG_SPLIT_NO_EMPTY);
foreach ($mount as $mount_line) {
$mount_buf = preg_split('/\s+/', $mount_line);
if (count($mount_buf) == 6) {
$mount_parm[$mount_buf[1]]['fstype'] = $mount_buf[2];
if (PSI_SHOW_MOUNT_OPTION) $mount_parm[$mount_buf[1]]['options'] = $mount_buf[3];
$mount_parm[$mount_buf[1]]['mountdev'] = $mount_buf[0];
}
}
foreach ($df as $df_line) {
if ((preg_match("/^(\/\S+)(\s+)(([0-9\.]+)([KMGT])(\s+)([0-9\.]+)([KMGT])(\s+)([0-9\.]+)([KMGT])(\s+))/", $df_line, $df_buf)
|| preg_match("/^(\/[^\s\:]+)\:(\s+)(([0-9\.]+)([KMGT])(\s+total\,\s+)([0-9\.]+)([KMGT])(\s+used\,\s+)([0-9\.]+)([KMGT])(\s+available))/", $df_line, $df_buf))
&& !preg_match('/^\/mnt\/asec\/com\./', $df_buf[1])) {
$dev = new DiskDevice();
if (PSI_SHOW_MOUNT_POINT) $dev->setMountPoint($df_buf[1]);
 
if ($df_buf[5] == 'K') $dev->setTotal($df_buf[4] * 1024);
elseif ($df_buf[5] == 'M') $dev->setTotal($df_buf[4] * 1024*1024);
elseif ($df_buf[5] == 'G') $dev->setTotal($df_buf[4] * 1024*1024*1024);
elseif ($df_buf[5] == 'T') $dev->setTotal($df_buf[4] * 1024*1024*1024*1024);
 
if ($df_buf[8] == 'K') $dev->setUsed($df_buf[7] * 1024);
elseif ($df_buf[8] == 'M') $dev->setUsed($df_buf[7] * 1024*1024);
elseif ($df_buf[8] == 'G') $dev->setUsed($df_buf[7] * 1024*1024*1024);
elseif ($df_buf[8] == 'T') $dev->setUsed($df_buf[7] * 1024*1024*1024*1024);
 
if ($df_buf[11] == 'K') $dev->setFree($df_buf[10] * 1024);
elseif ($df_buf[11] == 'M') $dev->setFree($df_buf[10] * 1024*1024);
elseif ($df_buf[11] == 'G') $dev->setFree($df_buf[10] * 1024*1024*1024);
elseif ($df_buf[11] == 'T') $dev->setFree($df_buf[10] * 1024*1024*1024*1024);
 
if (isset($mount_parm[$df_buf[1]])) {
$dev->setFsType($mount_parm[$df_buf[1]]['fstype']);
$dev->setName($mount_parm[$df_buf[1]]['mountdev']);
 
if (PSI_SHOW_MOUNT_OPTION) {
if (PSI_SHOW_MOUNT_CREDENTIALS) {
$dev->setOptions($mount_parm[$df_buf[1]]['options']);
} else {
$mpo=$mount_parm[$df_buf[1]]['options'];
 
$mpo=preg_replace('/(^guest,)|(^guest$)|(,guest$)/i', '', $mpo);
$mpo=preg_replace('/,guest,/i', ',', $mpo);
 
$mpo=preg_replace('/(^user=[^,]*,)|(^user=[^,]*$)|(,user=[^,]*$)/i', '', $mpo);
$mpo=preg_replace('/,user=[^,]*,/i', ',', $mpo);
 
$mpo=preg_replace('/(^username=[^,]*,)|(^username=[^,]*$)|(,username=[^,]*$)/i', '', $mpo);
$mpo=preg_replace('/,username=[^,]*,/i', ',', $mpo);
 
$mpo=preg_replace('/(^password=[^,]*,)|(^password=[^,]*$)|(,password=[^,]*$)/i', '', $mpo);
$mpo=preg_replace('/,password=[^,]*,/i', ',', $mpo);
 
$dev->setOptions($mpo);
}
}
}
$this->sys->setDiskDevices($dev);
$notwas = false;
}
}
}
}
if ($notwas) { // try Linux df style
$arrResult = Parser::df("-P 2>/dev/null", false);
foreach ($arrResult as $dev) {
$this->sys->setDiskDevices($dev);
}
}
}
 
/**
* Distribution
*
* @return void
*/
protected function _distro()
{
$buf = "";
if (($lines = $this->_get_buildprop()) && preg_match('/^ro\.build\.version\.release=([^\n]+)/m', $lines, $ar_buf)) {
$buf = trim($ar_buf[1]);
}
if (is_null($buf) || ($buf == "")) {
$this->sys->setDistribution('Android');
} else {
if (preg_match('/^(\d+\.\d+)/', $buf, $ver)
&& ($list = @parse_ini_file(PSI_APP_ROOT."/data/osnames.ini", true))
&& isset($list['Android'][$ver[1]])) {
$buf.=' '.$list['Android'][$ver[1]];
}
$this->sys->setDistribution('Android '.$buf);
}
$this->sys->setDistributionIcon('Android.png');
}
 
/**
* Machine
*
* @return void
*/
private function _machine()
{
if ($lines = $this->_get_buildprop()) {
$buf = "";
if (preg_match('/^ro\.product\.manufacturer=([^\n]+)/m', $lines, $ar_buf) && (trim($ar_buf[1]) !== "unknown")) {
$buf .= ' '.trim($ar_buf[1]);
}
if (preg_match('/^ro\.product\.model=([^\n]+)/m', $lines, $ar_buf) && (trim($ar_buf[1]) !== trim($buf))) {
$buf .= ' '.trim($ar_buf[1]);
}
if (preg_match('/^ro\.semc\.product\.name=([^\n]+)/m', $lines, $ar_buf)) {
$buf .= ' '.trim($ar_buf[1]);
}
if (trim($buf) != "") {
$this->sys->setMachine(trim($buf));
}
}
}
 
/**
* PCI devices
*
* @return void
*/
private function _pci()
{
if (CommonFunctions::executeProgram('lspci', '', $bufr, false)) {
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
foreach ($bufe as $buf) {
$device = preg_split("/ /", $buf, 4);
if (isset($device[3]) && trim($device[3]) != "") {
$dev = new HWDevice();
$dev->setName('Class '.trim($device[2]).' Device '.trim($device[3]));
$this->sys->setPciDevices($dev);
}
}
}
}
 
/**
* get the information
*
* @see PSI_Interface_OS::build()
*
* @return Void
*/
public function build()
{
if (!$this->blockname || $this->blockname==='vitals') {
$this->_distro();
$this->_hostname();
$this->_kernel();
$this->_uptime();
$this->_users();
$this->_loadavg();
$this->_processes();
}
if (!$this->blockname || $this->blockname==='hardware') {
$this->_machine();
$this->_cpuinfo();
$this->_pci();
$this->_usb();
$this->_i2c();
}
if (!$this->blockname || $this->blockname==='network') {
$this->_network();
}
if (!$this->blockname || $this->blockname==='memory') {
$this->_memory();
}
if (!$this->blockname || $this->blockname==='filesystem') {
$this->_filesystems();
}
}
}
/web/acc/phpsysinfo/includes/os/class.BSDCommon.inc.php
0,0 → 1,661
<?php
/**
* BSDCommon Class
*
* PHP version 5
*
* @category PHP
* @package PSI BSDCommon OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.BSDCommon.inc.php 621 2012-07-29 18:49:04Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* BSDCommon class
* get all the required information for BSD Like systems
* no need to implement in every class the same methods
*
* @category PHP
* @package PSI BSDCommon OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
abstract class BSDCommon extends OS
{
/**
* content of the syslog
*
* @var array
*/
private $_dmesg = null;
 
/**
* regexp1 for cpu information out of the syslog
*
* @var string
*/
private $_CPURegExp1 = "//";
 
/**
* regexp2 for cpu information out of the syslog
*
* @var string
*/
private $_CPURegExp2 = "//";
 
/**
* regexp1 for scsi information out of the syslog
*
* @var string
*/
private $_SCSIRegExp1 = "//";
 
/**
* regexp2 for scsi information out of the syslog
*
* @var string
*/
private $_SCSIRegExp2 = "//";
 
/**
* regexp3 for scsi information out of the syslog
*
* @var string
*/
private $_SCSIRegExp3 = "//";
 
/**
* regexp1 for pci information out of the syslog
*
* @var string
*/
private $_PCIRegExp1 = "//";
 
/**
* regexp1 for pci information out of the syslog
*
* @var string
*/
private $_PCIRegExp2 = "//";
 
/**
* setter for cpuregexp1
*
* @param string $value value to set
*
* @return void
*/
protected function setCPURegExp1($value)
{
$this->_CPURegExp1 = $value;
}
 
/**
* setter for cpuregexp2
*
* @param string $value value to set
*
* @return void
*/
protected function setCPURegExp2($value)
{
$this->_CPURegExp2 = $value;
}
 
/**
* setter for scsiregexp1
*
* @param string $value value to set
*
* @return void
*/
protected function setSCSIRegExp1($value)
{
$this->_SCSIRegExp1 = $value;
}
 
/**
* setter for scsiregexp2
*
* @param string $value value to set
*
* @return void
*/
protected function setSCSIRegExp2($value)
{
$this->_SCSIRegExp2 = $value;
}
 
/**
* setter for scsiregexp3
*
* @param string $value value to set
*
* @return void
*/
protected function setSCSIRegExp3($value)
{
$this->_SCSIRegExp3 = $value;
}
 
/**
* setter for pciregexp1
*
* @param string $value value to set
*
* @return void
*/
protected function setPCIRegExp1($value)
{
$this->_PCIRegExp1 = $value;
}
 
/**
* setter for pciregexp2
*
* @param string $value value to set
*
* @return void
*/
protected function setPCIRegExp2($value)
{
$this->_PCIRegExp2 = $value;
}
 
/**
* read /var/run/dmesg.boot, but only if we haven't already
*
* @return array
*/
protected function readdmesg()
{
if ($this->_dmesg === null) {
if ((PSI_OS != "Darwin") && (CommonFunctions::rfts('/var/run/dmesg.boot', $buf, 0, 4096, false) || CommonFunctions::rfts('/var/log/dmesg.boot', $buf, 0, 4096, false) || CommonFunctions::rfts('/var/run/dmesg.boot', $buf))) { // Once again but with debug
$parts = preg_split("/rebooting|Uptime/", $buf, -1, PREG_SPLIT_NO_EMPTY);
$this->_dmesg = preg_split("/\n/", $parts[count($parts) - 1], -1, PREG_SPLIT_NO_EMPTY);
} else {
$this->_dmesg = array();
}
}
 
return $this->_dmesg;
}
 
/**
* get a value from sysctl command
*
* @param string $key key for the value to get
*
* @return string
*/
protected function grabkey($key)
{
$buf = "";
if (CommonFunctions::executeProgram('sysctl', "-n $key", $buf, PSI_DEBUG)) {
return $buf;
} else {
return '';
}
}
 
/**
* Virtual Host Name
*
* @return void
*/
protected function hostname()
{
if (PSI_USE_VHOST === true) {
if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
} else {
if (CommonFunctions::executeProgram('hostname', '', $buf, PSI_DEBUG)) {
$this->sys->setHostname($buf);
}
}
}
 
/**
* Kernel Version
*
* @return void
*/
protected function kernel()
{
$s = $this->grabkey('kern.version');
$a = preg_split('/:/', $s);
if (isset($a[2])) {
$this->sys->setKernel($a[0].$a[1].':'.$a[2]);
} else {
$this->sys->setKernel($s);
}
}
 
/**
* Processor Load
* optionally create a loadbar
*
* @return void
*/
protected function loadavg()
{
$s = $this->grabkey('vm.loadavg');
$s = preg_replace('/{ /', '', $s);
$s = preg_replace('/ }/', '', $s);
$this->sys->setLoad($s);
if (PSI_LOAD_BAR && (PSI_OS != "Darwin")) {
if ($fd = $this->grabkey('kern.cp_time')) {
// Find out the CPU load
// user + sys = load
// total = total
preg_match($this->_CPURegExp2, $fd, $res);
$load = $res[2] + $res[3] + $res[4]; // cpu.user + cpu.sys
$total = $res[2] + $res[3] + $res[4] + $res[5]; // cpu.total
// we need a second value, wait 1 second befor getting (< 1 second no good value will occour)
sleep(1);
$fd = $this->grabkey('kern.cp_time');
preg_match($this->_CPURegExp2, $fd, $res);
$load2 = $res[2] + $res[3] + $res[4];
$total2 = $res[2] + $res[3] + $res[4] + $res[5];
$this->sys->setLoadPercent((100 * ($load2 - $load)) / ($total2 - $total));
}
}
}
 
/**
* CPU information
*
* @return void
*/
protected function cpuinfo()
{
$dev = new CpuDevice();
 
if (PSI_OS == "NetBSD") {
if ($model = $this->grabkey('machdep.cpu_brand')) {
$dev->setModel($model);
}
if ($cpuspeed = $this->grabkey('machdep.tsc_freq')) {
$dev->setCpuSpeed(round($cpuspeed / 1000000));
}
}
 
if ($dev->getModel() === "") {
$dev->setModel($this->grabkey('hw.model'));
}
$notwas = true;
foreach ($this->readdmesg() as $line) {
if ($notwas) {
if (preg_match($this->_CPURegExp1, $line, $ar_buf)) {
if ($dev->getCpuSpeed() === 0) {
$dev->setCpuSpeed(round($ar_buf[2]));
}
$notwas = false;
}
} else {
if (preg_match("/ Origin| Features/", $line, $ar_buf)) {
if (preg_match("/ Features2[ ]*=.*<(.*)>/", $line, $ar_buf)) {
$feats = preg_split("/,/", strtolower(trim($ar_buf[1])), -1, PREG_SPLIT_NO_EMPTY);
foreach ($feats as $feat) {
if (($feat=="vmx") || ($feat=="svm")) {
$dev->setVirt($feat);
break 2;
}
}
break;
}
} else break;
}
}
 
$ncpu = $this->grabkey('hw.ncpu');
if (is_null($ncpu) || (trim($ncpu) == "") || (!($ncpu >= 1)))
$ncpu = 1;
for ($ncpu ; $ncpu > 0 ; $ncpu--) {
$this->sys->setCpus($dev);
}
}
 
/**
* SCSI devices
* get the scsi device information out of dmesg
*
* @return void
*/
protected function scsi()
{
foreach ($this->readdmesg() as $line) {
if (preg_match($this->_SCSIRegExp1, $line, $ar_buf)) {
$dev = new HWDevice();
$dev->setName($ar_buf[1].": ".trim($ar_buf[2]));
$this->sys->setScsiDevices($dev);
} elseif (preg_match($this->_SCSIRegExp2, $line, $ar_buf)) {
/* duplication security */
$notwas = true;
foreach ($this->sys->getScsiDevices() as $finddev) {
if ($notwas && (substr($finddev->getName(), 0, strpos($finddev->getName(), ': ')) == $ar_buf[1])) {
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
if (isset($ar_buf[3]) && ($ar_buf[3]==="G")) {
$finddev->setCapacity($ar_buf[2] * 1024 * 1024 * 1024);
} else {
$finddev->setCapacity($ar_buf[2] * 1024 * 1024);
}
}
$notwas = false;
break;
}
}
if ($notwas) {
$dev = new HWDevice();
$dev->setName($ar_buf[1]);
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
if (isset($ar_buf[3]) && ($ar_buf[3]==="G")) {
$dev->setCapacity($ar_buf[2] * 1024 * 1024 * 1024);
} else {
$dev->setCapacity($ar_buf[2] * 1024 * 1024);
}
}
$this->sys->setScsiDevices($dev);
}
} elseif (preg_match($this->_SCSIRegExp3, $line, $ar_buf)) {
/* duplication security */
$notwas = true;
foreach ($this->sys->getScsiDevices() as $finddev) {
if ($notwas && (substr($finddev->getName(), 0, strpos($finddev->getName(), ': ')) == $ar_buf[1])) {
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS
&& defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
$finddev->setSerial(trim($ar_buf[2]));
}
$notwas = false;
break;
}
}
if ($notwas) {
$dev = new HWDevice();
$dev->setName($ar_buf[1]);
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS
&& defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
$dev->setSerial(trim($ar_buf[2]));
}
$this->sys->setScsiDevices($dev);
}
}
}
/* cleaning */
foreach ($this->sys->getScsiDevices() as $finddev) {
if (strpos($finddev->getName(), ': ') !== false)
$finddev->setName(substr(strstr($finddev->getName(), ': '), 2));
}
}
 
/**
* parsing the output of pciconf command
*
* @return Array
*/
protected function pciconf()
{
$arrResults = array();
$intS = 0;
if (CommonFunctions::executeProgram("pciconf", "-lv", $strBuf, PSI_DEBUG)) {
$arrTemp = array();
$arrBlocks = preg_split("/\n\S/", $strBuf, -1, PREG_SPLIT_NO_EMPTY);
foreach ($arrBlocks as $strBlock) {
$arrLines = preg_split("/\n/", $strBlock, -1, PREG_SPLIT_NO_EMPTY);
$vend = null;
foreach ($arrLines as $strLine) {
if (preg_match("/\sclass=0x([a-fA-F0-9]{4})[a-fA-F0-9]{2}\s.*\schip=0x([a-fA-F0-9]{4})([a-fA-F0-9]{4})\s/", $strLine, $arrParts)) {
$arrTemp[$intS] = 'Class '.$arrParts[1].': Device '.$arrParts[3].':'.$arrParts[2];
$vend = '';
} elseif (preg_match("/(.*) = '(.*)'/", $strLine, $arrParts)) {
if (trim($arrParts[1]) == "vendor") {
$vend = trim($arrParts[2]);
} elseif (trim($arrParts[1]) == "device") {
if (($vend !== null) && ($vend !== '')) {
$arrTemp[$intS] = $vend." - ".trim($arrParts[2]);
} else {
$arrTemp[$intS] = trim($arrParts[2]);
$vend = '';
}
}
}
}
if ($vend !== null) {
$intS++;
}
}
foreach ($arrTemp as $name) {
$dev = new HWDevice();
$dev->setName($name);
$arrResults[] = $dev;
}
}
 
return $arrResults;
}
 
/**
* PCI devices
* get the pci device information out of dmesg
*
* @return void
*/
protected function pci()
{
if ((!$results = Parser::lspci(false)) && (!$results = $this->pciconf())) {
foreach ($this->readdmesg() as $line) {
if (preg_match($this->_PCIRegExp1, $line, $ar_buf)) {
$dev = new HWDevice();
$dev->setName($ar_buf[1].": ".$ar_buf[2]);
$results[] = $dev;
} elseif (preg_match($this->_PCIRegExp2, $line, $ar_buf)) {
$dev = new HWDevice();
$dev->setName($ar_buf[1].": ".$ar_buf[2]);
$results[] = $dev;
}
}
}
foreach ($results as $dev) {
$this->sys->setPciDevices($dev);
}
}
 
/**
* IDE devices
* get the ide device information out of dmesg
*
* @return void
*/
protected function ide()
{
foreach ($this->readdmesg() as $line) {
if (preg_match('/^(ad[0-9]+): (.*)MB <(.*)> (.*) (.*)/', $line, $ar_buf)) {
$dev = new HWDevice();
$dev->setName($ar_buf[1].": ".trim($ar_buf[3]));
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
$dev->setCapacity($ar_buf[2] * 1024 * 1024);
}
$this->sys->setIdeDevices($dev);
} elseif (preg_match('/^(acd[0-9]+): (.*) <(.*)> (.*)/', $line, $ar_buf)) {
$dev = new HWDevice();
$dev->setName($ar_buf[1].": ".trim($ar_buf[3]));
$this->sys->setIdeDevices($dev);
} elseif (preg_match('/^(ada[0-9]+): <(.*)> (.*)/', $line, $ar_buf)) {
$dev = new HWDevice();
$dev->setName($ar_buf[1].": ".trim($ar_buf[2]));
$this->sys->setIdeDevices($dev);
} elseif (preg_match('/^(ada[0-9]+): (.*)MB \((.*)\)/', $line, $ar_buf)) {
/* duplication security */
$notwas = true;
foreach ($this->sys->getIdeDevices() as $finddev) {
if ($notwas && (substr($finddev->getName(), 0, strpos($finddev->getName(), ': ')) == $ar_buf[1])) {
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
$finddev->setCapacity($ar_buf[2] * 1024 * 1024);
}
$notwas = false;
break;
}
}
if ($notwas) {
$dev = new HWDevice();
$dev->setName($ar_buf[1]);
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
$dev->setCapacity($ar_buf[2] * 1024 * 1024);
}
$this->sys->setIdeDevices($dev);
}
} elseif (preg_match('/^(ada[0-9]+): Serial Number (.*)/', $line, $ar_buf)) {
/* duplication security */
$notwas = true;
foreach ($this->sys->getIdeDevices() as $finddev) {
if ($notwas && (substr($finddev->getName(), 0, strpos($finddev->getName(), ': ')) == $ar_buf[1])) {
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS
&& defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
$finddev->setSerial(trim($ar_buf[2]));
}
$notwas = false;
break;
}
}
if ($notwas) {
$dev = new HWDevice();
$dev->setName($ar_buf[1]);
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS
&& defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
$finddev->setSerial(trim($ar_buf[2]));
}
$this->sys->setIdeDevices($dev);
}
}
}
/* cleaning */
foreach ($this->sys->getIdeDevices() as $finddev) {
if (strpos($finddev->getName(), ': ') !== false)
$finddev->setName(substr(strstr($finddev->getName(), ': '), 2));
}
}
 
/**
* Physical memory information and Swap Space information
*
* @return void
*/
protected function memory()
{
if (PSI_OS == 'FreeBSD' || PSI_OS == 'OpenBSD') {
// vmstat on fbsd 4.4 or greater outputs kbytes not hw.pagesize
// I should probably add some version checking here, but for now
// we only support fbsd 4.4
$pagesize = 1024;
} else {
$pagesize = $this->grabkey('hw.pagesize');
}
if (CommonFunctions::executeProgram('vmstat', '', $vmstat, PSI_DEBUG)) {
$lines = preg_split("/\n/", $vmstat, -1, PREG_SPLIT_NO_EMPTY);
$ar_buf = preg_split("/\s+/", trim($lines[2]), 19);
if (PSI_OS == 'NetBSD' || PSI_OS == 'DragonFly') {
$this->sys->setMemFree($ar_buf[4] * 1024);
} else {
$this->sys->setMemFree($ar_buf[4] * $pagesize);
}
$this->sys->setMemTotal($this->grabkey('hw.physmem'));
$this->sys->setMemUsed($this->sys->getMemTotal() - $this->sys->getMemFree());
 
if (((PSI_OS == 'OpenBSD' || PSI_OS == 'NetBSD') && CommonFunctions::executeProgram('swapctl', '-l -k', $swapstat, PSI_DEBUG)) || CommonFunctions::executeProgram('swapinfo', '-k', $swapstat, PSI_DEBUG)) {
$lines = preg_split("/\n/", $swapstat, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
$ar_buf = preg_split("/\s+/", $line, 6);
if (($ar_buf[0] != 'Total') && ($ar_buf[0] != 'Device')) {
$dev = new DiskDevice();
$dev->setMountPoint($ar_buf[0]);
$dev->setName("SWAP");
$dev->setFsType('swap');
$dev->setTotal($ar_buf[1] * 1024);
$dev->setUsed($ar_buf[2] * 1024);
$dev->setFree($dev->getTotal() - $dev->getUsed());
$this->sys->setSwapDevices($dev);
}
}
}
}
}
 
/**
* USB devices
* get the ide device information out of dmesg
*
* @return void
*/
protected function usb()
{
foreach ($this->readdmesg() as $line) {
// if (preg_match('/^(ugen[0-9\.]+): <(.*)> (.*) (.*)/', $line, $ar_buf)) {
// $dev->setName($ar_buf[1].": ".$ar_buf[2]);
if (preg_match('/^(u[a-z]+[0-9]+): <([^,]*)(.*)> on (usbus[0-9]+)/', $line, $ar_buf)) {
$dev = new HWDevice();
$dev->setName($ar_buf[2]);
$this->sys->setUSBDevices($dev);
}
}
}
 
/**
* filesystem information
*
* @return void
*/
protected function filesystems()
{
$arrResult = Parser::df();
foreach ($arrResult as $dev) {
$this->sys->setDiskDevices($dev);
}
}
 
/**
* Distribution
*
* @return void
*/
protected function distro()
{
if (CommonFunctions::executeProgram('uname', '-s', $result, PSI_DEBUG)) {
$this->sys->setDistribution($result);
}
}
 
/**
* get the information
*
* @see PSI_Interface_OS::build()
*
* @return Void
*/
public function build()
{
if (!$this->blockname || $this->blockname==='vitals') {
$this->distro();
$this->hostname();
$this->kernel();
$this->_users();
$this->loadavg();
}
if (!$this->blockname || $this->blockname==='hardware') {
$this->cpuinfo();
$this->pci();
$this->ide();
$this->scsi();
$this->usb();
}
if (!$this->blockname || $this->blockname==='memory') {
$this->memory();
}
if (!$this->blockname || $this->blockname==='filesystem') {
$this->filesystems();
}
}
}
/web/acc/phpsysinfo/includes/os/class.Darwin.inc.php
1,198 → 1,493
<?php
<?php
/**
* Darwin System Class
*
* PHP version 5
*
* @category PHP
* @package PSI Darwin OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.Darwin.inc.php 638 2012-08-24 09:40:48Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* Darwin sysinfo class
* get all the required information from Darwin system
* information may be incomplete
*
* @category PHP
* @package PSI Darwin OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class Darwin extends BSDCommon
{
/**
* define the regexp for log parser
*/
/* public function __construct($blockname = false)
{
parent::__construct($blockname);
$this->error->addWarning("The Darwin version of phpSysInfo is a work in progress, some things currently don't work!");
$this->setCPURegExp1("/CPU: (.*) \((.*)-MHz (.*)\)/");
$this->setCPURegExp2("/(.*) ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)/");
$this->setSCSIRegExp1("/^(.*): <(.*)> .*SCSI.*device/");
} */
 
// phpSysInfo - A PHP System Information Script
// http://phpsysinfo.sourceforge.net/
/**
* get a value from sysctl command
*
* @param string $key key of the value to get
*
* @return string
*/
protected function grabkey($key)
{
if (CommonFunctions::executeProgram('sysctl', $key, $s, PSI_DEBUG)) {
$s = preg_replace('/'.$key.': /', '', $s);
$s = preg_replace('/'.$key.' = /', '', $s);
 
// 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.
return $s;
} else {
return '';
}
}
 
// 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.
/**
* get a value from ioreg command
*
* @param string $key key of the value to get
*
* @return string
*/
private function _grabioreg($key)
{
if (CommonFunctions::executeProgram('ioreg', '-c "'.$key.'"', $s, PSI_DEBUG)) {
/* delete newlines */
$s = preg_replace("/\s+/", " ", $s);
/* new newlines */
$s = preg_replace("/[\|\t ]*\+\-o/", "\n", $s);
/* combine duplicate whitespaces and some chars */
$s = preg_replace("/[\|\t ]+/", " ", $s);
 
// 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.
$lines = preg_split("/\n/", $s, -1, PREG_SPLIT_NO_EMPTY);
$out = "";
foreach ($lines as $line) {
if (preg_match('/^([^<]*) <class '.$key.',/', $line)) {
$out .= $line."\n";
}
}
 
// $Id: class.Darwin.inc.php,v 1.33 2006/06/14 16:36:34 bigmichi1 Exp $
if (!defined('IN_PHPSYSINFO')) {
die("No Hacking");
}
return $out;
} else {
return '';
}
}
 
require_once(APP_ROOT . '/includes/os/class.BSD.common.inc.php');
/**
* UpTime
* time the system is running
*
* @return void
*/
private function _uptime()
{
if (CommonFunctions::executeProgram('sysctl', '-n kern.boottime', $a, PSI_DEBUG)) {
$tmp = explode(" ", $a);
if ($tmp[0]=="{") { /* kern.boottime= { sec = 1096732600, usec = 885425 } Sat Oct 2 10:56:40 2004 */
$data = trim($tmp[3], ",");
$this->sys->setUptime(time() - $data);
} else { /* kern.boottime= 1096732600 */
$this->sys->setUptime(time() - $a);
}
}
}
 
$error->addWarning("The Darwin version of phpSysInfo is work in progress, some things currently don't work");
/**
* get CPU information
*
* @return void
*/
protected function cpuinfo()
{
$dev = new CpuDevice();
if (CommonFunctions::executeProgram('hostinfo', '| grep "Processor type"', $buf, PSI_DEBUG)) {
$dev->setModel(preg_replace('/Processor type: /', '', $buf));
$buf=$this->grabkey('hw.model');
if (!is_null($buf) && (trim($buf) != "")) {
$this->sys->setMachine(trim($buf));
if (CommonFunctions::rfts(PSI_APP_ROOT.'/data/ModelTranslation.txt', $buffer)) {
$buffer = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
foreach ($buffer as $line) {
$ar_buf = preg_split("/:/", $line, 3);
if (trim($buf) === trim($ar_buf[0])) {
$dev->setModel(trim($ar_buf[2]));
$this->sys->setMachine($this->sys->getMachine().' - '.trim($ar_buf[1]));
break;
}
}
}
}
$buf=$this->grabkey('machdep.cpu.brand_string');
if (!is_null($buf) && (trim($buf) != "") &&
((trim($buf) != "i486 (Intel 80486)") || ($dev->getModel() == ""))) {
$dev->setModel(trim($buf));
}
$buf=$this->grabkey('machdep.cpu.features');
if (!is_null($buf) && (trim($buf) != "")) {
if (preg_match("/ VMX/", $buf)) {
$dev->setVirt("vmx");
} elseif (preg_match("/ SVM/", $buf)) {
$dev->setVirt("svm");
}
}
}
$dev->setCpuSpeed(round($this->grabkey('hw.cpufrequency') / 1000000));
$dev->setBusSpeed(round($this->grabkey('hw.busfrequency') / 1000000));
$bufn=$this->grabkey('hw.cpufrequency_min');
$bufx=$this->grabkey('hw.cpufrequency_max');
if (!is_null($bufn) && (trim($bufn) != "") && !is_null($bufx) && (trim($bufx) != "") && ($bufn != $bufx)) {
$dev->setCpuSpeedMin(round($bufn / 1000000));
$dev->setCpuSpeedMax(round($bufx / 1000000));
}
$buf=$this->grabkey('hw.l2cachesize');
if (!is_null($buf) && (trim($buf) != "")) {
$dev->setCache(round($buf));
}
$ncpu = $this->grabkey('hw.ncpu');
if (is_null($ncpu) || (trim($ncpu) == "") || (!($ncpu >= 1)))
$ncpu = 1;
for ($ncpu ; $ncpu > 0 ; $ncpu--) {
$this->sys->setCpus($dev);
}
}
 
class sysinfo extends bsd_common {
var $cpu_regexp;
var $scsi_regexp;
var $parser;
// Our contstructor
// this function is run on the initialization of this class
function sysinfo () {
// $this->cpu_regexp = "CPU: (.*) \((.*)-MHz (.*)\)";
// $this->scsi_regexp1 = "^(.*): <(.*)> .*SCSI.*device";
$this->cpu_regexp2 = "/(.*) ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)/";
$this->parser = new Parser();
}
/**
* get the pci device information out of ioreg
*
* @return void
*/
protected function pci()
{
if (!$arrResults = Parser::lspci(false)) { //no lspci port
$s = $this->_grabioreg('IOPCIDevice');
$lines = preg_split("/\n/", $s, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
$dev = new HWDevice();
if (!preg_match('/"IOName" = "([^"]*)"/', $line, $ar_buf)) {
$ar_buf = preg_split("/[\s@]+/", $line, 19);
}
if (preg_match('/"model" = <?"([^"]*)"/', $line, $ar_buf2)) {
$dev->setName(trim($ar_buf[1]). ": ".trim($ar_buf2[1]));
} else {
$dev->setName(trim($ar_buf[1]));
}
$this->sys->setPciDevices($dev);
}
} else {
foreach ($arrResults as $dev) {
$this->sys->setPciDevices($dev);
}
}
}
 
function grab_key ($key) {
$s = execute_program('sysctl', $key);
$s = ereg_replace($key . ': ', '', $s);
$s = ereg_replace($key . ' = ', '', $s); // fix Apple set keys
return $s;
}
/**
* get the ide device information out of ioreg
*
* @return void
*/
protected function ide()
{
$s = $this->_grabioreg('IOATABlockStorageDevice');
$lines = preg_split("/\n/", $s, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
$dev = new HWDevice();
if (!preg_match('/"Product Name"="([^"]*)"/', $line, $ar_buf))
$ar_buf = preg_split("/[\s@]+/", $line, 19);
$dev->setName(trim($ar_buf[1]));
$this->sys->setIdeDevices($dev);
}
 
function grab_ioreg ($key) {
$s = execute_program('ioreg', '-cls "' . $key . '" | grep "' . $key . '"'); //ioreg -cls "$key" | grep "$key"
$s = ereg_replace('\|', '', $s);
$s = ereg_replace('\+\-\o', '', $s);
$s = ereg_replace('[ ]+', '', $s);
$s = ereg_replace('<[^>]+>', '', $s); // remove possible XML conflicts
$s = $this->_grabioreg('IOAHCIBlockStorageDevice');
$lines = preg_split("/\n/", $s, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
$dev = new HWDevice();
if (!preg_match('/"Product Name"="([^"]*)"/', $line, $ar_buf))
$ar_buf = preg_split("/[\s@]+/", $line, 19);
$dev->setName(trim($ar_buf[1]));
$this->sys->setIdeDevices($dev);
}
}
 
return $s;
}
/**
* get the usb device information out of ioreg
*
* @return void
*/
protected function usb()
{
$s = $this->_grabioreg('IOUSBDevice');
$lines = preg_split("/\n/", $s, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
$dev = new HWDevice();
if (!preg_match('/"USB Product Name" = "([^"]*)"/', $line, $ar_buf))
$ar_buf = preg_split("/[\s@]+/", $line, 19);
$dev->setName(trim($ar_buf[1]));
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
if (preg_match('/"USB Vendor Name" = "([^"]*)"/', $line, $ar_buf)) {
$dev->setManufacturer(trim($ar_buf[1]));
}
if (preg_match('/"USB Product Name" = "([^"]*)"/', $line, $ar_buf)) {
$dev->setProduct(trim($ar_buf[1]));
}
if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL
&& preg_match('/"USB Serial Number" = "([^"]*)"/', $line, $ar_buf)) {
$dev->setSerial(trim($ar_buf[1]));
}
}
$this->sys->setUsbDevices($dev);
}
}
 
function get_sys_ticks () {
$a = execute_program('sysctl', '-n kern.boottime'); // get boottime (value in seconds)
$sys_ticks = time() - $a;
/**
* get the scsi device information out of ioreg
*
* @return void
*/
protected function scsi()
{
$s = $this->_grabioreg('IOBlockStorageServices');
$lines = preg_split("/\n/", $s, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
$dev = new HWDevice();
if (!preg_match('/"Product Name"="([^"]*)"/', $line, $ar_buf))
$ar_buf = preg_split("/[\s@]+/", $line, 19);
$dev->setName(trim($ar_buf[1]));
$this->sys->setScsiDevices($dev);
}
}
 
return $sys_ticks;
}
/**
* get memory and swap information
*
* @return void
*/
protected function memory()
{
$s = $this->grabkey('hw.memsize');
if (CommonFunctions::executeProgram('vm_stat', '', $pstat, PSI_DEBUG)) {
// calculate free memory from page sizes (each page = 4096)
if (preg_match('/^Pages free:\s+(\S+)/m', $pstat, $free_buf)) {
if (preg_match('/^Anonymous pages:\s+(\S+)/m', $pstat, $anon_buf)
&& preg_match('/^Pages wired down:\s+(\S+)/m', $pstat, $wire_buf)
&& preg_match('/^File-backed pages:\s+(\S+)/m', $pstat, $fileb_buf)) {
// OS X 10.9 or never
$this->sys->setMemFree($free_buf[1] * 4 * 1024);
$this->sys->setMemApplication(($anon_buf[1]+$wire_buf[1]) * 4 * 1024);
$this->sys->setMemCache($fileb_buf[1] * 4 * 1024);
if (preg_match('/^Pages occupied by compressor:\s+(\S+)/m', $pstat, $compr_buf)) {
$this->sys->setMemBuffer($compr_buf[1] * 4 * 1024);
}
} else {
if (preg_match('/^Pages speculative:\s+(\S+)/m', $pstat, $spec_buf)) {
$this->sys->setMemFree(($free_buf[1]+$spec_buf[1]) * 4 * 1024);
} else {
$this->sys->setMemFree($free_buf[1] * 4 * 1024);
}
$appMemory = 0;
if (preg_match('/^Pages wired down:\s+(\S+)/m', $pstat, $wire_buf)) {
$appMemory += $wire_buf[1] * 4 * 1024;
}
if (preg_match('/^Pages active:\s+(\S+)/m', $pstat, $active_buf)) {
$appMemory += $active_buf[1] * 4 * 1024;
}
$this->sys->setMemApplication($appMemory);
 
function cpu_info () {
$results = array();
// $results['model'] = $this->grab_key('hw.model'); // need to expand this somehow...
// $results['model'] = $this->grab_key('hw.machine');
$results['model'] = ereg_replace('Processor type: ', '', execute_program('hostinfo', '| grep "Processor type"')); // get processor type
$results['cpus'] = $this->grab_key('hw.ncpu');
$results['cpuspeed'] = round($this->grab_key('hw.cpufrequency') / 1000000); // return cpu speed - Mhz
$results['busspeed'] = round($this->grab_key('hw.busfrequency') / 1000000); // return bus speed - Mhz
$results['cache'] = round($this->grab_key('hw.l2cachesize') / 1024); // return l2 cache
if (preg_match('/^Pages inactive:\s+(\S+)/m', $pstat, $inactive_buf)) {
$this->sys->setMemCache($inactive_buf[1] * 4 * 1024);
}
}
} else {
$lines = preg_split("/\n/", $pstat, -1, PREG_SPLIT_NO_EMPTY);
$ar_buf = preg_split("/\s+/", $lines[1], 19);
$this->sys->setMemFree($ar_buf[2] * 4 * 1024);
}
 
if (($this->grab_key('hw.model') == "PowerMac3,6") && ($results['cpus'] == "2")) { $results['model'] = 'Dual G4 - (PowerPC 7450)';} // is Dual G4
if (($this->grab_key('hw.model') == "PowerMac7,2") && ($results['cpus'] == "2")) { $results['model'] = 'Dual G5 - (PowerPC 970)';} // is Dual G5
if (($this->grab_key('hw.model') == "PowerMac1,1") && ($results['cpus'] == "1")) { $results['model'] = 'B&W G3 - (PowerPC 750)';} // is B&W G3
$this->sys->setMemTotal($s);
$this->sys->setMemUsed($this->sys->getMemTotal() - $this->sys->getMemFree());
 
return $results;
}
// get the pci device information out of ioreg
function pci () {
$results = array();
$s = $this->grab_ioreg('IOPCIDevice');
if (CommonFunctions::executeProgram('sysctl', 'vm.swapusage | colrm 1 22', $swapBuff, PSI_DEBUG)) {
$swap1 = preg_split('/M/', $swapBuff);
$swap2 = preg_split('/=/', $swap1[1]);
$swap3 = preg_split('/=/', $swap1[2]);
$dev = new DiskDevice();
$dev->setName('SWAP');
$dev->setMountPoint('SWAP');
$dev->setFsType('swap');
$dev->setTotal($swap1[0] * 1024 * 1024);
$dev->setUsed($swap2[1] * 1024 * 1024);
$dev->setFree($swap3[1] * 1024 * 1024);
$this->sys->setSwapDevices($dev);
}
}
}
 
$lines = explode("\n", $s);
for ($i = 0, $max = sizeof($lines); $i < $max; $i++) {
$ar_buf = preg_split("/\s+/", $lines[$i], 19);
$results[$i] = $ar_buf[0];
}
asort($results);
return array_values(array_unique($results));
}
// get the ide device information out of ioreg
function ide () {
$results = array();
// ioreg | grep "Media <class IOMedia>"
$s = $this->grab_ioreg('IOATABlockStorageDevice');
/**
* get the thunderbolt device information out of ioreg
*
* @return void
*/
protected function _tb()
{
$s = $this->_grabioreg('IOThunderboltPort');
$lines = preg_split("/\n/", $s, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
$dev = new HWDevice();
if (!preg_match('/"Description" = "([^"]*)"/', $line, $ar_buf))
$ar_buf = preg_split("/[\s@]+/", $line, 19);
$dev->setName(trim($ar_buf[1]));
$this->sys->setTbDevices($dev);
}
}
 
$lines = explode("\n", $s);
$j = 0;
for ($i = 0, $max = sizeof($lines); $i < $max; $i++) {
$ar_buf = preg_split("/\/\//", $lines[$i], 19);
/**
* get network information
*
* @return void
*/
private function _network()
{
if (CommonFunctions::executeProgram('netstat', '-nbdi | cut -c1-24,42- | grep Link', $netstat, PSI_DEBUG)) {
$lines = preg_split("/\n/", $netstat, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
$ar_buf = preg_split("/\s+/", $line, 10);
if (!empty($ar_buf[0])) {
$dev = new NetDevice();
$dev->setName($ar_buf[0]);
$dev->setTxBytes($ar_buf[8]);
$dev->setRxBytes($ar_buf[5]);
$dev->setErrors($ar_buf[4] + $ar_buf[7]);
if (isset($ar_buf[10])) {
$dev->setDrops($ar_buf[10]);
}
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS) && (CommonFunctions::executeProgram('ifconfig', $ar_buf[0].' 2>/dev/null', $bufr2, PSI_DEBUG))) {
$bufe2 = preg_split("/\n/", $bufr2, -1, PREG_SPLIT_NO_EMPTY);
foreach ($bufe2 as $buf2) {
if (preg_match('/^\s+ether\s+(\S+)/i', $buf2, $ar_buf2)) {
if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').preg_replace('/:/', '-', strtoupper($ar_buf2[1])));
} elseif (preg_match('/^\s+inet\s+(\S+)\s+netmask/i', $buf2, $ar_buf2)) {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1]);
} elseif ((preg_match('/^\s+inet6\s+([^\s%]+)\s+prefixlen/i', $buf2, $ar_buf2)
|| preg_match('/^\s+inet6\s+([^\s%]+)%\S+\s+prefixlen/i', $buf2, $ar_buf2))
&& ($ar_buf2[1]!="::") && !preg_match('/^fe80::/i', $ar_buf2[1])) {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').strtolower($ar_buf2[1]));
} elseif (preg_match('/^\s+media:\s+/i', $buf2) && preg_match('/[\(\s](\d+)(G*)base/i', $buf2, $ar_buf2)) {
if (isset($ar_buf2[2]) && strtoupper($ar_buf2[2])=="G") {
$unit = "G";
} else {
$unit = "M";
}
if (preg_match('/[<\s]([^\s<]+)-duplex/i', $buf2, $ar_buf3))
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1].$unit.'b/s '.strtolower($ar_buf3[1]));
else
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1].$unit.'b/s');
}
}
}
$this->sys->setNetDevices($dev);
}
}
}
}
 
if ( isset( $ar_buf[1] ) && $ar_buf[1] == 'class IOMedia' && preg_match('/Media/', $ar_buf[0])) {
$results[$j++]['model'] = $ar_buf[0];
}
}
asort($results);
return array_values(array_unique($results));
}
/**
* get icon name
*
* @return void
*/
protected function distro()
{
$this->sys->setDistributionIcon('Darwin.png');
if (!CommonFunctions::executeProgram('system_profiler', 'SPSoftwareDataType', $buffer, PSI_DEBUG)) {
parent::distro();
} else {
$arrBuff = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
foreach ($arrBuff as $line) {
$arrLine = preg_split("/:/", $line, -1, PREG_SPLIT_NO_EMPTY);
if (trim($arrLine[0]) === "System Version") {
$distro = trim($arrLine[1]);
 
function memory () {
$s = $this->grab_key('hw.memsize');
if (preg_match('/^Mac OS|^OS X|^macOS/', $distro)) {
$this->sys->setDistributionIcon('Apple.png');
if (preg_match('/(^Mac OS X Server|^Mac OS X|^OS X Server|^OS X|^macOS Server|^macOS) (\d+\.\d+)/', $distro, $ver)
&& ($list = @parse_ini_file(PSI_APP_ROOT."/data/osnames.ini", true))
&& isset($list['OS X'][$ver[2]])) {
$distro.=' '.$list['OS X'][$ver[2]];
}
}
 
$results['ram'] = array();
$results['swap'] = array();
$results['devswap'] = array();
$pstat = execute_program('vm_stat'); // use darwin's vm_stat
$lines = explode("\n", $pstat);
for ($i = 0, $max = sizeof($lines); $i < $max; $i++) {
$ar_buf = preg_split("/\s+/", $lines[$i], 19);
$this->sys->setDistribution($distro);
 
if ($i == 1) {
$results['ram']['free'] = $ar_buf[2] * 4; // calculate free memory from page sizes (each page = 4MB)
}
}
return;
}
}
}
}
 
$results['ram']['total'] = $s / 1024;
$results['ram']['shared'] = 0;
$results['ram']['buffers'] = 0;
$results['ram']['used'] = $results['ram']['total'] - $results['ram']['free'];
$results['ram']['cached'] = 0;
/**
* Processes
*
* @return void
*/
protected function _processes()
{
if (CommonFunctions::executeProgram('ps', 'aux', $bufr, PSI_DEBUG)) {
$lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
$processes['*'] = 0;
foreach ($lines as $line) {
if (preg_match("/^\S+\s+\d+\s+\S+\s+\S+\s+\d+\s+\d+\s+\S+\s+(\w)/", $line, $ar_buf)) {
$processes['*']++;
$state = $ar_buf[1];
if ($state == 'U') $state = 'D'; //linux format
elseif ($state == 'I') $state = 'S';
elseif ($state == 'D') $state = 'd'; //invalid
if (isset($processes[$state])) {
$processes[$state]++;
} else {
$processes[$state] = 1;
}
}
}
if ($processes['*'] > 0) {
$this->sys->setProcesses($processes);
}
}
}
 
$results['ram']['percent'] = round(($results['ram']['used'] * 100) / $results['ram']['total']);
// need to fix the swap info...
// meanwhile silence and / or disable the swap information
$pstat = execute_program('swapinfo', '-k', false);
if( $pstat != "ERROR" ) {
$lines = explode("\n", $pstat);
 
for ($i = 0, $max = sizeof($lines); $i < $max; $i++) {
$ar_buf = preg_split("/\s+/", $lines[$i], 6);
if ($i == 0) {
$results['swap']['total'] = 0;
$results['swap']['used'] = 0;
$results['swap']['free'] = 0;
} else {
$results['swap']['total'] = $results['swap']['total'] + $ar_buf[1];
$results['swap']['used'] = $results['swap']['used'] + $ar_buf[2];
$results['swap']['free'] = $results['swap']['free'] + $ar_buf[3];
}
}
$results['swap']['percent'] = round(($results['swap']['used'] * 100) / $results['swap']['total']);
/**
* get the information
*
* @see PSI_Interface_OS::build()
*
* @return Void
*/
public function build()
{
parent::build();
if (!$this->blockname || $this->blockname==='vitals') {
$this->_uptime();
$this->_processes();
}
if (!$this->blockname || $this->blockname==='hardware') {
$this->_tb();
}
if (!$this->blockname || $this->blockname==='network') {
$this->_network();
}
}
return $results;
}
 
function network () {
$netstat = execute_program('netstat', '-nbdi | cut -c1-24,42- | grep Link');
$lines = explode("\n", $netstat);
$results = array();
for ($i = 0, $max = sizeof($lines); $i < $max; $i++) {
$ar_buf = preg_split("/\s+/", $lines[$i], 10);
if (!empty($ar_buf[0])) {
$results[$ar_buf[0]] = array();
 
$results[$ar_buf[0]]['rx_bytes'] = $ar_buf[5];
$results[$ar_buf[0]]['rx_packets'] = $ar_buf[3];
$results[$ar_buf[0]]['rx_errs'] = $ar_buf[4];
$results[$ar_buf[0]]['rx_drop'] = isset( $ar_buf[10] ) ? $ar_buf[10] : 0;
 
$results[$ar_buf[0]]['tx_bytes'] = $ar_buf[8];
$results[$ar_buf[0]]['tx_packets'] = $ar_buf[6];
$results[$ar_buf[0]]['tx_errs'] = $ar_buf[7];
$results[$ar_buf[0]]['tx_drop'] = isset( $ar_buf[10] ) ? $ar_buf[10] : 0;
 
$results[$ar_buf[0]]['errs'] = $ar_buf[4] + $ar_buf[7];
$results[$ar_buf[0]]['drop'] = isset( $ar_buf[10] ) ? $ar_buf[10] : 0;
}
}
return $results;
}
 
function distroicon () {
$result = 'Darwin.png';
return($result);
}
 
}
 
?>
}
/web/acc/phpsysinfo/includes/os/class.DragonFly.inc.php
0,0 → 1,157
<?php
/**
* DragonFly System Class
*
* PHP version 5
*
* @category PHP
* @package PSI DragonFly OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.DragonFly.inc.php 287 2009-06-26 12:11:59Z bigmichi1 $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* DragonFly sysinfo class
* get all the required information from DragonFly system
*
* @category PHP
* @package PSI DragonFly OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class DragonFly extends BSDCommon
{
/**
* define the regexp for log parser
*/
public function __construct($blockname = false)
{
parent::__construct($blockname);
$this->setCPURegExp1("/^cpu(.*)\, (.*) MHz/");
$this->setCPURegExp2("/^(.*) at scsibus.*: <(.*)> .*/");
$this->setSCSIRegExp2("/^(da[0-9]+): (.*)MB /");
$this->setPCIRegExp1("/(.*): <(.*)>(.*) (pci|legacypci)[0-9]+$/");
$this->setPCIRegExp2("/(.*): <(.*)>.* at [0-9\.]+$/");
}
 
/**
* UpTime
* time the system is running
*
* @return void
*/
private function _uptime()
{
$a = $this->grabkey('kern.boottime');
preg_match("/sec = ([0-9]+)/", $a, $buf);
$this->sys->setUptime(time() - $buf[1]);
}
 
/**
* get network information
*
* @return void
*/
private function _network()
{
CommonFunctions::executeProgram('netstat', '-nbdi | cut -c1-25,44- | grep "^[a-z]*[0-9][ \t].*Link"', $netstat_b);
CommonFunctions::executeProgram('netstat', '-ndi | cut -c1-25,44- | grep "^[a-z]*[0-9][ \t].*Link"', $netstat_n);
$lines_b = preg_split("/\n/", $netstat_b, -1, PREG_SPLIT_NO_EMPTY);
$lines_n = preg_split("/\n/", $netstat_n, -1, PREG_SPLIT_NO_EMPTY);
for ($i = 0, $max = sizeof($lines_b); $i < $max; $i++) {
$ar_buf_b = preg_split("/\s+/", $lines_b[$i]);
$ar_buf_n = preg_split("/\s+/", $lines_n[$i]);
if (!empty($ar_buf_b[0]) && (!empty($ar_buf_n[5]) || ($ar_buf_n[5] === "0"))) {
$dev = new NetDevice();
$dev->setName($ar_buf_b[0]);
$dev->setTxBytes($ar_buf_b[8]);
$dev->setRxBytes($ar_buf_b[5]);
$dev->setErrors($ar_buf_n[4] + $ar_buf_n[6]);
$dev->setDrops($ar_buf_n[8]);
$this->sys->setNetDevices($dev);
}
}
}
 
/**
* get the ide information
*
* @return void
*/
protected function ide()
{
foreach ($this->readdmesg() as $line) {
if (preg_match('/^(.*): (.*) <(.*)> at (ata[0-9]+\-(.*)) (.*)/', $line, $ar_buf)) {
$dev = new HWDevice();
$dev->setName($ar_buf[1]);
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS && !preg_match("/^acd[0-9]+(.*)/", $ar_buf[1])) {
$dev->setCapacity($ar_buf[2] * 1024 * 1024);
}
$this->sys->setIdeDevices($dev);
}
}
}
 
/**
* get icon name
*
* @return void
*/
private function _distroicon()
{
$this->sys->setDistributionIcon('DragonFly.png');
}
 
/**
* Processes
*
* @return void
*/
protected function _processes()
{
if (CommonFunctions::executeProgram('ps', 'aux', $bufr, PSI_DEBUG)) {
$lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
$processes['*'] = 0;
foreach ($lines as $line) {
if (preg_match("/^\S+\s+\d+\s+\S+\s+\S+\s+\d+\s+\d+\s+\S+\s+(\w)/", $line, $ar_buf)) {
$processes['*']++;
$state = $ar_buf[1];
if ($state == 'I') $state = 'S'; //linux format
if (isset($processes[$state])) {
$processes[$state]++;
} else {
$processes[$state] = 1;
}
}
}
if ($processes['*'] > 0) {
$this->sys->setProcesses($processes);
}
}
}
 
/**
* get the information
*
* @see BSDCommon::build()
*
* @return Void
*/
public function build()
{
parent::build();
if (!$this->blockname || $this->blockname==='vitals') {
$this->_distroicon();
$this->_uptime();
$this->_processes();
}
if (!$this->blockname || $this->blockname==='network') {
$this->_network();
}
}
}
/web/acc/phpsysinfo/includes/os/class.FreeBSD.inc.php
1,108 → 1,208
<?php
<?php
/**
* FreeBSD System Class
*
* PHP version 5
*
* @category PHP
* @package PSI FreeBSD OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.FreeBSD.inc.php 696 2012-09-09 11:24:04Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* FreeBSD sysinfo class
* get all the required information from FreeBSD system
*
* @category PHP
* @package PSI FreeBSD OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class FreeBSD extends BSDCommon
{
/**
* define the regexp for log parser
*/
public function __construct($blockname = false)
{
parent::__construct($blockname);
$this->setCPURegExp1("/CPU: (.*) \((.*)-MHz (.*)\)/");
$this->setCPURegExp2("/(.*) ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)/");
$this->setSCSIRegExp1("/^(.*): <(.*)> .*SCSI.*device/");
$this->setSCSIRegExp2("/^(da[0-9]+): (.*)MB /");
$this->setSCSIRegExp3("/^(da[0-9]+|cd[0-9]+): Serial Number (.*)/");
$this->setPCIRegExp1("/(.*): <(.*)>(.*) pci[0-9]+$/");
$this->setPCIRegExp2("/(.*): <(.*)>.* at [.0-9]+ irq/");
}
 
// phpSysInfo - A PHP System Information Script
// http://phpsysinfo.sourceforge.net/
/**
* UpTime
* time the system is running
*
* @return void
*/
private function _uptime()
{
$s = preg_split('/ /', $this->grabkey('kern.boottime'));
$a = preg_replace('/,/', '', $s[3]);
$this->sys->setUptime(time() - $a);
}
 
// 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.
/**
* get network information
*
* @return void
*/
private function _network()
{
$dev = null;
if (CommonFunctions::executeProgram('netstat', '-nibd', $netstat, PSI_DEBUG)) {
$lines = preg_split("/\n/", $netstat, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
$ar_buf = preg_split("/\s+/", $line);
if (!empty($ar_buf[0])) {
if (preg_match('/^<Link/i', $ar_buf[2])) {
$dev = new NetDevice();
$dev->setName($ar_buf[0]);
if ((strlen($ar_buf[3]) < 17) && ($ar_buf[0] != $ar_buf[3])) { /* no MAC or dev name*/
if (isset($ar_buf[11]) && (trim($ar_buf[11]) != '')) { /* Idrop column exist*/
$dev->setTxBytes($ar_buf[9]);
$dev->setRxBytes($ar_buf[6]);
$dev->setErrors($ar_buf[4] + $ar_buf[8]);
$dev->setDrops($ar_buf[11] + $ar_buf[5]);
} else {
$dev->setTxBytes($ar_buf[8]);
$dev->setRxBytes($ar_buf[5]);
$dev->setErrors($ar_buf[4] + $ar_buf[7]);
$dev->setDrops($ar_buf[10]);
}
} else {
if (isset($ar_buf[12]) && (trim($ar_buf[12]) != '')) { /* Idrop column exist*/
$dev->setTxBytes($ar_buf[10]);
$dev->setRxBytes($ar_buf[7]);
$dev->setErrors($ar_buf[5] + $ar_buf[9]);
$dev->setDrops($ar_buf[12] + $ar_buf[6]);
} else {
$dev->setTxBytes($ar_buf[9]);
$dev->setRxBytes($ar_buf[6]);
$dev->setErrors($ar_buf[5] + $ar_buf[8]);
$dev->setDrops($ar_buf[11]);
}
}
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS) && (CommonFunctions::executeProgram('ifconfig', $ar_buf[0].' 2>/dev/null', $bufr2, PSI_DEBUG))) {
$bufe2 = preg_split("/\n/", $bufr2, -1, PREG_SPLIT_NO_EMPTY);
foreach ($bufe2 as $buf2) {
if (preg_match('/^\s+ether\s+(\S+)/i', $buf2, $ar_buf2)) {
if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').preg_replace('/:/', '-', strtoupper($ar_buf2[1])));
} elseif (preg_match('/^\s+inet\s+(\S+)\s+netmask/i', $buf2, $ar_buf2)) {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1]);
} elseif ((preg_match('/^\s+inet6\s+([^\s%]+)\s+prefixlen/i', $buf2, $ar_buf2)
|| preg_match('/^\s+inet6\s+([^\s%]+)%\S+\s+prefixlen/i', $buf2, $ar_buf2))
&& ($ar_buf2[1]!="::") && !preg_match('/^fe80::/i', $ar_buf2[1])) {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').strtolower($ar_buf2[1]));
} elseif (preg_match('/^\s+media:\s+/i', $buf2) && preg_match('/[\(\s](\d+)(G*)base/i', $buf2, $ar_buf2)) {
if (isset($ar_buf2[2]) && strtoupper($ar_buf2[2])=="G") {
$unit = "G";
} else {
$unit = "M";
}
if (preg_match('/[<\s]([^\s<]+)-duplex/i', $buf2, $ar_buf3))
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1].$unit.'b/s '.strtolower($ar_buf3[1]));
else
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1].$unit.'b/s');
}
}
}
$this->sys->setNetDevices($dev);
}
}
}
}
}
 
// 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.FreeBSD.inc.php,v 1.17 2006/04/18 16:22:26 bigmichi1 Exp $
if (!defined('IN_PHPSYSINFO')) {
die("No Hacking");
}
 
require_once(APP_ROOT . '/includes/os/class.BSD.common.inc.php');
 
class sysinfo extends bsd_common {
var $cpu_regexp = "";
var $scsi_regexp1 = "";
var $scsi_regexp2 = "";
var $cpu_regexp2 = "";
// Our contstructor
// this function is run on the initialization of this class
function sysinfo () {
$this->bsd_common();
$this->cpu_regexp = "CPU: (.*) \((.*)-MHz (.*)\)";
$this->scsi_regexp1 = "^(.*): <(.*)> .*SCSI.*device";
$this->scsi_regexp2 = "^(da[0-9]): (.*)MB ";
$this->cpu_regexp2 = "/(.*) ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)/";
}
 
function get_sys_ticks () {
$s = explode(' ', $this->grab_key('kern.boottime'));
$a = ereg_replace('{ ', '', $s[3]);
$sys_ticks = time() - $a;
return $sys_ticks;
}
 
function network () {
$netstat = execute_program('netstat', '-nibd | grep Link');
$lines = explode("\n", $netstat);
$results = array();
for ($i = 0, $max = sizeof($lines); $i < $max; $i++) {
$ar_buf = preg_split("/\s+/", $lines[$i]);
if (!empty($ar_buf[0])) {
$results[$ar_buf[0]] = array();
 
if (strlen($ar_buf[3]) < 15) {
$results[$ar_buf[0]]['rx_bytes'] = $ar_buf[5];
$results[$ar_buf[0]]['rx_packets'] = $ar_buf[3];
$results[$ar_buf[0]]['rx_errs'] = $ar_buf[4];
$results[$ar_buf[0]]['rx_drop'] = $ar_buf[10];
 
$results[$ar_buf[0]]['tx_bytes'] = $ar_buf[8];
$results[$ar_buf[0]]['tx_packets'] = $ar_buf[6];
$results[$ar_buf[0]]['tx_errs'] = $ar_buf[7];
$results[$ar_buf[0]]['tx_drop'] = $ar_buf[10];
 
$results[$ar_buf[0]]['errs'] = $ar_buf[4] + $ar_buf[7];
$results[$ar_buf[0]]['drop'] = $ar_buf[10];
/**
* get icon name and distro extended check
*
* @return void
*/
private function _distroicon()
{
if (extension_loaded('pfSense') && CommonFunctions::rfts('/etc/version', $version, 1, 4096, false) && (trim($version) != '')) { // pfSense detection
$this->sys->setDistribution('pfSense '. trim($version));
$this->sys->setDistributionIcon('pfSense.png');
} else {
$results[$ar_buf[0]]['rx_bytes'] = $ar_buf[6];
$results[$ar_buf[0]]['rx_packets'] = $ar_buf[4];
$results[$ar_buf[0]]['rx_errs'] = $ar_buf[5];
$results[$ar_buf[0]]['rx_drop'] = $ar_buf[11];
$this->sys->setDistributionIcon('FreeBSD.png');
}
}
 
$results[$ar_buf[0]]['tx_bytes'] = $ar_buf[9];
$results[$ar_buf[0]]['tx_packets'] = $ar_buf[7];
$results[$ar_buf[0]]['tx_errs'] = $ar_buf[8];
$results[$ar_buf[0]]['tx_drop'] = $ar_buf[11];
/**
* extend the memory information with additional values
*
* @return void
*/
private function _memoryadditional()
{
$pagesize = $this->grabkey("hw.pagesize");
$this->sys->setMemCache($this->grabkey("vm.stats.vm.v_cache_count") * $pagesize);
$this->sys->setMemApplication(($this->grabkey("vm.stats.vm.v_active_count") + $this->grabkey("vm.stats.vm.v_wire_count")) * $pagesize);
$this->sys->setMemBuffer($this->sys->getMemUsed() - $this->sys->getMemApplication() - $this->sys->getMemCache());
}
 
$results[$ar_buf[0]]['errs'] = $ar_buf[5] + $ar_buf[8];
$results[$ar_buf[0]]['drop'] = $ar_buf[11];
}
}
}
return $results;
}
/**
* Processes
*
* @return void
*/
protected function _processes()
{
if (CommonFunctions::executeProgram('ps', 'aux', $bufr, PSI_DEBUG)) {
$lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
$processes['*'] = 0;
foreach ($lines as $line) {
if (preg_match("/^\S+\s+\d+\s+\S+\s+\S+\s+\d+\s+\d+\s+\S+\s+(\w)/", $line, $ar_buf)) {
$processes['*']++;
$state = $ar_buf[1];
if ($state == 'L') $state = 'D'; //linux format
elseif ($state == 'I') $state = 'S';
if (isset($processes[$state])) {
$processes[$state]++;
} else {
$processes[$state] = 1;
}
}
}
if ($processes['*'] > 0) {
$this->sys->setProcesses($processes);
}
}
}
 
function distroicon () {
$result = 'FreeBSD.png';
return($result);
}
function memory_additional($results) {
$pagesize = $this->grab_key("hw.pagesize");
$results['ram']['cached'] = $this->grab_key("vm.stats.vm.v_cache_count") * $pagesize / 1024;
$results['ram']['cached_percent'] = round( $results['ram']['cached'] * 100 / $results['ram']['total']);
$results['ram']['app'] = $this->grab_key("vm.stats.vm.v_active_count") * $pagesize / 1024;
$results['ram']['app_percent'] = round( $results['ram']['app'] * 100 / $results['ram']['total']);
$results['ram']['buffers'] = $results['ram']['used'] - $results['ram']['app'] - $results['ram']['cached'];
$results['ram']['buffers_percent'] = round( $results['ram']['buffers'] * 100 / $results['ram']['total']);
return $results;
}
}
 
?>
/**
* get the information
*
* @see BSDCommon::build()
*
* @return Void
*/
public function build()
{
parent::build();
if (!$this->blockname || $this->blockname==='vitals') {
$this->_distroicon();
$this->_uptime();
$this->_processes();
}
if (!$this->blockname || $this->blockname==='network') {
$this->_network();
}
if (!$this->blockname || $this->blockname==='memory') {
$this->_memoryadditional();
}
}
}
/web/acc/phpsysinfo/includes/os/class.HPUX.inc.php
0,0 → 1,390
<?php
/**
* HP-UX System Class
*
* PHP version 5
*
* @category PHP
* @package PSI HPUX OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.HPUX.inc.php 596 2012-07-05 19:37:48Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* HP-UX sysinfo class
* get all the required information from HP-UX system
*
* @category PHP
* @package PSI HPUX OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class HPUX extends OS
{
/**
* Virtual Host Name
*
* @return void
*/
private function _hostname()
{
if (PSI_USE_VHOST === true) {
if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
} else {
if (CommonFunctions::executeProgram('hostname', '', $ret)) {
$this->sys->setHostname($ret);
}
}
}
 
/**
* HP-UX Version
*
* @return void
*/
private function _kernel()
{
if (CommonFunctions::executeProgram('uname', '-srvm', $ret)) {
$this->sys->setKernel($ret);
}
}
 
/**
* UpTime
* time the system is running
*
* @return void
*/
private function _uptime()
{
if (CommonFunctions::executeProgram('uptime', '', $buf)) {
if (preg_match("/up (\d+) days,\s*(\d+):(\d+),/", $buf, $ar_buf)) {
$min = $ar_buf[3];
$hours = $ar_buf[2];
$days = $ar_buf[1];
$this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60);
}
}
}
 
/**
* Processor Load
* optionally create a loadbar
*
* @return void
*/
private function _loadavg()
{
if (CommonFunctions::executeProgram('uptime', '', $buf)) {
if (preg_match("/average: (.*), (.*), (.*)$/", $buf, $ar_buf)) {
$this->sys->setLoad($ar_buf[1].' '.$ar_buf[2].' '.$ar_buf[3]);
}
}
}
 
/**
* CPU information
* All of the tags here are highly architecture dependant
*
* @return void
*/
private function _cpuinfo()
{
if (CommonFunctions::rfts('/proc/cpuinfo', $bufr)) {
$processors = preg_split('/\s?\n\s?\n/', trim($bufr));
foreach ($processors as $processor) {
$dev = new CpuDevice();
$details = preg_split("/\n/", $processor, -1, PREG_SPLIT_NO_EMPTY);
foreach ($details as $detail) {
$arrBuff = preg_split('/\s+:\s+/', trim($detail));
if (count($arrBuff) == 2) {
switch (strtolower($arrBuff[0])) {
case 'model name':
case 'cpu':
$dev->setModel($arrBuff[1]);
break;
case 'cpu mhz':
case 'clock':
$dev->setCpuSpeed($arrBuff[1]);
break;
case 'cycle frequency [hz]':
$dev->setCpuSpeed($arrBuff[1] / 1000000);
break;
case 'cpu0clktck':
$dev->setCpuSpeed(hexdec($arrBuff[1]) / 1000000); // Linux sparc64
break;
case 'l2 cache':
case 'cache size':
$dev->setCache(preg_replace("/[a-zA-Z]/", "", $arrBuff[1]) * 1024);
break;
case 'bogomips':
case 'cpu0bogo':
$dev->setBogomips($arrBuff[1]);
break;
}
}
}
}
}
}
 
/**
* PCI devices
*
* @return void
*/
private function _pci()
{
if (CommonFunctions::rfts('/proc/pci', $bufr)) {
$device = false;
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
foreach ($bufe as $buf) {
if (preg_match('/^\s*Bus\s/', $buf)) {
$device = true;
continue;
}
if ($device) {
$dev = new HWDevice();
$dev->setName(preg_replace('/\([^\)]+\)\.$/', '', trim($buf)));
$this->sys->setPciDevices($dev);
/*
list($key, $value) = preg_split('/: /', $buf, 2);
if (!preg_match('/bridge/i', $key) && !preg_match('/USB/i', $key)) {
$dev = new HWDevice();
$dev->setName(preg_replace('/\([^\)]+\)\.$/', '', trim($value)));
$this->sys->setPciDevices($dev);
}
*/
$device = false;
}
}
}
}
 
/**
* IDE devices
*
* @return void
*/
private function _ide()
{
$bufd = CommonFunctions::gdc('/proc/ide', false);
foreach ($bufd as $file) {
if (preg_match('/^hd/', $file)) {
$dev = new HWDevice();
$dev->setName(trim($file));
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS && CommonFunctions::rfts("/proc/ide/".$file."/media", $buf, 1)) {
if (trim($buf) == 'disk') {
if (CommonFunctions::rfts("/proc/ide/".$file."/capacity", $buf, 1, 4096, false)) {
$dev->setCapacity(trim($buf) * 512);
}
}
}
$this->sys->setIdeDevices($dev);
}
}
}
 
/**
* SCSI devices
*
* @return void
*/
private function _scsi()
{
$get_type = false;
if (CommonFunctions::rfts('/proc/scsi/scsi', $bufr, 0, 4096, PSI_DEBUG)) {
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
foreach ($bufe as $buf) {
if (preg_match('/Vendor: (.*) Model: (.*) Rev: (.*)/i', $buf, $dev)) {
$get_type = true;
continue;
}
if ($get_type) {
preg_match('/Type:\s+(\S+)/i', $buf, $dev_type);
$dev = new HWDevice();
$dev->setName($dev[1].' '.$dev[2].' ('.$dev_type[1].')');
$this->sys->setScsiDevices($dev);
$get_type = false;
}
}
}
}
 
/**
* USB devices
*
* @return void
*/
private function _usb()
{
if (CommonFunctions::rfts('/proc/bus/usb/devices', $bufr, 0, 4096, false)) {
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
$devnum = -1;
$results = array();
foreach ($bufe as $buf) {
if (preg_match('/^T/', $buf)) {
$devnum++;
$results[$devnum] = "";
} elseif (preg_match('/^S:/', $buf)) {
list($key, $value) = preg_split('/: /', $buf, 2);
list($key, $value2) = preg_split('/=/', $value, 2);
if (trim($key) != "SerialNumber") {
$results[$devnum] .= " ".trim($value2);
}
}
}
foreach ($results as $var) {
$dev = new HWDevice();
$dev->setName($var);
$this->sys->setUsbDevices($dev);
}
}
}
 
/**
* Network devices
* includes also rx/tx bytes
*
* @return void
*/
private function _network()
{
if (CommonFunctions::executeProgram('netstat', '-ni | tail -n +2', $netstat)) {
$lines = preg_split("/\n/", $netstat, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
$ar_buf = preg_split("/\s+/", $line);
if (! empty($ar_buf[0]) && ! empty($ar_buf[3])) {
$dev = new NetDevice();
$dev->setName($ar_buf[0]);
$dev->setRxBytes($ar_buf[4]);
$dev->setTxBytes($ar_buf[6]);
$dev->setErrors($ar_buf[5] + $ar_buf[7]);
$dev->setDrops($ar_buf[8]);
$this->sys->setNetDevices($dev);
}
}
}
}
 
/**
* Physical memory information and Swap Space information
*
* @return void
*/
private function _memory()
{
if (CommonFunctions::rfts('/proc/meminfo', $bufr)) {
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
foreach ($bufe as $buf) {
if (preg_match('/Mem:\s+(.*)$/', $buf, $ar_buf)) {
$ar_buf = preg_split('/\s+/', $ar_buf[1], 6);
$this->sys->setMemTotal($ar_buf[0]);
$this->sys->setMemUsed($ar_buf[1]);
$this->sys->setMemFree($ar_buf[2]);
$this->sys->setMemApplication($ar_buf[3]);
$this->sys->setMemBuffer($ar_buf[4]);
$this->sys->setMemCache($ar_buf[5]);
}
// Get info on individual swap files
if (CommonFunctions::rfts('/proc/swaps', $swaps)) {
$swapdevs = preg_split("/\n/", $swaps, -1, PREG_SPLIT_NO_EMPTY);
for ($i = 1, $max = (sizeof($swapdevs) - 1); $i < $max; $i++) {
$ar_buf = preg_split('/\s+/', $swapdevs[$i], 6);
$dev = new DiskDevice();
$dev->setMountPoint($ar_buf[0]);
$dev->setName("SWAP");
$dev->setFsType('swap');
$dev->setTotal($ar_buf[2] * 1024);
$dev->setUsed($ar_buf[3] * 1024);
$dev->setFree($dev->getTotal() - $dev->getUsed());
$this->sys->setSwapDevices($dev);
}
}
}
}
}
 
/**
* filesystem information
*
* @return void
*/
private function _filesystems()
{
if (CommonFunctions::executeProgram('df', '-kP', $df, PSI_DEBUG)) {
$mounts = preg_split("/\n/", $df, -1, PREG_SPLIT_NO_EMPTY);
if (CommonFunctions::executeProgram('mount', '-v', $s, PSI_DEBUG)) {
$lines = preg_split("/\n/", $s, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
$a = preg_split('/ /', $line, -1, PREG_SPLIT_NO_EMPTY);
$fsdev[$a[0]] = $a[4];
}
}
foreach ($mounts as $mount) {
$ar_buf = preg_split("/\s+/", $mount, 6);
$dev = new DiskDevice();
$dev->setName($ar_buf[0]);
$dev->setTotal($ar_buf[1] * 1024);
$dev->setUsed($ar_buf[2] * 1024);
$dev->setFree($ar_buf[3] * 1024);
$dev->setMountPoint($ar_buf[5]);
if (isset($fsdev[$ar_buf[0]])) {
$dev->setFsType($fsdev[$ar_buf[0]]);
}
$this->sys->setDiskDevices($dev);
}
}
}
 
/**
* Distribution
*
* @return void
*/
private function _distro()
{
$this->sys->setDistribution('HP-UX');
$this->sys->setDistributionIcon('HPUX.png');
}
 
/**
* get the information
*
* @see PSI_Interface_OS::build()
*
* @return Void
*/
public function build()
{
if (!$this->blockname || $this->blockname==='vitals') {
$this->_distro();
$this->_hostname();
$this->_kernel();
$this->_uptime();
$this->_users();
$this->_loadavg();
}
if (!$this->blockname || $this->blockname==='hardware') {
$this->_cpuinfo();
$this->_pci();
$this->_ide();
$this->_scsi();
$this->_usb();
}
if (!$this->blockname || $this->blockname==='network') {
$this->_network();
}
if (!$this->blockname || $this->blockname==='memory') {
$this->_memory();
}
if (!$this->blockname || $this->blockname==='filesystem') {
$this->_filesystems();
}
}
}
/web/acc/phpsysinfo/includes/os/class.Haiku.inc.php
0,0 → 1,391
<?php
/**
* Haiku System Class
*
* PHP version 5
*
* @category PHP
* @package PSI Haiku OS class
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
* @copyright 2012 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.Haiku.inc.php 687 2012-09-06 20:54:49Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* Haiku sysinfo class
* get all the required information from Haiku system
*
* @category PHP
* @package PSI Haiku OS class
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
* @copyright 2012 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class Haiku extends OS
{
/**
* get the cpu information
*
* @return void
*/
protected function _cpuinfo()
{
 
if (CommonFunctions::executeProgram('sysinfo', '-cpu', $bufr, PSI_DEBUG)) {
$cpus = preg_split("/\nCPU #\d+/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
$cpuspeed = "";
foreach ($cpus as $cpu) {
if (preg_match("/^.*running at (\d+)MHz/", $cpu, $ar_buf)) {
$cpuspeed = $ar_buf[1];
} elseif (preg_match("/^: \"(.*)\"/", $cpu, $ar_buf)) {
$dev = new CpuDevice();
$dev->setModel($ar_buf[1]);
$arrLines = preg_split("/\n/", $cpu, -1, PREG_SPLIT_NO_EMPTY);
foreach ($arrLines as $Line) {
if (preg_match("/^\s+Data TLB:\s+(.*)K-byte/", $Line, $Line_buf)) {
$dev->setCache(max($Line_buf[1]*1024, $dev->getCache()));
} elseif (preg_match("/^\s+Data TLB:\s+(.*)M-byte/", $Line, $Line_buf)) {
$dev->setCache(max($Line_buf[1]*1024*1024, $dev->getCache()));
} elseif (preg_match("/^\s+Data TLB:\s+(.*)G-byte/", $Line, $Line_buf)) {
$dev->setCache(max($Line_buf[1]*1024*1024*1024, $dev->getCache()));
} elseif (preg_match("/\s+VMX/", $Line, $Line_buf)) {
$dev->setVirt("vmx");
} elseif (preg_match("/\s+SVM/", $Line, $Line_buf)) {
$dev->setVirt("svm");
}
}
if ($cpuspeed != "") {
$dev->setCpuSpeed($cpuspeed);
}
$this->sys->setCpus($dev);
}
}
}
}
 
/**
* PCI devices
* get the pci device information
*
* @return void
*/
protected function _pci()
{
if (CommonFunctions::executeProgram('listdev', '', $bufr, PSI_DEBUG)) {
// $devices = preg_split("/^device |\ndevice /", $bufr, -1, PREG_SPLIT_NO_EMPTY);
$devices = preg_split("/^device /m", $bufr, -1, PREG_SPLIT_NO_EMPTY);
foreach ($devices as $device) {
$ar_buf = preg_split("/\n/", $device);
if (count($ar_buf) >= 3) {
if (preg_match("/^([^\(\[\n]*)/", $device, $ar_buf2)) {
if (preg_match("/^[^\(]*\((.*)\)/", $device, $ar_buf3)) {
$ar_buf2[1] = $ar_buf3[1];
}
$name = trim($ar_buf2[1]).": ";
 
if (preg_match("/^\s+vendor\s+[0-9a-fA-F]{4}:\s+(.*)/", $ar_buf[1], $ar_buf3)) {
$name .=$ar_buf3[1]." ";
}
if (preg_match("/^\s+device\s+[0-9a-fA-F]{4}:\s+(.*)/", $ar_buf[2], $ar_buf3)) {
$name .=$ar_buf3[1]." ";
}
$dev = new HWDevice();
$dev->setName(trim($name));
$this->sys->setPciDevices($dev);
}
}
}
}
}
 
/**
* USB devices
* get the usb device information
*
* @return void
*/
protected function _usb()
{
if (CommonFunctions::executeProgram('listusb', '', $bufr, PSI_DEBUG)) {
$devices = preg_split("/\n/", $bufr);
foreach ($devices as $device) {
if (preg_match("/^\S+\s+\S+\s+\"(.*)\"\s+\"(.*)\"/", $device, $ar_buf)) {
$dev = new HWDevice();
$dev->setName(trim($ar_buf[1]." ".$ar_buf[2]));
$this->sys->setUSBDevices($dev);
}
}
}
}
 
/**
* Haiku Version
*
* @return void
*/
private function _kernel()
{
if (CommonFunctions::executeProgram('uname', '-rvm', $ret)) {
$this->sys->setKernel($ret);
}
}
 
/**
* Distribution
*
* @return void
*/
protected function _distro()
{
if (CommonFunctions::executeProgram('uname', '-sr', $ret))
$this->sys->setDistribution($ret);
else
$this->sys->setDistribution('Haiku');
 
$this->sys->setDistributionIcon('Haiku.png');
}
 
/**
* UpTime
* time the system is running
*
* @return void
*/
private function _uptime()
{
if (CommonFunctions::executeProgram('uptime', '-u', $buf)) {
if (preg_match("/^up (\d+) minute[s]?/", $buf, $ar_buf)) {
$min = $ar_buf[1];
$this->sys->setUptime($min * 60);
} elseif (preg_match("/^up (\d+) hour[s]?, (\d+) minute[s]?/", $buf, $ar_buf)) {
$min = $ar_buf[2];
$hours = $ar_buf[1];
$this->sys->setUptime($hours * 3600 + $min * 60);
} elseif (preg_match("/^up (\d+) day[s]?, (\d+) hour[s]?, (\d+) minute[s]?/", $buf, $ar_buf)) {
$min = $ar_buf[3];
$hours = $ar_buf[2];
$days = $ar_buf[1];
$this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60);
}
}
}
 
/**
* Processor Load
* optionally create a loadbar
*
* @return void
*/
private function _loadavg()
{
if (CommonFunctions::executeProgram('top', '-n 1 -i 1', $buf)) {
if (preg_match("/\s+(\S+)%\s+TOTAL\s+\(\S+%\s+idle time/", $buf, $ar_buf)) {
$this->sys->setLoad($ar_buf[1]);
if (PSI_LOAD_BAR) {
$this->sys->setLoadPercent(round($ar_buf[1]));
}
}
}
}
 
/**
* Number of Users
*
* @return void
*/
protected function _users()
{
$this->sys->setUsers(1);
}
 
/**
* Virtual Host Name
*
* @return void
*/
private function _hostname()
{
if (PSI_USE_VHOST === true) {
if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
} else {
if (CommonFunctions::executeProgram('uname', '-n', $result, PSI_DEBUG)) {
$ip = gethostbyname($result);
if ($ip != $result) {
$this->sys->setHostname(gethostbyaddr($ip));
}
}
}
}
 
/**
* Physical memory information and Swap Space information
*
* @return void
*/
private function _memory()
{
if (CommonFunctions::executeProgram('sysinfo', '-mem', $bufr, PSI_DEBUG)) {
if (preg_match("/(.*)bytes free\s+\(used\/max\s+(.*)\s+\/\s+(.*)\)\s*\n\s+\(cached\s+(.*)\)/", $bufr, $ar_buf)) {
$this->sys->setMemTotal($ar_buf[3]);
$this->sys->setMemFree($ar_buf[1]);
$this->sys->setMemCache($ar_buf[4]);
$this->sys->setMemUsed($ar_buf[2]);
}
}
if (CommonFunctions::executeProgram('vmstat', '', $bufr, PSI_DEBUG)) {
if (preg_match("/max swap space:\s+(.*)\nfree swap space:\s+(.*)\n/", $bufr, $ar_buf)) {
if ($ar_buf[1]>0) {
$dev = new DiskDevice();
$dev->setMountPoint("/boot/common/var/swap");
$dev->setName("SWAP");
$dev->setTotal($ar_buf[1]);
$dev->setFree($ar_buf[2]);
$dev->setUSed($ar_buf[1]-$ar_buf[2]);
$this->sys->setSwapDevices($dev);
}
}
}
}
 
/**
* filesystem information
*
* @return void
*/
private function _filesystems()
{
if (CommonFunctions::executeProgram('df', '-b', $df, PSI_DEBUG)) {
$df = preg_split("/\n/", $df, -1, PREG_SPLIT_NO_EMPTY);
foreach ($df as $df_line) {
$ar_buf = preg_split("/\s+/", $df_line);
if ((substr($df_line, 0, 1) == "/") && (count($ar_buf) == 6)) {
$dev = new DiskDevice();
$dev->setMountPoint($ar_buf[0]);
$dev->setName($ar_buf[5]);
$dev->setFsType($ar_buf[1]);
$dev->setOptions($ar_buf[4]);
$dev->setTotal($ar_buf[2] * 1024);
$dev->setFree($ar_buf[3] * 1024);
$dev->setUsed($dev->getTotal() - $dev->getFree());
$this->sys->setDiskDevices($dev);
}
}
}
}
 
/**
* network information
*
* @return void
*/
private function _network()
{
if (CommonFunctions::executeProgram('ifconfig', '', $bufr, PSI_DEBUG)) {
$lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
$was = false;
$errors = 0;
$drops = 0;
$dev = null;
foreach ($lines as $line) {
if (preg_match("/^(\S+)/", $line, $ar_buf)) {
if ($was) {
$dev->setErrors($errors);
$dev->setDrops($drops);
$this->sys->setNetDevices($dev);
}
$errors = 0;
$drops = 0;
$dev = new NetDevice();
$dev->setName($ar_buf[1]);
$was = true;
} else {
if ($was) {
if (preg_match('/\sReceive:\s\d+\spackets,\s(\d+)\serrors,\s(\d+)\sbytes,\s\d+\smcasts,\s(\d+)\sdropped/i', $line, $ar_buf2)) {
$errors +=$ar_buf2[1];
$drops +=$ar_buf2[3];
$dev->setRxBytes($ar_buf2[2]);
} elseif (preg_match('/\sTransmit:\s\d+\spackets,\s(\d+)\serrors,\s(\d+)\sbytes,\s\d+\smcasts,\s(\d+)\sdropped/i', $line, $ar_buf2)) {
$errors +=$ar_buf2[1];
$drops +=$ar_buf2[3];
$dev->setTxBytes($ar_buf2[2]);
}
 
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) {
if (preg_match('/\sEthernet,\s+Address:\s(\S*)/i', $line, $ar_buf2)) {
if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) $dev->setInfo(preg_replace('/:/', '-', strtoupper($ar_buf2[1])));
} elseif (preg_match('/^\s+inet\saddr:\s(\S*),/i', $line, $ar_buf2)) {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1]);
} elseif (preg_match('/^\s+inet6\saddr:\s(\S*),/i', $line, $ar_buf2)
&& ($ar_buf2[1]!="::") && !preg_match('/^fe80::/i', $ar_buf2[1])) {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').strtolower($ar_buf2[1]));
}
}
}
}
}
if ($was) {
$dev->setErrors($errors);
$dev->setDrops($drops);
$this->sys->setNetDevices($dev);
}
}
}
 
/**
* Processes
*
* @return void
*/
protected function _processes()
{
if (CommonFunctions::executeProgram('ps', '', $bufr, PSI_DEBUG)) {
$lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
$processes['*'] = 0;
foreach ($lines as $line) {
if (preg_match("/^(kernel_team|\/)/", $line, $ar_buf)) {
$processes['*']++;
}
}
if ($processes['*'] > 0) {
$processes[' '] = $processes['*'];
$this->sys->setProcesses($processes);
}
}
}
 
/**
* get the information
*
* @return Void
*/
public function build()
{
$this->error->addError("WARN", "The Haiku version of phpSysInfo is a work in progress, some things currently don't work");
if (!$this->blockname || $this->blockname==='vitals') {
$this->_distro();
$this->_hostname();
$this->_kernel();
$this->_uptime();
$this->_users();
$this->_loadavg();
$this->_processes();
}
if (!$this->blockname || $this->blockname==='hardware') {
$this->_cpuinfo();
$this->_pci();
$this->_usb();
}
if (!$this->blockname || $this->blockname==='network') {
$this->_network();
}
if (!$this->blockname || $this->blockname==='memory') {
$this->_memory();
}
if (!$this->blockname || $this->blockname==='filesystem') {
$this->_filesystems();
}
}
}
/web/acc/phpsysinfo/includes/os/class.Linux.inc.php
1,553 → 1,1693
<?php
// 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.Linux.inc.php,v 1.88 2007/02/25 20:50:52 bigmichi1 Exp $
<?php
/**
* Linux System Class
*
* PHP version 5
*
* @category PHP
* @package PSI Linux OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.Linux.inc.php 712 2012-12-05 14:09:18Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* Linux sysinfo class
* get all the required information from Linux system
*
* @category PHP
* @package PSI Linux OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class Linux extends OS
{
/**
* Assoc array of all CPUs loads.
*/
protected $_cpu_loads;
 
if (!defined('IN_PHPSYSINFO')) {
die("No Hacking");
}
/**
* Machine
*
* @return void
*/
private function _machine()
{
$machine = "";
if ((CommonFunctions::rfts('/var/log/dmesg', $result, 0, 4096, false)
&& preg_match('/^[\s\[\]\.\d]*DMI:\s*(.*)/m', $result, $ar_buf))
||(CommonFunctions::executeProgram('dmesg', '', $result, false)
&& preg_match('/^[\s\[\]\.\d]*DMI:\s*(.*)/m', $result, $ar_buf))) {
$machine = trim($ar_buf[1]);
} else { //data from /sys/devices/virtual/dmi/id/
$product = "";
$board = "";
$bios = "";
if (CommonFunctions::rfts('/sys/devices/virtual/dmi/id/board_vendor', $buf, 1, 4096, false) && (trim($buf)!="")) {
$machine = trim($buf);
}
if (CommonFunctions::rfts('/sys/devices/virtual/dmi/id/product_name', $buf, 1, 4096, false) && (trim($buf)!="")) {
$product = trim($buf);
}
if (CommonFunctions::rfts('/sys/devices/virtual/dmi/id/board_name', $buf, 1, 4096, false) && (trim($buf)!="")) {
$board = trim($buf);
}
if (CommonFunctions::rfts('/sys/devices/virtual/dmi/id/bios_version', $buf, 1, 4096, false) && (trim($buf)!="")) {
$bios = trim($buf);
}
if (CommonFunctions::rfts('/sys/devices/virtual/dmi/id/bios_date', $buf, 1, 4096, false) && (trim($buf)!="")) {
$bios = trim($bios." ".trim($buf));
}
if ($product != "") {
$machine .= " ".$product;
}
if ($board != "") {
$machine .= "/".$board;
}
if ($bios != "") {
$machine .= ", BIOS ".$bios;
}
}
 
require_once(APP_ROOT . '/includes/os/class.BSD.common.inc.php');
if ($machine != "") {
$machine = trim(preg_replace("/^\/,?/", "", preg_replace("/ ?(To be filled by O\.E\.M\.|System manufacturer|System Product Name|Not Specified) ?/i", "", $machine)));
}
 
class sysinfo {
var $inifile = "distros.ini";
var $icon = "unknown.png";
var $distro = "unknown";
var $parser;
// get the distro name and icon when create the sysinfo object
function sysinfo() {
$this->parser = new Parser();
$this->parser->df_param = 'P';
$list = @parse_ini_file(APP_ROOT . "/" . $this->inifile, true);
if (!$list) {
return;
}
$distro_info = execute_program('lsb_release','-a 2> /dev/null', false); // We have the '2> /dev/null' because Ubuntu gives an error on this command which causes the distro to be unknown
if ( $distro_info != 'ERROR') {
$distro_tmp = explode("\n",$distro_info);
foreach( $distro_tmp as $info ) {
$info_tmp = explode(':', $info, 2);
$distro[ $info_tmp[0] ] = trim($info_tmp[1]);
}
if( !isset( $list[$distro['Distributor ID']] ) ){
return;
}
$this->icon = isset($list[$distro['Distributor ID']]["Image"]) ? $list[$distro['Distributor ID']]["Image"] : $this->icon;
$this->distro = $distro['Description'];
} else { // Fall back in case 'lsb_release' does not exist ;)
foreach ($list as $section => $distribution) {
if (!isset($distribution["Files"])) {
continue;
} else {
foreach (explode(";", $distribution["Files"]) as $filename) {
if (file_exists($filename)) {
$buf = rfts( $filename );
$this->icon = isset($distribution["Image"]) ? $distribution["Image"] : $this->icon;
$this->distro = isset($distribution["Name"]) ? $distribution["Name"] . " " . trim($buf) : trim($buf);
break 2;
}
}
}
}
}
}
// get our apache SERVER_NAME or vhost
function vhostname () {
if (! ($result = getenv('SERVER_NAME'))) {
$result = 'N.A.';
}
return $result;
}
// get the IP address of our vhost name
function vip_addr () {
return gethostbyname($this->vhostname());
}
// get our canonical hostname
function chostname () {
$result = rfts( '/proc/sys/kernel/hostname', 1 );
if ( $result == "ERROR" ) {
$result = "N.A.";
if (CommonFunctions::fileexists($filename="/etc/config/uLinux.conf") // QNAP detection
&& CommonFunctions::rfts($filename, $buf, 0, 4096, false)
&& preg_match("/^Rsync\sModel\s*=\s*QNAP/m", $buf)
&& CommonFunctions::fileexists($filename="/etc/platform.conf") // Platform detection
&& CommonFunctions::rfts($filename, $buf, 0, 4096, false)
&& preg_match("/^DISPLAY_NAME\s*=\s*(\S+)/m", $buf, $mach_buf) && ($mach_buf[1]!=="")) {
if ($machine != "") {
$machine = "QNAP ".$mach_buf[1].' - '.$machine;
} else {
$machine = "QNAP ".$mach_buf[1];
}
}
 
if ($machine != "") {
$this->sys->setMachine($machine);
}
}
//else {
// $result = gethostbyaddr( gethostbyname( trim( $result ) ) );
//}
return $result;
}
// get the IP address of our canonical hostname
function ip_addr () {
if (!($result = getenv('SERVER_ADDR'))) {
$result = gethostbyname($this->chostname());
}
return $result;
}
 
function kernel () {
$buf = rfts( '/proc/version', 1 );
if ( $buf == "ERROR" ) {
$result = "N.A.";
} else {
if (preg_match('/version (.*?) /', $buf, $ar_buf)) {
$result = $ar_buf[1];
/**
* Hostname
*
* @return void
*/
protected function _hostname()
{
if (PSI_USE_VHOST === true) {
if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
} else {
if (CommonFunctions::rfts('/proc/sys/kernel/hostname', $result, 1, 4096, PSI_DEBUG && (PSI_OS != 'Android'))) {
$result = trim($result);
$ip = gethostbyname($result);
if ($ip != $result) {
$this->sys->setHostname(gethostbyaddr($ip));
}
} elseif (CommonFunctions::executeProgram('hostname', '', $ret)) {
$this->sys->setHostname($ret);
}
 
if (preg_match('/SMP/', $buf)) {
$result .= ' (SMP)';
}
}
}
return $result;
}
function uptime () {
$buf = rfts( '/proc/uptime', 1 );
$ar_buf = explode( ' ', $buf );
$result = trim( $ar_buf[0] );
}
}
 
return $result;
}
/**
* Kernel Version
*
* @return void
*/
private function _kernel()
{
$result = "";
if (CommonFunctions::executeProgram($uname="uptrack-uname", '-r', $strBuf, false) || // show effective kernel if ksplice uptrack is installed
CommonFunctions::executeProgram($uname="uname", '-r', $strBuf, PSI_DEBUG)) {
$result = $strBuf;
if (CommonFunctions::executeProgram($uname, '-v', $strBuf, PSI_DEBUG)) {
if (preg_match('/SMP/', $strBuf)) {
$result .= ' (SMP)';
}
}
if (CommonFunctions::executeProgram($uname, '-m', $strBuf, PSI_DEBUG)) {
$result .= ' '.$strBuf;
}
} elseif (CommonFunctions::rfts('/proc/version', $strBuf, 1) && preg_match('/version\s+(\S+)/', $strBuf, $ar_buf)) {
$result = $ar_buf[1];
if (preg_match('/SMP/', $strBuf)) {
$result .= ' (SMP)';
}
}
if ($result != "") {
if (CommonFunctions::rfts('/proc/self/cgroup', $strBuf2, 0, 4096, false)) {
if (preg_match('/:\/lxc\//m', $strBuf2)) {
$result .= ' [lxc]';
} elseif (preg_match('/:\/docker\//m', $strBuf2)) {
$result .= ' [docker]';
} elseif (preg_match('/:\/system\.slice\/docker\-/m', $strBuf2)) {
$result .= ' [docker]';
}
}
if (CommonFunctions::rfts('/proc/version', $strBuf2, 1, 4096, false)
&& preg_match('/^Linux version [\d\.-]+-Microsoft/', $strBuf2)) {
$result .= ' [lxss]';
}
$this->sys->setKernel($result);
}
}
 
function users () {
$strResult = 0;
$strBuf = execute_program('who', '-q');
if( $strBuf != "ERROR" ) {
$arrWho = explode( '=', $strBuf );
$strResult = $arrWho[1];
}
return $strResult;
}
function loadavg ($bar = false) {
$buf = rfts( '/proc/loadavg' );
if( $buf == "ERROR" ) {
$results['avg'] = array('N.A.', 'N.A.', 'N.A.');
} else {
$results['avg'] = preg_split("/\s/", $buf, 4);
unset($results['avg'][3]); // don't need the extra values, only first three
}
if ($bar) {
$buf = rfts( '/proc/stat', 1 );
if( $buf != "ERROR" ) {
sscanf($buf, "%*s %Ld %Ld %Ld %Ld", $ab, $ac, $ad, $ae);
// Find out the CPU load
// user + sys = load
// total = total
$load = $ab + $ac + $ad; // cpu.user + cpu.sys
$total = $ab + $ac + $ad + $ae; // cpu.total
/**
* UpTime
* time the system is running
*
* @return void
*/
protected function _uptime()
{
if (CommonFunctions::rfts('/proc/uptime', $buf, 1, 4096, PSI_OS != 'Android')) {
$ar_buf = preg_split('/ /', $buf);
$this->sys->setUptime(trim($ar_buf[0]));
} elseif (CommonFunctions::executeProgram('uptime', '', $buf)) {
if (preg_match("/up (\d+) day[s]?,[ ]+(\d+):(\d+),/", $buf, $ar_buf)) {
$min = $ar_buf[3];
$hours = $ar_buf[2];
$days = $ar_buf[1];
$this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60);
} elseif (preg_match("/up (\d+) day[s]?,[ ]+(\d+) min,/", $buf, $ar_buf)) {
$min = $ar_buf[2];
$days = $ar_buf[1];
$this->sys->setUptime($days * 86400 + $min * 60);
} elseif (preg_match("/up[ ]+(\d+):(\d+),/", $buf, $ar_buf)) {
$min = $ar_buf[2];
$hours = $ar_buf[1];
$this->sys->setUptime($hours * 3600 + $min * 60);
} elseif (preg_match("/up[ ]+(\d+) min,/", $buf, $ar_buf)) {
$min = $ar_buf[1];
$this->sys->setUptime($min * 60);
}
}
}
 
// we need a second value, wait 1 second befor getting (< 1 second no good value will occour)
sleep(1);
$buf = rfts( '/proc/stat', 1 );
sscanf($buf, "%*s %Ld %Ld %Ld %Ld", $ab, $ac, $ad, $ae);
$load2 = $ab + $ac + $ad;
$total2 = $ab + $ac + $ad + $ae;
$results['cpupercent'] = (100*($load2 - $load)) / ($total2 - $total);
}
/**
* Processor Load
* optionally create a loadbar
*
* @return void
*/
protected function _loadavg()
{
if (CommonFunctions::rfts('/proc/loadavg', $buf, 1, 4096, PSI_OS != 'Android')) {
$result = preg_split("/\s/", $buf, 4);
// don't need the extra values, only first three
unset($result[3]);
$this->sys->setLoad(implode(' ', $result));
} elseif (CommonFunctions::executeProgram('uptime', '', $buf) && preg_match("/load average: (.*), (.*), (.*)$/", $buf, $ar_buf)) {
$this->sys->setLoad($ar_buf[1].' '.$ar_buf[2].' '.$ar_buf[3]);
}
if (PSI_LOAD_BAR) {
$this->sys->setLoadPercent($this->_parseProcStat('cpu'));
}
}
return $results;
}
 
function cpu_info () {
$bufr = rfts( '/proc/cpuinfo' );
$results = array("cpus" => 0);
if ( $bufr != "ERROR" ) {
$bufe = explode("\n", $bufr);
$results = array('cpus' => 0, 'bogomips' => 0);
$ar_buf = array();
foreach( $bufe as $buf ) {
$arrBuff = preg_split('/\s+:\s+/', trim($buf));
if( count( $arrBuff ) == 2 ) {
$key = $arrBuff[0];
$value = $arrBuff[1];
// All of the tags here are highly architecture dependant.
// the only way I could reconstruct them for machines I don't
// have is to browse the kernel source. So if your arch isn't
// supported, tell me you want it written in.
switch ($key) {
case 'model name':
$results['model'] = $value;
break;
case 'cpu MHz':
$results['cpuspeed'] = sprintf('%.2f', $value);
break;
case 'cycle frequency [Hz]': // For Alpha arch - 2.2.x
$results['cpuspeed'] = sprintf('%.2f', $value / 1000000);
break;
case 'clock': // For PPC arch (damn borked POS)
$results['cpuspeed'] = sprintf('%.2f', $value);
break;
case 'cpu': // For PPC arch (damn borked POS)
$results['model'] = $value;
break;
case 'L2 cache': // More for PPC
$results['cache'] = $value;
break;
case 'revision': // For PPC arch (damn borked POS)
$results['model'] .= ' ( rev: ' . $value . ')';
break;
case 'cpu model': // For Alpha arch - 2.2.x
$results['model'] .= ' (' . $value . ')';
break;
case 'cache size':
$results['cache'] = $value;
break;
case 'bogomips':
$results['bogomips'] += $value;
break;
case 'BogoMIPS': // For alpha arch - 2.2.x
$results['bogomips'] += $value;
break;
case 'BogoMips': // For sparc arch
$results['bogomips'] += $value;
break;
case 'cpus detected': // For Alpha arch - 2.2.x
$results['cpus'] += $value;
break;
case 'system type': // Alpha arch - 2.2.x
$results['model'] .= ', ' . $value . ' ';
break;
case 'platform string': // Alpha arch - 2.2.x
$results['model'] .= ' (' . $value . ')';
break;
case 'processor':
$results['cpus'] += 1;
break;
case 'Cpu0ClkTck': // Linux sparc64
$results['cpuspeed'] = sprintf('%.2f', hexdec($value) / 1000000);
break;
case 'Cpu0Bogo': // Linux sparc64 & sparc32
$results['bogomips'] = $value;
break;
case 'ncpus probed': // Linux sparc64 & sparc32
$results['cpus'] = $value;
break;
}
}
}
// sparc64 specific code follows
// This adds the ability to display the cache that a CPU has
// Originally made by Sven Blumenstein <bazik@gentoo.org> in 2004
// Modified by Tom Weustink <freshy98@gmx.net> in 2004
$sparclist = array('SUNW,UltraSPARC@0,0', 'SUNW,UltraSPARC-II@0,0', 'SUNW,UltraSPARC@1c,0', 'SUNW,UltraSPARC-IIi@1c,0', 'SUNW,UltraSPARC-II@1c,0', 'SUNW,UltraSPARC-IIe@0,0');
foreach ($sparclist as $name) {
$buf = rfts( '/proc/openprom/' . $name . '/ecache-size',1 , 32, false );
if( $buf != "ERROR" ) {
$results['cache'] = base_convert($buf, 16, 10)/1024 . ' KB';
}
}
// sparc64 specific code ends
// XScale detection code
if ( $results['cpus'] == 0 ) {
foreach( $bufe as $buf ) {
$fields = preg_split('/\s*:\s*/', trim($buf), 2);
if (sizeof($fields) == 2) {
list($key, $value) = $fields;
switch($key) {
case 'Processor':
$results['cpus'] += 1;
$results['model'] = $value;
break;
case 'BogoMIPS': //BogoMIPS are not BogoMIPS on this CPU, it's the speed, no BogoMIPS available
$results['cpuspeed'] = $value;
break;
case 'I size':
$results['cache'] = $value;
break;
case 'D size':
$results['cache'] += $value;
break;
}
}
}
$results['cache'] = $results['cache'] / 1024 . " KB";
}
}
$keys = array_keys($results);
$keys2be = array('model', 'cpuspeed', 'cache', 'bogomips', 'cpus');
while ($ar_buf = each($keys2be)) {
if (! in_array($ar_buf[1], $keys)) {
$results[$ar_buf[1]] = 'N.A.';
}
}
$buf = rfts( '/proc/acpi/thermal_zone/THRM/temperature', 1, 4096, false );
if ( $buf != "ERROR" ) {
$results['temp'] = substr( $buf, 25, 2 );
}
return $results;
}
/**
* fill the load for a individual cpu, through parsing /proc/stat for the specified cpu
*
* @param String $cpuline cpu for which load should be meassured
*
* @return Integer
*/
protected function _parseProcStat($cpuline)
{
if (is_null($this->_cpu_loads)) {
$this->_cpu_loads = array();
 
function pci () {
$arrResults = array();
$booDevice = false;
if( ! $arrResults = $this->parser->parse_lspci() ) {
$strBuf = rfts( '/proc/pci', 0, 4096, false );
if( $strBuf != "ERROR" ) {
$arrBuf = explode( "\n", $strBuf );
foreach( $arrBuf as $strLine ) {
if( preg_match( '/Bus/', $strLine ) ) {
$booDevice = true;
continue;
}
if( $booDevice ) {
list( $strKey, $strValue ) = explode( ': ', $strLine, 2 );
if( ! preg_match( '/bridge/i', $strKey ) && ! preg_match( '/USB/i ', $strKey ) ) {
$arrResults[] = preg_replace( '/\([^\)]+\)\.$/', '', trim( $strValue ) );
}
$booDevice = false;
}
}
asort( $arrResults );
}
}
return $arrResults;
}
$cpu_tmp = array();
if (CommonFunctions::rfts('/proc/stat', $buf)) {
if (preg_match_all('/^(cpu[0-9]*) (.*)/m', $buf, $matches, PREG_SET_ORDER)) {
foreach ($matches as $line) {
$cpu = $line[1];
$buf2 = $line[2];
 
function ide () {
$results = array();
$bufd = gdc( '/proc/ide', false );
$cpu_tmp[$cpu] = array();
 
foreach( $bufd as $file ) {
if (preg_match('/^hd/', $file)) {
$results[$file] = array();
$buf = rfts("/proc/ide/" . $file . "/media", 1 );
if ( $buf != "ERROR" ) {
$results[$file]['media'] = trim($buf);
if ($results[$file]['media'] == 'disk') {
$results[$file]['media'] = 'Hard Disk';
$buf = rfts( "/proc/ide/" . $file . "/capacity", 1, 4096, false);
if( $buf == "ERROR" ) {
$buf = rfts( "/sys/block/" . $file . "/size", 1, 4096, false);
}
if ( $buf != "ERROR" ) {
$results[$file]['capacity'] = trim( $buf );
}
} elseif ($results[$file]['media'] == 'cdrom') {
$results[$file]['media'] = 'CD-ROM';
unset($results[$file]['capacity']);
}
$ab = 0;
$ac = 0;
$ad = 0;
$ae = 0;
sscanf($buf2, "%Ld %Ld %Ld %Ld", $ab, $ac, $ad, $ae);
$cpu_tmp[$cpu]['load'] = $ab + $ac + $ad; // cpu.user + cpu.sys
$cpu_tmp[$cpu]['total'] = $ab + $ac + $ad + $ae; // cpu.total
}
}
 
// we need a second value, wait 1 second befor getting (< 1 second no good value will occour)
sleep(1);
 
if (CommonFunctions::rfts('/proc/stat', $buf)) {
if (preg_match_all('/^(cpu[0-9]*) (.*)/m', $buf, $matches, PREG_SET_ORDER)) {
foreach ($matches as $line) {
$cpu = $line[1];
if (isset($cpu_tmp[$cpu])) {
$buf2 = $line[2];
 
$ab = 0;
$ac = 0;
$ad = 0;
$ae = 0;
sscanf($buf2, "%Ld %Ld %Ld %Ld", $ab, $ac, $ad, $ae);
$load2 = $ab + $ac + $ad; // cpu.user + cpu.sys
$total2 = $ab + $ac + $ad + $ae; // cpu.total
$total = $cpu_tmp[$cpu]['total'];
$load = $cpu_tmp[$cpu]['load'];
$this->_cpu_loads[$cpu] = 0;
if ($total > 0 && $total2 > 0 && $load > 0 && $load2 > 0 && $total2 != $total && $load2 != $load) {
$this->_cpu_loads[$cpu] = (100 * ($load2 - $load)) / ($total2 - $total);
}
}
}
}
}
}
}
 
if (isset($this->_cpu_loads[$cpuline])) {
return $this->_cpu_loads[$cpuline];
} else {
unset($results[$file]);
}
return 0;
}
}
 
$buf = rfts( "/proc/ide/" . $file . "/model", 1 );
if ( $buf != "ERROR" ) {
$results[$file]['model'] = trim( $buf );
if (preg_match('/WDC/', $results[$file]['model'])) {
$results[$file]['manufacture'] = 'Western Digital';
} elseif (preg_match('/IBM/', $results[$file]['model'])) {
$results[$file]['manufacture'] = 'IBM';
} elseif (preg_match('/FUJITSU/', $results[$file]['model'])) {
$results[$file]['manufacture'] = 'Fujitsu';
} else {
$results[$file]['manufacture'] = 'Unknown';
}
}
}
}
/**
* CPU information
* All of the tags here are highly architecture dependant.
*
* @return void
*/
protected function _cpuinfo()
{
if (CommonFunctions::rfts('/proc/cpuinfo', $bufr)) {
$cpulist = null;
$raslist = null;
 
asort($results);
return $results;
}
// sparc
if (preg_match('/\nCpu(\d+)Bogo\s*:/i', $bufr)) {
$bufr = preg_replace('/\nCpu(\d+)ClkTck\s*:/i', "\nCpu0ClkTck:", preg_replace('/\nCpu(\d+)Bogo\s*:/i', "\n\nprocessor: $1\nCpu0Bogo:", $bufr));
} else {
$bufr = preg_replace('/\nCpu(\d+)ClkTck\s*:/i', "\n\nprocessor: $1\nCpu0ClkTck:", $bufr);
}
 
function scsi () {
$results = array();
$dev_vendor = '';
$dev_model = '';
$dev_rev = '';
$dev_type = '';
$s = 1;
$get_type = 0;
if (preg_match('/\nprocessor\s*:\s*\d+\r?\nprocessor\s*:\s*\d+/', $bufr)) {
$bufr = preg_replace('/^(processor\s*:\s*\d+)\r?$/m', "$1\n", $bufr);
}
 
$bufr = execute_program('lsscsi', '-c', false);
if( $bufr == "ERROR" ) {
$bufr = rfts( '/proc/scsi/scsi', 0, 4096, false);
// IBM/S390
$bufr = preg_replace('/\ncpu number\s*:\s*(\d+)\r?\ncpu MHz dynamic\s*:\s*(\d+)/m', "\nprocessor:$1\nclock:$2", $bufr);
 
$processors = preg_split('/\s?\n\s?\n/', trim($bufr));
 
//first stage
$_arch = null;
$_impl = null;
$_part = null;
$_hard = null;
$_revi = null;
$_cpus = null;
$_buss = null;
$_bogo = null;
$_vend = null;
$procname = null;
foreach ($processors as $processor) if (!preg_match('/^\s*processor\s*:/mi', $processor)) {
$details = preg_split("/\n/", $processor, -1, PREG_SPLIT_NO_EMPTY);
foreach ($details as $detail) {
$arrBuff = preg_split('/\s*:\s*/', trim($detail));
if ((count($arrBuff) == 2) && (($arrBuff1 = trim($arrBuff[1])) !== '')) {
switch (strtolower($arrBuff[0])) {
case 'cpu architecture':
$_arch = $arrBuff1;
break;
case 'cpu implementer':
$_impl = $arrBuff1;
break;
case 'cpu part':
$_part = $arrBuff1;
break;
case 'hardware':
$_hard = $arrBuff1;
break;
case 'revision':
$_revi = $arrBuff1;
break;
case 'cpu frequency':
if (preg_match('/^(\d+)\s+Hz/i', $arrBuff1, $bufr2)) {
$_cpus = round($bufr2[1]/1000000);
}
break;
case 'system bus frequency':
if (preg_match('/^(\d+)\s+Hz/i', $arrBuff1, $bufr2)) {
$_buss = round($bufr2[1]/1000000);
}
break;
case 'bogomips per cpu':
$_bogo = round($arrBuff1);
break;
case 'vendor_id':
$_vend = $arrBuff1;
case 'cpu':
$procname = $arrBuff1;
break;
}
}
}
}
 
//second stage
$cpucount = 0;
$speedset = false;
foreach ($processors as $processor) if (preg_match('/^\s*processor\s*:/mi', $processor)) {
$proc = null;
$arch = null;
$impl = null;
$part = null;
$dev = new CpuDevice();
$details = preg_split("/\n/", $processor, -1, PREG_SPLIT_NO_EMPTY);
foreach ($details as $detail) {
$arrBuff = preg_split('/\s*:\s*/', trim($detail));
if ((count($arrBuff) == 2) && (($arrBuff1 = trim($arrBuff[1])) !== '')) {
switch (strtolower($arrBuff[0])) {
case 'processor':
$proc = $arrBuff1;
if (is_numeric($proc)) {
if (strlen($procname)>0) {
$dev->setModel($procname);
}
} else {
$procname = $proc;
$dev->setModel($procname);
}
break;
case 'model name':
case 'cpu model':
case 'cpu type':
case 'cpu':
$dev->setModel($arrBuff1);
break;
case 'cpu mhz':
case 'clock':
if ($arrBuff1 > 0) { //openSUSE fix
$dev->setCpuSpeed($arrBuff1);
$speedset = true;
}
break;
case 'cpu mhz static':
if ($arrBuff1 > 0) { //openSUSE fix
$dev->setCpuSpeedMax($arrBuff1);
}
break;
case 'cycle frequency [hz]':
$dev->setCpuSpeed($arrBuff1 / 1000000);
$speedset = true;
break;
case 'cpu0clktck':
$dev->setCpuSpeed(hexdec($arrBuff1) / 1000000); // Linux sparc64
$speedset = true;
break;
case 'l3 cache':
case 'cache size':
$dev->setCache(trim(preg_replace("/[a-zA-Z]/", "", $arrBuff1)) * 1024);
break;
case 'initial bogomips':
case 'bogomips':
case 'cpu0bogo':
$dev->setBogomips(round($arrBuff1));
break;
case 'flags':
if (preg_match("/ vmx/", $arrBuff1)) {
$dev->setVirt("vmx");
} elseif (preg_match("/ svm/", $arrBuff1)) {
$dev->setVirt("svm");
} elseif (preg_match("/ hypervisor/", $arrBuff1)) {
$dev->setVirt("hypervisor");
}
break;
case 'i size':
case 'd size':
if ($dev->getCache() === null) {
$dev->setCache($arrBuff1 * 1024);
} else {
$dev->setCache($dev->getCache() + ($arrBuff1 * 1024));
}
break;
case 'cpu architecture':
$arch = $arrBuff1;
break;
case 'cpu implementer':
$impl = $arrBuff1;
break;
case 'cpu part':
$part = $arrBuff1;
break;
case 'vendor_id':
$dev->setVendorId($arrBuff1);
break;
}
}
}
if ($arch === null) $arch = $_arch;
if ($impl === null) $impl = $_impl;
if ($part === null) $part = $_part;
 
// sparc64 specific code follows
// This adds the ability to display the cache that a CPU has
// Originally made by Sven Blumenstein <bazik@gentoo.org> in 2004
// Modified by Tom Weustink <freshy98@gmx.net> in 2004
$sparclist = array('SUNW,UltraSPARC@0,0', 'SUNW,UltraSPARC-II@0,0', 'SUNW,UltraSPARC@1c,0', 'SUNW,UltraSPARC-IIi@1c,0', 'SUNW,UltraSPARC-II@1c,0', 'SUNW,UltraSPARC-IIe@0,0');
foreach ($sparclist as $name) {
if (CommonFunctions::rfts('/proc/openprom/'.$name.'/ecache-size', $buf, 1, 32, false)) {
$dev->setCache(base_convert(trim($buf), 16, 10));
}
}
// sparc64 specific code ends
 
// XScale detection code
if (($arch === "5TE") && ($dev->getBogomips() != null)) {
$dev->setCpuSpeed($dev->getBogomips()); //BogoMIPS are not BogoMIPS on this CPU, it's the speed
$speedset = true;
$dev->setBogomips(null); // no BogoMIPS available, unset previously set BogoMIPS
}
 
if (($dev->getBusSpeed() == 0) && ($_buss !== null)) {
$dev->setBusSpeed($_buss);
}
if (($dev->getCpuSpeed() == 0) && ($_cpus !== null)) {
$dev->setCpuSpeed($_cpus);
$speedset = true;
}
if (($dev->getBogomips() == 0) && ($_bogo !== null)) {
$dev->setBogomips($_bogo);
}
if (($dev->getVendorId() === null) && ($_vend !== null)) {
$dev->setVendorId($_vend);
}
 
if ($proc != null) {
if (!is_numeric($proc)) {
$proc = 0;
}
// variable speed processors specific code follows
if (CommonFunctions::rfts('/sys/devices/system/cpu/cpu'.$proc.'/cpufreq/cpuinfo_cur_freq', $buf, 1, 4096, false)) {
$dev->setCpuSpeed(trim($buf) / 1000);
$speedset = true;
} elseif (CommonFunctions::rfts('/sys/devices/system/cpu/cpu'.$proc.'/cpufreq/scaling_cur_freq', $buf, 1, 4096, false)) {
$dev->setCpuSpeed(trim($buf) / 1000);
$speedset = true;
}
if (CommonFunctions::rfts('/sys/devices/system/cpu/cpu'.$proc.'/cpufreq/cpuinfo_max_freq', $buf, 1, 4096, false)) {
$dev->setCpuSpeedMax(trim($buf) / 1000);
}
if (CommonFunctions::rfts('/sys/devices/system/cpu/cpu'.$proc.'/cpufreq/cpuinfo_min_freq', $buf, 1, 4096, false)) {
$dev->setCpuSpeedMin(trim($buf) / 1000);
}
// variable speed processors specific code ends
if (PSI_LOAD_BAR) {
$dev->setLoad($this->_parseProcStat('cpu'.$proc));
}
/*
if (CommonFunctions::rfts('/proc/acpi/thermal_zone/THRM/temperature', $buf, 1, 4096, false)
&& preg_match("/(\S+)\sC$/", $buf, $value)) {
$dev->setTemp(value[1]);
}
*/
if (($arch !== null) && ($impl !== null) && ($part !== null)) {
if (($impl === '0x41')
&& (($_hard === 'BCM2708') || ($_hard === 'BCM2835') || ($_hard === 'BCM2709') || ($_hard === 'BCM2836') || ($_hard === 'BCM2710') || ($_hard === 'BCM2837') || ($_hard === 'BCM2711') || ($_hard === 'BCM2838'))
&& ($_revi !== null)) { // Raspberry Pi detection (instead of 'cat /proc/device-tree/model')
if ($raslist === null) $raslist = @parse_ini_file(PSI_APP_ROOT."/data/raspberry.ini", true);
if ($raslist && !preg_match('/[^0-9a-f]/', $_revi)) {
if (($revidec = hexdec($_revi)) & 0x800000) {
if ($this->sys->getMachine() === '') {
$manufacturer = ($revidec >> 16) & 15;
if (isset($raslist['manufacturer'][$manufacturer])) {
$manuf = ' '.$raslist['manufacturer'][$manufacturer];
} else {
$manuf = '';
}
$model = ($revidec >> 4) & 255;
if (isset($raslist['model'][$model])) {
$this->sys->setMachine('Raspberry Pi '.$raslist['model'][$model].' (PCB 1.'.($revidec & 15).$manuf.')');
} else {
$this->sys->setMachine('Raspberry Pi (PCB 1.'.($revidec & 15).$manuf.')');
}
}
} else {
if ($this->sys->getMachine() === '') {
if (isset($raslist['old'][$revidec & 0x7fffff])) {
$this->sys->setMachine('Raspberry Pi '.$raslist['old'][$revidec & 0x7fffff]);
} else {
$this->sys->setMachine('Raspberry Pi');
}
}
}
}
} elseif (($_hard !== null) && ($this->sys->getMachine() === '')) { // other ARM hardware
$this->sys->setMachine($_hard);
}
if ($cpulist === null) $cpulist = @parse_ini_file(PSI_APP_ROOT."/data/cpus.ini", true);
if ($cpulist && (isset($cpulist['cpu'][$cpuimplpart = strtolower($impl.','.$part)]))) {
if (($cpumodel = $dev->getModel()) !== '') {
$dev->setModel($cpumodel.' - '.$cpulist['cpu'][$cpuimplpart]);
} else {
$dev->setModel($cpulist['cpu'][$cpuimplpart]);
}
}
} elseif (($_hard !== null) && ($this->sys->getMachine() === '')) { // other hardware
$this->sys->setMachine($_hard);
}
 
if ($dev->getModel() === "") {
$dev->setModel("unknown");
}
$cpucount++;
$this->sys->setCpus($dev);
}
}
 
$cpudevices = glob('/sys/devices/system/cpu/cpu*/uevent', GLOB_NOSORT);
if (is_array($cpudevices) && (($cpustopped = count($cpudevices)-$cpucount) > 0)) {
for (; $cpustopped > 0; $cpustopped--) {
$dev = new CpuDevice();
$dev->setModel("stopped");
if ($speedset) {
$dev->setCpuSpeed(-1);
}
$this->sys->setCpus($dev);
}
}
}
}
if ( $bufr != "ERROR" ) {
$bufe = explode("\n", $bufr);
foreach( $bufe as $buf ) {
if (preg_match('/Vendor/', $buf)) {
preg_match('/Vendor: (.*) Model: (.*) Rev: (.*)/i', $buf, $dev);
list($key, $value) = explode(': ', $buf, 2);
$dev_str = $value;
$get_type = true;
continue;
}
 
if ($get_type) {
preg_match('/Type:\s+(\S+)/i', $buf, $dev_type);
$results[$s]['model'] = "$dev[1] $dev[2] ($dev_type[1])";
$results[$s]['media'] = "Hard Disk";
$s++;
$get_type = false;
}
}
}
asort($results);
return $results;
}
/**
* PCI devices
*
* @return void
*/
private function _pci()
{
if ($arrResults = Parser::lspci()) {
foreach ($arrResults as $dev) {
$this->sys->setPciDevices($dev);
}
} elseif (CommonFunctions::rfts('/proc/pci', $strBuf, 0, 4096, false)) {
$booDevice = false;
$arrBuf = preg_split("/\n/", $strBuf, -1, PREG_SPLIT_NO_EMPTY);
foreach ($arrBuf as $strLine) {
if (preg_match('/^\s*Bus\s/', $strLine)) {
$booDevice = true;
continue;
}
if ($booDevice) {
$dev = new HWDevice();
$dev->setName(preg_replace('/\([^\)]+\)\.$/', '', trim($strLine)));
$this->sys->setPciDevices($dev);
/*
list($strKey, $strValue) = preg_split('/: /', $strLine, 2);
if (!preg_match('/bridge/i', $strKey) && !preg_match('/USB/i ', $strKey)) {
$dev = new HWDevice();
$dev->setName(preg_replace('/\([^\)]+\)\.$/', '', trim($strValue)));
$this->sys->setPciDevices($dev);
}
*/
$booDevice = false;
}
}
} else {
$pcidevices = glob('/sys/bus/pci/devices/*/uevent', GLOB_NOSORT);
if (is_array($pcidevices) && (($total = count($pcidevices)) > 0)) {
$buf = "";
for ($i = 0; $i < $total; $i++) {
if (CommonFunctions::rfts($pcidevices[$i], $buf, 0, 4096, false) && (trim($buf) != "")) {
$pcibuf = "";
if (preg_match("/^PCI_CLASS=(\S+)/m", trim($buf), $subbuf)) {
$pcibuf = "Class ".$subbuf[1].":";
}
if (preg_match("/^PCI_ID=(\S+)/m", trim($buf), $subbuf)) {
$pcibuf .= " Device ".$subbuf[1];
}
if (preg_match("/^DRIVER=(\S+)/m", trim($buf), $subbuf)) {
$pcibuf .= " Driver ".$subbuf[1];
}
$dev = new HWDevice();
if (trim($pcibuf) != "") {
$dev->setName(trim($pcibuf));
} else {
$dev->setName("unknown");
}
$this->sys->setPciDevices($dev);
}
}
}
}
}
 
function usb () {
$results = array();
$devnum = -1;
/**
* IDE devices
*
* @return void
*/
private function _ide()
{
$bufd = CommonFunctions::gdc('/proc/ide', false);
foreach ($bufd as $file) {
if (preg_match('/^hd/', $file)) {
$dev = new HWDevice();
$dev->setName(trim($file));
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS && CommonFunctions::rfts("/proc/ide/".$file."/media", $buf, 1)) {
if (trim($buf) == 'disk') {
if (CommonFunctions::rfts("/proc/ide/".$file."/capacity", $buf, 1, 4096, false) || CommonFunctions::rfts("/sys/block/".$file."/size", $buf, 1, 4096, false)) {
$dev->setCapacity(trim($buf) * 512);
}
}
}
if (CommonFunctions::rfts("/proc/ide/".$file."/model", $buf, 1)) {
$dev->setName($dev->getName().": ".trim($buf));
}
$this->sys->setIdeDevices($dev);
}
}
}
 
$bufr = execute_program('lsusb', '', false);
if( $bufr == "ERROR" ) {
$bufr = rfts( '/proc/bus/usb/devices', 0, 4096, false );
if ( $bufr != "ERROR" ) {
$bufe = explode("\n", $bufr);
foreach( $bufe as $buf ) {
if (preg_match('/^T/', $buf)) {
$devnum += 1;
$results[$devnum] = "";
} elseif (preg_match('/^S:/', $buf)) {
list($key, $value) = explode(': ', $buf, 2);
list($key, $value2) = explode('=', $value, 2);
if (trim($key) != "SerialNumber") {
$results[$devnum] .= " " . trim($value2);
$devstring = 0;
}
}
/**
* SCSI devices
*
* @return void
*/
private function _scsi()
{
$getline = 0;
$device = null;
$scsiid = null;
if (CommonFunctions::executeProgram('lsscsi', '-c', $bufr, PSI_DEBUG) || CommonFunctions::rfts('/proc/scsi/scsi', $bufr, 0, 4096, PSI_DEBUG)) {
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
foreach ($bufe as $buf) {
if (preg_match('/Host: scsi(\d+) Channel: (\d+) Target: (\d+) Lun: (\d+)/i', $buf, $scsiids)
|| preg_match('/Host: scsi(\d+) Channel: (\d+) Id: (\d+) Lun: (\d+)/i', $buf, $scsiids)) {
$scsiid = $scsiids;
$getline = 1;
continue;
}
if ($getline == 1) {
preg_match('/Vendor: (.*) Model: (.*) Rev: (.*)/i', $buf, $devices);
$getline = 2;
$device = $devices;
continue;
}
if ($getline == 2) {
preg_match('/Type:\s+(\S+)/i', $buf, $dev_type);
 
$dev = new HWDevice();
$dev->setName($device[1].' '.$device[2].' ('.$dev_type[1].')');
 
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS
&& ($dev_type[1]==='Direct-Access')) {
$sizelist = glob('/sys/bus/scsi/devices/'.intval($scsiid[1]).':'.intval($scsiid[2]).':'.intval($scsiid[3]).':'.intval($scsiid[4]).'/*/*/size', GLOB_NOSORT);
if (is_array($sizelist) && (($total = count($sizelist)) > 0)) {
$buf = "";
for ($i = 0; $i < $total; $i++) {
if (CommonFunctions::rfts($sizelist[$i], $buf, 1, 4096, false) && (($buf=trim($buf)) != "") && ($buf > 0)) {
$dev->setCapacity($buf * 512);
break;
}
}
}
}
$this->sys->setScsiDevices($dev);
$getline = 0;
}
}
}
} else {
$bufe = explode( "\n", $bufr );
foreach( $bufe as $buf ) {
$device = preg_split("/ /", $buf, 7);
if( isset( $device[6] ) && trim( $device[6] ) != "" ) {
$results[$devnum++] = trim( $device[6] );
}
}
}
}
return $results;
}
 
function sbus () {
$results = array();
$_results[0] = "";
// TODO. Nothing here yet. Move along.
$results = $_results;
return $results;
}
/**
* USB devices
*
* @return void
*/
protected function _usb()
{
$usbarray = array();
if (CommonFunctions::executeProgram('lsusb', (PSI_OS != 'Android')?'':'2>/dev/null', $bufr, PSI_DEBUG && (PSI_OS != 'Android'), 5) && ($bufr !== "")) {
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
foreach ($bufe as $buf) {
$device = preg_split("/ /", $buf, 7);
if (((isset($device[6]) && trim($device[6]) != "")) ||
((isset($device[5]) && trim($device[5]) != ""))) {
$usbid = intval($device[1]).'-'.intval(trim($device[3],':')).' '.$device[5];
if ((isset($device[6]) && trim($device[6]) != "")) {
$usbarray[$usbid]['name'] = trim($device[6]);
} else {
$usbarray[$usbid]['name'] = 'unknown';
}
}
}
}
 
function network () {
$results = array();
$usbdevices = glob('/sys/bus/usb/devices/*/idProduct', GLOB_NOSORT);
if (is_array($usbdevices) && (($total = count($usbdevices)) > 0)) {
for ($i = 0; $i < $total; $i++) {
if (CommonFunctions::rfts($usbdevices[$i], $idproduct, 1, 4096, false) && (($idproduct=trim($idproduct)) != "")) { //is readable
$busnum = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/busnum');
$devnum = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/devnum');
$idvendor = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/idVendor');
if (($busnum!==null) && ($devnum!==null) && ($idvendor!==null)) {
$usbid = intval($busnum).'-'.intval($devnum).' '.$idvendor.':'.$idproduct;
$manufacturer = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/manufacturer');
if ($manufacturer!==null) {
$usbarray[$usbid]['manufacturer'] = $manufacturer;
}
$product = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/product');
if ($product!==null) {
$usbarray[$usbid]['product'] = $product;
}
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS
&& defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
$serial = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/serial');
if (($serial!==null) && !preg_match('/\W/', $serial)) {
$usbarray[$usbid]['serial'] = $serial;
}
}
}
}
}
}
 
$bufr = rfts( '/proc/net/dev' );
if ( $bufr != "ERROR" ) {
$bufe = explode("\n", $bufr);
foreach( $bufe as $buf ) {
if (preg_match('/:/', $buf)) {
list($dev_name, $stats_list) = preg_split('/:/', $buf, 2);
$stats = preg_split('/\s+/', trim($stats_list));
$results[$dev_name] = array();
if ((count($usbarray) == 0) && CommonFunctions::rfts('/proc/bus/usb/devices', $bufr, 0, 4096, false)) {
$devnum = -1;
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
foreach ($bufe as $buf) {
if (preg_match('/^T/', $buf)) {
$devnum++;
} elseif (preg_match('/^S:/', $buf)) {
list($key, $value) = preg_split('/: /', $buf, 2);
list($key, $value2) = preg_split('/=/', $value, 2);
switch (trim($key)) {
case 'Manufacturer':
$usbarray[$devnum]['manufacturer'] = trim($value2);
break;
case 'Product':
$usbarray[$devnum]['product'] = trim($value2);
break;
case 'SerialNumber':
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS
&& defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL
&& !preg_match('/\W/', trim($value2))) {
$usbarray[$devnum]['serial'] = trim($value2);
}
break;
}
}
}
}
 
$results[$dev_name]['rx_bytes'] = $stats[0];
$results[$dev_name]['rx_packets'] = $stats[1];
$results[$dev_name]['rx_errs'] = $stats[2];
$results[$dev_name]['rx_drop'] = $stats[3];
if ((count($usbarray) == 0) && CommonFunctions::rfts('/proc/bus/input/devices', $bufr, 0, 4096, false)) {
$devnam = "unknown";
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
foreach ($bufe as $buf) {
if (preg_match('/^I:\s+(.+)/', $buf, $bufr)
&& isset($bufr[1]) && (trim($bufr[1])!=="")) {
$devnam = trim($bufr[1]);
$usbarray[$devnam]['phys'] = 'unknown';
} elseif (preg_match('/^N:\s+Name="([^"]+)"/', $buf, $bufr2)
&& isset($bufr2[1]) && (trim($bufr2[1])!=="")) {
$usbarray[$devnam]['name'] = trim($bufr2[1]);
} elseif (preg_match('/^P:\s+Phys=(.*)/', $buf, $bufr2)
&& isset($bufr2[1]) && (trim($bufr2[1])!=="")) {
$usbarray[$devnam]['phys'] = trim($bufr2[1]);
} elseif (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS
&& defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL
&& preg_match('/^U:\s+Uniq=(.+)/', $buf, $bufr2)
&& isset($bufr2[1]) && (trim($bufr2[1])!=="")) {
$usbarray[$devnam]['serial'] = trim($bufr2[1]);
}
}
}
 
$results[$dev_name]['tx_bytes'] = $stats[8];
$results[$dev_name]['tx_packets'] = $stats[9];
$results[$dev_name]['tx_errs'] = $stats[10];
$results[$dev_name]['tx_drop'] = $stats[11];
foreach ($usbarray as $usbdev) if (!isset($usbdev['phys']) || preg_match('/^usb-/', $usbdev['phys'])) {
$dev = new HWDevice();
 
$results[$dev_name]['errs'] = $stats[2] + $stats[10];
$results[$dev_name]['drop'] = $stats[3] + $stats[11];
}
}
if (isset($usbdev['manufacturer']) && (($manufacturer=$usbdev['manufacturer']) !== 'no manufacturer')) {
if (preg_match("/^linux\s/i", $manufacturer)) {
$manufacturer = 'Linux Foundation';
}
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
$dev->setManufacturer($manufacturer);
}
} else {
$manufacturer = '';
}
 
if (isset($usbdev['product'])) {
$product = $usbdev['product'];
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
$dev->setProduct($product);
}
} else {
$product = '';
}
 
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS
&& defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL
&& isset($usbdev['serial'])) {
$dev->setSerial($usbdev['serial']);
}
 
if (isset($usbdev['name']) && (($name=$usbdev['name']) !== 'unknown')) {
$dev->setName($name);
} else {
if (($newname = trim($manufacturer.' '.$product)) !== '') {
$dev->setName($newname);
} else {
$dev->setName('unknown');
}
}
 
$this->sys->setUsbDevices($dev);
}
}
return $results;
}
 
function memory () {
$results['ram'] = array('total' => 0, 'free' => 0, 'used' => 0, 'percent' => 0);
$results['swap'] = array('total' => 0, 'free' => 0, 'used' => 0, 'percent' => 0);
$results['devswap'] = array();
/**
* I2C devices
*
* @return void
*/
protected function _i2c()
{
$i2cdevices = glob('/sys/bus/i2c/devices/*/name', GLOB_NOSORT);
if (is_array($i2cdevices) && (($total = count($i2cdevices)) > 0)) {
$buf = "";
for ($i = 0; $i < $total; $i++) {
if (CommonFunctions::rfts($i2cdevices[$i], $buf, 1, 4096, false) && (trim($buf) != "")) {
$dev = new HWDevice();
$dev->setName(trim($buf));
$this->sys->setI2cDevices($dev);
}
}
}
}
 
$bufr = rfts( '/proc/meminfo' );
if ( $bufr != "ERROR" ) {
$bufe = explode("\n", $bufr);
foreach( $bufe as $buf ) {
if (preg_match('/^MemTotal:\s+(.*)\s*kB/i', $buf, $ar_buf)) {
$results['ram']['total'] = $ar_buf[1];
} else if (preg_match('/^MemFree:\s+(.*)\s*kB/i', $buf, $ar_buf)) {
$results['ram']['free'] = $ar_buf[1];
} else if (preg_match('/^Cached:\s+(.*)\s*kB/i', $buf, $ar_buf)) {
$results['ram']['cached'] = $ar_buf[1];
} else if (preg_match('/^Buffers:\s+(.*)\s*kB/i', $buf, $ar_buf)) {
$results['ram']['buffers'] = $ar_buf[1];
}
}
/**
* NVMe devices
*
* @return void
*/
protected function _nvme()
{
if (CommonFunctions::executeProgram('nvme', 'list', $bufr, PSI_DEBUG) && ($bufr!="")) {
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
$count = 0;
$nlocate = array();
$nsize = array();
foreach ($bufe as $buf) {
if ($count == 1) {
$locid = 0;
$nlocate[0] = 0;
$total = strlen($buf);
$begin = true;
for ($i = 0; $i < $total; $i++) {
if ($begin) {
if ($buf[$i] !== '-') {
$nsize[$locid] = $i - $nlocate[$locid];
$locid++;
$begin = false;
}
} else {
if ($buf[$i] === '-') {
$nlocate[$locid] = $i;
$begin = true;
}
}
}
if ($begin) {
$nsize[$locid] = $i - $nlocate[$locid];
}
} elseif ($count > 1) {
if (isset($nlocate[2]) && isset($nsize[2])) {
$dev = new HWDevice();
$dev->setName(trim(substr($buf, $nlocate[2], $nsize[2])));
if (defined('PSI_SHOW_DEVICES_INFOS') && (PSI_SHOW_DEVICES_INFOS)) {
if (isset($nlocate[4]) && isset($nsize[4])) {
if (preg_match('/\/\s*([0-9\.]+)\s*(B|KB|MB|GB|TB|PB)$/', str_replace(',', '.', trim(substr($buf, $nlocate[4], $nsize[4]))), $tmpbuf)) {
switch ($tmpbuf[2]) {
case 'B':
$dev->setCapacity($tmpbuf[1]);
break;
case 'KB':
$dev->setCapacity(1000*$tmpbuf[1]);
break;
case 'MB':
$dev->setCapacity(1000*1000*$tmpbuf[1]);
break;
case 'GB':
$dev->setCapacity(1000*1000*1000*$tmpbuf[1]);
break;
case 'TB':
$dev->setCapacity(1000*1000*1000*1000*$tmpbuf[1]);
break;
case 'PB':
$dev->setCapacity(1000*1000*1000*1000*1000*$tmpbuf[1]);
break;
}
}
}
if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
if (isset($nlocate[1]) && isset($nsize[1])) {
$dev->setSerial(trim(substr($buf, $nlocate[1], $nsize[1])));
}
}
}
$this->sys->setNvmeDevices($dev);
}
}
$count++;
}
}
}
 
$results['ram']['used'] = $results['ram']['total'] - $results['ram']['free'];
$results['ram']['percent'] = round(($results['ram']['used'] * 100) / $results['ram']['total']);
// values for splitting memory usage
if (isset($results['ram']['cached']) && isset($results['ram']['buffers'])) {
$results['ram']['app'] = $results['ram']['used'] - $results['ram']['cached'] - $results['ram']['buffers'];
$results['ram']['app_percent'] = round(($results['ram']['app'] * 100) / $results['ram']['total']);
$results['ram']['buffers_percent'] = round(($results['ram']['buffers'] * 100) / $results['ram']['total']);
$results['ram']['cached_percent'] = round(($results['ram']['cached'] * 100) / $results['ram']['total']);
}
/**
* Network devices
* includes also rx/tx bytes
*
* @return void
*/
protected function _network()
{
if (CommonFunctions::rfts('/proc/net/dev', $bufr, 0, 4096, PSI_DEBUG)) {
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
foreach ($bufe as $buf) {
if (preg_match('/:/', $buf)) {
list($dev_name, $stats_list) = preg_split('/:/', $buf, 2);
$stats = preg_split('/\s+/', trim($stats_list));
$dev = new NetDevice();
$dev->setName(trim($dev_name));
$dev->setRxBytes($stats[0]);
$dev->setTxBytes($stats[8]);
$dev->setErrors($stats[2] + $stats[10]);
$dev->setDrops($stats[3] + $stats[11]);
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) {
$macaddr = "";
if ((CommonFunctions::executeProgram('ip', 'addr show '.trim($dev_name), $bufr2, PSI_DEBUG) && ($bufr2!=""))
|| CommonFunctions::executeProgram('ifconfig', trim($dev_name).' 2>/dev/null', $bufr2, PSI_DEBUG)) {
$bufe2 = preg_split("/\n/", $bufr2, -1, PREG_SPLIT_NO_EMPTY);
foreach ($bufe2 as $buf2) {
// if (preg_match('/^'.trim($dev_name).'\s+Link\sencap:Ethernet\s+HWaddr\s(\S+)/i', $buf2, $ar_buf2)
if (preg_match('/\s+encap:Ethernet\s+HWaddr\s(\S+)/i', $buf2, $ar_buf2)
|| preg_match('/\s+encap:UNSPEC\s+HWaddr\s(\S+)-00-00-00-00-00-00-00-00-00-00\s*$/i', $buf2, $ar_buf2)
|| preg_match('/^\s+ether\s+(\S+)\s+txqueuelen/i', $buf2, $ar_buf2)
|| preg_match('/^\s+link\/ether\s+(\S+)\s+brd/i', $buf2, $ar_buf2)
|| preg_match('/^\s+link\/ether\s+(\S+)$/i', $buf2, $ar_buf2)
|| preg_match('/^\s+link\/ieee802.11\s+(\S+)$/i', $buf2, $ar_buf2)) {
if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) {
$macaddr = preg_replace('/:/', '-', strtoupper($ar_buf2[1]));
if ($macaddr === '00-00-00-00-00-00') { // empty
$macaddr = "";
}
}
} elseif (preg_match('/^\s+inet\saddr:(\S+)\s+P-t-P:(\S+)/i', $buf2, $ar_buf2)
|| preg_match('/^\s+inet\s+(\S+)\s+netmask.+destination\s+(\S+)/i', $buf2, $ar_buf2)
|| preg_match('/^\s+inet\s+([^\/\s]+).*peer\s+([^\/\s]+).*\s+scope\s((global)|(host))/i', $buf2, $ar_buf2)) {
if ($ar_buf2[1] != $ar_buf2[2]) {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1].";:".$ar_buf2[2]);
} else {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1]);
}
} elseif ((preg_match('/^\s+inet\saddr:(\S+)/i', $buf2, $ar_buf2)
|| preg_match('/^\s+inet\s+(\S+)\s+netmask/i', $buf2, $ar_buf2)
|| preg_match('/^'.trim($dev_name).':\s+ip\s+(\S+)\s+mask/i', $buf2, $ar_buf2)
|| preg_match('/^\s+inet6\saddr:\s([^\/\s]+)(.+)\s+Scope:[GH]/i', $buf2, $ar_buf2)
|| preg_match('/^\s+inet6\s+(\S+)\s+prefixlen(.+)((<global>)|(<host>))/i', $buf2, $ar_buf2)
|| preg_match('/^\s+inet6?\s+([^\/\s]+).*\s+scope\s((global)|(host))/i', $buf2, $ar_buf2))
&& ($ar_buf2[1]!="::") && !preg_match('/^fe80::/i', $ar_buf2[1])) {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').strtolower($ar_buf2[1]));
}
}
}
if ($macaddr != "") {
$dev->setInfo($macaddr.($dev->getInfo()?';'.$dev->getInfo():''));
}
if (CommonFunctions::rfts('/sys/class/net/'.trim($dev_name).'/speed', $buf, 1, 4096, false) && (($speed=trim($buf))!="") && ($buf > 0) && ($buf < 65535)) {
if ($speed > 1000) {
$speed = $speed/1000;
$unit = "G";
} else {
$unit = "M";
}
if (CommonFunctions::rfts('/sys/class/net/'.trim($dev_name).'/duplex', $buf, 1, 4096, false) && (($duplex=strtolower(trim($buf)))!="") && ($duplex!='unknown')) {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$speed.$unit.'b/s '.$duplex);
} else {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$speed.$unit.'b/s');
}
}
}
$this->sys->setNetDevices($dev);
}
}
} elseif (CommonFunctions::executeProgram('ip', 'addr show', $bufr, PSI_DEBUG) && ($bufr!="")) {
$lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
$was = false;
$macaddr = "";
$speedinfo = "";
$dev = null;
foreach ($lines as $line) {
if (preg_match("/^\d+:\s+([^\s:]+)/", $line, $ar_buf)) {
if ($was) {
if ($macaddr != "") {
$dev->setInfo($macaddr.($dev->getInfo()?';'.$dev->getInfo():''));
}
if ($speedinfo != "") {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$speedinfo);
}
$this->sys->setNetDevices($dev);
}
$speedinfo = "";
$macaddr = "";
$dev = new NetDevice();
$dev->setName($ar_buf[1]);
if (CommonFunctions::executeProgram('ip', '-s link show '.$ar_buf[1], $bufr2, PSI_DEBUG) && ($bufr2!="")
&& preg_match("/\n\s+RX:\s[^\n]+\n\s+(\d+)\s+\d+\s+(\d+)\s+(\d+)[^\n]+\n\s+TX:\s[^\n]+\n\s+(\d+)\s+\d+\s+(\d+)\s+(\d+)/m", $bufr2, $ar_buf2)) {
$dev->setRxBytes($ar_buf2[1]);
$dev->setTxBytes($ar_buf2[4]);
$dev->setErrors($ar_buf2[2]+$ar_buf2[5]);
$dev->setDrops($ar_buf2[3]+$ar_buf2[6]);
}
$was = true;
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) {
if (CommonFunctions::rfts('/sys/class/net/'.$ar_buf[1].'/speed', $buf, 1, 4096, false) && (trim($buf)!="")) {
$speed = trim($buf);
if ($speed > 1000) {
$speed = $speed/1000;
$unit = "G";
} else {
$unit = "M";
}
if (CommonFunctions::rfts('/sys/class/net/'.$ar_buf[1].'/duplex', $buf, 1, 4096, false) && (trim($buf)!="")) {
$speedinfo = $speed.$unit.'b/s '.strtolower(trim($buf));
} else {
$speedinfo = $speed.$unit.'b/s';
}
}
}
} else {
if ($was) {
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) {
if (preg_match('/^\s+link\/ether\s+(\S+)\s+brd/i', $line, $ar_buf2)) {
if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) $macaddr = preg_replace('/:/', '-', strtoupper($ar_buf2[1]));
} elseif (preg_match('/^\s+inet\s+([^\/\s]+).*peer\s+([^\/\s]+).*\s+scope\s((global)|(host))/i', $line, $ar_buf2)) {
if ($ar_buf2[1] != $ar_buf2[2]) {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1].";:".$ar_buf2[2]);
} else {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1]);
}
} elseif (preg_match('/^\s+inet6?\s+([^\/\s]+).*\s+scope\s((global)|(host))/i', $line, $ar_buf2)
&& ($ar_buf2[1]!="::") && !preg_match('/^fe80::/i', $ar_buf2[1])) {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').strtolower($ar_buf2[1]));
}
}
}
}
}
if ($was) {
if ($macaddr != "") {
$dev->setInfo($macaddr.($dev->getInfo()?';'.$dev->getInfo():''));
}
if ($speedinfo != "") {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$speedinfo);
}
$this->sys->setNetDevices($dev);
}
} elseif (CommonFunctions::executeProgram('ifconfig', '-a', $bufr, PSI_DEBUG)) {
$lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
$was = false;
$errors = 0;
$drops = 0;
$macaddr = "";
$speedinfo = "";
$dev = null;
foreach ($lines as $line) {
if (preg_match("/^([^\s:]+)/", $line, $ar_buf)) {
if ($was) {
$dev->setErrors($errors);
$dev->setDrops($drops);
if ($macaddr != "") {
$dev->setInfo($macaddr.($dev->getInfo()?';'.$dev->getInfo():''));
}
if ($speedinfo != "") {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$speedinfo);
}
$this->sys->setNetDevices($dev);
}
$errors = 0;
$drops = 0;
$speedinfo = "";
$macaddr = "";
$dev = new NetDevice();
$dev->setName($ar_buf[1]);
$was = true;
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) {
if (CommonFunctions::rfts('/sys/class/net/'.$ar_buf[1].'/speed', $buf, 1, 4096, false) && (trim($buf)!="")) {
$speed = trim($buf);
if ($speed > 1000) {
$speed = $speed/1000;
$unit = "G";
} else {
$unit = "M";
}
if (CommonFunctions::rfts('/sys/class/net/'.$ar_buf[1].'/duplex', $buf, 1, 4096, false) && (trim($buf)!="")) {
$speedinfo = $speed.$unit.'b/s '.strtolower(trim($buf));
} else {
$speedinfo = $speed.$unit.'b/s';
}
}
if (preg_match('/^'.$ar_buf[1].'\s+Link\sencap:Ethernet\s+HWaddr\s(\S+)/i', $line, $ar_buf2))
if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) $macaddr = preg_replace('/:/', '-', strtoupper($ar_buf2[1]));
elseif (preg_match('/^'.$ar_buf[1].':\s+ip\s+(\S+)\s+mask/i', $line, $ar_buf2))
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1]);
}
} else {
if ($was) {
if (preg_match('/\sRX bytes:(\d+)\s/i', $line, $ar_buf2)) {
$dev->setRxBytes($ar_buf2[1]);
}
if (preg_match('/\sTX bytes:(\d+)\s/i', $line, $ar_buf2)) {
$dev->setTxBytes($ar_buf2[1]);
}
 
$bufr = rfts( '/proc/swaps' );
if ( $bufr != "ERROR" ) {
$swaps = explode("\n", $bufr);
for ($i = 1; $i < (sizeof($swaps)); $i++) {
if( trim( $swaps[$i] ) != "" ) {
$ar_buf = preg_split('/\s+/', $swaps[$i], 6);
$results['devswap'][$i - 1] = array();
$results['devswap'][$i - 1]['dev'] = $ar_buf[0];
$results['devswap'][$i - 1]['total'] = $ar_buf[2];
$results['devswap'][$i - 1]['used'] = $ar_buf[3];
$results['devswap'][$i - 1]['free'] = ($results['devswap'][$i - 1]['total'] - $results['devswap'][$i - 1]['used']);
$results['devswap'][$i - 1]['percent'] = round(($ar_buf[3] * 100) / $ar_buf[2]);
$results['swap']['total'] += $ar_buf[2];
$results['swap']['used'] += $ar_buf[3];
$results['swap']['free'] = $results['swap']['total'] - $results['swap']['used'];
$results['swap']['percent'] = round(($results['swap']['used'] * 100) / $results['swap']['total']);
}
}
}
if (preg_match('/\sRX packets:\d+\serrors:(\d+)\sdropped:(\d+)/i', $line, $ar_buf2)) {
$errors +=$ar_buf2[1];
$drops +=$ar_buf2[2];
} elseif (preg_match('/\sTX packets:\d+\serrors:(\d+)\sdropped:(\d+)/i', $line, $ar_buf2)) {
$errors +=$ar_buf2[1];
$drops +=$ar_buf2[2];
}
 
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) {
if (preg_match('/\s+encap:Ethernet\s+HWaddr\s(\S+)/i', $line, $ar_buf2)
|| preg_match('/^\s+ether\s+(\S+)\s+txqueuelen/i', $line, $ar_buf2)) {
if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) $macaddr = preg_replace('/:/', '-', strtoupper($ar_buf2[1]));
} elseif (preg_match('/^\s+inet\saddr:(\S+)\s+P-t-P:(\S+)/i', $line, $ar_buf2)
|| preg_match('/^\s+inet\s+(\S+)\s+netmask.+destination\s+(\S+)/i', $line, $ar_buf2)) {
if ($ar_buf2[1] != $ar_buf2[2]) {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1].";:".$ar_buf2[2]);
} else {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1]);
}
} elseif ((preg_match('/^\s+inet\saddr:(\S+)/i', $line, $ar_buf2)
|| preg_match('/^\s+inet\s+(\S+)\s+netmask/i', $line, $ar_buf2)
|| preg_match('/^\s+inet6\saddr:\s([^\/\s]+)(.+)\s+Scope:[GH]/i', $line, $ar_buf2)
|| preg_match('/^\s+inet6\s+(\S+)\s+prefixlen(.+)((<global>)|(<host>))/i', $line, $ar_buf2))
&& ($ar_buf2[1]!="::") && !preg_match('/^fe80::/i', $ar_buf2[1])) {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').strtolower($ar_buf2[1]));
}
}
}
}
}
if ($was) {
$dev->setErrors($errors);
$dev->setDrops($drops);
if ($macaddr != "") {
$dev->setInfo($macaddr.($dev->getInfo()?';'.$dev->getInfo():''));
}
if ($speedinfo != "") {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$speedinfo);
}
$this->sys->setNetDevices($dev);
}
}
}
return $results;
}
function filesystems () {
return $this->parser->parse_filesystems();
}
 
function distro () {
return $this->distro;
}
/**
* Physical memory information and Swap Space information
*
* @return void
*/
protected function _memory()
{
if (CommonFunctions::rfts('/proc/meminfo', $mbuf)) {
$bufe = preg_split("/\n/", $mbuf, -1, PREG_SPLIT_NO_EMPTY);
foreach ($bufe as $buf) {
if (preg_match('/^MemTotal:\s+(\d+)\s*kB/i', $buf, $ar_buf)) {
$this->sys->setMemTotal($ar_buf[1] * 1024);
} elseif (preg_match('/^MemFree:\s+(\d+)\s*kB/i', $buf, $ar_buf)) {
$this->sys->setMemFree($ar_buf[1] * 1024);
} elseif (preg_match('/^Cached:\s+(\d+)\s*kB/i', $buf, $ar_buf)) {
$this->sys->setMemCache($ar_buf[1] * 1024);
} elseif (preg_match('/^Buffers:\s+(\d+)\s*kB/i', $buf, $ar_buf)) {
$this->sys->setMemBuffer($ar_buf[1] * 1024);
}
}
$this->sys->setMemUsed($this->sys->getMemTotal() - $this->sys->getMemFree());
// values for splitting memory usage
if ($this->sys->getMemCache() !== null && $this->sys->getMemBuffer() !== null) {
$this->sys->setMemApplication($this->sys->getMemUsed() - $this->sys->getMemCache() - $this->sys->getMemBuffer());
}
if (CommonFunctions::rfts('/proc/swaps', $sbuf, 0, 4096, false)) {
$swaps = preg_split("/\n/", $sbuf, -1, PREG_SPLIT_NO_EMPTY);
unset($swaps[0]);
foreach ($swaps as $swap) {
$ar_buf = preg_split('/\s+/', $swap, 5);
$dev = new DiskDevice();
$dev->setMountPoint($ar_buf[0]);
$dev->setName("SWAP");
$dev->setTotal($ar_buf[2] * 1024);
$dev->setUsed($ar_buf[3] * 1024);
$dev->setFree($dev->getTotal() - $dev->getUsed());
$this->sys->setSwapDevices($dev);
}
}
}
}
 
function distroicon () {
return $this->icon;
}
/**
* filesystem information
*
* @return void
*/
private function _filesystems()
{
$df_args = "";
$hideFstypes = array();
if (defined('PSI_HIDE_FS_TYPES') && is_string(PSI_HIDE_FS_TYPES)) {
if (preg_match(ARRAY_EXP, PSI_HIDE_FS_TYPES)) {
$hideFstypes = eval(PSI_HIDE_FS_TYPES);
} else {
$hideFstypes = array(PSI_HIDE_FS_TYPES);
}
}
foreach ($hideFstypes as $Fstype) {
$df_args .= "-x $Fstype ";
}
if ($df_args !== "") {
$df_args = trim($df_args); //trim spaces
$arrResult = Parser::df("-P $df_args 2>/dev/null");
} else {
$arrResult = Parser::df("-P 2>/dev/null");
}
foreach ($arrResult as $dev) {
$this->sys->setDiskDevices($dev);
}
}
 
}
/**
* Distribution
*
* @return void
*/
protected function _distro()
{
$this->sys->setDistribution("Linux");
$list = @parse_ini_file(PSI_APP_ROOT."/data/distros.ini", true);
if (!$list) {
return;
}
// We have the '2>/dev/null' because Ubuntu gives an error on this command which causes the distro to be unknown
if (CommonFunctions::executeProgram('lsb_release', '-a 2>/dev/null', $distro_info, PSI_DEBUG) && (strlen($distro_info) > 0)) {
$distro_tmp = preg_split("/\n/", $distro_info, -1, PREG_SPLIT_NO_EMPTY);
foreach ($distro_tmp as $info) {
$info_tmp = preg_split('/:/', $info, 2);
if (isset($distro_tmp[0]) && !is_null($distro_tmp[0]) && (trim($distro_tmp[0]) != "") &&
isset($distro_tmp[1]) && !is_null($distro_tmp[1]) && (trim($distro_tmp[1]) != "")) {
$distro[trim($info_tmp[0])] = trim($info_tmp[1]);
}
}
if (!isset($distro['Distributor ID']) && !isset($distro['Description'])) { // Systems like StartOS
if (isset($distro_tmp[0]) && !is_null($distro_tmp[0]) && (trim($distro_tmp[0]) != "")) {
$this->sys->setDistribution(trim($distro_tmp[0]));
if (preg_match('/^(\S+)\s*/', $distro_tmp[0], $id_buf)
&& isset($list[trim($id_buf[1])]['Image'])) {
$this->sys->setDistributionIcon($list[trim($id_buf[1])]['Image']);
}
}
} else {
if (isset($distro['Description'])
&& preg_match('/^NAME=\s*"?([^"\n]+)"?\s*$/', $distro['Description'], $name_tmp)) {
$distro['Description'] = $name_tmp[1];
}
if (isset($distro['Description'])
&& ($distro['Description'] != "n/a")
&& (!isset($distro['Distributor ID'])
|| (($distro['Distributor ID'] != "n/a")
&& ($distro['Description'] != $distro['Distributor ID'])))) {
$this->sys->setDistribution($distro['Description']);
if (isset($distro['Release']) && ($distro['Release'] != "n/a")
&& ($distro['Release'] != $distro['Description']) && strstr($distro['Release'], ".")){
if (preg_match("/^(\d+)\.[0]+$/", $distro['Release'], $match_buf)) {
$tofind = $match_buf[1];
} else {
$tofind = $distro['Release'];
}
if (!preg_match("/^".$tofind."[\s\.]|[\(\[]".$tofind."[\.\)\]]|\s".$tofind."$|\s".$tofind."[\s\.]/", $distro['Description'])) {
$this->sys->setDistribution($this->sys->getDistribution()." ".$distro['Release']);
}
}
} elseif (isset($distro['Distributor ID']) && ($distro['Distributor ID'] != "n/a")) {
$this->sys->setDistribution($distro['Distributor ID']);
if (isset($distro['Release']) && ($distro['Release'] != "n/a")) {
$this->sys->setDistribution($this->sys->getDistribution()." ".$distro['Release']);
}
if (isset($distro['Codename']) && ($distro['Codename'] != "n/a")) {
$this->sys->setDistribution($this->sys->getDistribution()." (".$distro['Codename'].")");
}
}
if (isset($distro['Distributor ID']) && ($distro['Distributor ID'] != "n/a") && isset($list[$distro['Distributor ID']]['Image'])) {
$this->sys->setDistributionIcon($list[$distro['Distributor ID']]['Image']);
} elseif (isset($distro['Description']) && ($distro['Description'] != "n/a")) {
$this->sys->setDistribution($distro['Description']);
if (isset($list[$distro['Description']]['Image'])) {
$this->sys->setDistributionIcon($list[$distro['Description']]['Image']);
}
}
}
} else {
/* default error handler */
if (function_exists('errorHandlerPsi')) {
restore_error_handler();
}
/* fatal errors only */
$old_err_rep = error_reporting();
error_reporting(E_ERROR);
 
?>
// Fall back in case 'lsb_release' does not exist but exist /etc/lsb-release
if (CommonFunctions::fileexists($filename="/etc/lsb-release")
&& CommonFunctions::rfts($filename, $buf, 0, 4096, false)
&& preg_match('/^DISTRIB_ID="?([^"\n]+)"?/m', $buf, $id_buf)) {
if (preg_match('/^DISTRIB_DESCRIPTION="?([^"\n]+)"?/m', $buf, $desc_buf)
&& (trim($desc_buf[1])!=trim($id_buf[1]))) {
$this->sys->setDistribution(trim($desc_buf[1]));
if (preg_match('/^DISTRIB_RELEASE="?([^"\n]+)"?/m', $buf, $vers_buf)
&& (trim($vers_buf[1])!=trim($desc_buf[1])) && strstr($vers_buf[1], ".")){
if (preg_match("/^(\d+)\.[0]+$/", trim($vers_buf[1]), $match_buf)) {
$tofind = $match_buf[1];
} else {
$tofind = trim($vers_buf[1]);
}
if (!preg_match("/^".$tofind."[\s\.]|[\(\[]".$tofind."[\.\)\]]|\s".$tofind."$|\s".$tofind."[\s\.]/", trim($desc_buf[1]))) {
$this->sys->setDistribution($this->sys->getDistribution()." ".trim($vers_buf[1]));
}
}
} else {
if (isset($list[trim($id_buf[1])]['Name'])) {
$this->sys->setDistribution(trim($list[trim($id_buf[1])]['Name']));
} else {
$this->sys->setDistribution(trim($id_buf[1]));
}
if (preg_match('/^DISTRIB_RELEASE="?([^"\n]+)"?/m', $buf, $vers_buf)) {
$this->sys->setDistribution($this->sys->getDistribution()." ".trim($vers_buf[1]));
}
if (preg_match('/^DISTRIB_CODENAME="?([^"\n]+)"?/m', $buf, $vers_buf)) {
$this->sys->setDistribution($this->sys->getDistribution()." (".trim($vers_buf[1]).")");
}
}
if (isset($list[trim($id_buf[1])]['Image'])) {
$this->sys->setDistributionIcon($list[trim($id_buf[1])]['Image']);
}
} else { // otherwise find files specific for distribution
foreach ($list as $section=>$distribution) {
if (!isset($distribution['Files'])) {
continue;
} else {
foreach (preg_split("/;/", $distribution['Files'], -1, PREG_SPLIT_NO_EMPTY) as $filename) {
if (CommonFunctions::fileexists($filename)) {
$distro = $distribution;
if (isset($distribution['Mode'])&&(strtolower($distribution['Mode'])=="detection")) {
$buf = "";
} elseif (isset($distribution['Mode'])&&(strtolower($distribution['Mode'])=="execute")) {
if (!CommonFunctions::executeProgram($filename, '2>/dev/null', $buf, PSI_DEBUG)) {
$buf = "";
}
} else {
if (!CommonFunctions::rfts($filename, $buf, 1, 4096, false)) {
$buf = "";
} elseif (isset($distribution['Mode'])&&(strtolower($distribution['Mode'])=="analyse")) {
if (preg_match('/^(\S+)\s*/', preg_replace('/^Red\s+/', 'Red', $buf), $id_buf)
&& isset($list[trim($id_buf[1])]['Image'])) {
$distro = $list[trim($id_buf[1])];
}
}
}
if (isset($distro['Image'])) {
$this->sys->setDistributionIcon($distro['Image']);
}
if (isset($distribution['Name'])) {
if (is_null($buf) || (trim($buf) == "")) {
$this->sys->setDistribution($distribution['Name']);
} else {
$this->sys->setDistribution($distribution['Name']." ".trim($buf));
}
} else {
if (is_null($buf) || (trim($buf) == "")) {
$this->sys->setDistribution($section);
} else {
$this->sys->setDistribution(trim($buf));
}
}
if (isset($distribution['Files2'])) {
foreach (preg_split("/;/", $distribution['Files2'], -1, PREG_SPLIT_NO_EMPTY) as $filename2) {
if (CommonFunctions::fileexists($filename2) && CommonFunctions::rfts($filename2, $buf, 0, 4096, false)) {
if (preg_match('/^majorversion="?([^"\n]+)"?/m', $buf, $maj_buf)
&& preg_match('/^minorversion="?([^"\n]+)"?/m', $buf, $min_buf)) {
$distr2=$maj_buf[1].'.'.$min_buf[1];
if (preg_match('/^buildphase="?([^"\n]+)"?/m', $buf, $pha_buf) && ($pha_buf[1]!=="0")) {
$distr2.='.'.$pha_buf[1];
}
if (preg_match('/^buildnumber="?([^"\n]+)"?/m', $buf, $num_buf)) {
$distr2.='-'.$num_buf[1];
}
if (preg_match('/^builddate="?([^"\n]+)"?/m', $buf, $dat_buf)) {
$distr2.=' ('.$dat_buf[1].')';
}
$this->sys->setDistribution($this->sys->getDistribution()." ".$distr2);
} else {
$distr2=trim(substr($buf, 0, strpos($buf, "\n")));
if (!is_null($distr2) && ($distr2 != "")) {
$this->sys->setDistribution($this->sys->getDistribution()." ".$distr2);
}
}
break;
}
}
}
break 2;
}
}
}
}
}
// if the distribution is still unknown
if ($this->sys->getDistribution() == "Linux") {
if (CommonFunctions::fileexists($filename="/etc/DISTRO_SPECS")
&& CommonFunctions::rfts($filename, $buf, 0, 4096, false)
&& preg_match('/^DISTRO_NAME=\'(.+)\'/m', $buf, $id_buf)) {
if (isset($list[trim($id_buf[1])]['Name'])) {
$dist = trim($list[trim($id_buf[1])]['Name']);
} else {
$dist = trim($id_buf[1]);
}
if (preg_match('/^DISTRO_VERSION=([^#\n\r]+)/m', $buf, $vers_buf)) {
$this->sys->setDistribution(trim($dist." ".trim($vers_buf[1])));
} else {
$this->sys->setDistribution($dist);
}
if (isset($list[trim($id_buf[1])]['Image'])) {
$this->sys->setDistributionIcon($list[trim($id_buf[1])]['Image']);
} else {
if (isset($list['Puppy']['Image'])) {
$this->sys->setDistributionIcon($list['Puppy']['Image']);
}
}
} elseif ((CommonFunctions::fileexists($filename="/etc/distro-release")
&& CommonFunctions::rfts($filename, $buf, 1, 4096, false)
&& !is_null($buf) && (trim($buf) != ""))
|| (CommonFunctions::fileexists($filename="/etc/system-release")
&& CommonFunctions::rfts($filename, $buf, 1, 4096, false)
&& !is_null($buf) && (trim($buf) != ""))) {
$this->sys->setDistribution(trim($buf));
if (preg_match('/^(\S+)\s*/', preg_replace('/^Red\s+/', 'Red', $buf), $id_buf)
&& isset($list[trim($id_buf[1])]['Image'])) {
$this->sys->setDistributionIcon($list[trim($id_buf[1])]['Image']);
}
} elseif (CommonFunctions::fileexists($filename="/etc/solydxk/info")
&& CommonFunctions::rfts($filename, $buf, 0, 4096, false)
&& preg_match('/^DISTRIB_ID="?([^"\n]+)"?/m', $buf, $id_buf)) {
if (preg_match('/^DESCRIPTION="?([^"\n]+)"?/m', $buf, $desc_buf)
&& (trim($desc_buf[1])!=trim($id_buf[1]))) {
$this->sys->setDistribution(trim($desc_buf[1]));
} else {
if (isset($list[trim($id_buf[1])]['Name'])) {
$this->sys->setDistribution(trim($list[trim($id_buf[1])]['Name']));
} else {
$this->sys->setDistribution(trim($id_buf[1]));
}
if (preg_match('/^RELEASE="?([^"\n]+)"?/m', $buf, $vers_buf)) {
$this->sys->setDistribution($this->sys->getDistribution()." ".trim($vers_buf[1]));
}
if (preg_match('/^CODENAME="?([^"\n]+)"?/m', $buf, $vers_buf)) {
$this->sys->setDistribution($this->sys->getDistribution()." (".trim($vers_buf[1]).")");
}
}
if (isset($list[trim($id_buf[1])]['Image'])) {
$this->sys->setDistributionIcon($list[trim($id_buf[1])]['Image']);
} else {
$this->sys->setDistributionIcon($list['SolydXK']['Image']);
}
} elseif (CommonFunctions::fileexists($filename="/etc/os-release")
&& CommonFunctions::rfts($filename, $buf, 0, 4096, false)
&& (preg_match('/^TAILS_VERSION_ID="?([^"\n]+)"?/m', $buf, $tid_buf)
|| preg_match('/^NAME="?([^"\n]+)"?/m', $buf, $id_buf))) {
if (preg_match('/^TAILS_VERSION_ID="?([^"\n]+)"?/m', $buf, $tid_buf)) {
if (preg_match('/^TAILS_PRODUCT_NAME="?([^"\n]+)"?/m', $buf, $desc_buf)) {
$this->sys->setDistribution(trim($desc_buf[1])." ".trim($tid_buf[1]));
} else {
if (isset($list['Tails']['Name'])) {
$this->sys->setDistribution(trim($list['Tails']['Name'])." ".trim($tid_buf[1]));
} else {
$this->sys->setDistribution('Tails'." ".trim($tid_buf[1]));
}
}
$this->sys->setDistributionIcon($list['Tails']['Image']);
} else {
if (preg_match('/^PRETTY_NAME="?([^"\n]+)"?/m', $buf, $desc_buf)
&& !preg_match('/\$/', $desc_buf[1])) { //if is not defined by variable
$this->sys->setDistribution(trim($desc_buf[1]));
} else {
if (isset($list[trim($id_buf[1])]['Name'])) {
$this->sys->setDistribution(trim($list[trim($id_buf[1])]['Name']));
} else {
$this->sys->setDistribution(trim($id_buf[1]));
}
if (preg_match('/^VERSION="?([^"\n]+)"?/m', $buf, $vers_buf)) {
$this->sys->setDistribution($this->sys->getDistribution()." ".trim($vers_buf[1]));
} elseif (preg_match('/^VERSION_ID="?([^"\n]+)"?/m', $buf, $vers_buf)) {
$this->sys->setDistribution($this->sys->getDistribution()." ".trim($vers_buf[1]));
}
}
if (isset($list[trim($id_buf[1])]['Image'])) {
$this->sys->setDistributionIcon($list[trim($id_buf[1])]['Image']);
}
}
} elseif (CommonFunctions::fileexists($filename="/etc/debian_version")) {
if (!CommonFunctions::rfts($filename, $buf, 1, 4096, false)) {
$buf = "";
}
if (isset($list['Debian']['Image'])) {
$this->sys->setDistributionIcon($list['Debian']['Image']);
}
if (isset($list['Debian']['Name'])) {
if (is_null($buf) || (trim($buf) == "")) {
$this->sys->setDistribution($list['Debian']['Name']);
} else {
$this->sys->setDistribution($list['Debian']['Name']." ".trim($buf));
}
} else {
if (is_null($buf) || (trim($buf) == "")) {
$this->sys->setDistribution('Debian');
} else {
$this->sys->setDistribution(trim($buf));
}
}
} elseif (CommonFunctions::fileexists($filename="/etc/config/uLinux.conf")
&& CommonFunctions::rfts($filename, $buf, 0, 4096, false)
&& preg_match("/^Rsync\sModel\s*=\s*QNAP/m", $buf)
&& preg_match("/^Version\s*=\s*([\d\.]+)\r?\nBuild\sNumber\s*=\s*(\S+)/m", $buf, $ver_buf)) {
$buf = $ver_buf[1]."-".$ver_buf[2];
if (isset($list['QTS']['Image'])) {
$this->sys->setDistributionIcon($list['QTS']['Image']);
}
if (isset($list['QTS']['Name'])) {
$this->sys->setDistribution($list['QTS']['Name']." ".trim($buf));
} else {
$this->sys->setDistribution(trim($buf));
}
}
}
/* restore error level */
error_reporting($old_err_rep);
/* restore error handler */
if (function_exists('errorHandlerPsi')) {
set_error_handler('errorHandlerPsi');
}
}
}
 
/**
* Processes
*
* @return void
*/
protected function _processes()
{
$process = glob('/proc/*/status', GLOB_NOSORT);
if (is_array($process) && (($total = count($process)) > 0)) {
$processes['*'] = 0;
$buf = "";
for ($i = 0; $i < $total; $i++) {
if (CommonFunctions::rfts($process[$i], $buf, 0, 4096, false)) {
$processes['*']++; //current total
if (preg_match('/^State:\s+(\w)/m', $buf, $state)) {
if (isset($processes[$state[1]])) {
$processes[$state[1]]++;
} else {
$processes[$state[1]] = 1;
}
}
}
}
if (!($processes['*'] > 0)) {
$processes['*'] = $processes[' '] = $total; //all unknown
}
$this->sys->setProcesses($processes);
}
}
 
/**
* get the information
*
* @see PSI_Interface_OS::build()
*
* @return Void
*/
public function build()
{
if (!$this->blockname || $this->blockname==='vitals') {
$this->_distro();
$this->_hostname();
$this->_kernel();
$this->_uptime();
$this->_users();
$this->_loadavg();
$this->_processes();
}
if (!$this->blockname || $this->blockname==='hardware') {
$this->_machine();
$this->_cpuinfo();
$this->_pci();
$this->_ide();
$this->_scsi();
$this->_nvme();
$this->_usb();
$this->_i2c();
}
if (!$this->blockname || $this->blockname==='network') {
$this->_network();
}
if (!$this->blockname || $this->blockname==='memory') {
$this->_memory();
}
if (!$this->blockname || $this->blockname==='filesystem') {
$this->_filesystems();
}
}
}
/web/acc/phpsysinfo/includes/os/class.Minix.inc.php
0,0 → 1,359
<?php
/**
* Minix System Class
*
* PHP version 5
*
* @category PHP
* @package PSI Minix OS class
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
* @copyright 2012 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.Minix.inc.php 687 2012-09-06 20:54:49Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* Minix sysinfo class
* get all the required information from Minix system
*
* @category PHP
* @package PSI Minix OS class
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
* @copyright 2012 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class Minix extends OS
{
/**
* content of the syslog
*
* @var array
*/
private $_dmesg = null;
 
/**
* read /var/log/messages, but only if we haven't already
*
* @return array
*/
protected function readdmesg()
{
if ($this->_dmesg === null) {
if (CommonFunctions::rfts('/var/log/messages', $buf)) {
$blocks = preg_replace("/\s(kernel: MINIX \d+\.\d+\.\d+\.)/", '<BLOCK>$1', $buf);
$parts = preg_split("/<BLOCK>/", $blocks, -1, PREG_SPLIT_NO_EMPTY);
$this->_dmesg = preg_split("/\n/", $parts[count($parts) - 1], -1, PREG_SPLIT_NO_EMPTY);
} else {
$this->_dmesg = array();
}
}
 
return $this->_dmesg;
}
 
/**
* get the cpu information
*
* @return void
*/
protected function _cpuinfo()
{
if (CommonFunctions::rfts('/proc/cpuinfo', $bufr, 0, 4096, false)) {
$processors = preg_split('/\s?\n\s?\n/', trim($bufr));
foreach ($processors as $processor) {
$_n = ""; $_f = ""; $_m = ""; $_s = "";
$dev = new CpuDevice();
$details = preg_split("/\n/", $processor, -1, PREG_SPLIT_NO_EMPTY);
foreach ($details as $detail) {
$arrBuff = preg_split('/\s+:\s+/', trim($detail));
if (count($arrBuff) == 2) {
switch (strtolower($arrBuff[0])) {
case 'model name':
$_n = $arrBuff[1];
break;
case 'cpu mhz':
$dev->setCpuSpeed($arrBuff[1]);
break;
case 'cpu family':
$_f = $arrBuff[1];
break;
case 'model':
$_m = $arrBuff[1];
break;
case 'stepping':
$_s = $arrBuff[1];
break;
case 'flags':
if (preg_match("/ vmx/", $arrBuff[1])) {
$dev->setVirt("vmx");
} elseif (preg_match("/ svm/", $arrBuff[1])) {
$dev->setVirt("svm");
}
break;
case 'vendor_id':
$dev->setVendorId($arrBuff[1]);
break;
}
}
}
if ($_n == "") $_n="CPU";
if ($_f != "") $_n.=" Family ".$_f;
if ($_m != "") $_n.=" Model ".$_m;
if ($_s != "") $_n.=" Stepping ".$_s;
$dev->SetModel($_n);
$this->sys->setCpus($dev);
}
} else
foreach ($this->readdmesg() as $line) {
if (preg_match('/kernel: (CPU .*) freq (.*) MHz/', $line, $ar_buf)) {
$dev = new CpuDevice();
$dev->setModel($ar_buf[1]);
$dev->setCpuSpeed($ar_buf[2]);
$this->sys->setCpus($dev);
}
}
}
 
/**
* PCI devices
* get the pci device information out of dmesg
*
* @return void
*/
protected function _pci()
{
if (CommonFunctions::rfts('/proc/pci', $strBuf, 0, 4096, false)) {
$arrLines = preg_split("/\n/", $strBuf, -1, PREG_SPLIT_NO_EMPTY);
$arrResults = array();
foreach ($arrLines as $strLine) {
$arrParams = preg_split('/\s+/', trim($strLine), 4);
if (count($arrParams) == 4)
$strName = $arrParams[3];
else
$strName = "unknown";
$strName = preg_replace('/\(.*\)/', '', $strName);
$dev = new HWDevice();
$dev->setName($strName);
$arrResults[] = $dev;
}
foreach ($arrResults as $dev) {
$this->sys->setPciDevices($dev);
}
}
if (!(isset($arrResults) && is_array($arrResults)) && ($results = Parser::lspci())) {
/* if access error: chmod 4755 /usr/bin/lspci */
foreach ($results as $dev) {
$this->sys->setPciDevices($dev);
}
}
}
 
/**
* Minix Version
*
* @return void
*/
private function _kernel()
{
if (CommonFunctions::executeProgram('uname', '-rvm', $ret)) {
foreach ($this->readdmesg() as $line) {
if (preg_match('/kernel: MINIX (\d+\.\d+\.\d+)\. \((.+)\)/', $line, $ar_buf)) {
$branch = $ar_buf[2];
break;
}
}
if (isset($branch))
$this->sys->setKernel($ret.' ('.$branch.')');
else
$this->sys->setKernel($ret);
}
}
 
/**
* Distribution
*
* @return void
*/
protected function _distro()
{
if (CommonFunctions::executeProgram('uname', '-sr', $ret))
$this->sys->setDistribution($ret);
else
$this->sys->setDistribution('Minix');
 
$this->sys->setDistributionIcon('Minix.png');
}
 
/**
* UpTime
* time the system is running
*
* @return void
*/
private function _uptime()
{
if (CommonFunctions::executeProgram('uptime', '', $buf)) {
if (preg_match("/up (\d+) day[s]?,\s*(\d+):(\d+),/", $buf, $ar_buf)) {
$min = $ar_buf[3];
$hours = $ar_buf[2];
$days = $ar_buf[1];
$this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60);
} elseif (preg_match("/up (\d+):(\d+),/", $buf, $ar_buf)) {
$min = $ar_buf[2];
$hours = $ar_buf[1];
$this->sys->setUptime($hours * 3600 + $min * 60);
}
}
}
 
/**
* Processor Load
* optionally create a loadbar
*
* @return void
*/
private function _loadavg()
{
if (CommonFunctions::executeProgram('uptime', '', $buf)) {
if (preg_match("/load averages: (.*), (.*), (.*)$/", $buf, $ar_buf)) {
$this->sys->setLoad($ar_buf[1].' '.$ar_buf[2].' '.$ar_buf[3]);
}
}
}
 
/**
* Virtual Host Name
*
* @return void
*/
private function _hostname()
{
if (PSI_USE_VHOST === true) {
if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
} else {
if (CommonFunctions::executeProgram('uname', '-n', $result, PSI_DEBUG)) {
$ip = gethostbyname($result);
if ($ip != $result) {
$this->sys->setHostname(gethostbyaddr($ip));
}
}
}
}
 
 
/**
* Physical memory information and Swap Space information
*
* @return void
*/
private function _memory()
{
if (CommonFunctions::rfts('/proc/meminfo', $bufr, 1, 4096, false)) {
$ar_buf = preg_split('/\s+/', trim($bufr));
if (count($ar_buf) >= 5) {
$this->sys->setMemTotal($ar_buf[0]*$ar_buf[1]);
$this->sys->setMemFree($ar_buf[0]*$ar_buf[2]);
$this->sys->setMemCache($ar_buf[0]*$ar_buf[4]);
$this->sys->setMemUsed($ar_buf[0]*($ar_buf[1]-$ar_buf[2]));
}
}
}
 
/**
* filesystem information
*
* @return void
*/
private function _filesystems()
{
$arrResult = Parser::df("-P 2>/dev/null");
foreach ($arrResult as $dev) {
$this->sys->setDiskDevices($dev);
}
}
 
/**
* network information
*
* @return void
*/
private function _network()
{
if (CommonFunctions::executeProgram('ifconfig', '-a', $bufr, PSI_DEBUG)) {
$lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
if (preg_match("/^([^\s:]+):\saddress\s(\S+)\snetmask/", $line, $ar_buf)) {
$dev = new NetDevice();
$dev->setName($ar_buf[1]);
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) {
$dev->setInfo($ar_buf[2]);
}
$this->sys->setNetDevices($dev);
}
}
}
}
 
/**
* Processes
*
* @return void
*/
protected function _processes()
{
if (CommonFunctions::executeProgram('ps', 'alx', $bufr, PSI_DEBUG)) {
$lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
$processes['*'] = 0;
foreach ($lines as $line) {
if (preg_match("/^\s(\w)\s/", $line, $ar_buf)) {
$processes['*']++;
$state = $ar_buf[1];
if ($state == 'W') $state = 'D'; //linux format
elseif ($state == 'D') $state = 'd'; //invalid
if (isset($processes[$state])) {
$processes[$state]++;
} else {
$processes[$state] = 1;
}
}
}
if ($processes['*'] > 0) {
$this->sys->setProcesses($processes);
}
}
}
 
/**
* get the information
*
* @return Void
*/
public function build()
{
$this->error->addError("WARN", "The Minix version of phpSysInfo is a work in progress, some things currently don't work");
if (!$this->blockname || $this->blockname==='vitals') {
$this->_distro();
$this->_hostname();
$this->_kernel();
$this->_uptime();
$this->_users();
$this->_loadavg();
$this->_processes();
}
if (!$this->blockname || $this->blockname==='hardware') {
$this->_pci();
$this->_cpuinfo();
}
if (!$this->blockname || $this->blockname==='network') {
$this->_network();
}
if (!$this->blockname || $this->blockname==='memory') {
$this->_memory();
}
if (!$this->blockname || $this->blockname==='filesystem') {
$this->_filesystems();
}
}
}
/web/acc/phpsysinfo/includes/os/class.NetBSD.inc.php
1,111 → 1,208
<?php
<?php
/**
* NetBSD System Class
*
* PHP version 5
*
* @category PHP
* @package PSI NetBSD OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.NetBSD.inc.php 287 2009-06-26 12:11:59Z bigmichi1 $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* NetBSD sysinfo class
* get all the required information from NetBSD systems
*
* @category PHP
* @package PSI NetBSD OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class NetBSD extends BSDCommon
{
/**
* define the regexp for log parser
*/
public function __construct($blockname = false)
{
parent::__construct($blockname);
$this->setCPURegExp1("/^cpu(.*)\, (.*) MHz/");
$this->setCPURegExp2("/user = (.*), nice = (.*), sys = (.*), intr = (.*), idle = (.*)/");
$this->setSCSIRegExp1("/^(.*) at scsibus.*: <(.*)> .*/");
$this->setSCSIRegExp2("/^(sd[0-9]+): (.*)([MG])B,/");
$this->setPCIRegExp1("/(.*) at pci[0-9]+ dev [0-9]* function [0-9]*: (.*)$/");
$this->setPCIRegExp2("/\"(.*)\" (.*).* at [.0-9]+ irq/");
}
 
// phpSysInfo - A PHP System Information Script
// http://phpsysinfo.sourceforge.net/
/**
* UpTime
* time the system is running
*
* @return void
*/
private function _uptime()
{
$a = $this->grabkey('kern.boottime');
$this->sys->setUptime(time() - $a);
}
 
// 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.
/**
* get network information
*
* @return void
*/
private function _network()
{
CommonFunctions::executeProgram('netstat', '-nbdi | cut -c1-25,44- | grep "^[a-z]*[0-9][ \t].*Link"', $netstat_b);
CommonFunctions::executeProgram('netstat', '-ndi | cut -c1-25,44- | grep "^[a-z]*[0-9][ \t].*Link"', $netstat_n);
$lines_b = preg_split("/\n/", $netstat_b, -1, PREG_SPLIT_NO_EMPTY);
$lines_n = preg_split("/\n/", $netstat_n, -1, PREG_SPLIT_NO_EMPTY);
for ($i = 0, $max = sizeof($lines_b); $i < $max; $i++) {
$ar_buf_b = preg_split("/\s+/", $lines_b[$i]);
$ar_buf_n = preg_split("/\s+/", $lines_n[$i]);
if (!empty($ar_buf_b[0]) && (!empty($ar_buf_n[3]) || ($ar_buf_n[3] === "0"))) {
$dev = new NetDevice();
$dev->setName($ar_buf_b[0]);
$dev->setTxBytes($ar_buf_b[4]);
$dev->setRxBytes($ar_buf_b[3]);
$dev->setDrops($ar_buf_n[8]);
$dev->setErrors($ar_buf_n[4] + $ar_buf_n[6]);
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS) && (CommonFunctions::executeProgram('ifconfig', $ar_buf_b[0].' 2>/dev/null', $bufr2, PSI_DEBUG))) {
$speedinfo = "";
$bufe2 = preg_split("/\n/", $bufr2, -1, PREG_SPLIT_NO_EMPTY);
foreach ($bufe2 as $buf2) {
if (preg_match('/^\s+address:\s+(\S+)/i', $buf2, $ar_buf2)) {
if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').preg_replace('/:/', '-', strtoupper($ar_buf2[1])));
} elseif (preg_match('/^\s+inet\s+(\S+)\s+netmask/i', $buf2, $ar_buf2)) {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1]);
} elseif ((preg_match('/^\s+inet6\s+([^\s%]+)\s+prefixlen/i', $buf2, $ar_buf2)
|| preg_match('/^\s+inet6\s+([^\s%]+)%\S+\s+prefixlen/i', $buf2, $ar_buf2))
&& ($ar_buf2[1]!="::") && !preg_match('/^fe80::/i', $ar_buf2[1])) {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').strtolower($ar_buf2[1]));
} elseif (preg_match('/^\s+media:\s+/i', $buf2) && preg_match('/[\(\s](\d+)(G*)base/i', $buf2, $ar_buf2)) {
if (isset($ar_buf2[2]) && strtoupper($ar_buf2[2])=="G") {
$unit = "G";
} else {
$unit = "M";
}
if (preg_match('/\s(\S+)-duplex/i', $buf2, $ar_buf3))
$speedinfo = $ar_buf2[1].$unit.'b/s '.strtolower($ar_buf3[1]);
else
$speedinfo = $ar_buf2[1].$unit.'b/s';
}
}
if ($speedinfo != "") $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$speedinfo);
}
$this->sys->setNetDevices($dev);
}
}
}
 
// 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.
/**
* IDE information
*
* @return void
*/
protected function ide()
{
foreach ($this->readdmesg() as $line) {
if (preg_match('/^(.*) at (pciide|wdc|atabus|atapibus)[0-9]+ (.*): <(.*)>/', $line, $ar_buf)
|| preg_match('/^(.*) at (pciide|wdc|atabus|atapibus)[0-9]+ /', $line, $ar_buf)) {
$dev = new HWDevice();
if (isset($ar_buf[4])) {
$dev->setName($ar_buf[4]);
} else {
$dev->setName($ar_buf[1]);
// now loop again and find the name
foreach ($this->readdmesg() as $line2) {
if (preg_match("/^(".$ar_buf[1]."): <(.*)>$/", $line2, $ar_buf_n)) {
$dev->setName($ar_buf_n[2]);
break;
}
}
}
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
// now loop again and find the capacity
foreach ($this->readdmesg() as $line2) {
if (preg_match("/^(".$ar_buf[1]."): (.*), (.*), (.*)MB, .*$/", $line2, $ar_buf_n)) {
$dev->setCapacity($ar_buf_n[4] * 1024 * 1024);
break;
} elseif (preg_match("/^(".$ar_buf[1]."): (.*) MB, (.*), (.*), .*$/", $line2, $ar_buf_n)) {
$dev->setCapacity($ar_buf_n[2] * 1024 * 1024);
break;
} elseif (preg_match("/^(".$ar_buf[1]."): (.*) GB, (.*), (.*), .*$/", $line2, $ar_buf_n)) {
$dev->setCapacity($ar_buf_n[2] * 1024 * 1024 * 1024);
break;
}
}
}
$this->sys->setIdeDevices($dev);
}
}
}
 
// 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.
/**
* get icon name
*
* @return void
*/
private function _distroicon()
{
$this->sys->setDistributionIcon('NetBSD.png');
}
 
// $Id: class.NetBSD.inc.php,v 1.18 2006/04/18 16:57:32 bigmichi1 Exp $
if (!defined('IN_PHPSYSINFO')) {
die("No Hacking");
/**
* Processes
*
* @return void
*/
protected function _processes()
{
if (CommonFunctions::executeProgram('ps', 'aux', $bufr, PSI_DEBUG)) {
$lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
$processes['*'] = 0;
foreach ($lines as $line) {
if (preg_match("/^\S+\s+\d+\s+\S+\s+\S+\s+\d+\s+\d+\s+\S+\s+(\w)/", $line, $ar_buf)) {
$processes['*']++;
$state = $ar_buf[1];
if ($state == 'O') $state = 'R'; //linux format
elseif ($state == 'I') $state = 'S';
if (isset($processes[$state])) {
$processes[$state]++;
} else {
$processes[$state] = 1;
}
}
}
if ($processes['*'] > 0) {
$this->sys->setProcesses($processes);
}
}
}
 
/**
* get the information
*
* @see BSDCommon::build()
*
* @return Void
*/
public function build()
{
parent::build();
if (!$this->blockname || $this->blockname==='vitals') {
$this->_distroicon();
$this->_uptime();
$this->_processes();
}
if (!$this->blockname || $this->blockname==='network') {
$this->_network();
}
}
}
 
require_once(APP_ROOT . '/includes/os/class.BSD.common.inc.php');
 
class sysinfo extends bsd_common {
var $cpu_regexp;
var $scsi_regexp;
// Our contstructor
// this function is run on the initialization of this class
function sysinfo () {
$this->bsd_common();
$this->cpu_regexp = "^cpu(.*)\, (.*) MHz";
$this->scsi_regexp1 = "^(.*) at scsibus.*: <(.*)> .*";
$this->scsi_regexp2 = "^(da[0-9]): (.*)MB ";
$this->cpu_regexp2 = "/user = (.*), nice = (.*), sys = (.*), intr = (.*), idle = (.*)/";
$this->pci_regexp1 = '/(.*) at pci[0-9] dev [0-9]* function [0-9]*: (.*)$/';
$this->pci_regexp2 = '/"(.*)" (.*).* at [.0-9]+ irq/';
}
 
function get_sys_ticks () {
$a = $this->grab_key('kern.boottime');
$sys_ticks = time() - $a;
return $sys_ticks;
}
 
function network () {
$netstat_b = execute_program('netstat', '-nbdi | cut -c1-25,44- | grep "^[a-z]*[0-9][ \t].*Link"');
$netstat_n = execute_program('netstat', '-ndi | cut -c1-25,44- | grep "^[a-z]*[0-9][ \t].*Link"');
$lines_b = explode("\n", $netstat_b);
$lines_n = explode("\n", $netstat_n);
$results = array();
for ($i = 0, $max = sizeof($lines_b); $i < $max; $i++) {
$ar_buf_b = preg_split("/\s+/", $lines_b[$i]);
$ar_buf_n = preg_split("/\s+/", $lines_n[$i]);
if (!empty($ar_buf_b[0]) && !empty($ar_buf_n[3])) {
$results[$ar_buf_b[0]] = array();
 
$results[$ar_buf_b[0]]['rx_bytes'] = $ar_buf_b[3];
$results[$ar_buf_b[0]]['rx_packets'] = $ar_buf_n[3];
$results[$ar_buf_b[0]]['rx_errs'] = $ar_buf_n[4];
$results[$ar_buf_b[0]]['rx_drop'] = $ar_buf_n[8];
 
$results[$ar_buf_b[0]]['tx_bytes'] = $ar_buf_b[4];
$results[$ar_buf_b[0]]['tx_packets'] = $ar_buf_n[5];
$results[$ar_buf_b[0]]['tx_errs'] = $ar_buf_n[6];
$results[$ar_buf_b[0]]['tx_drop'] = $ar_buf_n[8];
 
$results[$ar_buf_b[0]]['errs'] = $ar_buf_n[4] + $ar_buf_n[6];
$results[$ar_buf_b[0]]['drop'] = $ar_buf_n[8];
}
}
return $results;
}
 
// get the ide device information out of dmesg
function ide () {
$results = array();
 
$s = 0;
for ($i = 0, $max = count($this->read_dmesg()); $i < $max; $i++) {
$buf = $this->dmesg[$i];
if (preg_match('/^(.*) at (pciide|wdc|atabus|atapibus)[0-9] (.*): <(.*)>/', $buf, $ar_buf)) {
$s = $ar_buf[1];
$results[$s]['model'] = $ar_buf[4];
$results[$s]['media'] = 'Hard Disk';
// now loop again and find the capacity
for ($j = 0, $max1 = count($this->read_dmesg()); $j < $max1; $j++) {
$buf_n = $this->dmesg[$j];
if (preg_match("/^($s): (.*), (.*), (.*)MB, .*$/", $buf_n, $ar_buf_n)) {
$results[$s]['capacity'] = $ar_buf_n[4] * 2048 * 1.049;
} elseif (preg_match("/^($s): (.*) MB, (.*), (.*), .*$/", $buf_n, $ar_buf_n)) {
$results[$s]['capacity'] = $ar_buf_n[2] * 2048;
}
}
}
}
asort($results);
return $results;
}
 
function distroicon () {
$result = 'NetBSD.png';
return($result);
}
}
 
?>
/web/acc/phpsysinfo/includes/os/class.OS.inc.php
0,0 → 1,172
<?php
/**
* Basic OS Class
*
* PHP version 5
*
* @category PHP
* @package PSI OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.OS.inc.php 699 2012-09-15 11:57:13Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* Basic OS functions for all OS classes
*
* @category PHP
* @package PSI OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
abstract class OS implements PSI_Interface_OS
{
/**
* object for error handling
*
* @var PSI_Error
*/
protected $error;
 
/**
* block name
*
* @var string
*/
protected $blockname = false;
 
/**
* @var System
*/
protected $sys;
 
/**
* build the global Error object
*/
public function __construct($blockname = false)
{
$this->error = PSI_Error::singleton();
$this->sys = new System();
$this->blockname = $blockname;
}
 
/**
* get os specific encoding
*
* @see PSI_Interface_OS::getEncoding()
*
* @return string
*/
public function getEncoding()
{
return PSI_SYSTEM_CODEPAGE;
}
 
/**
* get os specific language
*
* @see PSI_Interface_OS::getLanguage()
*
* @return string
*/
public function getLanguage()
{
return PSI_SYSTEM_LANG;
}
 
/**
* get block name
*
* @see PSI_Interface_OS::getBlockName()
*
* @return string
*/
public function getBlockName()
{
return $this->blockname;
}
 
/**
* Number of Users
*
* @return void
*/
protected function _users()
{
if (CommonFunctions::executeProgram('who', '', $strBuf, PSI_DEBUG)) {
if (strlen($strBuf) > 0) {
$lines = preg_split('/\n/', $strBuf);
$this->sys->setUsers(count($lines));
}
} elseif (CommonFunctions::executeProgram('uptime', '', $buf, PSI_DEBUG) && preg_match("/,\s+(\d+)\s+user[s]?,/", $buf, $ar_buf)) {
//} elseif (CommonFunctions::executeProgram('uptime', '', $buf) && preg_match("/,\s+(\d+)\s+user[s]?,\s+load average[s]?:\s+(.*),\s+(.*),\s+(.*)$/", $buf, $ar_buf)) {
$this->sys->setUsers($ar_buf[1]);
} else {
$processlist = glob('/proc/*/cmdline', GLOB_NOSORT);
if (is_array($processlist) && (($total = count($processlist)) > 0)) {
$count = 0;
$buf = "";
for ($i = 0; $i < $total; $i++) {
if (CommonFunctions::rfts($processlist[$i], $buf, 0, 4096, false)) {
$name = str_replace(chr(0), ' ', trim($buf));
if (preg_match("/^-/", $name)) {
$count++;
}
}
}
if ($count > 0) {
$this->sys->setUsers($count);
}
}
}
}
 
/**
* IP of the Host
*
* @return void
*/
protected function _ip()
{
if (PSI_USE_VHOST === true) {
if ((CommonFunctions::readenv('SERVER_ADDR', $result) || CommonFunctions::readenv('LOCAL_ADDR', $result)) //is server address defined
&& !strstr($result, '.') && strstr($result, ':')) { //is IPv6, quick version of preg_match('/\(([[0-9A-Fa-f\:]+)\)/', $result)
$dnsrec = dns_get_record($this->sys->getHostname(), DNS_AAAA);
if (isset($dnsrec[0]['ipv6'])) { //is DNS IPv6 record
$this->sys->setIp($dnsrec[0]['ipv6']); //from DNS (avoid IPv6 NAT translation)
} else {
$this->sys->setIp(preg_replace('/^::ffff:/i', '', $result)); //from SERVER_ADDR or LOCAL_ADDR
}
} else {
$this->sys->setIp(gethostbyname($this->sys->getHostname())); //IPv4 only
}
} else {
if (CommonFunctions::readenv('SERVER_ADDR', $result) || CommonFunctions::readenv('LOCAL_ADDR', $result)) {
$this->sys->setIp(preg_replace('/^::ffff:/i', '', $result));
} else {
$this->sys->setIp(gethostbyname($this->sys->getHostname()));
}
}
}
 
/**
* get the filled or unfilled (with default values) System object
*
* @see PSI_Interface_OS::getSys()
*
* @return System
*/
final public function getSys()
{
$this->build();
if (!$this->blockname || $this->blockname==='vitals') {
$this->_ip();
}
 
return $this->sys;
}
}
/web/acc/phpsysinfo/includes/os/class.OpenBSD.inc.php
1,110 → 1,229
<?php
<?php
/**
* OpenBSD System Class
*
* PHP version 5
*
* @category PHP
* @package PSI OpenBSD OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.OpenBSD.inc.php 621 2012-07-29 18:49:04Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* OpenBSD sysinfo class
* get all the required information from OpenBSD systems
*
* @category PHP
* @package PSI OpenBSD OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class OpenBSD extends BSDCommon
{
/**
* define the regexp for log parser
*/
public function __construct($blockname = false)
{
parent::__construct($blockname);
// $this->setCPURegExp1("/^cpu(.*) (.*) MHz/");
$this->setCPURegExp2("/(.*),(.*),(.*),(.*),(.*)/");
$this->setSCSIRegExp1("/^(.*) at scsibus.*: <(.*)> .*/");
$this->setSCSIRegExp2("/^(sd[0-9]+): (.*)MB,/");
$this->setPCIRegExp1("/(.*) at pci[0-9]+ .* \"(.*)\"/");
$this->setPCIRegExp2("/\"(.*)\" (.*).* at [.0-9]+ irq/");
}
 
// phpSysInfo - A PHP System Information Script
// http://phpsysinfo.sourceforge.net/
/**
* UpTime
* time the system is running
*
* @return void
*/
private function _uptime()
{
$a = $this->grabkey('kern.boottime');
$this->sys->setUptime(time() - $a);
}
 
// 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.
/**
* get network information
*
* @return void
*/
private function _network()
{
CommonFunctions::executeProgram('netstat', '-nbdi | cut -c1-25,44- | grep Link | grep -v \'* \'', $netstat_b, PSI_DEBUG);
CommonFunctions::executeProgram('netstat', '-ndi | cut -c1-25,44- | grep Link | grep -v \'* \'', $netstat_n, PSI_DEBUG);
$lines_b = preg_split("/\n/", $netstat_b, -1, PREG_SPLIT_NO_EMPTY);
$lines_n = preg_split("/\n/", $netstat_n, -1, PREG_SPLIT_NO_EMPTY);
for ($i = 0, $max = sizeof($lines_b); $i < $max; $i++) {
$ar_buf_b = preg_split("/\s+/", $lines_b[$i]);
$ar_buf_n = preg_split("/\s+/", $lines_n[$i]);
if (!empty($ar_buf_b[0]) && (!empty($ar_buf_n[3]) || ($ar_buf_n[3] === "0"))) {
$dev = new NetDevice();
$dev->setName($ar_buf_b[0]);
$dev->setTxBytes($ar_buf_b[4]);
$dev->setRxBytes($ar_buf_b[3]);
$dev->setErrors($ar_buf_n[4] + $ar_buf_n[6]);
$dev->setDrops($ar_buf_n[8]);
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS) && (CommonFunctions::executeProgram('ifconfig', $ar_buf_b[0].' 2>/dev/null', $bufr2, PSI_DEBUG))) {
$speedinfo = "";
$bufe2 = preg_split("/\n/", $bufr2, -1, PREG_SPLIT_NO_EMPTY);
foreach ($bufe2 as $buf2) {
if (preg_match('/^\s+lladdr\s+(\S+)/i', $buf2, $ar_buf2)) {
if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').preg_replace('/:/', '-', strtoupper($ar_buf2[1])));
} elseif (preg_match('/^\s+inet\s+(\S+)\s+netmask/i', $buf2, $ar_buf2)) {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1]);
} elseif ((preg_match('/^\s+inet6\s+([^\s%]+)\s+prefixlen/i', $buf2, $ar_buf2)
|| preg_match('/^\s+inet6\s+([^\s%]+)%\S+\s+prefixlen/i', $buf2, $ar_buf2))
&& ($ar_buf2[1]!="::") && !preg_match('/^fe80::/i', $ar_buf2[1])) {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').strtolower($ar_buf2[1]));
} elseif (preg_match('/^\s+media:\s+/i', $buf2) && preg_match('/[\(\s](\d+)(G*)base/i', $buf2, $ar_buf2)) {
if (isset($ar_buf2[2]) && strtoupper($ar_buf2[2])=="G") {
$unit = "G";
} else {
$unit = "M";
}
if (preg_match('/\s(\S+)-duplex/i', $buf2, $ar_buf3))
$speedinfo = $ar_buf2[1].$unit.'b/s '.strtolower($ar_buf3[1]);
else
$speedinfo = $ar_buf2[1].$unit.'b/s';
}
}
if ($speedinfo != "") $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$speedinfo);
}
$this->sys->setNetDevices($dev);
}
}
}
 
// 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.
/**
* IDE information
*
* @return void
*/
protected function ide()
{
foreach ($this->readdmesg() as $line) {
if (preg_match('/^(.*) at pciide[0-9]+ (.*): <(.*)>/', $line, $ar_buf)) {
$dev = new HWDevice();
$dev->setName($ar_buf[3]);
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
// now loop again and find the capacity
foreach ($this->readdmesg() as $line2) {
if (preg_match("/^(".$ar_buf[1]."): (.*), (.*), (.*)MB, .*$/", $line2, $ar_buf_n)) {
$dev->setCapacity($ar_buf_n[4] * 1024 * 1024);
break;
}
}
}
$this->sys->setIdeDevices($dev);
}
}
}
 
// 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.
/**
* get CPU information
*
* @return void
*/
protected function cpuinfo()
{
$dev = new CpuDevice();
$dev->setModel($this->grabkey('hw.model'));
$dev->setCpuSpeed($this->grabkey('hw.cpuspeed'));
$was = false;
foreach ($this->readdmesg() as $line) {
if (preg_match("/^cpu[0-9]+: (.*)/", $line, $ar_buf)) {
$was = true;
if (preg_match("/^cpu[0-9]+: (\d+)([KM])B (.*) L2 cache/", $line, $ar_buf2)) {
if ($ar_buf2[2]=="M") {
$dev->setCache($ar_buf2[1]*1024*1024);
} elseif ($ar_buf2[2]=="K") {
$dev->setCache($ar_buf2[1]*1024);
}
} else {
$feats = preg_split("/,/", strtolower(trim($ar_buf[1])), -1, PREG_SPLIT_NO_EMPTY);
foreach ($feats as $feat) {
if (($feat=="vmx") || ($feat=="svm")) {
$dev->setVirt($feat);
}
}
}
} elseif ($was) {
break;
}
}
$ncpu = $this->grabkey('hw.ncpu');
if (is_null($ncpu) || (trim($ncpu) == "") || (!($ncpu >= 1)))
$ncpu = 1;
for ($ncpu ; $ncpu > 0 ; $ncpu--) {
$this->sys->setCpus($dev);
}
}
 
// $Id: class.OpenBSD.inc.php,v 1.21 2006/04/18 17:46:15 bigmichi1 Exp $
if (!defined('IN_PHPSYSINFO')) {
die("No Hacking");
}
/**
* get icon name
*
* @return void
*/
private function _distroicon()
{
$this->sys->setDistributionIcon('OpenBSD.png');
}
 
require_once(APP_ROOT . '/includes/os/class.BSD.common.inc.php');
/**
* Processes
*
* @return void
*/
protected function _processes()
{
if (CommonFunctions::executeProgram('ps', 'aux', $bufr, PSI_DEBUG)) {
$lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
$processes['*'] = 0;
foreach ($lines as $line) {
if (preg_match("/^\S+\s+\d+\s+\S+\s+\S+\s+\d+\s+\d+\s+\S+\s+(\w)/", $line, $ar_buf)) {
$processes['*']++;
$state = $ar_buf[1];
if ($state == 'I') $state = 'S'; //linux format
if (isset($processes[$state])) {
$processes[$state]++;
} else {
$processes[$state] = 1;
}
}
}
if ($processes['*'] > 0) {
$this->sys->setProcesses($processes);
}
}
}
 
class sysinfo extends bsd_common {
var $cpu_regexp = "";
var $scsi_regexp1 = "";
var $scsi_regexp2 = "";
var $cpu_regexp2 = "";
// Our contstructor
// this function is run on the initialization of this class
function sysinfo () {
$this->bsd_common();
$this->cpu_regexp = "^cpu(.*) (.*) MHz";
$this->scsi_regexp1 = "^(.*) at scsibus.*: <(.*)> .*";
$this->scsi_regexp2 = "^(da[0-9]): (.*)MB ";
$this->cpu_regexp2 = "/(.*),(.*),(.*),(.*),(.*)/";
$this->pci_regexp1 = '/(.*) at pci[0-9] .* "(.*)"/';
$this->pci_regexp2 = '/"(.*)" (.*).* at [.0-9]+ irq/';
}
 
function get_sys_ticks () {
$a = $this->grab_key('kern.boottime');
$sys_ticks = time() - $a;
return $sys_ticks;
}
 
function network () {
$netstat_b = execute_program('netstat', '-nbdi | cut -c1-25,44- | grep Link | grep -v \'* \'');
$netstat_n = execute_program('netstat', '-ndi | cut -c1-25,44- | grep Link | grep -v \'* \'');
$lines_b = explode("\n", $netstat_b);
$lines_n = explode("\n", $netstat_n);
$results = array();
for ($i = 0, $max = sizeof($lines_b); $i < $max; $i++) {
$ar_buf_b = preg_split("/\s+/", $lines_b[$i]);
$ar_buf_n = preg_split("/\s+/", $lines_n[$i]);
if (!empty($ar_buf_b[0]) && !empty($ar_buf_n[3])) {
$results[$ar_buf_b[0]] = array();
 
$results[$ar_buf_b[0]]['rx_bytes'] = $ar_buf_b[3];
$results[$ar_buf_b[0]]['rx_packets'] = $ar_buf_n[3];
$results[$ar_buf_b[0]]['rx_errs'] = $ar_buf_n[4];
$results[$ar_buf_b[0]]['rx_drop'] = $ar_buf_n[8];
 
$results[$ar_buf_b[0]]['tx_bytes'] = $ar_buf_b[4];
$results[$ar_buf_b[0]]['tx_packets'] = $ar_buf_n[5];
$results[$ar_buf_b[0]]['tx_errs'] = $ar_buf_n[6];
$results[$ar_buf_b[0]]['tx_drop'] = $ar_buf_n[8];
 
$results[$ar_buf_b[0]]['errs'] = $ar_buf_n[4] + $ar_buf_n[6];
$results[$ar_buf_b[0]]['drop'] = $ar_buf_n[8];
}
}
return $results;
}
// get the ide device information out of dmesg
function ide () {
$results = array();
 
$s = 0;
for ($i = 0, $max = count($this->read_dmesg()); $i < $max; $i++) {
$buf = $this->dmesg[$i];
if (preg_match('/^(.*) at pciide[0-9] (.*): <(.*)>/', $buf, $ar_buf)) {
$s = $ar_buf[1];
$results[$s]['model'] = $ar_buf[3];
$results[$s]['media'] = 'Hard Disk';
// now loop again and find the capacity
for ($j = 0, $max1 = count($this->read_dmesg()); $j < $max1; $j++) {
$buf_n = $this->dmesg[$j];
if (preg_match("/^($s): (.*), (.*), (.*)MB, .*$/", $buf_n, $ar_buf_n)) {
$results[$s]['capacity'] = $ar_buf_n[4] * 2048 * 1.049;;
}
}
}
}
asort($results);
return $results;
}
 
function distroicon () {
$result = 'OpenBSD.png';
return($result);
}
}
 
?>
/**
* get the information
*
* @see BSDCommon::build()
*
* @return Void
*/
public function build()
{
parent::build();
if (!$this->blockname || $this->blockname==='vitals') {
$this->_distroicon();
$this->_uptime();
$this->_processes();
}
if (!$this->blockname || $this->blockname==='network') {
$this->_network();
}
}
}
/web/acc/phpsysinfo/includes/os/class.QNX.inc.php
0,0 → 1,233
<?php
/**
* QNX System Class
*
* PHP version 5
*
* @category PHP
* @package PSI QNX OS class
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
* @copyright 2012 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.QNX.inc.php 687 2012-09-06 20:54:49Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* QNX sysinfo class
* get all the required information from QNX system
*
* @category PHP
* @package PSI QNX OS class
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
* @copyright 2012 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class QNX extends OS
{
/**
* get the cpu information
*
* @return void
*/
protected function _cpuinfo()
{
if (CommonFunctions::executeProgram('pidin', 'info', $buf)
&& preg_match('/^Processor\d+: (.*)/m', $buf)) {
$lines = preg_split("/\n/", $buf, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
if (preg_match('/^Processor\d+: (.+)/', $line, $proc)) {
$dev = new CpuDevice();
$dev->SetModel(trim($proc[1]));
if (preg_match('/(\d+)MHz/', $proc[1], $mhz)) {
$dev->setCpuSpeed($mhz[1]);
}
$this->sys->setCpus($dev);
}
}
}
}
 
/**
* QNX Version
*
* @return void
*/
private function _kernel()
{
if (CommonFunctions::executeProgram('uname', '-rvm', $ret)) {
$this->sys->setKernel($ret);
}
}
 
/**
* Distribution
*
* @return void
*/
protected function _distro()
{
if (CommonFunctions::executeProgram('uname', '-sr', $ret))
$this->sys->setDistribution($ret);
else
$this->sys->setDistribution('QNX');
 
$this->sys->setDistributionIcon('QNX.png');
}
 
/**
* UpTime
* time the system is running
*
* @return void
*/
private function _uptime()
{
 
if (CommonFunctions::executeProgram('pidin', 'info', $buf)
&& preg_match('/^.* BootTime:(.*)/', $buf, $bstart)
&& CommonFunctions::executeProgram('date', '', $bstop)) {
/* default error handler */
if (function_exists('errorHandlerPsi')) {
restore_error_handler();
}
/* fatal errors only */
$old_err_rep = error_reporting();
error_reporting(E_ERROR);
 
$uptime = strtotime($bstop)-strtotime($bstart[1]);
if ($uptime > 0) $this->sys->setUptime($uptime);
 
/* restore error level */
error_reporting($old_err_rep);
/* restore error handler */
if (function_exists('errorHandlerPsi')) {
set_error_handler('errorHandlerPsi');
}
}
}
 
/**
* Number of Users
*
* @return void
*/
protected function _users()
{
$this->sys->setUsers(1);
}
 
/**
* Virtual Host Name
*
* @return void
*/
private function _hostname()
{
if (PSI_USE_VHOST === true) {
if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
} else {
if (CommonFunctions::executeProgram('uname', '-n', $result, PSI_DEBUG)) {
$ip = gethostbyname($result);
if ($ip != $result) {
$this->sys->setHostname(gethostbyaddr($ip));
}
}
}
}
 
/**
* Physical memory information and Swap Space information
*
* @return void
*/
private function _memory()
{
if (CommonFunctions::executeProgram('pidin', 'info', $buf)
&& preg_match('/^.* FreeMem:(\S+)Mb\/(\S+)Mb/', $buf, $memm)) {
$this->sys->setMemTotal(1024*1024*$memm[2]);
$this->sys->setMemFree(1024*1024*$memm[1]);
$this->sys->setMemUsed(1024*1024*($memm[2]-$memm[1]));
}
}
 
/**
* filesystem information
*
* @return void
*/
private function _filesystems()
{
$arrResult = Parser::df("-P 2>/dev/null");
foreach ($arrResult as $dev) {
$this->sys->setDiskDevices($dev);
}
}
 
/**
* network information
*
* @return void
*/
private function _network()
{
if (CommonFunctions::executeProgram('ifconfig', '', $bufr, PSI_DEBUG)) {
$lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
$was = false;
$dev = null;
foreach ($lines as $line) {
if (preg_match("/^([^\s:]+)/", $line, $ar_buf)) {
if ($was) {
$this->sys->setNetDevices($dev);
}
$dev = new NetDevice();
$dev->setName($ar_buf[1]);
$was = true;
} else {
if ($was) {
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) {
if (preg_match('/^\s+address:\s*(\S+)/i', $line, $ar_buf2)) {
if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').preg_replace('/:/', '-', strtoupper($ar_buf2[1])));
} elseif (preg_match('/^\s+inet\s+(\S+)\s+netmask/i', $line, $ar_buf2))
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1]);
 
}
}
}
}
if ($was) {
$this->sys->setNetDevices($dev);
}
}
}
 
/**
* get the information
*
* @return Void
*/
public function build()
{
$this->error->addError("WARN", "The QNX version of phpSysInfo is a work in progress, some things currently don't work");
if (!$this->blockname || $this->blockname==='vitals') {
$this->_distro();
$this->_hostname();
$this->_kernel();
$this->_uptime();
$this->_users();
}
if (!$this->blockname || $this->blockname==='hardware') {
$this->_cpuinfo();
}
if (!$this->blockname || $this->blockname==='network') {
$this->_network();
}
if (!$this->blockname || $this->blockname==='memory') {
$this->_memory();
}
if (!$this->blockname || $this->blockname==='filesystem') {
$this->_filesystems();
}
}
}
/web/acc/phpsysinfo/includes/os/class.SunOS.inc.php
1,240 → 1,483
<?php
<?php
/**
* SunOS System Class
*
* PHP version 5
*
* @category PHP
* @package PSI SunOS OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.SunOS.inc.php 687 2012-09-06 20:54:49Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* SunOS sysinfo class
* get all the required information from SunOS systems
*
* @category PHP
* @package PSI SunOS OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class SunOS extends OS
{
 
// phpSysInfo - A PHP System Information Script
// http://phpsysinfo.sourceforge.net/
/**
* content of prtconf -v
*
* @var array
*/
private $_prtconf = null;
 
// 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.
/**
* Execute prtconf -v and save ass array
*
* @return array
*/
protected function prtconf()
{
if ($this->_prtconf === null) {
$this->_prtconf = array();
if (CommonFunctions::executeProgram('prtconf', '-v', $buf, PSI_DEBUG) && ($buf!="")) {
$blocks = preg_split( '/\n(?= \S)/', $buf, -1, PREG_SPLIT_NO_EMPTY);
if (!empty($blocks) && (count($blocks)>2)) {
array_shift($blocks);
foreach ($blocks as $block) {
if (preg_match('/^ (\S+) /',$block, $ar_buf)) {
$group = trim($ar_buf[1], ',');
$grouparr = array();
$blocks1 = preg_split( '/\n(?= \S)/', $block, -1, PREG_SPLIT_NO_EMPTY);
if (!empty($blocks1) && count($blocks1)) {
array_shift($blocks1);
foreach ($blocks1 as $block1) {
if (!preg_match('/^ name=\'([^\']+)\'/',$block1)
&& preg_match('/^ (\S+) /',$block1, $ar_buf)) {
$device = trim($ar_buf[1], ',');
$devicearr = array();
$blocks2 = preg_split( '/\n(?= \S)/', $block1, -1, PREG_SPLIT_NO_EMPTY);
if (!empty($blocks2) && count($blocks2)) {
array_shift($blocks2);
foreach ($blocks2 as $block2) {
if (!preg_match('/^ name=\'([^\']+)\'/',$block2)
&& preg_match('/^ (\S+) /',$block2, $ar_buf)) {
$subdev = trim($ar_buf[1], ',');
$subdevarr = array();
$blocks3 = preg_split( '/\n(?= \S)/', $block2, -1, PREG_SPLIT_NO_EMPTY);
if (!empty($blocks3) && count($blocks3)) {
array_shift($blocks3);
foreach ($blocks3 as $block3) {
if (preg_match('/^ name=\'([^\']+)\' [\s\S]+ value=\'?([^\']+)\'?/m',$block3, $ar_buf)) {
if ($subdev==='Hardware') {
$subdevarr[$ar_buf[1]] = $ar_buf[2];
$subdevarr['device'] = $device;
}
}
}
if (count($subdevarr)) {
$devicearr = $subdevarr;
}
}
}
}
}
if (count($devicearr)) {
$grouparr[$device][] = $devicearr;
}
}
}
}
if (count($grouparr)) {
$this->_prtconf[$group][] = $grouparr;
}
}
}
}
}
}
 
// 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.
return $this->_prtconf;
}
 
// 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.
/**
* Extract kernel values via kstat() interface
*
* @param string $key key for kstat programm
*
* @return string
*/
private function _kstat($key)
{
if (CommonFunctions::executeProgram('kstat', '-p d '.$key, $m, PSI_DEBUG) && ($m!=="")) {
list($key, $value) = preg_split("/\t/", $m, 2);
 
// $Id: class.SunOS.inc.php,v 1.24 2007/02/18 18:59:54 bigmichi1 Exp $
return trim($value);
} else {
return '';
}
}
 
$error->addError("WARN", "The SunOS version of phpSysInfo is work in progress, some things currently don't work");
/**
* Virtual Host Name
*
* @return void
*/
private function _hostname()
{
if (PSI_USE_VHOST === true) {
if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
} else {
if (CommonFunctions::executeProgram('uname', '-n', $result, PSI_DEBUG)) {
$ip = gethostbyname($result);
if ($ip != $result) {
$this->sys->setHostname(gethostbyaddr($ip));
}
}
}
}
 
class sysinfo {
// Extract kernel values via kstat() interface
function kstat ($key) {
$m = execute_program('kstat', "-p d $key");
list($key, $value) = explode("\t", trim($m), 2);
return $value;
}
/**
* Kernel Version
*
* @return void
*/
private function _kernel()
{
if (CommonFunctions::executeProgram('uname', '-s', $os, PSI_DEBUG) && ($os!="")) {
if (CommonFunctions::executeProgram('uname', '-r', $version, PSI_DEBUG) && ($version!="")) {
$os.=' '.$version;
}
if (CommonFunctions::executeProgram('uname', '-v', $subversion, PSI_DEBUG) && ($subversion!="")) {
$os.=' ('.$subversion.')';
}
if (CommonFunctions::executeProgram('uname', '-i', $platform, PSI_DEBUG) && ($platform!="")) {
$os.=' '.$platform;
}
$this->sys->setKernel($os);
}
}
 
function vhostname () {
if (! ($result = getenv('SERVER_NAME'))) {
$result = 'N.A.';
}
return $result;
}
// get the IP address of our vhost name
function vip_addr () {
return gethostbyname($this->vhostname());
}
// get our canonical hostname
function chostname () {
if ($result = execute_program('uname', '-n')) {
$result = gethostbyaddr(gethostbyname($result));
} else {
$result = 'N.A.';
}
return $result;
}
// get the IP address of our canonical hostname
function ip_addr () {
if (!($result = getenv('SERVER_ADDR'))) {
$result = gethostbyname($this->chostname());
}
return $result;
}
/**
* UpTime
* time the system is running
*
* @return void
*/
private function _uptime()
{
$this->sys->setUptime(time() - $this->_kstat('unix:0:system_misc:boot_time'));
}
 
function kernel () {
$os = execute_program('uname', '-s');
$version = execute_program('uname', '-r');
return $os . ' ' . $version;
}
/**
* Processor Load
* optionally create a loadbar
*
* @return void
*/
private function _loadavg()
{
$load1 = $this->_kstat('unix:0:system_misc:avenrun_1min');
$load5 = $this->_kstat('unix:0:system_misc:avenrun_5min');
$load15 = $this->_kstat('unix:0:system_misc:avenrun_15min');
$this->sys->setLoad(round($load1 / 256, 2).' '.round($load5 / 256, 2).' '.round($load15 / 256, 2));
}
 
function uptime () {
$result = time() - $this->kstat('unix:0:system_misc:boot_time');
/**
* CPU information
*
* @return void
*/
private function _cpuinfo()
{
if (CommonFunctions::executeProgram('kstat', '-p d cpu_info:*:cpu_info*:core_id', $m, PSI_DEBUG) && ($m!=="")) {
$cpuc = count(preg_split('/\n/', $m, -1, PREG_SPLIT_NO_EMPTY));
for ($cpu=0; $cpu < $cpuc; $cpu++) {
$dev = new CpuDevice();
if (($buf = $this->_kstat('cpu_info:'.$cpu.':cpu_info'.$cpu.':current_clock_Hz')) !== "") {
$dev->setCpuSpeed($buf/1000000);
} elseif (($buf = $this->_kstat('cpu_info:'.$cpu.':cpu_info'.$cpu.':clock_MHz')) !== "") {
$dev->setCpuSpeed($buf);
}
if (($buf = $this->_kstat('cpu_info:'.$cpu.':cpu_info'.$cpu.':supported_frequencies_Hz')) !== "") {
$cpuarr = preg_split('/:/', $buf, -1, PREG_SPLIT_NO_EMPTY);
if (($cpuarrc=count($cpuarr))>1) {
$dev->setCpuSpeedMin($cpuarr[0]/1000000);
$dev->setCpuSpeedMax($cpuarr[$cpuarrc-1]/1000000);
}
}
if (($buf =$this->_kstat('cpu_info:'.$cpu.':cpu_info'.$cpu.':brand')) !== "") {
$dev->setModel($buf);
} elseif (($buf =$this->_kstat('cpu_info:'.$cpu.':cpu_info'.$cpu.':cpu_type')) !== "") {
$dev->setModel($buf);
} elseif (CommonFunctions::executeProgram('uname', '-p', $buf, PSI_DEBUG) && ($buf!="")) {
$dev->setModel($buf);
} elseif (CommonFunctions::executeProgram('uname', '-i', $buf, PSI_DEBUG) && ($buf!="")) {
$dev->setModel($buf);
}
$this->sys->setCpus($dev);
}
}
}
 
return $result;
}
/**
* PCI devices
*
* @return void
*/
protected function _pci()
{
$prtconf = $this->prtconf();
if ((count($prtconf)>1) && isset($prtconf['pci'])) {
foreach ($prtconf['pci'] as $prt) {
foreach ($prt as $pci) {
foreach ($pci as $pcidev) {
if (isset($pcidev['device'])) {
$dev = new HWDevice();
if (isset($pcidev['model'])) {
$name = $pcidev['model'];
} else {
$name = $pcidev['device'];
}
if (isset($pcidev['device-name'])) {
$name .= ': '.$pcidev['device-name'];
}
$dev->setName($name);
 
function users () {
$who = explode('=', execute_program('who', '-q'));
$result = $who[1];
return $result;
}
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
if (isset($pcidev['subsystem-name']) && ($pcidev['subsystem-name']!=='unknown subsystem')) {
$dev->setProduct($pcidev['subsystem-name']);
}
if (isset($pcidev['vendor-name'])) {
$dev->setManufacturer($pcidev['vendor-name']);
}
}
 
function loadavg ($bar = false) {
$load1 = $this->kstat('unix:0:system_misc:avenrun_1min');
$load5 = $this->kstat('unix:0:system_misc:avenrun_5min');
$load15 = $this->kstat('unix:0:system_misc:avenrun_15min');
$results['avg'] = array( round($load1/256, 2), round($load5/256, 2), round($load15/256, 2) );
return $results;
}
$this->sys->setPciDevices($dev);
}
}
}
}
}
}
 
function cpu_info () {
$results = array();
$ar_buf = array();
/**
* Network devices
*
* @return void
*/
private function _network()
{
if (CommonFunctions::executeProgram('netstat', '-ni | awk \'(NF ==10){print;}\'', $netstat, PSI_DEBUG)) {
$lines = preg_split("/\n/", $netstat, -1, PREG_SPLIT_NO_EMPTY);
foreach ($lines as $line) {
$ar_buf = preg_split("/\s+/", $line);
if (!empty($ar_buf[0]) && $ar_buf[0] !== 'Name') {
$dev = new NetDevice();
$dev->setName($ar_buf[0]);
$results[$ar_buf[0]]['errs'] = $ar_buf[5] + $ar_buf[7];
if (preg_match('/^(\D+)(\d+)$/', $ar_buf[0], $intf)) {
$prefix = $intf[1].':'.$intf[2].':'.$intf[1].$intf[2].':';
} elseif (preg_match('/^(\D.*)(\d+)$/', $ar_buf[0], $intf)) {
$prefix = $intf[1].':'.$intf[2].':mac:';
} else {
$prefix = "";
}
if ($prefix !== "") {
$cnt = $this->_kstat($prefix.'drop');
if ($cnt > 0) {
$dev->setDrops($cnt);
}
$cnt = $this->_kstat($prefix.'obytes64');
if ($cnt > 0) {
$dev->setTxBytes($cnt);
}
$cnt = $this->_kstat($prefix.'rbytes64');
if ($cnt > 0) {
$dev->setRxBytes($cnt);
}
}
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) {
if (CommonFunctions::executeProgram('ifconfig', $ar_buf[0], $bufr2, PSI_DEBUG) && ($bufr2!=="")) {
$bufe2 = preg_split("/\n/", $bufr2, -1, PREG_SPLIT_NO_EMPTY);
foreach ($bufe2 as $buf2) {
if (preg_match('/^\s+ether\s+(\S+)/i', $buf2, $ar_buf2)) {
if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').preg_replace('/:/', '-', strtoupper($ar_buf2[1])));
} elseif (preg_match('/^\s+inet\s+(\S+)\s+netmask/i', $buf2, $ar_buf2)) {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1]);
}
}
}
if (CommonFunctions::executeProgram('ifconfig', $ar_buf[0].' inet6', $bufr2, PSI_DEBUG) && ($bufr2!=="")) {
$bufe2 = preg_split("/\n/", $bufr2, -1, PREG_SPLIT_NO_EMPTY);
foreach ($bufe2 as $buf2) {
if (preg_match('/^\s+inet6\s+([^\s\/]+)/i', $buf2, $ar_buf2)
&& ($ar_buf2[1]!="::") && !preg_match('/^fe80::/i', $ar_buf2[1]))
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').strtolower($ar_buf2[1]));
}
}
}
 
$results['model'] = execute_program('uname', '-i');
$results['cpuspeed'] = $this->kstat('cpu_info:0:cpu_info0:clock_MHz');
$results['cache'] = $this->kstat('cpu_info:0:cpu_info0:cpu_type');
$results['cpus'] = $this->kstat('unix:0:system_misc:ncpus');
$this->sys->setNetDevices($dev);
}
}
}
}
 
return $results;
}
/**
* Physical memory information and Swap Space information
*
* @return void
*/
private function _memory()
{
$pagesize = $this->_kstat('unix:0:seg_cache:slab_size');
$this->sys->setMemTotal($this->_kstat('unix:0:system_pages:pagestotal') * $pagesize);
$this->sys->setMemUsed($this->_kstat('unix:0:system_pages:pageslocked') * $pagesize);
$this->sys->setMemFree($this->_kstat('unix:0:system_pages:pagesfree') * $pagesize);
$dev = new DiskDevice();
$dev->setName('SWAP');
$dev->setFsType('swap');
$dev->setMountPoint('SWAP');
$dev->setTotal($this->_kstat('unix:0:vminfo:swap_avail') / 1024);
$dev->setUsed($this->_kstat('unix:0:vminfo:swap_alloc') / 1024);
$dev->setFree($this->_kstat('unix:0:vminfo:swap_free') / 1024);
$this->sys->setSwapDevices($dev);
}
 
function pci () {
// FIXME
$results = array();
return $results;
}
/**
* filesystem information
*
* @return void
*/
private function _filesystems()
{
if (CommonFunctions::executeProgram('df', '-k', $df, PSI_DEBUG)) {
$df = preg_replace('/\n\s/m', ' ', $df);
$mounts = preg_split("/\n/", $df, -1, PREG_SPLIT_NO_EMPTY);
foreach ($mounts as $mount) {
$ar_buf = preg_split('/\s+/', $mount, 6);
if (!empty($ar_buf[0]) && $ar_buf[0] !== 'Filesystem') {
$dev = new DiskDevice();
$dev->setName($ar_buf[0]);
$dev->setTotal($ar_buf[1] * 1024);
$dev->setUsed($ar_buf[2] * 1024);
$dev->setFree($ar_buf[3] * 1024);
$dev->setMountPoint($ar_buf[5]);
if (CommonFunctions::executeProgram('df', '-n', $dftypes, PSI_DEBUG)) {
$mounttypes = preg_split("/\n/", $dftypes, -1, PREG_SPLIT_NO_EMPTY);
foreach ($mounttypes as $type) {
$ty_buf = preg_split('/:/', $type, 2);
if (trim($ty_buf[0]) == $dev->getMountPoint()) {
$dev->setFsType($ty_buf[1]);
break;
}
}
} elseif (CommonFunctions::executeProgram('df', '-T', $dftypes, PSI_DEBUG)) {
$dftypes = preg_replace('/\n\s/m', ' ', $dftypes);
$mounttypes = preg_split("/\n/", $dftypes, -1, PREG_SPLIT_NO_EMPTY);
foreach ($mounttypes as $type) {
$ty_buf = preg_split("/\s+/", $type, 3);
if ($ty_buf[0] == $dev->getName()) {
$dev->setFsType($ty_buf[1]);
break;
}
}
}
$this->sys->setDiskDevices($dev);
}
}
}
}
 
function ide () {
// FIXME
$results = array();
return $results;
}
/**
* Distribution Icon
*
* @return void
*/
private function _distro()
{
if (CommonFunctions::rfts('/etc/release', $buf, 1, 4096, false) && (trim($buf)!="")) {
$this->sys->setDistribution(trim($buf));
$list = @parse_ini_file(PSI_APP_ROOT."/data/distros.ini", true);
if ($list && preg_match('/^(\S+)\s*/', preg_replace('/^Open\s+/', 'Open', preg_replace('/^Oracle\s+/', 'Oracle', trim($buf))), $id_buf) && isset($list[$distid=(trim($id_buf[1].' SunOS'))]['Image'])) {
$this->sys->setDistributionIcon($list[$distid]['Image']);
if (isset($list[trim($distid)]['Name'])) {
$this->sys->setDistribution(trim($list[$distid]['Name']).' '.$this->sys->getDistribution());
}
} else {
$this->sys->setDistributionIcon('SunOS.png');
}
} else {
$this->sys->setDistribution('SunOS');
$this->sys->setDistributionIcon('SunOS.png');
}
}
 
function scsi () {
// FIXME
$results = array();
return $results;
}
/**
* Processes
*
* @return void
*/
protected function _processes()
{
if (CommonFunctions::executeProgram('ps', 'aux', $bufr, PSI_DEBUG)) {
$lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
$processes['*'] = 0;
foreach ($lines as $line) {
if (preg_match("/^\S+\s+\d+\s+\S+\s+\S+\s+\d+\s+\d+\s+\S+\s+(\w)/", $line, $ar_buf)) {
$processes['*']++;
$state = $ar_buf[1];
if ($state == 'O') $state = 'R'; //linux format
elseif ($state == 'W') $state = 'D';
elseif ($state == 'D') $state = 'd'; //invalid
if (isset($processes[$state])) {
$processes[$state]++;
} else {
$processes[$state] = 1;
}
}
}
if ($processes['*'] > 0) {
$this->sys->setProcesses($processes);
}
}
}
 
function usb () {
// FIXME
$results = array();
return $results;
}
 
function sbus () {
$results = array();
$_results[0] = "";
// TODO. Nothing here yet. Move along.
$results = $_results;
return $results;
}
 
function network () {
$results = array();
 
$netstat = execute_program('netstat', '-ni | awk \'(NF ==10){print;}\'');
$lines = explode("\n", $netstat);
$results = array();
for ($i = 0, $max = sizeof($lines); $i < $max; $i++) {
$ar_buf = preg_split("/\s+/", $lines[$i]);
if ((!empty($ar_buf[0])) && ($ar_buf[0] != 'Name')) {
$results[$ar_buf[0]] = array();
 
$results[$ar_buf[0]]['rx_bytes'] = 0;
$results[$ar_buf[0]]['rx_packets'] = $ar_buf[4];
$results[$ar_buf[0]]['rx_errs'] = $ar_buf[5];
$results[$ar_buf[0]]['rx_drop'] = 0;
 
$results[$ar_buf[0]]['tx_bytes'] = 0;
$results[$ar_buf[0]]['tx_packets'] = $ar_buf[6];
$results[$ar_buf[0]]['tx_errs'] = $ar_buf[7];
$results[$ar_buf[0]]['tx_drop'] = 0;
 
$results[$ar_buf[0]]['errs'] = $ar_buf[5] + $ar_buf[
7];
$results[$ar_buf[0]]['drop'] = 0;
 
preg_match('/^(\D+)(\d+)$/', $ar_buf[0], $intf);
$prefix = $intf[1] . ':' . $intf[2] . ':' . $intf[1] . $intf[2] . ':';
$cnt = $this->kstat($prefix . 'drop');
 
if ($cnt > 0) {
$results[$ar_buf[0]]['rx_drop'] = $cnt;
}
$cnt = $this->kstat($prefix . 'obytes64');
 
if ($cnt > 0) {
$results[$ar_buf[0]]['tx_bytes'] = $cnt;
}
$cnt = $this->kstat($prefix . 'rbytes64');
 
if ($cnt > 0) {
$results[$ar_buf[0]]['rx_bytes'] = $cnt;
/**
* get the information
*
* @see PSI_Interface_OS::build()
*
* @return Void
*/
public function build()
{
$this->error->addError("WARN", "The SunOS version of phpSysInfo is a work in progress, some things currently don't work");
if (!$this->blockname || $this->blockname==='vitals') {
$this->_distro();
$this->_hostname();
$this->_kernel();
$this->_uptime();
$this->_users();
$this->_loadavg();
$this->_processes();
}
}
}
return $results;
}
 
function memory () {
$results['devswap'] = array();
 
$results['ram'] = array();
 
$pagesize = $this->kstat('unix:0:seg_cache:slab_size');
$results['ram']['total'] = $this->kstat('unix:0:system_pages:pagestotal') * $pagesize / 1024;
$results['ram']['used'] = $this->kstat('unix:0:system_pages:pageslocked') * $pagesize / 1024;
$results['ram']['free'] = $this->kstat('unix:0:system_pages:pagesfree') * $pagesize / 1024;
$results['ram']['shared'] = 0;
$results['ram']['buffers'] = 0;
$results['ram']['cached'] = 0;
 
$results['ram']['percent'] = round(($results['ram']['used'] * 100) / $results['ram']['total']);
 
$results['swap'] = array();
$results['swap']['total'] = $this->kstat('unix:0:vminfo:swap_avail') / 1024 / 1024;
$results['swap']['used'] = $this->kstat('unix:0:vminfo:swap_alloc') / 1024 / 1024;
$results['swap']['free'] = $this->kstat('unix:0:vminfo:swap_free') / 1024 / 1024;
$results['swap']['percent'] = round(($ar_buf[1] * 100) / $ar_buf[0]);
$results['swap']['percent'] = round(($results['swap']['used'] * 100) / $results['swap']['total']);
return $results;
}
 
function filesystems () {
$df = execute_program('df', '-k');
$mounts = explode("\n", $df);
 
$dftypes = execute_program('df', '-n');
$mounttypes = explode("\n", $dftypes);
 
for ($i = 1, $j = 0, $max = sizeof($mounts); $i < $max; $i++) {
$ar_buf = preg_split('/\s+/', $mounts[$i], 6);
$ty_buf = explode(':', $mounttypes[$i-1], 2);
 
if (hide_mount($ar_buf[5])) {
continue;
}
 
$results[$j] = array();
 
$results[$j]['disk'] = $ar_buf[0];
$results[$j]['size'] = $ar_buf[1];
$results[$j]['used'] = $ar_buf[2];
$results[$j]['free'] = $ar_buf[3];
$results[$j]['percent'] = round(($results[$j]['used'] * 100) / $results[$j]['size']);
$results[$j]['mount'] = $ar_buf[5];
$results[$j]['fstype'] = $ty_buf[1];
$j++;
}
return $results;
}
function distro () {
$result = 'SunOS';
return($result);
}
 
function distroicon () {
$result = 'SunOS.png';
return($result);
}
}
 
?>
if (!$this->blockname || $this->blockname==='hardware') {
$this->_cpuinfo();
$this->_pci();
}
if (!$this->blockname || $this->blockname==='network') {
$this->_network();
}
if (!$this->blockname || $this->blockname==='memory') {
$this->_memory();
}
if (!$this->blockname || $this->blockname==='filesystem') {
$this->_filesystems();
}
}
}
/web/acc/phpsysinfo/includes/os/class.WINNT.inc.php
1,344 → 1,1015
<?php
// 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.
// WINNT implementation written by Carl C. Longnecker, longneck@iname.com
// $Id: class.WINNT.inc.php,v 1.25 2007/03/07 20:21:27 bigmichi1 Exp $
<?php
/**
* WINNT System Class
*
* PHP version 5
*
* @category PHP
* @package PSI WINNT OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.WINNT.inc.php 699 2012-09-15 11:57:13Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* WINNT sysinfo class
* get all the required information from WINNT systems
* information are retrieved through the WMI interface
*
* @category PHP
* @package PSI WINNT OS class
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class WINNT extends OS
{
/**
* holds the data from WMI Win32_OperatingSystem
*
* @var array
*/
private $_Win32_OperatingSystem = null;
 
class sysinfo {
// $wmi holds the COM object that we pull all the WMI data from
var $wmi;
/**
* holds the data from WMI Win32_ComputerSystem
*
* @var array
*/
private $_Win32_ComputerSystem = null;
 
// $wmidevices holds all devices, which are in the system
var $wmidevices;
/**
* holds the data from WMI Win32_Processor
*
* @var array
*/
private $_Win32_Processor = null;
 
// this constructor initialis the $wmi object
function sysinfo ()
{
// don't set this params for local connection, it will not work
$strHostname = '';
$strUser = '';
$strPassword = '';
/**
* holds the data from WMI Win32_PerfFormattedData_PerfOS_Processor
*
* @var array
*/
private $_Win32_PerfFormattedData_PerfOS_Processor = null;
 
// initialize the wmi object
$objLocator = new COM("WbemScripting.SWbemLocator");
if($strHostname == "") {
$this->wmi = $objLocator->ConnectServer();
} else{
$this->wmi = $objLocator->ConnectServer($strHostname, "rootcimv2", "$strHostname\$strUser", $strPassword);
}
}
/**
* holds the data from systeminfo command
*
* @var string
*/
private $_systeminfo = null;
 
// private function for getting a list of values in the specified context, optionally filter this list, based on the list from second parameter
function _GetWMI($strClass, $strValue = array() ) {
$objWEBM = $this->wmi->Get($strClass);
/**
* holds the COM object that we pull all the WMI data from
*
* @var Object
*/
private $_wmi = null;
 
if( PHP_VERSION < 5 ) {
$objProp = $objWEBM->Properties_;
$arrProp = $objProp->Next($objProp->Count);
$objWEBMCol = $objWEBM->Instances_();
$arrWEBMCol = $objWEBMCol->Next($objWEBMCol->Count);
} else {
$arrProp = $objWEBM->Properties_;
$arrWEBMCol = $objWEBM->Instances_();
/**
* holds the COM object that we pull all the RegRead data from
*
* @var Object
*/
private $_reg = null;
 
/**
* holds the COM object that we pull all the EnumKey data from
*
* @var Object
*/
private $_key = null;
 
/**
* holds all devices, which are in the system
*
* @var array
*/
private $_wmidevices;
 
/**
* holds all disks, which are in the system
*
* @var array
*/
private $_wmidisks;
 
/**
* store language encoding of the system to convert some output to utf-8
*
* @var string
*/
private $_codepage = null;
 
/**
* store language of the system
*
* @var string
*/
private $_syslang = null;
 
/**
* reads the data from WMI Win32_OperatingSystem
*
* @return array
*/
private function _get_Win32_OperatingSystem()
{
if ($this->_Win32_OperatingSystem === null) $this->_Win32_OperatingSystem = CommonFunctions::getWMI($this->_wmi, 'Win32_OperatingSystem', array('CodeSet', 'Locale', 'LastBootUpTime', 'LocalDateTime', 'Version', 'ServicePackMajorVersion', 'Caption', 'OSArchitecture', 'TotalVisibleMemorySize', 'FreePhysicalMemory'));
return $this->_Win32_OperatingSystem;
}
 
foreach($arrWEBMCol as $objItem)
/**
* reads the data from WMI Win32_ComputerSystem
*
* @return array
*/
private function _get_Win32_ComputerSystem()
{
@reset($arrProp);
$arrInstance = array();
foreach($arrProp as $propItem)
{
eval("\$value = \$objItem->" .$propItem->Name .";");
if( empty( $strValue ) ) {
$arrInstance[$propItem->Name] = trim($value);
} else {
if( in_array( $propItem->Name, $strValue ) ) {
$arrInstance[$propItem->Name] = trim($value);
}
if ($this->_Win32_ComputerSystem === null) $this->_Win32_ComputerSystem = CommonFunctions::getWMI($this->_wmi, 'Win32_ComputerSystem', array('Name', 'Manufacturer', 'Model'));
return $this->_Win32_ComputerSystem;
}
 
/**
* reads the data from WMI Win32_Processor
*
* @return array
*/
private function _get_Win32_Processor()
{
if ($this->_Win32_Processor === null) $this->_Win32_Processor = CommonFunctions::getWMI($this->_wmi, 'Win32_Processor', array('LoadPercentage', 'AddressWidth', 'Name', 'L2CacheSize', 'L3CacheSize', 'CurrentClockSpeed', 'ExtClock', 'NumberOfCores', 'NumberOfLogicalProcessors', 'MaxClockSpeed', 'Manufacturer'));
return $this->_Win32_Processor;
}
 
/**
* reads the data from WMI Win32_PerfFormattedData_PerfOS_Processor
*
* @return array
*/
private function _get_Win32_PerfFormattedData_PerfOS_Processor()
{
if ($this->_Win32_PerfFormattedData_PerfOS_Processor === null) {
$this->_Win32_PerfFormattedData_PerfOS_Processor = array();
$buffer = $this->_get_Win32_OperatingSystem();
if ($buffer && isset($buffer[0]) && isset($buffer[0]['Version']) && version_compare($buffer[0]['Version'], "5.1", ">=")) { // minimal windows 2003 or windows XP
$cpubuffer = CommonFunctions::getWMI($this->_wmi, 'Win32_PerfFormattedData_PerfOS_Processor', array('Name', 'PercentProcessorTime'));
if ($cpubuffer) foreach ($cpubuffer as $cpu) {
if (isset($cpu['Name']) && isset($cpu['PercentProcessorTime'])) {
$this->_Win32_PerfFormattedData_PerfOS_Processor['cpu'.$cpu['Name']] = $cpu['PercentProcessorTime'];
}
}
}
}
$arrData[] = $arrInstance;
}
return $arrData;
}
 
// private function for getting different device types from the system
function _devicelist ( $strType ) {
if( empty( $this->wmidevices ) ) {
$this->wmidevices = $this->_GetWMI( "Win32_PnPEntity", array( "Name", "PNPDeviceID" ) );
return $this->_Win32_PerfFormattedData_PerfOS_Processor;
}
 
$list = array();
foreach ( $this->wmidevices as $device ) {
if ( substr( $device["PNPDeviceID"], 0, strpos( $device["PNPDeviceID"], "\\" ) + 1 ) == ( $strType . "\\" ) ) {
$list[] = $device["Name"];
}
/**
* reads the data from systeminfo
*
* @return string
*/
private function _get_systeminfo()
{
if ($this->_systeminfo === null) CommonFunctions::executeProgram('systeminfo', '', $this->_systeminfo, false);
return $this->_systeminfo;
}
 
return $list;
}
// get our apache SERVER_NAME or vhost
function vhostname () {
if (! ($result = getenv('SERVER_NAME'))) {
$result = 'N.A.';
}
return $result;
}
/**
* build the global Error object and create the WMI connection
*/
public function __construct($blockname = false)
{
parent::__construct($blockname);
try {
// initialize the wmi object
$objLocator = new COM('WbemScripting.SWbemLocator');
$this->_wmi = $objLocator->ConnectServer('', 'root\CIMv2');
} catch (Exception $e) {
$this->error->addError("WMI connect error", "PhpSysInfo can not connect to the WMI interface for security reasons.\nCheck an authentication mechanism for the directory where phpSysInfo is installed.");
}
try {
// initialize the RegRead object
$this->_reg = new COM("WScript.Shell");
} catch (Exception $e) {
//$this->error->addError("Windows Scripting Host error", "PhpSysInfo can not initialize Windows Scripting Host for security reasons.\nCheck an authentication mechanism for the directory where phpSysInfo is installed.");
$this->_reg = false;
}
try {
// initialize the EnumKey object
$this->_key = new COM("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\default:StdRegProv");
} catch (Exception $e) {
//$this->error->addError("WWinmgmts Impersonationlevel Script Error", "PhpSysInfo can not initialize Winmgmts Impersonationlevel Script for security reasons.\nCheck an authentication mechanism for the directory where phpSysInfo is installed.");
$this->_key = false;
}
 
// get the IP address of our vhost name
function vip_addr () {
return gethostbyname($this->vhostname());
}
$this->_getCodeSet();
}
 
// get our canonical hostname
function chostname ()
{
$buffer = $this->_GetWMI( "Win32_ComputerSystem", array( "Name" ) );
$result = $buffer[0]["Name"];
return gethostbyaddr(gethostbyname($result));
}
/**
* store the codepage of the os for converting some strings to utf-8
*
* @return void
*/
private function _getCodeSet()
{
$buffer = $this->_get_Win32_OperatingSystem();
if (!$buffer) {
if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage\\ACP", $strBuf, false)) {
$buffer[0]['CodeSet'] = $strBuf;
}
if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Nls\\Language\\Default", $strBuf, false)) {
$buffer[0]['Locale'] = $strBuf;
}
}
if ($buffer && isset($buffer[0])) {
if (isset($buffer[0]['CodeSet'])) {
$codeset = $buffer[0]['CodeSet'];
if ($codeset == 932) {
$codename = ' (SJIS)';
} elseif ($codeset == 949) {
$codename = ' (EUC-KR)';
} elseif ($codeset == 950) {
$codename = ' (BIG-5)';
} else {
$codename = '';
}
CommonFunctions::setcp($codeset);
$this->_codepage = 'windows-'.$codeset.$codename;
}
if (isset($buffer[0]['Locale']) && (($locale = hexdec($buffer[0]['Locale']))>0)) {
$lang = "";
if (is_readable(PSI_APP_ROOT.'/data/languages.ini') && ($langdata = @parse_ini_file(PSI_APP_ROOT.'/data/languages.ini', true))) {
if (isset($langdata['WINNT'][$locale])) {
$lang = $langdata['WINNT'][$locale];
}
}
if ($lang == "") {
$lang = 'Unknown';
}
$this->_syslang = $lang.' ('.$locale.')';
}
}
}
 
// get the IP address of our canonical hostname
function ip_addr ()
{
$buffer = $this->_GetWMI( "Win32_ComputerSystem", array( "Name" ) );
$result = $buffer[0]["Name"];
return gethostbyname($result);
}
/**
* retrieve different device types from the system based on selector
*
* @param string $strType type of the devices that should be returned
*
* @return array list of devices of the specified type
*/
private function _devicelist($strType)
{
if (empty($this->_wmidevices)) {
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
$this->_wmidevices = CommonFunctions::getWMI($this->_wmi, 'Win32_PnPEntity', array('Name', 'PNPDeviceID', 'Manufacturer', 'PNPClass'));
if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
$this->_wmidisks = CommonFunctions::getWMI($this->_wmi, 'Win32_DiskDrive', array('PNPDeviceID', 'Size', 'SerialNumber'));
} else {
$this->_wmidisks = CommonFunctions::getWMI($this->_wmi, 'Win32_DiskDrive', array('PNPDeviceID', 'Size'));
}
} else {
$this->_wmidevices = CommonFunctions::getWMI($this->_wmi, 'Win32_PnPEntity', array('Name', 'PNPDeviceID'));
$this->_wmidisks = array();
}
}
$list = array();
foreach ($this->_wmidevices as $device) {
if (substr($device['PNPDeviceID'], 0, strpos($device['PNPDeviceID'], "\\") + 1) == ($strType."\\")) {
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
if (!isset($device['PNPClass']) || ($device['PNPClass']===$strType) || ($device['PNPClass']==='System')) {
$device['PNPClass'] = null;
}
if (preg_match('/^\(.*\)$/', $device['Manufacturer'])) {
$device['Manufacturer'] = null;
}
$device['Capacity'] = null;
if (($strType==='IDE')||($strType==='SCSI')) {
foreach ($this->_wmidisks as $disk) {
if (($disk['PNPDeviceID'] === $device['PNPDeviceID']) && isset($disk['Size'])) {
$device['Capacity'] = $disk['Size'];
break;
}
}
}
$device['Serial'] = null;
if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
if ($strType==='USB') {
if (preg_match('/\\\\(\w+)$/', $device['PNPDeviceID'], $buf)) {
$device['Serial'] = $buf[1];
}
} elseif (($strType==='IDE')||($strType==='SCSI')) {
foreach ($this->_wmidisks as $disk) {
if (($disk['PNPDeviceID'] === $device['PNPDeviceID']) && isset($disk['SerialNumber'])) {
$device['Serial'] = $disk['SerialNumber'];
break;
}
}
}
}
$list[] = array('Name'=>$device['Name'], 'Manufacturer'=>$device['Manufacturer'], 'Product'=>$device['PNPClass'], 'Capacity'=>$device['Capacity'], 'Serial'=>$device['Serial']);
} else {
$list[] = array('Name'=>$device['Name']);
}
}
}
 
function kernel ()
{
$buffer = $this->_GetWMI( "Win32_OperatingSystem", array( "Version", "ServicePackMajorVersion" ) );
$result = $buffer[0]["Version"];
if( $buffer[0]["ServicePackMajorVersion"] > 0 ) {
$result .= " SP" . $buffer[0]["ServicePackMajorVersion"];
return $list;
}
return $result;
}
 
// get the time the system is running
function uptime ()
{
$result = 0;
$buffer = $this->_GetWMI( "Win32_OperatingSystem", array( "LastBootUpTime", "LocalDateTime" ) );
/**
* Host Name
*
* @return void
*/
private function _hostname()
{
if (PSI_USE_VHOST === true) {
if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
} else {
$buffer = $this->_get_Win32_ComputerSystem();
if (!$buffer && CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ActiveComputerName\\ComputerName", $strBuf, false) && (strlen($strBuf) > 0)) {
$buffer[0]['Name'] = $strBuf;
}
if ($buffer) {
$result = $buffer[0]['Name'];
$ip = gethostbyname($result);
if ($ip != $result) {
if ((version_compare("10.0.0.0", $ip, "<=") && version_compare($ip, "10.255.255.255", "<=")) ||
(version_compare("172.16.0.0", $ip, "<=") && version_compare($ip, "172.31.255.255", "<=")) ||
(version_compare("192.168.0.0", $ip, "<=") && version_compare($ip, "192.168.255.255", "<=")) ||
(version_compare("127.0.0.0", $ip, "<=") && version_compare($ip, "127.255.255.255", "<=")) ||
(version_compare("169.254.1.0", $ip, "<=") && version_compare($ip, "169.254.254.255", "<=")) ||
(version_compare("255.255.255.255", $ip, "=="))) {
$this->sys->setHostname($result); // internal ip
} else {
$this->sys->setHostname(gethostbyaddr($ip));
}
}
} else {
if (CommonFunctions::readenv('COMPUTERNAME', $hnm)) $this->sys->setHostname($hnm);
}
}
}
 
$byear = intval(substr($buffer[0]["LastBootUpTime"], 0, 4));
$bmonth = intval(substr($buffer[0]["LastBootUpTime"], 4, 2));
$bday = intval(substr($buffer[0]["LastBootUpTime"], 6, 2));
$bhour = intval(substr($buffer[0]["LastBootUpTime"], 8, 2));
$bminute = intval(substr($buffer[0]["LastBootUpTime"], 10, 2));
$bseconds = intval(substr($buffer[0]["LastBootUpTime"], 12, 2));
/**
* UpTime
* time the system is running
*
* @return void
*/
private function _uptime()
{
$result = 0;
date_default_timezone_set('UTC');
$buffer = $this->_get_Win32_OperatingSystem();
if ($buffer && ($buffer[0]['LastBootUpTime'] !== null)) {
$local = $buffer[0]['LocalDateTime'];
$boot = $buffer[0]['LastBootUpTime'];
 
$lyear = intval(substr($buffer[0]["LocalDateTime"], 0, 4));
$lmonth = intval(substr($buffer[0]["LocalDateTime"], 4, 2));
$lday = intval(substr($buffer[0]["LocalDateTime"], 6, 2));
$lhour = intval(substr($buffer[0]["LocalDateTime"], 8, 2));
$lminute = intval(substr($buffer[0]["LocalDateTime"], 10, 2));
$lseconds = intval(substr($buffer[0]["LocalDateTime"], 12, 2));
$lyear = intval(substr($local, 0, 4));
$lmonth = intval(substr($local, 4, 2));
$lday = intval(substr($local, 6, 2));
$lhour = intval(substr($local, 8, 2));
$lminute = intval(substr($local, 10, 2));
$lseconds = intval(substr($local, 12, 2));
$loffset = intval(substr($boot, 21, 4));
 
$boottime = mktime($bhour, $bminute, $bseconds, $bmonth, $bday, $byear);
$localtime = mktime($lhour, $lminute, $lseconds, $lmonth, $lday, $lyear);
$byear = intval(substr($boot, 0, 4));
$bmonth = intval(substr($boot, 4, 2));
$bday = intval(substr($boot, 6, 2));
$bhour = intval(substr($boot, 8, 2));
$bminute = intval(substr($boot, 10, 2));
$bseconds = intval(substr($boot, 12, 2));
$boffset = intval(substr($boot, 21, 4));
 
$result = $localtime - $boottime;
if (version_compare($buffer[0]['Version'], "5.1", "<")) { // fix LastBootUpTime on Windows 2000 and older
$boffset += $boffset;
}
 
return $result;
}
$localtime = mktime($lhour, $lminute, $lseconds, $lmonth, $lday, $lyear) - $loffset*60;
$boottime = mktime($bhour, $bminute, $bseconds, $bmonth, $bday, $byear) - $boffset*60;
 
// count the users, which are logged in
function users ()
{
if( stristr( $this->kernel(), "2000 P" ) ) return "N.A.";
$buffer = $this->_GetWMI( "Win32_PerfRawData_TermService_TerminalServices", array( "TotalSessions" ) );
return $buffer[0]["TotalSessions"];
}
$result = $localtime - $boottime;
 
// get the load of the processors
function loadavg ($bar = false)
{
$buffer = $this->_GetWMI( "Win32_Processor", array( "LoadPercentage" ) );
$cpuload = array();
for( $i = 0; $i < count( $buffer ); $i++ ) {
$cpuload['avg'][] = $buffer[$i]["LoadPercentage"];
$this->sys->setUptime($result);
} elseif (($this->sys->getDistribution()=="ReactOS") && CommonFunctions::executeProgram('uptime', '', $strBuf, false) && (strlen($strBuf) > 0) && preg_match("/^System Up Time:\s+(\d+) days, (\d+) Hours, (\d+) Minutes, (\d+) Seconds/", $strBuf, $ar_buf)) {
$sec = $ar_buf[4];
$min = $ar_buf[3];
$hours = $ar_buf[2];
$days = $ar_buf[1];
$this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60 + $sec);
}
}
if ($bar) {
$cpuload['cpupercent'] = array_sum( $cpuload['avg'] ) / count( $buffer );
 
/**
* Number of Users
*
* @return void
*/
protected function _users()
{
if (CommonFunctions::executeProgram('quser', '', $strBuf, false) && (strlen($strBuf) > 0)) {
$lines = preg_split('/\n/', $strBuf);
$users = count($lines)-1;
} else {
$users = 0;
$buffer = CommonFunctions::getWMI($this->_wmi, 'Win32_Process', array('Caption'));
foreach ($buffer as $process) {
if (strtoupper($process['Caption']) == strtoupper('explorer.exe')) {
$users++;
}
}
}
$this->sys->setUsers($users);
}
return $cpuload;
}
 
// get some informations about the cpu's
function cpu_info ()
{
$buffer = $this->_GetWMI( "Win32_Processor", array( "Name", "L2CacheSize", "CurrentClockSpeed", "ExtClock" ) );
$results["cpus"] = 0;
foreach ($buffer as $cpu) {
$results["cpus"]++;
$results["model"] = $cpu["Name"];
$results["cache"] = $cpu["L2CacheSize"];
$results["cpuspeed"] = $cpu["CurrentClockSpeed"];
$results["busspeed"] = $cpu["ExtClock"];
}
return $results;
}
/**
* Distribution
*
* @return void
*/
private function _distro()
{
$buffer = $this->_get_Win32_OperatingSystem();
if ($buffer) {
$ver = $buffer[0]['Version'];
$kernel = $ver;
if ($buffer[0]['ServicePackMajorVersion'] > 0) {
$kernel .= ' SP'.$buffer[0]['ServicePackMajorVersion'];
}
if (isset($buffer[0]['OSArchitecture']) && preg_match("/^(\d+)/", $buffer[0]['OSArchitecture'], $bits)) {
$this->sys->setKernel($kernel.' ('.$bits[1].'-bit)');
} elseif (($allCpus = $this->_get_Win32_Processor()) && isset($allCpus[0]['AddressWidth'])) {
$this->sys->setKernel($kernel.' ('.$allCpus[0]['AddressWidth'].'-bit)');
} else {
$this->sys->setKernel($kernel);
}
$this->sys->setDistribution($buffer[0]['Caption']);
 
// get the pci devices from the system
function pci ()
{
$pci = $this->_devicelist( "PCI" );
return $pci;
}
if (version_compare($ver, "5.1", "<"))
$icon = 'Win2000.png';
elseif (version_compare($ver, "5.1", ">=") && version_compare($ver, "6.0", "<"))
$icon = 'WinXP.png';
elseif (version_compare($ver, "6.0", ">=") && version_compare($ver, "6.2", "<"))
$icon = 'WinVista.png';
else
$icon = 'Win8.png';
$this->sys->setDistributionIcon($icon);
} elseif (CommonFunctions::executeProgram('cmd', '/c ver 2>nul', $ver_value, false)) {
if (preg_match("/ReactOS\r?\nVersion\s+(.+)/", $ver_value, $ar_temp)) {
$this->sys->setDistribution("ReactOS");
$this->sys->setKernel($ar_temp[1]);
$this->sys->setDistributionIcon('ReactOS.png');
$this->_wmi = false; // No WMI info on ReactOS yet
} elseif (preg_match("/^(Microsoft [^\[]*)\s*\[\D*\s*(.+)\]/", $ver_value, $ar_temp)) {
if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProductName", $strBuf, false) && (strlen($strBuf) > 0)) {
if (preg_match("/^Microsoft /", $strBuf)) {
$this->sys->setDistribution($strBuf);
} else {
$this->sys->setDistribution("Microsoft ".$strBuf);
}
} else {
$this->sys->setDistribution($ar_temp[1]);
}
$kernel = $ar_temp[2];
$this->sys->setKernel($kernel);
if ((($kernel[1] == '.') && ($kernel[0] <5)) || (substr($kernel, 0, 4) == '5.0.'))
$icon = 'Win2000.png';
elseif ((substr($kernel, 0, 4) == '6.0.') || (substr($kernel, 0, 4) == '6.1.'))
$icon = 'WinVista.png';
elseif ((substr($kernel, 0, 4) == '6.2.') || (substr($kernel, 0, 4) == '6.3.') || (substr($kernel, 0, 4) == '6.4.') || (substr($kernel, 0, 5) == '10.0.'))
$icon = 'Win8.png';
else
$icon = 'WinXP.png';
$this->sys->setDistributionIcon($icon);
} else {
$this->sys->setDistribution("WinNT");
$this->sys->setDistributionIcon('Win2000.png');
}
} else {
$this->sys->setDistribution("WinNT");
$this->sys->setDistributionIcon('Win2000.png');
}
}
 
// get the ide devices from the system
function ide ()
{
$buffer = $this->_devicelist( "IDE" );
$ide = array();
foreach ( $buffer as $device ) {
$ide[]['model'] = $device;
}
return $ide;
}
/**
* Processor Load
* optionally create a loadbar
*
* @return void
*/
private function _loadavg()
{
if (($cpubuffer = $this->_get_Win32_PerfFormattedData_PerfOS_Processor()) && isset($cpubuffer['cpu_Total'])) {
$this->sys->setLoad($cpubuffer['cpu_Total']);
if (PSI_LOAD_BAR) {
$this->sys->setLoadPercent($cpubuffer['cpu_Total']);
}
} elseif ($buffer = $this->_get_Win32_Processor()) {
$loadok = true;
$sum = 0;
foreach ($buffer as $load) {
$value = $load['LoadPercentage'];
if ($value !== null) {
$sum += $value;
} else {
$loadok = false;
break;
}
}
if ($loadok) {
$percent = $sum / count($buffer);
$this->sys->setLoad($percent);
if (PSI_LOAD_BAR) {
$this->sys->setLoadPercent($percent);
}
}
}
}
 
// get the scsi devices from the system
function scsi ()
{
$scsi = $this->_devicelist( "SCSI" );
return $scsi;
}
/**
* CPU information
*
* @return void
*/
private function _cpuinfo()
{
$allCpus = $this->_get_Win32_Processor();
if (!$allCpus) {
$hkey = "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor";
if (CommonFunctions::enumKey($this->_key, $hkey, $arrBuf, false)) {
foreach ($arrBuf as $coreCount) {
if (CommonFunctions::readReg($this->_reg, $hkey."\\".$coreCount."\\ProcessorNameString", $strBuf, false)) {
$allCpus[$coreCount]['Name'] = $strBuf;
}
if (CommonFunctions::readReg($this->_reg, $hkey."\\".$coreCount."\\~MHz", $strBuf, false)) {
if (preg_match("/^0x([0-9a-f]+)$/i", $strBuf, $hexvalue)) {
$allCpus[$coreCount]['CurrentClockSpeed'] = hexdec($hexvalue[1]);
}
}
if (CommonFunctions::readReg($this->_reg, $hkey."\\".$coreCount."\\VendorIdentifier", $strBuf, false)) {
$allCpus[$coreCount]['Manufacturer'] = $strBuf;
}
}
}
}
 
// get the usb devices from the system
function usb ()
{
$usb = $this->_devicelist( "USB" );
return $usb;
}
$globalcpus = 0;
foreach ($allCpus as $oneCpu) {
$cpuCount = 1;
if (isset($oneCpu['NumberOfLogicalProcessors'])) {
$cpuCount = $oneCpu['NumberOfLogicalProcessors'];
} elseif (isset($oneCpu['NumberOfCores'])) {
$cpuCount = $oneCpu['NumberOfCores'];
}
$globalcpus+=$cpuCount;
}
 
// get the sbus devices from the system - currently not called
function sbus ()
{
$sbus = $this->_devicelist( "SBUS" );
return $sbus;
}
foreach ($allCpus as $oneCpu) {
$cpuCount = 1;
if (isset($oneCpu['NumberOfLogicalProcessors'])) {
$cpuCount = $oneCpu['NumberOfLogicalProcessors'];
} elseif (isset($oneCpu['NumberOfCores'])) {
$cpuCount = $oneCpu['NumberOfCores'];
}
for ($i = 0; $i < $cpuCount; $i++) {
$cpu = new CpuDevice();
if (isset($oneCpu['Name'])) $cpu->setModel($oneCpu['Name']);
if (isset($oneCpu['L3CacheSize']) && ($oneCpu['L3CacheSize'] > 0)) {
$cpu->setCache($oneCpu['L3CacheSize'] * 1024);
} elseif (isset($oneCpu['L2CacheSize'])) {
$cpu->setCache($oneCpu['L2CacheSize'] * 1024);
}
if (isset($oneCpu['CurrentClockSpeed'])) {
$cpu->setCpuSpeed($oneCpu['CurrentClockSpeed']);
if (isset($oneCpu['MaxClockSpeed']) && ($oneCpu['CurrentClockSpeed'] < $oneCpu['MaxClockSpeed'])) $cpu->setCpuSpeedMax($oneCpu['MaxClockSpeed']);
}
if (isset($oneCpu['ExtClock'])) $cpu->setBusSpeed($oneCpu['ExtClock']);
if (isset($oneCpu['Manufacturer'])) $cpu->setVendorId($oneCpu['Manufacturer']);
if (PSI_LOAD_BAR) {
if (($cpubuffer = $this->_get_Win32_PerfFormattedData_PerfOS_Processor()) && (count($cpubuffer) == ($globalcpus+1)) && isset($cpubuffer['cpu'.$i])) {
$cpu->setLoad($cpubuffer['cpu'.$i]);
} elseif ((count($allCpus) == $globalcpus) && isset($oneCpu['LoadPercentage'])) {
$cpu->setLoad($oneCpu['LoadPercentage']);
}
}
$this->sys->setCpus($cpu);
}
}
}
 
// get the netowrk devices and rx/tx bytes
function network () {
$results = array();
$buffer = $this->_GetWMI( "Win32_PerfRawData_Tcpip_NetworkInterface" );
foreach( $buffer as $device ) {
$dev_name = $device["Name"];
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_perfrawdata_tcpip_networkinterface.asp
// there is a possible bug in the wmi interfaceabout uint32 and uint64: http://www.ureader.com/message/1244948.aspx, so that
// magative numbers would occour, try to calculate the nagative value from total - positive number
if( $device["BytesSentPersec"] < 0) {
$results[$dev_name]['tx_bytes'] = $device["BytesTotalPersec"] - $device["BytesReceivedPersec"];
} else {
$results[$dev_name]['tx_bytes'] = $device["BytesSentPersec"];
}
if( $device["BytesReceivedPersec"] < 0 ) {
$results[$dev_name]['rx_bytes'] = $device["BytesTotalPersec"] - $device["BytesSentPersec"];
} else {
$results[$dev_name]['rx_bytes'] = $device["BytesReceivedPersec"];
}
$results[$dev_name]['rx_packets'] = $device["PacketsReceivedPersec"];
$results[$dev_name]['tx_packets'] = $device["PacketsSentPersec"];
$results[$dev_name]['rx_errs'] = $device["PacketsReceivedErrors"];
$results[$dev_name]['rx_drop'] = $device["PacketsReceivedDiscarded"];
$results[$dev_name]['errs'] = $device["PacketsReceivedErrors"];
$results[$dev_name]['drop'] = $device["PacketsReceivedDiscarded"];
}
return $results;
}
/**
* Machine information
*
* @return void
*/
private function _machine()
{
$buffer = $this->_get_Win32_ComputerSystem();
if ($buffer) {
$buf = "";
if (isset($buffer[0]['Manufacturer']) && !preg_match("/^To be filled by O\.E\.M\.$|^System manufacturer$|^Not Specified$/i", $buf2=$buffer[0]['Manufacturer'])) {
$buf .= ' '.$buf2;
}
 
function memory ()
{
$buffer = $this->_GetWMI( "Win32_LogicalMemoryConfiguration", array( "TotalPhysicalMemory" ) );
$results['ram']['total'] = $buffer[0]["TotalPhysicalMemory"];
if (isset($buffer[0]['Model']) && !preg_match("/^To be filled by O\.E\.M\.$|^System Product Name$|^Not Specified$/i", $buf2=$buffer[0]['Model'])) {
$buf .= ' '.$buf2;
}
if (trim($buf) != "") {
$this->sys->setMachine(trim($buf));
}
}
}
 
$buffer = $this->_GetWMI( "Win32_PerfRawData_PerfOS_Memory", array( "AvailableKBytes" ) );
$results['ram']['free'] = $buffer[0]["AvailableKBytes"];
/**
* Hardwaredevices
*
* @return void
*/
private function _hardware()
{
foreach ($this->_devicelist('PCI') as $pciDev) {
$dev = new HWDevice();
$dev->setName($pciDev['Name']);
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
$dev->setManufacturer($pciDev['Manufacturer']);
$dev->setProduct($pciDev['Product']);
}
$this->sys->setPciDevices($dev);
}
 
$results['ram']['used'] = $results['ram']['total'] - $results['ram']['free'];
$results['ram']['percent'] = ceil( ( $results['ram']['used'] * 100 ) / $results['ram']['total'] );
$results['swap']['total'] = 0;
$results['swap']['used'] = 0;
$results['swap']['free'] = 0;
foreach ($this->_devicelist('IDE') as $ideDev) {
$dev = new HWDevice();
$dev->setName($ideDev['Name']);
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
$dev->setCapacity($ideDev['Capacity']);
if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
$dev->setSerial($ideDev['Serial']);
}
}
$this->sys->setIdeDevices($dev);
}
 
$buffer = $this->_GetWMI( "Win32_PageFileUsage" ); // no need to filter, using nearly everything from output
$k = 0;
foreach ($buffer as $swapdevice) {
$results['devswap'][$k]['dev'] = $swapdevice["Name"];
$results['devswap'][$k]['total'] = $swapdevice["AllocatedBaseSize"] * 1024;
$results['devswap'][$k]['used'] = $swapdevice["CurrentUsage"] * 1024;
$results['devswap'][$k]['free'] = ( $swapdevice["AllocatedBaseSize"] - $swapdevice["CurrentUsage"] ) * 1024;
$results['devswap'][$k]['percent'] = ceil( $swapdevice["CurrentUsage"] / $swapdevice["AllocatedBaseSize"] );
foreach ($this->_devicelist('SCSI') as $scsiDev) {
$dev = new HWDevice();
$dev->setName($scsiDev['Name']);
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
$dev->setCapacity($scsiDev['Capacity']);
if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
$dev->setSerial($scsiDev['Serial']);
}
}
$this->sys->setScsiDevices($dev);
}
 
$results['swap']['total'] += $results['devswap'][$k]['total'];
$results['swap']['used'] += $results['devswap'][$k]['used'];
$results['swap']['free'] += $results['devswap'][$k]['free'];
$k += 1;
}
$results['swap']['percent'] = ceil( $results['swap']['used'] / $results['swap']['total'] * 100 );
return $results;
}
foreach ($this->_devicelist('USB') as $usbDev) {
$dev = new HWDevice();
$dev->setName($usbDev['Name']);
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
$dev->setManufacturer($usbDev['Manufacturer']);
$dev->setProduct($usbDev['Product']);
if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
$dev->setSerial($usbDev['Serial']);
}
}
$this->sys->setUsbDevices($dev);
}
}
 
// get the filesystem informations
function filesystems ()
{
$typearray = array("Unknown", "No Root Directory", "Removeable Disk",
"Local Disk", "Network Drive", "Compact Disc", "RAM Disk");
$floppyarray = array("Unknown", "5 1/4 in.", "3 1/2 in.", "3 1/2 in.",
"3 1/2 in.", "3 1/2 in.", "5 1/4 in.", "5 1/4 in.", "5 1/4 in.",
"5 1/4 in.", "5 1/4 in.", "Other", "HD", "3 1/2 in.", "3 1/2 in.",
"5 1/4 in.", "5 1/4 in.", "3 1/2 in.", "3 1/2 in.", "5 1/4 in.",
"3 1/2 in.", "3 1/2 in.", "8 in.");
/**
* Network devices
*
* @return void
*/
private function _network()
{
if ($this->_wmi) {
$buffer = $this->_get_Win32_OperatingSystem();
if ($buffer && isset($buffer[0]) && isset($buffer[0]['Version']) && version_compare($buffer[0]['Version'], "6.2", ">=")) { // minimal windows 2012 or windows 8
$allDevices = CommonFunctions::getWMI($this->_wmi, 'Win32_PerfRawData_Tcpip_NetworkAdapter', array('Name', 'BytesSentPersec', 'BytesTotalPersec', 'BytesReceivedPersec', 'PacketsReceivedErrors', 'PacketsReceivedDiscarded', 'CurrentBandwidth'));
} else {
$allDevices = CommonFunctions::getWMI($this->_wmi, 'Win32_PerfRawData_Tcpip_NetworkInterface', array('Name', 'BytesSentPersec', 'BytesTotalPersec', 'BytesReceivedPersec', 'PacketsReceivedErrors', 'PacketsReceivedDiscarded', 'CurrentBandwidth'));
}
if ($allDevices) {
$aliases = array();
$hkey = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}";
if (CommonFunctions::enumKey($this->_key, $hkey, $arrBuf, false)) {
foreach ($arrBuf as $netID) {
if (CommonFunctions::readReg($this->_reg, $hkey."\\".$netID."\\Connection\\PnPInstanceId", $strInstanceID, false)) { //a w Name jest net alias
if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\".$strInstanceID."\\FriendlyName", $strName, false)) {
$cname = str_replace(array('(', ')', '#'), array('[', ']', '_'), $strName); //convert to canonical
if (!isset($aliases[$cname])) { // duplicate checking
$aliases[$cname]['id'] = $netID;
$aliases[$cname]['name'] = $strName;
if (CommonFunctions::readReg($this->_reg, $hkey."\\".$netID."\\Connection\\Name", $strCName, false)
&& (str_replace(array('(', ')', '#'), array('[', ']', '_'), $strCName) !== $cname)) {
$aliases[$cname]['netname'] = $strCName;
}
} else {
$aliases[$cname]['id'] = '';
}
}
}
}
}
 
$buffer = $this->_GetWMI( "Win32_LogicalDisk" , array( "Name", "Size", "FreeSpace", "FileSystem", "DriveType", "MediaType" ) );
$aliases2 = array();
$hkey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards";
if (CommonFunctions::enumKey($this->_key, $hkey, $arrBuf, false)) {
foreach ($arrBuf as $netCount) {
if (CommonFunctions::readReg($this->_reg, $hkey."\\".$netCount."\\Description", $strName, false)
&& CommonFunctions::readReg($this->_reg, $hkey."\\".$netCount."\\ServiceName", $strGUID, false)) {
$cname = str_replace(array('(', ')', '#'), array('[', ']', '_'), $strName); //convert to canonical
if (!isset($aliases2[$cname])) { // duplicate checking
$aliases2[$cname]['id'] = $strGUID;
$aliases2[$cname]['name'] = $strName;
} else {
$aliases2[$cname]['id'] = '';
}
}
}
}
 
$k = 0;
foreach ( $buffer as $filesystem ) {
if ( hide_mount( $filesystem["Name"] ) ) {
continue;
}
$results[$k]['mount'] = $filesystem["Name"];
$results[$k]['size'] = $filesystem["Size"] / 1024;
$results[$k]['used'] = ( $filesystem["Size"] - $filesystem["FreeSpace"] ) / 1024;
$results[$k]['free'] = $filesystem["FreeSpace"] / 1024;
@$results[$k]['percent'] = ceil( $results[$k]['used'] / $results[$k]['size'] * 100 ); // silence this line, nobody is having a floppy in the drive everytime
$results[$k]['fstype'] = $filesystem["FileSystem"];
$results[$k]['disk'] = $typearray[$filesystem["DriveType"]];
if ( $filesystem["MediaType"] != "" && $filesystem["DriveType"] == 2 ) $results[$k]['disk'] .= " (" . $floppyarray[$filesystem["MediaType"]] . ")";
$k += 1;
}
return $results;
}
$allNetworkAdapterConfigurations = CommonFunctions::getWMI($this->_wmi, 'Win32_NetworkAdapterConfiguration', array('SettingID', /*'Description',*/ 'MACAddress', 'IPAddress'));
foreach ($allDevices as $device) if (!preg_match('/^WAN Miniport \[/', $device['Name'])) {
$dev = new NetDevice();
$name = $device['Name'];
 
function distro ()
{
$buffer = $this->_GetWMI( "Win32_OperatingSystem", array( "Caption" ) );
return $buffer[0]["Caption"];
}
if (preg_match('/^isatap\.({[A-Fa-f0-9\-]*})/', $name)) {
$dev->setName("Microsoft ISATAP Adapter");
} else {
if (preg_match('/\s-\s([^-]*)$/', $name, $ar_name)) {
$name=substr($name, 0, strlen($name)-strlen($ar_name[0]));
}
$dev->setName($name);
}
 
function distroicon ()
{
return 'xp.gif';
}
}
$macexist = false;
if (((($ali=$aliases) && isset($ali[$name])) || (($ali=$aliases2) && isset($ali[$name]))) && isset($ali[$name]['id']) && ($ali[$name]['id'] !== "")) {
foreach ($allNetworkAdapterConfigurations as $NetworkAdapterConfiguration) {
if ($ali[$name]['id']==$NetworkAdapterConfiguration['SettingID']) {
$mininame = $ali[$name]['name'];
if (preg_match('/^isatap\.({[A-Fa-f0-9\-]*})/', $mininame))
$mininame="Microsoft ISATAP Adapter";
elseif (preg_match('/\s-\s([^-]*)$/', $mininame, $ar_name))
$name=substr($mininame, 0, strlen($mininame)-strlen($ar_name[0]));
$dev->setName($mininame);
if (trim($NetworkAdapterConfiguration['MACAddress']) !== "") $macexist = true;
if (defined('PSI_SHOW_NETWORK_INFOS') && PSI_SHOW_NETWORK_INFOS) {
if (isset($ali[$name]['netname'])) $dev->setInfo(str_replace(';', ':', $ali[$name]['netname']));
if ((!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR)
&& (trim($NetworkAdapterConfiguration['MACAddress']) !== "")) $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').str_replace(':', '-', strtoupper($NetworkAdapterConfiguration['MACAddress'])));
if (isset($NetworkAdapterConfiguration['IPAddress']))
foreach ($NetworkAdapterConfiguration['IPAddress'] as $ipaddres)
if (($ipaddres != "0.0.0.0") && ($ipaddres != "::") && !preg_match('/^fe80::/i', $ipaddres))
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').strtolower($ipaddres));
}
 
?>
break;
}
}
}
 
if ($macexist
// || ($device['CurrentBandwidth'] >= 1000000)
|| ($device['BytesTotalPersec'] != 0)
|| ($device['BytesSentPersec'] != 0)
|| ($device['BytesReceivedPersec'] != 0)
|| ($device['PacketsReceivedErrors'] != 0)
|| ($device['PacketsReceivedDiscarded'] != 0)) { // hide unused
if (defined('PSI_SHOW_NETWORK_INFOS') && PSI_SHOW_NETWORK_INFOS) {
if (($speedinfo = $device['CurrentBandwidth']) >= 1000000) {
if ($speedinfo > 1000000000) {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').round($speedinfo/1000000000, 2)."Gb/s");
} else {
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').round($speedinfo/1000000, 2)."Mb/s");
}
}
}
 
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_perfrawdata_tcpip_networkinterface.asp
// there is a possible bug in the wmi interfaceabout uint32 and uint64: http://www.ureader.com/message/1244948.aspx, so that
// magative numbers would occour, try to calculate the nagative value from total - positive number
$txbytes = $device['BytesSentPersec'];
$rxbytes = $device['BytesReceivedPersec'];
if (($txbytes < 0) && ($rxbytes < 0)) {
$txbytes += 4294967296;
$rxbytes += 4294967296;
} elseif ($txbytes < 0) {
if ($device['BytesTotalPersec'] > $rxbytes)
$txbytes = $device['BytesTotalPersec'] - $rxbytes;
else
$txbytes += 4294967296;
} elseif ($rxbytes < 0) {
if ($device['BytesTotalPersec'] > $txbytes)
$rxbytes = $device['BytesTotalPersec'] - $txbytes;
else
$rxbytes += 4294967296;
}
$dev->setTxBytes($txbytes);
$dev->setRxBytes($rxbytes);
$dev->setErrors($device['PacketsReceivedErrors']);
$dev->setDrops($device['PacketsReceivedDiscarded']);
 
$this->sys->setNetDevices($dev);
}
}
}
} elseif (($buffer = $this->_get_systeminfo()) && preg_match('/^(\s+)\[\d+\]:[^\r\n]+\r\n\s+[^\s\[]/m', $buffer, $matches, PREG_OFFSET_CAPTURE)) {
$netbuf = substr($buffer, $matches[0][1]);
if (preg_match('/^[^\s]/m', $netbuf, $matches2, PREG_OFFSET_CAPTURE)) {
$netbuf = substr($netbuf, 0, $matches2[0][1]);
}
$netstrs = preg_split('/^'.$matches[1][0].'\[\d+\]:/m', $netbuf, -1, PREG_SPLIT_NO_EMPTY);
$devnr = 0;
foreach ($netstrs as $netstr) {
$netstrls = preg_split('/\r\n/', $netstr, -1, PREG_SPLIT_NO_EMPTY);
if (sizeof($netstrls)>1) {
$dev = new NetDevice();
foreach ($netstrls as $nr=>$netstrl) {
if ($nr === 0) {
$name = trim($netstrl);
if ($name !== "") {
$dev->setName($name);
} else {
$dev->setName('dev'.$devnr);
$devnr++;
}
} elseif (preg_match('/\[\d+\]:\s+(.+)/', $netstrl, $netinfo)) {
$ipaddres = trim($netinfo[1]);
if (($ipaddres!="0.0.0.0") && !preg_match('/^fe80::/i', $ipaddres))
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').strtolower($ipaddres));
}
}
$this->sys->setNetDevices($dev);
}
}
}
}
 
/**
* Physical memory information and Swap Space information
*
* @link http://msdn2.microsoft.com/En-US/library/aa394239.aspx
* @link http://msdn2.microsoft.com/en-us/library/aa394246.aspx
* @return void
*/
private function _memory()
{
if ($this->_wmi) {
$buffer = $this->_get_Win32_OperatingSystem();
if ($buffer) {
$this->sys->setMemTotal($buffer[0]['TotalVisibleMemorySize'] * 1024);
$this->sys->setMemFree($buffer[0]['FreePhysicalMemory'] * 1024);
$this->sys->setMemUsed($this->sys->getMemTotal() - $this->sys->getMemFree());
}
$buffer = CommonFunctions::getWMI($this->_wmi, 'Win32_PageFileUsage');
foreach ($buffer as $swapdevice) {
$dev = new DiskDevice();
$dev->setName("SWAP");
$dev->setMountPoint($swapdevice['Name']);
$dev->setTotal($swapdevice['AllocatedBaseSize'] * 1024 * 1024);
$dev->setUsed($swapdevice['CurrentUsage'] * 1024 * 1024);
$dev->setFree($dev->getTotal() - $dev->getUsed());
$dev->setFsType('swap');
$this->sys->setSwapDevices($dev);
}
} elseif (($buffer = $this->_get_systeminfo()) && preg_match("/:\s([\d \xFF]+)\sMB\r\n.+:\s([\d \xFF]+)\sMB\r\n.+:\s([\d \xFF]+)\sMB\r\n.+:\s([\d \xFF]+)\sMB\r\n.+\s([\d \xFF]+)\sMB\r\n/m", $buffer, $buffer2)) {
// && (preg_match("/:\s([\d \xFF]+)\sMB\r\n.+:\s([\d \xFF]+)\sMB\r\n.+:\s([\d \xFF]+)\sMB\r\n.+:\s([\d \xFF]+)\sMB\r\n.+\s([\d \xFF]+)\sMB\r\n.*:\s+(\S+)\r\n/m", $buffer, $buffer2)) {
$this->sys->setMemTotal(preg_replace('/(\s)|(\xFF)/', '', $buffer2[1]) * 1024 * 1024);
$this->sys->setMemFree(preg_replace('/(\s)|(\xFF)/', '', $buffer2[2]) * 1024 * 1024);
$this->sys->setMemUsed($this->sys->getMemTotal() - $this->sys->getMemFree());
}
}
 
/**
* filesystem information
*
* @return void
*/
private function _filesystems()
{
$typearray = array('Unknown', 'No Root Directory', 'Removable Disk', 'Local Disk', 'Network Drive', 'Compact Disc', 'RAM Disk');
$floppyarray = array('Unknown', '5 1/4 in.', '3 1/2 in.', '3 1/2 in.', '3 1/2 in.', '3 1/2 in.', '5 1/4 in.', '5 1/4 in.', '5 1/4 in.', '5 1/4 in.', '5 1/4 in.', 'Other', 'HD', '3 1/2 in.', '3 1/2 in.', '5 1/4 in.', '5 1/4 in.', '3 1/2 in.', '3 1/2 in.', '5 1/4 in.', '3 1/2 in.', '3 1/2 in.', '8 in.');
$buffer = CommonFunctions::getWMI($this->_wmi, 'Win32_LogicalDisk', array('Name', 'Size', 'FreeSpace', 'FileSystem', 'DriveType', 'MediaType'));
foreach ($buffer as $filesystem) {
$dev = new DiskDevice();
$dev->setMountPoint($filesystem['Name']);
$dev->setFsType($filesystem['FileSystem']);
if ($filesystem['Size'] > 0) {
$dev->setTotal($filesystem['Size']);
$dev->setFree($filesystem['FreeSpace']);
$dev->setUsed($filesystem['Size'] - $filesystem['FreeSpace']);
}
if ($filesystem['MediaType'] != "" && $filesystem['DriveType'] == 2) {
$dev->setName($typearray[$filesystem['DriveType']]." (".$floppyarray[$filesystem['MediaType']].")");
} else {
$dev->setName($typearray[$filesystem['DriveType']]);
}
$this->sys->setDiskDevices($dev);
}
if (!$buffer && ($this->sys->getDistribution()=="ReactOS")) {
// test for command 'free' on current disk
if (CommonFunctions::executeProgram('cmd', '/c free 2>nul', $out_value, true)) {
for ($letter='A'; $letter!='AA'; $letter++) if (CommonFunctions::executeProgram('cmd', '/c free '.$letter.': 2>nul', $out_value, false)) {
$values = preg_replace('/[^\d\n]/', '', $out_value);
if (preg_match('/\n(\d+)\n(\d+)\n(\d+)$/', $values, $out_dig)) {
$size = $out_dig[1];
$used = $out_dig[2];
$free = $out_dig[3];
if ($used + $free == $size) {
$dev = new DiskDevice();
$dev->setMountPoint($letter.":");
$dev->setFsType('Unknown');
$dev->setName('Unknown');
$dev->setTotal($size);
$dev->setUsed($used);
$dev->setFree($free);
$this->sys->setDiskDevices($dev);
}
}
}
}
}
}
 
/**
* get os specific encoding
*
* @see OS::getEncoding()
*
* @return string
*/
public function getEncoding()
{
return $this->_codepage;
}
 
/**
* get os specific language
*
* @see OS::getLanguage()
*
* @return string
*/
public function getLanguage()
{
return $this->_syslang;
}
 
public function _processes()
{
$processes['*'] = 0;
if (CommonFunctions::executeProgram('qprocess', '*', $strBuf, false) && (strlen($strBuf) > 0)) {
$lines = preg_split('/\n/', $strBuf);
$processes['*'] = (count($lines)-1) - 3 ; //correction for process "qprocess *"
}
if ($processes['*'] <= 0) {
$buffer = CommonFunctions::getWMI($this->_wmi, 'Win32_Process', array('Caption'));
$processes['*'] = count($buffer);
}
$processes[' '] = $processes['*'];
$this->sys->setProcesses($processes);
}
 
/**
* get the information
*
* @see PSI_Interface_OS::build()
*
* @return Void
*/
public function build()
{
$this->_distro(); //share getDistribution()
if ($this->sys->getDistribution()=="ReactOS") {
$this->error->addError("WARN", "The ReactOS version of phpSysInfo is a work in progress, some things currently don't work");
}
if (!$this->blockname || $this->blockname==='vitals') {
$this->_hostname();
$this->_users();
$this->_uptime();
$this->_loadavg();
$this->_processes();
}
if (!$this->blockname || $this->blockname==='network') {
$this->_network();
}
if (!$this->blockname || $this->blockname==='hardware') {
$this->_machine();
$this->_cpuinfo();
$this->_hardware();
}
if (!$this->blockname || $this->blockname==='filesystem') {
$this->_filesystems();
}
if (!$this->blockname || $this->blockname==='memory') {
$this->_memory();
}
}
}
/web/acc/phpsysinfo/includes/xml/hardware.php
File deleted
/web/acc/phpsysinfo/includes/xml/memory.php
File deleted
/web/acc/phpsysinfo/includes/xml/network.php
File deleted
/web/acc/phpsysinfo/includes/xml/mbinfo.php
File deleted
/web/acc/phpsysinfo/includes/xml/portail.php
File deleted
Property changes:
Deleted: svn:keywords
-Id Date Author
\ No newline at end of property
/web/acc/phpsysinfo/includes/xml/utilisateur.php.2
File deleted
/web/acc/phpsysinfo/includes/xml/vitals.php
File deleted
/web/acc/phpsysinfo/includes/xml/filesystems.php
File deleted
/web/acc/phpsysinfo/includes/xml/hddtemp.php
File deleted
/web/acc/phpsysinfo/includes/xml/class.SimpleXMLExtended.inc.php
0,0 → 1,227
<?php
/**
* modified XML Element
*
* PHP version 5
*
* @category PHP
* @package PSI_XML
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.SimpleXMLExtended.inc.php 610 2012-07-11 19:12:12Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* class extends the SimpleXML element for including some special functions, like encoding stuff and cdata support
*
* @category PHP
* @package PSI_XML
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class SimpleXMLExtended
{
/**
* store the encoding that is used for conversation to utf8
*
* @var String base encoding
*/
private $_encoding = null;
 
/**
* SimpleXMLElement to which every call is delegated
*
* @var SimpleXMLElement delegated SimpleXMLElement
*/
private $_SimpleXmlElement = null;
 
/**
* _CP437toUTF8Table for code page conversion for CP437
*
* @var array _CP437toUTF8Table array
*/
private static $_CP437toUTF8Table = array(
"\xC3\x87","\xC3\xBC","\xC3\xA9","\xC3\xA2",
"\xC3\xA4","\xC3\xA0","\xC3\xA5","\xC3\xA7",
"\xC3\xAA","\xC3\xAB","\xC3\xA8","\xC3\xAF",
"\xC3\xAE","\xC3\xAC","\xC3\x84","\xC3\x85",
"\xC3\x89","\xC3\xA6","\xC3\x86","\xC3\xB4",
"\xC3\xB6","\xC3\xB2","\xC3\xBB","\xC3\xB9",
"\xC3\xBF","\xC3\x96","\xC3\x9C","\xC3\xA2",
"\xC2\xA3","\xC3\xA5","\xE2\x82\xA7","\xC6\x92",
"\xC3\xA1","\xC3\xAD","\xC3\xB3","\xC3\xBA",
"\xC3\xB1","\xC3\x91","\xC2\xAA","\xC2\xBA",
"\xC2\xBF","\xE2\x8C\x90","\xC2\xAC","\xC2\xBD",
"\xC2\xBC","\xC2\xA1","\xC2\xAB","\xC2\xBB",
"\xE2\x96\x91","\xE2\x96\x92","\xE2\x96\x93","\xE2\x94\x82",
"\xE2\x94\xA4","\xE2\x95\xA1","\xE2\x95\xA2","\xE2\x95\x96",
"\xE2\x95\x95","\xE2\x95\xA3","\xE2\x95\x91","\xE2\x95\x97",
"\xE2\x95\x9D","\xE2\x95\x9C","\xE2\x95\x9B","\xE2\x94\x90",
"\xE2\x94\x94","\xE2\x94\xB4","\xE2\x94\xAC","\xE2\x94\x9C",
"\xE2\x94\x80","\xE2\x94\xBC","\xE2\x95\x9E","\xE2\x95\x9F",
"\xE2\x95\x9A","\xE2\x95\x94","\xE2\x95\xA9","\xE2\x95\xA6",
"\xE2\x95\xA0","\xE2\x95\x90","\xE2\x95\xAC","\xE2\x95\xA7",
"\xE2\x95\xA8","\xE2\x95\xA4","\xE2\x95\xA5","\xE2\x95\x99",
"\xE2\x95\x98","\xE2\x95\x92","\xE2\x95\x93","\xE2\x95\xAB",
"\xE2\x95\xAA","\xE2\x94\x98","\xE2\x94\x8C","\xE2\x96\x88",
"\xE2\x96\x84","\xE2\x96\x8C","\xE2\x96\x90","\xE2\x96\x80",
"\xCE\xB1","\xC3\x9F","\xCE\x93","\xCF\x80",
"\xCE\xA3","\xCF\x83","\xC2\xB5","\xCF\x84",
"\xCE\xA6","\xCE\x98","\xCE\xA9","\xCE\xB4",
"\xE2\x88\x9E","\xCF\x86","\xCE\xB5","\xE2\x88\xA9",
"\xE2\x89\xA1","\xC2\xB1","\xE2\x89\xA5","\xE2\x89\xA4",
"\xE2\x8C\xA0","\xE2\x8C\xA1","\xC3\xB7","\xE2\x89\x88",
"\xC2\xB0","\xE2\x88\x99","\xC2\xB7","\xE2\x88\x9A",
"\xE2\x81\xBF","\xC2\xB2","\xE2\x96\xA0","\xC2\xA0");
 
/**
* create a new extended SimpleXMLElement and set encoding if specified
*
* @param SimpleXMLElement $xml base xml element
* @param String $encoding base encoding that should be used for conversation to utf8
*
* @return void
*/
public function __construct($xml, $encoding = null)
{
if ($encoding != null) {
$this->_encoding = $encoding;
}
$this->_SimpleXmlElement = $xml;
}
 
/**
* insert a child element with or without a value, also doing conversation of name and if value is set to utf8
*
* @param String $name name of the child element
* @param String $value a value that should be insert to the child
*
* @return SimpleXMLExtended extended child SimpleXMLElement
*/
public function addChild($name, $value = null)
{
$nameUtf8 = $this->_toUTF8($name);
if ($value == null) {
return new SimpleXMLExtended($this->_SimpleXmlElement->addChild($nameUtf8), $this->_encoding);
} else {
$valueUtf8 = htmlspecialchars($this->_toUTF8($value), ENT_COMPAT, "UTF-8");
 
return new SimpleXMLExtended($this->_SimpleXmlElement->addChild($nameUtf8, $valueUtf8), $this->_encoding);
}
}
 
/**
* insert a child with cdata section
*
* @param String $name name of the child element
* @param String $cdata data for CDATA section
*
* @return SimpleXMLExtended extended child SimpleXMLElement
*/
public function addCData($name, $cdata)
{
$nameUtf8 = $this->_toUTF8($name);
$node = $this->_SimpleXmlElement->addChild($nameUtf8);
$domnode = dom_import_simplexml($node);
$no = $domnode->ownerDocument;
$domnode->appendChild($no->createCDATASection($cdata));
 
return new SimpleXMLExtended($node, $this->_encoding);
}
 
/**
* add a attribute to a child and convert name and value to utf8
*
* @param String $name name of the attribute
* @param String $value value of the attribute
*
* @return Void
*/
public function addAttribute($name, $value)
{
$nameUtf8 = $this->_toUTF8($name);
$valueUtf8 = htmlspecialchars($this->_toUTF8($value), ENT_COMPAT, "UTF-8");
if (($valueUtf8 === "") && (version_compare("5.2.2", PHP_VERSION, ">"))) {
$this->_SimpleXmlElement->addAttribute($nameUtf8, "\0"); // Fixing bug #41175 (addAttribute() fails to add an attribute with an empty value)
} else {
$this->_SimpleXmlElement->addAttribute($nameUtf8, $valueUtf8);
}
}
 
/**
* append a xml-tree to another xml-tree
*
* @param SimpleXMLElement $new_child child that should be appended
*
* @return Void
*/
public function combinexml(SimpleXMLElement $new_child)
{
$node1 = dom_import_simplexml($this->_SimpleXmlElement);
$dom_sxe = dom_import_simplexml($new_child);
$node2 = $node1->ownerDocument->importNode($dom_sxe, true);
$node1->appendChild($node2);
}
 
/**
* convert a string into an UTF-8 string
*
* @param String $str string to convert
*
* @return String UTF-8 string
*/
private function _toUTF8($str)
{
$str = trim(preg_replace('/[\x00-\x09\x0b-\x1F]/', ' ', $str)); //remove nonprintable characters
if ($this->_encoding != null) {
if (strcasecmp($this->_encoding, "UTF-8") == 0) {
return $str;
} elseif (strcasecmp($this->_encoding, "CP437") == 0) {
$strr = "";
if (($strl = strlen($str)) > 0) for ($i = 0; $i < $strl; $i++) {
$strc = substr($str, $i, 1);
if ($strc < 128) $strr.=$strc;
else $strr.=self::$_CP437toUTF8Table[$strc-128];
}
 
return $strr;
} else {
if (preg_match("/^windows-\d+ \((.+)\)$/", $this->_encoding, $buf)) {
$encoding = $buf[1];
} else {
$encoding = $this->_encoding;
}
$enclist = mb_list_encodings();
if (in_array($encoding, $enclist)) {
return mb_convert_encoding($str, 'UTF-8', $encoding);
} elseif (function_exists("iconv")) {
if (($iconvout=iconv($encoding, 'UTF-8', $str))!==false) {
return $iconvout;
} else {
return mb_convert_encoding($str, 'UTF-8');
}
} elseif (function_exists("libiconv") && (($iconvout=libiconv($encoding, 'UTF-8', $str))!==false)) {
return $iconvout;
} else {
return mb_convert_encoding($str, 'UTF-8');
}
}
} else {
return mb_convert_encoding($str, 'UTF-8');
}
}
 
/**
* Returns the SimpleXmlElement
*
* @return SimpleXmlElement entire xml as SimpleXmlElement
*/
public function getSimpleXmlElement()
{
return $this->_SimpleXmlElement;
}
}
/web/acc/phpsysinfo/includes/xml/class.XML.inc.php
0,0 → 1,836
<?php
/**
* XML Generation class
*
* PHP version 5
*
* @category PHP
* @package PSI_XML
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: class.XML.inc.php 699 2012-09-15 11:57:13Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* class for generation of the xml
*
* @category PHP
* @package PSI_XML
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version Release: 3.0
* @link http://phpsysinfo.sourceforge.net
*/
class XML
{
/**
* Sysinfo object where the information retrieval methods are included
*
* @var PSI_Interface_OS
*/
private $_sysinfo;
 
/**
* @var System
*/
private $_sys = null;
 
/**
* xml object with the xml content
*
* @var SimpleXMLExtended
*/
private $_xml;
 
/**
* object for error handling
*
* @var PSI_Error
*/
private $_errors;
 
/**
* array with all enabled plugins (name)
*
* @var array
*/
private $_plugins;
 
/**
* plugin name if pluginrequest
*
* @var string
*/
private $_plugin = '';
 
/**
* generate a xml for a plugin or for the main app
*
* @var boolean
*/
private $_plugin_request = false;
 
/**
* generate the entire xml with all plugins or only a part of the xml (main or plugin)
*
* @var boolean
*/
private $_complete_request = false;
 
/**
* doing some initial tasks
* - generate the xml structure with the right header elements
* - get the error object for error output
* - get a instance of the sysinfo object
*
* @param boolean $complete generate xml with all plugins or not
* @param string $pluginname name of the plugin
*
* @return void
*/
public function __construct($complete = false, $pluginname = "", $blockname = false)
{
$this->_errors = PSI_Error::singleton();
if ($pluginname == "") {
$this->_plugin_request = false;
$this->_plugin = '';
} else {
$this->_plugin_request = true;
$this->_plugin = $pluginname;
}
if ($complete) {
$this->_complete_request = true;
} else {
$this->_complete_request = false;
}
$os = PSI_OS;
$this->_sysinfo = new $os($blockname);
$this->_plugins = CommonFunctions::getPlugins();
$this->_xmlbody();
}
 
/**
* generate common information
*
* @return void
*/
private function _buildVitals()
{
$vitals = $this->_xml->addChild('Vitals');
$vitals->addAttribute('Hostname', $this->_sys->getHostname());
$vitals->addAttribute('IPAddr', $this->_sys->getIp());
$vitals->addAttribute('Kernel', $this->_sys->getKernel());
$vitals->addAttribute('Distro', $this->_sys->getDistribution());
$vitals->addAttribute('Distroicon', $this->_sys->getDistributionIcon());
$vitals->addAttribute('Uptime', $this->_sys->getUptime());
$vitals->addAttribute('Users', $this->_sys->getUsers());
$vitals->addAttribute('LoadAvg', $this->_sys->getLoad());
if ($this->_sys->getLoadPercent() !== null) {
$vitals->addAttribute('CPULoad', $this->_sys->getLoadPercent());
}
if ($this->_sysinfo->getLanguage() !== null) {
$vitals->addAttribute('SysLang', $this->_sysinfo->getLanguage());
}
if ($this->_sysinfo->getEncoding() !== null) {
$vitals->addAttribute('CodePage', $this->_sysinfo->getEncoding());
}
 
//processes
if (($procss = $this->_sys->getProcesses()) !== null) {
if (isset($procss['*']) && (($procall = $procss['*']) > 0)) {
$vitals->addAttribute('Processes', $procall);
if (!isset($procss[' ']) || !($procss[' '] > 0)) { // not unknown
$procsum = 0;
if (isset($procss['R']) && (($proctmp = $procss['R']) > 0)) {
$vitals->addAttribute('ProcessesRunning', $proctmp);
$procsum += $proctmp;
}
if (isset($procss['S']) && (($proctmp = $procss['S']) > 0)) {
$vitals->addAttribute('ProcessesSleeping', $proctmp);
$procsum += $proctmp;
}
if (isset($procss['T']) && (($proctmp = $procss['T']) > 0)) {
$vitals->addAttribute('ProcessesStopped', $proctmp);
$procsum += $proctmp;
}
if (isset($procss['Z']) && (($proctmp = $procss['Z']) > 0)) {
$vitals->addAttribute('ProcessesZombie', $proctmp);
$procsum += $proctmp;
}
if (isset($procss['D']) && (($proctmp = $procss['D']) > 0)) {
$vitals->addAttribute('ProcessesWaiting', $proctmp);
$procsum += $proctmp;
}
if (($proctmp = $procall - $procsum) > 0) {
$vitals->addAttribute('ProcessesOther', $proctmp);
}
}
}
}
// $vitals->addAttribute('OS', PSI_OS);
$vitals->addAttribute('OS', (PSI_OS=='Android')?'Linux':PSI_OS);
}
 
/**
* generate the network information
*
* @return void
*/
private function _buildNetwork()
{
$hideDevices = array();
$network = $this->_xml->addChild('Network');
if (defined('PSI_HIDE_NETWORK_INTERFACE')) {
if (is_string(PSI_HIDE_NETWORK_INTERFACE)) {
if (preg_match(ARRAY_EXP, PSI_HIDE_NETWORK_INTERFACE)) {
$hideDevices = eval(PSI_HIDE_NETWORK_INTERFACE);
} else {
$hideDevices = array(PSI_HIDE_NETWORK_INTERFACE);
}
} elseif (PSI_HIDE_NETWORK_INTERFACE === true) {
return;
}
}
foreach ($this->_sys->getNetDevices() as $dev) {
if (!in_array(trim($dev->getName()), $hideDevices)) {
$device = $network->addChild('NetDevice');
$device->addAttribute('Name', $dev->getName());
$device->addAttribute('RxBytes', $dev->getRxBytes());
$device->addAttribute('TxBytes', $dev->getTxBytes());
$device->addAttribute('Err', $dev->getErrors());
$device->addAttribute('Drops', $dev->getDrops());
if (defined('PSI_SHOW_NETWORK_INFOS') && PSI_SHOW_NETWORK_INFOS && $dev->getInfo())
$device->addAttribute('Info', $dev->getInfo());
}
}
}
 
/**
* generate the hardware information
*
* @return void
*/
private function _buildHardware()
{
$hardware = $this->_xml->addChild('Hardware');
if ($this->_sys->getMachine() != "") {
$hardware->addAttribute('Name', $this->_sys->getMachine());
}
$pci = null;
foreach (System::removeDupsAndCount($this->_sys->getPciDevices()) as $dev) {
if ($pci === null) $pci = $hardware->addChild('PCI');
$tmp = $pci->addChild('Device');
$tmp->addAttribute('Name', $dev->getName());
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
if ($dev->getManufacturer() !== null) {
$tmp->addAttribute('Manufacturer', $dev->getManufacturer());
}
if ($dev->getProduct() !== null) {
$tmp->addAttribute('Product', $dev->getProduct());
}
}
if ($dev->getCount() > 1) {
$tmp->addAttribute('Count', $dev->getCount());
}
}
$usb = null;
foreach (System::removeDupsAndCount($this->_sys->getUsbDevices()) as $dev) {
if ($usb === null) $usb = $hardware->addChild('USB');
$tmp = $usb->addChild('Device');
$tmp->addAttribute('Name', $dev->getName());
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
if ($dev->getManufacturer() !== null) {
$tmp->addAttribute('Manufacturer', $dev->getManufacturer());
}
if ($dev->getProduct() !== null) {
$tmp->addAttribute('Product', $dev->getProduct());
}
if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL && ($dev->getSerial() !== null)) {
$tmp->addAttribute('Serial', $dev->getSerial());
}
}
if ($dev->getCount() > 1) {
$tmp->addAttribute('Count', $dev->getCount());
}
}
$ide = null;
foreach (System::removeDupsAndCount($this->_sys->getIdeDevices()) as $dev) {
if ($ide === null) $ide = $hardware->addChild('IDE');
$tmp = $ide->addChild('Device');
$tmp->addAttribute('Name', $dev->getName());
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
if ($dev->getCapacity() !== null) {
$tmp->addAttribute('Capacity', $dev->getCapacity());
}
if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL && ($dev->getSerial() !== null)) {
$tmp->addAttribute('Serial', $dev->getSerial());
}
}
if ($dev->getCount() > 1) {
$tmp->addAttribute('Count', $dev->getCount());
}
}
$scsi = null;
foreach (System::removeDupsAndCount($this->_sys->getScsiDevices()) as $dev) {
if ($scsi === null) $scsi = $hardware->addChild('SCSI');
$tmp = $scsi->addChild('Device');
$tmp->addAttribute('Name', $dev->getName());
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
if ($dev->getCapacity() !== null) {
$tmp->addAttribute('Capacity', $dev->getCapacity());
}
if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL && ($dev->getSerial() !== null)) {
$tmp->addAttribute('Serial', $dev->getSerial());
}
}
if ($dev->getCount() > 1) {
$tmp->addAttribute('Count', $dev->getCount());
}
}
$nvme = null;
foreach (System::removeDupsAndCount($this->_sys->getNvmeDevices()) as $dev) {
if ($nvme === null) $nvme = $hardware->addChild('NVMe');
$tmp = $nvme->addChild('Device');
$tmp->addAttribute('Name', $dev->getName());
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
if ($dev->getCapacity() !== null) {
$tmp->addAttribute('Capacity', $dev->getCapacity());
}
if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL && ($dev->getSerial() !== null)) {
$tmp->addAttribute('Serial', $dev->getSerial());
}
}
if ($dev->getCount() > 1) {
$tmp->addAttribute('Count', $dev->getCount());
}
}
$tb = null;
foreach (System::removeDupsAndCount($this->_sys->getTbDevices()) as $dev) {
if ($tb === null) $tb = $hardware->addChild('TB');
$tmp = $tb->addChild('Device');
$tmp->addAttribute('Name', $dev->getName());
if ($dev->getCount() > 1) {
$tmp->addAttribute('Count', $dev->getCount());
}
}
$i2c = null;
foreach (System::removeDupsAndCount($this->_sys->getI2cDevices()) as $dev) {
if ($i2c === null) $i2c = $hardware->addChild('I2C');
$tmp = $i2c->addChild('Device');
$tmp->addAttribute('Name', $dev->getName());
if ($dev->getCount() > 1) {
$tmp->addAttribute('Count', $dev->getCount());
}
}
 
$cpu = null;
$vendortab = null;
foreach ($this->_sys->getCpus() as $oneCpu) {
if ($cpu === null) $cpu = $hardware->addChild('CPU');
$tmp = $cpu->addChild('CpuCore');
$tmp->addAttribute('Model', $oneCpu->getModel());
if ($oneCpu->getCpuSpeed() !== 0) {
$tmp->addAttribute('CpuSpeed', max($oneCpu->getCpuSpeed(), 0));
}
if ($oneCpu->getCpuSpeedMax() !== 0) {
$tmp->addAttribute('CpuSpeedMax', $oneCpu->getCpuSpeedMax());
}
if ($oneCpu->getCpuSpeedMin() !== 0) {
$tmp->addAttribute('CpuSpeedMin', $oneCpu->getCpuSpeedMin());
}
/*
if ($oneCpu->getTemp() !== null) {
$tmp->addAttribute('CpuTemp', $oneCpu->getTemp());
}
*/
if ($oneCpu->getBusSpeed() !== null) {
$tmp->addAttribute('BusSpeed', $oneCpu->getBusSpeed());
}
if ($oneCpu->getCache() !== null) {
$tmp->addAttribute('Cache', $oneCpu->getCache());
}
if ($oneCpu->getVirt() !== null) {
$tmp->addAttribute('Virt', $oneCpu->getVirt());
}
if ($oneCpu->getVendorId() !== null) {
if ($vendortab === null) $vendortab = @parse_ini_file(PSI_APP_ROOT."/data/cpus.ini", true);
$shortvendorid = preg_replace('/[\s!]/', '', $oneCpu->getVendorId());
if ($vendortab && ($shortvendorid != "") && isset($vendortab['manufacturer'][$shortvendorid])) {
$tmp->addAttribute('Manufacturer', $vendortab['manufacturer'][$shortvendorid]);
}
}
if ($oneCpu->getBogomips() !== null) {
$tmp->addAttribute('Bogomips', $oneCpu->getBogomips());
}
if ($oneCpu->getLoad() !== null) {
$tmp->addAttribute('Load', $oneCpu->getLoad());
}
}
}
 
/**
* generate the memory information
*
* @return void
*/
private function _buildMemory()
{
$memory = $this->_xml->addChild('Memory');
$memory->addAttribute('Free', $this->_sys->getMemFree());
$memory->addAttribute('Used', $this->_sys->getMemUsed());
$memory->addAttribute('Total', $this->_sys->getMemTotal());
$memory->addAttribute('Percent', $this->_sys->getMemPercentUsed());
if (($this->_sys->getMemApplication() !== null) || ($this->_sys->getMemBuffer() !== null) || ($this->_sys->getMemCache() !== null)) {
$details = $memory->addChild('Details');
if ($this->_sys->getMemApplication() !== null) {
$details->addAttribute('App', $this->_sys->getMemApplication());
$details->addAttribute('AppPercent', $this->_sys->getMemPercentApplication());
}
if ($this->_sys->getMemBuffer() !== null) {
$details->addAttribute('Buffers', $this->_sys->getMemBuffer());
$details->addAttribute('BuffersPercent', $this->_sys->getMemPercentBuffer());
}
if ($this->_sys->getMemCache() !== null) {
$details->addAttribute('Cached', $this->_sys->getMemCache());
$details->addAttribute('CachedPercent', $this->_sys->getMemPercentCache());
}
}
if (count($this->_sys->getSwapDevices()) > 0) {
$swap = $memory->addChild('Swap');
$swap->addAttribute('Free', $this->_sys->getSwapFree());
$swap->addAttribute('Used', $this->_sys->getSwapUsed());
$swap->addAttribute('Total', $this->_sys->getSwapTotal());
$swap->addAttribute('Percent', $this->_sys->getSwapPercentUsed());
$i = 1;
foreach ($this->_sys->getSwapDevices() as $dev) {
$swapMount = $swap->addChild('Mount');
$this->_fillDevice($swapMount, $dev, $i++);
}
}
}
 
/**
* fill a xml element with atrributes from a disk device
*
* @param SimpleXmlExtended $mount Xml-Element
* @param DiskDevice $dev DiskDevice
* @param Integer $i counter
*
* @return Void
*/
private function _fillDevice(SimpleXMLExtended $mount, DiskDevice $dev, $i)
{
$mount->addAttribute('MountPointID', $i);
if ($dev->getFsType()!=="") $mount->addAttribute('FSType', $dev->getFsType());
$mount->addAttribute('Name', $dev->getName());
$mount->addAttribute('Free', sprintf("%.0f", $dev->getFree()));
$mount->addAttribute('Used', sprintf("%.0f", $dev->getUsed()));
$mount->addAttribute('Total', sprintf("%.0f", $dev->getTotal()));
$mount->addAttribute('Percent', $dev->getPercentUsed());
if ($dev->getIgnore() > 0) $mount->addAttribute('Ignore', $dev->getIgnore());
if (PSI_SHOW_MOUNT_OPTION === true) {
if ($dev->getOptions() !== null) {
$mount->addAttribute('MountOptions', preg_replace("/,/", ", ", $dev->getOptions()));
}
}
if ($dev->getPercentInodesUsed() !== null) {
$mount->addAttribute('Inodes', $dev->getPercentInodesUsed());
}
if (PSI_SHOW_MOUNT_POINT === true) {
$mount->addAttribute('MountPoint', $dev->getMountPoint());
}
}
 
/**
* generate the filesysteminformation
*
* @return void
*/
private function _buildFilesystems()
{
$hideMounts = $hideFstypes = $hideDisks = $ignoreFree = $ignoreUsage = $ignoreThreshold = array();
$i = 1;
if (defined('PSI_HIDE_MOUNTS') && is_string(PSI_HIDE_MOUNTS)) {
if (preg_match(ARRAY_EXP, PSI_HIDE_MOUNTS)) {
$hideMounts = eval(PSI_HIDE_MOUNTS);
} else {
$hideMounts = array(PSI_HIDE_MOUNTS);
}
}
if (defined('PSI_HIDE_FS_TYPES') && is_string(PSI_HIDE_FS_TYPES)) {
if (preg_match(ARRAY_EXP, PSI_HIDE_FS_TYPES)) {
$hideFstypes = eval(PSI_HIDE_FS_TYPES);
} else {
$hideFstypes = array(PSI_HIDE_FS_TYPES);
}
}
if (defined('PSI_HIDE_DISKS')) {
if (is_string(PSI_HIDE_DISKS)) {
if (preg_match(ARRAY_EXP, PSI_HIDE_DISKS)) {
$hideDisks = eval(PSI_HIDE_DISKS);
} else {
$hideDisks = array(PSI_HIDE_DISKS);
}
} elseif (PSI_HIDE_DISKS === true) {
return;
}
}
if (defined('PSI_IGNORE_FREE') && is_string(PSI_IGNORE_FREE)) {
if (preg_match(ARRAY_EXP, PSI_IGNORE_FREE)) {
$ignoreFree = eval(PSI_IGNORE_FREE);
} else {
$ignoreFree = array(PSI_IGNORE_FREE);
}
}
if (defined('PSI_IGNORE_USAGE') && is_string(PSI_IGNORE_USAGE)) {
if (preg_match(ARRAY_EXP, PSI_IGNORE_USAGE)) {
$ignoreUsage = eval(PSI_IGNORE_USAGE);
} else {
$ignoreUsage = array(PSI_IGNORE_USAGE);
}
}
if (defined('PSI_IGNORE_THRESHOLD_FS_TYPES') && is_string(PSI_IGNORE_THRESHOLD_FS_TYPES)) {
if (preg_match(ARRAY_EXP, PSI_IGNORE_THRESHOLD_FS_TYPES)) {
$ignoreThreshold = eval(PSI_IGNORE_THRESHOLD_FS_TYPES);
} else {
$ignoreThreshold = array(PSI_IGNORE_THRESHOLD_FS_TYPES);
}
}
$fs = $this->_xml->addChild('FileSystem');
foreach ($this->_sys->getDiskDevices() as $disk) {
if (!in_array($disk->getMountPoint(), $hideMounts, true) && !in_array($disk->getFsType(), $hideFstypes, true) && !in_array($disk->getName(), $hideDisks, true)) {
$mount = $fs->addChild('Mount');
if (in_array($disk->getFsType(), $ignoreThreshold, true)) {
$disk->setIgnore(3);
} elseif (in_array($disk->getMountPoint(), $ignoreUsage, true)) {
$disk->setIgnore(2);
} elseif (in_array($disk->getMountPoint(), $ignoreFree, true)) {
$disk->setIgnore(1);
}
$this->_fillDevice($mount, $disk, $i++);
}
}
}
 
/**
* generate the motherboard information
*
* @return void
*/
private function _buildMbinfo()
{
$mbinfo = $this->_xml->addChild('MBInfo');
$temp = $fan = $volt = $power = $current = $other = null;
 
if (sizeof(unserialize(PSI_MBINFO))>0) {
foreach (unserialize(PSI_MBINFO) as $mbinfoclass) {
$mbinfo_data = new $mbinfoclass();
$mbinfo_detail = $mbinfo_data->getMBInfo();
 
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='temperature') foreach ($mbinfo_detail->getMbTemp() as $dev) {
if ($temp == null) {
$temp = $mbinfo->addChild('Temperature');
}
$item = $temp->addChild('Item');
$item->addAttribute('Label', $dev->getName());
$item->addAttribute('Value', $dev->getValue());
if ($dev->getMax() !== null) {
$item->addAttribute('Max', $dev->getMax());
}
if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") {
$item->addAttribute('Event', $dev->getEvent());
}
}
 
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='fans') foreach ($mbinfo_detail->getMbFan() as $dev) {
if ($fan == null) {
$fan = $mbinfo->addChild('Fans');
}
$item = $fan->addChild('Item');
$item->addAttribute('Label', $dev->getName());
$item->addAttribute('Value', $dev->getValue());
if ($dev->getMin() !== null) {
$item->addAttribute('Min', $dev->getMin());
}
if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") {
$item->addAttribute('Event', $dev->getEvent());
}
}
 
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='voltage') foreach ($mbinfo_detail->getMbVolt() as $dev) {
if ($volt == null) {
$volt = $mbinfo->addChild('Voltage');
}
$item = $volt->addChild('Item');
$item->addAttribute('Label', $dev->getName());
$item->addAttribute('Value', $dev->getValue());
if ($dev->getMin() !== null) {
$item->addAttribute('Min', $dev->getMin());
}
if ($dev->getMax() !== null) {
$item->addAttribute('Max', $dev->getMax());
}
if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") {
$item->addAttribute('Event', $dev->getEvent());
}
}
 
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='power') foreach ($mbinfo_detail->getMbPower() as $dev) {
if ($power == null) {
$power = $mbinfo->addChild('Power');
}
$item = $power->addChild('Item');
$item->addAttribute('Label', $dev->getName());
$item->addAttribute('Value', $dev->getValue());
if ($dev->getMax() !== null) {
$item->addAttribute('Max', $dev->getMax());
}
if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") {
$item->addAttribute('Event', $dev->getEvent());
}
}
 
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='current') foreach ($mbinfo_detail->getMbCurrent() as $dev) {
if ($current == null) {
$current = $mbinfo->addChild('Current');
}
$item = $current->addChild('Item');
$item->addAttribute('Label', $dev->getName());
$item->addAttribute('Value', $dev->getValue());
if ($dev->getMin() !== null) {
$item->addAttribute('Min', $dev->getMin());
}
if ($dev->getMax() !== null) {
$item->addAttribute('Max', $dev->getMax());
}
if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") {
$item->addAttribute('Event', $dev->getEvent());
}
}
 
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='other') foreach ($mbinfo_detail->getMbOther() as $dev) {
if ($other == null) {
$other = $mbinfo->addChild('Other');
}
$item = $other->addChild('Item');
$item->addAttribute('Label', $dev->getName());
$item->addAttribute('Value', $dev->getValue());
if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") {
$item->addAttribute('Event', $dev->getEvent());
}
}
}
}
}
 
/**
* generate the ups information
*
* @return void
*/
private function _buildUpsinfo()
{
$upsinfo = $this->_xml->addChild('UPSInfo');
if (defined('PSI_UPS_APCUPSD_CGI_ENABLE') && PSI_UPS_APCUPSD_CGI_ENABLE) {
$upsinfo->addAttribute('ApcupsdCgiLinks', true);
}
if (sizeof(unserialize(PSI_UPSINFO))>0) {
foreach (unserialize(PSI_UPSINFO) as $upsinfoclass) {
$upsinfo_data = new $upsinfoclass();
$upsinfo_detail = $upsinfo_data->getUPSInfo();
foreach ($upsinfo_detail->getUpsDevices() as $ups) {
$item = $upsinfo->addChild('UPS');
$item->addAttribute('Name', $ups->getName());
if ($ups->getModel() !== "") {
$item->addAttribute('Model', $ups->getModel());
}
if ($ups->getMode() !== "") {
$item->addAttribute('Mode', $ups->getMode());
}
if ($ups->getStartTime() !== "") {
$item->addAttribute('StartTime', $ups->getStartTime());
}
$item->addAttribute('Status', $ups->getStatus());
if ($ups->getTemperatur() !== null) {
$item->addAttribute('Temperature', $ups->getTemperatur());
}
if ($ups->getOutages() !== null) {
$item->addAttribute('OutagesCount', $ups->getOutages());
}
if ($ups->getLastOutage() !== null) {
$item->addAttribute('LastOutage', $ups->getLastOutage());
}
if ($ups->getLastOutageFinish() !== null) {
$item->addAttribute('LastOutageFinish', $ups->getLastOutageFinish());
}
if ($ups->getLineVoltage() !== null) {
$item->addAttribute('LineVoltage', $ups->getLineVoltage());
}
if ($ups->getLineFrequency() !== null) {
$item->addAttribute('LineFrequency', $ups->getLineFrequency());
}
if ($ups->getLoad() !== null) {
$item->addAttribute('LoadPercent', $ups->getLoad());
}
if ($ups->getBatteryDate() !== null) {
$item->addAttribute('BatteryDate', $ups->getBatteryDate());
}
if ($ups->getBatteryVoltage() !== null) {
$item->addAttribute('BatteryVoltage', $ups->getBatteryVoltage());
}
if ($ups->getBatterCharge() !== null) {
$item->addAttribute('BatteryChargePercent', $ups->getBatterCharge());
}
if ($ups->getTimeLeft() !== null) {
$item->addAttribute('TimeLeftMinutes', $ups->getTimeLeft());
}
}
}
}
}
 
/**
* generate the xml document
*
* @return void
*/
private function _buildXml()
{
if (!$this->_plugin_request || $this->_complete_request) {
if ($this->_sys === null) {
if (PSI_DEBUG === true) {
// unstable version check
if (!is_numeric(substr(PSI_VERSION, -1))) {
$this->_errors->addError("WARN", "This is an unstable version of phpSysInfo, some things may not work correctly");
}
 
// Safe mode check
$safe_mode = @ini_get("safe_mode") ? true : false;
if ($safe_mode) {
$this->_errors->addError("WARN", "PhpSysInfo requires to set off 'safe_mode' in 'php.ini'");
}
// Include path check
$include_path = @ini_get("include_path");
if ($include_path && ($include_path!="")) {
$include_path = preg_replace("/(:)|(;)/", "\n", $include_path);
if (preg_match("/^\.$/m", $include_path)) {
$include_path = ".";
}
}
if ($include_path != ".") {
$this->_errors->addError("WARN", "PhpSysInfo requires '.' inside the 'include_path' in php.ini");
}
// popen mode check
if (defined("PSI_MODE_POPEN") && PSI_MODE_POPEN === true) {
$this->_errors->addError("WARN", "Installed version of PHP does not support proc_open() function, popen() is used");
}
}
$this->_sys = $this->_sysinfo->getSys();
}
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='vitals') $this->_buildVitals();
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='network') $this->_buildNetwork();
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='hardware') $this->_buildHardware();
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='memory') $this->_buildMemory();
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='filesystem') $this->_buildFilesystems();
if (!$this->_sysinfo->getBlockName() || in_array($this->_sysinfo->getBlockName(), array('voltage','current','temperature','fans','power','other'))) $this->_buildMbinfo();
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='ups') $this->_buildUpsinfo();
}
if (!$this->_sysinfo->getBlockName()) $this->_buildPlugins();
$this->_xml->combinexml($this->_errors->errorsAddToXML($this->_sysinfo->getEncoding()));
}
 
/**
* get the xml object
*
* @return SimpleXmlElement
*/
public function getXml()
{
$this->_buildXml();
 
return $this->_xml->getSimpleXmlElement();
}
 
/**
* include xml-trees of the plugins to the main xml
*
* @return void
*/
private function _buildPlugins()
{
$pluginroot = $this->_xml->addChild("Plugins");
if (($this->_plugin_request || $this->_complete_request) && count($this->_plugins) > 0) {
$plugins = array();
if ($this->_complete_request) {
$plugins = $this->_plugins;
}
if ($this->_plugin_request) {
$plugins = array($this->_plugin);
}
foreach ($plugins as $plugin) {
$object = new $plugin($this->_sysinfo->getEncoding());
$object->execute();
$oxml = $object->xml();
if (sizeof($oxml) > 0) {
$pluginroot->combinexml($oxml);
}
}
}
}
 
/**
* build the xml structure where the content can be inserted
*
* @return void
*/
private function _xmlbody()
{
$dom = new DOMDocument('1.0', 'UTF-8');
$root = $dom->createElement("tns:phpsysinfo");
$root->setAttribute('xmlns:tns', 'http://phpsysinfo.sourceforge.net/');
$root->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
$root->setAttribute('xsi:schemaLocation', 'http://phpsysinfo.sourceforge.net/ phpsysinfo3.xsd');
$dom->appendChild($root);
$this->_xml = new SimpleXMLExtended(simplexml_import_dom($dom), $this->_sysinfo->getEncoding());
 
$generation = $this->_xml->addChild('Generation');
$generation->addAttribute('version', PSI_VERSION_STRING);
$generation->addAttribute('timestamp', time());
$options = $this->_xml->addChild('Options');
$options->addAttribute('tempFormat', defined('PSI_TEMP_FORMAT') ? strtolower(PSI_TEMP_FORMAT) : 'c');
$options->addAttribute('byteFormat', defined('PSI_BYTE_FORMAT') ? strtolower(PSI_BYTE_FORMAT) : 'auto_binary');
$options->addAttribute('datetimeFormat', defined('PSI_DATETIME_FORMAT') ? strtolower(PSI_DATETIME_FORMAT) : 'utc');
if (defined('PSI_REFRESH')) {
$options->addAttribute('refresh', max(intval(PSI_REFRESH), 0));
} else {
$options->addAttribute('refresh', 60000);
}
if (defined('PSI_FS_USAGE_THRESHOLD')) {
if ((($fsut = intval(PSI_FS_USAGE_THRESHOLD)) >= 1) && ($fsut <= 99)) {
$options->addAttribute('threshold', $fsut);
}
} else {
$options->addAttribute('threshold', 90);
}
if (count($this->_plugins) > 0) {
if ($this->_plugin_request) {
$plug = $this->_xml->addChild('UsedPlugins');
$plug->addChild('Plugin')->addAttribute('name', $this->_plugin);
} elseif ($this->_complete_request) {
$plug = $this->_xml->addChild('UsedPlugins');
foreach ($this->_plugins as $plugin) {
$plug->addChild('Plugin')->addAttribute('name', $plugin);
}
/*
} else {
$plug = $this->_xml->addChild('UnusedPlugins');
foreach ($this->_plugins as $plugin) {
$plug->addChild('Plugin')->addAttribute('name', $plugin);
}
*/
}
}
}
}
/web/acc/phpsysinfo/index.php
1,331 → 1,95
<?php
// 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: index.php,v 1.122.4.1 2007/08/19 09:21:57 xqus Exp $
// phpsysinfo release version number
$VERSION = "2.5.4";
$startTime = array_sum( explode( " ", microtime() ) );
<?php
/**
* start page for webaccess
* redirect the user to the supported page type by the users webbrowser (js available or not)
*
* PHP version 5
*
* @category PHP
* @package PSI
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: index.php 687 2012-09-06 20:54:49Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* define the application root path on the webserver
* @var string
*/
define('PSI_APP_ROOT', dirname(__FILE__));
 
define('APP_ROOT', dirname(__FILE__));
define('IN_PHPSYSINFO', true);
 
ini_set('magic_quotes_runtime', 'off');
ini_set('register_globals', 'off');
// ini_set('display_errors','on');
 
require_once(APP_ROOT . '/includes/class.error.inc.php');
$error = new Error;
 
// Figure out which OS where running on, and detect support
if ( file_exists( APP_ROOT . '/includes/os/class.' . PHP_OS . '.inc.php' ) ) {
} else {
$error->addError('include(class.' . PHP_OS . '.php.inc)' , PHP_OS . ' is not currently supported', __LINE__, __FILE__ );
if (version_compare("5.1.3", PHP_VERSION, ">")) {
die("PHP 5.1.3 or greater is required!!!");
}
 
if (!extension_loaded('xml')) {
$error->addError('extension_loaded(xml)', 'phpsysinfo requires the xml module for php to work', __LINE__, __FILE__);
}
if (!extension_loaded('pcre')) {
$error->addError('extension_loaded(pcre)', 'phpsysinfo requires the pcre module for php to work', __LINE__, __FILE__);
}
 
if (!file_exists(APP_ROOT . '/config.php')) {
$error->addError('file_exists(config.php)', 'config.php does not exist in the phpsysinfo directory.', __LINE__, __FILE__);
} else {
require_once(APP_ROOT . '/config.php'); // get the config file
if (!extension_loaded("pcre")) {
die("phpSysInfo requires the pcre extension to php in order to work properly.");
}
 
if ( !empty( $sensor_program ) ) {
$sensor_program = basename( $sensor_program );
if( !file_exists( APP_ROOT . '/includes/mb/class.' . $sensor_program . '.inc.php' ) ) {
$error->addError('include(class.' . htmlspecialchars($sensor_program, ENT_QUOTES) . '.inc.php)', 'specified sensor programm is not supported', __LINE__, __FILE__ );
}
}
require_once PSI_APP_ROOT.'/includes/autoloader.inc.php';
 
if ( !empty( $hddtemp_avail ) && $hddtemp_avail != "tcp" && $hddtemp_avail != "suid" ) {
$error->addError('include(class.hddtemp.inc.php)', 'bad configuration in config.php for $hddtemp_avail', __LINE__, __FILE__ );
}
// Load configuration
require_once PSI_APP_ROOT.'/read_config.php';
 
if( $error->ErrorsExist() ) {
echo $error->ErrorsAsHTML();
exit;
if (!defined('PSI_CONFIG_FILE') || !defined('PSI_DEBUG')) {
$tpl = new Template("/templates/html/error_config.html");
echo $tpl->fetch();
die();
}
 
require_once(APP_ROOT . '/includes/common_functions.php'); // Set of common functions used through out the app
 
// commented for security
// Check to see if where running inside of phpGroupWare
//if (file_exists("../header.inc.php") && isset($_REQUEST['sessionid']) && $_REQUEST['sessionid'] && $_REQUEST['kp3'] && $_REQUEST['domain']) {
// define('PHPGROUPWARE', 1);
// $phpgw_info['flags'] = array('currentapp' => 'phpsysinfo-dev');
// include('../header.inc.php');
//} else {
// define('PHPGROUPWARE', 0);
//}
 
// DEFINE TEMPLATE_SET
if (isset($_POST['template'])) {
$template = $_POST['template'];
} elseif (isset($_GET['template'])) {
$template = $_GET['template'];
} elseif (isset($_COOKIE['template'])) {
$template = $_COOKIE['template'];
} else {
$template = $default_template;
}
 
// check to see if we have a random
if ($template == 'random') {
$buf = gdc( APP_ROOT . "/templates/" );
$template = $buf[array_rand($buf, 1)];
}
 
if ($template != 'xml' && $template != 'wml') {
// figure out if the template exists
$template = basename($template);
if (!file_exists(APP_ROOT . "/templates/" . $template)) {
// use default if not exists.
$template = $default_template;
}
// Store the current template name in a cookie, set expire date to 30 days later
// if template is xml then skip
// setcookie("template", $template, (time() + 60 * 60 * 24 * 30));
// $_COOKIE['template'] = $template; //update COOKIE Var
}
 
// get our current language
// default to english, but this is negotiable.
if ($template == "wml") {
$lng = "en";
} elseif (isset($_POST['lng'])) {
$lng = $_POST['lng'];
} elseif (isset($_GET['lng'])) {
$lng = $_GET['lng'];
} elseif (isset($_COOKIE['lng'])) {
$lng = $_COOKIE['lng'];
} else {
$lng = $default_lng;
}
 
if ($lng == 'browser') {
// see if the browser knows the right languange.
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$plng = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
if (count($plng) > 0) {
while (list($k, $v) = each($plng)) {
$k = explode(';', $v, 1);
$k = explode('-', $k[0]);
if (file_exists(APP_ROOT . '/includes/lang/' . $k[0] . '.php')) {
$lng = $k[0];
break;
}
}
// redirect to page with and without javascript
$display = strtolower(isset($_GET['disp']) ? $_GET['disp'] : PSI_DEFAULT_DISPLAY_MODE);
switch ($display) {
case "static":
$webpage = new WebpageXSLT();
$webpage->run();
break;
case "dynamic":
$webpage = new Webpage();
$webpage->run();
break;
case "xml":
$webpage = new WebpageXML("complete");
$webpage->run();
break;
case "json":
$webpage = new WebpageXML("complete");
$json = $webpage->getJsonString();
header("Cache-Control: no-cache, must-revalidate\n");
header("Content-Type: application/json\n\n");
echo $json;
break;
case "bootstrap":
/*
$tpl = new Template("/templates/html/index_bootstrap.html");
echo $tpl->fetch();
*/
$webpage = new Webpage("bootstrap");
$webpage->run();
break;
case "auto":
$tpl = new Template("/templates/html/index_all.html");
echo $tpl->fetch();
break;
default:
$defaultdisplay = strtolower(PSI_DEFAULT_DISPLAY_MODE);
switch ($defaultdisplay) {
case "static":
$webpage = new WebpageXSLT();
$webpage->run();
break;
case "dynamic":
$webpage = new Webpage();
$webpage->run();
break;
case "bootstrap":
$webpage = new Webpage("bootstrap");
$webpage->run();
break;
default:
$tpl = new Template("/templates/html/index_all.html");
echo $tpl->fetch();
break;
}
}
break;
}
 
//Add for Alcasar : 'fr' or 'en' only because some variables aren't defined in other languages
if($lng != 'fr') $lng = "en";
 
$lng = basename($lng);
if (file_exists(APP_ROOT . '/includes/lang/' . $lng . '.php')) {
//$charset = 'iso-8859-1';
$charset = 'utf-8'; //modif fait pour integration alcasar
require_once(APP_ROOT . '/includes/lang/' . $lng . '.php'); // get our language include
// Store the current language selection in a cookie, set expire date to 30 days later
// setcookie("lng", $lng, (time() + 60 * 60 * 24 * 30));
// $_COOKIE['lng'] = $lng; //update COOKIE Var
} else {
$error->addError('include(' . $lng . ')', 'we do not support this language', __LINE__, __FILE__ );
$lng = $default_lng;
}
 
// include the files and create the instances
define('TEMPLATE_SET', $template);
require_once( APP_ROOT . '/includes/os/class.' . PHP_OS . '.inc.php' );
$sysinfo = new sysinfo;
if( !empty( $sensor_program ) ) {
require_once(APP_ROOT . '/includes/mb/class.' . $sensor_program . '.inc.php');
$mbinfo = new mbinfo;
}
if ( !empty($hddtemp_avail ) ) {
require_once(APP_ROOT . '/includes/mb/class.hddtemp.inc.php');
}
 
require_once(APP_ROOT . '/includes/xml/vitals.php');
require_once(APP_ROOT . '/includes/xml/network.php');
require_once(APP_ROOT . '/includes/xml/hardware.php');
require_once(APP_ROOT . '/includes/xml/portail.php');
//require_once(APP_ROOT . '/includes/xml/utilisateur.php');
require_once(APP_ROOT . '/includes/xml/memory.php');
require_once(APP_ROOT . '/includes/xml/filesystems.php');
require_once(APP_ROOT . '/includes/xml/mbinfo.php');
require_once(APP_ROOT . '/includes/xml/hddtemp.php');
 
// build the xml
$xml = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
$xml .= "<!DOCTYPE phpsysinfo SYSTEM \"phpsysinfo.dtd\">\n\n";
$xml .= created_by();
$xml .= "<phpsysinfo>\n";
$xml .= " <Generation version=\"$VERSION\" timestamp=\"" . time() . "\"/>\n";
$xml .= xml_vitals();
$xml .= xml_network();
$xml .= xml_hardware();
$xml .= xml_portail();
$xml .= xml_memory();
$xml .= xml_filesystems();
if ( !empty( $sensor_program ) ) {
$xml .= xml_mbinfo();
}
if ( !empty($hddtemp_avail ) ) {
$hddtemp = new hddtemp;
$xml .= xml_hddtemp();
}
$xml .= "</phpsysinfo>";
replace_specialchars($xml);
 
// output
if (TEMPLATE_SET == 'xml') {
// just printout the XML and exit
header("Content-Type: text/xml\n\n");
print $xml;
} elseif (TEMPLATE_SET == 'wml') {
require_once(APP_ROOT . '/includes/XPath.class.php');
$XPath = new XPath();
$XPath->importFromString($xml);
 
header("Content-type: text/vnd.wap.wml; charset=iso-8859-1");
header("");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
 
echo "<?xml version='1.0' encoding='iso-8859-1'?>\n";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\" >\n";
echo "<wml>\n";
echo "<card id=\"start\" title=\"phpSysInfo - Menu\">\n";
echo "<p><a href=\"#vitals\">" . $text['vitals'] . "</a></p>\n";
echo "<p><a href=\"#network\">" . $text['netusage'] . "</a></p>\n";
echo "<p><a href=\"#memory\">" . $text['memusage'] . "</a></p>\n";
echo "<p><a href=\"#filesystem\">" . $text['fs'] . "</a></p>\n";
if (!empty($sensor_program) || (isset($hddtemp_avail) && $hddtemp_avail)) {
echo "<p><a href=\"#temp\">" . $text['temperature'] . "</a></p>\n";
}
if (!empty($sensor_program)) {
echo "<p><a href=\"#fans\">" . $text['fans'] . "</a></p>\n";
echo "<p><a href=\"#volt\">" . $text['voltage'] . "</a></p>\n";
}
echo "</card>\n";
echo wml_vitals();
echo wml_network();
echo wml_memory();
echo wml_filesystem();
$temp = "";
if (!empty($sensor_program)) {
echo wml_mbfans();
echo wml_mbvoltage();
$temp .= wml_mbtemp();
}
if (isset($hddtemp_avail) && $hddtemp_avail)
if ($XPath->match("/phpsysinfo/HDDTemp/Item"))
$temp .= wml_hddtemp();
if(strlen($temp) > 0)
echo "<card id=\"temp\" title=\"" . $text['temperature'] . "\">\n" . $temp . "</card>\n";
echo "</wml>\n";
 
} else {
$image_height = get_gif_image_height(APP_ROOT . '/templates/' . TEMPLATE_SET . '/images/bar_middle.gif');
define('BAR_HEIGHT', $image_height);
 
// if (PHPGROUPWARE != 1) {
require_once(APP_ROOT . '/includes/class.Template.inc.php'); // template library
// }
// fire up the template engine
$tpl = new Template(APP_ROOT . '/templates/' . TEMPLATE_SET);
$tpl->set_file(array('form' => 'form.tpl'));
// print out a box of information
function makebox ($title, $content)
{
if (empty($content)) {
return "";
} else {
global $webpath;
$textdir = direction();
$t = new Template(APP_ROOT . '/templates/' . TEMPLATE_SET);
$t->set_file(array('box' => 'box.tpl'));
$t->set_var('title', $title);
$t->set_var('content', $content);
$t->set_var('webpath', $webpath);
$t->set_var('text_dir', $textdir['direction']);
return $t->parse('out', 'box');
}
}
// Fire off the XPath class
require_once(APP_ROOT . '/includes/XPath.class.php');
$XPath = new XPath();
$XPath->importFromString($xml);
// let the page begin.
require_once(APP_ROOT . '/includes/system_header.php');
 
$tpl->set_var('title', $text['title'] . ': ' . $XPath->getData('/phpsysinfo/Vitals/Hostname') . ' (' . $XPath->getData('/phpsysinfo/Vitals/IPAddr') . ')');
$tpl->set_var('vitals', makebox($text['vitals'], html_vitals()));
// rajout pour integrer les utilisateurs du portail captif
$tpl->set_var('portail', makebox($text['portail'], html_portail()));
// $tpl->set_var('utilisateur', makebox($text['portail'], html_utilisateur()));
$tpl->set_var('memory', makebox($text['memusage'], html_memory()));
$tpl->set_var('filesystems', makebox($text['fs'], html_filesystems()));
$tpl->set_var('network', makebox($text['netusage'], html_network()));
$tpl->set_var('hardware', makebox($text['hardware'], html_hardware()));
// Timo van Roermund: change the condition for showing the temperature, voltage and fans section
$html_temp = "";
if (!empty($sensor_program)) {
if ($XPath->match("/phpsysinfo/MBinfo/Temperature/Item")) {
$html_temp = html_mbtemp();
}
if ($XPath->match("/phpsysinfo/MBinfo/Fans/Item")) {
$tpl->set_var('mbfans', makebox($text['fans'], html_mbfans()));
} else {
$tpl->set_var('mbfans', '');
};
if ($XPath->match("/phpsysinfo/MBinfo/Voltage/Item")) {
$tpl->set_var('mbvoltage', makebox($text['voltage'], html_mbvoltage()));
} else {
$tpl->set_var('mbvoltage', '');
};
}
if (isset($hddtemp_avail) && $hddtemp_avail) {
if ($XPath->match("/phpsysinfo/HDDTemp/Item")) {
$html_temp .= html_hddtemp();
};
}
if (strlen($html_temp) > 0) {
$tpl->set_var('mbtemp', makebox($text['temperature'], "\n<table width=\"100%\">\n" . $html_temp . "</table>\n"));
}
 
if ( $error->ErrorsExist() && isset($showerrors) && $showerrors ) {
$tpl->set_var('errors', makebox("ERRORS", $error->ErrorsAsHTML() ));
}
// parse our the template
$tpl->pfp('out', 'form');
// finally our print our footer
// if (PHPGROUPWARE == 1) {
// $phpgw->common->phpgw_footer();
// } else {
// require_once(APP_ROOT . '/includes/system_footer.php');
// }
}
 
?>
/web/acc/phpsysinfo/js.php
0,0 → 1,85
<?php
/**
* compress js files and send them to the browser on the fly
*
* PHP version 5
*
* @category PHP
* @package PSI_JS
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: js.php 661 2012-08-27 11:26:39Z namiltd $
* @link http://phpsysinfo.sourceforge.net
*/
/**
* application root path
*
* @var string
*/
define('PSI_APP_ROOT', dirname(__FILE__));
 
require_once PSI_APP_ROOT.'/includes/autoloader.inc.php';
 
require_once PSI_APP_ROOT.'/read_config.php';
 
$file = isset($_GET['name']) ? basename(htmlspecialchars($_GET['name'])) : null;
$plugin = isset($_GET['plugin']) ? basename(htmlspecialchars($_GET['plugin'])) : null;
$script = null;
 
if ($file != null && $plugin == null) {
if (strtolower(substr($file, 0, 6)) == 'jquery') {
$script = PSI_APP_ROOT.'/js/jQuery/'.$file;
} elseif (strtolower(substr($file, 0, 10)) == 'phpsysinfo') {
$script = PSI_APP_ROOT.'/js/phpSysInfo/'.$file;
} else {
$script = PSI_APP_ROOT.'/js/vendor/'.$file;
}
} elseif ($file == null && $plugin != null) {
$script = PSI_APP_ROOT.'/plugins/'.strtolower($plugin).'/js/'.strtolower($plugin);
} elseif ($file != null && $plugin != null) {
$script = PSI_APP_ROOT.'/plugins/'.strtolower($plugin).'/js/'.strtolower($file);
}
 
if ($script != null) {
$scriptjs = $script.'.js';
$scriptmin = $script.'.min.js';
$compression = false;
 
header("content-type: application/x-javascript");
 
if ((!defined("PSI_DEBUG") || (PSI_DEBUG !== true)) && defined("PSI_JS_COMPRESSION")) {
$compression = strtolower(PSI_JS_COMPRESSION);
}
switch ($compression) {
case "normal":
if (file_exists($scriptmin) && is_readable($scriptmin)) {
$filecontent = file_get_contents($scriptmin);
echo $filecontent;
} elseif (file_exists($scriptjs) && is_readable($scriptjs)) {
$filecontent = file_get_contents($scriptjs);
$packer = new JavaScriptPacker($filecontent);
echo $packer->pack();
}
break;
case "none":
if (file_exists($scriptjs) && is_readable($scriptjs)) {
$filecontent = file_get_contents($scriptjs);
$packer = new JavaScriptPacker($filecontent, 0);
echo $packer->pack();
} elseif (file_exists($scriptmin) && is_readable($scriptmin)) {
$filecontent = file_get_contents($scriptmin);
echo $filecontent;
}
break;
default:
if (file_exists($scriptjs) && is_readable($scriptjs)) {
$filecontent = file_get_contents($scriptjs);
} elseif (file_exists($scriptmin) && is_readable($scriptmin)) {
$filecontent = file_get_contents($scriptmin);
} else break;
 
echo $filecontent;
break;
}
}
/web/acc/phpsysinfo/phpsysinfo.ini
0,0 → 1,824
; PSI Config File
;
; @category PHP
; @package PSI
; @author Michael Cramer <BigMichi1@users.sourceforge.net>
; @copyright 2009 phpSysInfo
; @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
; @version SVN: $Id: phpsysinfo.ini.new 705 2012-11-11 00:33:29Z namiltd $
; @link http://phpsysinfo.sourceforge.net
 
[main]
; ********************************
; MAIN PARAMETERS
; ********************************
 
; Turn on debugging of some functions and include errors and warnings in xml and provide a popup for displaying errors
; - false : no debug information are stored in xml or displayed
; - true : debug information stored in xml and displayed *be careful if set this to true, may include sensitive information from your pc*
;
DEBUG=false
 
; Turn on logging/unlogging of functions executeProgram() and rfts()
; example : executeProgram () and rfts () record the results to the "/tmp/phpsysinfo.log" file
; LOG="/tmp/phpsysinfo.log"
; example : executeProgram () and rfts () read the results from the "/tmp/phpsysinfo.log" file
; LOG="-/tmp/phpsysinfo.log"
; example : executeProgram () and rfts () read the results from the "/tmp/phpsysinfo.log" file
; LOG="+/tmp/phpsysinfo.log", if lack in the log file it runs normally
;
LOG=false
 
; Turn on/off compression for JavaScript file
; - JS_COMPRESSION=false //no compression (recommended with slow processor)
; - JS_COMPRESSION="None" //code minimizing
; - JS_COMPRESSION="Normal" //code packing
;
JS_COMPRESSION="Normal"
 
; Additional paths where to look for installed programs
; Example : ADD_PATHS="/opt/bin,/opt/sbin"
;
ADD_PATHS=false
 
; List of IP addresses of clients authorized to run
; Example : ALLOWED="127.0.0.1,192.168.1.48" //allowed IP 127.0.0.1 and 192.168.1.48
; ALLOWED=false //no IP checking
;
ALLOWED=false
 
; List of sudo commands
; Example : SUDO_COMMANDS="iptables-save" //execute "sudo iptables-save" instead "iptables-save"
; SUDO_COMMANDS=false //no sudo commands
;
SUDO_COMMANDS=false
 
; Order of data blocks
; Example : BLOCKS="vitals,hardware,memory,filesystem,network,voltage,current,temperature,fans,power,other,ups" or BLOCKS=true //default order
; BLOCKS=false //hide all blocks
;
BLOCKS=true
 
 
; Plugins that should be included in xml and output
; List of plugins should look like "plugin,plugin,plugin". See /plugins directory
; - PLUGINS="MDStatus,PS" //list of plugins
; - PLUGINS=false //no plugins
; included plugins:
; - Raid - show the software, fake, zpool or megaraid RAID status
; - PS - show a process tree of all running processes
; - PSStatus - show a graphical representation if a process is running or not
; - Quotas - show a table with all quotas that are active and there current state
; - SMART - show S.M.A.R.T. information from drives that support it
; - BAT - show battery state on a laptop, tablet or phone
; - UpdateNotifier - show update notifications (only for Ubuntu server)
; - SNMPPInfo - show printers info via SNMP
; - Uprecords - show uprecords info
; - Iptables - show iptables rules list
; - PingTest - show Ping Test info
; - StableBit - show StableBit Scanner info (WinNT)
; - HyperV - show Hyper-V info (WinNT)
; - Docker - show docker stats
;
PLUGINS=false
 
 
; ********************************
; DISPLAY PARAMETERS
; ********************************
 
 
; Define the default display mode
; auto: let user browser choose the mode
; dynamic: use javascript to refresh data
; static: static page (use metatag to reload page)
; bootstrap: use twitter bootstrap template
;
DEFAULT_DISPLAY_MODE="dynamic"
 
 
; Define the default language
;
DEFAULT_LANG="en"
 
 
; Define the default template
;
DEFAULT_TEMPLATE="cream"
 
 
; Define the default template for frontend "bootstrap"
;
DEFAULT_BOOTSTRAP_TEMPLATE="phpsysinfo"
 
 
; Show or hide language picklist
;
SHOW_PICKLIST_LANG=false
 
 
; Show or hide template picklist
;
SHOW_PICKLIST_TEMPLATE=false
 
 
; Show CPU list expanded
;
SHOW_CPULIST_EXPANDED=false
 
 
; Show CPU info expanded
;
SHOW_CPUINFO_EXPANDED=false
 
 
; Show memory infos expanded
;
SHOW_MEMORY_INFOS_EXPANDED=false
 
 
; Hide loader for frontend "bootstrap"
;
HIDE_BOOTSTRAP_LOADER=true
 
 
; Define the interval for refreshing data in ms
; - 0 : disabled
; - 1000 : 1 second
; Default is 60 seconds
;
REFRESH=60000
 
 
; Show a graph for current cpuload
; - true : displayed, but it's a performance hit (because we have to wait to get a value, 1 second)
; - "compact" : displayed like above but in compact mode
; - false : will not be displayed
;
LOAD_BAR=true
 
 
; Display the virtual host name and address
; - Default is canonical host name and address
; - Use USE_VHOST=true to display virtual host name.
;
USE_VHOST=false
 
 
; Controls the units & format for network, memory and filesystem
; - 1 KiB = 2^10 bytes = 1,024 bytes
; - 1 KB = 10^3 bytes = 1,000 bytes
; - "B" everything is in Byte
; - "PiB" everything is in PeBiByte
; - "TiB" everything is in TeBiByte
; - "GiB" everything is in GiBiByte
; - "MiB" everything is in MeBiByte
; - "KiB" everything is in KiBiByte
; - "auto_binary" everything is automatic done if value is to big for, e.g MiB then it will be in GiB
; - "PB" everything is in PetaByte
; - "TB" everything is in TeraByte
; - "GB" everything is in GigaByte
; - "MB" everything is in MegaByte
; - "KB" everything is in KiloByte
; - "auto_decimal" everything is automatic done if value is to big for, e.g MB then it will be in GB
;
BYTE_FORMAT="auto_binary"
 
 
; Format in which temperature is displayed
; - "c" shown in celsius
; - "f" shown in fahrenheit
; - "c-f" both shown first celsius and fahrenheit in braces
; - "f-c" both shown first fahrenheit and celsius in braces
;
TEMP_FORMAT="c"
 
 
; Show devices infos
; Example : SHOW_DEVICES_INFOS=true
;
SHOW_DEVICES_INFOS=false
 
 
; Show devices serial number
; Example : SHOW_DEVICES_SERIAL=true
;
SHOW_DEVICES_SERIAL=false
 
 
; Format in which datetime is displayed
; - "UTC" shown as UTC string
; - "locale" shown as Locale string
;
DATETIME_FORMAT="UTC"
 
 
; ********************************
; SENSORS PARAMETERS
; ********************************
 
 
; Define the motherboard monitoring program
; We support the following programs so far
; - HDDtemp http://www.guzu.net/linux/hddtemp.php (Linux)
; - LMSensors http://www.lm-sensors.org/ (Linux)
; - Healthd http://healthd.thehousleys.net/ (FreeBSD)
; - HWSensors http://www.openbsd.org/ (OpenBSD)
; - MBMon http://www.nt.phys.kyushu-u.ac.jp/shimizu/download/download.html (FreeBSD/Linux/NetBSD/OpenBSD)
; - MBM5 http://mbm.livewiredev.com/ (data from file data/MBM5.csv - WinNT)
; - Coretemp No addon tool neded (FreeBSD/Linux)
; - IPMItool http://ipmitool.sourceforge.net/ (Linux)
; - FreeIPMI http://www.gnu.org/software/freeipmi/ (FreeBSD/Linux/OpenBSD/SunOS)
; - IPMIutil http://ipmiutil.sourceforge.net/ (Darwin/FreeBSD/Linux/SunOS/WinNT)
; - K8Temp http://hur.st/k8temp/ (DragonFly/FreeBSD/NetBSD/OpenBSD)
; - PiTemp No addon tool neded (Raspberry Pi and Banana Pi - Linux)
; - OHM http://openhardwaremonitor.org/ (WinNT)
; - ThermalZone No addon tool neded (WinNT/Linux/Android)
; - QTSsnmp SNMP service enabled and snmp-utils package installed: opkg install snmp-utils (QNAP - QTS Linux)
; - Hwmon No addon tool neded (Linux)
; - SpeedFan http://www.almico.com/speedfan.php (required tool packaged in: tools/speedfan/SpeedFanGet_bin.zip) (WinNT)
; - Thinkpad No addon tool neded (Lenovo Thinkpad - Linux)
;
; Example: If you want to use lmsensors : SENSOR_PROGRAM="LMSensors"
; If you want to use lmsensors and IPMItool: SENSOR_PROGRAM="LMSensors,IPMItool"
;
SENSOR_PROGRAM=false
 
 
; Show events of sensors
; - true : show events
; - false : do not show events
;
SENSOR_EVENTS=true
 
 
; Sort sensors list
;
SORT_SENSORS_LIST=false
 
 
; Some sensors programs contain an additional configuration in the relevant sections [sensor_...]
 
 
; ********************************
; FILESYSTEM PARAMETERS
; ********************************
 
 
; Show mount point
; - true : show mount point
; - false : do not show mount point
;
SHOW_MOUNT_POINT=true
 
 
; Show mount option
; - true : show mount option
; - false : do not show mount option
;
SHOW_MOUNT_OPTION=true
 
 
; Show mount credentials
; - true : show mount credentials
; - false : do not show mount credentials
;
SHOW_MOUNT_CREDENTIALS=false
 
 
; Show inode usage
; - true : display used inodes in percent
; - false : hide them
;
SHOW_INODES=false
 
 
; Hide mounts
; Example : HIDE_MOUNTS="/home,/usr"
;
; HIDE_MOUNTS="/dev,/dev/shm,/run,/run/user/0,/var/tmp/havp,/sys/fs/cgroup"
HIDE_MOUNTS=""
 
 
; Filesystem usage warning threshold in percent
; - 0 : disabled
; - 90 : 90%
; Default is 90%
;
FS_USAGE_THRESHOLD=90
 
 
; Ignore usage and usage threshold for filesystem types
; Example : IGNORE_THRESHOLD_FS_TYPES="iso9660, squashfs, devfs, devtmpfs, lxfs, udf, UDF, CDFS"
;
IGNORE_THRESHOLD_FS_TYPES="iso9660, squashfs, devfs, devtmpfs, lxfs, udf, UDF, CDFS"
 
 
; Ignore usage of mounts
; Example : IGNORE_USAGE="/root,/mnt/c"
;
IGNORE_USAGE=""
 
 
; Ignore free space size of mounts
; Example : IGNORE_FREE="/zfs/space,/zfs/data"
;
IGNORE_FREE=""
 
 
; Hide filesystem types
; Example : HIDE_FS_TYPES="tmpfs,devtmpfs,usbfs,bstfolder"
;
HIDE_FS_TYPES="tmpfs,devtmpfs"
 
 
; Hide partitions
; Example : HIDE_DISKS="rootfs,/dev/sda1"
; HIDE_DISKS=true //hide all partitions
;
HIDE_DISKS=""
 
 
; ********************************
; NETWORK PARAMETERS
; ********************************
 
 
; Hide network interfaces
; Example : HIDE_NETWORK_INTERFACE="eth0,sit0"
; HIDE_NETWORK_INTERFACE=true //hide all network interfaces
;
HIDE_NETWORK_INTERFACE="lo,tun0"
 
 
; Show network interfaces infos for Linux, Android, FreeBSD, NetBSD, OpenBSD, Haiku, Darwin, SunOS, Minix, QNX and WinNT
; Example : SHOW_NETWORK_INFOS=true
;
SHOW_NETWORK_INFOS=true
 
 
; Hide MAC address in the infos
;
HIDE_NETWORK_MACADDR=false
 
 
; Sort network interfaces list
;
SORT_NETWORK_INTERFACES_LIST=false
 
 
; Show network infos expanded
;
SHOW_NETWORK_INFOS_EXPANDED=false
 
 
; Show network active speed
; - true : display network active speed
; - "bps" : display network active speed in bits per second (b/s, Kb/s, etc...)
; - false : hide them
;
SHOW_NETWORK_ACTIVE_SPEED=true
 
 
; ********************************
; UPS PARAMETERS
; ********************************
 
 
; Define the ups monitoring program
; We support the following programs so far
; - Apcupsd http://www.apcupsd.com/
; - Nut http://www.networkupstools.org/
; - PowerSoftPlus http://ever.eu/
; - pmset based on the result of the command "pmset -g batt" on Darwin system
; - SNMPups monitoring via Simple Network Management Protocol (SNMP)
;
; Example: If you want to use Apcupsd : UPS_PROGRAM="Apcupsd"
; If you want to use Apcupsd and Nut : UPS_PROGRAM="Apcupsd,Nut"
;
UPS_PROGRAM=false
 
 
; Apcupsd supports multiple UPSes
; You can specify comma delimited list in the form <hostname>:<port> or <ip>:<port>. The defaults are: 127.0.0.1:3551
; See the following parameters in apcupsd.conf: NETSERVER, NISIP, NISPORT
; It uses the defaults if not specified.
;
UPS_APCUPSD_LIST=false
 
 
; Apcupsd has a CGI monitoring utility called apcupsd-cgi
; You can set the parameter below to true if you have it installed - this will add apcupsd-cgi links to the UPS tree
;
UPS_APCUPSD_CGI_ENABLE=false
 
 
; Nut supports multiple UPSes
; You can specify comma delimited list in the form <hostname>:<port> or <ip>:<port>. The defaults are: 127.0.0.1:3493
; See the following parameters in upsd.conf: LISTEN
; It uses the defaults if not specified.
;
UPS_NUT_LIST=false
 
 
; SNMPups supports multiple UPSes
; You can specify comma delimited list in the form <hostname>:<port> or <ip>:<port>. The default port is 161
; List must be specified.
;
UPS_SNMPUPS_LIST=false
 
 
; define how to access the SNMP data
; - "php-snmp" execute php snmprealwalk function (php-snmp module must be installed)
; - "command" execute snmpwalk command
;
UPS_SNMPUPS_ACCESS="php-snmp"
 
 
; ********************************
; SENSORS PROGRAMS PARAMETERS
; ********************************
 
 
[sensor_hddtemp]
; Hddtemp motherboard monitoring program configuration
;
; If the hddtemp program is available we can read the temperature, if hdd is smart capable
; !!ATTENTION!! hddtemp might be a security issue
; - ACCESS="command" //read data from 'hddtemp' command (must be set suid)
; - ACCESS="tcp" //read data from hddtemp deamon (localhost:7634)
;
ACCESS="command"
 
[sensor_lmsensors]
; LMSensors motherboard monitoring program configuration
;
; - ACCESS="command" //read data from 'sensors' command
; - ACCESS="data" //read data from file data/lmsensors.txt
;
ACCESS="command"
 
[sensor_healthd]
; Healthd motherboard monitoring program configuration
;
; - ACCESS="command" //read data from 'healthdc' command
; - ACCESS="data" //read data from file data/healthd.txt
;
ACCESS="command"
 
[sensor_mbmon]
; MBMon motherboard monitoring program configuration
;
; - ACCESS="command" //read data from 'mbmon -c 1 -r' command
; - ACCESS="data" //read data from file data/mbmon.txt
; - ACCESS="tcp" //read data from mbmon deamon (localhost:411)
;
ACCESS="command"
 
[sensor_ipmitool]
; IPMItool motherboard monitoring program configuration
;
; - ACCESS="command" //read data from 'ipmitool sensor -v' command
; //if access error execute first: chmod 666 /dev/ipmi0
; - ACCESS="data" //read data from file data/ipmitool.txt
;
ACCESS="command"
 
[sensor_freeipmi]
; FreeIPMI motherboard monitoring program configuration
;
; - ACCESS="command" //read data from 'ipmi-sensors --output-sensor-thresholds' program
; - ACCESS="data" //read data from file data/freeipmi.txt
;
ACCESS="command"
 
[sensor_ipmiutil]
; IPMIutil motherboard monitoring program configuration
;
; - ACCESS="command" //read data from 'ipmiutil sensor -stw' command
; //if access error execute first: chmod 666 /dev/ipmi0
; - ACCESS="data" //read data from file data/ipmiutil.txt
;
ACCESS="command"
 
[sensor_k8temp]
; K8Temp motherboard monitoring program configuration
;
; - ACCESS="command" //read data from 'k8temp' command
; - ACCESS="data" //read data from file data/k8temp.txt
;
ACCESS="command"
 
[sensor_speedfan]
; SpeedFan motherboard monitoring program configuration
;
; - ACCESS="command" //read data from 'speedfanget' command
; - ACCESS="data" //read data from file data/speedfan.txt
;
ACCESS="command"
 
 
; ********************************
; PLUGINS PARAMETERS
; ********************************
 
 
[bat]
; BAT Plugin configuration
 
; define how to access the battery statistic data
; - "command" on Linux and Android read data from /proc/acpi/battery/BAT0/info and /proc/acpi/battery/BAT0/state
; or on newer kernel from /sys/class/power_supply/
; or from 'upower -d' command (if UPOWER is true)
; on Android read data from /sys/class/power_supply/
; on Darwin read data from 'ioreg -w0 -l -n AppleSmartBattery -r' command
; on FreeBSD read data from 'acpiconf -i batt' command
; on OpenBSD read data from 'sysctl hw.sensors.acpibat0' command
; - "data" (a file must be available in the data directory of the phpsysinfo installation
; with the filename "bat_info.txt" and "bat_state.txt"; content is the output
; from "cat /proc/acpi/battery/BAT0/info" and "cat /proc/acpi/battery/BAT0/state")
;
ACCESS="command"
 
; on Lunux try executing 'upower -d' command
;
UPOWER=false
 
; Show battery serial number
;
SHOW_SERIAL=false
 
 
[raid]
; Raid Plugin configuration
 
; define how to access the raid statistic data
; - "command" - mdstat: file "/proc/mdstat" is read (on Linux only)
; - dmraid: command "dmraid -s -vv 2>&1" is run (on Linux only)
; If access error try execute first: chmod 4755 /sbin/dmraid
; This method is not recommended for safety reasons!
; - megactl: command "megactl" (on Linux only)
; downloaded from http://sourceforge.net/projects/megactl/ or http://github.com/hmage/megactl
; If permission error try execute first: chmod 4755 /usr/sbin/megactl
; - megasasctl: command "megasasctl" (on Linux only)
; downloaded from http://sourceforge.net/projects/megactl/ or http://github.com/hmage/megactl
; If permission error try execute first: chmod 4755 /usr/sbin/megasasctl
; - graid: command "graid list" is run (on FreeBSD only)
; - zpool: command "zpool status" is run
; - idrac: command "snmpwalk -Ona -c public -v 1 -r 0 -t 3 {device} .1.3.6.1.4.1.674.10892.5.5.1.20" is run
; - "php-snmp"- idrac: execute php snmprealwalk function (php-snmp module must be installed)
; - for others the option is inactive (uses "command" instead)
; - "data" (a file must be available in the data directory of the phpsysinfo installation
; with the filename "raidmdstat.txt" or "raiddmraid.txt" or "raidmegactl.txt"
; or "raidmegasasctl" or "raidgraid.txt" or "raidzpool.txt" or "raididrac{device_number}.txt")
;
ACCESS="command"
 
; define possible programs
PROGRAM="mdstat,dmraid,megactl,megasasctl,graid,zpool,idrac"
 
; Hide RAID devices
; Example : HIDE_DEVICES="md127"
;
HIDE_DEVICES=""
 
;
; string contains a list of IDRAC devices that are checked
; Example : IDRAC_DEVICES="192.168.0.120"
;
IDRAC_DEVICES=""
 
[ps]
; PS Plugin configuration
 
; define how to access the ps statistic data
; - "command" ps command is run everytime the block gets refreshed or build / on WINNT
; information is retrieved everytime through WMI
; - "data" (a file must be available in the data directory of the phpsysinfo installation
; with the filename "ps.txt"; content is the output from "ps -axo pid,ppid,pmem,args")
;
ACCESS="command"
 
; Memory Usage info
;
MEMORY_USAGE=true
 
; CPU Usage info
;
CPU_USAGE=true
 
; Show kthreadd child list expanded
;
SHOW_KTHREADD_EXPANDED=false
 
; Show PID 1 child list expanded
;
SHOW_PID1CHILD_EXPANDED=false
 
 
[psstatus]
; PSStatus Plugin configuration
 
; define how to access the psstatus statistic data
; - "command" pidof command is run everytime the block gets refreshed or build / on WINNT
; information is retrieved everytime through WMI
; - "data" a file must be available in the data directory of the phpsysinfo installation
; with the filename "psstatus.txt"; content is the output from
; <code>for ps in "apache2" "mysqld" "sshd"; do echo $ps "|" `pidof -s -x "$ps"`; done</code>
;
ACCESS="command"
 
; Regular expression search in the process name (e.g. "ddclient.*")
; - true : Regular expression search (used pgrep command)
; - false : Normal search (used pidof command)
;
USE_REGEX=false
 
; controls which processes are checked if they are running
;
; string contains a list of process names that are checked, names are seperated by a comma (on WINNT names must end with '.exe')
;
PROCESSES="mysqld, sshd, explorer.exe"
 
 
[quotas]
; Quotas Plugin configuration
 
; define how to access the repquota statistic data
; - "command" repquota command is run everytime the block gets refreshed or build
; - "data" (a file must be available in the data directory of the phpsysinfo installation with the filename "quotas.txt"; content is the output from "repquota -au")
;
ACCESS="command"
 
 
[smart]
; SMART Plugin configuration
 
; Smartctl program
; If the smartctl program is available we can read S.M.A.R.T informations
; - "command" smartctl command is run everytime the block gets refreshed or build
; if error: Smartctl open device: /dev/sda failed: Permission denied
; Not recommended method:
; execute: chmod 4755 /usr/sbin/smartctl
; Second method:
; try to set: SUDO_COMMANDS="smartctl" and add to file /etc/sudoers line: apache ALL = (ALL) NOPASSWD: /usr/sbin/smartctl
; - "data" (a file must be available in the data directory of the
; phpsysinfo installation with the filename "smart{disk_number}.txt";
; content is the output from "smartctl --all device")
; - "wmi" information is retrieved everytime through WMI (WinNT only)
;
ACCESS="command"
 
; Smartctl devices to monitor
; If the smartctl support is enabled, those disks information will be displayed
; - DEVICES="/dev/hda,/dev/hdb" //Will display those two disks informations
; You also can specify --device option value for smartctl command surrounded by parentheses eg:
; - DEVICES="(marvell)/dev/sda"
; or
; - DEVICES="(megaraid.0)/dev/sda" //comma in --device option value is replaced by a dot
;
DEVICES="/dev/sda, /dev/sdb"
 
; Smartctl ID# and column name from "Vendor Specific SMART Attributes with Thresholds" table
; If the smartctl support is enabled, enter the ID#-COLUMN_NAME from "Vendor Specific SMART Attributes with Thresholds" table from smartctl output.
; or for no SCSI devices: ID#-COLUMN_NAME-REPLACEMENT_ID# where REPLACEMENT_ID# is an alternative ID number.
; COLUMN_NAME of this ID# will be displayed in the phpsysinfo S.M.A.R.T table. If you want RAW_VALUE to be displayed for the temperature (ID# 194) enter 194-RAW_VALUE
; - IDS="194-VALUE,4-VALUE,009-RAW_VALUE" //ID#-COLUMN_NAME, ID#-COLUMN_NAME, etc...
;
IDS="005-RAW_VALUE,194-RAW_VALUE,4-RAW_VALUE,009-RAW_VALUE,012-RAW_VALUE,193-RAW_VALUE-225,001-RAW_VALUE,007-RAW_VALUE,200-RAW_VALUE,197-RAW_VALUE,198-RAW_VALUE"
 
 
[snmppinfo]
; SNMPPInfo Plugin configuration
 
; define how to access the SNMP Printer Info statistic data
; - "php-snmp" execute php snmprealwalk function (php-snmp module must be installed)
; - "command" execute snmpwalk command
; - "data" a file must be available in the data directory of the
; phpsysinfo installation with the filename "snmppinfo{printer_number}.txt";
; content is the output from:
; LANG=C LC_ALL=C snmpwalk -On -c public -v 1 -r 0 -t 3 {printer_address} .1.3.6.1.2.1.1.5 > snmppinfo{printer_number}.txt
; LANG=C LC_ALL=C snmpwalk -On -c public -v 1 -r 0 -t 3 {printer_address} .1.3.6.1.4.1.367.3.2.1.2.24.1.1 >> snmppinfo{printer_number}.txt
; LANG=C LC_ALL=C snmpwalk -On -c public -v 1 -r 0 -t 3 {printer_address} .1.3.6.1.2.1.43.11.1.1 >> snmppinfo{printer_number}.txt
; LANG=C LC_ALL=C snmpwalk -On -c public -v 1 -r 0 -t 3 {printer_address} .1.3.6.1.2.1.43.18.1.1 >> snmppinfo{printer_number}.txt
;
ACCESS="php-snmp"
 
;define the Printer devices
;
; string contains a list of printer addresses that are checked
;
DEVICES="192.168.0.5, 192.168.0.9"
 
 
[updatenotifier]
; Update Notifier Plugin configuration
 
; define how to access the updatenotifier statistic data
; - "command" execute command /usr/lib/update-notifier/apt-check
; - "data" reads data from file defined in FILE parameter
;
ACCESS="data"
 
; define the update info file format
; - true: Ubuntu Landscape format (file: /var/lib/update-notifier/updates-available)
; - false: universal format (format: A;B)
; A: total packages to update
; B: security packages to update
;
UBUNTU_LANDSCAPE_FORMAT=true
 
; define the update info file. The default is: /var/lib/update-notifier/updates-available
;
FILE="/var/lib/update-notifier/updates-available"
 
 
[uprecords]
; Uprecords Plugin configuration
 
; define how to access the uprecords statistic data
; - "command" uprecords command is run everytime the block gets refreshed or build
; if access error try execute first: chmod 4755 /usr/bin/uprecords
; This method is not recommended for safety reasons!
; - "data" (a file must be available in the data directory of the phpsysinfo installation
; with the filename "uprecords.txt"; content is the output from "TZ=GMT uprecords -a -w")
;
ACCESS="command"
 
; define the maximum number of entries to show (for command access)
; default is 10
;
MAX_ENTRIES = 10
 
; define the short mode (do not print extra statistics)
; default is false
;
SHORT_MODE = false
 
; denote current system session by asterisk (* at the end) instead by the arrow (-> at the beginning)
; default is false
;
DENOTE_BY_ASTERISK = false
 
 
[iptables]
; Iptables Plugin configuration
 
; define how to access the iptables rules data
; - "command" iptables-save command is run everytime the block gets refreshed or build
; if access error try to set: SUDO_COMMANDS="iptables-save" and add to file /etc/sudoers line: apache ALL = (ALL) NOPASSWD: /sbin/iptables-save
; - "data" (a file must be available in the data directory of the phpsysinfo installation with the filename "iptables.txt"; content is the output from "iptables-save")
;
ACCESS="command"
 
 
[pingtest]
; PingTest Plugin configuration
 
; define how to access the psstatus statistic data
; - "command" ping command is run everytime the block gets refreshed or build
; - "data" (a file must be available in the data directory of the phpsysinfo installation
; with the filename "pingtest.txt")
;
ACCESS="command"
 
;define the Addresses
;
; string contains a list of addresses that are checked
; Example : ADDRESSES="127.0.0.1,8.8.8.8"
;
ADDRESSES=""
 
; Define ping timeout in seconds
; - 0 : default ping command timeout
; - 3 : 3 seconds
; Default is 2 seconds
;
TIMEOUT=2
 
[stablebit]
; StableBit Plugin configuration
 
; Show or hide disks serial number
;
SHOW_SERIAL=false
 
[hyperv]
; HyperV Plugin configuration
 
; define how to access the ps statistic data
; - "command" information is retrieved through WMI
; - "data" (a file must be available in the data directory of the phpsysinfo installation
; with the filename "hyperv.txt")
;
ACCESS="command"
 
[docker]
; Docker Plugin configuration
 
; define how to access the docker statistic data
; - "command" docker command is run everytime the block gets refreshed or build
; - "data" (a file must be available in the data directory of the phpsysinfo installation
; with the filename "docker.txt"; content is the output from "docker stats --no-stream --format 'table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}\t{{.NetIO}}\t{{.BlockIO}}\t{{.PIDs}}'")
;
ACCESS="command"
/web/acc/phpsysinfo/phpsysinfo.xslt
0,0 → 1,1409
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: phpsysinfo.xslt 699 2012-09-15 11:57:13Z namiltd $ -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:output version="4.0" method="html" indent="no"
encoding="UTF-8" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/html4/loose.dtd" />
<xsl:param name="SV_OutputFormat" select="'HTML'" />
<xsl:variable name="XML" select="/" />
<xsl:template match="/">
<html>
<head>
<title>
<xsl:text>phpSysInfo</xsl:text>
</title>
<style type="text/css">
<xsl:comment>
@import url("templates/phpsysinfo.css");
</xsl:comment>
</style>
<link href="gfx/favicon.gif" rel="shortcut icon" />
</head>
<body>
<xsl:for-each select="$XML">
<xsl:for-each select="*">
<div>
<xsl:for-each select="Vitals">
<h1 id="title" style="_color: #000; /* ie6 fix */">
<span>
<xsl:text>System information : </xsl:text>
</span>
<xsl:value-of select="@Hostname" />
<span>
<xsl:text> (</xsl:text>
</span>
<xsl:value-of select="@IPAddr" />
<span>
<xsl:text>)</xsl:text>
</span>
</h1>
</xsl:for-each>
<div id="vitals">
<xsl:for-each select="Vitals">
<h2>
<span>
<xsl:text>System Vital</xsl:text>
</span>
</h2>
<div style="overflow-x:auto;">
<table border="0" style="border-spacing:0;"
class="stripMe" id="vitalsTable"
width="100%">
<tbody>
<tr>
<td style="width:160px;">
<span>
<xsl:text>Canonical Hostname</xsl:text>
</span>
</td>
<td>
<xsl:value-of
select="@Hostname" />
</td>
</tr>
<tr class="odd">
<td style="width:160px;">
<span>
<xsl:text>Listening IP</xsl:text>
</span>
</td>
<td>
<xsl:value-of
select="@IPAddr" />
</td>
</tr>
<tr>
<td style="width:160px;">
<span>
<xsl:text>Kernel Version</xsl:text>
</span>
</td>
<td>
<xsl:value-of
select="@Kernel" />
</td>
</tr>
<tr class="odd">
<td style="width:160px;">
<span>
<xsl:text>Distro Name</xsl:text>
</span>
</td>
<td>
<img
style="height:16px; width:16px;">
<xsl:attribute
name="src">
<xsl:if
test="substring(string(concat(&apos;gfx/images/&apos;,@Distroicon)), 2, 1) = ':'">
<xsl:text>file:///</xsl:text>
</xsl:if>
<xsl:value-of
select="translate(string(concat(&apos;gfx/images/&apos;,@Distroicon)), '&#x5c;', '/')" />
</xsl:attribute>
<xsl:attribute
name="alt" />
</img>
<span>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</span>
<span>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</span>
<xsl:value-of
select="@Distro" />
</td>
</tr>
<tr class="odd">
<td style="width:160px;">
<span>
<xsl:text>OS Type</xsl:text>
</span>
</td>
<td>
<img
style="height:16px; width:16px;">
<xsl:attribute
name="src">
<xsl:if
test="substring(string(concat(&apos;gfx/images/&apos;,@OS,&apos;.png&apos;)), 2, 1) = ':'">
<xsl:text>file:///</xsl:text>
</xsl:if>
<xsl:value-of
select="translate(string(concat(&apos;gfx/images/&apos;,@OS,&apos;.png&apos;)), '&#x5c;', '/')" />
</xsl:attribute>
<xsl:attribute
name="alt" />
</img>
<span>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</span>
<span>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</span>
<xsl:value-of
select="@OS" />
</td>
</tr>
<tr>
<td style="width:160px;">
<span>
<xsl:text>Uptime</xsl:text>
</span>
</td>
<td>
<span>
<xsl:value-of
select="floor( @Uptime div 60 div 60 div 24)" />
</span>
<span>
<xsl:text> Days </xsl:text>
</span>
<span>
<xsl:value-of
select="floor( ( @Uptime div 60 div 60) - ( floor( @Uptime div 60 div 60 div 24) * 24) )" />
</span>
<span>
<xsl:text> Hours </xsl:text>
</span>
<span>
<xsl:value-of
select="floor( @Uptime div 60 - ( floor( @Uptime div 60 div 60 div 24) * 60 * 24) - ( floor( ( @Uptime div 60 div 60) - ( floor( @Uptime div 60 div 60 div 24) * 24) ) * 60) )" />
</span>
<span>
<xsl:text> Minutes</xsl:text>
</span>
</td>
</tr>
<tr class="odd">
<td style="width:160px;">
<span>
<xsl:text>Current Users</xsl:text>
</span>
</td>
<td>
<xsl:value-of
select="@Users" />
</td>
</tr>
<tr>
<td style="width:160px;">
<span>
<xsl:text>Load Averages</xsl:text>
</span>
</td>
<td>
<xsl:value-of
select="@LoadAvg" />
<xsl:if
test="count(@CPULoad )&gt;0">
<xsl:text disable-output-escaping="yes">&lt;br/&gt;</xsl:text>
<div
style="float:left; width:{concat( CPULoad , &apos;px&apos; )}; "
class="bar">
<span>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</span>
</div>
<div
style="float:left; ">
<span>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</span>
<xsl:value-of
select="round(@CPULoad)" />
<span>
<xsl:text>%</xsl:text>
</span>
</div>
</xsl:if>
</td>
</tr>
<xsl:if
test="count(@SysLang )&gt;0">
<tr class="odd">
<td style="width:160px;">
<span>
<xsl:text>System Language</xsl:text>
</span>
</td>
<td>
<xsl:value-of
select="@SysLang" />
</td>
</tr>
</xsl:if>
<xsl:if
test="count(@CodePage )&gt;0">
<tr class="odd">
<td style="width:160px;">
<span>
<xsl:text>Code Page</xsl:text>
</span>
</td>
<td>
<xsl:value-of
select="@CodePage" />
</td>
</tr>
</xsl:if>
<xsl:if
test="count(@Processes )&gt;0">
<tr class="odd">
<td style="width:160px;">
<span>
<xsl:text>Processes</xsl:text>
</span>
</td>
<td>
<xsl:value-of
select="@Processes" />
</td>
</tr>
</xsl:if>
</tbody>
</table>
</div>
</xsl:for-each>
</div>
<div id="hardware">
<xsl:for-each select="Hardware">
<h2>
<span>
<xsl:text>Hardware Information</xsl:text>
</span>
</h2>
<div style="overflow-x:auto;">
<xsl:if
test="count(@Name )&gt;0">
<table border="0" style="border-spacing:0;"
width="100%">
<tbody>
<tr class="odd">
<td style="width:160px;">
<span>
<xsl:text>Machine</xsl:text>
</span>
</td>
<td>
<xsl:value-of
select="@Name" />
</td>
</tr>
</tbody>
</table>
</xsl:if>
<xsl:for-each select="CPU">
<table border="0" style="border-spacing:0;"
width="100%">
<tbody>
<tr class="odd">
<td style="width:160px;">
<span>
<xsl:text>Processors</xsl:text>
</span>
</td>
<td>
<xsl:value-of
select="count(CpuCore)" />
</td>
</tr>
<xsl:for-each
select="CpuCore">
<xsl:if
test="count(@Model )&gt;0">
<tr class="odd">
<td
style="width:160px;">
<span>
<xsl:text>Model</xsl:text>
</span>
</td>
<td>
<xsl:value-of
select="@Model" />
</td>
</tr>
</xsl:if>
<xsl:if
test="count(@CpuSpeed )&gt;0">
<tr>
<td
style="width:160px;">
<span>
<xsl:text>CPU Speed</xsl:text>
</span>
</td>
<td>
<xsl:value-of
select="@CpuSpeed" />
<span>
<xsl:text> MHz</xsl:text>
</span>
</td>
</tr>
</xsl:if>
<xsl:if
test="count(@CpuSpeedMax )&gt;0">
<tr>
<td
style="width:160px;">
<span>
<xsl:text>CPU Speed Max</xsl:text>
</span>
</td>
<td>
<xsl:value-of
select="@CpuSpeedMax" />
<span>
<xsl:text> MHz</xsl:text>
</span>
</td>
</tr>
</xsl:if>
<xsl:if
test="count(@CpuSpeedMin )&gt;0">
<tr>
<td
style="width:160px;">
<span>
<xsl:text>CPU Speed Min</xsl:text>
</span>
</td>
<td>
<xsl:value-of
select="@CpuSpeedMin" />
<span>
<xsl:text> MHz</xsl:text>
</span>
</td>
</tr>
</xsl:if>
<xsl:if
test="count(@Cache )&gt;0">
<tr>
<td
style="width:160px;">
<span>
<xsl:text>Cache Size</xsl:text>
</span>
</td>
<td>
<xsl:value-of
select="round(@Cache div 1024)" />
<span>
<xsl:text> KiB</xsl:text>
</span>
</td>
</tr>
</xsl:if>
<xsl:if
test="count(@Virt )&gt;0">
<tr class="odd">
<td
style="width:160px;">
<span>
<xsl:text>Virtualization</xsl:text>
</span>
</td>
<td>
<xsl:value-of
select="@Virt" />
</td>
</tr>
</xsl:if>
<xsl:if
test="count(@BusSpeed )&gt;0">
<tr class="odd">
<td
style="width:160px;">
<span>
<xsl:text>Bus Speed</xsl:text>
</span>
</td>
<td>
<xsl:value-of
select="@BusSpeed" />
<span>
<xsl:text> MHz</xsl:text>
</span>
</td>
</tr>
</xsl:if>
<xsl:if
test="count(@Bogomips )&gt;0">
<tr class="odd">
<td
style="width:160px;">
<span>
<xsl:text>System Bogomips</xsl:text>
</span>
</td>
<td>
<xsl:value-of
select="round(@Bogomips)" />
</td>
</tr>
</xsl:if>
<xsl:if
test="count(@Manufacturer )&gt;0">
<tr class="odd">
<td
style="width:160px;">
<span>
<xsl:text>Manufacturer</xsl:text>
</span>
</td>
<td>
<xsl:value-of
select="@Manufacturer" />
</td>
</tr>
</xsl:if>
<xsl:if
test="count(@Load )&gt;0">
<tr class="odd">
<td
style="width:160px;">
<span>
<xsl:text>Load Averages</xsl:text>
</span>
</td>
<td>
<xsl:value-of
select="round(@Load)" />
<span>
<xsl:text>%</xsl:text>
</span>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</tbody>
</table>
</xsl:for-each>
<xsl:for-each select="PCI">
<h3>
<span>
<xsl:text>PCI Devices</xsl:text>
</span>
</h3>
<table style="display:block; border-spacing:0;"
id="pciTable"
width="100%">
<tbody>
<tr>
<td>
<ul
style="margin-left:10px;">
<xsl:for-each
select="Device">
<li>
<xsl:if
test="count(@Count )&gt;0">
<xsl:if
test="round(@Count) &gt;1">
<span>
<xsl:text>(</xsl:text>
</span>
<xsl:value-of select="round(@Count)" />
<span>
<xsl:text>x) </xsl:text>
</span>
</xsl:if>
</xsl:if>
<xsl:value-of
select="@Name" />
</li>
</xsl:for-each>
</ul>
</td>
</tr>
</tbody>
</table>
</xsl:for-each>
<xsl:for-each select="IDE">
<h3 class="odd">
<span>
<xsl:text>IDE Devices</xsl:text>
</span>
</h3>
<table style="display:block; border-spacing:0;"
class="odd" id="ideTable"
width="100%">
<tbody>
<tr>
<td>
<ul
style="margin-left:10px;">
<xsl:for-each
select="Device">
<li>
<xsl:if
test="count(@Count )&gt;0">
<xsl:if
test="round(@Count) &gt;1">
<span>
<xsl:text>(</xsl:text>
</span>
<xsl:value-of select="round(@Count)" />
<span>
<xsl:text>x) </xsl:text>
</span>
</xsl:if>
</xsl:if>
<xsl:value-of
select="@Name" />
<xsl:if
test="count(@Capacity )&gt;0">
<span>
<xsl:text> (</xsl:text>
</span>
<xsl:value-of select="round(@Capacity div 1024)" />
<span>
<xsl:text> KiB)</xsl:text>
</span>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</td>
</tr>
</tbody>
</table>
</xsl:for-each>
<xsl:for-each select="SCSI">
<h3>
<span>
<xsl:text>SCSI Devices</xsl:text>
</span>
</h3>
<table style="border-spacing:0;"
id="scsiTable"
width="100%">
<tbody>
<tr>
<td
style="display:block;">
<ul
style="margin-left:10px;">
<xsl:for-each
select="Device">
<li>
<xsl:if
test="count(@Count )&gt;0">
<xsl:if
test="round(@Count) &gt;1">
<span>
<xsl:text>(</xsl:text>
</span>
<xsl:value-of select="round(@Count)" />
<span>
<xsl:text>x) </xsl:text>
</span>
</xsl:if>
</xsl:if>
<xsl:value-of
select="@Name" />
<xsl:if
test="count(@Capacity )&gt;0">
<span>
<xsl:text> (</xsl:text>
</span>
<xsl:value-of select="round(@Capacity div 1024)" />
<span>
<xsl:text> KiB)</xsl:text>
</span>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</td>
</tr>
</tbody>
</table>
</xsl:for-each>
<xsl:for-each select="NVMe">
<h3>
<span>
<xsl:text>NVMe Devices</xsl:text>
</span>
</h3>
<table style="border-spacing:0;"
id="nvmeTable"
width="100%">
<tbody>
<tr>
<td
style="display:block;">
<ul
style="margin-left:10px;">
<xsl:for-each
select="Device">
<li>
<xsl:if
test="count(@Count )&gt;0">
<xsl:if
test="round(@Count) &gt;1">
<span>
<xsl:text>(</xsl:text>
</span>
<xsl:value-of select="round(@Count)" />
<span>
<xsl:text>x) </xsl:text>
</span>
</xsl:if>
</xsl:if>
<xsl:value-of
select="@Name" />
<xsl:if
test="count(@Capacity )&gt;0">
<span>
<xsl:text> (</xsl:text>
</span>
<xsl:value-of select="round(@Capacity div 1024)" />
<span>
<xsl:text> KiB)</xsl:text>
</span>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</td>
</tr>
</tbody>
</table>
</xsl:for-each>
<xsl:for-each select="USB">
<h3 class="odd">
<span>
<xsl:text>USB Devices</xsl:text>
</span>
</h3>
<table style="border-spacing:0;"
class="odd" id="usbTable"
width="100%">
<tbody>
<tr>
<td>
<ul
style="margin-left:10px;">
<xsl:for-each
select="Device">
<li>
<xsl:if
test="count(@Count )&gt;0">
<xsl:if
test="round(@Count) &gt;1">
<span>
<xsl:text>(</xsl:text>
</span>
<xsl:value-of select="round(@Count)" />
<span>
<xsl:text>x) </xsl:text>
</span>
</xsl:if>
</xsl:if>
<xsl:value-of
select="@Name" />
</li>
</xsl:for-each>
</ul>
</td>
</tr>
</tbody>
</table>
</xsl:for-each>
<xsl:for-each select="TB">
<h3 class="odd">
<span>
<xsl:text>TB Devices</xsl:text>
</span>
</h3>
<table style="border-spacing:0;"
class="odd" id="tbTable"
width="100%">
<tbody>
<tr>
<td>
<ul
style="margin-left:10px;">
<xsl:for-each
select="Device">
<li>
<xsl:if
test="count(@Count )&gt;0">
<xsl:if
test="round(@Count) &gt;1">
<span>
<xsl:text>(</xsl:text>
</span>
<xsl:value-of select="round(@Count)" />
<span>
<xsl:text>x) </xsl:text>
</span>
</xsl:if>
</xsl:if>
<xsl:value-of
select="@Name" />
</li>
</xsl:for-each>
</ul>
</td>
</tr>
</tbody>
</table>
</xsl:for-each>
<xsl:for-each select="I2C">
<h3 class="odd">
<span>
<xsl:text>I2C Devices</xsl:text>
</span>
</h3>
<table style="border-spacing:0;"
class="odd" id="i2cTable"
width="100%">
<tbody>
<tr>
<td>
<ul
style="margin-left:10px;">
<xsl:for-each
select="Device">
<li>
<xsl:if
test="count(@Count )&gt;0">
<xsl:if
test="round(@Count) &gt;1">
<span>
<xsl:text>(</xsl:text>
</span>
<xsl:value-of select="round(@Count)" />
<span>
<xsl:text>x) </xsl:text>
</span>
</xsl:if>
</xsl:if>
<xsl:value-of
select="@Name" />
</li>
</xsl:for-each>
</ul>
</td>
</tr>
</tbody>
</table>
</xsl:for-each>
</div>
</xsl:for-each>
</div>
<div id="memory">
<xsl:for-each select="Memory">
<h2>
<span>
<xsl:text>Memory Usage</xsl:text>
</span>
</h2>
<div style="overflow-x:auto;">
<table border="0"
style="border-spacing:0;">
<thead>
<tr>
<th style="width:200px;">
<span>
<xsl:text>Type</xsl:text>
</span>
</th>
<th style="width:285px;">
<span>
<xsl:text>Usage</xsl:text>
</span>
</th>
<th style="width:100px;"
class="right">
<span>
<xsl:text>Free</xsl:text>
</span>
</th>
<th style="width:100px;"
class="right">
<span>
<xsl:text>Used</xsl:text>
</span>
</th>
<th style="width:100px;"
class="right">
<span>
<xsl:text>Size</xsl:text>
</span>
</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="width:200px;">
<span>
<xsl:text>Physical Memory</xsl:text>
</span>
</td>
<td style="width:285px;">
<div
style="float:left; width:{concat( @Percent , &apos;px&apos; )}; "
class="bar">
<span>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</span>
</div>
<div style="float:left; ">
<span>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</span>
<xsl:value-of
select="@Percent" />
<span>
<xsl:text>%</xsl:text>
</span>
</div>
</td>
<td style="width:100px;"
class="right">
<xsl:value-of
select="round(@Free div 1024)" />
<span>
<xsl:text> KiB</xsl:text>
</span>
</td>
<td style="width:100px;"
class="right">
<xsl:value-of
select="round(@Used div 1024)" />
<span>
<xsl:text> KiB</xsl:text>
</span>
</td>
<td style="width:100px;"
class="right">
<xsl:value-of
select="round(@Total div 1024)" />
<span>
<xsl:text> KiB</xsl:text>
</span>
</td>
</tr>
<xsl:for-each
select="Details">
<xsl:if
test="count(@* )&gt;0">
<xsl:if
test="count(@App )&gt;0">
<tr>
<td
style="width:200px;">
<span>
<xsl:text>- Kernel + applications</xsl:text>
</span>
</td>
<td
style="width:285px;">
<div
style="float:left; width:{concat( @AppPercent , &apos;px&apos; )}; "
class="bar">
<span>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</span>
</div>
<div
style="float:left; ">
<span>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</span>
<xsl:value-of
select="@AppPercent" />
<span>
<xsl:text>%</xsl:text>
</span>
</div>
</td>
<td
style="width:100px;"
class="right" />
<td
style="width:100px;"
class="right">
<xsl:value-of
select="round(@App div 1024)" />
<span>
<xsl:text> KiB</xsl:text>
</span>
</td>
<td
style="width:100px;"
class="right" />
</tr>
</xsl:if>
<xsl:if
test="count(@Cached )&gt;0">
<tr>
<td
style="width:200px;">
<span>
<xsl:text>- Cached</xsl:text>
</span>
</td>
<td
style="width:285px;">
<div
style="float:left; width:{concat( @CachedPercent , &apos;px&apos; )}; "
class="bar">
<span>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</span>
</div>
<div
style="float:left; ">
<span>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</span>
<xsl:value-of
select="@CachedPercent" />
<span>
<xsl:text>%</xsl:text>
</span>
</div>
</td>
<td
style="width:100px;"
class="right" />
<td
style="width:100px;"
class="right">
<xsl:value-of
select="round(@Cached div 1024)" />
<span>
<xsl:text> KiB</xsl:text>
</span>
</td>
<td
style="width:100px;"
class="right" />
</tr>
</xsl:if>
<xsl:if
test="count(@Buffers )&gt;0">
<tr>
<td
style="width:200px;">
<span>
<xsl:text>- Buffers</xsl:text>
</span>
</td>
<td
style="width:285px;">
<div
style="float:left; width:{concat( @BuffersPercent , &apos;px&apos; )}; "
class="bar">
<span>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</span>
</div>
<div
style="float:left; ">
<span>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</span>
<xsl:value-of
select="@BuffersPercent" />
<span>
<xsl:text>%</xsl:text>
</span>
</div>
</td>
<td
style="width:100px;"
class="right" />
<td
style="width:100px;"
class="right">
<xsl:value-of
select="round(@Buffers div 1024)" />
<span>
<xsl:text> KiB</xsl:text>
</span>
</td>
<td
style="width:100px;"
class="right" />
</tr>
</xsl:if>
</xsl:if>
</xsl:for-each>
</tbody>
</table>
<xsl:for-each select="Swap">
<table border="0"
style="border-spacing:0;"
width="100%">
<tbody>
<tr class="odd">
<td style="width:200px;">
<span>
<xsl:text>Disk Swap</xsl:text>
</span>
</td>
<td style="width:285px;">
<div
style="float:left; width:{concat( @Percent , &apos;px&apos; )}; "
class="bar">
<span>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</span>
</div>
<div
style="float:left; ">
<span>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</span>
<xsl:value-of
select="@Percent" />
<span>
<xsl:text>%</xsl:text>
</span>
</div>
</td>
<td style="width:100px;"
class="right">
<xsl:value-of
select="round(@Free div 1024)" />
<span>
<xsl:text> KiB</xsl:text>
</span>
</td>
<td style="width:100px;"
class="right">
<xsl:value-of
select="round(@Used div 1024)" />
<span>
<xsl:text> KiB</xsl:text>
</span>
</td>
<td style="width:100px;"
class="right">
<xsl:value-of
select="round(@Total div 1024)" />
<span>
<xsl:text> KiB</xsl:text>
</span>
</td>
</tr>
<xsl:for-each
select="Mount">
<tr class="odd">
<td
style="width:200px;">
<span>
<xsl:text>- </xsl:text>
<xsl:value-of
select="@MountPoint" />
</span>
</td>
<td
style="width:285px;">
<div
style="float:left; width:{concat( @Percent , &apos;px&apos; )}; "
class="bar">
<span>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</span>
</div>
<div
style="float:left; ">
<span>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</span>
<xsl:value-of
select="@Percent" />
<span>
<xsl:text>%</xsl:text>
</span>
</div>
</td>
<td
style="width:100px;"
class="right">
<xsl:value-of
select="round(@Free div 1024)" />
<span>
<xsl:text> KiB</xsl:text>
</span>
</td>
<td
style="width:100px;"
class="right">
<xsl:value-of
select="round(@Used div 1024)" />
<span>
<xsl:text> KiB</xsl:text>
</span>
</td>
<td
style="width:100px;"
class="right">
<xsl:value-of
select="round(@Total div 1024)" />
<span>
<xsl:text> KiB</xsl:text>
</span>
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</xsl:for-each>
</div>
</xsl:for-each>
</div>
<div id="filesystem">
<h2>
<span>
<xsl:text>Mounted Filesystems</xsl:text>
</span>
</h2>
<div style="overflow-x:auto;">
<table style="border-spacing:0;"
class="stripMe" id="filesystemTable">
<thead>
<tr>
<th style="width:100px;">
<span>
<xsl:text>Mountpoint</xsl:text>
</span>
</th>
<th style="width:50px;">
<span>
<xsl:text>Type</xsl:text>
</span>
</th>
<th style="width:120px;">
<span>
<xsl:text>Partition</xsl:text>
</span>
</th>
<th>
<span>
<xsl:text>Usage</xsl:text>
</span>
</th>
<th style="width:100px;"
class="right">
<span>
<xsl:text>Free</xsl:text>
</span>
</th>
<th style="width:100px;"
class="right">
<span>
<xsl:text>Used</xsl:text>
</span>
</th>
<th style="width:100px;"
class="right">
<span>
<xsl:text>Size</xsl:text>
</span>
</th>
</tr>
</thead>
<tbody>
<xsl:for-each
select="FileSystem">
<xsl:for-each
select="Mount">
<tr>
<td style="width:100px;">
<xsl:value-of
select="@MountPoint" />
</td>
<td style="width:50px;">
<xsl:value-of
select="@FSType" />
</td>
<td style="width:120px;">
<xsl:value-of
select="@Name" />
</td>
<td style="width:285px;">
<div
style="float:left; width:{concat( @Percent , &apos;px&apos; )}; "
class="bar">
<span>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</span>
</div>
<div
style="float:left; ">
<span>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</span>
<xsl:value-of
select="@Percent" />
<span>
<xsl:text>%</xsl:text>
</span>
<xsl:if
test="count(@Inodes )&gt;0">
<span>
<xsl:text> (</xsl:text>
</span>
<span
style="font-style:italic;">
<xsl:value-of
select="@Inodes" />
</span>
<span>
<xsl:text>%)</xsl:text>
</span>
</xsl:if>
</div>
</td>
<td style="width:100px;" class="right">
<xsl:value-of select="round(@Free div 1024)" />
<span>
<xsl:text> KiB</xsl:text>
</span>
</td>
<td style="width:100px;" class="right">
<xsl:value-of select="round(@Used div 1024)" />
<span>
<xsl:text> KiB</xsl:text>
</span>
</td>
<td style="width:100px;" class="right">
<xsl:value-of select="round(@Total div 1024)" />
<span>
<xsl:text> KiB</xsl:text>
</span>
</td>
</tr>
</xsl:for-each>
</xsl:for-each>
</tbody>
</table>
</div>
</div>
<div id="network">
<h2>
<span>
<xsl:text>Network Usage</xsl:text>
</span>
</h2>
<div style="overflow-x:auto;">
<div style="overflow-x:auto;">
<table style="border-spacing:0;"
class="stripMe" id="networkTable">
<thead>
<tr>
<th>
<span>
<xsl:text>Device</xsl:text>
</span>
</th>
<th class="right" width="60px">
<span>
<xsl:text>Received</xsl:text>
</span>
</th>
<th class="right" width="60px">
<span>
<xsl:text>Send</xsl:text>
</span>
</th>
<th class="right" width="60px">
<span>
<xsl:text>Err/Drop</xsl:text>
</span>
</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="Network">
<xsl:for-each select="NetDevice">
<tr>
<td>
<xsl:value-of select="@Name"/>
</td>
<td class="right" width="60px">
<span>
<xsl:value-of select="round(@RxBytes div 1024)"/>
</span>
<span>
<xsl:text> KiB</xsl:text>
</span>
</td>
<td class="right" width="60px">
<span>
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</span>
<span>
<xsl:value-of select="round(@TxBytes div 1024)"/>
</span>
<span>
<xsl:text> KiB</xsl:text>
</span>
</td>
<td class="right" width="60px">
<xsl:value-of select="@Err"/>
<span>
<xsl:text>/</xsl:text>
</span>
<xsl:value-of select="@Drops"/>
</td>
</tr>
</xsl:for-each>
</xsl:for-each>
</tbody>
</table>
</div>
</div>
</div>
<div id="footer">
<span>
<xsl:text>Created by </xsl:text>
</span>
<a>
<xsl:choose>
<xsl:when test="substring(string(&apos;http://phpsysinfo.sourceforge.net/&apos;), 1, 1) = '#'">
<xsl:attribute name="href">
<xsl:value-of select="&apos;http://phpsysinfo.sourceforge.net/&apos;"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="href">
<xsl:if test="substring(string(&apos;http://phpsysinfo.sourceforge.net/&apos;), 2, 1) = ':'">
<xsl:text>file:///</xsl:text>
</xsl:if>
<xsl:value-of select="translate(string(&apos;http://phpsysinfo.sourceforge.net/&apos;), '&#x5c;', '/')"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<span>
<xsl:text>phpSysInfo - </xsl:text>
</span>
<xsl:for-each select="Generation">
<xsl:for-each select="@version">
<span>
<xsl:value-of select="string(.)"/>
</span>
</xsl:for-each>
</xsl:for-each>
</a>
</div>
</div>
</xsl:for-each>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
/web/acc/phpsysinfo/phpsysinfo3.xsd
0,0 → 1,472
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://phpsysinfo.sourceforge.net/" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://phpsysinfo.sourceforge.net/">
 
<complexType name="Generation">
<attribute name="version" type="string" use="required"></attribute>
<attribute name="timestamp" type="unsignedLong" use="required"></attribute>
</complexType>
 
<complexType name="Options">
<attribute name="tempFormat" type="string" use="required"></attribute>
<attribute name="byteFormat" type="string" use="required"></attribute>
<attribute name="refresh" type="unsignedInt" use="required"></attribute>
<attribute name="threshold" type="unsignedInt" use="optional"></attribute>
</complexType>
 
<complexType name="UsedPlugins">
<sequence>
<element name="Plugin" type="tns:Plugin" minOccurs="0" maxOccurs="unbounded"></element>
</sequence>
</complexType>
 
<complexType name="Vitals">
<attribute name="Hostname" type="string" use="required"></attribute>
<attribute name="IPAddr" type="string" use="required"></attribute>
<attribute name="Kernel" type="string" use="required"></attribute>
<attribute name="Distro" type="string" use="required"></attribute>
<attribute name="Distroicon" type="string" use="required"></attribute>
<attribute name="OS" type="string" use="required"></attribute>
<attribute name="Uptime" type="unsignedLong" use="required"></attribute>
<attribute name="Users" type="unsignedLong" use="required"></attribute>
<attribute name="LoadAvg" type="string" use="required"></attribute>
<attribute name="CPULoad" type="integer" use="optional"></attribute>
<attribute name="SysLang" type="string" use="optional"></attribute>
<attribute name="CodePage" type="string" use="optional"></attribute>
<attribute name="Processes" type="string" use="optional"></attribute>
</complexType>
 
<complexType name="NetDevice">
<attribute name="Name" type="string" use="required"></attribute>
<attribute name="RxBytes" type="integer" use="required"></attribute>
<attribute name="TxBytes" type="integer" use="required"></attribute>
<attribute name="Err" type="integer" use="required"></attribute>
<attribute name="Drops" type="integer" use="required"></attribute>
<attribute name="Info" type="string" use="optional"></attribute>
</complexType>
 
 
<complexType name="Network">
<sequence>
<element name="NetDevice" type="tns:NetDevice" minOccurs="0" maxOccurs="unbounded"></element>
</sequence>
</complexType>
 
 
<complexType name="HWDevice">
<attribute name="Name" type="string" use="required"></attribute>
<attribute name="Count" use="optional">
<simpleType>
<restriction base="integer">
<minExclusive value="1"></minExclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="Capacity" use="optional">
<simpleType>
<restriction base="unsignedLong">
<minExclusive value="0"></minExclusive>
</restriction>
</simpleType>
</attribute>
</complexType>
 
<complexType name="PCI">
<sequence>
<element name="PCI" type="tns:HWDevice" minOccurs="0" maxOccurs="unbounded"></element>
</sequence>
</complexType>
 
<complexType name="USB">
<sequence>
<element name="USB" type="tns:HWDevice" minOccurs="0" maxOccurs="unbounded"></element>
</sequence>
</complexType>
 
<complexType name="IDE">
<sequence>
<element name="IDE" type="tns:HWDevice" minOccurs="0" maxOccurs="unbounded"></element>
</sequence>
</complexType>
 
<complexType name="SCSI">
<sequence>
<element name="SCSI" type="tns:HWDevice" minOccurs="0" maxOccurs="unbounded"></element>
</sequence>
</complexType>
 
<complexType name="NVMe">
<sequence>
<element name="NVMe" type="tns:HWDevice" minOccurs="0" maxOccurs="unbounded"></element>
</sequence>
</complexType>
 
<complexType name="TB">
<sequence>
<element name="TB" type="tns:HWDevice" minOccurs="0" maxOccurs="unbounded"></element>
</sequence>
</complexType>
 
<complexType name="I2C">
<sequence>
<element name="I2C" type="tns:HWDevice" minOccurs="0" maxOccurs="unbounded"></element>
</sequence>
</complexType>
 
<complexType name="CPU">
<sequence>
<element name="CpuCore" type="tns:CpuCore" minOccurs="0" maxOccurs="unbounded"></element>
</sequence>
</complexType>
 
<complexType name="CpuCore">
<attribute name="Model" type="string" use="required"></attribute>
<attribute name="CpuSpeed" use="optional">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="CpuSpeedMax" use="optional">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="CpuSpeedMin" use="optional">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="Cache" use="optional">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="Virtualization" type="string" use="optional"></attribute>
<attribute name="BusSpeed" use="optional">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="Bogomips" use="optional">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="CpuTemp" use="optional">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="Manufacturer" type="string" use="optional"></attribute>
<attribute name="Load" use="optional">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
</complexType>
 
<complexType name="Hardware">
<attribute name="Name" type="string" use="optional"></attribute>
<sequence>
<element name="PCI" type="tns:PCI" minOccurs="0" maxOccurs="1"></element>
<element name="USB" type="tns:USB" minOccurs="0" maxOccurs="1"></element>
<element name="IDE" type="tns:IDE" minOccurs="0" maxOccurs="1"></element>
<element name="SCSI" type="tns:SCSI" minOccurs="0" maxOccurs="1"></element>
<element name="TB" type="tns:TB" minOccurs="0" maxOccurs="1"></element>
<element name="I2C" type="tns:I2C" minOccurs="0" maxOccurs="1"></element>
<element name="CPU" type="tns:CPU" minOccurs="0" maxOccurs="1"></element>
</sequence>
</complexType>
 
<complexType name="Plugin">
<attribute name="name" type="string"></attribute>
</complexType>
 
<complexType name="phpsysinfo">
<sequence>
<element name="Generation" type="tns:Generation" minOccurs="1" maxOccurs="1"></element>
<element name="Options" type="tns:Options" minOccurs="1" maxOccurs="1"></element>
<element name="UsedPlugins" type="tns:UsedPlugins" minOccurs="1" maxOccurs="1"></element>
<element name="Vitals" type="tns:Vitals" minOccurs="1" maxOccurs="1"></element>
<element name="Network" type="tns:Network" minOccurs="1" maxOccurs="1"></element>
<element name="Hardware" type="tns:Hardware" minOccurs="1" maxOccurs="1"></element>
<element name="Memory" type="tns:Memory" minOccurs="1" maxOccurs="1"></element>
<element name="FileSystem" type="tns:FileSystem" minOccurs="1" maxOccurs="1"></element>
<element name="MBInfo" type="tns:MBInfo" minOccurs="1" maxOccurs="1"></element>
<element name="UPSInfo" type="tns:UPSInfo" minOccurs="1" maxOccurs="1"></element>
<element name="Plugins" type="tns:Plugins" minOccurs="1" maxOccurs="1"></element>
</sequence>
</complexType>
 
 
<complexType name="Memory">
<sequence>
<element name="Details" type="tns:Details" minOccurs="1" maxOccurs="1"></element>
<element name="Swap" type="tns:Swap" minOccurs="0" maxOccurs="1"></element>
</sequence>
<attribute name="Free" use="required">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="Used" use="required">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="Total" use="required">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="Percent" use="required">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
</complexType>
 
<complexType name="Details">
<attribute name="App" use="optional">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="AppPercent" use="optional">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="Cached" use="optional">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="CachedPercent" use="optional">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="Buffers" use="optional">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="BuffersPercent" use="optional">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
</complexType>
 
<complexType name="Swap">
<sequence>
<element name="Mount" type="tns:DiskDevice" minOccurs="1" maxOccurs="unbounded"></element>
</sequence>
<attribute name="Free" use="required">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="Used" use="required">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="Total" use="required">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="Percent" use="required">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
</complexType>
 
<complexType name="DiskDevice">
<attribute name="MountPointID" use="required">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="FSType" type="string"></attribute>
<attribute name="Name" type="string" use="required"></attribute>
<attribute name="Free" use="required">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="Used" use="required">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="Total" use="required">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="Percent" use="required">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="MountOptions" type="string" use="optional"></attribute>
<attribute name="Inodes" use="optional">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="MountPoint" type="string" use="optional"></attribute>
</complexType>
 
<complexType name="FileSystem">
<sequence>
<element name="Mount" type="tns:DiskDevice" minOccurs="0" maxOccurs="unbounded"></element>
</sequence>
</complexType>
 
<complexType name="MBInfo">
<sequence>
<element name="Temperature" type="tns:Temperature" minOccurs="0" maxOccurs="1"></element>
<element name="Fans" type="tns:Fans" minOccurs="0" maxOccurs="1"></element>
<element name="Voltage" type="tns:Voltage" minOccurs="0" maxOccurs="1"></element>
</sequence>
</complexType>
 
<complexType name="Sensor">
<attribute name="Label" type="string" use="required"></attribute>
<attribute name="Value" use="required">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="Min" use="required">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
<attribute name="Max" use="required">
<simpleType>
<restriction base="unsignedLong">
<minInclusive value="0"></minInclusive>
</restriction>
</simpleType>
</attribute>
</complexType>
 
<complexType name="Temperature">
<sequence>
<element name="Item" type="tns:Sensor" minOccurs="1" maxOccurs="unbounded"></element>
</sequence>
</complexType>
 
<complexType name="Fans">
<sequence>
<element name="Item" type="tns:Sensor" minOccurs="1" maxOccurs="unbounded"></element>
</sequence>
</complexType>
 
<complexType name="Voltage">
<sequence>
<element name="Item" type="tns:Sensor" minOccurs="1" maxOccurs="unbounded"></element>
</sequence>
</complexType>
 
<complexType name="UPSDevice">
<attribute name="Name" type="string" use="required"></attribute>
<attribute name="Model" type="string" use="required"></attribute>
<attribute name="Mode" type="string" use="required"></attribute>
<attribute name="StartTime" type="string" use="optional"></attribute>
<attribute name="Status" type="string" use="required"></attribute>
<attribute name="Temperature" type="unsignedLong" use="optional"></attribute>
<attribute name="OutagesCount" type="unsignedLong" use="optional"></attribute>
<attribute name="LastOutage" type="string" use="optional"></attribute>
<attribute name="LastOutageFinish" type="string" use="optional"></attribute>
<attribute name="LineVoltage" type="unsignedLong" use="optional"></attribute>
<attribute name="LoadPercent" type="unsignedLong" use="optional"></attribute>
<attribute name="BatteryVoltage" type="unsignedLong" use="optional"></attribute>
<attribute name="BatteryChargePercent" type="unsignedLong" use="optional"></attribute>
<attribute name="TimeLeftMinutes" type="string" use="optional"></attribute>
</complexType>
 
<complexType name="UPS">
<sequence>
<element name="UPS" type="tns:UPSDevice" minOccurs="1" maxOccurs="1"></element>
</sequence>
</complexType>
 
<complexType name="UPSInfo">
<sequence>
<element name="UPSInfo" type="tns:UPS" minOccurs="0" maxOccurs="unbounded"></element>
</sequence>
</complexType>
 
<complexType name="Plugins">
<sequence>
<any minOccurs="0" maxOccurs="unbounded"></any>
</sequence></complexType>
 
<element name="phpsysinfo" type="tns:phpsysinfo"></element>
</schema>
/web/acc/phpsysinfo/read_config.php
0,0 → 1,299
<?php
if (!defined('PSI_CONFIG_FILE')) {
/**
* phpSysInfo version
*/
define('PSI_VERSION', '3.3.2');
/**
* phpSysInfo configuration
*/
define('PSI_CONFIG_FILE', PSI_APP_ROOT.'/phpsysinfo.ini');
 
define('ARRAY_EXP', '/^return array \([^;]*\);$/'); //array expression search
 
if (!is_readable(PSI_CONFIG_FILE)) {
echo "ERROR: phpsysinfo.ini does not exist or is not readable by the webserver in the phpsysinfo directory";
die();
} elseif (!($config = @parse_ini_file(PSI_CONFIG_FILE, true))) {
echo "ERROR: phpsysinfo.ini file is not parsable";
die();
} else {
foreach ($config as $name=>$group) {
if (strtoupper($name)=="MAIN") {
$name_prefix='PSI_';
} elseif (strtoupper(substr($name, 0, 7))=="SENSOR_") {
$name_prefix='PSI_'.strtoupper($name).'_';
} else {
$name_prefix='PSI_PLUGIN_'.strtoupper($name).'_';
}
foreach ($group as $param=>$value) {
if ((trim($value)==="") || (trim($value)==="0")) {
define($name_prefix.strtoupper($param), false);
} elseif (trim($value)==="1") {
define($name_prefix.strtoupper($param), true);
} else {
if (strstr($value, ',')) {
define($name_prefix.strtoupper($param), 'return '.var_export(preg_split('/\s*,\s*/', trim($value), -1, PREG_SPLIT_NO_EMPTY), 1).';');
} else {
define($name_prefix.strtoupper($param), trim($value));
}
}
}
}
}
 
if (defined('PSI_ALLOWED') && is_string(PSI_ALLOWED)) {
if (preg_match(ARRAY_EXP, PSI_ALLOWED)) {
$allowed = eval(strtolower(PSI_ALLOWED));
} else {
$allowed = array(strtolower(PSI_ALLOWED));
}
 
if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
} else {
if (isset($_SERVER["HTTP_CLIENT_IP"])) {
$ip = $_SERVER["HTTP_CLIENT_IP"];
} else {
$ip = $_SERVER["REMOTE_ADDR"];
}
}
$ip = preg_replace("/^::ffff:/", "", strtolower($ip));
 
if (!in_array($ip, $allowed, true)) {
echo "Client IP address not allowed";
die();
}
}
 
/* default error handler */
if (function_exists('errorHandlerPsi')) {
restore_error_handler();
}
 
/* fatal errors only */
$old_err_rep = error_reporting();
error_reporting(E_ERROR);
 
/* get git revision */
if (file_exists(PSI_APP_ROOT.'/.git/HEAD')) {
$contents = @file_get_contents(PSI_APP_ROOT.'/.git/HEAD');
if ($contents && preg_match("/^ref:\s+(.*)\/([^\/\s]*)/m", $contents, $matches)) {
$contents = @file_get_contents(PSI_APP_ROOT.'/.git/'.$matches[1]."/".$matches[2]);
if ($contents && preg_match("/^([^\s]*)/m", $contents, $revision)) {
define('PSI_VERSION_STRING', PSI_VERSION ."-".$matches[2]."-".substr($revision[1], 0, 7));
} else {
define('PSI_VERSION_STRING', PSI_VERSION ."-".$matches[2]);
}
}
}
/* get svn revision */
if (!defined('PSI_VERSION_STRING') && file_exists(PSI_APP_ROOT.'/.svn/entries')) {
$contents = @file_get_contents(PSI_APP_ROOT.'/.svn/entries');
if ($contents && preg_match("/dir\n(.+)/", $contents, $matches)) {
define('PSI_VERSION_STRING', PSI_VERSION."-r".$matches[1]);
} else {
define('PSI_VERSION_STRING', PSI_VERSION);
}
}
if (!defined('PSI_VERSION_STRING')) {
define('PSI_VERSION_STRING', PSI_VERSION);
}
 
if (!defined('PSI_OS')) { //if not overloaded in phpsysinfo.ini
/* get Linux code page */
if (PHP_OS == 'Linux') {
if (file_exists($fname = '/etc/sysconfig/i18n')
|| file_exists($fname = '/etc/default/locale')
|| file_exists($fname = '/etc/locale.conf')
|| file_exists($fname = '/etc/sysconfig/language')
|| file_exists($fname = '/etc/profile.d/lang.sh')
|| file_exists($fname = '/etc/profile')) {
$contents = @file_get_contents($fname);
} else {
$contents = false;
if (file_exists('/system/build.prop')) { //Android
define('PSI_OS', 'Android');
if (@exec('uname -o 2>/dev/null', $unameo) && (sizeof($unameo)>0) && (($unameo0 = trim($unameo[0])) != "")) {
define('PSI_UNAMEO', $unameo0);
}
if (!defined('PSI_MODE_POPEN')) { //if not overloaded in phpsysinfo.ini
if (!function_exists("proc_open")) { //proc_open function test by executing 'pwd' command
define('PSI_MODE_POPEN', true); //use popen() function - no stderr error handling (but with problems with timeout)
} else {
$out = '';
$err = '';
$pipes = array();
$descriptorspec = array(0=>array("pipe", "r"), 1=>array("pipe", "w"), 2=>array("pipe", "w"));
$process = proc_open("pwd 2>/dev/null ", $descriptorspec, $pipes);
if (!is_resource($process)) {
define('PSI_MODE_POPEN', true);
} else {
$w = null;
$e = null;
 
while (!(feof($pipes[1]) && feof($pipes[2]))) {
$read = array($pipes[1], $pipes[2]);
 
$n = stream_select($read, $w, $e, 5);
 
if (($n === false) || ($n === 0)) {
break;
}
 
foreach ($read as $r) {
if ($r == $pipes[1]) {
$out .= fread($r, 4096);
} elseif (feof($pipes[1]) && ($r == $pipes[2])) {//read STDERR after STDOUT
$err .= fread($r, 4096);
}
}
}
 
if (is_null($out) || (trim($out) == "") || (substr(trim($out), 0, 1) != "/")) {
define('PSI_MODE_POPEN', true);
}
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
// It is important that you close any pipes before calling
// proc_close in order to avoid a deadlock
proc_close($process);
}
}
}
}
}
if (!(defined('PSI_SYSTEM_CODEPAGE') && defined('PSI_SYSTEM_LANG')) //also if both not overloaded in phpsysinfo.ini
&& $contents && (preg_match('/^(LANG="?[^"\n]*"?)/m', $contents, $matches)
|| preg_match('/^RC_(LANG="?[^"\n]*"?)/m', $contents, $matches)
|| preg_match('/^\s*export (LANG="?[^"\n]*"?)/m', $contents, $matches))) {
if (!defined('PSI_SYSTEM_CODEPAGE')) {
if (file_exists($vtfname = '/sys/module/vt/parameters/default_utf8')
&& (trim(@file_get_contents($vtfname)) === "1")) {
define('PSI_SYSTEM_CODEPAGE', 'UTF-8');
} elseif (@exec($matches[1].' locale -k LC_CTYPE 2>/dev/null', $lines)) { //if not overloaded in phpsysinfo.ini
foreach ($lines as $line) {
if (preg_match('/^charmap="?([^"]*)/', $line, $matches2)) {
define('PSI_SYSTEM_CODEPAGE', $matches2[1]);
break;
}
}
}
}
if (!defined('PSI_SYSTEM_LANG') && @exec($matches[1].' locale 2>/dev/null', $lines2)) { //also if not overloaded in phpsysinfo.ini
foreach ($lines2 as $line) {
if (preg_match('/^LC_MESSAGES="?([^\."@]*)/', $line, $matches2)) {
$lang = "";
if (is_readable(PSI_APP_ROOT.'/data/languages.ini') && ($langdata = @parse_ini_file(PSI_APP_ROOT.'/data/languages.ini', true))) {
if (isset($langdata['Linux']['_'.$matches2[1]])) {
$lang = $langdata['Linux']['_'.$matches2[1]];
}
}
if ($lang == "") {
$lang = 'Unknown';
}
define('PSI_SYSTEM_LANG', $lang.' ('.$matches2[1].')');
break;
}
}
}
}
} elseif (PHP_OS == 'Haiku') {
if (!(defined('PSI_SYSTEM_CODEPAGE') && defined('PSI_SYSTEM_LANG')) //also if both not overloaded in phpsysinfo.ini
&& @exec('locale -m 2>/dev/null', $lines)) {
foreach ($lines as $line) {
if (preg_match('/^"?([^\."]*)\.?([^"]*)/', $line, $matches2)) {
 
if (!defined('PSI_SYSTEM_CODEPAGE') && isset($matches2[2]) && !is_null($matches2[2]) && (trim($matches2[2]) != "")) { //also if not overloaded in phpsysinfo.ini
define('PSI_SYSTEM_CODEPAGE', $matches2[2]);
}
 
if (!defined('PSI_SYSTEM_LANG')) { //if not overloaded in phpsysinfo.ini
$lang = "";
if (is_readable(PSI_APP_ROOT.'/data/languages.ini') && ($langdata = @parse_ini_file(PSI_APP_ROOT.'/data/languages.ini', true))) {
if (isset($langdata['Linux']['_'.$matches2[1]])) {
$lang = $langdata['Linux']['_'.$matches2[1]];
}
}
if ($lang == "") {
$lang = 'Unknown';
}
define('PSI_SYSTEM_LANG', $lang.' ('.$matches2[1].')');
}
break;
}
}
}
} elseif (PHP_OS == 'Darwin') {
if (!defined('PSI_SYSTEM_LANG') //if not overloaded in phpsysinfo.ini
&& @exec('defaults read /Library/Preferences/.GlobalPreferences AppleLocale 2>/dev/null', $lines)) {
$lang = "";
if (is_readable(PSI_APP_ROOT.'/data/languages.ini') && ($langdata = @parse_ini_file(PSI_APP_ROOT.'/data/languages.ini', true))) {
if (isset($langdata['Linux']['_'.$lines[0]])) {
$lang = $langdata['Linux']['_'.$lines[0]];
}
}
if ($lang == "") {
$lang = 'Unknown';
}
define('PSI_SYSTEM_LANG', $lang.' ('.$lines[0].')');
}
}
}
 
/* executeProgram() timeout value in seconds */
if (defined('PSI_EXEC_TIMEOUT')) {
define('PSI_EXEC_TIMEOUT_INT', max(intval(PSI_EXEC_TIMEOUT), 1));
} else {
define('PSI_EXEC_TIMEOUT_INT', 30);
}
 
/* snmprealwalk() and executeProgram("snmpwalk") number of seconds until the first timeout */
if (defined('PSI_SNMP_TIMEOUT')) {
define('PSI_SNMP_TIMEOUT_INT', max(intval(PSI_SNMP_TIMEOUT), 1));
} else {
define('PSI_SNMP_TIMEOUT_INT', 3);
}
 
/* snmprealwalk() and executeProgram("snmpwalk") number of times to retry if timeouts occur */
if (defined('PSI_SNMP_RETRY')) {
define('PSI_SNMP_RETRY_INT', max(intval(PSI_SNMP_RETRY), 0));
} else {
define('PSI_SNMP_RETRY_INT', 0);
}
 
if (!defined('PSI_OS')) {
define('PSI_OS', PHP_OS);
}
 
if (!defined('PSI_SYSTEM_LANG')) {
define('PSI_SYSTEM_LANG', null);
}
if (!defined('PSI_SYSTEM_CODEPAGE')) { //if not overloaded in phpsysinfo.ini
if ((PSI_OS=='Android') || (PSI_OS=='Darwin')) {
define('PSI_SYSTEM_CODEPAGE', 'UTF-8');
} elseif (PSI_OS=='Minix') {
define('PSI_SYSTEM_CODEPAGE', 'CP437');
} else {
define('PSI_SYSTEM_CODEPAGE', null);
}
}
 
if (!defined('PSI_JSON_ISSUE')) { //if not overloaded in phpsysinfo.ini
if (!extension_loaded("xml")) {
die("phpSysInfo requires the xml extension to php in order to work properly.");
}
if (simplexml_load_string("<A><B><C/></B>\n</A>") !== simplexml_load_string("<A><B><C/></B></A>")) { // json_encode issue test
define('PSI_JSON_ISSUE', true); // Problem must be solved
}
}
 
/* restore error level */
error_reporting($old_err_rep);
 
/* restore error handler */
if (function_exists('errorHandlerPsi')) {
set_error_handler('errorHandlerPsi');
}
}
/web/acc/phpsysinfo/templates/alcasar/alcasar.css
File deleted
Property changes:
Deleted: svn:keywords
-Id Date Author
\ No newline at end of property
/web/acc/phpsysinfo/templates/alcasar/form.tpl
File deleted
Property changes:
Deleted: svn:keywords
-Id Date Author
\ No newline at end of property
/web/acc/phpsysinfo/templates/alcasar/images/redbar_left.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/web/acc/phpsysinfo/templates/alcasar/images/redbar_right.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/web/acc/phpsysinfo/templates/alcasar/images/redbar_middle.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/web/acc/phpsysinfo/templates/alcasar/images/bar_left.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/web/acc/phpsysinfo/templates/alcasar/images/bar_right.gif
File deleted
\ No newline at end of file
/web/acc/phpsysinfo/templates/alcasar/images/bar_middle.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/web/acc/phpsysinfo/templates/alcasar/images/trans.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/web/acc/phpsysinfo/templates/alcasar/box.tpl
File deleted
Property changes:
Deleted: svn:keywords
-Id Date Author
\ No newline at end of property
/web/acc/phpsysinfo/templates/alcasar/index.html
Property changes:
Deleted: svn:keywords
-Id Date Author
\ No newline at end of property
/web/acc/phpsysinfo/templates/aqua.css
0,0 → 1,191
/*
$Id*
*/
a {
text-decoration: none;
color: #c03000;
}
 
a:hover {
text-decoration: underline;
}
 
* {
margin: 0;
padding: 0;
}
 
wbr {
display: inline-block;
}
 
html {
height: 100%;
background: url("aqua/aq_background.gif");
}
 
body {
position: relative;
width: 940px;
_width: 945px; /* ie6 */
min-height: 100%;
overflow: auto;
margin: 0 auto;
padding: 20px 20px 0 20px;
font: 75% arial, tahoma, helvetica, sans-serif;
color: #000;
}
 
p {
padding: 4px 10px 2px 10px;
line-height: 1.6;
text-align: left;
vertical-align: top;
}
 
h1 {
margin: 0 10px;
_margin: 0 15px 0 10px; /* ie6 */
padding: 10px 10px;
border-top: 1px solid #2971a7;
border-bottom: 1px solid #2971a7;
font-size: 1.67em;
font-weight: normal;
color: #fff;
background: #2971a7;
}
 
h2 {
padding: 5px 10px;
font-family: "trebuchet ms";
font-size: 1em;
font-weight: bold;
letter-spacing: 0.0em;
text-transform: uppercase;
color: #fff;
background: #2971a7;
text-align: center;
}
 
th, td, h3 {
padding: 4px 10px 2px 10px;
text-align: left;
vertical-align: top;
}
 
h3 {
font-size: 100%;
}
 
table {
width: 100%;
font-size: 1em;
background-color: #fff;
}
 
table tfoot td {
color: #2e2e2e;
}
 
#select {
text-align: right;
padding: 10px;
font-size: 0.8em;
}
 
#select select {
width: 100px;
}
 
#vitals, #network, #memory, #filesystem, #hardware, #temperature, #voltage, #fans, #power, #current, #other, #ups {
float: left;
width: 451px;
margin: 10px 0 0 8px;
_margin: 10px 4px 0 4px; /* ie6 */
padding: 1px;
border: 2px solid #2971a7;
background: #fff;
}
 
#pciTable, #ideTable, #scsiTable, #nvmeTable, #usbTable, #tbTable, #i2cTable {
padding: 0px 30px;
}
 
#memory, #filesystem {
width: 915px;
}
 
#filesystemTable thead tr th {
cursor: pointer;
}
 
#footer {
clear: both;
color: #000;
margin: 12px;
padding: 13px 25px;
line-height: 18px;
}
 
.plugin {
float: left;
margin: 10px 0 0 8px;
_margin: 10px 4px 0 4px; /* ie6 */
padding: 1px;
border: 2px solid #2971a7;
background: #fff;
}
 
.even {
background: #e4ebf3;
}
 
.bar {
background: #2971a7;
}
 
.barwarn {
background: #a72971;
}
 
.right {
text-align: right;
padding-right: 20px;
}
 
.dataTables_wrapper{
margin: 0 0 0 0 !important;
border: 0px !important;
}
 
.treeimg {
display: table-cell;
*float: left; /* ie6 ie7 */
vertical-align: top;
}
 
.treespan {
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.treespanbold {
font-weight: bold;
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.tree tr td {
cursor: auto;
height: 100%;
}
 
.treediv {
display: table;
height: 100%;
}
 
.tablemain {
width: 100%;
height: 100%;
}
/web/acc/phpsysinfo/templates/blue.css
0,0 → 1,181
a {
text-decoration: none;
color: #efefef;
}
 
a:hover {
text-decoration: underline;
}
 
* {
margin: 0;
padding: 0;
}
 
wbr {
display: inline-block;
}
 
html {
background: url("blue/bg.png") #195287;
color: #195287;
font-size: 100%;
height: 100%;
}
 
body {
font-family: Helvetica, Verdana, Tahoma, Arial, 'Liberation Sans', FreeSans, sans-serif;
font-size: .75em;
position: relative;
margin: 0 auto;
min-height: 100%;
padding: 20px 20px 0 20px;
overflow: auto;
width: 940px;
_width: 945px; /* ie6 */
}
 
p {
padding: 4px 10px 2px 10px;
line-height: 1.6;
text-align: left;
vertical-align: top;
}
 
h1 {
color: #fff;
font-size: 170%;
font-weight: bold;
line-height: 1.5em;
margin: 0 10px;
_margin: 0 15px 0 10px; /* ie6 */
padding: 10px 10px;
text-align: center;
text-shadow: #444 2px 2px 3px;
}
 
h2 {
background-image: url('blue/title.png');
background-color: #195287;
color: #fff;
font-size: 130%;
font-weight: bold;
line-height: 1.5em;
padding: 3px 10px;
/*text-transform: uppercase;*/
text-shadow: #333 2px 2px 2px;
}
 
th, td, h3 {
font-size: 100%;
padding: 4px 10px 2px 10px;
text-align: left;
vertical-align: top;
}
 
table {
width: 100%;
}
 
#select {
text-align: right;
color: #fff
}
 
#select select {
width: 100px;
}
 
#vitals, #network, #memory, #filesystem, #hardware, #temperature, #voltage, #fans, #power, #current, #other, #ups {
background-color: #fff;
float: left;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding: 1px;
width: 451px;
}
 
#pciTable, #ideTable, #scsiTable, #nvmeTable, #usbTable, #tbTable, #i2cTable {
padding: 0px 30px;
}
 
#memory, #filesystem {
width: 915px;
}
 
#filesystemTable thead tr th {
cursor: pointer;
}
 
#footer {
clear: both;
color: #fff;
margin: 12px;
padding: 13px 25px;
line-height: 18px;
font-size: 80%;
text-align: center;
}
 
.plugin {
float: left;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding: 1px;
background-color: #f6f6f6;
}
 
.odd {
background-color: #f6f6f6;
}
 
.even {
background-color: #efefef;
}
 
.bar {
background-image: url('blue/bar.png');
background-color: #195287;
}
 
.barwarn {
background-image: url('blue/barwarn.png');
background-color: #871952;
}
 
.right {
padding-right: 20px;
text-align: right;
}
 
.treeimg {
display: table-cell;
*float: left; /* ie6 ie7 */
vertical-align: top;
}
 
.treespan {
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.treespanbold {
font-weight: bold;
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.tree tr td {
cursor: auto;
height: 100%;
}
 
.treediv {
display: table;
height: 100%;
}
 
.tablemain {
width: 100%;
height: 100%;
}
/web/acc/phpsysinfo/templates/clean.css
0,0 → 1,179
/*
$Id: clean.css 518 2011-10-28 08:09:07Z namiltd $
*/
a {
text-decoration: none;
color: #c03000;
}
 
a:hover {
text-decoration: underline;
}
 
* {
margin: 0;
padding: 0;
}
 
wbr {
display: inline-block;
}
 
html {
font-size: 100%;
height: 100%;
color: #333;
}
 
body {
font-family: Helvetica, Arial, "Lucida Grande", Verdana, sans-serif;
font-size: .75em;
position: relative;
width: 940px;
_width: 945px; /* ie6 */
min-height: 100%;
overflow: auto;
margin: 0 auto;
padding: 20px 20px 0 20px;
}
 
p {
padding: 4px 10px 2px 10px;
line-height: 1.6;
text-align: left;
vertical-align: top;
}
 
h1 {
margin: 0 10px;
_margin: 0 15px 0 10px; /* ie6 */
padding: 10px 10px;
text-align: center;
font-family: Helvetica, Arial, "Lucida Grande", Verdana, sans-serif;
font-size: 130%;
line-height: 1.5em;
color: #224970;
}
 
h2 {
font-family: Helvetica, Arial, "Lucida Grande", Verdana, sans-serif;
font-size: 120%;
padding: 3px 10px;
text-transform: uppercase;
line-height: 1.5em;
color: #224970;
text-align: left;
}
 
th, td, h3 {
padding: 4px 10px 2px 10px;
text-align: left;
vertical-align: top;
font-size: 100%;
}
 
table {
width: 100%;
border-top: solid 2px #dadada;
border-bottom: solid 2px #dadada;
background-color: #f3f8fc;
}
 
table th {
color: #330;
}
 
#select {
text-align: right;
}
 
#select select {
width: 100px;
font-family: Helvetica, Arial, "Lucida Grande", Verdana, sans-serif;
}
 
#vitals, #network, #memory, #filesystem, #hardware, #temperature, #voltage, #fans, #power, #current, #other, #ups {
float: left;
width: 451px;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
color: #000;
}
 
#pciTable, #ideTable, #scsiTable, #nvmeTable, #usbTable, #tbTable, #i2cTable {
padding: 0px 30px;
}
 
#memory, #filesystem {
width: 915px;
}
 
#filesystemTable thead tr th {
cursor: pointer;
}
 
#footer {
clear: both;
color: #000;
margin: 12px;
padding: 13px 25px;
line-height: 18px;
font-size: 80%;
text-align: center;
}
 
.plugin {
float: left;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding: 1px;
}
 
.bar {
background-color: #2f659b;
}
 
.barwarn {
background-color: #9b2f65;
}
 
.right {
text-align: right;
padding-right: 20px;
}
 
.treeTable {
border: none;
}
 
.treeimg {
display: table-cell;
*float: left; /* ie6 ie7 */
vertical-align: top;
}
 
.treespan {
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.treespanbold {
font-weight: bold;
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.tree tr td {
cursor: auto;
height: 100%;
}
 
.treediv {
display: table;
height: 100%;
}
 
.tablemain {
width: 100%;
height: 100%;
}
/web/acc/phpsysinfo/templates/cleansyn.css
0,0 → 1,180
/*
$Id: cleansyn.css 518 2015-03-21 10:31:07Z namiltd $
*/
a {
text-decoration: none;
color: #363;
}
 
a:hover {
text-decoration: underline;
}
 
* {
margin: 0;
padding: 0;
}
 
wbr {
display: inline-block;
}
 
html {
font-size: 100%;
height: 100%;
color: #ddd;
}
 
body {
font-family: Helvetica, Arial, "Lucida Grande", Verdana, sans-serif;
font-size: .75em;
position: relative;
width: 940px;
_width: 945px; /* ie6 */
min-height: 100%;
overflow: auto;
margin: 0 auto;
padding: 20px 20px 0 20px;
background-color: #111;
}
 
p {
padding: 4px 10px 2px 10px;
line-height: 1.6;
text-align: left;
vertical-align: top;
}
 
h1 {
margin: 0 10px;
_margin: 0 15px 0 10px; /* ie6 */
padding: 10px 10px;
text-align: center;
font-family: Helvetica, Arial, "Lucida Grande", Verdana, sans-serif;
font-size: 130%;
line-height: 1.5em;
color: #fff;
}
 
h2 {
font-family: Helvetica, Arial, "Lucida Grande", Verdana, sans-serif;
font-size: 120%;
padding: 3px 10px;
text-transform: uppercase;
line-height: 1.5em;
color: #fff;
text-align: left;
}
 
th, td, h3 {
padding: 4px 10px 2px 10px;
text-align: left;
vertical-align: top;
font-size: 100%;
}
 
table {
width: 100%;
border-top: solid 2px #dadada;
border-bottom: solid 2px #dadada;
background-color: #333;
}
 
table th {
color: #3a3;
}
 
#select {
text-align: right;
}
 
#select select {
width: 100px;
font-family: Helvetica, Arial, "Lucida Grande", Verdana, sans-serif;
}
 
#vitals, #network, #memory, #filesystem, #hardware, #temperature, #voltage, #fans, #power, #current, #other, #ups {
float: left;
width: 451px;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
color: #ccc;
}
 
#pciTable, #ideTable, #scsiTable, #nvmeTable, #usbTable, #tbTable, #i2cTable {
padding: 0px 30px;
}
 
#memory, #filesystem {
width: 915px;
}
 
#filesystemTable thead tr th {
cursor: pointer;
}
 
#footer {
clear: both;
color: #bbb;
margin: 12px;
padding: 13px 25px;
line-height: 18px;
font-size: 80%;
text-align: center;
}
 
.plugin {
float: left;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding: 1px;
}
 
.bar {
background-color: #0f0;
}
 
.barwarn {
background-color: #944;
}
 
.right {
text-align: right;
padding-right: 20px;
}
 
.treeTable {
border: none;
}
 
.treeimg {
display: table-cell;
*float: left; /* ie6 ie7 */
vertical-align: top;
}
 
.treespan {
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.treespanbold {
font-weight: bold;
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.tree tr td {
cursor: auto;
height: 100%;
}
 
.treediv {
display: table;
height: 100%;
}
 
.tablemain {
width: 100%;
height: 100%;
}
/web/acc/phpsysinfo/templates/cream.css
0,0 → 1,175
/*
$Id
*/
a {
text-decoration: none;
color: #c03000;
}
 
a:hover {
text-decoration: underline;
}
 
* {
margin: 0;
padding: 0;
}
 
wbr {
display: inline-block;
}
 
html {
background: url("cream/bg.gif") repeat-x #f8f2e3;
color: #444b54;
font-size: 100%;
height: 100%;
}
 
body {
font-family: Helvetica, Arial, 'Liberation Sans', FreeSans, sans-serif;
font-size: .75em;
position: relative;
margin: 0 auto;
min-height: 100%;
padding: 20px 20px 0 20px;
overflow: auto;
width: 940px;
_width: 945px; /* ie6 */
}
 
p {
padding: 4px 10px 2px 10px;
line-height: 1.6;
text-align: left;
vertical-align: top;
}
 
h1 {
color: #394047;
font-size: 150%;
font-weight: normal;
line-height: 1.5em;
margin: 0 10px;
_margin: 0 15px 0 10px; /* ie6 */
padding: 10px 10px;
text-align: center;
}
 
h2 {
background-color: #444b54;
color: #fff;
font-size: 130%;
font-weight: bold;
line-height: 1.5em;
padding: 3px 10px;
text-transform: uppercase;
}
 
th, td, h3 {
font-size: 100%;
padding: 4px 10px 2px 10px;
text-align: left;
vertical-align: top;
}
 
table {
width: 100%;
background-color: #fff;
}
 
#select {
text-align: right;
}
 
#select select {
width: 100px;
}
 
#vitals, #network, #memory, #filesystem, #hardware, #temperature, #voltage, #fans, #power, #current, #other, #ups {
background-color: #fff;
float: left;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding: 1px;
width: 451px;
}
 
#pciTable, #ideTable, #scsiTable, #nvmeTable, #usbTable, #tbTable, #i2cTable {
padding: 0px 30px;
}
 
#memory, #filesystem {
width: 915px;
}
 
#filesystemTable thead tr th {
cursor: pointer;
}
 
#footer {
clear: both;
color: #5c5c5c;
margin: 12px;
padding: 13px 25px;
line-height: 18px;
font-size: 80%;
text-align: center;
}
 
.plugin {
float: left;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding: 1px;
background: #fff;
}
 
.even {
background-color: #fbfbf9;
}
 
.bar {
background-color: #58626d;
}
 
.barwarn {
background-color: #9b2f65;
}
 
.right {
padding-right: 20px;
text-align: right;
}
 
.treeimg {
display: table-cell;
*float: left; /* ie6 ie7 */
vertical-align: top;
}
 
.treespan {
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.treespanbold {
font-weight: bold;
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.tree tr td {
cursor: auto;
height: 100%;
}
 
.treediv {
display: table;
height: 100%;
}
 
.tablemain {
width: 100%;
height: 100%;
}
/web/acc/phpsysinfo/templates/dark_bootstrap.css
0,0 → 1,221
body {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 13px;
padding-top: 80px;
color: #c8c8c8;
background-color: #272b30;
}
 
wbr {
display: inline-block;
}
 
.table td.rightCell, .table th.rightCell {
text-align: right;
}
 
.percent {
text-align: center;
}
 
.card {
background-color: #2e3338;
border: none;
}
 
.navbar {
background-color: #3a3f44;
border-color: #2b2e32;
}
 
.navbar-brand, .navbar-brand:hover {
color: #fff;
margin-right: 0;
}
 
.treegrid-span {
display: table-cell;
}
 
.treegrid-spanbold {
font-weight: bold;
display: table-cell;
}
 
.treegrid-indent {
width: 16px;
height: 16px;
display: table-cell;
}
 
.treegrid-expander {
width: 0px;
height: 16px;
display: table-cell;
cursor: pointer;
}
 
.normalicon {
width: 16px;
height: 16px;
position: relative;
top: 1px;
display: table-cell;
font-style: normal;
font-weight: normal;
line-height: 1;
 
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.normalicon-right:before {
content: "\25ba";
}
.normalicon-down:before {
content: "\25bc";
}
 
table.sortable thead th {
cursor: pointer;
position: relative;
top: 0;
left: 0;
}
 
table.sortable thead th:hover {
background-color: #49515a;
}
 
.sorttable_nosort {
cursor: auto!important;
}
 
.table-hover > tbody > tr:hover {
color: #c8c8c8;
background-color: #49515a;
}
 
.table-hover > tfoot > tr:hover {
background-color: #49515a;
}
 
table.borderless td, table.borderless th, table.noborderattop tr:first-child td, table.noborderattop tr:first-child th {
border: none!important;
}
 
.table {
color: #c8c8c8;
background-color: #2e3338!important;
margin: 0;
border: 0;
}
 
.logo {
cursor: pointer;
width: 32px;
}
 
.select {
color: #c8c8c8;
}
 
.template {
cursor: pointer;
color: #333;
}
 
.language {
cursor: pointer;
color: #333;
}
 
.card-header {
background-color: #3e444c!important;
border-color: #3e444c!important;
color: #fff!important;
}
 
.progress {
margin-bottom: 0;
background-color: #1c1e22;
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);
box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);
}
 
.progress-bar-success {
background-color: #62c462;
}
 
.progress-bar-info {
background-color: #5bc0de;
}
 
.progress-bar-warning {
background-color: #f89406;
}
 
.progress-bar-danger {
background-color: #ee5f5b;
}
 
.modal-content {
background-color: #2e3338;
}
 
.list-group {
display: block;
}
 
.list-group-item {
background-color: #2e3338;
}
 
.reload {
background-image: url("../gfx/reload.gif");
float: right;
cursor: pointer;
width: 16px;
height: 16px;
}
 
.container {
padding:0;
}
 
.table thead th {
border-top: none;
}
 
a, a:visited {
color: #fff;
}
 
a:hover {
text-decoration: underline;
color: #fff;
}
 
.psihref, .psihref:visited {
color: #fff;
}
 
.psihref:hover {
text-decoration: underline;
color: #fff;
}
 
.col-lg-6, .col-lg-12 {
padding-bottom: 20px;
}
 
.badge {
font-size: 12px;
border-radius: 10px;
padding: 3px 7px;
float: right;
}
 
.table-nopadding > tbody > tr > td,
.table-nopadding > tbody > tr > th {
padding: 0;
}
/web/acc/phpsysinfo/templates/green_bootstrap.css
0,0 → 1,220
body {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 13px;
padding-top: 80px;
color: #333;
background-color: #fff;
}
 
wbr {
display: inline-block;
}
 
.table td.rightCell, .table th.rightCell {
text-align: right;
}
 
.percent {
text-align: center;
}
 
.card {
border-color: #f2f2f2;
}
 
.navbar {
background-color: #3bc873;
border-color: #33b667;
}
 
.navbar-brand, .navbar-brand:hover {
color: #fff;
margin-right: 0;
}
 
.treegrid-span {
display: table-cell;
}
 
.treegrid-spanbold {
font-weight: bold;
display: table-cell;
}
 
.treegrid-indent {
width: 16px;
height: 16px;
display: table-cell;
}
 
.treegrid-expander {
width: 0px;
height: 16px;
display: table-cell;
cursor: pointer;
}
 
.normalicon {
width: 16px;
height: 16px;
position: relative;
top: 1px;
display: table-cell;
font-style: normal;
font-weight: normal;
line-height: 1;
 
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.normalicon-right:before {
content: "\25ba";
}
.normalicon-down:before {
content: "\25bc";
}
 
table.sortable thead th {
cursor: pointer;
position: relative;
top: 0;
left: 0;
}
 
table.sortable thead th:hover {
background-color: #ececec;
}
 
.sorttable_nosort {
cursor: auto!important;
}
 
.table-hover > tbody > tr:hover {
color: #333;
background-color: #ececec;
}
 
.table-hover > tfoot > tr:hover {
background-color: #ececec;
}
 
table.borderless td, table.borderless th, table.noborderattop tr:first-child td, table.noborderattop tr:first-child th {
border: none!important;
}
 
.table {
color: #333;
background-color: #fff!important;
margin: 0;
border: 0;
}
 
.logo {
cursor: pointer;
width: 32px;
}
 
.select {
color: #333;
}
 
.template {
cursor: pointer;
color: #333;
}
 
.language {
cursor: pointer;
color: #333;
}
 
.card-header {
background-color: #33b770!important;
border-color: #33b770!important;
color: #fff!important;
}
 
.progress {
margin-bottom: 0;
background-color: #f5f5f5;
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);
box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);
}
 
.progress-bar-success {
background-color: #5bc0de;
}
 
.progress-bar-info {
background-color: #5cb85c;
}
 
.progress-bar-warning {
background-color: #f0ad4e;
}
 
.progress-bar-danger {
background-color: #d9534f;
}
 
.modal-content {
background-color: #fff;
}
 
.list-group {
display: block;
}
 
.list-group-item {
background-color: #fff;
}
 
.reload {
background-image: url("../gfx/reload.gif");
float: right;
cursor: pointer;
width: 16px;
height: 16px;
}
 
.container {
padding:0;
}
 
.table thead th {
border-top: none;
}
 
a, a:visited {
color: #000;
}
 
a:hover {
text-decoration: underline;
color: #000;
}
 
.psihref, .psihref:visited {
color: #fff;
}
 
.psihref:hover {
text-decoration: underline;
color: #fff;
}
 
.col-lg-6, .col-lg-12 {
padding-bottom: 20px;
}
 
.badge{
font-size: 12px;
border-radius: 10px;
padding: 3px 7px;
float: right;
}
 
.table-nopadding > tbody > tr > td,
.table-nopadding > tbody > tr > th {
padding: 0;
}
/web/acc/phpsysinfo/templates/idash.css
0,0 → 1,193
/* NextGen Remixed by iDash.pl */
a {
text-decoration: none;
color: #5a7000;
}
 
a:hover {
text-decoration: underline;
color: #5a7000;
}
 
* {
margin: 0;
padding: 0;
}
 
wbr {
display: inline-block;
}
 
html {
height: 100%;
background: url("idash/bg.png") repeat-x scroll center top #111;
}
 
body {
position: relative;
width: 940px;
_width: 945px; /* ie6 */
min-height: 100%;
overflow: auto;
margin: 0 auto;
padding: 20px 20px 0 20px;
font: 0.75em tahoma, arial, sans-serif;
color: #ccc;
}
 
div#output {
margin: -20px -10px 0 -10px;
padding: 95px 0 0 0;
}
 
p {
padding: 4px 10px 2px 10px;
line-height: 1.6;
text-align: left;
vertical-align: top;
}
 
h1 {
position: absolute;
top: 35px;
left: 10px;
margin: 0;
padding: 0px 10px;
font-size: 2em;
font-weight: normal;
color: #fff;
}
 
h2 {
padding: 5px 10px;
font-family: "trebuchet ms";
font-size: 1.2em;
font-weight: bold;
letter-spacing: 0.0em;
text-transform: uppercase;
color: #fff; /* #7d9100; */
background: #354242;
}
 
th, td, h3 {
padding: 4px 10px 2px 10px;
text-align: left;
vertical-align: top;
}
 
h3 {
font-size: 120%;
}
 
table {
width: 100%;
}
 
#select {
position: absolute;
top: 75px;
color: #fff;
right: 30px;
width: 370px;
text-align: right;
}
 
#select select {
width: 100px;
}
 
#vitals, #network, #memory, #filesystem, #hardware, #temperature, #voltage, #fans, #power, #current, #other, #ups {
float: left;
width: 451px;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding: 1px;
border: 1px solid #354242;
}
 
#pciTable, #ideTable, #scsiTable, #nvmeTable, #usbTable, #tbTable, #i2cTable {
padding: 0px 30px;
}
 
#memory, #filesystem {
width: 915px;
}
 
#filesystemTable thead tr th {
cursor: pointer;
}
 
#footer {
color: #777;
clear: both;
margin: 12px;
padding: 13px 25px;
line-height: 18px;
text-align: right;
}
 
.lang_047 {
color:444
}
 
.plugin {
float: left;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding: 1px;
border: 1px solid #354242;
}
 
.even {
background: #333;
}
 
.bar {
background: #34da64 url("idash/html.gif");
}
 
.barwarn {
background: #e69575 url("idash/htmlwarn.gif");
}
 
.right {
text-align: right;
padding-right: 20px;
}
 
.dataTables_wrapper{
margin: 0 0 0 0 !important;
border: 0px !important;
}
 
.treeimg {
display: table-cell;
*float: left; /* ie6 ie7 */
vertical-align: top;
}
 
.treespan {
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.treespanbold {
font-weight: bold;
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.tree tr td {
cursor: auto;
height: 100%;
}
 
.treediv {
display: table;
height: 100%;
}
 
.tablemain {
width: 100%;
height: 100%;
}
/web/acc/phpsysinfo/templates/jstyle_blue.css
0,0 → 1,179
/*
$Id: jstyle_blue.css 518 2011-10-28 08:09:07Z namiltd $
*/
a {
text-decoration: none;
color: #c03000;
}
 
a:hover {
text-decoration: underline;
}
 
* {
margin: 0;
padding: 0;
}
 
wbr {
display: inline-block;
}
 
html {
font-size: 100%;
height: 100%;
background-color: #f3f1e9;
color: #666;
}
 
body {
font-family: Verdana, "Bitstream Vera Sans";
font-size: .75em;
position: relative;
width: 940px;
_width: 945px; /* ie6 */
min-height: 100%;
overflow: auto;
margin: 0 auto;
padding: 20px 20px 0 20px;
}
 
p {
padding: 4px 10px 2px 10px;
line-height: 1.6;
text-align: left;
vertical-align: top;
}
 
h1 {
margin: 0 10px;
_margin: 0 15px 0 10px; /* ie6 */
padding: 10px 10px;
text-align: center;
color: #fff;
font-family: Georgia, serif;
font-weight: normal;
font-size: 150%;
line-height: 1.5em;
color: #326ea1;
}
 
h2 {
font-family: Georgia, serif;
font-weight: bold;
font-size: 130%;
padding: 3px 10px;
text-transform: uppercase;
line-height: 1.5em;
color: #326ea1;
border-bottom: 2px solid #326ea1;
}
 
th, td, h3 {
padding: 4px 10px 2px 10px;
text-align: left;
vertical-align: top;
font-size: 100%;
}
 
table {
width: 100%;
}
 
#select {
text-align: right;
}
 
#select select {
width: 100px;
}
 
#vitals, #network, #memory, #filesystem, #hardware, #temperature, #voltage, #fans, #power, #current, #other, #ups {
float: left;
width: 451px;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding: 1px;
}
 
#pciTable, #ideTable, #scsiTable, #nvmeTable, #usbTable, #tbTable, #i2cTable {
padding: 0px 30px;
}
 
#memory, #filesystem {
width: 915px;
}
 
#filesystemTable thead tr .header {
cursor: pointer;
}
 
#filesystemTable thead tr th {
cursor: pointer;
}
 
#footer {
clear: both;
color: #5c5c5c;
margin: 12px;
padding: 13px 25px;
line-height: 18px;
font-size: 80%;
text-align: center;
}
 
.plugin {
float: left;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding: 1px;
}
 
.even {
background: #ebe8da;
}
 
.bar {
background-color: #326edf;
}
 
.barwarn {
background-color: #df326e;
}
 
.right {
text-align: right;
padding-right: 20px;
}
 
.treeimg {
display: table-cell;
*float: left; /* ie6 ie7 */
vertical-align: top;
}
 
.treespan {
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.treespanbold {
font-weight: bold;
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.tree tr td {
cursor: auto;
height: 100%;
}
 
.treediv {
display: table;
height: 100%;
}
 
.tablemain {
width: 100%;
height: 100%;
}
/web/acc/phpsysinfo/templates/jstyle_green.css
0,0 → 1,174
/*
$Id: jstyle_green.css 518 2011-10-28 08:09:07Z namiltd $
*/
a {
color:#c03000;
text-decoration:none;
}
 
a:hover {
text-decoration:underline;
}
 
* {
margin:0;
padding:0;
}
 
wbr {
display: inline-block;
}
 
html {
background-color:#f3f1e9;
color:#666;
font-size:100%;
height:100%;
}
 
body {
font-family:Verdana, "Bitstream Vera Sans";
font-size:.75em;
margin:0 auto;
min-height:100%;
overflow:auto;
padding:20px 20px 0;
position:relative;
width:940px;
_width: 945px; /* ie6 */
}
 
p {
line-height:1.6;
padding:4px 10px 2px;
text-align:left;
vertical-align:top;
}
 
h1 {
color:#693;
font-family:Georgia, serif;
font-size:150%;
font-weight:400;
line-height:1.5em;
margin:0 10px;
_margin: 0 15px 0 10px; /* ie6 */
padding:10px;
text-align:center;
}
 
h2 {
border-bottom:2px solid #693;
color:#693;
font-family:Georgia, serif;
font-size:130%;
font-weight:700;
line-height:1.5em;
padding:3px 10px;
text-transform:uppercase;
}
 
th,td,h3 {
font-size:100%;
padding:4px 10px 2px;
text-align:left;
vertical-align:top;
}
 
table {
width:100%;
}
 
#select {
text-align:right;
}
 
#select select {
width:100px;
}
 
#vitals,#network, #memory, #filesystem, #hardware, #temperature, #voltage, #fans, #power, #current, #other, #ups {
float:left;
margin:10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding:1px;
width:451px;
}
 
#pciTable, #ideTable, #scsiTable, #nvmeTable, #usbTable, #tbTable, #i2cTable {
padding:0 30px;
}
 
#memory,#filesystem {
width:915px;
}
 
#filesystemTable thead tr th {
cursor:pointer;
}
 
#footer {
clear:both;
color:#5C5C5C;
font-size:80%;
line-height:18px;
margin:12px;
padding:13px 25px;
text-align:center;
}
 
.plugin {
float: left;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding: 1px;
}
 
.even {
background:#EBE8DA;
}
 
.bar {
background-color:#C1DC70;
}
 
.barwarn {
background-color:#DC8B70;
}
 
.right {
padding-right:20px;
text-align:right;
}
 
.treeimg {
display: table-cell;
*float: left; /* ie6 ie7 */
vertical-align: top;
}
 
.treespan {
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.treespanbold {
font-weight: bold;
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.tree tr td {
cursor: auto;
height: 100%;
}
 
.treediv {
display: table;
height: 100%;
}
 
.tablemain {
width: 100%;
height: 100%;
}
/web/acc/phpsysinfo/templates/lingruby.css
0,0 → 1,161
/*
$Id: two.css 518 2011-10-28 08:09:07Z namiltd $
*/
a {
text-decoration: none;
color: #cc0000;
}
 
a:hover {
text-decoration: underline;
}
 
* {
margin: 0;
padding: 0;
}
 
wbr {
display: inline-block;
}
 
html {
font-size: 100%;
height: 100%;
color: #2b2828;
background: url("lingruby/background.png") fixed center;
}
 
body {
font-family: "Comic Sans MS", sans-serif;
font-size: .85em;
position: relative;
width: 940px;
_width: 945px; /* ie6 */
min-height: 100%;
overflow: auto;
margin: 0 auto;
padding: 20px 20px 0 20px;
}
 
h1 {
margin: 0 10px;
_margin: 0 15px 0 10px; /* ie6 */
padding: 10px 10px;
text-align: center;
color: #fff;
font-weight: normal;
font-size: 170%;
line-height: 1.5em;
}
 
h2 {
font-weight: bold;
font-size: 150%;
line-height: 1.5em;
color: #fff;
border-bottom: 2px solid #fff;
}
 
th, td, h3 {
padding: 4px 10px 2px 10px;
text-align: left;
vertical-align: top;
font-size: 100%;
}
 
table {
width: 100%;
}
 
#select {
color: #fff;
text-align: right;
margin-bottom: 45px;
}
 
#select select {
width: 100px;
}
 
#vitals, #network, #memory, #filesystem, #hardware, #temperature, #voltage, #fans, #power, #current, #other, #ups {
float: left;
width: 451px;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding: 1px;
}
 
#pciTable, #ideTable, #scsiTable, #nvmeTable, #usbTable, #tbTable, #i2cTable {
padding: 0px 30px;
}
 
#memory, #filesystem {
width: 915px;
}
 
#filesystemTable thead tr th {
cursor: pointer;
}
 
#footer {
clear: both;
color: #000;
margin: 12px;
padding: 13px 25px;
line-height: 18px;
font-size: 90%;
text-align: center;
}
 
.plugin {
float: left;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding: 1px;
}
 
.bar {
background-color: #fff;
}
 
.barwarn {
background-color: #bbb;
}
 
.right {
text-align: right;
padding-right: 20px;
}
 
.treeimg {
display: table-cell;
*float: left; /* ie6 ie7 */
vertical-align: top;
}
 
.treespan {
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.treespanbold {
font-weight: normal;
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.tree tr td {
cursor: auto;
height: 100%;
}
 
.treediv {
display: table;
height: 100%;
}
 
.tablemain {
width: 100%;
height: 100%;
}
/web/acc/phpsysinfo/templates/nextgen.css
0,0 → 1,191
/*
$Id: nextgen.css 518 2011-10-28 08:09:07Z namiltd $
*/
a {
text-decoration: none;
color: #00a;
}
 
a:hover {
text-decoration: underline;
color: #7d9100;
}
 
* {
margin: 0;
padding: 0;
}
 
wbr {
display: inline-block;
}
 
html {
height: 100%;
background: url("nextgen/nextgen_bg.png") repeat-x scroll center top #f3f1e9;
}
 
body {
position: relative;
width: 940px;
_width: 945px; /* ie6 */
min-height: 100%;
overflow: auto;
margin: 0 auto;
padding: 20px 20px 0 20px;
font: 0.75em arial, tahoma, helvetica, sans-serif;
color: #000;
}
 
div#output {
margin: -20px -10px 0 -10px;
padding: 116px 0 0 0;
}
 
p {
padding: 4px 10px 2px 10px;
line-height: 1.6;
text-align: left;
vertical-align: top;
}
 
h1 {
position: absolute;
top: 35px;
left: 10px;
margin: 0;
padding: 0px 10px;
font-size: 2em;
font-weight: normal;
color: #fff;
}
 
h2 {
padding: 5px 10px;
font-family: "trebuchet ms";
font-size: 1.2em;
font-weight: bold;
letter-spacing: 0.0em;
text-transform: uppercase;
color: #c9de55; /* #7d9100; */
background: #354242;
}
 
th, td, h3 {
padding: 4px 10px 2px 10px;
text-align: left;
vertical-align: top;
}
 
h3 {
font-size: 120%;
}
 
table {
width: 100%;
}
 
#select {
position: absolute;
top: 75px;
color: #fff;
right: 30px;
width: 370px;
text-align: right;
}
 
#select select {
width: 100px;
}
 
#vitals, #network, #memory, #filesystem, #hardware, #temperature, #voltage, #fans, #power, #current, #other, #ups {
float: left;
width: 451px;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding: 1px;
border: 1px solid #354242;
}
 
#pciTable, #ideTable, #scsiTable, #nvmeTable, #usbTable, #tbTable, #i2cTable {
padding: 0px 30px;
}
 
#memory, #filesystem {
width: 915px;
}
 
#filesystemTable thead tr th {
cursor: pointer;
}
 
#footer {
color: #777;
clear: both;
margin: 12px;
padding: 13px 25px;
line-height: 18px;
text-align: right;
}
 
.plugin {
float: left;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding: 1px;
border: 1px solid #354242;
}
 
.even {
background: #ddd;
}
 
.bar {
background: #c1dc70 url("../gfx/html.gif");
}
 
.barwarn {
background: #dc8b70 url("../gfx/htmlwarn.gif");
}
 
.right {
text-align: right;
padding-right: 20px;
}
 
.dataTables_wrapper{
margin: 0 0 0 0 !important;
border: 0px !important;
}
 
.treeimg {
display: table-cell;
*float: left; /* ie6 ie7 */
vertical-align: top;
}
 
.treespan {
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.treespanbold {
font-weight: bold;
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.tree tr td {
cursor: auto;
height: 100%;
}
 
.treediv {
display: table;
height: 100%;
}
 
.tablemain {
width: 100%;
height: 100%;
}
/web/acc/phpsysinfo/templates/phpsysinfo.css
0,0 → 1,183
/*
$Id: phpsysinfo.css 589 2012-07-01 09:58:44Z namiltd $
*/
a {
text-decoration: none;
color: #c03000;
}
 
a:hover {
text-decoration: underline;
}
 
* {
margin: 0;
padding: 0;
}
 
wbr {
display: inline-block;
}
 
html {
height: 100%;
background: url("../gfx/html.gif");
}
 
body {
position: relative;
width: 940px;
_width: 945px; /* ie6 */
min-height: 100%;
overflow: auto;
margin: 0 auto;
padding: 20px 20px 0 20px;
font: 0.75em arial, tahoma, helvetica, sans-serif;
color: #000;
background: #fff url("../gfx/body.gif") repeat-y;
_bac\kground: #fff; /* ie6 only */
}
 
p {
padding: 4px 10px 2px 10px;
line-height: 1.6;
text-align: left;
vertical-align: top;
}
 
h1 {
margin: 0 10px;
_margin: 0 15px 0 10px; /* ie6 */
padding: 10px 10px;
border-top: 1px solid #8a6e5a;
border-bottom: 1px solid #8a6e5a;
font-size: 2em;
font-weight: normal;
color: #fff;
background: #8a6e5a;
}
 
h2 {
padding: 5px 10px;
font-family: "trebuchet ms";
font-size: 1.2em;
font-weight: bold;
letter-spacing: 0.0em;
text-transform: uppercase;
color: #fff;
background: #5a7e8a;
}
 
th, td, h3 {
padding: 4px 10px 2px 10px;
text-align: left;
vertical-align: top;
}
 
h3 {
font-size: 120%;
}
 
table {
width: 100%;
}
 
#select {
text-align: right;
padding: 10px;
}
 
#select select {
width: 100px;
}
 
#vitals, #network, #memory, #filesystem, #hardware, #temperature, #voltage, #fans, #power, #current, #other, #ups {
float: left;
width: 451px;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding: 1px;
border: 1px solid #5a7e8a;
}
 
#pciTable, #ideTable, #scsiTable, #nvmeTable, #usbTable, #tbTable, #i2cTable {
padding: 0px 30px;
}
 
#memory, #filesystem {
width: 915px;
}
 
#filesystemTable thead tr th {
cursor: pointer;
}
 
#footer {
clear: both;
color: #c9c9c9;
margin: 12px;
padding: 13px 25px;
line-height: 18px;
}
 
.plugin {
float: left;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding: 1px;
border: 1px solid #5a7e8a;
}
 
.even {
background: #d6d6d6;
}
 
.bar {
background: #c1dc70 url("../gfx/html.gif");
}
 
.barwarn {
background: #dc8b70 url("../gfx/htmlwarn.gif");
}
 
.right {
text-align: right;
padding-right: 20px;
}
 
.dataTables_wrapper{
margin: 0 0 0 0 !important;
border: 0px !important;
}
 
.treeimg {
display: table-cell;
*float: left; /* ie6 ie7 */
vertical-align: top;
}
 
.treespan {
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.treespanbold {
font-weight: bold;
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.tree tr td {
cursor: auto;
height: 100%;
}
 
.treediv {
display: table;
height: 100%;
}
 
.tablemain {
width: 100%;
height: 100%;
}
/web/acc/phpsysinfo/templates/phpsysinfo_bootstrap.css
0,0 → 1,220
body {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 13px;
padding-top: 80px;
color: #333;
background-color: #fff;
}
 
wbr {
display: inline-block;
}
 
.table td.rightCell, .table th.rightCell {
text-align: right;
}
 
.percent {
text-align: center;
}
 
.card {
border-color: #f2f2f2;
}
 
.navbar {
background-color: #3b87c8;
border-color: #2d6da3;
}
 
.navbar-brand, .navbar-brand:hover {
color: #fff;
margin-right: 0;
}
 
.treegrid-span {
display: table-cell;
}
 
.treegrid-spanbold {
font-weight: bold;
display: table-cell;
}
 
.treegrid-indent {
width: 16px;
height: 16px;
display: table-cell;
}
 
.treegrid-expander {
width: 0px;
height: 16px;
display: table-cell;
cursor: pointer;
}
 
.normalicon {
width: 16px;
height: 16px;
position: relative;
top: 1px;
display: table-cell;
font-style: normal;
font-weight: normal;
line-height: 1;
 
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.normalicon-right:before {
content: "\25ba";
}
.normalicon-down:before {
content: "\25bc";
}
 
table.sortable thead th {
cursor: pointer;
position: relative;
top: 0;
left: 0;
}
 
table.sortable thead th:hover {
background-color: #ececec;
}
 
.sorttable_nosort {
cursor: auto!important;
}
 
.table-hover > tbody > tr:hover {
color: #333;
background-color: #ececec;
}
 
.table-hover > tfoot > tr:hover {
background-color: #ececec;
}
 
table.borderless td, table.borderless th, table.noborderattop tr:first-child td, table.noborderattop tr:first-child th {
border: none!important;
}
 
.table {
color: #333;
background-color: #fff!important;
margin: 0;
border: 0;
}
 
.logo {
cursor: pointer;
width: 32px;
}
 
.select {
color: #333;
}
 
.template {
cursor: pointer;
color: #333;
}
 
.language {
cursor: pointer;
color: #333;
}
 
.card-header {
background-color: #337ab7!important;
border-color: #337ab7!important;
color: #fff!important;
}
 
.progress {
margin-bottom: 0;
background-color: #f5f5f5;
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);
box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);
}
 
.progress-bar-success {
background-color: #5cb85c;
}
 
.progress-bar-info {
background-color: #5bc0de;
}
 
.progress-bar-warning {
background-color: #f0ad4e;
}
 
.progress-bar-danger {
background-color: #d9534f;
}
 
.modal-content {
background-color: #fff;
}
 
.list-group {
display: block;
}
 
.list-group-item {
background-color: #fff;
}
 
.reload {
background-image: url("../gfx/reload.gif");
float: right;
cursor: pointer;
width: 16px;
height: 16px;
}
 
.container {
padding:0;
}
 
.table thead th {
border-top: none;
}
 
a, a:visited {
color: #000;
}
 
a:hover {
text-decoration: underline;
color: #000;
}
 
.psihref, .psihref:visited {
color: #fff;
}
 
.psihref:hover {
text-decoration: underline;
color: #fff;
}
 
.col-lg-6, .col-lg-12 {
padding-bottom: 20px;
}
 
.badge {
font-size: 12px;
border-radius: 10px;
padding: 3px 7px;
float: right;
}
 
.table-nopadding > tbody > tr > td,
.table-nopadding > tbody > tr > th {
padding: 0;
}
/web/acc/phpsysinfo/templates/schabau.css
0,0 → 1,175
/*
$Id: schabau.css 518 2011-10-28 08:09:07Z namiltd $
*/
a {
text-decoration: none;
color: #c03000;
}
 
a:hover {
text-decoration: underline;
}
 
* {
margin: 0;
padding: 0;
}
 
wbr {
display: inline-block;
}
 
html {
font-size: 100%;
height: 100%;
background-color: #f2f2df;
color: #666;
}
 
body {
font-family: Verdana, "Bitstream Vera Sans";
font-size: .75em;
position: relative;
width: 940px;
_width: 945px; /* ie6 */
min-height: 100%;
overflow: auto;
margin: 0 auto;
padding: 20px 20px 0 20px;
}
 
p {
padding: 4px 10px 2px 10px;
line-height: 1.6;
text-align: left;
vertical-align: top;
}
 
h1 {
margin: 0 10px;
_margin: 0 15px 0 10px; /* ie6 */
padding: 10px 10px;
text-align: center;
color: #fff;
font-family: Georgia, serif;
font-weight: normal;
font-size: 150%;
line-height: 1.5em;
color: #326ea1;
}
 
h2 {
font-family: Georgia, serif;
font-weight: bold;
font-size: 130%;
padding: 3px 10px;
text-transform: uppercase;
line-height: 1.5em;
color: #326ea1;
border-bottom: 2px solid #326ea1;
}
 
th, td, h3 {
padding: 4px 10px 2px 10px;
text-align: left;
vertical-align: top;
font-size: 100%;
}
 
table {
width: 100%;
}
 
#select {
text-align: right;
}
 
#select select {
width: 100px;
}
 
#vitals, #network, #memory, #filesystem, #hardware, #temperature, #voltage, #fans, #power, #current, #other, #ups {
float: left;
width: 451px;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding: 1px;
}
 
#pciTable, #ideTable, #scsiTable, #nvmeTable, #usbTable, #tbTable, #i2cTable {
padding: 0px 30px;
}
 
#memory, #filesystem {
width: 915px;
}
 
#filesystemTable thead tr th {
cursor: pointer;
}
 
#footer {
clear: both;
color: #5c5c5c;
margin: 12px;
padding: 13px 25px;
line-height: 18px;
font-size: 80%;
text-align: center;
}
 
.plugin {
float: left;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding: 1px;
}
 
.even {
background: #ebe8da;
}
 
.bar {
background-color: #326edf;
}
 
.barwarn {
background-color: #fa5858;
}
 
.right {
text-align: right;
padding-right: 20px;
}
 
.treeimg {
display: table-cell;
*float: left; /* ie6 ie7 */
vertical-align: top;
}
 
.treespan {
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.treespanbold {
font-weight: bold;
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.tree tr td {
cursor: auto;
height: 100%;
}
 
.treediv {
display: table;
height: 100%;
}
 
.tablemain {
width: 100%;
height: 100%;
}
/web/acc/phpsysinfo/templates/two.css
0,0 → 1,162
/*
$Id: two.css 518 2011-10-28 08:09:07Z namiltd $
*/
a {
text-decoration: none;
color: #c03000;
}
 
a:hover {
text-decoration: underline;
}
 
* {
margin: 0;
padding: 0;
}
 
wbr {
display: inline-block;
}
 
html {
font-size: 100%;
height: 100%;
color: #2b2828;
background: url("two/gradient.png") repeat-x #eef2fe;
}
 
body {
font-family: Verdana, "Bitstream Vera Sans";
font-size: .75em;
position: relative;
width: 940px;
_width: 945px; /* ie6 */
min-height: 100%;
overflow: auto;
margin: 0 auto;
padding: 20px 20px 0 20px;
}
 
h1 {
margin: 0 10px;
_margin: 0 15px 0 10px; /* ie6 */
padding: 10px 10px;
text-align: center;
color: #fff;
font-weight: normal;
font-size: 170%;
line-height: 1.5em;
}
 
h2 {
font-weight: bold;
font-size: 130%;
line-height: 1.5em;
color: #8b272a;
border-bottom: 2px solid #8b272a;
}
 
th, td, h3 {
padding: 4px 10px 2px 10px;
text-align: left;
vertical-align: top;
font-size: 100%;
}
 
table {
width: 100%;
}
 
 
#select {
color: #fff;
text-align: right;
margin-bottom: 45px;
}
 
#select select {
width: 100px;
}
 
#vitals, #network, #memory, #filesystem, #hardware, #temperature, #voltage, #fans, #power, #current, #other, #ups {
float: left;
width: 451px;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding: 1px;
}
 
#pciTable, #ideTable, #scsiTable, #nvmeTable, #usbTable, #tbTable, #i2cTable {
padding: 0px 30px;
}
 
#memory, #filesystem {
width: 915px;
}
 
#filesystemTable thead tr th {
cursor: pointer;
}
 
#footer {
clear: both;
color: #5c5c5c;
margin: 12px;
padding: 13px 25px;
line-height: 18px;
font-size: 80%;
text-align: center;
}
 
.plugin {
float: left;
margin: 10px 0 0 10px;
_margin: 10px 5px 0 5px; /* ie6 */
padding: 1px;
}
 
.bar {
background-color: #8b272a;
}
 
.barwarn {
background-color: #88278b;
}
 
.right {
text-align: right;
padding-right: 20px;
}
 
.treeimg {
display: table-cell;
*float: left; /* ie6 ie7 */
vertical-align: top;
}
 
.treespan {
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.treespanbold {
font-weight: bold;
display: table-cell;
*float: left; /* ie6 ie7 */
}
 
.tree tr td {
cursor: auto;
height: 100%;
}
 
.treediv {
display: table;
height: 100%;
}
 
.tablemain {
width: 100%;
height: 100%;
}
/web/acc/phpsysinfo/xml.php
0,0 → 1,55
<?php
header('Access-Control-Allow-Origin: *');
/**
* generate the xml
*
* PHP version 5
*
* @category PHP
* @package PSI_XML
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
* @copyright 2009 phpSysInfo
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
* @version SVN: $Id: xml.php 614 2012-07-28 09:02:59Z jacky672 $
* @link http://phpsysinfo.sourceforge.net
*/
 
/**
* application root path
*
* @var string
*/
define('PSI_APP_ROOT', dirname(__FILE__));
 
require_once PSI_APP_ROOT.'/includes/autoloader.inc.php';
 
if ((isset($_GET['json']) || isset($_GET['jsonp'])) && !extension_loaded("json")) {
echo '<Error Message="The json extension to php required!" Function="ERROR"/>';
} else {
// check what xml part should be generated
if (isset($_GET['plugin'])) {
if (($_GET['plugin'] !== "") && !preg_match('/[^A-Za-z]/', $_GET['plugin'])) {
$output = new WebpageXML($_GET['plugin']);
} else {
unset($output);
}
} else {
$output = new WebpageXML();
}
// if $output is correct generate output in proper type
if (isset($output) && is_object($output)) {
if (isset($_GET['json']) || isset($_GET['jsonp'])) {
header("Cache-Control: no-cache, must-revalidate\n");
$json = $output->getJsonString();
if (isset($_GET['jsonp'])) {
header("Content-Type: application/javascript\n\n");
echo (!preg_match('/[^\w\?]/', $_GET['callback'])?$_GET['callback']:'') . '('.$json.')';
} else {
header("Content-Type: application/json\n\n");
echo $json;
}
} else {
$output->run();
}
}
}