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


PHP PEAR_Error类代码示例

本文整理汇总了PHP中PEAR_Error的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_Error类的具体用法?PHP PEAR_Error怎么用?PHP PEAR_Error使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: errorObjToString

    /**
     * A method to convert PEAR_Error objects to strings.
     *
     * @static
     * @param PEAR_Error $oError A {@link PEAR_Error} object
     */
    function errorObjToString($oError, $additionalInfo = null)
    {
        $aConf = $GLOBALS['_MAX']['CONF'];
        $message = htmlspecialchars($oError->getMessage());
        $debugInfo = htmlspecialchars($oError->getDebugInfo());
        $additionalInfo = htmlspecialchars($additionalInfo);
        $level = $oError->getCode();
        $errorType = MAX::errorConstantToString($level);
        $img = MAX::constructURL(MAX_URL_IMAGE, 'errormessage.gif');
        // Message
        $output = <<<EOF
<br />
<div class="errormessage">
    <img class="errormessage" src="{$img}" align="absmiddle">
    <span class='tab-r'>{$errorType} Error</span>
    <br />
    <br />{$message}
    <br /><pre>{$debugInfo}</pre>
    {$additionalInfo}
</div>
<br />
<br />
EOF;
        return $output;
    }
开发者ID:akirsch,项目名称:revive-adserver,代码行数:31,代码来源:Max.php

示例2: _getPearTrace

 /**
  * Return a trace for the PEAR error.
  *
  * @param PEAR_Error $error The PEAR error.
  *
  * @return string The backtrace as a string.
  */
 private function _getPearTrace(PEAR_Error $error)
 {
     $backtrace = $error->getBacktrace();
     if (!empty($backtrace)) {
         $pear_error = "\n\n" . 'PEAR Error:' . "\n";
         foreach ($backtrace as $frame) {
             $pear_error .= '    ' . (isset($frame['class']) ? $frame['class'] : '') . (isset($frame['type']) ? $frame['type'] : '') . (isset($frame['function']) ? $frame['function'] : 'unkown') . ' ' . (isset($frame['file']) ? $frame['file'] : 'unkown') . ':' . (isset($frame['line']) ? $frame['line'] : 'unkown') . "\n";
         }
         $pear_error .= "\n";
         return $pear_error;
     }
     return '';
 }
开发者ID:no-reply,项目名称:cbpl-vufind,代码行数:20,代码来源:Pear.php

示例3: __construct

 /**
  * @param PEAR_Error $error
  */
 public function __construct(PEAR_Error $error)
 {
     $message = $error->getMessage();
     $userInfo = $error->getUserInfo();
     if (!is_null($userInfo)) {
         $message .= ', ' . $userInfo;
     }
     parent::__construct($message);
     $backtrace = $error->getBacktrace();
     if (is_array($backtrace)) {
         $this->file = $backtrace[1]['file'];
         $this->line = $backtrace[1]['line'];
     }
 }
开发者ID:nyarla,项目名称:fluxflex-rep2ex,代码行数:17,代码来源:Exception.php

示例4: Ethna_Error

 /**
  *	Ethna_Errorクラスのコンストラクタ
  *
  *	@access	public
  *	@param	int		$level				エラーレベル
  *	@param	string	$message			エラーメッセージ
  *	@param	int		$code				エラーコード
  *	@param	array	$userinfo			エラー追加情報(エラーコード以降の全ての引数)
  */
 function Ethna_Error($message = null, $code = null, $mode = null, $options = null)
 {
     $controller =& Ethna_Controller::getInstance();
     if ($controller !== null) {
         $this->i18n =& $controller->getI18N();
     }
     // $options以降の引数->$userinfo
     if (func_num_args() > 4) {
         $userinfo = array_slice(func_get_args(), 4);
         if (count($userinfo) == 1) {
             if (is_array($userinfo[0])) {
                 $userinfo = $userinfo[0];
             } else {
                 if (is_null($userinfo[0])) {
                     $userinfo = array();
                 }
             }
         }
     } else {
         $userinfo = array();
     }
     // メッセージ補正処理
     if (is_null($message)) {
         // $codeからメッセージを取得する
         $message = $controller->getErrorMessage($code);
         if (is_null($message)) {
             $message = 'unkown error';
         }
     }
     parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
     // Ethnaフレームワークのエラーハンドラ(PEAR_Errorのコールバックとは異なる)
     Ethna::handleError($this);
 }
开发者ID:BackupTheBerlios,项目名称:delphinus-svn,代码行数:42,代码来源:Ethna_Error.php

示例5: showError

 /**
  * A method to display an M2M/Dashboard error
  *
  * @param PEAR_Error $oError
  */
 function showError($oError)
 {
     $aConf = $GLOBALS['_MAX']['CONF'];
     $oTpl = new OA_Admin_Template('dashboard/error.html');
     $errorCode = $oError->getCode();
     $nativeErrorMessage = $oError->getMessage();
     // Set error message
     if (isset($GLOBALS['strDashboardErrorMsg' . $errorCode])) {
         $errorMessage = $GLOBALS['strDashboardErrorMsg' . $errorCode];
     } else {
         if (!empty($nativeErrorMessage)) {
             $errorMessage = $nativeErrorMessage;
             // Don't show this message twice on error page
             unset($nativeErrorMessage);
         } else {
             $errorMessage = $GLOBALS['strDashboardGenericError'];
         }
     }
     // Set error description
     if (isset($GLOBALS['strDashboardErrorDsc' . $errorCode])) {
         $errorDescription = $GLOBALS['strDashboardErrorDsc' . $errorCode];
     }
     $oTpl->assign('errorCode', $errorCode);
     $oTpl->assign('errorMessage', $errorMessage);
     $oTpl->assign('systemMessage', $nativeErrorMessage);
     $oTpl->assign('errorDescription', $errorDescription);
     $oTpl->display();
 }
开发者ID:villos,项目名称:tree_admin,代码行数:33,代码来源:Reload.php

示例6: SOAP_Fault

 /**
  * Constructor.
  *
  * @param string $faultstring  Message string for fault.
  * @param mixed $faultcode     The faultcode.
  * @param mixed $faultactor
  * @param mixed $detail        @see PEAR_Error
  * @param array $mode          @see PEAR_Error
  * @param array $options       @see PEAR_Error
  */
 function SOAP_Fault($faultstring = 'unknown error', $faultcode = 'Client', $faultactor = null, $detail = null, $mode = null, $options = null)
 {
     parent::PEAR_Error($faultstring, $faultcode, $mode, $options, $detail);
     if ($faultactor) {
         $this->error_message_prefix = $faultactor;
     }
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:17,代码来源:Fault.php

示例7: authenticate

 public function authenticate()
 {
     $login = $_REQUEST['login'];
     $password = md5($_REQUEST['password']);
     if ($login == '' || $password == '') {
         $user = new PEAR_Error('authentication_error_blank');
     } else {
         $user = new Administrator();
         $user->whereAdd("login = '{$login}'");
         $user->whereAdd("password = '{$password}'");
         $user->find();
         if ($user->N != 1) {
             $user = new PEAR_Error('authentication_error_invalid');
         } else {
             $user->fetch();
         }
     }
     return $user;
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:19,代码来源:AdminDBAuthentication.php

示例8: authenticate

 /**
  * Attempt to authenticate the current user.
  *
  * @return object User object if successful, PEAR_Error otherwise.
  * @access public
  */
 public function authenticate()
 {
     $username = $_POST['username'];
     $password = $_POST['password'];
     if ($username == '' || $password == '') {
         $user = new PEAR_Error('authentication_error_blank');
     } else {
         $user = new User();
         $user->username = (isset($configArray['Site']['institution']) ? $configArray['Site']['institution'] . ':' : '') . $username;
         $user->password = $password;
         if (!$user->find(true)) {
             $user = new PEAR_Error('authentication_error_invalid');
         } else {
             $user->authMethod = 'Database';
             $user->last_login = date('Y-m-d H:i:s');
             $user->update();
         }
     }
     return $user;
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:26,代码来源:DatabaseAuthentication.php

示例9: _getPearTrace

 /**
  * Return a trace for the PEAR error.
  *
  * @param PEAR_Error $error The PEAR error.
  *
  * @return string The backtrace as a string.
  */
 private function _getPearTrace(PEAR_Error $error)
 {
     $pear_error = '';
     $backtrace = $error->getBacktrace();
     if (!empty($backtrace)) {
         $pear_error .= 'PEAR backtrace:' . "\n\n";
         foreach ($backtrace as $frame) {
             $pear_error .= (isset($frame['class']) ? $frame['class'] : '') . (isset($frame['type']) ? $frame['type'] : '') . (isset($frame['function']) ? $frame['function'] : 'unkown') . ' ' . (isset($frame['file']) ? $frame['file'] : 'unkown') . ':' . (isset($frame['line']) ? $frame['line'] : 'unkown') . "\n";
         }
     }
     $userinfo = $error->getUserInfo();
     if (!empty($userinfo)) {
         $pear_error .= "\n" . 'PEAR user info:' . "\n\n";
         if (is_string($userinfo)) {
             $pear_error .= $userinfo;
         } else {
             $pear_error .= print_r($userinfo, true);
         }
     }
     return $pear_error;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:28,代码来源:Pear.php

示例10: SOAP_Fault

 /**
  *
  * 
  * @param    string 
  * @param    mixed
  * @param    mixed
  * @param    mixed
  * @param    mixed
  */
 function SOAP_Fault($message = 'unknown error', $code = null, $mode = null, $options = null, $userinfo = null)
 {
     if (is_array($userinfo)) {
         $actor = $userinfo['actor'];
         $detail = $userinfo['detail'];
     } else {
         $actor = 'Unknown';
         $detail = $userinfo;
     }
     parent::PEAR_Error($message, $code, $mode, $options, $detail);
     $this->error_message_prefix = $actor;
 }
开发者ID:GabrielDiniz,项目名称:FluxNetControl,代码行数:21,代码来源:fault.php

示例11: foreach

 /**
  * Deliver an error page
  *
  * @param PEAR_Error $error    The error.
  * @param array      $headers  The HTTP headers to deliver with the response
  * @param string     $title    The page title
  * @param string     $headline The headline of the page
  * @param string     $body     The message to display on the page
  */
 function _errorPage($error, $headers, $title, $headline, $body)
 {
     global $conf;
     /* Print the headers */
     foreach ($headers as $line) {
         header($line);
     }
     /* Print the page */
     echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n";
     echo "<html><head><title>" . $title . "</title></head>\n";
     echo "<body>\n";
     echo "<h1>" . $headline . "</h1>\n";
     echo "<p>" . $body . "</p>\n";
     if (!empty($error)) {
         echo "<hr><pre>" . $error->getMessage() . "</pre>\n";
         Horde::log($error, 'ERR');
     }
     echo "<hr>\n";
     echo isset($_SERVER['SERVER_SIGNATURE']) ? $_SERVER['SERVER_SIGNATURE'] : '' . "\n";
     echo "</body></html>\n";
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:30,代码来源:View.php

示例12: _error

 /**
  * Build a standardized string describing the current SMTP error.
  *
  * @param string $text       Custom string describing the error context.
  * @param PEAR_Error $error  PEAR_Error object.
  * @param integer $e_code    Error code.
  *
  * @throws Horde_Mail_Exception
  */
 protected function _error($text, $error, $e_code)
 {
     /* Split the SMTP response into a code and a response string. */
     list($code, $response) = $this->_smtp->getResponse();
     /* Abort current SMTP transaction. */
     $this->_smtp->rset();
     /* Build our standardized error string. */
     throw new Horde_Mail_Exception($text . ' [SMTP: ' . $error->getMessage() . " (code: {$code}, response: {$response})]", $e_code);
 }
开发者ID:x59,项目名称:horde-mail,代码行数:18,代码来源:Smtp.php

示例13:

 /**
  * DB_DataObject_Error constructor.
  *
  * @param mixed   $code   DB error code, or string with error message.
  * @param integer $mode   what "error mode" to operate in
  * @param integer $level  what error level to use for $mode & PEAR_ERROR_TRIGGER
  * @param mixed   $debuginfo  additional debug info, such as the last query
  *
  * @access public
  *
  * @see PEAR_Error
  */
 function __construct($message = '', $code = DB_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE)
 {
     parent::__construct('DB_DataObject Error: ' . $message, $code, $mode, $level);
 }
开发者ID:Jaree,项目名称:revive-adserver,代码行数:16,代码来源:Error.php

示例14: insCall

                if (!$stamm) {
                    $data["CID"] = $_SESSION["loginCRM"];
                    // Dann halt beim Absender in den Thread eintragen
                    $data["cause"] = $Subject . "|" . $_POST["TO"];
                    insCall($data, $_FILES);
                }
                $TO = "";
                $CC = "";
                $msg = "Mail versendet";
                $Subject = "";
                $BodyText = "";
                if ($_POST["QUELLE"]) {
                    header("Location: " . $referer);
                }
            } else {
                $msg = "Fehler beim Versenden " . PEAR_Error::getMessage();
                //$TO=$_POST["TO"]; $CC=$_POST["CC"]; $msg="Fehler beim Versenden ".PEAR_Error::getMessage ();
                //$Subject=$_POST["Subject"]; $BodyText=$_POST["BodyText"];
            }
        } else {
            $Subject = preg_replace("/(content-type:|bcc:|cc:|to:|from:)/im", "", $_POST["Subject"]);
            $BodyText = preg_replace("/(content-type:|bcc:|cc:|to:|from:)/im", "", $_POST["BodyText"]);
        }
    } else {
        $user = getUserStamm($_SESSION["loginCRM"]);
        $BodyText = "";
        // \n".$MailSign;
    }
}
switch ($USER['mandsig']) {
    case '0':
开发者ID:vanloswang,项目名称:kivitendo-crm,代码行数:31,代码来源:mail.php

示例15: Services_JSON_Error

 function Services_JSON_Error($message = 'unknown error', $code = null, $mode = null, $options = null, $userinfo = null)
 {
     parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
 }
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:4,代码来源:JSON.php


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