本文整理汇总了PHP中db_get_table函数的典型用法代码示例。如果您正苦于以下问题:PHP db_get_table函数的具体用法?PHP db_get_table怎么用?PHP db_get_table使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_get_table函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: profile_create
/**
* Create a new profile for the user, return the ID of the new profile
* @param integer $p_user_id A valid user identifier.
* @param string $p_platform Value for profile platform.
* @param string $p_os Value for profile operating system.
* @param string $p_os_build Value for profile operation system build.
* @param string $p_description Description of profile.
* @return integer
*/
function profile_create($p_user_id, $p_platform, $p_os, $p_os_build, $p_description)
{
$p_user_id = (int) $p_user_id;
if (ALL_USERS != $p_user_id) {
user_ensure_unprotected($p_user_id);
}
# platform cannot be blank
if (is_blank($p_platform)) {
error_parameters(lang_get('platform'));
trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
# os cannot be blank
if (is_blank($p_os)) {
error_parameters(lang_get('os'));
trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
# os_build cannot be blank
if (is_blank($p_os_build)) {
error_parameters(lang_get('version'));
trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
# Add profile
db_param_push();
$t_query = 'INSERT INTO {user_profile}
( user_id, platform, os, os_build, description )
VALUES
( ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ' )';
db_query($t_query, array($p_user_id, $p_platform, $p_os, $p_os_build, $p_description));
return db_insert_id(db_get_table('user_profile'));
}
示例2: news_create
/**
* Add a news item
*
* @param integer $p_project_id A project identifier.
* @param integer $p_poster_id The user id of poster.
* @param integer $p_view_state View state.
* @param boolean $p_announcement Whether article is an announcement.
* @param string $p_headline News Headline.
* @param string $p_body News Body.
* @return integer news article id
*/
function news_create($p_project_id, $p_poster_id, $p_view_state, $p_announcement, $p_headline, $p_body)
{
if (is_blank($p_headline)) {
error_parameters(lang_get('headline'));
trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
if (is_blank($p_body)) {
error_parameters(lang_get('body'));
trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
db_param_push();
$t_query = 'INSERT INTO {news}
( project_id, poster_id, date_posted, last_modified,
view_state, announcement, headline, body )
VALUES
( ' . db_param() . ',
' . db_param() . ',
' . db_param() . ',
' . db_param() . ',
' . db_param() . ',
' . db_param() . ',
' . db_param() . ',
' . db_param() . '
)';
db_query($t_query, array((int) $p_project_id, (int) $p_poster_id, db_now(), db_now(), (int) $p_view_state, $p_announcement, $p_headline, $p_body));
$t_news_id = db_insert_id(db_get_table('news'));
return $t_news_id;
}
示例3: renderIssues
function renderIssues($status)
{
$content = array();
$t_bug_table = db_get_table('mantis_bug_table');
$t_user_id = auth_get_current_user_id();
$specific_where = helper_project_specific_where($this->project_id, $t_user_id);
if ($this->severity) {
$severityCond = '= ' . $this->severity;
} else {
$severityCond = '> -1';
}
if ($this->version) {
$versionCon = '= ' . $this->version;
} else {
$versionCon = '> -1';
}
$query = "SELECT *\n\t\t\tFROM {$t_bug_table}\n\t\t\tWHERE {$specific_where}\n\t\t\tAND status = {$status}\n\t\t\tAND severity {$severityCond}\n AND version {$versionCon}\n\t\t\tORDER BY last_updated DESC\n\t\t\tLIMIT 20";
$result = db_query_bound($query);
$category_count = db_num_rows($result);
for ($i = 0; $i < $category_count; $i++) {
$row = db_fetch_array($result);
$content[] = '<div class="portlet ui-helper-clearfix" id="' . $row['id'] . '">
<div class="portlet-header">' . icon_get_status_icon($row['priority']) . ' ' . string_get_bug_view_link($row['id']) . ': ' . $row['summary'] . '</div>
<div class="portlet-content">' . ($row['handler_id'] ? '<strong>Assigned:</strong> ' . user_get_name($row['handler_id']) . BR : '') . '</div></div>';
}
if ($row) {
//pre_var_dump(array_keys($row));
}
return $content;
}
示例4: get_bug_id_from_artas_id
function get_bug_id_from_artas_id($t_artas_id)
{
# ATR or ACP
if (substr($t_artas_id, 0, 3) == "ATR") {
$t_cstm_field = 55;
$t_artas_id = str_replace("ATR", "", $t_artas_id);
} else {
if (substr($t_artas_id, 0, 3) == "ACP") {
$t_cstm_field = 56;
$t_artas_id = str_replace("ACP", "", $t_artas_id);
} else {
return "null";
}
}
list($t_artas_id_number, $t_version) = split("-", $t_artas_id);
$t_version = str_replace("_", " ", $t_version);
$t_custom_table = db_get_table('mantis_custom_field_string_table');
$t_bug_table = db_get_table('mantis_bug_table');
$query = 'SELECT bug_id FROM ' . $t_custom_table . ',' . $t_bug_table . ' WHERE ' . $t_custom_table . '.bug_id = ' . $t_bug_table . '.id and field_id = ' . $t_cstm_field . ' AND value = ' . $t_artas_id_number . ' and version = "' . $t_version . '"';
$result = db_query_bound($query, null);
$rows = array();
$i = 0;
while ($row = db_fetch_array($result)) {
$rows[] = $row['bug_id'];
$i++;
}
if ($i == 1) {
return $rows[0];
} else {
return "null";
}
}
示例5: getUserStorySprintHistory
function getUserStorySprintHistory($bug_id)
{
$t_mantis_bug_history_table = db_get_table('mantis_bug_history_table');
$t_sql = "SELECT date_modified \n\t\t\t\t\tFROM {$t_mantis_bug_history_table} \n\t\t\t\t\tWHERE bug_id = " . db_param(0) . " \n\t\t\t\t\tAND field_name = 'Sprint' \n\t\t\t\t\tORDER BY date_modified DESC";
$t_params = array($bug_id);
$sprint = $this->executeQuery($t_sql, $t_params);
return $sprint[0]['date_modified'];
}
示例6: get_mantis_plugin_table
/**
* @param $table
* @return string
*/
private function get_mantis_plugin_table($table)
{
if ($this->get_mantis_version() == '1.2.') {
$mantis_plugin_table = plugin_table($table, 'SpecManagement');
} else {
$mantis_plugin_table = db_get_table('plugin_SpecManagement_' . $table);
}
return $mantis_plugin_table;
}
开发者ID:Cre-ator,项目名称:Whiteboard.SpecificationManagement-Plugin,代码行数:13,代码来源:specmanagement_database_api.php
示例7: get_mantis_table
/**
* Gets a specific mantis database table
*
* @param $table
* @return string
*/
private function get_mantis_table($table)
{
if ($this->get_mantis_version() == '1.2.') {
$mantis_table = db_get_table('mantis_' . $table . '_table');
} else {
$mantis_table = db_get_table($table);
}
return $mantis_table;
}
示例8: getNumberOfUserStories
function getNumberOfUserStories($project_id, $version)
{
$t_mantis_custom_field_string_table = db_get_table('mantis_custom_field_string_table');
$t_mantis_bug_table = db_get_table('mantis_bug_table');
$this->getAdditionalProjectFields();
$t_sql = "SELECT count(*) AS userstories \n\t\t\t\t\tFROM {$t_mantis_bug_table} \n\t\t\t\t\tINNER JOIN {$t_mantis_custom_field_string_table} ON id = bug_id \n\t\t\t\t\tWHERE project_id=" . db_param(0) . " \n\t\t\t\t\tAND target_version = " . db_param(1) . " \n\t\t\t\t\tAND status < 80 \n\t\t\t\t\tAND field_id=" . db_param(2) . " \n\t\t\t\t\tAND value != ''" . " \n\t\t\t\t\tGROUP BY field_id";
$t_params = array($project_id, $version, $this->pb);
$total = $this->executeQuery($t_sql, $t_params);
return 0 + $total[0]['userstories'];
}
示例9: profile_exists
function profile_exists($p_platform, $p_os, $p_os_build)
{
$t_user_profile_table = db_get_table('mantis_user_profile_table');
$query_where = 'platform = ' . db_param() . ' and os = ' . db_param() . ' and os_build = ' . db_param();
$query = "SELECT *\n\t\t\t\t FROM {$t_user_profile_table}\n\t\t\t\t WHERE {$query_where}\n\t\t\t\t ORDER BY platform, os, os_build LIMIT 0,1";
$result = db_query_bound($query, array($p_platform, $p_os, $p_os_build));
$result = db_fetch_array($result);
if ($result === false) {
return false;
}
return $result['id'];
}
示例10: 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;
}
示例11: update_bug_summary_by_version
function update_bug_summary_by_version($t_version, $map_file)
{
$db_table = db_get_table('mantis_bug_table');
$query = "SELECT `id`, `summary`, `project_id` FROM {$db_table} WHERE `version` = '" . mysql_real_escape_string($t_version) . "'";
$result = db_query_bound($query);
$rows = array();
while (true) {
$row = db_fetch_array($result);
if ($row == false) {
break;
}
$rows[] = $row;
}
if (count($rows) === 0) {
return;
}
require_once "ProjectAcraExt.php";
$app_packages = get_project_package_list($rows[0]['project_id']);
foreach ($rows as $row) {
$bug_id = $row['id'];
$stacktrace = bug_get_text_field($bug_id, 'description');
$info = get_stack_map($stacktrace);
$exception = $info->exception;
$method = "";
$suffix = "";
$size = count($info->stack);
if ($size > 0) {
foreach ($info->stack as $entry) {
$func = $entry->method;
foreach ($app_packages as $pack => $len) {
if (strncmp($func, $pack, $len) === 0) {
$method = $entry->method;
$suffix = $entry->suffix;
break;
}
}
if (strlen($method) > 0) {
break;
}
}
}
if (strlen($exception) > 0) {
$line = build_summary_text($exception, $method . $suffix);
} else {
$line = 'Acra report crash ' . $method . $suffix;
}
$line = mysql_real_escape_string($line);
$query = "UPDATE `{$db_table}` SET `summary` = '{$line}' WHERE `id` = {$bug_id}; ";
db_query_bound($query);
}
}
示例12: get_username
/**
* Get username.
*/
function get_username($user_id)
{
$user_table = db_get_table('mantis_user_table');
$query_rep_user_name = "SELECT realname, username FROM {$user_table} WHERE id = {$user_id};";
$res_rep_user_name = db_query($query_rep_user_name);
while ($row_rep_user_name = db_fetch_array($res_rep_user_name)) {
if ($row_rep_user_name['realname'] == '') {
$user_name = $row_rep_user_name['username'];
} else {
$user_name = $row_rep_user_name['realname'];
}
}
return $user_name;
}
示例13: 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;
}
示例14: bug_revision_add
/**
* Add a new revision to a bug history.
* @param integer $p_bug_id A bug identifier.
* @param integer $p_user_id User ID.
* @param integer $p_type Revision Type.
* @param string $p_value Value.
* @param integer $p_bugnote_id A Bugnote ID.
* @param integer $p_timestamp Integer Timestamp.
* @return int Revision ID
*/
function bug_revision_add($p_bug_id, $p_user_id, $p_type, $p_value, $p_bugnote_id = 0, $p_timestamp = null)
{
if ($p_type <= REV_ANY) {
return null;
}
$t_last = bug_revision_last($p_bug_id, $p_type);
# Don't save a revision twice if nothing has changed
if (!is_null($t_last) && $p_value == $t_last['value']) {
return $t_last['id'];
}
if ($p_timestamp === null) {
$t_timestamp = db_now();
} else {
$t_timestamp = $p_timestamp;
}
$t_query = 'INSERT INTO {bug_revision} (
bug_id, bugnote_id, user_id,
timestamp, type, value
) VALUES ( ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ' )';
db_query($t_query, array($p_bug_id, $p_bugnote_id, $p_user_id, $t_timestamp, $p_type, $p_value));
return db_insert_id(db_get_table('bug_revision'));
}
示例15: print_users_in_group_option_list
function print_users_in_group_option_list($usergroup_id)
{
if (plugin_config_get('assign_to_groups', '') == 1 && plugin_config_get('assign_group_threshold', '') <= user_get_access_level(auth_get_current_user_id())) {
$show_groups = 1;
} else {
$show_groups = 0;
}
$t_table_users = plugin_table('users');
$t_user_table = db_get_table('mantis_user_table');
$query = "SELECT * FROM (";
$query .= " SELECT u.id, u.username, u.realname, ug.group_user_id";
$query .= " FROM {$t_user_table} AS u";
$query .= " LEFT JOIN {$t_table_users} AS ug ON (u.id=ug.user)";
//if( plugin_config_get('assign_to_groups', '') == 0 || plugin_config_get('assign_group_threshold','') > user_get_access_level( auth_get_current_user_id() ) )
if ($show_groups == 0) {
$query .= " WHERE u.username NOT LIKE " . db_param();
}
$query .= ") AS t1 WHERE group_user_id=" . db_param() . " OR group_user_id IS NULL ORDER BY username ASC";
if ($show_groups == 0) {
$result = db_query_bound($query, array(plugin_config_get('group_prefix') . '%', (int) $usergroup_id));
} else {
$result = db_query_bound($query, array((int) $usergroup_id));
}
$count = db_num_rows($result);
for ($i = 0; $i < $count; $i++) {
$row = db_fetch_array($result);
if ($row['id'] == $usergroup_id) {
continue;
//usergroup must not be nested with itself
}
echo '<option value="' . $row['id'] . '" ';
if (!is_null($row['group_user_id'])) {
echo 'selected="selected"';
} else {
echo '';
}
echo '>' . $row['username'] . '</option>';
}
}