[Phpsysinfo-subversion] SF.net SVN: phpsysinfo:[40] xml.php
Brought to you by:
namiltd
From: <Big...@us...> - 2008-12-08 10:57:27
|
Revision: 40 http://phpsysinfo.svn.sourceforge.net/phpsysinfo/?rev=40&view=rev Author: BigMichi1 Date: 2008-12-08 10:57:25 +0000 (Mon, 08 Dec 2008) Log Message: ----------- import cvs Added Paths: ----------- xml.php Added: xml.php =================================================================== --- xml.php (rev 0) +++ xml.php 2008-12-08 10:57:25 UTC (rev 40) @@ -0,0 +1,120 @@ +<?php +/*************************************************************************** + * Copyright (C) 2008 by phpSysInfo - A PHP System Information Script * + * http://phpsysinfo.sourceforge.net/ * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +// +// $Id$ +// +define('APP_ROOT', dirname(__FILE__)); +define('IN_PHPSYSINFO', true); +if (!defined('PSI_INTERNAL_XML')) { + define('PSI_INTERNAL_XML', true); +} +require_once (APP_ROOT . '/includes/common_functions.php'); // Set of common functions used through out the app + +/** + * Check for the SimpleXML fuction. We need this for almost everything. + * Even our error class needs this to output the errors. + * Because of that this check uses a custom error function that will + * return a hard coded XML file (with headers). + */ +checkForExtensions(); +$error = Error :: singleton(); +if (!file_exists(APP_ROOT . '/config.php')) { + $error->addError('file_exists(config.php)', 'config.php does not exist in the phpsysinfo directory.'); +} else { + // get the config file + require_once (APP_ROOT . '/config.php'); +} +$plugin = (isset ($_GET['plugin'])) ? basename(htmlspecialchars($_GET['plugin'])) : ""; +if ($plugin == "complete") { + $plugin_request = false; + $completexml = true; +} +elseif ($plugin != "") { + $plugins = explode(",", PSI_PLUGINS); + if (in_array($plugin, $plugins)) { + $plugin_request = true; + $completexml = false; + } else { + $plugin_request = false; + $completexml = false; + } +} else { + $plugin_request = false; + $completexml = false; +} +if (!$plugin_request) { + // Figure out which OS we are running on, and detect support + if (file_exists(APP_ROOT . '/includes/os/class.' . PHP_OS . '.inc.php')) { + require_once (APP_ROOT . '/includes/os/class.' . PHP_OS . '.inc.php'); + } else { + $error->addError('include(class.' . PHP_OS . '.php.inc)', PHP_OS . ' is not currently supported'); + } + if (!extension_loaded('pcre')) { + $error->addError('extension_loaded(pcre)', 'phpsysinfo requires the pcre module for php to work'); + } + if (PSI_SENSOR_PROGRAM !== false) { + if (!file_exists(APP_ROOT . '/includes/mb/class.' . PSI_SENSOR_PROGRAM . '.inc.php')) { + define('PSI_MBINFO', false); + $error->addError('include(class.' . htmlspecialchars(PSI_SENSOR_PROGRAM, ENT_QUOTES) . '.inc.php)', 'specified sensor program is not supported'); + } else { + require_once (APP_ROOT . '/includes/mb/class.' . PSI_SENSOR_PROGRAM . '.inc.php'); + define('PSI_MBINFO', true); + } + } else { + define('PSI_MBINFO', false); + } + if (PSI_HDD_TEMP !== false) { + if (PSI_HDD_TEMP != "tcp" && PSI_HDD_TEMP != "suid") { + $error->addError('include(class.hddtemp.inc.php)', 'bad configuration in config.php for PSI_HDD_TEMP'); + define('PSI_HDDTEMP', false); + } else { + require_once (APP_ROOT . '/includes/mb/class.hddtemp.inc.php'); + define('PSI_HDDTEMP', true); + } + } else { + define('PSI_HDDTEMP', false); + } + if (PSI_UPS_PROGRAM !== false) { + $ups_program = basename(PSI_UPS_PROGRAM); + if (!file_exists(APP_ROOT . '/includes/ups/class.' . $ups_program . '.inc.php')) { + define('PSI_UPSINFO', false); + $error->addError('include(class.' . htmlspecialchars($ups_program, ENT_QUOTES) . '.inc.php)', 'specified UPS program is not supported'); + } else { + require_once (APP_ROOT . '/includes/ups/class.' . $ups_program . '.inc.php'); + define('PSI_UPSINFO', true); + define('PSI_UPSINFO_APCUPSD_UPS_LIST', PSI_APCUPSD_UPS_LIST); + } + } else { + define('PSI_UPSINFO', false); + } + if ($error->ErrorsExist()) { + header("Content-Type: text/xml\n\n"); + echo $error->ErrorsAsXML(); + exit; + } +} +// Create the XML file +require_once (APP_ROOT . '/includes/xml.class.php'); +($plugin_request) ? $xml = new xml($plugin, $completexml) : $xml = new xml("", $completexml); +$xml->buildXml(); +if (PSI_INTERNAL_XML) { + $xml->printXml(); +} \ No newline at end of file Property changes on: xml.php ___________________________________________________________________ Added: svn:mime-type + text/x-php Added: svn:keywords + Id Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |