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


PHP ErrorHandler::error方法代码示例

本文整理汇总了PHP中ErrorHandler::error方法的典型用法代码示例。如果您正苦于以下问题:PHP ErrorHandler::error方法的具体用法?PHP ErrorHandler::error怎么用?PHP ErrorHandler::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ErrorHandler的用法示例。


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

示例1: debug

 public static function debug($message)
 {
     if (!DEBUG) {
         return;
     }
     ErrorHandler::error(500, "Debug", "<pre>" . $message . "</pre>", 3);
 }
开发者ID:davbfr,项目名称:cf,代码行数:7,代码来源:Output.class.php

示例2: ensureDir

 public static function ensureDir($name, $mode = 0750)
 {
     if (!is_dir($name)) {
         if (!@mkdir($name, $mode, true)) {
             ErrorHandler::error(500, null, "Unable to create directory {$name}");
         }
     }
 }
开发者ID:davbfr,项目名称:cf,代码行数:8,代码来源:System.class.php

示例3: getArray

 public function getArray()
 {
     $data = json_decode(file_get_contents($this->filename_cache), true);
     if (json_last_error() !== JSON_ERROR_NONE) {
         ErrorHandler::error(500, null, "Error in {$filename} : " . self::jsonLastErrorMsg());
     }
     return $data;
 }
开发者ID:davbfr,项目名称:cf,代码行数:8,代码来源:Cache.class.php

示例4: loadAsKey

 public function loadAsKey($key, $filename)
 {
     $data = json_decode(file_get_contents($filename), true);
     if (json_last_error() !== JSON_ERROR_NONE) {
         ErrorHandler::error(500, null, "Error in {$filename} : " . self::jsonLastErrorMsg());
     }
     $this->data[$key] = $data;
     Logger::debug("Config {$filename} loaded");
 }
开发者ID:davbfr,项目名称:cf,代码行数:9,代码来源:Config.class.php

示例5: login

 protected function login($username, $password)
 {
     $users = new UsersModel();
     $userid = $users->dologin($username, $password);
     if ($userid === false) {
         ErrorHandler::error(401, "Invalid username or password");
     }
     return $userid;
 }
开发者ID:DavBfr,项目名称:BlogMVC,代码行数:9,代码来源:LoginRest.class.php

示例6: dispatch

 /**
  * Dispatch the request.
  */
 public function dispatch()
 {
     if ($this->active) {
         // Initialize the core model
         $coreModel = new CoreModel($this->request);
         // Validate the request
         $requestValid = $coreModel->validateRequest();
         $output = '';
         if ($requestValid) {
             // Retrieve the correct module controller
             $controllerObj = $this->getRequestController();
             // In case the controller could not be initialized, throw an exception
             if (!$controllerObj) {
                 ErrorHandler::error(E_ERROR, 'The requested endpoint could not be initialized');
             }
             // In case the module is inactive or the requested method does not exist, throw an exception
             if (!$controllerObj->active || !method_exists($controllerObj, $this->action)) {
                 ErrorHandler::error(E_ERROR, "The requested action '%s' is not available", $this->action);
             }
             // Start an output buffer to catch request content
             ob_start();
             // Execute the before action when present
             $beforeMethodName = 'before' . ucfirst($this->action);
             if (method_exists($controllerObj, $beforeMethodName)) {
                 $controllerObj->{$beforeMethodName}();
             }
             // Execute the requested action
             $controllerObj->{$this->action}();
             // Execute the after action when present
             $afterMethodName = 'after' . ucfirst($this->action);
             if (method_exists($controllerObj, $afterMethodName)) {
                 $controllerObj->{$afterMethodName}();
             }
             // Retrieve the output buffer result
             $result = ob_get_clean();
             // In case the request is AJAX, output the request result directly
             if ($this->request->ajax) {
                 // Retrieve the header include content
                 $header = $this->getHeaderIncludeHTML();
                 $output = $header . $result;
             } else {
                 // Retrieve the output
                 ob_start();
                 require_once $this->modulePath . DIR_VIEW . 'index.php';
                 $output = ob_get_clean();
             }
         }
     } else {
         $output = $this->getMaintenanceView();
     }
     // Set the output character set
     header('Content-type: text/html; charset=utf-8');
     //                header('Cache-Control: max-age=3600');
     // Send the output
     exit($output);
 }
开发者ID:geo4web-testbed,项目名称:topic2,代码行数:59,代码来源:CoreController.php

示例7: insert

 public function insert($filename, $optional = false)
 {
     $template = self::findTemplate($filename);
     if ($template === false) {
         if ($optional) {
             return;
         }
         ErrorHandler::error(404, null, $filename);
     }
     include $template;
 }
开发者ID:davbfr,项目名称:cf,代码行数:11,代码来源:Template.class.php

示例8: validateRequestParams

 public function validateRequestParams()
 {
     $userName = $this->getParam(REQUEST_PARAMETER_USER_NAME);
     $userPassword = $this->getParam(REQUEST_PARAMETER_USER_PASSWORD);
     if (!$userName || !$userPassword) {
         ErrorHandler::error(E_ERROR, 'Missing user parameters');
     }
     $this->userName = strtolower($userName);
     $password = mcrypt_encrypt(MCRYPT_RIJNDAEL_192, VISUALIZATION_KEY, $userPassword, MCRYPT_MODE_ECB);
     $this->userPassword = urlencode($password);
 }
开发者ID:geo4web-testbed,项目名称:topic2,代码行数:11,代码来源:ValidateModel.php

示例9: validateRequestParams

 public function validateRequestParams()
 {
     $loggedIn = Session::getData(REQUEST_PARAMETER_LOGGEDIN);
     $this->user = Session::getData(REQUEST_PARAMETER_USER_NAME);
     if (!$loggedIn || !isset($this->user['UserName']) || !isset($this->user['Email'])) {
         ErrorHandler::error(E_ERROR, 'This action is not allowed');
     }
     $this->visualization = $this->getVisualization();
     if (!isset($this->visualization[REQUEST_PARAMETER_VIZ_ID]) || !$this->visualization[REQUEST_PARAMETER_VIZ_ID]) {
         ErrorHandler::error(E_ERROR, 'An invalid visualization was requested');
     }
     if (!$this->visualization[REQUEST_PARAMETER_MYMAP]) {
         ErrorHandler::error(E_ERROR, 'Only My Maps are allowed');
     }
 }
开发者ID:geo4web-testbed,项目名称:topic2,代码行数:15,代码来源:PropositionModel.php

示例10: validateRequestParams

 public function validateRequestParams()
 {
     $loggedIn = Session::getData(REQUEST_PARAMETER_LOGGEDIN);
     $this->user = Session::getData(REQUEST_PARAMETER_USER_NAME);
     if (!$loggedIn || !isset($this->user['UserName']) || !isset($this->user['Email'])) {
         ErrorHandler::error(E_ERROR, 'This action is not allowed');
     }
     $this->visualization = $this->getVisualization();
     if (!isset($this->visualization[REQUEST_PARAMETER_VIZ_ID]) || !$this->visualization[REQUEST_PARAMETER_VIZ_ID] || !$this->visualization[REQUEST_PARAMETER_MYMAP] && (!$this->visualization['map_enabled'] || !$this->visualization['edit_enabled'])) {
         ErrorHandler::error(E_ERROR, 'An invalid visualization was requested');
     }
     $this->featureId = $this->getParam('featureId');
     $this->layerId = $this->getParam('layerId');
     if (!$this->featureId || !$this->layerId) {
         ErrorHandler::error(E_ERROR, 'No feature data was given');
     }
 }
开发者ID:geo4web-testbed,项目名称:topic2,代码行数:17,代码来源:GetFeatureModel.php

示例11: parse

 public function parse($filenames)
 {
     if (!is_array($filenames)) {
         $filenames = array($filenames);
     }
     $template = false;
     foreach ($filenames as $filename) {
         $template = self::findTemplate($filename);
         if ($template !== false) {
             break;
         }
     }
     if ($template === false) {
         ErrorHandler::error(404, null, implode(", ", $filenames));
     }
     return Markdown::transform(file_get_contents($template));
 }
开发者ID:DavBfr,项目名称:BlogMVC,代码行数:17,代码来源:MdTemplate.class.php

示例12: ensureRequest

 public static function ensureRequest($array, $mandatory, $optional = array(), $strict = false)
 {
     foreach ($mandatory as $param) {
         if (!isset($array[$param])) {
             ErrorHandler::error(417, null, "Missing parameter {$param}");
         }
         if ($array[$param] == "") {
             ErrorHandler::error(417, null, "Empty parameter {$param}");
         }
     }
     if ($strict) {
         foreach ($array as $param => $val) {
             if (!(in_array($param, $mandatory) || in_array($param, $optional))) {
                 ErrorHandler::error(417, null, "Parameter overly {$param}");
             }
         }
     }
 }
开发者ID:davbfr,项目名称:cf,代码行数:18,代码来源:Input.class.php

示例13: runCurl

 /**
  * Send a cURL request.
  *
  * @param       string          $url            URL to call
  * @param       array           $options        cURL options (optional)
  * @param       array           $timeout        Request timeout in seconds (optional)
  * @return      mixed                           Result
  */
 public static function runCurl($url, $options = array(), $timeout = 30)
 {
     // Prepare the timeout option
     $options[CURLOPT_TIMEOUT] = intval($timeout);
     // Initialize the cURL connection
     self::initCurl($url, $options);
     // Execute the call
     $curlResult = curl_exec(self::$curl);
     // In case of an unsuccessful request, set the result to false
     if (!in_array(curl_getinfo(self::$curl, CURLINFO_HTTP_CODE), array(200, 204, 301, 302, 304))) {
         // In case debug mode is enabled, throw an error
         if (debugMode()) {
             ErrorHandler::error(500, curl_getinfo(self::$curl, CURLINFO_HTTP_CODE) . ': ' . curl_error(self::$curl));
         }
         $curlResult = false;
     }
     // Return the call result
     return $curlResult;
 }
开发者ID:spotzi,项目名称:Geotagger,代码行数:27,代码来源:Connectivity.php

示例14: validateRequestParams

 public function validateRequestParams()
 {
     $loggedIn = Session::getData(REQUEST_PARAMETER_LOGGEDIN);
     $this->user = Session::getData(REQUEST_PARAMETER_USER_NAME);
     if (!$loggedIn || !isset($this->user['UserName']) || !isset($this->user['Email'])) {
         ErrorHandler::error(E_ERROR, 'This action is not allowed');
     }
     // @todo: update so this class can deal with other update fields like email
     $passwordOld = $this->getParam('passwordOld');
     $passwordNew = $this->getParam('passwordNew');
     $passwordConfirm = $this->getParam('passwordConfirm');
     if (!$passwordOld || !$passwordNew || !$passwordConfirm) {
         ErrorHandler::error(E_ERROR, 'Invalid password input');
     }
     $passwordHashOld = mcrypt_encrypt(MCRYPT_RIJNDAEL_192, VISUALIZATION_KEY, $passwordOld, MCRYPT_MODE_ECB);
     $this->passwordOld = urlencode($passwordHashOld);
     $passwordHashNew = mcrypt_encrypt(MCRYPT_RIJNDAEL_192, VISUALIZATION_KEY, $passwordNew, MCRYPT_MODE_ECB);
     $this->passwordNew = urlencode($passwordHashNew);
     $passwordHashConfirm = mcrypt_encrypt(MCRYPT_RIJNDAEL_192, VISUALIZATION_KEY, $passwordConfirm, MCRYPT_MODE_ECB);
     $this->passwordConfirm = urlencode($passwordHashConfirm);
 }
开发者ID:geo4web-testbed,项目名称:topic2,代码行数:21,代码来源:UserModel.php

示例15: create

 public function create()
 {
     $webserviceUrl = WEBSERVICE_URL . 'visualization/wo/visualization';
     $webserviceParams = array('user' => WEBSERVICE_USER, 'password' => WEBSERVICE_PASSWORD, 'userName' => $this->user['UserName'], 'userKey' => $this->user['ApiKey'], 'format' => 'application/json');
     $visualizationName = $this->getParam('createName');
     if ($visualizationName) {
         $webserviceParams['visualizationName'] = strip_tags($visualizationName);
     }
     $webserviceResult = Connectivity::runCurl($webserviceUrl, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $webserviceParams));
     $result = false;
     if ($webserviceResult) {
         $webserviceContents = json_decode($webserviceResult, true);
         if (isset($webserviceContents['response']['visualization'])) {
             $result = $webserviceContents['response']['visualization'];
         }
     }
     if ($result === false) {
         ErrorHandler::error(E_NOTICE, "The visualization '%s' could not be created, result: %s", $visualizationName ? $webserviceParams['visualizationName'] : '', $webserviceResult);
     }
     return array(REQUEST_RESULT => $result);
 }
开发者ID:geo4web-testbed,项目名称:topic2,代码行数:21,代码来源:CreateModel.php


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