当前位置: 首页>>代码示例>>PHP>>正文


PHP db_param_push函数代码示例

本文整理汇总了PHP中db_param_push函数的典型用法代码示例。如果您正苦于以下问题:PHP db_param_push函数的具体用法?PHP db_param_push怎么用?PHP db_param_push使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了db_param_push函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
}
开发者ID:spring,项目名称:spring-website,代码行数:61,代码来源:billing_api.php

示例2: api_token_revoke

/**
 * Revokes the api token with the specified id
 * @param integer $p_api_token_id The API token id.
 * @param integer $p_user_id The user id.
 * @return void
 * @access public
 */
function api_token_revoke($p_api_token_id, $p_user_id)
{
    db_param_push();
    $t_query = 'DELETE FROM {api_token} WHERE id=' . db_param() . ' AND user_id = ' . db_param();
    db_query($t_query, array($p_api_token_id, $p_user_id));
}
开发者ID:spring,项目名称:spring-website,代码行数:13,代码来源:api_token_api.php

示例3: custom_field_get_linked_ids

/**
 * Return an array of ids of custom fields bound to the specified project
 *
 * The ids will be sorted based on the sequence number associated with the binding
 * @param integer $p_project_id A project identifier.
 * @return array
 * @access public
 */
function custom_field_get_linked_ids($p_project_id = ALL_PROJECTS)
{
    global $g_cache_cf_linked;
    if (!isset($g_cache_cf_linked[$p_project_id])) {
        db_param_push();
        if (ALL_PROJECTS == $p_project_id) {
            $t_user_id = auth_get_current_user_id();
            # Select only the ids of custom fields in projects the user has access to
            #  - all custom fields in public projects,
            #  - those in private projects where the user is listed
            #  - in private projects where the user is implicitly listed
            $t_query = 'SELECT DISTINCT cft.id
				FROM {custom_field} cft
					JOIN {custom_field_project} cfpt ON cfpt.field_id = cft.id
					JOIN {project} pt
						ON pt.id = cfpt.project_id AND pt.enabled = ' . db_prepare_bool(true) . '
					LEFT JOIN {project_user_list} pult
						ON pult.project_id = cfpt.project_id AND pult.user_id = ' . db_param() . '
					, {user} ut
				WHERE ut.id = ' . db_param() . '
					AND (  pt.view_state = ' . VS_PUBLIC . '
						OR pult.user_id = ut.id
						';
            $t_params = array($t_user_id, $t_user_id);
            # Add private access clause and related parameter
            $t_private_access = config_get('private_project_threshold');
            if (is_array($t_private_access)) {
                if (1 == count($t_private_access)) {
                    $t_access_clause = '= ' . db_param();
                    $t_params[] = array_shift($t_private_access);
                } else {
                    $t_access_clause = 'IN (';
                    foreach ($t_private_access as $t_elem) {
                        $t_access_clause .= db_param() . ',';
                        $t_params[] = $t_elem;
                    }
                    $t_access_clause = rtrim($t_access_clause, ',') . ')';
                }
            } else {
                $t_access_clause = '>=' . db_param();
                $t_params[] = $t_private_access;
            }
            $t_query .= 'OR ( pult.user_id IS NULL AND ut.access_level ' . $t_access_clause . ' ) )';
        } else {
            if (is_array($p_project_id)) {
                if (1 == count($p_project_id)) {
                    $t_project_clause = '= ' . db_param();
                    $t_params[] = array_shift($p_project_id);
                } else {
                    $t_project_clause = 'IN (';
                    foreach ($p_project_id as $t_project) {
                        $t_project_clause .= db_param() . ',';
                        $t_params[] = $t_project;
                    }
                    $t_project_clause = rtrim($t_project_clause, ',') . ')';
                }
            } else {
                $t_project_clause = '= ' . db_param();
                $t_params[] = $p_project_id;
            }
            $t_query = 'SELECT cft.id
				FROM {custom_field} cft
					JOIN {custom_field_project} cfpt ON cfpt.field_id = cft.id
				WHERE cfpt.project_id ' . $t_project_clause . '
				ORDER BY sequence ASC, name ASC';
        }
        $t_result = db_query($t_query, $t_params);
        $t_ids = array();
        while ($t_row = db_fetch_array($t_result)) {
            array_push($t_ids, $t_row['id']);
        }
        custom_field_cache_array_rows($t_ids);
        $g_cache_cf_linked[$p_project_id] = $t_ids;
    } else {
        $t_ids = $g_cache_cf_linked[$p_project_id];
    }
    return $t_ids;
}
开发者ID:hamx0r,项目名称:mantisbt,代码行数:86,代码来源:custom_field_api.php

示例4: cfdef_prepare_list_distinct_values

/**
 * Prepare possible values for option list
 * @param array $p_field_def Custom field definition.
 * @return array|boolean
 */
function cfdef_prepare_list_distinct_values(array $p_field_def)
{
    db_param_push();
    $t_query = 'SELECT possible_values FROM {custom_field} WHERE id=' . db_param();
    $t_result = db_query($t_query, array($p_field_def['id']));
    $t_row = db_fetch_array($t_result);
    if (!$t_row) {
        return false;
    }
    $t_possible_values = custom_field_prepare_possible_values($t_row['possible_values']);
    $t_values_arr = explode('|', $t_possible_values);
    $t_return_arr = array();
    foreach ($t_values_arr as $t_option) {
        array_push($t_return_arr, $t_option);
    }
    return $t_return_arr;
}
开发者ID:spring,项目名称:spring-website,代码行数:22,代码来源:cfdef_standard.php

示例5: auth_get_current_user_id

/**
 * Retrieve user id of current user
 * @return integer user id
 * @access public
 */
function auth_get_current_user_id()
{
    global $g_cache_current_user_id;
    if (null !== $g_cache_current_user_id) {
        return $g_cache_current_user_id;
    }
    $t_cookie_string = auth_get_current_user_cookie();
    if ($t_result = user_search_cache('cookie_string', $t_cookie_string)) {
        $t_user_id = (int) $t_result['id'];
        current_user_set($t_user_id);
        return $t_user_id;
    }
    # @todo error with an error saying they aren't logged in? Or redirect to the login page maybe?
    db_param_push();
    $t_query = 'SELECT id FROM {user} WHERE cookie_string=' . db_param();
    $t_result = db_query($t_query, array($t_cookie_string));
    $t_user_id = (int) db_result($t_result);
    # The cookie was invalid. Clear the cookie (to allow people to log in again)
    # and give them an Access Denied message.
    if (!$t_user_id) {
        auth_clear_cookies();
        access_denied();
        exit;
    }
    current_user_set($t_user_id);
    return $t_user_id;
}
开发者ID:spring,项目名称:spring-website,代码行数:32,代码来源:authentication_api.php

示例6: plugin_register_installed

/**
 * Find and register all installed plugins.
 * This includes the MantisCore pseudo-plugin.
 * @return void
 */
function plugin_register_installed()
{
    global $g_plugin_cache_priority, $g_plugin_cache_protected;
    # register plugins specified in the site configuration
    foreach (plugin_get_force_installed() as $t_basename => $t_priority) {
        plugin_register($t_basename);
        $g_plugin_cache_priority[$t_basename] = $t_priority;
        $g_plugin_cache_protected[$t_basename] = true;
    }
    # register plugins installed via the interface/database
    db_param_push();
    $t_query = 'SELECT basename, priority, protected FROM {plugin} WHERE enabled=' . db_param() . ' ORDER BY priority DESC';
    $t_result = db_query($t_query, array(true));
    while ($t_row = db_fetch_array($t_result)) {
        $t_basename = $t_row['basename'];
        if (!plugin_is_registered($t_basename)) {
            plugin_register($t_basename);
            $g_plugin_cache_priority[$t_basename] = (int) $t_row['priority'];
            $g_plugin_cache_protected[$t_basename] = (bool) $t_row['protected'];
        }
    }
}
开发者ID:spring,项目名称:spring-website,代码行数:27,代码来源:plugin_api.php

示例7: project_hierarchy_cache

/**
 * Cache project hierarchy
 * @param boolean $p_show_disabled Whether or not to cache projects which are disabled.
 * @return void
 */
function project_hierarchy_cache($p_show_disabled = false)
{
    global $g_cache_project_hierarchy, $g_cache_project_inheritance;
    global $g_cache_show_disabled;
    if (!is_null($g_cache_project_hierarchy) && $g_cache_show_disabled == $p_show_disabled) {
        return;
    }
    $g_cache_show_disabled = $p_show_disabled;
    db_param_push();
    $t_enabled_clause = $p_show_disabled ? '1=1' : 'p.enabled = ' . db_param();
    $t_query = 'SELECT DISTINCT p.id, ph.parent_id, p.name, p.inherit_global, ph.inherit_parent
				  FROM {project} p
				  LEFT JOIN {project_hierarchy} ph
				    ON ph.child_id = p.id
				  WHERE ' . $t_enabled_clause . '
				  ORDER BY p.name';
    $t_result = db_query($t_query, $p_show_disabled ? array() : array(true));
    $g_cache_project_hierarchy = array();
    $g_cache_project_inheritance = array();
    while ($t_row = db_fetch_array($t_result)) {
        if (null === $t_row['parent_id']) {
            $t_row['parent_id'] = ALL_PROJECTS;
        }
        if (isset($g_cache_project_hierarchy[(int) $t_row['parent_id']])) {
            $g_cache_project_hierarchy[(int) $t_row['parent_id']][] = (int) $t_row['id'];
        } else {
            $g_cache_project_hierarchy[(int) $t_row['parent_id']] = array((int) $t_row['id']);
        }
        if (!isset($g_cache_project_inheritance[(int) $t_row['id']])) {
            $g_cache_project_inheritance[(int) $t_row['id']] = array();
        }
        if ($t_row['inherit_global'] && !isset($g_cache_project_inheritance[(int) $t_row['id']][ALL_PROJECTS])) {
            $g_cache_project_inheritance[(int) $t_row['id']][] = ALL_PROJECTS;
        }
        if ($t_row['inherit_parent'] && !isset($g_cache_project_inheritance[(int) $t_row['id']][(int) $t_row['parent_id']])) {
            $g_cache_project_inheritance[(int) $t_row['id']][] = (int) $t_row['parent_id'];
        }
    }
}
开发者ID:spring,项目名称:spring-website,代码行数:44,代码来源:project_hierarchy_api.php

示例8: token_purge_expired

/**
 * Purge all expired tokens.
 * @param integer $p_token_type The token type.
 * @return boolean always true.
 */
function token_purge_expired($p_token_type = null)
{
    global $g_tokens_purged;
    db_param_push();
    $t_query = 'DELETE FROM {tokens} WHERE ' . db_param() . ' > expiry';
    if (!is_null($p_token_type)) {
        $t_query .= ' AND type=' . db_param();
        db_query($t_query, array(db_now(), (int) $p_token_type));
    } else {
        db_query($t_query, array(db_now()));
    }
    $g_tokens_purged = true;
    return true;
}
开发者ID:spring,项目名称:spring-website,代码行数:19,代码来源:tokens_api.php

示例9: tag_stats_related

/**
 * Get a list of related tags.
 * Returns a list of tags that are the most related to the given tag,
 * based on the number of times they have been attached to the same bugs.
 * Defaults to a list of five tags.
 * @param integer $p_tag_id The tag ID to retrieve statistics on.
 * @param integer $p_limit  List size.
 * @return array Array of tag rows, with share count added
 */
function tag_stats_related($p_tag_id, $p_limit = 5)
{
    $c_user_id = auth_get_current_user_id();
    db_param_push();
    $t_subquery = 'SELECT b.id FROM {bug} b
					LEFT JOIN {project_user_list} p
						ON p.project_id=b.project_id AND p.user_id=' . db_param() . ' JOIN {user} u
						ON u.id=' . db_param() . ' JOIN {bug_tag} t
						ON t.bug_id=b.id
					WHERE ( p.access_level>b.view_state OR u.access_level>b.view_state )
						AND t.tag_id=' . db_param();
    # 4th Param
    $t_query = 'SELECT * FROM {bug_tag}
					WHERE tag_id != ' . db_param() . ' AND bug_id IN ( ' . $t_subquery . ' ) ';
    $t_result = db_query($t_query, array($p_tag_id, $c_user_id, $c_user_id, $p_tag_id));
    $t_tag_counts = array();
    while ($t_row = db_fetch_array($t_result)) {
        if (!isset($t_tag_counts[$t_row['tag_id']])) {
            $t_tag_counts[$t_row['tag_id']] = 1;
        } else {
            $t_tag_counts[$t_row['tag_id']]++;
        }
    }
    arsort($t_tag_counts);
    $t_tags = array();
    $i = 1;
    foreach ($t_tag_counts as $t_tag_id => $t_count) {
        $t_tag_row = tag_get($t_tag_id);
        $t_tag_row['count'] = $t_count;
        $t_tags[] = $t_tag_row;
        $i++;
        if ($i > $p_limit) {
            break;
        }
    }
    return $t_tags;
}
开发者ID:spring,项目名称:spring-website,代码行数:46,代码来源:tag_api.php

示例10: update

    /**
     * Update a bug from the given data structure
     *  If the third parameter is true, also update the longer strings table
     * @param boolean $p_update_extended Whether to update extended fields.
     * @param boolean $p_bypass_mail     Whether to bypass sending email notifications.
     * @internal param boolean $p_bypass_email Default false, set to true to avoid generating emails (if sending elsewhere)
     * @return boolean (always true)
     * @access public
     */
    function update($p_update_extended = false, $p_bypass_mail = false)
    {
        self::validate($p_update_extended);
        $c_bug_id = $this->id;
        if (is_blank($this->due_date)) {
            $this->due_date = date_get_null();
        }
        $t_old_data = bug_get($this->id, true);
        # Update all fields
        # Ignore date_submitted and last_updated since they are pulled out
        #  as unix timestamps which could confuse the history log and they
        #  shouldn't get updated like this anyway.  If you really need to change
        #  them use bug_set_field()
        db_param_push();
        $t_query = 'UPDATE {bug}
					SET project_id=' . db_param() . ', reporter_id=' . db_param() . ',
						handler_id=' . db_param() . ', duplicate_id=' . db_param() . ',
						priority=' . db_param() . ', severity=' . db_param() . ',
						reproducibility=' . db_param() . ', status=' . db_param() . ',
						resolution=' . db_param() . ', projection=' . db_param() . ',
						category_id=' . db_param() . ', eta=' . db_param() . ',
						os=' . db_param() . ', os_build=' . db_param() . ',
						platform=' . db_param() . ', version=' . db_param() . ',
						build=' . db_param() . ', fixed_in_version=' . db_param() . ',';
        $t_fields = array($this->project_id, $this->reporter_id, $this->handler_id, $this->duplicate_id, $this->priority, $this->severity, $this->reproducibility, $this->status, $this->resolution, $this->projection, $this->category_id, $this->eta, $this->os, $this->os_build, $this->platform, $this->version, $this->build, $this->fixed_in_version);
        $t_roadmap_updated = false;
        if (access_has_project_level(config_get('roadmap_update_threshold'))) {
            $t_query .= '
						target_version=' . db_param() . ',';
            $t_fields[] = $this->target_version;
            $t_roadmap_updated = true;
        }
        $t_query .= '
						view_state=' . db_param() . ',
						summary=' . db_param() . ',
						sponsorship_total=' . db_param() . ',
						sticky=' . db_param() . ',
						due_date=' . db_param() . '
					WHERE id=' . db_param();
        $t_fields[] = $this->view_state;
        $t_fields[] = $this->summary;
        $t_fields[] = $this->sponsorship_total;
        $t_fields[] = (bool) $this->sticky;
        $t_fields[] = $this->due_date;
        $t_fields[] = $this->id;
        db_query($t_query, $t_fields);
        bug_clear_cache($this->id);
        # log changes
        history_log_event_direct($c_bug_id, 'project_id', $t_old_data->project_id, $this->project_id);
        history_log_event_direct($c_bug_id, 'reporter_id', $t_old_data->reporter_id, $this->reporter_id);
        history_log_event_direct($c_bug_id, 'handler_id', $t_old_data->handler_id, $this->handler_id);
        history_log_event_direct($c_bug_id, 'priority', $t_old_data->priority, $this->priority);
        history_log_event_direct($c_bug_id, 'severity', $t_old_data->severity, $this->severity);
        history_log_event_direct($c_bug_id, 'reproducibility', $t_old_data->reproducibility, $this->reproducibility);
        history_log_event_direct($c_bug_id, 'status', $t_old_data->status, $this->status);
        history_log_event_direct($c_bug_id, 'resolution', $t_old_data->resolution, $this->resolution);
        history_log_event_direct($c_bug_id, 'projection', $t_old_data->projection, $this->projection);
        history_log_event_direct($c_bug_id, 'category', category_full_name($t_old_data->category_id, false), category_full_name($this->category_id, false));
        history_log_event_direct($c_bug_id, 'eta', $t_old_data->eta, $this->eta);
        history_log_event_direct($c_bug_id, 'os', $t_old_data->os, $this->os);
        history_log_event_direct($c_bug_id, 'os_build', $t_old_data->os_build, $this->os_build);
        history_log_event_direct($c_bug_id, 'platform', $t_old_data->platform, $this->platform);
        history_log_event_direct($c_bug_id, 'version', $t_old_data->version, $this->version);
        history_log_event_direct($c_bug_id, 'build', $t_old_data->build, $this->build);
        history_log_event_direct($c_bug_id, 'fixed_in_version', $t_old_data->fixed_in_version, $this->fixed_in_version);
        if ($t_roadmap_updated) {
            history_log_event_direct($c_bug_id, 'target_version', $t_old_data->target_version, $this->target_version);
        }
        history_log_event_direct($c_bug_id, 'view_state', $t_old_data->view_state, $this->view_state);
        history_log_event_direct($c_bug_id, 'summary', $t_old_data->summary, $this->summary);
        history_log_event_direct($c_bug_id, 'sponsorship_total', $t_old_data->sponsorship_total, $this->sponsorship_total);
        history_log_event_direct($c_bug_id, 'sticky', $t_old_data->sticky, $this->sticky);
        history_log_event_direct($c_bug_id, 'due_date', $t_old_data->due_date != date_get_null() ? $t_old_data->due_date : null, $this->due_date != date_get_null() ? $this->due_date : null);
        # Update extended info if requested
        if ($p_update_extended) {
            $t_bug_text_id = bug_get_field($c_bug_id, 'bug_text_id');
            db_param_push();
            $t_query = 'UPDATE {bug_text}
							SET description=' . db_param() . ',
								steps_to_reproduce=' . db_param() . ',
								additional_information=' . db_param() . '
							WHERE id=' . db_param();
            db_query($t_query, array($this->description, $this->steps_to_reproduce, $this->additional_information, $t_bug_text_id));
            bug_text_clear_cache($c_bug_id);
            $t_current_user = auth_get_current_user_id();
            if ($t_old_data->description != $this->description) {
                if (bug_revision_count($c_bug_id, REV_DESCRIPTION) < 1) {
                    bug_revision_add($c_bug_id, $t_old_data->reporter_id, REV_DESCRIPTION, $t_old_data->description, 0, $t_old_data->date_submitted);
                }
                $t_revision_id = bug_revision_add($c_bug_id, $t_current_user, REV_DESCRIPTION, $this->description);
                history_log_event_special($c_bug_id, DESCRIPTION_UPDATED, $t_revision_id);
//.........这里部分代码省略.........
开发者ID:spring,项目名称:spring-website,代码行数:101,代码来源:bug_api.php

示例11: custom_field_set_sequence

/**
 * Sets the sequence number for the specified custom field for the specified
 * project.
 * @param integer $p_field_id   A custom field identifier.
 * @param integer $p_project_id A Project identifier.
 * @param integer $p_sequence   Sequence order.
 * @return boolean
 * @access public
 */
function custom_field_set_sequence($p_field_id, $p_project_id, $p_sequence)
{
    db_param_push();
    $t_query = 'UPDATE {custom_field_project}
				  SET sequence=' . db_param() . '
				  WHERE field_id=' . db_param() . ' AND
				  		project_id=' . db_param();
    db_query($t_query, array($p_sequence, $p_field_id, $p_project_id));
    custom_field_clear_cache($p_field_id);
    return true;
}
开发者ID:spring,项目名称:spring-website,代码行数:20,代码来源:custom_field_api.php

示例12: filter_db_get_available_queries

/**
 * Note: any changes made in this function should be reflected in
 * mci_filter_db_get_available_queries())
 * @param integer $p_project_id A valid project identifier.
 * @param integer $p_user_id    A valid user identifier.
 * @return mixed
 */
function filter_db_get_available_queries($p_project_id = null, $p_user_id = null)
{
    $t_overall_query_arr = array();
    if (null === $p_project_id) {
        $t_project_id = helper_get_current_project();
    } else {
        $t_project_id = (int) $p_project_id;
    }
    if (null === $p_user_id) {
        $t_user_id = auth_get_current_user_id();
    } else {
        $t_user_id = (int) $p_user_id;
    }
    # If the user doesn't have access rights to stored queries, just return
    if (!access_has_project_level(config_get('stored_query_use_threshold'))) {
        return $t_overall_query_arr;
    }
    # Get the list of available queries. By sorting such that public queries are
    # first, we can override any query that has the same name as a private query
    # with that private one
    db_param_push();
    $t_query = 'SELECT * FROM {filters}
					WHERE (project_id=' . db_param() . '
						OR project_id=0)
					AND name!=\'\'
					AND (is_public = ' . db_param() . '
						OR user_id = ' . db_param() . ')
					ORDER BY is_public DESC, name ASC';
    $t_result = db_query($t_query, array($t_project_id, true, $t_user_id));
    while ($t_row = db_fetch_array($t_result)) {
        $t_overall_query_arr[$t_row['id']] = $t_row['name'];
    }
    $t_overall_query_arr = array_unique($t_overall_query_arr);
    asort($t_overall_query_arr);
    return $t_overall_query_arr;
}
开发者ID:spring,项目名称:spring-website,代码行数:43,代码来源:filter_api.php

示例13: email_collect_recipients

/**
 * Collect valid email recipients for email notification
 * @todo yarick123: email_collect_recipients(...) will be completely rewritten to provide additional information such as language, user access,..
 * @todo yarick123:sort recipients list by language to reduce switches between different languages
 * @param integer $p_bug_id                  A bug identifier.
 * @param string  $p_notify_type             Notification type.
 * @param array   $p_extra_user_ids_to_email Array of additional email addresses to notify.
 * @return array
 */
function email_collect_recipients($p_bug_id, $p_notify_type, array $p_extra_user_ids_to_email = array())
{
    $t_recipients = array();
    # add explicitly specified users
    $t_explicit_enabled = ON == email_notify_flag($p_notify_type, 'explicit');
    foreach ($p_extra_user_ids_to_email as $t_user_id) {
        if ($t_explicit_enabled) {
            $t_recipients[$t_user_id] = true;
            log_event(LOG_EMAIL_RECIPIENT, 'Issue = #%d, add @U%d (explicitly specified)', $p_bug_id, $t_user_id);
        } else {
            log_event(LOG_EMAIL_RECIPIENT, 'Issue = #%d, skip @U%d (explicit disabled)', $p_bug_id, $t_user_id);
        }
    }
    # add Reporter
    $t_reporter_id = bug_get_field($p_bug_id, 'reporter_id');
    if (ON == email_notify_flag($p_notify_type, 'reporter')) {
        $t_recipients[$t_reporter_id] = true;
        log_event(LOG_EMAIL_RECIPIENT, 'Issue = #%d, add @U%d (reporter)', $p_bug_id, $t_reporter_id);
    } else {
        log_event(LOG_EMAIL_RECIPIENT, 'Issue = #%d, skip @U%d (reporter disabled)', $p_bug_id, $t_reporter_id);
    }
    # add Handler
    $t_handler_id = bug_get_field($p_bug_id, 'handler_id');
    if ($t_handler_id > 0) {
        if (ON == email_notify_flag($p_notify_type, 'handler')) {
            $t_recipients[$t_handler_id] = true;
            log_event(LOG_EMAIL_RECIPIENT, 'Issue = #%d, add @U%d (handler)', $p_bug_id, $t_handler_id);
        } else {
            log_event(LOG_EMAIL_RECIPIENT, 'Issue = #%d, skip @U%d (handler disabled)', $p_bug_id, $t_handler_id);
        }
    }
    $t_project_id = bug_get_field($p_bug_id, 'project_id');
    # add users monitoring the bug
    $t_monitoring_enabled = ON == email_notify_flag($p_notify_type, 'monitor');
    db_param_push();
    $t_query = 'SELECT DISTINCT user_id FROM {bug_monitor} WHERE bug_id=' . db_param();
    $t_result = db_query($t_query, array($p_bug_id));
    while ($t_row = db_fetch_array($t_result)) {
        $t_user_id = $t_row['user_id'];
        if ($t_monitoring_enabled) {
            $t_recipients[$t_user_id] = true;
            log_event(LOG_EMAIL_RECIPIENT, 'Issue = #%d, add @U%d (monitoring)', $p_bug_id, $t_user_id);
        } else {
            log_event(LOG_EMAIL_RECIPIENT, 'Issue = #%d, skip @U%d (monitoring disabled)', $p_bug_id, $t_user_id);
        }
    }
    # add Category Owner
    if (ON == email_notify_flag($p_notify_type, 'category')) {
        $t_category_id = bug_get_field($p_bug_id, 'category_id');
        if ($t_category_id > 0) {
            $t_category_assigned_to = category_get_field($t_category_id, 'user_id');
            if ($t_category_assigned_to > 0) {
                $t_recipients[$t_category_assigned_to] = true;
                log_event(LOG_EMAIL_RECIPIENT, sprintf('Issue = #%d, add Category Owner = @U%d', $p_bug_id, $t_category_assigned_to));
            }
        }
    }
    # add users who contributed bugnotes
    $t_bugnote_id = bugnote_get_latest_id($p_bug_id);
    $t_bugnote_date = bugnote_get_field($t_bugnote_id, 'last_modified');
    $t_bug = bug_get($p_bug_id);
    $t_bug_date = $t_bug->last_updated;
    $t_notes_enabled = ON == email_notify_flag($p_notify_type, 'bugnotes');
    db_param_push();
    $t_query = 'SELECT DISTINCT reporter_id FROM {bugnote} WHERE bug_id = ' . db_param();
    $t_result = db_query($t_query, array($p_bug_id));
    while ($t_row = db_fetch_array($t_result)) {
        $t_user_id = $t_row['reporter_id'];
        if ($t_notes_enabled) {
            $t_recipients[$t_user_id] = true;
            log_event(LOG_EMAIL_RECIPIENT, 'Issue = #%d, add @U%d (note author)', $p_bug_id, $t_user_id);
        } else {
            log_event(LOG_EMAIL_RECIPIENT, 'Issue = #%d, skip @U%d (note author disabled)', $p_bug_id, $t_user_id);
        }
    }
    # add project users who meet the thresholds
    $t_bug_is_private = bug_get_field($p_bug_id, 'view_state') == VS_PRIVATE;
    $t_threshold_min = email_notify_flag($p_notify_type, 'threshold_min');
    $t_threshold_max = email_notify_flag($p_notify_type, 'threshold_max');
    $t_threshold_users = project_get_all_user_rows($t_project_id, $t_threshold_min);
    foreach ($t_threshold_users as $t_user) {
        if ($t_user['access_level'] <= $t_threshold_max) {
            if (!$t_bug_is_private || access_compare_level($t_user['access_level'], config_get('private_bug_threshold'))) {
                $t_recipients[$t_user['id']] = true;
                log_event(LOG_EMAIL_RECIPIENT, 'Issue = #%d, add @U%d (based on access level)', $p_bug_id, $t_user['id']);
            }
        }
    }
    # add users as specified by plugins
    $t_recipients_include_data = event_signal('EVENT_NOTIFY_USER_INCLUDE', array($p_bug_id, $p_notify_type));
    foreach ($t_recipients_include_data as $t_plugin => $t_recipients_include_data2) {
//.........这里部分代码省略.........
开发者ID:spring,项目名称:spring-website,代码行数:101,代码来源:email_api.php

示例14: install_check_token_serialization

/**
 * Schema update to migrate token data from php serialization to json.
 * This ensures it is not possible to execute code during un-serialization
 */
function install_check_token_serialization()
{
    $query = 'SELECT * FROM {tokens} WHERE type=1 or type=2 or type=5';
    $t_result = db_query($query);
    while ($t_row = db_fetch_array($t_result)) {
        $t_id = $t_row['id'];
        $t_value = $t_row['value'];
        if ($t_value === null) {
            $t_token = null;
        } else {
            $t_token = @unserialize($t_value);
            if ($t_token === false) {
                # If user hits a page other than install, tokens may be created using new code.
                $t_token = json_decode($t_value);
                if ($t_token !== null) {
                    continue;
                }
                return 1;
                # Fatal: invalid data found in tokens table
            }
        }
        $t_json_token = json_encode($t_token);
        db_param_push();
        $t_query = 'UPDATE {tokens} SET value=' . db_param() . ' WHERE id=' . db_param();
        db_query($t_query, array($t_json_token, $t_id));
    }
    # Return 2 because that's what ADOdb/DataDict does when things happen properly
    return 2;
}
开发者ID:spring,项目名称:spring-website,代码行数:33,代码来源:install_helper_functions_api.php

示例15: version_get_id

/**
 * Get the version_id, given the project_id and $p_version_id
 * returns false if not found, otherwise returns the id.
 * @param string  $p_version    A version string to look up.
 * @param integer $p_project_id A valid project identifier.
 * @param boolean $p_inherit    True to include versions from parent projects,
 *                              false not to, or null to use configuration
 *                              setting ($g_subprojects_inherit_versions).
 * @return integer
 */
function version_get_id($p_version, $p_project_id = null, $p_inherit = null)
{
    global $g_cache_versions;
    if ($p_project_id === null) {
        $c_project_id = helper_get_current_project();
    } else {
        $c_project_id = (int) $p_project_id;
    }
    foreach ($g_cache_versions as $t_version) {
        if ($t_version['version'] === $p_version && $t_version['project_id'] == $c_project_id) {
            return $t_version['id'];
        }
    }
    db_param_push();
    $t_project_where = version_get_project_where_clause($c_project_id, $p_inherit);
    $t_query = 'SELECT id FROM {project_version} WHERE ' . $t_project_where . ' AND version=' . db_param();
    $t_result = db_query($t_query, array($p_version));
    if ($t_row = db_result($t_result)) {
        return $t_row;
    } else {
        return false;
    }
}
开发者ID:spring,项目名称:spring-website,代码行数:33,代码来源:version_api.php


注:本文中的db_param_push函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。