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


PHP errorHandler函数代码示例

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


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

示例1: query

 function query($query)
 {
     global $config;
     // разбираем запрос
     $type = $this->parseQuery($query);
     // выполняем запрос
     try {
         $result = $this->link->query($query);
         // получаем результаты
         if (in_array($type, array('SELECT', 'SHOW'))) {
             $result->setFetchMode(PDO::FETCH_OBJ);
             while ($row = $result->fetch()) {
                 $res[] = $row;
             }
         } elseif (in_array($type, array('INSERT'))) {
             $res[] = $this->link->lastInsertId();
         }
         // увеличиваем счетчик запросов
         $this->callsCount++;
         // если дебаг включен то добавляем запрос в лог
         if ($config['debug'] == true) {
             $this->callsDebug[] = $query;
         }
     } catch (PDOException $e) {
         errorHandler(0, array($e->getMessage(), $query), __FILE__, __LINE__);
     }
     return isset($res) ? $res : NULL;
 }
开发者ID:insecuritea,项目名称:malware_sources,代码行数:28,代码来源:db.php

示例2: shutDownHandler

 function shutDownHandler()
 {
     $lastError = error_get_last();
     if (isset($lastError) && $lastError['type'] & (E_ERROR | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING)) {
         errorHandler($lastError['type'], $lastError['message'], $lastError['file'], $lastError['line']);
     }
 }
开发者ID:ErosZy,项目名称:CSF,代码行数:7,代码来源:CoreError.php

示例3: check_for_fatal

/**
 * Checks for a fatal error, work around for set_error_handler not working on fatal errors.
 */
function check_for_fatal()
{
    $error = error_get_last();
    if ($error["type"] == E_ERROR) {
        errorHandler($error["type"], $error["message"], $error["file"], $error["line"]);
    }
}
开发者ID:edwardshe,项目名称:sublite-1,代码行数:10,代码来源:error.php

示例4: actionBulkCreate

 public function actionBulkCreate(array $names = array(), $parentId = 0, $vocabularyId = 0)
 {
     $vocabularyId = CPropertyValue::ensureInteger($vocabularyId);
     if (!$vocabularyId) {
         return errorHandler()->log('Missing Vocabulary Id');
     }
     foreach ($names as $catName) {
         $catName = trim($catName);
         if ($catName == '') {
             continue;
         }
         $model = new Term('single_save');
         $model->v_id = $vocabularyId;
         $model->name = $catName;
         $model->alias = Utility::createAlias($model, $model->name);
         $model->state = Term::STATE_ACTIVE;
         $model->parentId = $parentId;
         if (!$model->save()) {
             $this->result->fail(ERROR_HANDLING_DB, 'save category failed');
         } else {
             if ($model->parentId) {
                 $relation = TermHierarchy::model()->findByAttributes(array('term_id' => $model->id));
                 if (!is_object($relation)) {
                     $relation = new TermHierarchy();
                     $relation->term_id = $model->id;
                 }
                 $relation->parent_id = $model->parentId;
                 if (!$relation->save()) {
                     Yii::log(CVarDumper::dumpAsString($relation->getErrors()), CLogger::LEVEL_ERROR);
                 }
             }
         }
     }
 }
开发者ID:hung5s,项目名称:yap,代码行数:34,代码来源:TermApi.php

示例5: actionDelete

 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id)
 {
     if (Yii::app()->request->isPostRequest) {
         // we only allow deletion via POST request
         if (($id = $this->get('id', null)) !== null) {
             $ids = is_numeric($id) ? array($id) : explode(',', $id);
             // delete one or multiple objects given the list of object IDs
             $result = $this->api('XUser.AdminUserGroup.delete', array('ids' => $ids));
             if (errorHandler()->getException() == null) {
                 // only redirect user to the admin page if it is not an AJAX request
                 if (!Yii::app()->request->isAjaxRequest) {
                     $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
                 } else {
                     echo 'Items are deleted successfully';
                 }
             } else {
                 // redirecting with error carried ot the redirected page
                 if (!Yii::app()->request->isAjaxRequest) {
                     user()->setFlashErrors(errorHander()->getErrors());
                     $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
                 } else {
                     //This won't work for grid as its jquery.gridview.js alert ajax content
                     //echo errorHandler()->getErrorMessages();
                     echo errorHandler()->getException()->message;
                 }
             }
         } else {
             throw new CHttpException(400, Yii::t('Xpress.XUserGroup', 'Cannot delete item with the given ID.'));
         }
     } else {
         throw new CHttpException(400, Yii::t('Xpress.XUserGroup', 'Invalid request. Please do not repeat this request again.'));
     }
 }
开发者ID:hung5s,项目名称:yap,代码行数:38,代码来源:AdminUserGroupController.php

示例6: actionChangePassword

 public function actionChangePassword($oldPassword, $newPassword, $confirmPassword)
 {
     $model = app()->user->UserModel;
     $model->passwordOld = $oldPassword;
     $model->password = $newPassword;
     $model->confirmPassword = $confirmPassword;
     $model->setScenario('change_password');
     if (!$model->validate('passwordOld', 'password', 'confirmPassword')) {
         errorHandler()->log(new XException($model, 0));
         $this->result = false;
         return false;
     }
     $user = app()->user->UserModel->find('id=:id AND password=:password', array(':id' => app()->user->id, ':password' => md5($model->passwordOld)));
     if (is_null($user)) {
         $model->addError('passwordOld', 'Old Password is wrong');
         errorHandler()->log(new XException($model, 0));
         $this->result = false;
         return false;
     }
     if ($model->passwordOld == $model->password) {
         $model->addError('password', 'New Password is the same with Old Password');
         errorHandler()->log(new XException($model, 0));
         $this->result = false;
         return false;
     }
     app()->user->UserModel->updateByPk(app()->user->id, array('password' => md5($model->password)));
     $this->result = true;
 }
开发者ID:hung5s,项目名称:yap,代码行数:28,代码来源:UserApi.php

示例7: actionDelete

 public function actionDelete(array $ids)
 {
     $deleted = array();
     foreach ($ids as $id) {
         $model = Module::model()->findByPk($id);
         /**
         * TODO: Check related data if this Module is deletable
         * This can be done in onBeforeDelete or here or in hooks
         *
         if (Related::model()->count("module_id = {$id}") > 0)
         {
             errorHandle()->log(new XException(Yii::t('Admin.Module',"Cannot delete Module ID={$id} as it has related class data."));
         }
         else
         */
         try {
             $deleted[] = $model->PrimaryKey;
             $model->delete();
         } catch (CException $ex) {
             array_pop($deleted);
             errorHandler()->log(new XException($ex->getMessage(), $ex->getCode()));
         }
     }
     return $this->result = $deleted;
 }
开发者ID:hung5s,项目名称:yap,代码行数:25,代码来源:ModuleApi.php

示例8: actionDelete

 public function actionDelete($authItemName)
 {
     $authItemName = trim($authItemName);
     if ($authItemName == '') {
         return $this->result = errorHandler()->logException(null, -1, 'XUSER_ERR_ROLE_NAME_EMPTY', array('message' => 'Role name is empty'));
     }
     $authItem = AuthItem::model()->find('name=:name', array(':name' => $authItemName));
     if (!is_object($authItem)) {
         return $this->result = errorHandler()->logException(null, -1, 'XUSER_ERR_ROLE_NOT_FOUND', array('message' => 'Role is not found'));
     }
     // check if this role is system role
     if ($authItem->is_system == true) {
         return $this->result = errorHandler()->logException(null, -1, 'XUSER_ERR_ROLE_CANNOT_DELETE_BECAUSE_SYSTEM', array('message' => 'Cannot delete this role as it is a system role'));
     }
     // check if this role is assigned to any user
     $sql = 'SELECT COUNT(userid) FROM "' . SITE_ID . '_authassignment" WHERE itemname = \'' . $authItem->name . '\'';
     $count = app()->db->createCommand($sql)->queryScalar();
     if ($count > 0) {
         return $this->result = errorHandler()->logException(null, -1, 'XUSER_ERR_ROLE_CANNOT_DELETE_BECAUSE_ASSIGNED', array('message' => "Cannot delete this role as it's assigned to users"));
     }
     // delete the role
     if (!$authItem->delete()) {
         return $this->result = errorHandler()->logException(null, -1, 'XUSER_ERR_ROLE_DELETE_FAILED', array('message' => 'Deleting the role has been failed'));
     }
     return $this->result = array('result' => null, 'returnCode' => 1);
 }
开发者ID:hung5s,项目名称:yap,代码行数:26,代码来源:AuthItemApi.php

示例9: init

 public function init()
 {
     if ($this->id == '') {
         throw errorHandler()->logException(null, -1, 'XPRESS_XDATATABLE_INVALID_ID', array('message' => 'XDataTable requires a specific id'));
     }
     $this->registerJs();
 }
开发者ID:hung5s,项目名称:yap,代码行数:7,代码来源:XDataTable.php

示例10: query

 function query($Query_String)
 {
     if (defined('DB_TUNNEL')) {
         $opts = array('http' => array('method' => 'POST', 'header' => 'Content-Type: application/binary, Content-Transfer-Encoding: base64', 'content' => base64_encode(gzcompress($Query_String))));
         $result = file_get_contents(DB_TUNNEL, false, stream_context_create($opts));
         $result = gzuncompress(base64_decode($result));
         $result = json_decode($result, true);
         return array('data' => $result, 'ptr' => 0);
     }
     $this->connect();
     $type = explode(' ', $Query_String);
     $type = strtoupper($type[0]);
     global $acl;
     if (in_array($type, array('SELECT', 'DESCRIBE', 'SHOW')) && !in_array('view', $acl) || in_array($type, array('INSERT', 'CREATE')) && !in_array('add', $acl) || in_array($type, array('UPDATE', 'ALTER')) && !in_array('edit', $acl) || in_array($type, array('DELETE', 'DROP', 'TRUNCATE')) && !in_array('delete', $acl)) {
         ob_clean();
         global $lex, $user, $errorHandlerLatch;
         $errorHandlerLatch = true;
         //$yield = $Query_String;
         //die($Query_String);
         require_once 'templates/error_401.php';
     }
     $this->Query_ID = mysqli_query($this->Link_ID, $Query_String);
     $this->Row = 0;
     $this->Errno = mysqli_errno($this->Link_ID);
     $this->Error = mysqli_error($this->Link_ID);
     if (!$this->Query_ID) {
         $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
         $i = 0;
         while (substr($backtrace[$i]['file'], strlen($backtrace[$i]['file']) - 23) == 'interfaces/database.php') {
             $i += 1;
         }
         errorHandler(1, $this->Error . '<br/><pre>' . str_replace(array('FROM', 'WHERE', 'AND', 'ORDER'), array('<br/>FROM', '<br/>WHERE', '<br/> &nbsp; AND', '<br/>ORDER'), $Query_String) . '</pre>', $backtrace[$i]['file'], $backtrace[$i]['line']);
     }
     return $this->Query_ID;
 }
开发者ID:Villvay,项目名称:veev,代码行数:35,代码来源:database.php

示例11: fatalErrorShutdownHandler

function fatalErrorShutdownHandler()
{
    $last_error = error_get_last();
    if ($last_error['type'] === E_ERROR) {
        // fatal error
        errorHandler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']);
    }
}
开发者ID:insecuritea,项目名称:malware_sources,代码行数:8,代码来源:download.php

示例12: fatalErrorHandler

function fatalErrorHandler()
{
    $types = array(E_ERROR, E_PARSE);
    $err = error_get_last();
    if (in_array($err['type'], $types)) {
        errorHandler($err['type'], $err['message'], $err['file'], $err['line']);
    }
}
开发者ID:jejem,项目名称:starter-kit,代码行数:8,代码来源:FatalErrorHandler.php

示例13: deleteBlog

function deleteBlog($DB, $bid)
{
    $stmt = $DB->prepare("DELETE FROM blog WHERE blogId=?");
    if (!$stmt->bind_param('i', $bid)) {
        return errorHandler("deleteBlog failed to bind parameter", 503);
    }
    return $stmt;
}
开发者ID:safetyscissors,项目名称:blog,代码行数:8,代码来源:blogQueries.php

示例14: updateUserPassword

function updateUserPassword($DB, $uid, $passwordHash)
{
    $stmt = $DB->prepare("UPDATE user SET userHash=? WHERE userId=?");
    if (!$stmt->bind_param('si', $passwordHash, $uid)) {
        return errorHandler("updateList failed to bind parameter", 503);
    }
    return $stmt;
}
开发者ID:safetyscissors,项目名称:blog,代码行数:8,代码来源:userQueries.php

示例15: deletePage

function deletePage($DB, $pid)
{
    $stmt = $DB->prepare("DELETE FROM staticPage WHERE staticPageId=?");
    if (!$stmt->bind_param('i', $pid)) {
        return errorHandler("deletePage failed to bind parameter", 503);
    }
    return $stmt;
}
开发者ID:safetyscissors,项目名称:blog,代码行数:8,代码来源:pageQueries.php


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