public function init()
 {
     parent::init();
     $this->requireFiles();
     $os = PSI_OS;
     $this->_sysinfo = new $os();
     $this->_sys = $this->_sysinfo->getSys();
 }
Пример #2
0
 /**
  * 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', CommonFunctions::PSI_VERSION);
     $generation->addAttribute('timestamp', time());
     $options = $this->_xml->addChild('Options');
     $options->addAttribute('tempFormat', defined('PSI_TEMP_FORMAT') ? PSI_TEMP_FORMAT : 'c');
     $options->addAttribute('byteFormat', defined('PSI_BYTE_FORMAT') ? PSI_BYTE_FORMAT : 'auto_binary');
     $options->addAttribute('refresh', defined('PSI_REFRESH') ? PSI_REFRESH : 0);
     $options->addAttribute('showPickListTemplate', defined('PSI_SHOW_PICKLIST_TEMPLATE') ? PSI_SHOW_PICKLIST_TEMPLATE ? 'true' : 'false' : 'false');
     $options->addAttribute('showPickListLang', defined('PSI_SHOW_PICKLIST_LANG') ? PSI_SHOW_PICKLIST_LANG ? 'true' : 'false' : 'false');
     $plug = $this->_xml->addChild('UsedPlugins');
     if ($this->_complete_request && count($this->_plugins) > 0) {
         foreach ($this->_plugins as $plugin) {
             $plug->addChild('Plugin')->addAttribute('name', $plugin);
         }
     } elseif ($this->_plugin_request && count($this->_plugins) > 0) {
         $plug->addChild('Plugin')->addAttribute('name', $this->_plugin);
     }
 }
Пример #3
0
 /**
  * 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');
     if (defined('PSI_REFRESH')) {
         if (PSI_REFRESH === false) {
             $options->addAttribute('refresh', 0);
         } elseif (PSI_REFRESH === true) {
             $options->addAttribute('refresh', 1);
         } else {
             $options->addAttribute('refresh', PSI_REFRESH);
         }
     } else {
         $options->addAttribute('refresh', 60000);
     }
     if (defined('PSI_FS_USAGE_THRESHOLD')) {
         if (PSI_FS_USAGE_THRESHOLD === true) {
             $options->addAttribute('threshold', 1);
         } elseif (PSI_FS_USAGE_THRESHOLD !== false && PSI_FS_USAGE_THRESHOLD >= 1 && PSI_FS_USAGE_THRESHOLD <= 99) {
             $options->addAttribute('threshold', PSI_FS_USAGE_THRESHOLD);
         }
     } else {
         $options->addAttribute('threshold', 90);
     }
     $options->addAttribute('showPickListTemplate', defined('PSI_SHOW_PICKLIST_TEMPLATE') ? PSI_SHOW_PICKLIST_TEMPLATE ? 'true' : 'false' : 'false');
     $options->addAttribute('showPickListLang', defined('PSI_SHOW_PICKLIST_LANG') ? PSI_SHOW_PICKLIST_LANG ? 'true' : 'false' : 'false');
     $options->addAttribute('showCPUListExpanded', defined('PSI_SHOW_CPULIST_EXPANDED') ? PSI_SHOW_CPULIST_EXPANDED ? 'true' : 'false' : 'true');
     $options->addAttribute('showCPUInfoExpanded', defined('PSI_SHOW_CPUINFO_EXPANDED') ? PSI_SHOW_CPUINFO_EXPANDED ? 'true' : 'false' : 'false');
     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);
             }
         }
     }
 }
Пример #4
0
 /**
  * Includes the plugins to the main data array
  *
  * @return void
  */
 private function _buildPlugins()
 {
     if (count($this->_plugins) > 0) {
         $plugins = array();
         foreach ($this->_plugins as $plugin) {
             $object = new $plugin($this->_sysinfo->getEncoding());
             $object->execute();
             $data = $object->getData();
             if ($data !== null) {
                 $plugins[get_class($object)] = $data;
             }
         }
         if (count($plugins) > 0) {
             $this->_json['Plugins'] = $plugins;
         }
     }
 }