本文整理汇总了PHP中error类的典型用法代码示例。如果您正苦于以下问题:PHP error类的具体用法?PHP error怎么用?PHP error使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了error类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($infos = false)
{
$displayErrors = false;
if (!self::$pdoS) {
if (empty($infos)) {
require ROOT . 'config/bdd.php';
$infos = $BDD['mysql'];
}
$displayErrors = @$infos['displayErrors'];
try {
self::$pdoS = new PDO('mysql:host=' . $infos['host'] . ';dbname=' . $infos['database'] . '', $infos['login'], $infos['password'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''));
self::$pdoS->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->wake_up();
return true;
} catch (PDOException $erreur) {
$error = new error();
if ($displayErrors) {
$error->addError('Error : ' . $erreur->getMessage(), ERROR_PAGE);
} else {
$error->addError('We can\'t display the page you asked for.', ERROR_PAGE);
}
return false;
}
}
$this->wake_up();
}
示例2: load
/**
* Loads the data for this ViewNode record from the database
* @return ViewNode object (this)
*/
function load($style = 'long')
{
global $DB, $CFG, $USER, $ERROR, $HUB_FLM, $HUB_SQL;
try {
$this->canview();
} catch (Exception $e) {
return access_denied_error();
}
$params = array();
$params[0] = $this->viewid;
$params[1] = $this->nodeid;
$params[2] = $this->userid;
$resArray = $DB->select($HUB_SQL->DATAMODEL_VIEWNODE_SELECT, $params);
if ($resArray !== false) {
$count = count($resArray);
if ($count == 0) {
$ERROR = new error();
$ERROR->createNodeNotFoundError($this->nodeid);
return $ERROR;
} else {
for ($i = 0; $i < $count; $i++) {
$array = $resArray[$i];
$this->xpos = stripslashes(trim($array['XPos']));
$this->ypos = $array['YPos'];
$this->creationdate = $array['CreationDate'];
$this->modificationdate = $array['ModificationDate'];
$this->node = new CNode($this->nodeid);
$this->node = $this->node->load($style);
}
}
} else {
return database_error();
}
return $this;
}
示例3: error
function error()
{
require 'Controllers/error.php';
$controller = new error();
$controller->index();
return false;
}
示例4: captcha
function captcha($sourceFolder, $moduleFolder, $uploadFolder, $urlRequestRoot, $cmsFolder, $length = 5)
{
$this->sourceFolder = $sourceFolder;
$this->moduleFolder = $moduleFolder;
$this->uploadFolder = $uploadFolder;
$this->urlRequestRoot = $urlRequestRoot;
$this->cmsFolder = $cmsFolder;
// header('Content-type: image/png');
$this->Length = $length;
//$this->fontpath = dirname($_SERVER['SCRIPT_FILENAME']) . '/fonts/';
global $sourceFolder, $moduleFolder;
$this->fontpath = "{$sourceFolder}/{$moduleFolder}/form/captcha/fonts/";
$this->fonts = $this->getFonts();
$errormgr = new error();
if ($this->fonts == FALSE) {
//$errormgr = new error;
$errormgr->addError('No fonts available!');
$errormgr->displayError();
// die();
}
if (function_exists('imagettftext') == FALSE) {
$errormgr->addError('');
$errormgr->displayError();
// die();
}
$this->stringGen();
$this->makeCaptcha();
}
示例5: Error
public static function Error()
{
Session::flush('sure', Messages::_404());
require_once SITE_PATH . '/app/controllers/error_controller.php';
$control = new error();
$control->index();
return FALSE;
}
示例6: Error
public static function Error()
{
Session::flush('sure', '404: Page does not exists!<br/>Are you sure what you are looking for?');
require_once SITE_PATH . '/app/controllers/error_controller.php';
$control = new error();
$control->index();
return FALSE;
}
示例7: Not_have_Perm
/**
* Not have permition to view this page
*/
public function Not_have_Perm()
{
/** @noinspection PhpIncludeInspection */
require_once controllers_dir() . default_error();
$err = new error();
$err->error403();
exit;
}
示例8: view
public function view()
{
// Get URI vars
$newsID = (int) uri::segment(3);
// Get news entry
if (!$newsID || !($news = $this->news_model->getEntry($newsID, 'in_view')) || !$news['active']) {
error::show404();
}
// Do we have views enabled?
if (config::item('news_views', 'news')) {
// Update views counter
$this->news_model->updateViews($newsID);
}
// Load ratings
if (config::item('news_rating', 'news') == 'stars') {
// Load votes model
loader::model('comments/votes');
// Get votes
$news['user_vote'] = $this->votes_model->getVote('news', $newsID);
} elseif (config::item('news_rating', 'news') == 'likes') {
// Load likes model
loader::model('comments/likes');
// Get likes
$news['user_vote'] = $this->likes_model->getLike('news', $newsID);
}
// Assign vars
view::assign(array('newsID' => $newsID, 'news' => $news));
// Set title
view::setTitle($news['data_title']);
// Set meta tags
view::setMetaDescription($news['data_meta_description']);
view::setMetaKeywords($news['data_meta_keywords']);
// Load view
view::load('news/view');
}
示例9: template
function template($file)
{
global $template_loaded;
$template_loaded = false;
HOOK::run(str_replace('/', '_', "template_load_{$file}"));
$template_name = defined('IN_ADMINCP') ? 'default' : getSetting('template');
if (IN_MOBILE) {
$mobilefile = ROOT . "./template/{$template_name}/mobile/{$file}.php";
if (file_exists($mobilefile)) {
return $mobilefile;
}
$mobilefile_default = ROOT . "./template/default/mobile/{$file}.php";
if (file_exists($mobilefile_default)) {
return $mobilefile_default;
}
}
$path = ROOT . "./template/{$template_name}/{$file}.php";
if (file_exists($path)) {
return $path;
}
$path = ROOT . "./template/default/{$file}.php";
if (file_exists($path)) {
return $path;
}
error::system_error("Missing template '{$file}'.");
}
示例10: Forum_Controller
/**
* Forum_Controller constructor
* @param string template The base template to use for
* the specific page.
*/
function Forum_Controller($template)
{
/* Globalize the settings and config arrays */
global $_SETTINGS, $_USERGROUPS, $_ALLFORUMS;
/* Make sure the default event class exists */
if (!class_exists('DefaultEvent')) {
exit('Yahtzee!');
}
/* Call the Controller Constructor */
parent::Controller(new DefaultEvent());
/* Create a new instance of Template */
error::reset();
$this->template =& new Template($template);
if (error::grab()) {
critical_error();
}
/* Set all of the setting values to the template */
$this->template->setVarArray($_SETTINGS);
/* Set the Jump To Box */
$jump_to =& new AllForumsIterator($_ALLFORUMS);
$this->template->setList('all_forums', $jump_to);
/* Add the usergroups to the template */
$usergroups =& new FAArrayIterator($_USERGROUPS);
$this->template->setList('usergroups', $usergroups);
}
示例11: bulk_verify
/**
* Provides the services/data_utils/bulk_verify service. This takes a report plus params (json object) in the $_POST
* data and verifies all the records returned by the report according to the filter. Pass ignore=true to allow this to
* ignore any verification check rule failures (use with care!).
*/
public function bulk_verify()
{
$db = new Database();
$this->authenticate('write');
$report = $_POST['report'];
$params = json_decode($_POST['params'], true);
$params['sharing'] = 'verification';
$websites = $this->website_id ? array($this->website_id) : null;
$this->reportEngine = new ReportEngine($websites, $this->user_id);
try {
// Load the report used for the verification grid with the same params
$data = $this->reportEngine->requestReport("{$report}.xml", 'local', 'xml', $params);
// now get a list of all the occurrence ids
$ids = array();
foreach ($data['content']['records'] as $record) {
if ($record['record_status'] !== 'V' && (!empty($record['pass']) || $_POST['ignore'] === 'true')) {
$ids[$record['occurrence_id']] = $record['occurrence_id'];
$db->insert('occurrence_comments', array('occurrence_id' => $record['occurrence_id'], 'comment' => 'This record is assumed to be correct', 'created_by_id' => $this->user_id, 'created_on' => date('Y-m-d H:i:s'), 'updated_by_id' => $this->user_id, 'updated_on' => date('Y-m-d H:i:s')));
}
}
$db->from('occurrences')->set(array('record_status' => 'V', 'verified_by_id' => $this->user_id, 'verified_on' => date('Y-m-d H:i:s'), 'updated_by_id' => $this->user_id, 'updated_on' => date('Y-m-d H:i:s')))->in('id', array_keys($ids))->update();
echo count($ids);
$db->from('cache_occurrences')->set(array('record_status' => 'V', 'cache_updated_on' => date('Y-m-d H:i:s')))->in('id', array_keys($ids))->update();
} catch (Exception $e) {
echo $e->getMessage();
error::log_error('Exception during bulk verify', $e);
}
}
示例12: verify
/**
* Function to support the services/data_cleaner/verify web-service.
* Receives a list of proposed records and applies verification rules to them, then
* returns a list of verification notices.
* Input is provided in the $_GET or $_POST data sent to the method as follows:
* auth_token - read authorisation token
* nonce - read nonce
* sample - Provides details of the sample being verified. If verifying a list
* of records from different places or dates then the sample entry can be ommitted or only partially
* filled-in with the missing information provided on a record by record bases. A JSON formatted
* object with entries for sample:survey_id, sample:date, sample:entered_sref and sample:entered_sref_system, plus
* optional sample:geom (WKT format).
* occurrences - JSON format, provide an array of the occurrence record to verify. Each record is an object
* with occurrence:taxa_taxon_list_id, an optional stage plus any of the values for the sample which need to be
* specified on a record by record bases. I.e. provide sample:date if the sample information sent
* does not include a date, or a date is included but this record is for a different date.
* rule_types - JSON formatted array of the rule types to run. If not provided, then all rule types are run.
* E.g. ["WithoutPolygon","PeriodWithinYear"] to run just without polygon and period within year checks.
* @return JSON A JSON array containing a list of notifications. Each notification is a JSON
* object, with taxa_taxon_list_id and message properties.
*/
public function verify()
{
// authenticate requesting website for this service
$this->authenticate('read');
if (isset($_REQUEST['sample'])) {
$sample = json_decode($_REQUEST['sample'], true);
}
if (isset($_REQUEST['occurrences'])) {
$occurrences = json_decode($_REQUEST['occurrences'], true);
}
if (empty($sample) || empty($occurrences)) {
$this->response = 'Invalid parameters';
} else {
$db = new Database();
// Create an empty template table
$db->query("select * into temporary occdelta from cache_occurrences limit 0;");
try {
$this->prepareOccdelta($db, $sample, $occurrences);
$r = $this->runRules($db);
$db->query('drop table occdelta');
$this->content_type = 'Content-Type: application/json';
$this->response = json_encode($r);
} catch (Exception $e) {
$db->query('drop table occdelta');
$this->response = "Query failed";
error::log_error('Error occurred calling verification rule service', $e);
}
}
$this->send_response();
}
示例13: delete
public function delete()
{
// Get URI vars
$slugID = urldecode(utf8::trim(uri::segment(4)));
// Do we have a slug ID?
if ($slugID == '') {
error::show404();
}
// Get user
if (!($user = $this->users_model->getUser($slugID)) || !$user['active'] || !$user['verified']) {
error::show404();
} elseif ($user['user_id'] == session::item('user_id')) {
router::redirect($user['slug']);
}
// Does user exist?
if (!($blocked = $this->users_blocked_model->getUser($user['user_id'], true))) {
view::setError(__('no_blocked_user', 'users_blocked'));
router::redirect('users/blocked');
}
// Delete blocked user
$this->users_blocked_model->deleteBlockedUser(session::item('user_id'), $user['user_id']);
// Success
view::setInfo(__('user_unblocked', 'users_blocked'));
router::redirect(input::get('page') ? 'users/blocked' : $user['slug']);
}
示例14: run_controller
public function run_controller($in_action = false)
{
// Инициализируем класс контроллера
$class = 'controller_' . $this->request->controller;
if (!class_exists($class) && $this->config->fallback_controller) {
$class = 'controller_' . $this->config->fallback_controller;
}
if (!class_exists($class)) {
if ($in_action) {
$class = 'controller_error';
} else {
error::call('Not Found', 404);
}
}
$this->controller = new $class($this->request, $this->response);
ob_start();
$this->plugin_action('controller_before');
// Хук, до выполнения экшена контроллера
$this->controller->before();
// Запускаем основной экшн
$action = $this->request->action . '_action';
$this->controller->{$action}($this->request->param);
$this->plugin_action('controller_after');
// Хук, после выполнения экшена контроллера
$this->controller->after();
// Запускаем ренедер контента
$this->controller->render();
$this->plugin_action('controller_render');
}
示例15: nxd_check_config
function nxd_check_config($item)
{
if (!isset($GLOBALS['nxd_config'][$item])) {
return error::instance()->fatal('Missing configuration item requested', $item);
}
return $GLOBALS['nxd_config'][$item];
}