本文整理汇总了PHP中db_prepare_int函数的典型用法代码示例。如果您正苦于以下问题:PHP db_prepare_int函数的具体用法?PHP db_prepare_int怎么用?PHP db_prepare_int使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_prepare_int函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: twitter_issue_resolved
/**
* Posts a twitter update when a bug is resolved.
*
* @param $p_bug_id The bug id that was resolved.
* @access public
*/
function twitter_issue_resolved($p_bug_id)
{
if (!twitter_enabled()) {
return true;
}
$t_bug = bug_get($p_bug_id, false);
# Do not twitter except fixed issues
if ($t_bug->resolution < config_get('bug_resolution_fixed_threshold') || $t_bug->resolution >= config_get('bug_resolution_not_fixed_threshold')) {
return true;
}
# Do not twitter private bugs.
if ($t_bug->view_state != VS_PUBLIC) {
return true;
}
# Do not twitter bugs belonging to private projects.
if (VS_PRIVATE == project_get_field($t_bug->project_id, 'view_state')) {
return true;
}
$c_bug_id = db_prepare_int($p_bug_id);
if (is_blank($t_bug->fixed_in_version)) {
$t_message = sprintf(lang_get('twitter_resolved_no_version'), $c_bug_id, category_full_name($t_bug->category_id, false), $t_bug->summary, user_get_name($t_bug->handler_id));
} else {
$t_message = sprintf(lang_get('twitter_resolved'), $c_bug_id, category_full_name($t_bug->category_id, false), $t_bug->summary, user_get_name($t_bug->handler_id), $t_bug->fixed_in_version);
}
return twitter_update($t_message);
}
示例2: wiki_xwiki_get_page_id_for_issue
function wiki_xwiki_get_page_id_for_issue($p_issue_id)
{
$t_project_id = project_get_name(bug_get_field($p_issue_id, 'project_id'));
$c_issue_id = db_prepare_int($p_issue_id);
return $c_issue_id;
return $t_project_id . '/' . $c_issue_id;
}
示例3: project_hierarchy_remove_all
function project_hierarchy_remove_all($p_project_id)
{
$t_project_hierarchy_table = config_get('mantis_project_hierarchy_table');
$c_project_id = db_prepare_int($p_project_id);
$query = "DELETE FROM {$t_project_hierarchy_table}\n\t\t WHERE child_id = {$c_project_id}\n\t\t\t\t\t\t OR parent_id = {$c_project_id}";
db_query($query);
}
示例4: project_hierarchy_remove_all
/**
* Remove any project hierarchy entries relating to project_id
* @param int $p_project_id Project ID
* @return null
*/
function project_hierarchy_remove_all($p_project_id)
{
$t_project_hierarchy_table = db_get_table('mantis_project_hierarchy_table');
$c_project_id = db_prepare_int($p_project_id);
$query = "DELETE FROM {$t_project_hierarchy_table}\n\t\t WHERE child_id = " . db_param() . "\n\t\t\t\t\t\t OR parent_id = " . db_param();
db_query_bound($query, array($c_project_id, $c_project_id));
}
示例5: wiki_dokuwiki_get_page_id_for_issue
function wiki_dokuwiki_get_page_id_for_issue($p_issue_id)
{
$c_issue_id = db_prepare_int($p_issue_id);
$t_project_id = bug_get_field($p_issue_id, 'project_id');
$t_project_name = project_get_name($t_project_id);
# create a namespace for the project to contain all project documentation.
# create within it a namespace for issues. This is to allow the creation of a _template.txt
# file to act as the template for issues belonging to this project.
return $t_project_name . ':issue:' . $c_issue_id;
}
示例6: bug_get_attachments
function bug_get_attachments($p_bug_id)
{
$c_bug_id = db_prepare_int($p_bug_id);
$t_bug_file_table = db_get_table('mantis_bug_file_table');
$query = "SELECT id, title, diskfile, filename, filesize, file_type, date_added, user_id\n FROM {$t_bug_file_table}\n WHERE bug_id=" . db_param() . "\n ORDER BY date_added";
$db_result = db_query_bound($query, array($c_bug_id));
$num_files = db_num_rows($db_result);
$t_result = array();
for ($i = 0; $i < $num_files; $i++) {
$t_result[] = db_fetch_array($db_result);
}
return $t_result;
}
示例7: last_visited_issue
/**
* This method should be called from view, update, print pages for issues,
* mantisconnect.
*
* @param issue_id The issue id that was justed visited.
* @param user_id The user id that visited the issue, or null for current
* logged in user.
* @access public
*/
function last_visited_issue($p_issue_id, $p_user_id = null)
{
if (!last_visited_enabled()) {
return;
}
$c_issue_id = db_prepare_int($p_issue_id);
$t_value = token_get_value(TOKEN_LAST_VISITED, $p_user_id);
if (is_null($t_value)) {
$t_value = $c_issue_id;
} else {
$t_ids = explode(',', $p_issue_id . ',' . $t_value);
$t_ids = array_unique($t_ids);
$t_ids = array_slice($t_ids, 0, config_get('recently_visited_count'));
$t_value = implode(',', $t_ids);
}
token_set(TOKEN_LAST_VISITED, $t_value, TOKEN_EXPIRY_LAST_VISITED, $p_user_id);
}
示例8: link_note_action
function link_note_action($p_note_id, $p_action, $p_url, $p_link_active = true, $p_caption = null)
{
if (null === $p_caption) {
$t_caption = lang_get('action_' . $p_action);
$t_before = '[ ';
$t_after = ' ]';
} else {
$t_caption = $p_caption;
$t_before = $t_after = '';
}
$c_note_id = db_prepare_int($p_note_id);
$c_action = urlencode($p_action);
# $c_url = urlencode( $p_url );
$t_action = config_get('web_directory') . 'action.php';
$t_link = "{$t_action}?f_action={$c_action}&f_note_id={$c_note_id}";
# &f_url=$c_url";
return link_create($t_link, $t_caption, $p_link_active, $t_before, $t_after);
}
示例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: access_cache_matrix_user
function access_cache_matrix_user($p_user_id)
{
global $g_cache_access_matrix, $g_cache_access_matrix_user_ids;
$c_user_id = db_prepare_int($p_user_id);
if (!in_array((int) $p_user_id, $g_cache_access_matrix_user_ids)) {
$t_project_user_list_table = config_get('mantis_project_user_list_table');
$query = "SELECT project_id, access_level\n\t\t\t\t\t FROM {$t_project_user_list_table}\n\t\t\t\t\t WHERE user_id='{$c_user_id}'";
$result = db_query($query);
$count = db_num_rows($result);
# make sure we always have an array to return
$g_cache_access_matrix[(int) $p_user_id] = array();
for ($i = 0; $i < $count; $i++) {
$row = db_fetch_array($result);
$g_cache_access_matrix[(int) $p_user_id][(int) $row['project_id']] = (int) $row['access_level'];
}
$g_cache_access_matrix_user_ids[] = (int) $p_user_id;
}
return $g_cache_access_matrix[(int) $p_user_id];
}
示例11: bugnote_stats_get_project_array
/**
* Returns an array of bugnote 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.
* @param int $p_cost cost
* @return array array of bugnote stats
* @access public
*/
function bugnote_stats_get_project_array($p_project_id, $p_from, $p_to, $p_cost)
{
$c_project_id = db_prepare_int($p_project_id);
$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);
}
$c_cost = db_prepare_double($p_cost);
$t_bug_table = db_get_table('mantis_bug_table');
$t_user_table = db_get_table('mantis_user_table');
$t_bugnote_table = db_get_table('mantis_bugnote_table');
if (!is_blank($c_from)) {
$t_from_where = " AND bn.date_submitted >= {$c_from}";
} else {
$t_from_where = '';
}
if (!is_blank($c_to)) {
$t_to_where = " AND bn.date_submitted <= {$c_to}";
} else {
$t_to_where = '';
}
if (ALL_PROJECTS != $c_project_id) {
$t_project_where = " AND b.project_id = '{$c_project_id}' AND bn.bug_id = b.id ";
} else {
$t_project_where = '';
}
$t_results = array();
$query = "SELECT username, realname, summary, bn.bug_id, SUM(time_tracking) AS sum_time_tracking\n\t\t\tFROM {$t_user_table} u, {$t_bugnote_table} bn, {$t_bug_table} b\n\t\t\tWHERE u.id = bn.reporter_id AND bn.time_tracking != 0 AND bn.bug_id = b.id\n\t\t\t{$t_project_where} {$t_from_where} {$t_to_where}\n\t\t\tGROUP BY bn.bug_id, u.username, u.realname, b.summary\n\t\t\tORDER BY bn.bug_id";
$result = db_query($query);
$t_cost_min = $c_cost / 60;
while ($row = db_fetch_array($result)) {
$t_total_cost = $t_cost_min * $row['sum_time_tracking'];
$row['cost'] = $t_total_cost;
$t_results[] = $row;
}
return $t_results;
}
示例12: news_get_limited_rows
function news_get_limited_rows($p_offset, $p_project_id = null)
{
if ($p_project_id === null) {
$p_project_id = helper_get_current_project();
}
$c_offset = db_prepare_int($p_offset);
$t_projects = current_user_get_all_accessible_subprojects($p_project_id);
$t_projects[] = (int) $p_project_id;
if (ALL_PROJECTS != $p_project_id) {
$t_projects[] = ALL_PROJECTS;
}
$t_news_table = db_get_table('mantis_news_table');
$t_news_view_limit = config_get('news_view_limit');
$t_news_view_limit_days = config_get('news_view_limit_days') * SECONDS_PER_DAY;
switch (config_get('news_limit_method')) {
case 0:
# BY_LIMIT - Select the news posts
$query = "SELECT *\n\t\t\t\t\t\tFROM {$t_news_table}";
if (1 == count($t_projects)) {
$c_project_id = $t_projects[0];
$query .= " WHERE project_id='{$c_project_id}'";
} else {
$query .= ' WHERE project_id IN (' . join($t_projects, ',') . ')';
}
$query .= ' ORDER BY announcement DESC, id DESC';
$result = db_query($query, $t_news_view_limit, $c_offset);
break;
case 1:
# BY_DATE - Select the news posts
$query = "SELECT *\n\t\t\t\t\t\tFROM {$t_news_table} WHERE\n\t\t\t\t\t\t( " . db_helper_compare_days(0, 'date_posted', "< {$t_news_view_limit_days}") . "\n\t\t\t\t\t\t OR announcement = " . db_param() . " ) ";
$t_params = array(db_now(), 1);
if (1 == count($t_projects)) {
$c_project_id = $t_projects[0];
$query .= " AND project_id=" . db_param();
$t_params[] = $c_project_id;
} else {
$query .= ' AND project_id IN (' . join($t_projects, ',') . ')';
}
$query .= " ORDER BY announcement DESC, id DESC";
$result = db_query_bound($query, $t_params, $t_news_view_limit, $c_offset);
break;
}
# end switch
$t_row_count = db_num_rows($result);
$t_rows = array();
for ($i = 0; $i < $t_row_count; $i++) {
$row = db_fetch_array($result);
array_push($t_rows, $row);
}
return $t_rows;
}
示例13: email_queue_delete
function email_queue_delete($p_email_id)
{
$c_email_id = db_prepare_int($p_email_id);
$t_email_table = config_get('mantis_email_table');
$query = "DELETE FROM {$t_email_table}\r\n\t\t\t\t WHERE email_id='{$c_email_id}'";
db_query($query);
}
示例14: user_set_password
function user_set_password($p_user_id, $p_password, $p_allow_protected = false)
{
if (!$p_allow_protected) {
user_ensure_unprotected($p_user_id);
}
$t_email = user_get_field($p_user_id, 'email');
$t_username = user_get_field($p_user_id, 'username');
# When the password is changed, invalidate the cookie to expire sessions that
# may be active on all browsers.
$t_seed = $t_email . $t_username;
$c_cookie_string = db_prepare_string(auth_generate_unique_cookie_string($t_seed));
$c_user_id = db_prepare_int($p_user_id);
$c_password = db_prepare_string(auth_process_plain_password($p_password));
$c_user_table = config_get('mantis_user_table');
$query = "UPDATE {$c_user_table}\n\t\t\t\t SET password='{$c_password}',\n\t\t\t\t cookie_string='{$c_cookie_string}'\n\t\t\t\t WHERE id='{$c_user_id}'";
db_query($query);
#db_query() errors on failure so:
return true;
}
示例15: edit_printing_prefs
/**
* Edit Printing preferences
* @param int $p_user_id user id
* @param bool $p_error_if_protected error if account protected
* @param string $p_redirect_url redirect url
*/
function edit_printing_prefs($p_user_id = null, $p_error_if_protected = true, $p_redirect_url = '')
{
if (null === $p_user_id) {
$p_user_id = auth_get_current_user_id();
}
$c_user_id = db_prepare_int($p_user_id);
# protected account check
if ($p_error_if_protected) {
user_ensure_unprotected($p_user_id);
}
$t_user_print_pref_table = db_get_table('user_print_pref');
if (is_blank($p_redirect_url)) {
$p_redirect_url = 'print_all_bug_page.php';
}
# get the fields list
$t_field_name_arr = get_field_names();
$field_name_count = count($t_field_name_arr);
# Grab the data
$query = "SELECT print_pref\n\t\t\tFROM {$t_user_print_pref_table}\n\t\t\tWHERE user_id=" . db_param();
$result = db_query_bound($query, array($c_user_id));
## OOPS, No entry in the database yet. Lets make one
if (0 == db_num_rows($result)) {
# create a default array, same size than $t_field_name
for ($i = 0; $i < $field_name_count; $i++) {
$t_default_arr[$i] = 1;
}
$t_default = implode('', $t_default_arr);
# all fields are added by default
$query = "INSERT\n\t\t\t\tINTO {$t_user_print_pref_table}\n\t\t\t\t(user_id, print_pref)\n\t\t\t\tVALUES\n\t\t\t\t(" . db_param() . "," . db_param() . ")";
$result = db_query_bound($query, array($c_user_id, $t_default));
# Rerun select query
$query = "SELECT print_pref\n\t\t\t\tFROM {$t_user_print_pref_table}\n\t\t\t\tWHERE user_id=" . db_param();
$result = db_query_bound($query, array($c_user_id));
}
# putting the query result into an array with the same size as $t_fields_arr
$row = db_fetch_array($result);
$t_prefs = $row['print_pref'];
# Account Preferences Form BEGIN
$t_index_count = 0;
?>
<br />
<div>
<form method="post" action="print_all_bug_options_update.php">
<?php
echo form_security_field('print_all_bug_options_update');
?>
<input type="hidden" name="user_id" value="<?php
echo $p_user_id;
?>
" />
<input type="hidden" name="redirect_url" value="<?php
echo string_attribute($p_redirect_url);
?>
" />
<table class="width75" cellspacing="1">
<tr>
<td class="form-title">
<?php
echo lang_get('printing_preferences_title');
?>
</td>
<td class="right">
</td>
</tr>
<?php
# display the checkboxes
for ($i = 0; $i < $field_name_count; $i++) {
echo '<tr>';
?>
<th class="category">
<?php
echo lang_get($t_field_name_arr[$i]);
?>
</th>
<td>
<input type="checkbox" name="<?php
echo 'print_' . $t_field_name_arr[$i];
?>
"
<?php
if (isset($t_prefs[$i]) && $t_prefs[$i] == 1) {
echo 'checked="checked"';
}
?>
/>
</td>
</tr>
<?php
}
?>
//.........这里部分代码省略.........