本文整理汇总了PHP中ExceptionHandler类的典型用法代码示例。如果您正苦于以下问题:PHP ExceptionHandler类的具体用法?PHP ExceptionHandler怎么用?PHP ExceptionHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ExceptionHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handlerIndex
/**
* 简单的自定义处理handler的方法handlerIndex
* 可以不用exceptionHandler类下处理,但前提你你知道自己在做什么
* @param type $e
*/
static function handlerIndex($e)
{
$excepHandler = new ExceptionHandler();
$excepHandler->out['_url'][] = array('url' => '/', 'text' => '返回首页');
$excepHandler->out['_url'][] = array('url' => '/', 'text' => '返回上页');
$excepHandler->tpl = PATH_APP . '/template/index_msg.tpl';
$excepHandler->handler($e);
}
示例2: DatesAreValid
function DatesAreValid()
{
$dt = PdoDataAccess::runquery("select * from ATN_PersonShifts\r\n\t\t\twhere PersonID=:p \r\n\t\t\tAND ( :f between FromDate AND ToDate OR :t between FromDate AND ToDate ) AND RowID <> :r", array(":p" => $this->PersonID, ":r" => $this->RowID, ":f" => DateModules::shamsi_to_miladi($this->FromDate, "-"), ":t" => DateModules::shamsi_to_miladi($this->ToDate, "-")));
if (count($dt) > 0) {
ExceptionHandler::PushException("شیفت انتخاب شده دارای تداخل زمانی میباشد");
return false;
}
/*$ShiftObj = new ATN_shifts($this->ShiftID);
$dt = PdoDataAccess::runquery("select * from ATN_PersonShifts join ATN_shifts using(ShiftID)
where PersonID=:p
AND ( (:s between FromTime AND ToTime) OR (:e between FromTime AND ToTime) ) AND RowID <> :r
AND ( (:f between FromDate AND if(ToDate='0000-00-00','4000-00-00',ToDate) )
OR (:t between FromDate AND if(ToDate='0000-00-00','4000-00-00',ToDate) ) )",
array(":p" => $this->PersonID, ":s" => $ShiftObj->FromTime,
":e" => $ShiftObj->ToTime, ":r" => $this->RowID,
":f" => DateModules::shamsi_to_miladi($this->FromDate),
":t" => DateModules::shamsi_to_miladi($this->ToDate)));
if(count($dt) > 0)
{
ExceptionHandler::PushException("شیفت های این فرد با یکدیگر دارای تداخل ساعتی می باشند");;
return false;
} */
return true;
}
示例3: SaveTemplate
function SaveTemplate()
{
$pdo = PdoDataAccess::getPdoObject();
$pdo->beginTransaction();
$CorrectContent = CNT_templates::CorrectTemplateContentItems($_POST['TemplateContent']);
$obj = new CNT_templates();
$obj->TemplateContent = $CorrectContent;
$obj->TemplateTitle = $_POST['TemplateTitle'];
if ($_POST['TemplateID'] > 0) {
$obj->TemplateID = $_POST['TemplateID'];
$result = $obj->Edit($pdo);
} else {
$result = $obj->Add($pdo);
}
if (!$result) {
$pdo->rollBack();
print_r(ExceptionHandler::PopAllExceptions());
//echo PdoDataAccess::GetLatestQueryString();
echo Response::createObjectiveResponse(false, ExceptionHandler::GetExceptionsToString());
die;
}
$pdo->commit();
echo Response::createObjectiveResponse(true, $obj->TemplateID);
die;
}
示例4: getFoldedEntityPreview
public function getFoldedEntityPreview($ident)
{
$type = $this->pp->getPostType();
$postCP = $this->pp->getPostContentProviderByIdent($ident);
$hasInDb = is_object($postCP);
$post = null;
if ($hasInDb) {
$post = $postCP->getPost();
} else {
//Сделаем его форсированно загружаемым из шаблона
$virtualPostParams['b_tpl'] = 1;
$post = $this->pp->getVirtualPost($ident, $virtualPostParams);
$postCP = ContentProviderFactory::getContentProvider($post);
}
//Накачиваем страницу
$PARAMS = array('type' => $type, 'full' => '', 'short' => '', 'error' => '');
try {
$PARAMS['full'] = $postCP->getPostContent()->getContent();
$PARAMS['short'] = $postCP->getPostContentShowcase()->getContent();
} catch (Exception $ex) {
$PARAMS['error'] = ExceptionHandler::getHtml($ex);
}
$info = $hasInDb ? $this->pp->postHref($post, null, null, null, true) : PsHtml::gray($post->isVirtual() ? 'Пост не зарегистрирован в базе' : 'Пост зарегистрирован в базе, но не виден пользователю');
$content = PSSmarty::template('post/folded_prev.tpl', $PARAMS)->fetch();
return array('info' => $info, 'content' => $content);
}
示例5: deleteParam
function deleteParam()
{
$obj = new manage_salary_params();
$obj->param_id = $_POST["param_id"];
echo $obj->RemoveParam($obj->param_id) ? "true" : ExceptionHandler::GetExceptionsToString("\n");
die;
}
示例6: DontPayItem
function DontPayItem()
{
$obj = new manage_writ_item();
$return = $obj->DontPayItems($_POST["writ_id"], $_POST["writ_ver"], $_POST["staff_id"]);
echo Response::createObjectiveResponse($return, $return ? $obj->writ_id : ExceptionHandler::popExceptionDescription());
die;
}
示例7: executeQuery
/** @return ADORecordSet */
private static function executeQuery($query, $params = false, &$queryFinal = null, array &$paramsFinal = null)
{
$queryFinal = $query instanceof Query ? $query->build($params) : $query;
$queryFinal = normalize_string($queryFinal);
$paramsFinal = to_array($params);
$LOGGER = PsLogger::inst(__CLASS__);
$PROFILER = PsProfiler::inst(__CLASS__);
$PROFILER->start(strtolower($queryFinal));
try {
if ($LOGGER->isEnabled()) {
$LOGGER->info("[{$queryFinal}]" . ($paramsFinal ? ', PARAMS: ' . array_to_string($paramsFinal) : ''));
}
$rs = PsConnectionPool::conn()->execute($queryFinal, $paramsFinal);
if (is_object($rs)) {
$PROFILER->stop();
return $rs;
}
$error = PsConnectionPool::conn()->ErrorMsg();
$LOGGER->info('ERROR: {}', $error);
throw new DBException($error, DBException::ERROR_NOT_CLASSIFIED, $queryFinal, $paramsFinal);
} catch (Exception $ex) {
$PROFILER->stop(false);
if ($ex instanceof DBException) {
ExceptionHandler::dumpError($ex);
}
throw $ex;
}
}
示例8: load
static function load($className)
{
if (count(split('/', $className)) >= 2) {
$sep = split('/', $className);
if (count($sep) == 2) {
$appName = $sep[0];
$conName = $sep[1];
$action = "index";
} else {
$appName = $sep[1];
$conName = $sep[2];
if (isset($sep[3])) {
$action = $sep[3];
}
}
if (empty($action)) {
$action = "index";
}
if (empty($appName)) {
ExceptionHandler::ErrorStr("Application request: {$conName}");
}
$fileName = $_ENV['raptorphp.dir_apps'] . $appName . '/controllers/' . $conName . '.php';
if (file_exists($fileName)) {
require_once $fileName;
$ControllerName = ucfirst($appName);
$Controller = new $ControllerName();
$Controller->{$action}();
} else {
ExceptionHandler::ErrorStr("Controller request: {$className} is missing.");
}
} else {
ExceptionHandler::ErrorStr("Controller request: {$className} is missing.");
}
}
示例9: getFoldedEntityPreview
public function getFoldedEntityPreview($ident)
{
$type = $this->rp->getPostType();
$rubricCP = $this->rp->getRubricContentProviderByIdent($ident);
$hasInDb = is_object($rubricCP);
$rubric = null;
if ($hasInDb) {
$rubric = $rubricCP->getRubric();
} else {
//Сделаем его форсированно загружаемым из шаблона
$virtualRubricParams['b_tpl'] = 1;
$rubric = $this->rp->getVirtualRubric($ident, $virtualRubricParams);
$rubricCP = ContentProviderFactory::getContentProvider($rubric);
}
//Накачиваем страницу
$PARAMS = array('type' => $type, 'full' => '', 'error' => '');
try {
$PARAMS['full'] = $rubricCP->getContent();
} catch (Exception $ex) {
$PARAMS['error'] = ExceptionHandler::getHtml($ex);
}
$info = $hasInDb ? $this->rp->rubricHref($rubric) : PsHtml::gray($rubric->isVirtual() ? 'Рубрика не зарегистрирована в базе' : 'Рубрика зарегистрирована в базе, но не видна пользователю');
$content = PSSmarty::template('rubric/folded_prev.tpl', $PARAMS)->fetch();
return array('info' => $info, 'content' => $content);
}
示例10: enable
/**
* Enables the debug tools.
*
* This method registers an error handler and an exception handler.
*
* If the Symfony ClassLoader component is available, a special
* class loader is also registered.
*
* @param int $errorReportingLevel The level of error reporting you want
* @param bool $displayErrors Whether to display errors (for development) or just log them (for production)
*/
public static function enable($errorReportingLevel = E_ALL, $displayErrors = true)
{
if (static::$enabled) {
return;
}
static::$enabled = true;
if (null !== $errorReportingLevel) {
error_reporting($errorReportingLevel);
} else {
error_reporting(E_ALL);
}
if ('cli' !== PHP_SAPI) {
ini_set('display_errors', 0);
ExceptionHandler::register();
} elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) {
// CLI - display errors only if they're not already logged to STDERR
ini_set('display_errors', 1);
}
if ($displayErrors) {
ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
} else {
ErrorHandler::register()->throwAt(0, true);
}
DebugClassLoader::enable();
}
示例11: getContent
/**
* Метод безопасно получает контент.
* В случае возникновения ошибки возвращает её стек.
*/
public static function getContent($objOrTpl, $method = 'buildContent')
{
$isCallable = is_callable($objOrTpl);
$isTpl = $objOrTpl instanceof Smarty_Internal_Template;
if (!$isCallable && !$isTpl) {
check_condition(is_object($objOrTpl), 'Not object passed to ' . __FUNCTION__);
PsUtil::assertMethodExists($objOrTpl, $method);
}
$returned = null;
$flushed = null;
ob_start();
ob_implicit_flush(false);
try {
if ($isCallable) {
$returned = call_user_func($objOrTpl);
} else {
if ($isTpl) {
$returned = $objOrTpl->fetch();
} else {
$returned = $objOrTpl->{$method}();
}
}
} catch (Exception $ex) {
ob_end_clean();
return ExceptionHandler::getHtml($ex);
}
$flushed = ob_get_contents();
ob_end_clean();
return isEmpty($returned) ? isEmpty($flushed) ? null : $flushed : $returned;
}
示例12: saveStaffData
function saveStaffData()
{
$obj = new manage_staff();
PdoDataAccess::FillObjectByArray($obj, $_POST);
if (isset($_POST["work_start_date"])) {
$obj->work_start_date = DateModules::Shamsi_to_Miladi($_POST["work_start_date"]);
}
if (isset($_POST["ProfWorkStart"])) {
$obj->ProfWorkStart = DateModules::Shamsi_to_Miladi($_POST["ProfWorkStart"]);
}
if (isset($_POST["retired_date"])) {
$obj->retired_date = DateModules::Shamsi_to_Miladi($_POST["retired_date"]);
}
if (isset($_POST["last_retired_pay"])) {
$obj->last_retired_pay = DateModules::Shamsi_to_Miladi($_POST["last_retired_pay"]);
}
if (!isset($_POST['Over25'])) {
$obj->Over25 = 0;
}
$obj->sum_paied_pension = $obj->sum_paied_pension > 0 ? $obj->sum_paied_pension : "0";
$return = $obj->EditStaff();
$key = $obj->staff_id . "," . $obj->PersonID . "," . $obj->person_type;
echo $return ? Response::createObjectiveResponse("true", $key) : Response::createObjectiveResponse(false, ExceptionHandler::GetExceptionsToString("\n"));
die;
}
示例13: __construct
protected function __construct($titleKey = '', $pageDepth = 0)
{
$this->SetSecurityHeaders();
$this->path = str_repeat('../', $pageDepth);
$this->server = ServiceLocator::GetServer();
$resources = Resources::GetInstance();
ExceptionHandler::SetExceptionHandler(new WebExceptionHandler(array($this, 'RedirectToError')));
$this->smarty = new SmartyPage($resources, $this->path);
$userSession = ServiceLocator::GetServer()->GetUserSession();
$this->smarty->assign('Charset', $resources->Charset);
$this->smarty->assign('CurrentLanguage', $resources->CurrentLanguage);
$this->smarty->assign('HtmlLang', $resources->HtmlLang);
$this->smarty->assign('HtmlTextDirection', $resources->TextDirection);
$appTitle = Configuration::Instance()->GetKey(ConfigKeys::APP_TITLE);
$pageTile = $resources->GetString($titleKey);
$this->smarty->assign('Title', (empty($appTitle) ? 'Booked' : $appTitle) . (empty($pageTile) ? '' : ' - ' . $pageTile));
$this->smarty->assign('CalendarJSFile', $resources->CalendarLanguageFile);
$this->smarty->assign('LoggedIn', $userSession->IsLoggedIn());
$this->smarty->assign('Version', Configuration::VERSION);
$this->smarty->assign('Path', $this->path);
$this->smarty->assign('ScriptUrl', Configuration::Instance()->GetScriptUrl());
$this->smarty->assign('UserName', !is_null($userSession) ? $userSession->FirstName : '');
$this->smarty->assign('DisplayWelcome', $this->DisplayWelcome());
$this->smarty->assign('UserId', $userSession->UserId);
$this->smarty->assign('CanViewAdmin', $userSession->IsAdmin);
$this->smarty->assign('CanViewGroupAdmin', $userSession->IsGroupAdmin);
$this->smarty->assign('CanViewResourceAdmin', $userSession->IsResourceAdmin);
$this->smarty->assign('CanViewScheduleAdmin', $userSession->IsScheduleAdmin);
$this->smarty->assign('CanViewResponsibilities', !$userSession->IsAdmin && ($userSession->IsGroupAdmin || $userSession->IsResourceAdmin || $userSession->IsScheduleAdmin));
$allowAllUsersToReports = Configuration::Instance()->GetSectionKey(ConfigSection::REPORTS, ConfigKeys::REPORTS_ALLOW_ALL, new BooleanConverter());
$this->smarty->assign('CanViewReports', $allowAllUsersToReports || $userSession->IsAdmin || $userSession->IsGroupAdmin || $userSession->IsResourceAdmin || $userSession->IsScheduleAdmin);
$timeout = Configuration::Instance()->GetKey(ConfigKeys::INACTIVITY_TIMEOUT);
if (!empty($timeout)) {
$this->smarty->assign('SessionTimeoutSeconds', max($timeout, 1) * 60);
}
$this->smarty->assign('ShouldLogout', $this->GetShouldAutoLogout());
$this->smarty->assign('CssExtensionFile', Configuration::Instance()->GetKey(ConfigKeys::CSS_EXTENSION_FILE));
$this->smarty->assign('UseLocalJquery', Configuration::Instance()->GetKey(ConfigKeys::USE_LOCAL_JQUERY, new BooleanConverter()));
$this->smarty->assign('EnableConfigurationPage', Configuration::Instance()->GetSectionKey(ConfigSection::PAGES, ConfigKeys::PAGES_ENABLE_CONFIGURATION, new BooleanConverter()));
$this->smarty->assign('ShowParticipation', !Configuration::Instance()->GetSectionKey(ConfigSection::RESERVATION, ConfigKeys::RESERVATION_PREVENT_PARTICIPATION, new BooleanConverter()));
$this->smarty->assign('LogoUrl', 'booked.png');
if (file_exists($this->path . 'img/custom-logo.png')) {
$this->smarty->assign('LogoUrl', 'custom-logo.png');
}
if (file_exists($this->path . 'img/custom-logo.gif')) {
$this->smarty->assign('LogoUrl', 'custom-logo.gif');
}
if (file_exists($this->path . 'img/custom-logo.jpg')) {
$this->smarty->assign('LogoUrl', 'custom-logo.jpg');
}
$this->smarty->assign('CssUrl', 'null-style.css');
if (file_exists($this->path . 'css/custom-style.css')) {
$this->smarty->assign('CssUrl', 'custom-style.css');
}
$logoUrl = Configuration::Instance()->GetKey(ConfigKeys::HOME_URL);
if (empty($logoUrl)) {
$logoUrl = $this->path . Pages::UrlFromId($userSession->HomepageId);
}
$this->smarty->assign('HomeUrl', $logoUrl);
}
示例14: release_post
function release_post()
{
$temp = parent::runquery("SELECT s.staff_id, s.post_id\r\n \t\tFROM position p INNER JOIN staff s ON(s.staff_id = p.staff_id)\r\n \t\tWHERE p.post_id = ? AND s.staff_id=?", array($this->post_id, $this->staff_id));
if (count($temp) == 0) {
return true;
}
if ($temp[0]["post_id"] == $this->post_id) {
ExceptionHandler::PushException(CANNT_RELEASE_WRIT_POST);
return false;
}
parent::runquery("update position set staff_id=null where post_id=" . $this->post_id);
$daObj = new DataAudit();
$daObj->ActionType = DataAudit::Action_update;
$daObj->RelatedPersonType = DataAudit::PersonType_staff;
$daObj->RelatedPersonID = $this->staff_id;
$daObj->MainObjectID = $this->post_id;
$daObj->TableName = "position";
$daObj->description = "آزاد کردن پست اجرایی هیئت علمی";
$daObj->execute();
//------------------ baseinfo update ---------------------------
$staffObj = new manage_staff("", "", $this->staff_id);
require_once inc_manage_post;
manage_posts::baseinfoRelease($staffObj->PersonID, $this->post_id, "آزاد کردن پست اجرایی هیئت علمی");
//--------------------------------------------------------------
return true;
}
示例15: ExceptionHandler
public static function &getInstance()
{
if (self::$_instance === null) {
self::$_instance = new ExceptionHandler();
}
return self::$_instance;
}