コード例 #1
0
ファイル: Response.php プロジェクト: igaponov/jsonrpc
 /**
  * @return mixed|null
  */
 public function getErrorData()
 {
     if ($this->error instanceof Error) {
         return $this->error->getData();
     }
     return null;
 }
コード例 #2
0
ファイル: scheduler.php プロジェクト: emeraldion/creso
function handle_errors($errno, $errstr, $errfile, $errline, $errcontext)
{
    $error = new Error();
    $error->date = date('Y-m-d H:i:s');
    $error->text = $errstr;
    $error->save();
}
コード例 #3
0
ファイル: Error.php プロジェクト: tarsana/functional
 /**
  * Creates a new Error.
  *
  * @param string     $message
  * @param Error|null $error
  */
 protected function __construct($message, Error $error = null)
 {
     if (null != $error) {
         $message = $error->message() . ' -> ' . $message;
     }
     $this->message = $message;
 }
コード例 #4
0
 function show_php_error($severity, $message, $filepath, $line)
 {
     $severity = !isset($this->levels[$severity]) ? $severity : $this->levels[$severity];
     $filepath = str_replace("\\", "/", $filepath);
     // For safety reasons we do not show the full file path
     if (FALSE !== strpos($filepath, '/')) {
         $x = explode('/', $filepath);
         $filepath = $x[count($x) - 2] . '/' . end($x);
     }
     // BEGIN DATABASE LOGGING
     $CI =& get_instance();
     if (is_object($CI) && (!property_exists($CI, 'debugmode') || $CI->debugmode != TRUE)) {
         $e = new Error();
         $e->source = '';
         $e->severity = $severity;
         $e->message = $message;
         $e->filepath = $filepath;
         $e->line = $line;
         $e->application = property('application', $CI, '');
         if (property_exists($CI, 'user')) {
             $e->user_id = $CI->user->id;
         }
         $e->save();
         $error_id = $e->id;
     }
     // END DATABASE LOGGING
     if (ob_get_level() > $this->ob_level + 1) {
         ob_end_flush();
     }
     ob_start();
     include APPPATH . 'errors/error_php' . EXT;
     $buffer = ob_get_contents();
     ob_end_clean();
     echo $buffer;
 }
コード例 #5
0
 /**
  * Outputs the error popup, or a plain message, depending on the response content type.
  *
  * @param \Exception|\Error      $exception Note: can't be type hinted, for PHP7 compat.
  * @param ResponseInterface|null $response  If null, it outputs directly to the client. Otherwise, it assumes the
  *                                          object is a new blank response.
  * @return ResponseInterface|null
  */
 static function display($exception, ResponseInterface $response = null)
 {
     // For HTML pages, output the error popup
     if (strpos(get($_SERVER, 'HTTP_ACCEPT'), 'text/html') !== false) {
         ob_start();
         ErrorConsoleRenderer::renderStyles();
         $stackTrace = self::getStackTrace($exception->getPrevious() ?: $exception);
         ErrorConsoleRenderer::renderPopup($exception, self::$appName, $stackTrace);
         $popup = ob_get_clean();
         // PSR-7 output
         if ($response) {
             $response->getBody()->write($popup);
             return $response->withStatus(500);
         }
         // Direct output
         echo $popup;
     } else {
         // PSR-7 output
         if ($response) {
             $response->getBody()->write($exception->getMessage());
             if (self::$devEnv) {
                 $response->getBody()->write("\n\nStack trace:\n" . $exception->getTraceAsString());
             }
             return $response->withoutHeader('Content-Type')->withHeader('Content-Type', 'text-plain')->withStatus(500);
         }
         // Direct output
         header("Content-Type: text/plain");
         http_response_code(500);
         echo $exception->getMessage();
         if (self::$devEnv) {
             echo "\n\nStack trace:\n" . $exception->getTraceAsString();
         }
     }
     return null;
 }
コード例 #6
0
 function error()
 {
     require 'controllers/' . EQ_404 . '.php';
     $error = new Error();
     $error->index();
     return false;
 }
コード例 #7
0
ファイル: MenuElementView.php プロジェクト: piiskop/pstk
 /**
  * This function creates a HTML-block for a menu item.
  *
  * @access public
  * @author k
  * @param MenuElement $parameters['menuElement']
  *        	the menu element
  * @param string $parameters['type']
  *        	the type
  * @see MenuElement::$type
  * @uses Error for error handling
  * @uses ErrorView for error handling
  * @uses MENU_COMMON for the common menu
  * @uses MENU_SIDE for the menu in sidebar
  */
 public static function buildMenuElement($parameters)
 {
     require_once 'HTML/Template/IT.php';
     $tpl = new \HTML_Template_IT(ROOT_FOLDER . 'html');
     $tpl->loadTemplatefile('particle-template.html');
     switch ($parameters['type']) {
         case MENU_COMMON:
             $tpl->setCurrentBlock('item-in-common-menu');
             $tpl->setVariable(array('HREF-OF-ITEM-IN-COMMON-MENU' => null === $parameters['menuElement']->getHref() ? $parameters['menuElement']->translate(array('property' => 'href', 'isSlug' => true)) : $parameters['menuElement']->getHref(), 'LABEL-OF-ITEM-IN-COMMON-MENU' => $parameters['menuElement']->translate(array('property' => 'label'))));
             $tpl->parse('item-in-common-menu');
             // echo ' 38: ', $tpl->get('menu-item');
             return $tpl->get('item-in-common-menu');
             break;
         case MENU_SIDE:
             $tpl->setCurrentBlock('item-in-menu-in-sidebar');
             $tpl->setVariable(array('HREF-OF-ITEM-IN-MENU-IN-SIDEBAR' => null === $parameters['menuElement']->getHref() ? $parameters['menuElement']->translate(array('property' => 'href', 'isSlug' => true)) : $parameters['menuElement']->getHref(), 'LABEL-OF-ITEM-IN-MENU-IN-SIDEBAR' => $parameters['menuElement']->translate(array('property' => 'label'))));
             $tpl->parse('item-in-menu-in-sidebar');
             return $tpl->get('item-in-menu-in-sidebar');
             break;
         default:
             require_once dirname(__FILE__) . '/Error.php';
             $error = new Error();
             $error->setMessage(\pstk\String::translate('errorWhichMenu'));
             require_once dirname(__FILE__) . '/ErrorView.php';
             ErrorView::raiseError($error);
     }
 }
コード例 #8
0
ファイル: Bootstrap.php プロジェクト: leal32b/mvc
 function __construct()
 {
     $url = filter_input(INPUT_GET, 'url');
     $url = rtrim($url, '/');
     $url = explode('/', $url);
     if (empty($url[0])) {
         require 'controllers/controllerIndex.php';
         $controller = new Index();
         $controller->index();
         return false;
     }
     $file = 'controllers/controller' . $url[0] . '.php';
     if (file_exists($file)) {
         require $file;
     } else {
         require 'controllers/controllerError.php';
         $controller = new Error();
         $controller->index($url[0]);
         return false;
     }
     $controller = new $url[0]();
     if (isset($url[1])) {
         if (method_exists($controller, $url[1])) {
             if (isset($url[2])) {
                 $controller->{$url[1]}($url[2]);
             } else {
                 $controller->{$url[1]}();
             }
         } else {
             $controller->index();
         }
     } else {
         $controller->index();
     }
 }
コード例 #9
0
ファイル: Bootstrap.php プロジェクト: hrydi/distro
 function error()
 {
     require "controller/error.php";
     $controller = new Error();
     $controller->index();
     return false;
 }
コード例 #10
0
 function error()
 {
     require 'controller/error.class.php';
     $controller = new Error();
     $controller->index();
     return false;
 }
コード例 #11
0
ファイル: bootstrap.php プロジェクト: sandyrod/mimo
 function error()
 {
     require 'error.php';
     $controlador = new Error();
     $controlador->index();
     return false;
 }
コード例 #12
0
ファイル: bootstrap.php プロジェクト: alibabaih/notepad-php
 public function error()
 {
     require 'controllers/error.php';
     $controller = new Error();
     $controller->index();
     return false;
 }
コード例 #13
0
ファイル: bootstrap.php プロジェクト: WHTGo/EXP-Training
 function error()
 {
     require 'application/controllers/error.php';
     $controller = new Error();
     $controller->Index();
     return false;
 }
コード例 #14
0
 public function error($exception)
 {
     require 'lib/controllers/error.controller.php';
     $error = new Error();
     $error->show($exception->getMessage() . '<br />Code: ' . $exception->getCode());
     exit;
 }
コード例 #15
0
 /**
  * read the config file and check for existence
  *
  * @return void
  */
 private function _checkConfig()
 {
     include_once APP_ROOT . '/read_config.php';
     if ($this->error->errorsExist()) {
         $this->error->errorsAsXML();
     }
 }
コード例 #16
0
ファイル: Start.php プロジェクト: Rasulbek/asiacinema
 function error($msg = false)
 {
     require 'controllers/error.php';
     $error = new Error();
     $error->index($msg);
     return false;
 }
コード例 #17
0
ファイル: application.php プロジェクト: EmmanuelSW/Eswood
 public function __construct()
 {
     $this->getUrlWithoutModRewrite();
     if (!$this->url_controller) {
         require APP . 'controllers/home.php';
         $page = new Home();
         $page->index();
     } elseif (file_exists(APP . 'controllers/' . $this->url_controller . '.php')) {
         require APP . 'controllers/' . $this->url_controller . '.php';
         $this->url_controller = new $this->url_controller();
         if (method_exists($this->url_controller, $this->url_action)) {
             if (!empty($this->url_params)) {
                 // Llama el metodo y le pasa los argumentos
                 call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
             } else {
                 //Si no hay  parametros llama a el metodo sin argumentos.
                 $this->url_controller->{$this->url_action}();
             }
         } else {
             if (strlen($this->url_action) == 0) {
                 // Si no se define alguna accion defino por defecto la index
                 $this->url_controller->index();
             } else {
                 //Si la accion no existe lanzo el error
                 require APP . 'controllers/error.php';
                 $page = new Error();
                 $page->index();
             }
         }
     } else {
         require APP . 'controllers/error.php';
         $page = new Error();
         $page->index();
     }
 }
コード例 #18
0
 /**
  * Wraps the passed Error class
  *
  * @param Error $error the Error object
  */
 public function __construct($error)
 {
     $this->_error = $error;
     $message = $error->getMessage();
     $code = $error->getCode();
     parent::__construct(sprintf('(%s) - %s', get_class($error), $message), $code);
 }
コード例 #19
0
ファイル: bootstrap.class.php プロジェクト: rlemon/f2chat
 public function error($message)
 {
     require 'lib/controllers/error.controller.php';
     $error = new Error();
     $error->show($message);
     exit;
 }
コード例 #20
0
 public function testError()
 {
     $test = new Error();
     $test->run($this->result);
     $this->assertEquals(1, $this->errorCount);
     $this->assertEquals(1, $this->endCount);
 }
コード例 #21
0
 public function testError()
 {
     $test = new Error();
     $result = $test->run();
     $this->assertEquals(1, $result->errorCount());
     $this->assertEquals(0, $result->failureCount());
     $this->assertEquals(1, count($result));
 }
コード例 #22
0
ファイル: class.php プロジェクト: Gamepay/xp-framework
function __output($buf)
{
    if (FALSE !== ($p = strpos($buf, EPREPEND_IDENTIFIER))) {
        $e = new Error(str_replace(EPREPEND_IDENTIFIER, '', substr($buf, $p)));
        fputs(STDERR, $e->toString());
    }
    return $buf;
}
コード例 #23
0
 function error()
 {
     require 'controllers/error.php';
     $controller = new Error();
     $controller->index();
     return false;
     //stops the execution of code and returns
 }
コード例 #24
0
ファイル: CodeParsingTest.php プロジェクト: nikic/php-parser
 private function formatErrorMessage(Error $e, $code)
 {
     if ($e->hasColumnInfo()) {
         return $e->getMessageWithColumnInfo($code);
     } else {
         return $e->getMessage();
     }
 }
コード例 #25
0
ファイル: Error.php プロジェクト: raynaldmo/php-education
function log($s)
{
    static $error;
    if (is_null($error)) {
        $error = new Error();
    }
    $error->log($s);
}
コード例 #26
0
ファイル: ErrorController.php プロジェクト: hanihh/vvs_v2
 public function actionAdmin()
 {
     $model = new Error('search');
     $model->unsetAttributes();
     if (isset($_GET['Error'])) {
         $model->setAttributes($_GET['Error']);
     }
     $this->render('admin', array('model' => $model));
 }
コード例 #27
0
 /**
  * 
  * @param \webignition\CssValidatorOutput\Message\Error $error
  * @return \webignition\CssValidatorOutput\Message\Warning
  */
 public static function fromError(Error $error)
 {
     $warning = new Warning();
     $warning->setContext($error->getContext());
     $warning->setLineNumber($error->getLineNumber());
     $warning->setMessage($error->getMessage());
     $warning->setRef($error->getRef());
     return $warning;
 }
コード例 #28
0
 protected function remove()
 {
     if (!$this->id) {
         $error = new Error(__METHOD__, Text::read('message.ID.error'));
         die($error->getView());
     }
     // Ajax Callback
     $this->ajaxCallback();
 }
コード例 #29
0
 /**
  * Load your component.
  * 
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page       The resolved page
  */
 public function load(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     switch ($this->cx->getMode()) {
         case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND:
             $errorObj = new Error(\Env::get('cx')->getPage()->getContent());
             \Env::get('cx')->getPage()->setContent($errorObj->getErrorPage());
             break;
     }
 }
コード例 #30
0
ファイル: class.Account.php プロジェクト: sohflp/Hooked
 protected function detail()
 {
     if (!$this->id) {
         $error = new Error(__METHOD__, Text::read('message.ID.error'));
         die($error->getView());
     }
     $this->myView = new AccountDetailView();
     $this->myModel = new AccountModel();
     $this->__detail();
 }