本文整理汇总了PHP中error_parameters函数的典型用法代码示例。如果您正苦于以下问题:PHP error_parameters函数的具体用法?PHP error_parameters怎么用?PHP error_parameters使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了error_parameters函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: email_queue_add
/**
* Add to email queue
* @param EmailData $p_email_data
* @return int
*/
function email_queue_add($p_email_data)
{
$t_email_data = email_queue_prepare_db($p_email_data);
# email cannot be blank
if (is_blank($t_email_data->email)) {
error_parameters(lang_get('email'));
trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
# subject cannot be blank
if (is_blank($t_email_data->subject)) {
error_parameters(lang_get('subject'));
trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
# body cannot be blank
if (is_blank($t_email_data->body)) {
error_parameters(lang_get('body'));
trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
$t_email_table = db_get_table('email');
$c_email = $t_email_data->email;
$c_subject = $t_email_data->subject;
$c_body = $t_email_data->body;
$c_metadata = serialize($t_email_data->metadata);
$query = "INSERT INTO {$t_email_table}\n\t\t\t\t ( email,\n\t\t\t\t subject,\n\t\t\t\t\t body,\n\t\t\t\t\t submitted,\n\t\t\t\t\t metadata)\n\t\t\t\t VALUES\n\t\t\t\t ( " . db_param() . ",\n\t\t\t\t " . db_param() . ",\n\t\t\t\t " . db_param() . ",\n\t\t\t\t\t " . db_param() . ",\n\t\t\t\t\t " . db_param() . "\n\t\t\t\t\t)";
db_query_bound($query, array($c_email, $c_subject, $c_body, db_now(), $c_metadata));
return db_insert_id($t_email_table, 'email_id');
}
示例2: gpc_get_fileCustom
function gpc_get_fileCustom($p_var_name, $p_default = null)
{
if (isset($_FILES[$p_var_name])) {
# FILES are not escaped even if magic_quotes is ON, this applies to Windows paths.
$t_result = $_FILES[$p_var_name];
} else {
if (isset($_POST[$p_var_name])) {
$f = $_POST[$p_var_name][0];
$h = "data:image/png;base64,";
if (substr($f, 0, strlen($h)) == $h) {
$data = base64_decode(substr($f, strlen($h)));
$fn = tempnam("/tmp", "CLPBRD");
file_put_contents($fn, $data);
chmod($fn, 0777);
$t_result = array();
$pi = pathinfo($fn);
$t_result[0]['name'] = $pi['filename'] . ".png";
$t_result[0]['type'] = "image/png";
$t_result[0]['size'] = strlen($data);
$t_result[0]['tmp_name'] = $fn;
$t_result[0]['error'] = 0;
}
} else {
if (func_num_args() > 1) {
# check for a default passed in (allowing null)
$t_result = $p_default;
} else {
error_parameters($p_var_name);
trigger_error(ERROR_GPC_VAR_NOT_FOUND, ERROR);
}
}
}
return $t_result;
}
示例3: email_queue_add
function email_queue_add($p_email_data)
{
$t_email_data = email_queue_prepare_db($p_email_data);
# email cannot be blank
if (is_blank($t_email_data->email)) {
error_parameters(lang_get('email'));
trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
# subject cannot be blank
if (is_blank($t_email_data->subject)) {
error_parameters(lang_get('subject'));
trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
# body cannot be blank
if (is_blank($t_email_data->body)) {
error_parameters(lang_get('body'));
trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
$t_email_table = config_get('mantis_email_table');
$c_email = $t_email_data->email;
$c_subject = $t_email_data->subject;
$c_body = $t_email_data->body;
$c_metadata = serialize($t_email_data->metadata);
$query = "INSERT INTO {$t_email_table}\r\n\t\t\t\t ( email,\r\n\t\t\t\t subject,\r\n\t\t\t\t\t body,\r\n\t\t\t\t\t submitted,\r\n\t\t\t\t\t metadata)\r\n\t\t\t\t VALUES\r\n\t\t\t\t ( '{$c_email}',\r\n\t\t\t\t '{$c_subject}',\r\n\t\t\t\t '{$c_body}',\r\n\t\t\t\t\t " . db_now() . ",\r\n\t\t\t\t\t '{$c_metadata}'\r\n\t\t\t\t\t)";
db_query($query);
return db_insert_id($t_email_table);
}
示例4: install
function install() {
$result = extension_loaded("xmlreader") && extension_loaded("xmlwriter");
if ( ! $result ) {
#\todo returning false should trigger some error reporting, needs rethinking error_api
error_parameters( plugin_lang_get( 'error_no_xml' ) );
trigger_error( ERROR_PLUGIN_INSTALL_FAILED, ERROR );
}
return $result;
}
示例5: api_token_name_ensure_unique
/**
* Ensure that the specified token name is unique to the user, otherwise,
* prompt the user with an error.
*
* @param string $p_token_name The token name.
* @param string $p_user_id The user id.
*/
function api_token_name_ensure_unique($p_token_name, $p_user_id)
{
$t_query = 'SELECT * FROM {api_token} WHERE user_id=' . db_param() . ' AND name=' . db_param();
$t_result = db_query($t_query, array($p_user_id, $p_token_name));
$t_row = db_fetch_array($t_result);
if ($t_row) {
error_parameters($p_token_name);
trigger_error(ERROR_API_TOKEN_NAME_NOT_UNIQUE, ERROR);
}
}
示例6: get
function get($p_name, $p_default = null)
{
if (isset($_SESSION[$p_name])) {
return unserialize($_SESSION[$p_name]);
}
if (func_num_args() > 1) {
return $p_default;
}
error_parameters($p_name);
trigger_error(ERROR_SESSION_VAR_NOT_FOUND, ERROR);
}
示例7: billing_get_for_project
/**
* Gets the billing information for the specified project during the specified date range.
*
* @param integer $p_project_id A project identifier or ALL_PROJECTS.
* @param string $p_from Starting date (yyyy-mm-dd) inclusive, if blank, then ignored.
* @param string $p_to Ending date (yyyy-mm-dd) inclusive, if blank, then ignored.
* @param integer $p_cost_per_hour Cost per hour.
* @return array array of bugnotes
* @access public
*/
function billing_get_for_project($p_project_id, $p_from, $p_to, $p_cost_per_hour)
{
$t_params = array();
$c_to = strtotime($p_to) + SECONDS_PER_DAY - 1;
$c_from = strtotime($p_from);
if ($c_to === false || $c_from === false) {
error_parameters(array($p_from, $p_to));
trigger_error(ERROR_GENERIC, ERROR);
}
db_param_push();
if (ALL_PROJECTS != $p_project_id) {
access_ensure_project_level(config_get('view_bug_threshold'), $p_project_id);
$t_project_where = ' AND b.project_id = ' . db_param() . ' AND bn.bug_id = b.id ';
$t_params[] = $p_project_id;
} else {
$t_project_ids = user_get_all_accessible_projects();
$t_project_where = ' AND b.project_id in (' . implode(', ', $t_project_ids) . ')';
}
if (!is_blank($c_from)) {
$t_from_where = ' AND bn.date_submitted >= ' . db_param();
$t_params[] = $c_from;
} else {
$t_from_where = '';
}
if (!is_blank($c_to)) {
$t_to_where = ' AND bn.date_submitted <= ' . db_param();
$t_params[] = $c_to;
} else {
$t_to_where = '';
}
$t_results = array();
$t_query = 'SELECT bn.id id, bn.time_tracking minutes, bn.date_submitted as date_submitted, bnt.note note,
u.realname realname, b.project_id project_id, c.name bug_category, b.summary bug_summary, bn.bug_id bug_id, bn.reporter_id reporter_id
FROM {user} u, {bugnote} bn, {bug} b, {bugnote_text} bnt, {category} c
WHERE u.id = bn.reporter_id AND bn.time_tracking != 0 AND bn.bug_id = b.id AND bnt.id = bn.bugnote_text_id AND c.id=b.category_id
' . $t_project_where . $t_from_where . $t_to_where . '
ORDER BY bn.id';
$t_result = db_query($t_query, $t_params);
$t_cost_per_min = $p_cost_per_hour / 60.0;
$t_access_level_required = config_get('time_tracking_view_threshold');
while ($t_row = db_fetch_array($t_result)) {
if (!access_has_bugnote_level($t_access_level_required, $t_row['id'])) {
continue;
}
$t_total_cost = $t_cost_per_min * $t_row['minutes'];
$t_row['cost'] = $t_total_cost;
$t_results[] = $t_row;
}
$t_billing_rows = billing_rows_to_array($t_results);
return $t_billing_rows;
}
示例8: billing_get_for_project
/**
* Gets the billing information for the specified project during the specified date range.
*
* @param integer $p_project_id A project identifier.
* @param string $p_from Starting date (yyyy-mm-dd) inclusive, if blank, then ignored.
* @param string $p_to Ending date (yyyy-mm-dd) inclusive, if blank, then ignored.
* @param integer $p_cost_per_hour Cost per hour.
* @return array array of bugnotes
* @access public
*/
function billing_get_for_project($p_project_id, $p_from, $p_to, $p_cost_per_hour)
{
$t_params = array();
$c_to = strtotime($p_to) + SECONDS_PER_DAY - 1;
$c_from = strtotime($p_from);
if ($c_to === false || $c_from === false) {
error_parameters(array($p_from, $p_to));
trigger_error(ERROR_GENERIC, ERROR);
}
if (ALL_PROJECTS != $p_project_id) {
$t_project_where = ' AND b.project_id = ' . db_param() . ' AND bn.bug_id = b.id ';
$t_params[] = $p_project_id;
} else {
$t_project_where = '';
}
if (!is_blank($c_from)) {
$t_from_where = ' AND bn.date_submitted >= ' . db_param();
$t_params[] = $c_from;
} else {
$t_from_where = '';
}
if (!is_blank($c_to)) {
$t_to_where = ' AND bn.date_submitted <= ' . db_param();
$t_params[] = $c_to;
} else {
$t_to_where = '';
}
$t_results = array();
$t_query = 'SELECT bn.id id, bn.time_tracking minutes, bn.date_submitted as date_submitted, bnt.note note,
u.realname realname, b.summary bug_summary, bn.bug_id bug_id, bn.reporter_id reporter_id
FROM {user} u, {bugnote} bn, {bug} b, {bugnote_text} bnt
WHERE u.id = bn.reporter_id AND bn.time_tracking != 0 AND bn.bug_id = b.id AND bnt.id = bn.bugnote_text_id
' . $t_project_where . $t_from_where . $t_to_where . '
ORDER BY bn.id';
$t_result = db_query($t_query, $t_params);
$t_cost_per_min = $p_cost_per_hour / 60.0;
while ($t_row = db_fetch_array($t_result)) {
$t_total_cost = $t_cost_per_min * $t_row['minutes'];
$t_row['cost'] = $t_total_cost;
$t_results[] = $t_row;
}
$t_billing_rows = billing_rows_to_array($t_results);
return $t_billing_rows;
}
示例9: plugin_TimeTracking_stats_get_project_array
/**
* Returns an array of time tracking stats
* @param int $p_project_id project id
* @param string $p_from Starting date (yyyy-mm-dd) inclusive, if blank, then ignored.
* @param string $p_to Ending date (yyyy-mm-dd) inclusive, if blank, then ignored.
* @return array array of bugnote stats
* @access public
*/
function plugin_TimeTracking_stats_get_project_array($p_project_id, $p_from, $p_to)
{
$c_project_id = db_prepare_int($p_project_id);
$c_to = "'" . date("Y-m-d", strtotime("{$p_to}") + SECONDS_PER_DAY - 1) . "'";
$c_from = "'" . $p_from . "'";
//strtotime( $p_from )
if ($c_to === false || $c_from === false) {
error_parameters(array($p_form, $p_to));
trigger_error(ERROR_GENERIC, ERROR);
}
$t_timereport_table = plugin_table('data', 'TimeTracking');
$t_bug_table = db_get_table('mantis_bug_table');
$t_user_table = db_get_table('mantis_user_table');
$t_project_table = db_get_table('mantis_project_table');
if (!is_blank($c_from)) {
$t_from_where = " AND expenditure_date >= {$c_from}";
} else {
$t_from_where = '';
}
if (!is_blank($c_to)) {
$t_to_where = " AND expenditure_date <= {$c_to}";
} else {
$t_to_where = '';
}
if (ALL_PROJECTS != $c_project_id) {
$t_project_where = " AND b.project_id = '{$c_project_id}' ";
} else {
$t_project_where = '';
}
if (!access_has_global_level(plugin_config_get('view_others_threshold'))) {
$t_user_id = auth_get_current_user_id();
$t_user_where = " AND user = '{$t_user_id}' ";
} else {
$t_user_where = '';
}
$t_results = array();
$query = "SELECT u.username, p.name as project_name, bug_id, expenditure_date, hours, timestamp, info \nFROM {$t_timereport_table} tr, {$t_bug_table} b, {$t_user_table} u, {$t_project_table} p\nWHERE tr.bug_id=b.id and tr.user=u.id AND p.id = b.project_id\n{$t_project_where} {$t_from_where} {$t_to_where} {$t_user_where}\nORDER BY user, expenditure_date, bug_id";
$result = db_query($query);
while ($row = db_fetch_array($result)) {
$t_results[] = $row;
}
return $t_results;
}
示例10: action_add_note_validate
/**
* Validates the action on the specified bug id.
*
* @returns true|array Action can be applied., ( bug_id => reason for failure )
*/
function action_add_note_validate($p_bug_id)
{
$f_bugnote_text = gpc_get_string('bugnote_text');
if (is_blank($f_bugnote_text)) {
error_parameters(lang_get('bugnote'));
trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
$t_failed_validation_ids = array();
$t_add_bugnote_threshold = config_get('add_bugnote_threshold');
$t_bug_id = $p_bug_id;
if (bug_is_readonly($t_bug_id)) {
$t_failed_validation_ids[$t_bug_id] = lang_get('actiongroup_error_issue_is_readonly');
return $t_failed_validation_ids;
}
if (!access_has_bug_level($t_add_bugnote_threshold, $t_bug_id)) {
$t_failed_validation_ids[$t_bug_id] = lang_get('access_denied');
return $t_failed_validation_ids;
}
return true;
}
示例11: antispam_check
/**
* Triggers an error if the current user is suspected to be a spammer.
* This should be run before actions like adding issues or issue notes. If the
* user is determined to demonstrate spammy behavior, this method will trigger an
* error and exit the script.
*/
function antispam_check()
{
if (OFF == config_get_global('allow_signup')) {
return;
}
if (access_get_global_level() > config_get('default_new_account_access_level')) {
return;
}
$t_antispam_max_event_count = config_get('antispam_max_event_count');
if ($t_antispam_max_event_count == 0) {
return;
}
# Make sure user has at least one more event to add before exceeding the limit, which will happen
# after this method returns.
$t_antispam_time_window_in_seconds = config_get('antispam_time_window_in_seconds');
if (history_count_user_recent_events($t_antispam_time_window_in_seconds) < $t_antispam_max_event_count) {
return;
}
error_parameters($t_antispam_max_event_count, $t_antispam_time_window_in_seconds);
trigger_error(ERROR_SPAM_SUSPECTED, ERROR);
}
示例12: news_update
function news_update($p_news_id, $p_project_id, $p_view_state, $p_announcement, $p_headline, $p_body)
{
$c_news_id = db_prepare_int($p_news_id);
$c_project_id = db_prepare_int($p_project_id);
$c_view_state = db_prepare_int($p_view_state);
$c_announcement = db_prepare_bool($p_announcement);
$c_headline = db_prepare_string($p_headline);
$c_body = db_prepare_string($p_body);
if (is_blank($c_headline)) {
error_parameters(lang_get('headline'));
trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
if (is_blank($c_body)) {
error_parameters(lang_get('body'));
trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
$t_news_table = config_get('mantis_news_table');
# Update entry
$query = "UPDATE {$t_news_table}\n\t\t\t\t SET view_state='{$c_view_state}',\n\t\t\t\t\tannouncement='{$c_announcement}',\n\t\t\t\t\theadline='{$c_headline}',\n\t\t\t\t\tbody='{$c_body}',\n\t\t\t\t\tproject_id='{$c_project_id}',\n\t\t\t\t\tlast_modified= " . db_now() . "\n\t\t\t\t WHERE id='{$c_news_id}'";
db_query($query);
# db_query() errors on failure so:
return true;
}
示例13: gpc_get_string
}
}
$f_filter_target = gpc_get_string('filter_target');
$t_function_name = 'print_filter_' . utf8_substr($f_filter_target, 0, -7);
if (function_exists($t_function_name)) {
return_dynamic_filters_prepend_headers();
call_user_func($t_function_name);
} else {
if ('custom_field' == utf8_substr($f_filter_target, 0, 12)) {
# custom function
$t_custom_id = utf8_substr($f_filter_target, 13, -7);
return_dynamic_filters_prepend_headers();
print_filter_custom_field($t_custom_id);
} else {
$t_plugin_filters = filter_get_plugin_filters();
$t_found = false;
foreach ($t_plugin_filters as $t_field_name => $t_filter_object) {
if ($t_field_name . '_filter' == $f_filter_target) {
return_dynamic_filters_prepend_headers();
print_filter_plugin_field($t_field_name, $t_filter_object);
$t_found = true;
break;
}
}
if (!$t_found) {
# error - no function to populate the target (e.g., print_filter_foo)
error_parameters($f_filter_target);
trigger_error(ERROR_FILTER_NOT_FOUND, ERROR);
}
}
}
示例14: save
/**
* Create or update repository data.
* Creates database row if $this->id is zero, updates an existing row otherwise.
*/
function save()
{
if (is_blank($this->type) || is_blank($this->name)) {
if (is_blank($this->type)) {
error_parameters(plugin_lang_get('type'));
} else {
error_parameters(plugin_lang_get('name'));
}
trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
$t_repo_table = plugin_table('repository', 'Source');
if (0 == $this->id) {
# create
$t_query = "INSERT INTO {$t_repo_table} ( type, name, url, info ) VALUES ( " . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ' )';
db_query_bound($t_query, array($this->type, $this->name, $this->url, serialize($this->info)));
$this->id = db_insert_id($t_repo_table);
} else {
# update
$t_query = "UPDATE {$t_repo_table} SET type=" . db_param() . ', name=' . db_param() . ', url=' . db_param() . ', info=' . db_param() . ' WHERE id=' . db_param();
db_query_bound($t_query, array($this->type, $this->name, $this->url, serialize($this->info), $this->id));
}
foreach ($this->mappings as $t_mapping) {
$t_mapping->save();
}
}
示例15: process
//.........这里部分代码省略.........
$t_custom_fields[++$i] = new stdClass();
}
switch ($reader->localName) {
default:
$field = $reader->localName;
$reader->read();
$t_custom_fields[$i]->{$field} = $reader->value;
}
}
}
break;
case 'bugnotes':
// store bug notes
$i = -1;
$depth_bn = $reader->depth;
while ($reader->read() && ($reader->depth > $depth_bn || $reader->nodeType != XMLReader::END_ELEMENT)) {
if ($reader->nodeType == XMLReader::ELEMENT) {
if ($reader->localName == 'bugnote') {
$t_bugnotes[++$i] = new stdClass();
}
switch ($reader->localName) {
case 'reporter':
$t_old_id = $reader->getAttribute('id');
$reader->read();
$t_bugnotes[$i]->reporter_id = $this->get_user_id($reader->value, $userId);
break;
case 'view_state':
$t_old_id = $reader->getAttribute('id');
$reader->read();
$t_bugnotes[$i]->private = $reader->value == VS_PRIVATE ? true : false;
break;
default:
$field = $reader->localName;
$reader->read();
$t_bugnotes[$i]->{$field} = $reader->value;
}
}
}
break;
case 'attachments':
// store attachments
$i = -1;
$depth_att = $reader->depth;
while ($reader->read() && ($reader->depth > $depth_att || $reader->nodeType != XMLReader::END_ELEMENT)) {
if ($reader->nodeType == XMLReader::ELEMENT) {
if ($reader->localName == 'attachment') {
$t_attachments[++$i] = new stdClass();
}
switch ($reader->localName) {
default:
$field = $reader->localName;
$reader->read();
$t_attachments[$i]->{$field} = $reader->value;
}
}
}
break;
default:
$field = $reader->localName;
//echo "using default handler for field: $field\n";
$reader->read();
$this->newbug_->{$field} = $reader->value;
}
}
}
// now save the new bug
$this->new_id_ = $this->newbug_->create();
// add custom fields
if ($this->new_id_ > 0 && is_array($t_custom_fields) && count($t_custom_fields) > 0) {
foreach ($t_custom_fields as $t_custom_field) {
$t_custom_field_id = custom_field_get_id_from_name($t_custom_field->name);
if (custom_field_ensure_exists($t_custom_field_id) && custom_field_is_linked($t_custom_field_id, $t_project_id)) {
custom_field_set_value($t_custom_field->id, $this->new_id_, $t_custom_field->value);
} else {
error_parameters($t_custom_field->name, $t_custom_field_id);
trigger_error(ERROR_CUSTOM_FIELD_NOT_LINKED_TO_PROJECT, ERROR);
}
}
}
// add bugnotes
if ($this->new_id_ > 0 && is_array($t_bugnotes) && count($t_bugnotes) > 0) {
foreach ($t_bugnotes as $t_bugnote) {
bugnote_add($this->new_id_, $t_bugnote->note, $t_bugnote->time_tracking, $t_bugnote->private, $t_bugnote->note_type, $t_bugnote->note_attr, $t_bugnote->reporter_id, false, $t_bugnote->date_submitted, $t_bugnote->last_modified, true);
}
}
// add attachments
if ($this->new_id_ > 0 && is_array($t_attachments) && count($t_attachments) > 0) {
foreach ($t_attachments as $t_attachment) {
// Create a temporary file in the temporary files directory using sys_get_temp_dir()
$temp_file_name = tempnam(sys_get_temp_dir(), 'MantisImport');
file_put_contents($temp_file_name, base64_decode($t_attachment->content));
$file_data = array('name' => $t_attachment->filename, 'type' => $t_attachment->file_type, 'tmp_name' => $temp_file_name, 'size' => filesize($temp_file_name), 'error' => UPLOAD_ERR_OK);
// unfortunately we have no clue who has added the attachment (this could only be fetched from history -> feel free to implement this)
// also I have no clue where description should come from...
file_add($this->new_id_, $file_data, 'bug', $t_attachment->title, $p_desc = '', $p_user_id = null, $t_attachment->date_added, true);
unlink($temp_file_name);
}
}
//echo "\nnew bug: $this->new_id_\n";
}