/** * set parameters for the generation process * * @param boolean $completeXML switch for complete xml with all plugins * @param string $plugin name of the plugin * * @return void */ public function __construct($completeXML, $plugin = null) { parent::__construct(); if ($completeXML) { $this->_plugins = CommonFunctions::getPlugins(); } if ($plugin !== null) { if (!is_array($plugin)) { $plugin = array($plugin); } foreach ($plugin as $p) { if (in_array(strtolower($p), CommonFunctions::getPlugins())) { $this->_plugins[] = $p; } $this->_pluginRequest = true; } } $this->_prepare(); }
/** * render the page * * @return void */ public function run() { $this->_checkTemplateLanguage(); echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n"; echo " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"; echo " <head>\n"; echo " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n"; echo " <meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />\n"; echo " <meta http-equiv=\"Content-Script-Type\" content=\"text/javascript\" />\n"; echo " <meta name=\"Description\" content=\"PHPSysInfo is a customizable PHP Script that parses /proc, and formats information nicely."; echo " It will display information about system facts like Uptime, CPU, Memory, PCI devices, SCSI devices, IDE devices, Network adapters, Disk usage, and more.\" />\n"; echo " <link type=\"text/css\" rel=\"stylesheet\" href=\"./templates/" . $this->_template . ".css\" title=\"PSI_Template\"/>\n"; echo " <link type=\"text/css\" rel=\"stylesheet\" href=\"./templates/plugin/nyroModal.full.css\" />\n"; echo " <link type=\"text/css\" rel=\"stylesheet\" href=\"./templates/plugin/jquery.jgrowl.css\" />\n"; echo " <link type=\"text/css\" rel=\"stylesheet\" href=\"./templates/plugin/jquery.dataTables.css\" />\n"; echo " <link type=\"text/css\" rel=\"stylesheet\" href=\"./templates/plugin/jquery.treeTable.css\" />\n"; echo " <script type=\"text/JavaScript\" src=\"./js.php?name=jquery\"></script>\n"; echo " <script type=\"text/JavaScript\" src=\"./js.php?name=jquery.dataTables\"></script>\n"; echo " <script type=\"text/JavaScript\" src=\"./js.php?name=jquery.nyroModal\"></script>\n"; echo " <script type=\"text/JavaScript\" src=\"./js.php?name=jquery.jgrowl\"></script>\n"; echo " <script type=\"text/JavaScript\" src=\"./js.php?name=jquery.timers\"></script>\n"; echo " <script type=\"text/JavaScript\" src=\"./js.php?name=jquery.treeTable\"></script>\n"; echo " <script type=\"text/JavaScript\" src=\"./js.php?name=phpsysinfo\"></script>\n"; foreach (CommonFunctions::getPlugins() as $plugin) { echo " <script type=\"text/JavaScript\" src=\"./js.php?plugin=" . trim($plugin) . "\"></script>\n"; } echo " <title>PhpSysInfo " . CommonFunctions::PSI_VERSION . "</title>\n"; echo " </head>\n"; echo " <body>\n"; echo " <div id=\"loader\">\n"; echo " <img width=\"16\" align=\"absmiddle\" src=\"../vulnmeter/images/loading.gif\" border=\"0\" alt=\"" . _("Loading") . "\" title=\"" . _("Loading") . "\"> " . _("Loading... please wait!") . "\n"; echo " </div>\n"; echo " <div id=\"errors\" style=\"display: none; width: 940px\">\n"; echo " <div id=\"errorlist\">\n"; echo " <h2>Oh, I'm sorry. Something seems to be wrong.</h2>\n"; echo " </div>\n"; echo " </div>\n"; echo " <div id=\"container\">\n"; echo " <h1>\n"; echo " <a href=\"#errors\" class=\"nyroModal\">\n"; echo " <img id=\"warn\" style=\"vertical-align: middle; display:none; border:0px;\" src=\"./gfx/attention.png\" alt=\"warning\" />\n"; echo " </a>\n"; echo " <span id=\"title\">\n"; echo " <span id=\"lang_001\">System information</span>\n"; echo " : <span id=\"s_hostname_title\"></span>\n"; echo " <span id=\"s_ip_title\"></span> <a href='/munin/localdomain/localhost.localdomain.html#Processes' style='text-decoration:none;text-transform:none;color:black'><img src='../pixmaps/chart_bar.png' border='0' align='absmiddle'> Resources</a> \n"; /*$tz =( isset($_SESSION["_timezone"]) ) ? intval($_SESSION["_timezone"]) : intval(date("O"))/100; $timetz = gmdate("U")+(3600*$tz); echo " <span id=\"s_ip_title\"></span> <a target='main' href='/ossim/report/host_report.php?hmenu=Sysinfo&smenu=Sysinfo&host=any&star_date=".gmdate("Y-m-d",$timetz-604800)."&end_date=".gmdate("Y-m-d",$timetz)."' style='text-decoration:none;text-transform:none;color:black'><img src='../pixmaps/chart_bar.png' border='0' align='absmiddle'> Resources</a> \n";*/ echo " </span>\n"; echo " </h1>\n"; /*echo " <div id=\"select\">\n"; echo " <span id=\"lang_044\">Template</span>\n"; echo " <select id=\"template\" name=\"template\">\n"; foreach ($this->_templates as $template) { $selected = ""; if ($this->_template === $template) { $selected = " selected=\"selected\""; } echo " <option value=\"".$template."\"".$selected.">".$template."</option>\n"; } echo " </select>\n"; echo " <span id=\"lang_045\">Language</span>\n"; echo " <select id=\"lang\" name=\"lang\">\n"; foreach ($this->_languages as $language) { $selected = ""; if ($this->_language === $language) { $selected = " selected=\"selected\""; } echo " <option value=\"".$language."\"".$selected.">".$language."</option>\n"; } echo " </select>\n"; echo " </div>\n";*/ echo " <div id=\"vitals\">\n"; echo " <h2><span id=\"lang_002\">System vitals</span></h2>\n"; echo " <table class=\"stripeMe\" id=\"vitalsTable\" cellspacing=\"0\">\n"; echo " <tr>\n"; echo " <td style=\"width:160px;\"><span id=\"lang_003\">Hostname</span></td>\n"; echo " <td><span id=\"s_hostname\"></span></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td style=\"width:160px;\"><span id=\"lang_004\">Listening IP</span></td>\n"; echo " <td><span id=\"s_ip\"></span></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td style=\"width:160px;\"><span id=\"lang_005\">Kernel Version</span></td>\n"; echo " <td><span id=\"s_kernel\"></span></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td style=\"width:160px;\"><span id=\"lang_006\">Distro Name</span></td>\n"; echo " <td><span id=\"s_distro\"></span></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td style=\"width:160px;\"><span id=\"lang_007\">Uptime</span></td>\n"; echo " <td><span id=\"s_uptime\"></span></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td style=\"width:160px;\"><span id=\"lang_008\">Current Users</span></td>\n"; echo " <td><span id=\"s_users\"></span></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td style=\"width:160px;\"><span id=\"lang_009\">Load Averages</span></td>\n"; echo " <td id=\"s_loadavg\"></td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </div>\n"; echo " <div id=\"hardware\">\n"; echo " </div>\n"; echo " <div id=\"memory\">\n"; echo " </div>\n"; echo " <div id=\"filesystem\">\n"; echo " </div>\n"; echo " <div id=\"network\">\n"; echo " <h2><span id=\"lang_021\">Network Usage</span></h2>\n"; echo " <table class=\"stripeMe\" id=\"networkTable\" cellspacing=\"0\">\n"; echo " <thead>\n"; echo " <tr>\n"; echo " <th><span id=\"lang_022\">Interface</span></th>\n"; echo " <th class=\"right\" style=\"width:60px;\"><span id=\"lang_023\">Recieved</span></th>\n"; echo " <th class=\"right\" style=\"width:60px;\"><span id=\"lang_024\">Transfered</span></th>\n"; echo " <th class=\"right\" style=\"width:60px;\"><span id=\"lang_025\">Error/Drops</span></th>\n"; echo " </tr>\n"; echo " </thead>\n"; echo " <tbody id=\"tbody_network\">\n"; echo " </tbody>\n"; echo " </table>\n"; echo " </div>\n"; echo " <div id=\"voltage\" style=\"display: none;\">\n"; echo " <h2><span id=\"lang_052\">Voltage</span></h2>\n"; echo " <table class=\"stripeMe\" id=\"voltageTable\" cellspacing=\"0\">\n"; echo " <thead>\n"; echo " <tr>\n"; echo " <th><span id=\"lang_059\">Label</span></th>\n"; echo " <th class=\"right\"><span id=\"lang_052\">Voltage</span></th>\n"; echo " <th class=\"right\" style=\"width: 80px;\"><span id=\"lang_055\">Min</span></th>\n"; echo " <th class=\"right\" style=\"width: 80px;\"><span id=\"lang_056\">Max</span></th>\n"; echo " </tr>\n"; echo " </thead>\n"; echo " <tbody>\n"; echo " </tbody>\n"; echo " </table>\n"; echo " </div>\n"; echo " <div id=\"temp\" style=\"display: none;\">\n"; echo " <h2><span id=\"lang_051\">Temperature</span></h2>\n"; echo " <table class=\"stripeMe\" id=\"tempTable\" cellspacing=\"0\">\n"; echo " <thead>\n"; echo " <tr>\n"; echo " <th><span id=\"lang_059\">Label</span></th>\n"; echo " <th class=\"right\" style=\"width: 80px;\"><span id=\"lang_054\">Value</span></th>\n"; echo " <th class=\"right\" style=\"width: 80px;\"><span id=\"lang_058\">Limit</span></th>\n"; echo " </tr>\n"; echo " </thead>\n"; echo " <tbody>\n"; echo " </tbody>\n"; echo " </table>\n"; echo " </div>\n"; echo " <div id=\"fan\" style=\"display: none;\">\n"; echo " <h2><span id=\"lang_053\">Fan</span></h2>\n"; echo " <table class=\"stripeMe\" id=\"fanTable\" cellspacing=\"0\">\n"; echo " <thead>\n"; echo " <tr>\n"; echo " <th><span id=\"lang_059\">Label</span></th>\n"; echo " <th class=\"right\" style=\"width: 80px;\"><span id=\"lang_054\">Value</span></th>\n"; echo " <th class=\"right\" style=\"width: 80px;\"><span id=\"lang_055\">Min</span></th>\n"; echo " </tr>\n"; echo " </thead>\n"; echo " <tbody>\n"; echo " </tbody>\n"; echo " </table>\n"; echo " </div>\n"; echo " <div id=\"ups\" style=\"display: none;\">\n"; echo " </div>\n"; echo " <div id=\"footer\">\n"; echo " <span id=\"lang_047\">Generated by</span> <a href=\"http://phpsysinfo.sourceforge.net/\">phpSysInfo - <span id=\"version\"></span></a>\n"; echo " </div>\n"; echo " </div>\n"; echo " </body>\n"; echo "</html>\n"; }
* external is needed when running in static mode * * @var boolean */ define('PSI_INTERNAL_XML', false); if (version_compare("5.2", PHP_VERSION, ">")) { die("PHP 5.2 or greater is required!!!"); } if (!extension_loaded("pcre")) { die("phpSysInfo requires the pcre extension to php in order to work properly."); } require_once APP_ROOT . '/includes/autoloader.inc.php'; // Load configuration and perform system check try { require_once APP_ROOT . '/read_config.php'; } catch (Exception $e) { } require_once APP_ROOT . '/systemcheck.php'; if (Error::singleton()->errorsExist()) { $tpl = new Template("/views/errors.html"); $tpl->set('errors', Error::singleton()->getErrors()); echo $tpl->fetch(); exit(-1); } $tpl = new Template("/views/index.html"); $tpl->set('plugins', CommonFunctions::getPlugins()); require_once '../includes/config.php'; include '../templates/' . $CONF['template'] . '/header.php'; echo $tpl->fetch(); set_page_title('Teknik Server Stats'); include '../templates/' . $CONF['template'] . '/footer.php';
/** * set parameters for the XML generation process * * @param boolean $completeXML switch for complete xml with all plugins * @param string $plugin name of the plugin * * @return void */ public function __construct($completeXML, $plugin = null) { parent::__construct(); if ($completeXML) { $this->_completeXML = true; } if ($plugin) { if (in_array($plugin, CommonFunctions::getPlugins())) { $this->_pluginName = $plugin; $this->_pluginRequest = true; } } $this->_prepare(); }
/** * 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 = "") { $this->_errors = 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(); $this->_plugins = CommonFunctions::getPlugins(); $this->_xmlbody(); }