[Phpsysinfo-subversion] SF.net SVN: phpsysinfo:[687] branches/namiltd-ini
Brought to you by:
namiltd
|
From: <na...@us...> - 2012-09-06 20:54:56
|
Revision: 687
http://phpsysinfo.svn.sourceforge.net/phpsysinfo/?rev=687&view=rev
Author: namiltd
Date: 2012-09-06 20:54:49 +0000 (Thu, 06 Sep 2012)
Log Message:
-----------
php.ini checking
Modified Paths:
--------------
branches/namiltd-ini/includes/os/class.Haiku.inc.php
branches/namiltd-ini/includes/os/class.Minix.inc.php
branches/namiltd-ini/includes/os/class.SunOS.inc.php
branches/namiltd-ini/includes/xml/class.XML.inc.php
branches/namiltd-ini/index.php
branches/namiltd-ini/templates/html/error_config.html
Modified: branches/namiltd-ini/includes/os/class.Haiku.inc.php
===================================================================
--- branches/namiltd-ini/includes/os/class.Haiku.inc.php 2012-09-05 09:02:55 UTC (rev 686)
+++ branches/namiltd-ini/includes/os/class.Haiku.inc.php 2012-09-06 20:54:49 UTC (rev 687)
@@ -39,7 +39,6 @@
public function __construct()
{
parent::__construct();
- $this->error->addError("WARN", "The Haiku version of phpSysInfo is work in progress, some things currently don't work");
}
/**
@@ -98,27 +97,26 @@
$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 (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);
- }
- }
- }
- }
+ 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);
+ }
+ }
+ }
+ }
}
/**
@@ -130,15 +128,15 @@
protected function _usb()
{
if (CommonFunctions::executeProgram('listusb', '', $bufr, PSI_DEBUG)){
- $devices = preg_split("/\n/", $bufr);
+ $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);
- }
+ $dev = new HWDevice();
+ $dev->setName(trim($ar_buf[1]." ".$ar_buf[2]));
+ $this->sys->setUSBDevices($dev);
+ }
}
- }
+ }
}
/**
@@ -206,9 +204,9 @@
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]));
- }
+ if (PSI_LOAD_BAR) {
+ $this->sys->setLoadPercent(round($ar_buf[1]));
+ }
}
}
}
@@ -278,14 +276,14 @@
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);
- }
+ $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);
+ }
}
}
}
@@ -325,51 +323,51 @@
private function _network()
{
if (CommonFunctions::executeProgram('ifconfig', '', $bufr, PSI_DEBUG)){
- $lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
- $notwas = true;
- foreach ($lines as $line) {
- if (preg_match("/^(\S+)/", $line, $ar_buf)) {
- if (!$notwas) {
- $dev->setErrors($errors);
- $dev->setDrops($drops);
- $this->sys->setNetDevices($dev);
- }
+ $lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
+ $notwas = true;
+ foreach ($lines as $line) {
+ if (preg_match("/^(\S+)/", $line, $ar_buf)) {
+ if (!$notwas) {
+ $dev->setErrors($errors);
+ $dev->setDrops($drops);
+ $this->sys->setNetDevices($dev);
+ }
$errors = 0;
$drops = 0;
- $dev = new NetDevice();
- $dev->setName($ar_buf[1]);
- $notwas = false;
- } else {
- if (!$notwas) {
+ $dev = new NetDevice();
+ $dev->setName($ar_buf[1]);
+ $notwas = false;
+ } else {
+ if (!$notwas) {
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]);
+ $errors +=$ar_buf2[1];
+ $drops +=$ar_buf2[3];
+ $dev->setRxBytes($ar_buf2[2]);
}
else if (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]);
+ $errors +=$ar_buf2[1];
+ $drops +=$ar_buf2[3];
+ $dev->setTxBytes($ar_buf2[2]);
}
- if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) {
+ if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) {
if (preg_match('/\sEthernet,\s+Address:\s(\S*)/i', $line, $ar_buf2))
- $dev->setInfo(preg_replace('/:/', '-', $ar_buf2[1]));
+ $dev->setInfo(preg_replace('/:/', '-', $ar_buf2[1]));
else if (preg_match('/^\s+inet\saddr:\s(\S*),/i', $line, $ar_buf2))
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1]);
else if (preg_match('/^\s+inet6\saddr:\s(\S*),/i', $line, $ar_buf2))
- if (!preg_match('/^fe80::/i',$ar_buf2[1]))
- $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1]);
+ if (!preg_match('/^fe80::/i',$ar_buf2[1]))
+ $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1]);
}
- }
- }
- }
- if (!$notwas) {
- $dev->setErrors($errors);
- $dev->setDrops($drops);
- $this->sys->setNetDevices($dev);
- }
- }
+ }
+ }
+ }
+ if (!$notwas) {
+ $dev->setErrors($errors);
+ $dev->setDrops($drops);
+ $this->sys->setNetDevices($dev);
+ }
+ }
}
/**
@@ -379,6 +377,7 @@
*/
function build()
{
+ $this->error->addError("WARN", "The Haiku version of phpSysInfo is work in progress, some things currently don't work");
$this->_hostname();
$this->_ip();
$this->_distro();
Modified: branches/namiltd-ini/includes/os/class.Minix.inc.php
===================================================================
--- branches/namiltd-ini/includes/os/class.Minix.inc.php 2012-09-05 09:02:55 UTC (rev 686)
+++ branches/namiltd-ini/includes/os/class.Minix.inc.php 2012-09-06 20:54:49 UTC (rev 687)
@@ -39,7 +39,6 @@
public function __construct()
{
parent::__construct();
- $this->error->addError("WARN", "The Minix version of phpSysInfo is work in progress, some things currently don't work");
}
/**
@@ -315,6 +314,7 @@
*/
function build()
{
+ $this->error->addError("WARN", "The Minix version of phpSysInfo is work in progress, some things currently don't work");
$this->_hostname();
$this->_ip();
$this->_distro();
Modified: branches/namiltd-ini/includes/os/class.SunOS.inc.php
===================================================================
--- branches/namiltd-ini/includes/os/class.SunOS.inc.php 2012-09-05 09:02:55 UTC (rev 686)
+++ branches/namiltd-ini/includes/os/class.SunOS.inc.php 2012-09-06 20:54:49 UTC (rev 687)
@@ -31,7 +31,6 @@
*/
public function __construct()
{
- $this->error->addError("WARN", "The SunOS version of phpSysInfo is work in progress, some things currently don't work");
}
/**
@@ -265,6 +264,7 @@
*/
function build()
{
+ $this->error->addError("WARN", "The SunOS version of phpSysInfo is work in progress, some things currently don't work");
$this->_hostname();
$this->_ip();
$this->_distro();
Modified: branches/namiltd-ini/includes/xml/class.XML.inc.php
===================================================================
--- branches/namiltd-ini/includes/xml/class.XML.inc.php 2012-09-05 09:02:55 UTC (rev 686)
+++ branches/namiltd-ini/includes/xml/class.XML.inc.php 2012-09-06 20:54:49 UTC (rev 687)
@@ -458,6 +458,24 @@
{
if (!$this->_plugin_request || $this->_complete_request) {
if ($this->_sys === null) {
+ if (PSI_DEBUG === true){
+ // 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 = str_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");
+ }
+ }
$this->_sys = $this->_sysinfo->getSys();
}
$this->_buildVitals();
Modified: branches/namiltd-ini/index.php
===================================================================
--- branches/namiltd-ini/index.php 2012-09-05 09:02:55 UTC (rev 686)
+++ branches/namiltd-ini/index.php 2012-09-06 20:54:49 UTC (rev 687)
@@ -32,41 +32,16 @@
}
require_once APP_ROOT.'/includes/autoloader.inc.php';
-
+
// Load configuration
-if (!is_readable(APP_ROOT.'/config.php')) {
+require_once APP_ROOT.'/config.php';
+
+if (!defined('PSI_CONFIG_FILE')||(!defined('PSI_DEBUG'))){
$tpl = new Template("/templates/html/error_config.html");
echo $tpl->fetch();
die();
}
-else {
- include_once APP_ROOT.'/config.php';
-}
-/*
-if (!defined('PSI_DEBUG')){
- trigger_error("Error: phpSysInfo requires setting 'DEBUG' (true or false) in 'phpsysinfo.ini'", E_USER_ERROR);
-}
-if (PSI_DEBUG === true){
-// Safe mode check
- $safe_mode = @ini_get("safe_mode") ? TRUE : FALSE;
- if ($safe_mode) {
- echo "Warning: phpSysInfo requires you to set off 'safe_mode' in 'php.ini'";
- }
-// Include path check
- $include_path = @ini_get("include_path");
- if (($include_path)&&($include_path!="")) {
- $include_path = str_replace(":", "\n", $include_path);
- if (preg_match("/^\.$/m", $include_path)) {
- $include_path = ".";
- }
- }
- if ($include_path != "." ) {
- echo "Warning: phpSysInfo requires '.' inside the 'include_path' in php.ini";
- }
-}
-*/
-
// redirect to page with and without javascript
$display = isset($_GET['disp']) ? $_GET['disp'] : strtolower(PSI_DEFAULT_DISPLAY_MODE);
switch ($display) {
Modified: branches/namiltd-ini/templates/html/error_config.html
===================================================================
--- branches/namiltd-ini/templates/html/error_config.html 2012-09-05 09:02:55 UTC (rev 686)
+++ branches/namiltd-ini/templates/html/error_config.html 2012-09-06 20:54:49 UTC (rev 687)
@@ -15,7 +15,7 @@
<body onload="doRedirect()">
<h1>phpSysInfo - Error</h1>
<div style="position:absolute;top:150px;text-align:center;width:95%;">
- <p style="margin:12pt;"><strong>config.php</strong> does not exist or is not readable by the webserver in the phpsysinfo directory.</p>
+ <p style="margin:12pt;"><strong>phpsysinfo.ini</strong> does not exist or is not readable by the webserver in the phpsysinfo directory or is misunderstood.</p>
<p style="margin:12pt;">Generated by <a href="http://phpsysinfo.sourceforge.net/">phpSysInfo - <?php echo PSI_VERSION_STRING ?></a></p>
</div>
</body>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|