本文整理汇总了PHP中error函数的典型用法代码示例。如果您正苦于以下问题:PHP error函数的具体用法?PHP error怎么用?PHP error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了error函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param string $db_host
* @param string $db_username
* @param string $db_password
* @param string $db_name
*/
public function __construct($db_host, $db_username, $db_password, $db_name)
{
$this->link_id = mysqli_connect($db_host, $db_username, $db_password, $db_name);
if (!$this->link_id) {
error('Unable to connect to MySQL server. MySQL reported: ' . mysqli_error($this->link_id), __FILE__, __LINE__);
}
}
开发者ID:tipsun91,项目名称:punbb-mod,代码行数:13,代码来源:common_db.php
示例2: static_method
function static_method($eventdata)
{
static $called = 0;
static $ignorefail = false;
if ($eventdata == 'status') {
return $called;
} else {
if ($eventdata == 'reset') {
$called = 0;
$ignorefail = false;
return;
} else {
if ($eventdata == 'fail') {
if ($ignorefail) {
$called++;
return true;
} else {
return false;
}
} else {
if ($eventdata == 'ignorefail') {
$ignorefail = true;
return;
} else {
if ($eventdata == 'ok') {
$called++;
return true;
}
}
}
}
}
error('Incorrect eventadata submitted: ' . $eventdata);
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:34,代码来源:testeventslib.php
示例3: _apply_access_policy
function _apply_access_policy($object, $action)
{
$access_policy =& access_policy::instance();
if (!$access_policy->save_object_access_for_action($object, $action)) {
error('access template for action not defined', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('action' => $action));
}
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:7,代码来源:set_publish_status_action.class.php
示例4: checkAuthentication
public static function checkAuthentication($sessionid)
{
try {
if ($sessionid !== null) {
self::$data = API::User()->checkAuthentication($sessionid);
}
if ($sessionid === null || empty(self::$data)) {
self::setDefault();
self::$data = API::User()->login(array('user' => ZBX_GUEST_USER, 'password' => '', 'userData' => true));
if (empty(self::$data)) {
clear_messages(1);
throw new Exception();
}
$sessionid = self::$data['sessionid'];
}
if (self::$data['gui_access'] == GROUP_GUI_ACCESS_DISABLED) {
error(_('GUI access disabled.'));
throw new Exception();
}
zbx_setcookie('zbx_sessionid', $sessionid, self::$data['autologin'] ? time() + SEC_PER_DAY * 31 : 0);
return true;
} catch (Exception $e) {
self::setDefault();
return false;
}
}
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:26,代码来源:class.cwebuser.php
示例5: login
/**
* Tries to login a user and populates self::$data on success.
*
* @param string $login user login
* @param string $password user password
*
* @throws Exception if user cannot be logged in
*
* @return bool
*/
public static function login($login, $password)
{
try {
self::setDefault();
self::$data = API::User()->login(array('user' => $login, 'password' => $password, 'userData' => true));
if (!self::$data) {
throw new Exception();
}
if (self::$data['gui_access'] == GROUP_GUI_ACCESS_DISABLED) {
error(_('GUI access disabled.'));
throw new Exception();
}
if (empty(self::$data['url'])) {
self::$data['url'] = CProfile::get('web.menu.view.last', 'index.php');
}
$result = (bool) self::$data;
if (isset(self::$data['attempt_failed']) && self::$data['attempt_failed']) {
CProfile::init();
CProfile::update('web.login.attempt.failed', self::$data['attempt_failed'], PROFILE_TYPE_INT);
CProfile::update('web.login.attempt.ip', self::$data['attempt_ip'], PROFILE_TYPE_STR);
CProfile::update('web.login.attempt.clock', self::$data['attempt_clock'], PROFILE_TYPE_INT);
$result &= CProfile::flush();
}
// remove guest session after successful login
$result &= DBexecute('DELETE FROM sessions WHERE sessionid=' . zbx_dbstr(get_cookie('zbx_sessionid')));
if ($result) {
self::setSessionCookie(self::$data['sessionid']);
add_audit_ext(AUDIT_ACTION_LOGIN, AUDIT_RESOURCE_USER, self::$data['userid'], '', null, null, null);
}
return $result;
} catch (Exception $e) {
self::setDefault();
return false;
}
}
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:45,代码来源:CWebUser.php
示例6: fully_interactive
function fully_interactive($argv)
{
if (!is_dir('app')) {
error("Couldn't find \"app\" folder in path, please run from a Magento sub-directory.");
}
$code_pool = trim(input("What code pool?"));
$package = trim(input("What package?"));
$module = trim(input("What module?"));
$path = get_config_path($code_pool, $package, $module);
echo "Loading: " . $path . "\n";
$xml = simplexml_load_file($path);
$xVersion = $xml->modules->{$package . '_' . $module}->version;
$version = (string) $xVersion;
echo "Current Version: " . $version . "\n";
//list($major, $minor, $bugfix) = explode(".", $version);
$parts = explode(".", $version);
$index = get_version_index();
$parts[$index]++;
$version_new = implode(".", $parts);
$xVersion[0] = $version_new;
$xml = $xml->asXml();
if (simplexml_load_string($xml)) {
file_put_contents($path, $xml);
}
echo "Updated {$path} to {$version_new}\n";
}
开发者ID:itmyprofession,项目名称:Pulsestorm,代码行数:26,代码来源:magento-increment-version.php
示例7: module_f
function module_f()
{
$input_id = $this->trans_lib->safe("input");
if (!$input_id) {
error("未定义标识串!");
}
$id = $this->trans_lib->int("id");
if (!$id) {
error("未定义模块!");
}
$this->tpl->assign("input_id", $input_id);
$this->tpl->assign("id", $id);
//取得主题列表
$pageurl = $this->url("subject,module");
$pageurl .= "input=" . rawurlencode($input_id) . "&id=" . $id . "&";
//
$this->list_m->set_condition("m.langid='" . $_SESSION["sys_lang_id"] . "'");
//区分语言
$this->list_m->set_condition("m.module_id='" . $id . "'");
$pageid = $this->trans_lib->int(SYS_PAGEID);
$rslist = $this->list_m->get_list($pageid);
$this->tpl->assign("rslist", $rslist);
$total_count = $this->list_m->get_count();
//取得总数
$pagelist = $this->page_lib->page($page_url, $total_count);
$this->tpl->assign("pagelist", $pagelist);
$this->tpl->display("subject/module.html");
}
开发者ID:norain2050,项目名称:hkgbf,代码行数:28,代码来源:subject.php
示例8: post_generate
function post_generate(&$code)
{
$js = '';
if(isset($link->attributes['active_tab']))
$active_tab = $link->attributes['active_tab'];
else
$active_tab = reset($this->tabs);
if(!$this->tabs || !$active_tab || !in_array($active_tab, $this->tabs))
{
error('INVALID_TABS_DECLARATION', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__,
array('tag' => $this->tag,
'description' => 'check your tabs settings',
'file' => $this->source_file,
'line' => $this->starting_line_no));
}
foreach($this->tabs as $id)
$js .= "tabs.register_tab_item('{$id}');\n";
$js .= "tabs.activate('{$active_tab}');\n";
$code->write_html("
<script type='text/javascript'>
var tabs = new tabs_container();
{$js}
</script>");
parent :: post_generate($code);
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:32,代码来源:tabs.tag.php
示例9: _init
function _init()
{
global $G;
$G['TITLE'] = TITLE;
$G['ME'] = basename($_SERVER['SCRIPT_FILENAME']);
// initialize display vars
foreach (array('MESSAGES', 'ERRORS', 'CONTENT') as $v) {
$G[$v] = "";
}
// create the table
try {
$db = new bwSQLite3(DB_FILENAME, TABLE_NAME);
$tn = TABLE_NAME;
$db->sql_do("drop table if exists {$tn}");
$db->sql_do("create table {$tn} ( id integer primary key, animal text, sound text )");
// insert some rows
$db->sql_do("insert into {$tn} (animal, sound) values (?, ?)", 'cat', 'Purr');
$db->sql_do("insert into {$tn} (animal, sound) values (?, ?)", 'dog', 'Woof');
$db->sql_do("insert into {$tn} (animal, sound) values (?, ?)", 'duck', 'Quack');
$db->sql_do("insert into {$tn} (animal, sound) values (?, ?)", 'bear', 'Grrr');
} catch (PDOException $e) {
error($e->getMessage());
}
$G['db'] = $db;
}
开发者ID:kbglobal51,项目名称:yii-trackstar-sample,代码行数:25,代码来源:01_delete-end.php
示例10: commentwall_init
/**
* Comment wall initialisation.
*/
function commentwall_init()
{
global $CFG, $db, $function, $metatags, $template;
// Add meta tags
$metatags .= "<script type=\"text/javascript\" src=\"{$CFG->wwwroot}mod/commentwall/commentwall.js\"><!-- commentwall js --></script>";
// Define some templates
templates_add_context('commentwallobject', 'mod/commentwall/template');
templates_add_context('commentwallfooter', 'mod/commentwall/footer');
templates_add_context('css', 'mod/commentwall/css');
// Set up the database
$tables = $db->Metatables();
if (!in_array($CFG->prefix . "commentwall", $tables)) {
if (file_exists($CFG->dirroot . "mod/commentwall/{$CFG->dbtype}.sql")) {
modify_database($CFG->dirroot . "mod/commentwall/{$CFG->dbtype}.sql");
//reload system
header_redirect($CFG->wwwroot);
} else {
error("Error: Your database ({$CFG->dbtype}) is not yet fully supported by the Elgg commentwall. See the mod/commentwall directory.");
}
print_continue($CFG->wwwroot);
exit;
}
// Add configuration options
$function['userdetails:edit:details'][] = $CFG->dirroot . "mod/commentwall/lib/commentwall_settings.php";
}
开发者ID:BackupTheBerlios,项目名称:tulipan-svn,代码行数:28,代码来源:lib.php
示例11: update
public function update($post)
{
if (empty($_POST['body'])) {
error(__("Error"), __("Body can't be blank."));
}
$post->update(array("title" => $_POST['title'], "body" => $_POST['body']));
}
开发者ID:betsyzhang,项目名称:chyrp,代码行数:7,代码来源:text.php
示例12: add
function add()
{
$this->system->add_breadcrumb('Data resources', '_cpanel/admin/resources/data');
$this->system->add_breadcrumb('Tambah resources');
if (isset($_POST['save_resources'])) {
$name = trim($_POST['name']);
if ($name == '') {
$data['msg'] = error("Resources name is required");
} else {
$is_available = $this->adodb->GetOne("SELECT COUNT(*) FROM sys_resources WHERE `name` = '{$name}'");
if ($is_available > 0) {
$data['msg'] = error("Resources for \"{$name}\" is available on DB. Please use another name");
} else {
$parent_id = (int) $_POST['parent_id'];
$insert = $this->adodb->Execute("INSERT INTO sys_resources SET parent_id = '{$parent_id}',`name` = '{$name}'");
if ($insert) {
$data['msg'] = success("New resources has been saved successfully");
}
}
}
}
$data['resources'] = array_resources();
$data['module'] = "_cpanel";
$data['page'] = "layout_add_resources";
$this->load->view($this->layout_content, $data);
}
开发者ID:unregister,项目名称:tutupgelas,代码行数:26,代码来源:resources.php
示例13: tex_filter_get_executable
function tex_filter_get_executable($debug = false)
{
global $CFG;
$error_message1 = "Your system is not configured to run mimeTeX. You need to download the appropriate<br />" . "executable for you " . PHP_OS . " platform from <a href=\"http://moodle.org/download/mimetex/\">" . "http://moodle.org/download/mimetex/</a>, or obtain the C source<br /> " . "from <a href=\"http://www.forkosh.com/mimetex.zip\">" . "http://www.forkosh.com/mimetex.zip</a>, compile it and " . "put the executable into your<br /> moodle/filter/tex/ directory.";
$error_message2 = "Custom mimetex is not executable!<br /><br />";
if (PHP_OS == "WINNT" || PHP_OS == "WIN32" || PHP_OS == "Windows") {
return "{$CFG->dirroot}/filter/tex/mimetex.exe";
}
$custom_commandpath = "{$CFG->dirroot}/filter/tex/mimetex";
if (file_exists($custom_commandpath)) {
if (is_executable($custom_commandpath)) {
return $custom_commandpath;
} else {
error($error_message2 . $error_message1);
}
}
switch (PHP_OS) {
case "Linux":
return "{$CFG->dirroot}/filter/tex/mimetex.linux";
case "Darwin":
return "{$CFG->dirroot}/filter/tex/mimetex.darwin";
case "FreeBSD":
return "{$CFG->dirroot}/filter/tex/mimetex.freebsd";
}
error($error_message1);
}
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:26,代码来源:lib.php
示例14: index_f
function index_f()
{
$id = $this->trans_lib->int("id");
if (!$id) {
error($this->lang["download_error"], $this->url());
}
$rs = $this->upfile_m->get_one($id);
//执行下载操作
if (!file_exists(ROOT . $rs["filename"]) || !$rs["filename"] || !is_file(ROOT . $rs["filename"])) {
error($this->lang["download_empty"], $this->url());
}
$filesize = filesize(ROOT . $rs["filename"]);
if (!$rs["title"]) {
$rs["title"] = $rs["filename"];
}
$tmpname = str_replace("." . $rs["ftype"], "", $rs["title"]);
$tmpname = $tmpname . "." . $rs["ftype"];
ob_end_clean();
header("Date: " . gmdate("D, d M Y H:i:s", $rs["postdate"]) . " GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $rs["postdate"]) . " GMT");
header("Content-Encoding: none");
header("Content-Disposition: attachment; filename=" . rawurlencode($tmpname));
header("Content-Length: " . $filesize);
header("Accept-Ranges: bytes");
readfile($rs["filename"]);
flush();
ob_flush();
}
开发者ID:ahmatjan,项目名称:yida,代码行数:28,代码来源:download.php
示例15: definition
/**
* Called to define this moodle form
*
* @return void
*/
public function definition()
{
global $DB;
$mform =& $this->_form;
$course = $this->_customdata['course'];
$cm = $this->_customdata['cm'];
$modcontext = $this->_customdata['modcontext'];
$sessionid = $this->_customdata['sessionid'];
if (!($sess = $DB->get_record('attcontrol_sessions', array('id' => $sessionid)))) {
error('No such session in this course');
}
$dhours = floor($sess->duration / HOURSECS);
$dmins = floor(($sess->duration - $dhours * HOURSECS) / MINSECS);
$defopts = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'noclean' => true, 'context' => $modcontext);
$data = array('sessiondate' => $sess->sessdate, 'durtime' => array('hours' => $dhours, 'minutes' => $dmins), 'description' => $sess->description);
$mform->addElement('header', 'general', get_string('changesession', 'attcontrol'));
$mform->addElement('static', 'olddate', get_string('olddate', 'attcontrol'), userdate($sess->sessdate, get_string('strftimedmyhm', 'attcontrol')));
$mform->addElement('date_time_selector', 'sessiondate', get_string('newdate', 'attcontrol'));
for ($i = 0; $i <= 23; $i++) {
$hours[$i] = sprintf("%02d", $i);
}
for ($i = 0; $i < 60; $i += 5) {
$minutes[$i] = sprintf("%02d", $i);
}
$durselect[] =& $mform->createElement('select', 'hours', '', $hours);
$durselect[] =& $mform->createElement('select', 'minutes', '', $minutes, false, true);
$mform->addGroup($durselect, 'durtime', get_string('duration', 'attcontrol'), array(' '), true);
$mform->addElement('textarea', 'description', get_string("description", "attcontrol"), 'wrap="virtual" rows="10" cols="100"');
$mform->setDefaults($data);
$submit_string = get_string('update', 'attcontrol');
$this->add_action_buttons(true, $submit_string);
}
开发者ID:martinliao,项目名称:attcontrol,代码行数:37,代码来源:update_form.php
示例16: initialize_cart_handler
function initialize_cart_handler(&$handler)
{
if($handler === null)
{
switch(CART_DEFAULT_HANDLER_TYPE)
{
case 'session':
include_once(LIMB_DIR . '/core/model/shop/handlers/session_cart_handler.class.php');
$this->_cart_handler =& new session_cart_handler($this->_cart_id);
break;
case 'db':
include_once(LIMB_DIR . '/core/model/shop/handlers/db_cart_handler.class.php');
$this->_cart_handler =& new db_cart_handler($this->_cart_id);
break;
default:
error('unknown default cart handler type',
__FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__,
array('type' => CART_DEFAULT_HANDLER_TYPE));
}
$this->_cart_handler->reset();
}
else
{
$this->_cart_handler =& $handler;
$this->_cart_handler->set_cart_id($this->_cart_id);
$this->_cart_handler->reset();
}
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:32,代码来源:cart.class.php
示例17: enforce
function enforce($condition, $message = 'Enforcement failed')
{
if (!$condition) {
error($message);
}
return $condition;
}
开发者ID:yuhangwang,项目名称:verysleepy,代码行数:7,代码来源:crashback.php
示例18: get_userinfo
/**
* Returns the user information for 'external' users. In this case the
* attributes provided by Shibboleth
*
* @return array $result Associative array of user data
*/
function get_userinfo($username)
{
// reads user information from shibboleth attributes and return it in array()
global $CFG;
// Check whether we have got all the essential attributes
if (empty($_SERVER[$this->config->user_attribute])) {
error(get_string('shib_not_all_attributes_error', 'auth', "'" . $this->config->user_attribute . "' ('" . $_SERVER[$this->config->user_attribute] . "'), '" . $this->config->field_map_firstname . "' ('" . $_SERVER[$this->config->field_map_firstname] . "'), '" . $this->config->field_map_lastname . "' ('" . $_SERVER[$this->config->field_map_lastname] . "') and '" . $this->config->field_map_email . "' ('" . $_SERVER[$this->config->field_map_email] . "')"));
}
$attrmap = $this->get_attributes();
$result = array();
$search_attribs = array();
foreach ($attrmap as $key => $value) {
// Check if attribute is present
if (!isset($_SERVER[$value])) {
$result[$key] = '';
continue;
}
// Make usename lowercase
if ($key == 'username') {
$result[$key] = strtolower($this->get_first_string($_SERVER[$value]));
} else {
$result[$key] = $this->get_first_string($_SERVER[$value]);
}
}
// Provide an API to modify the information to fit the Moodle internal
// data representation
if ($this->config->convert_data && $this->config->convert_data != '' && is_readable($this->config->convert_data)) {
// Include a custom file outside the Moodle dir to
// modify the variable $moodleattributes
include $this->config->convert_data;
}
return $result;
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:39,代码来源:auth.php
示例19: definition
function definition()
{
global $CFG;
$mform =& $this->_form;
// this hack is needed for different settings of each subtype
if (!empty($this->_instance)) {
if ($res = get_record('resource', 'id', (int) $this->_instance)) {
$type = $res->type;
} else {
error('incorrect assignment');
}
} else {
$type = required_param('type', PARAM_ALPHA);
}
$mform->addElement('hidden', 'type', $type);
$mform->setDefault('type', $type);
require $CFG->dirroot . '/mod/resource/type/' . $type . '/resource.class.php';
$resclass = 'resource_' . $type;
$this->_resinstance = new $resclass();
//-------------------------------------------------------------------------------
$mform->addElement('header', 'general', get_string('general', 'form'));
// $mform->addElement('static', 'statictype', get_string('assignmenttype', 'assignment'), get_string('type'.$type,'assignment'));
$mform->addElement('text', 'name', get_string('name'), array('size' => '48'));
$mform->setType('name', PARAM_TEXT);
$mform->addRule('name', null, 'required', null, 'client');
$mform->addElement('htmleditor', 'summary', get_string('summary'));
$mform->setType('summary', PARAM_RAW);
$mform->setHelpButton('summary', array('summary', get_string('summary'), 'resource'));
// summary should be optional again MDL-9485
//$mform->addRule('summary', get_string('required'), 'required', null, 'client');
$mform->addElement('header', 'typedesc', get_string('resourcetype' . $type, 'resource'));
$this->_resinstance->setup_elements($mform);
$this->standard_coursemodule_elements(array('groups' => false, 'groupmembersonly' => true, 'gradecat' => false));
$this->add_action_buttons();
}
开发者ID:r007,项目名称:PMoodle,代码行数:35,代码来源:mod_form.php
示例20: pre_parse
function pre_parse()
{
if (!array_key_exists('attributes', $this->attributes) || empty($this->attributes['attributes'])) {
error('MISSINGREQUIREATTRIBUTE', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('tag' => $this->tag, 'attribute' => 'attributes', 'file' => $this->source_file, 'line' => $this->starting_line_no));
}
return PARSER_REQUIRE_PARSING;
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:7,代码来源:request_transfer.tag.php
注:本文中的error函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论