当前位置: 首页>>代码示例>>PHP>>正文


PHP Error::singleton方法代码示例

本文整理汇总了PHP中Error::singleton方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::singleton方法的具体用法?PHP Error::singleton怎么用?PHP Error::singleton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Error的用法示例。


在下文中一共展示了Error::singleton方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * call the parent constructor and check for needed extensions
  */
 public function __construct()
 {
     CommonFunctions::checkForSVN();
     CommonFunctions::checkForExtensions();
     $this->error = Error::singleton();
     $this->_checkConfig();
 }
开发者ID:sorrowchen,项目名称:openfiler-cn,代码行数:10,代码来源:class.Output.inc.php

示例2: __construct

 public function __construct($pluginname = "", $complete = false)
 {
     $pluginname == "" ? $this->plugin_request = false : ($this->plugin_request = true);
     $complete ? $this->complete_request = true : ($this->complete_request = false);
     $this->errors = Error::singleton();
     if (!$this->plugin_request || $this->complete_request) {
         $this->sysinfo = new sysinfo();
         if (PSI_MBINFO) {
             $this->mbinfo = new mbinfo();
         }
         if (PSI_HDDTEMP) {
             $this->hddtemp = new hddtemp();
         }
         if (PSI_UPSINFO) {
             $this->upsinfo = new upsinfo();
         }
     }
     $this->xml = simplexml_load_string("<?xml version='1.0'?>\n<phpsysinfo></phpsysinfo>");
     $generation = $this->xml->addChild('Generation');
     $generation->addAttribute('version', PSI_VERSION);
     $generation->addAttribute('timestamp', time());
     $options = $this->xml->addChild('Options');
     $options->addChild('tempFormat', tempFormat);
     $options->addChild('byteFormat', byteFormat);
     if (!$this->plugin_request || $this->complete_request) {
         $this->plugins = explode(",", PSI_PLUGINS);
         $plug = $options->addChild('Used_Plugins');
         foreach ($this->plugins as $plugin) {
             $plug->addChild('Plugin', $plugin);
         }
     } else {
         $this->plugins = array($pluginname);
     }
 }
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:34,代码来源:xml.class.php

示例3: __construct

 public function __construct()
 {
     $this->error = Error::singleton();
     // don't set this params for local connection, it will not work
     $strHostname = '';
     $strUser = '';
     $strPassword = '';
     // initialize the wmi object
     $objLocator = new COM("WbemScripting.SWbemLocator");
     if ($strHostname == "") {
         $this->wmi = $objLocator->ConnectServer();
     } else {
         $this->wmi = $objLocator->ConnectServer($strHostname, "rootcimv2", "{$strHostname}\$strUser", $strPassword);
     }
 }
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:15,代码来源:class.WINNT.inc.php

示例4: errorHandlerPsi

/**
 * 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 = Error::singleton();
    $error->addPhpError("errorHandlerPsi : ", "Level : " . $level . " Message : " . $message . " File : " . $file . " Line : " . $line);
}
开发者ID:antirek,项目名称:prestige-pbx,代码行数:15,代码来源:autoloader.inc.php

示例5: __construct

 /**
  * build the global Error object
  */
 public function __construct()
 {
     $this->error = Error::singleton();
     $this->mbinfo = new MBInfo();
 }
开发者ID:l1ght13aby,项目名称:Ubilling,代码行数:8,代码来源:class.sensors.inc.php

示例6: gdc

 /**
  * reads a directory and return the name of the files and directorys in it
  *
  * @param string  $strPath     path of the directory which should be read
  * @param boolean $booErrorRep en- or disables the reporting of errors which should be logged
  *
  * @return array content of the directory excluding . and ..
  */
 public static function gdc($strPath, $booErrorRep = true)
 {
     $arrDirectoryContent = array();
     $error = Error::singleton();
     if (is_dir($strPath)) {
         if ($handle = opendir($strPath)) {
             while (($strFile = readdir($handle)) !== false) {
                 if ($strFile != "." && $strFile != "..") {
                     $arrDirectoryContent[] = $strFile;
                 }
             }
             closedir($handle);
         } else {
             if ($booErrorRep) {
                 $error->addError('opendir(' . $strPath . ')', 'directory can not be read by phpsysinfo');
             }
         }
     } else {
         if ($booErrorRep) {
             $error->addError('is_dir(' . $strPath . ')', 'directory does not exist on your machine');
         }
     }
     return $arrDirectoryContent;
 }
开发者ID:antirek,项目名称:prestige-pbx,代码行数:32,代码来源:class.CommonFunctions.inc.php

示例7: define

 * 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';
开发者ID:KingNoosh,项目名称:Teknik,代码行数:31,代码来源:index.php

示例8: __construct

 /**
  * 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();
 }
开发者ID:HaakonME,项目名称:porticoestate,代码行数:31,代码来源:class.XML.inc.php

示例9: __construct

 /**
  * build the global Error object
  */
 public function __construct()
 {
     $this->error = Error::singleton();
     $this->sys = new System();
 }
开发者ID:jhbsz,项目名称:ossimTest,代码行数:8,代码来源:class.OS.inc.php

示例10: get_loaded_extensions

}
// also require 'com_dotnet' on Windows systems
if (PHP_OS == 'WINNT') {
    $required_extensions[] = 'com_dotnet';
}
$loaded_extensions = get_loaded_extensions();
foreach ($required_extensions as $ext) {
    if (!in_array($ext, $loaded_extensions)) {
        Error::singleton()->adderror("warn", "phpsysinfo requires extension '" . $ext . "' to be loaded");
    }
}
// safe mode check
$safe_mode = @ini_get("safe_mode") ? true : false;
if ($safe_mode) {
    Error::singleton()->adderror("warn", "phpsysinfo requires to set off 'safe_mode' in 'php.ini'");
}
// include path check
$include_path = @ini_get("include_path");
if ($include_path && $include_path != "") {
    $include_path = preg_replace("/(:)|(;)/", "\n", $include_path);
    if (preg_match("/^\\.\$/m", $include_path)) {
        $include_path = ".";
    }
}
if ($include_path != ".") {
    Error::singleton()->adderror("warn", "phpsysinfo requires '.' inside the 'include_path' in php.ini");
}
// popen mode check
if (defined("PSI_MODE_POPEN") && psi_mode_popen === true) {
    Error::singleton()->adderror("warn", "installed version of php does not support proc_open() function, popen() is used");
}
开发者ID:KingNoosh,项目名称:Teknik,代码行数:31,代码来源:systemcheck.php

示例11: session_start

session_start();
$username = $_SESSION['loggedin_username'];
$password = $_SESSION['loggedin_password'];
$isloggedin = $_SESSION['isloggedin'];
if (!$isloggedin or $password == "") {
    header("Location: ..");
    exit;
    // this is only exit to redirect to loginform, when not logged in.
}
if (PHP_VERSION < 5.2) {
    die("PHP 5.2 or greater is required!!!");
}
define('APP_ROOT', dirname(__FILE__));
require_once './includes/common_functions.php';
checkForExtensions();
$error = Error::singleton();
if (!is_readable('/etc/phpsysinfo/config.php')) {
    $error->addError('file_exists(/etc/phpsysinfo/config.php)', '/etc/phpsysinfo/config.php does not exist or is not readable by the webserver in the phpsysinfo directory.');
} else {
    require_once '/etc/phpsysinfo/config.php';
    // get the config file
}
if ($error->ErrorsExist()) {
    echo $error->ErrorsAsHTML();
    exit;
}
//redirection part
include './includes/redir.php';
//checking config.php setting for template, if not supportet set phpsysinfo.css as default
$template = template;
if (!file_exists('templates/' . $template)) {
开发者ID:rohdoor,项目名称:ehcp,代码行数:31,代码来源:index.php

示例12: GetGeneralInformations

    private function GetGeneralInformations() {

        $results = array();

        // Distribution
        if(CommonFunctions::rfts('/proc/version', $distribData)) {
            $results['Distribution'] = trim($distribData);
        }

        // Ip de la machine
        if(CommonFunctions::executeProgram("ifconfig", $this->config->ifnetwork.' | grep inet | cut -d":" -f2 | cut -d" " -f1', $buffer)) {
            $results['IPMachine'] = $buffer;
        }

        // Marque
        if(CommonFunctions::executeProgram("hwinfo", '--bios | grep -m1 ^\ \ \ \ Manufacturer: | cut -f2 -d\"', $buffer)) {
            $results['Marque'] = $buffer;
        }
        else {
            $results['Marque'] = '<![CDATA['.Error::singleton()->errorsAsXML().']]>';
        }

        // Model
        if(CommonFunctions::executeProgram("hwinfo", "--bios | grep -m1 ^\ \ \ \ Product: | cut -f2 -d\\\"", $buffer)) {
            $results['Model'] = $buffer;
        }

        $results['Prod'] = trim($this->config->isProductionServer);
        $results['AnnuThere'] = 0;

        // Genre
        if(CommonFunctions::executeProgram("dpkg", "-l | grep lcs-web", $buffer)) {
            if(strlen($buffer) > 0) {
                $this->genre = 'LCS';
            }
            else {
                if(CommonFunctions::executeProgram("dpkg", "-l | grep se3", $buffer)) {
                    if(strlen($buffer) > 0) {
                        $this->genre = 'SE3';
                    }
                    else {
                        $this->genre = 'UNKNOW';
                    }

                }
            }
        }


        $results['Genre'] = $this->genre;

        //Kernel
        $results['Kernel'] = $this->kernel();

        // UpTime
        $results['Uptime'] = $this->uptime();

        return '<GeneralInformations>
'.CommonFunctions::ArrayToXML($results).'
</GeneralInformations>';
    }
开发者ID:rhertzog,项目名称:lcs,代码行数:61,代码来源:Monitor.class.php

示例13: getWMI

 /**
  * 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 = Error::singleton();
                 $error->addError($e->getCode(), $e->getMessage());
             }
         }
     }
     return $arrData;
 }
开发者ID:JordaoS,项目名称:phpsysinfo,代码行数:54,代码来源:class.CommonFunctions.inc.php

示例14: define

<?php

if (!defined('PSI_CONFIG_FILE')) {
    /**
     * phpSysInfo version
     */
    define('PSI_VERSION', '4.0-wip');
    /**
     * phpSysInfo configuration
     */
    define('PSI_CONFIG_FILE', APP_ROOT . '/phpsysinfo.ini');
    define('ARRAY_EXP', '/^return array \\([^;]*\\);$/');
    //array expression search
    if (!is_readable(PSI_CONFIG_FILE) || !($config = @parse_ini_file(PSI_CONFIG_FILE, true))) {
        Error::singleton()->addError('warn', "Configuration file '" . PSI_CONFIG_FILE . "' not readable");
        throw new Exception('init: config file not readable');
    } else {
        foreach ($config as $name => $group) {
            if (strtoupper($name) == "MAIN") {
                $name_prefix = 'PSI_';
            } else {
                $name_prefix = 'PSI_PLUGIN_' . strtoupper($name) . '_';
            }
            foreach ($group as $param => $value) {
                if ($value === "" || $value === "0") {
                    define($name_prefix . strtoupper($param), false);
                } elseif ($value === "1") {
                    define($name_prefix . strtoupper($param), true);
                } else {
                    if (strstr($value, ',')) {
                        define($name_prefix . strtoupper($param), 'return ' . var_export(preg_split('/\\s*,\\s*/', $value, -1, PREG_SPLIT_NO_EMPTY), 1) . ';');
开发者ID:KingNoosh,项目名称:Teknik,代码行数:31,代码来源:read_config.php


注:本文中的Error::singleton方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。