當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。