addError('include(class.' . PHP_OS . '.php.inc)' , PHP_OS . ' is not currently supported', __LINE__, __FILE__ );
}
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 ( !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__ );
}
}
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__ );
}
if( $error->ErrorsExist() ) {
echo $error->ErrorsAsHTML();
exit;
}
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(APP_ROOT .'/templates/' . $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 = split(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
if (count($plng) > 0) {
while (list($k, $v) = each($plng)) {
$k = split(';', $v, 1);
$k = split('-', $k[0]);
if (file_exists(APP_ROOT . '/includes/lang/' . $k[0] . '.php')) {
$lng = $k[0];
break;
}
}
}
}
}
$lng = basename($lng);
if (file_exists(APP_ROOT . '/includes/lang/' . $lng . '.php')) {
$charset = $app_strings['LBL_CHARSET'];
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/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 = "\n";
$xml .= "\n\n";
$xml .= created_by();
$xml .= "