Esempio n. 1
0
/**
 * sets a user-defined error handler function
 *
 * @param integer $level   contains the level of the error raised, as an integer.
 * @param string  $message contains the error message, as a string.
 * @param string  $file    which contains the filename that the error was raised in, as a string.
 * @param integer $line    which contains the line number the error was raised at, as an integer.
 *
 * @return void
 */
function errorHandlerPsi($level, $message, $file, $line)
{
    $error = PSI_Error::singleton();
    if (PSI_DEBUG || $level !== 2 || !(preg_match("/^[^:]*: open_basedir /", $message) || preg_match("/^fopen\\(/", $message) || preg_match("/^is_readable\\(/", $message))) {
        // disable open_basedir, is_readable and fopen warnings
        $error->addPhpError("errorHandlerPsi : ", "Level : " . $level . " Message : " . $message . " File : " . $file . " Line : " . $line);
    }
}
Esempio n. 2
0
 /**
  * Singleton function
  *
  * @return Error instance of the class
  */
 public static function singleton()
 {
     if (!isset(self::$_instance)) {
         $c = __CLASS__;
         self::$_instance = new $c();
     }
     return self::$_instance;
 }
Esempio n. 3
0
 /**
  * build the global Error object, read the configuration and check if all files are available
  * for a minimalistic function of the plugin
  *
  * @param String $plugin_name name of the plugin
  * @param String $enc         target encoding
  *
  * @return void
  */
 public function __construct($plugin_name, $enc)
 {
     $this->global_error = PSI_Error::Singleton();
     if (trim($plugin_name) != "") {
         $this->_plugin_name = $plugin_name;
         $this->_plugin_base = APP_ROOT . "/plugins/" . strtolower($this->_plugin_name) . "/";
         $this->_checkfiles();
         $this->_getconfig();
     } else {
         $this->global_error->addError("__construct()", "Parent constructor called without Plugin-Name!");
     }
     $this->_createXml($enc);
 }
Esempio n. 4
0
 /**
  * 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 = PSI_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();
 }
Esempio n. 5
0
 /**
  * build the global Error object
  */
 public function __construct()
 {
     $this->error = PSI_Error::singleton();
     $this->upsinfo = new UPSInfo();
 }
 /**
  * function for getting a list of values in the specified context
  * optionally filter this list, based on the list from third parameter
  *
  * @param $wmi holds the COM object that we pull the WMI data from
  * @param string $strClass name of the class where the values are stored
  * @param array  $strValue filter out only needed values, if not set all values of the class are returned
  *
  * @return array content of the class stored in an array
  */
 public static function getWMI($wmi, $strClass, $strValue = array())
 {
     $arrData = array();
     if ($wmi) {
         $value = "";
         try {
             $objWEBM = $wmi->Get($strClass);
             $arrProp = $objWEBM->Properties_;
             $arrWEBMCol = $objWEBM->Instances_();
             foreach ($arrWEBMCol as $objItem) {
                 if (is_array($arrProp)) {
                     reset($arrProp);
                 }
                 $arrInstance = array();
                 foreach ($arrProp as $propItem) {
                     $value = $objItem->{$propItem->Name};
                     //instead exploitable eval("\$value = \$objItem->".$propItem->Name.";");
                     if (empty($strValue)) {
                         if (is_string($value)) {
                             $arrInstance[$propItem->Name] = trim($value);
                         } else {
                             $arrInstance[$propItem->Name] = $value;
                         }
                     } else {
                         if (in_array($propItem->Name, $strValue)) {
                             if (is_string($value)) {
                                 $arrInstance[$propItem->Name] = trim($value);
                             } else {
                                 $arrInstance[$propItem->Name] = $value;
                             }
                         }
                     }
                 }
                 $arrData[] = $arrInstance;
             }
         } catch (Exception $e) {
             if (PSI_DEBUG) {
                 $error = PSI_Error::singleton();
                 $error->addError($e->getCode(), $e->getMessage());
             }
         }
     }
     return $arrData;
 }
Esempio n. 7
0
 /**
  * call the parent constructor and check for needed extensions
  */
 public function __construct()
 {
     $this->error = PSI_Error::singleton();
     $this->_checkConfig();
     CommonFunctions::checkForExtensions();
 }
Esempio n. 8
0
 /**
  * build the global Error object
  */
 public function __construct()
 {
     $this->error = PSI_Error::singleton();
     $this->sys = new System();
 }
Esempio n. 9
0
/**
 * sets a user-defined error handler function
 *
 * @param integer $level   contains the level of the error raised, as an integer.
 * @param string  $message contains the error message, as a string.
 * @param string  $file    which contains the filename that the error was raised in, as a string.
 * @param integer $line    which contains the line number the error was raised at, as an integer.
 *
 * @return void
 */
function errorHandlerPsi($level, $message, $file, $line)
{
    $error = PSI_Error::singleton();
    $error->addPhpError("errorHandlerPsi : ", "Level : " . $level . " Message : " . $message . " File : " . $file . " Line : " . $line);
}