本文整理汇总了PHP中auth_get_current_user_id函数的典型用法代码示例。如果您正苦于以下问题:PHP auth_get_current_user_id函数的具体用法?PHP auth_get_current_user_id怎么用?PHP auth_get_current_user_id使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了auth_get_current_user_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public function get($request)
{
/**
* Returns the Response with a list of bug URIs.
*
* @param $request - The Request we're responding to
*/
$visible_project_ids = user_get_accessible_projects(auth_get_current_user_id(), TRUE);
# Now we construct a query to figure out which of these bugs matches the conditions
# we got from the query string, and order them correctly.
$sql_to_add = $this->_build_sql_from_querystring($request->query);
$bug_ids = array();
$mantis_bug_table = config_get('mantis_bug_table');
$query = "SELECT b.id, b.project_id FROM {$mantis_bug_table} b {$sql_to_add};";
$result = db_query($query);
# This loop takes care of both the filtering and the sorting.
foreach ($result as $r) {
if (in_array($r[1], $visible_project_ids)) {
$bug_ids[] = $r[0];
}
}
$this->rsrc_data['results'] = array();
foreach ($bug_ids as $id) {
$this->rsrc_data['results'][] = Bug::get_url_from_mantis_id($id);
}
$resp = new Response();
$resp->status = 200;
$resp->body = $this->_repr($request);
return $resp;
}
示例2: bug_group_action_print_bug_list
/**
* Print the list of selected issues and the legend for the status colors.
*
* @param $p_bug_ids_array An array of issue ids.
*/
function bug_group_action_print_bug_list($p_bug_ids_array)
{
$t_legend_position = config_get('status_legend_position');
if (STATUS_LEGEND_POSITION_TOP == $t_legend_position) {
html_status_legend();
echo '<br />';
}
echo '<div align="center">';
echo '<table class="width75" cellspacing="1">';
echo '<tr class="row-1">';
echo '<td class="category" colspan="2">';
echo lang_get('actiongroup_bugs');
echo '</td>';
echo '</tr>';
$t_i = 1;
foreach ($p_bug_ids_array as $t_bug_id) {
$t_class = sprintf("row-%d", $t_i++ % 2 + 1);
echo sprintf("<tr bgcolor=\"%s\"> <td>%s</td> <td>%s</td> </tr>\n", get_status_color(bug_get_field($t_bug_id, 'status'), auth_get_current_user_id(), bug_get_field($t_bug_id, 'project_id')), string_get_bug_view_link($t_bug_id), string_attribute(bug_get_field($t_bug_id, 'summary')));
}
echo '</table>';
echo '</form>';
echo '</div>';
if (STATUS_LEGEND_POSITION_BOTTOM == $t_legend_position) {
echo '<br />';
html_status_legend();
}
}
示例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: kanban_ajax_button_bug_change_status
/**
* Print Change Status to: AJAXified button
* This code is similar to button_bug_change_status except that the
* button is AJAXified.
* Uses projax.php
*
* @param int $p_bug_id
* @param int $t_project_id
* @param int $t_user_id
* @return null
*/
function kanban_ajax_button_bug_change_status($p_bug_id, $t_project_id, $t_user_id)
{
global $g_projax;
$t_bug_project_id = bug_get_field($p_bug_id, 'project_id');
$t_bug_current_state = bug_get_field($p_bug_id, 'status');
$t_current_access = access_get_project_level($t_bug_project_id);
$t_enum_list = get_status_option_list($t_current_access, $t_bug_current_state, false, bug_get_field($p_bug_id, 'reporter_id') == auth_get_current_user_id() && ON == config_get('allow_reporter_close'), $t_bug_project_id);
if (count($t_enum_list) > 0) {
# resort the list into ascending order after noting the key from the first element (the default)
$t_default_arr = each($t_enum_list);
$t_default = $t_default_arr['key'];
ksort($t_enum_list);
reset($t_enum_list);
echo "<div id=\"ajax_statuschange\"><form method=\"post\" id=\"ajax_status_form\" action=\"xmlhttprequest.php\">";
# CSRF protection not required here - form does not result in modifications
echo "<input type=\"hidden\" name=\"project_id\" id=\"project_id\" value=\"{$t_project_id}\" />";
echo "<input type=\"hidden\" name=\"user_id\" id=\"user_id\" value=\"{$t_user_id}\" />";
echo "<input type=\"hidden\" name=\"entrypoint\" id=\"entrypoint\" value=\"bug_update_status\" />";
$t_button_text = lang_get('bug_status_to_button');
// AJAX button options
$options = array('url' => plugin_page('kanban_ajax_request'), 'with' => true, 'confirm' => lang_get('confirm_change_status'), 'success' => 'location.reload()', 'failure' => 'alert("Error: " ' + request . status + ')');
echo $g_projax->submit_to_remote('ajax_status', $t_button_text, $options);
echo " <select name=\"new_status\">";
# space at beginning of line is important
foreach ($t_enum_list as $key => $val) {
echo "<option value=\"{$key}\" ";
check_selected($key, $t_default);
echo ">{$val}</option>";
}
echo '</select>';
$t_bug_id = string_attribute($p_bug_id);
echo "<input type=\"hidden\" name=\"id\" value=\"{$t_bug_id}\" />\n";
echo "</form></div>\n";
}
}
示例5: mci_account_get_array_by_id
/**
* Get username, realname and email from for a given user id
* @param integer $p_user_id A valid user identifier.
* @return array
*/
function mci_account_get_array_by_id($p_user_id)
{
$t_result = array();
$t_result['id'] = $p_user_id;
if (user_exists($p_user_id)) {
$t_current_user_id = auth_get_current_user_id();
$t_access_level = user_get_field($t_current_user_id, 'access_level');
$t_can_manage = access_has_global_level(config_get('manage_user_threshold')) && access_has_global_level($t_access_level);
# this deviates from the behaviour of view_user_page.php, but it is more intuitive
$t_is_same_user = $t_current_user_id === $p_user_id;
$t_can_see_realname = access_has_project_level(config_get('show_user_realname_threshold'));
$t_can_see_email = access_has_project_level(config_get('show_user_email_threshold'));
$t_result['name'] = user_get_field($p_user_id, 'username');
if ($t_is_same_user || $t_can_manage || $t_can_see_realname) {
$t_realname = user_get_realname($p_user_id);
if (!empty($t_realname)) {
$t_result['real_name'] = $t_realname;
}
}
if ($t_is_same_user || $t_can_manage || $t_can_see_email) {
$t_email = user_get_email($p_user_id);
if (!empty($t_email)) {
$t_result['email'] = $t_email;
}
}
}
return $t_result;
}
示例6: prepare_user_name
/**
* prepares the name of the user given the id. also makes it an email link.
* @param int $p_user_id
* @return string
*/
function prepare_user_name($p_user_id)
{
# Catch a user_id of NO_USER (like when a handler hasn't been assigned)
if (NO_USER == $p_user_id) {
return '';
}
$t_username = user_get_name($p_user_id);
if (user_exists($p_user_id) && user_get_field($p_user_id, 'enabled')) {
$t_username = string_display_line($t_username);
// WK/BFE: Original-Zeile auskommentiert: , LB/BFE 2015
// return '<a href="' . string_sanitize_url( 'view_user_page.php?id=' . $p_user_id, true ) . '">' . $t_username . '</a>';
// ersetzt durch: (Link auf view_user_page nur wenn globale Rolle mindestens $g_manage_user_threshold
if (user_is_administrator(auth_get_current_user_id())) {
return '<a href="' . string_sanitize_url('view_user_page.php?id=' . $p_user_id, true) . '">' . $t_username . '</a>';
} else {
return $t_username;
}
// WK/BFE: Ende der Modifikation
} else {
$t_result = '<font STYLE="text-decoration: line-through">';
$t_result .= string_display_line($t_username);
$t_result .= '</font>';
return $t_result;
}
}
示例7: timeline_events
/**
* Get an array of timeline events
* Events for which the skip() method returns true will be excluded
* @param integer $p_start_time Timestamp representing start time of the period.
* @param integer $p_end_time Timestamp representing end time of the period.
* @param integer $p_max_events The maximum number of events to return or 0 for unlimited.
* @return array
*/
function timeline_events($p_start_time, $p_end_time, $p_max_events)
{
$t_timeline_events = array();
$t_result = history_get_range_result(null, $p_start_time, $p_end_time, 'DESC');
$t_count = 0;
while ($t_history_event = history_get_event_from_row($t_result, auth_get_current_user_id(), true)) {
$t_event = null;
$t_user_id = $t_history_event['userid'];
$t_timestamp = $t_history_event['date'];
$t_issue_id = $t_history_event['bug_id'];
switch ($t_history_event['type']) {
case NEW_BUG:
$t_event = new IssueCreatedTimelineEvent($t_timestamp, $t_user_id, $t_issue_id);
break;
case BUGNOTE_ADDED:
$t_bugnote_id = $t_history_event['old_value'];
$t_event = new IssueNoteCreatedTimelineEvent($t_timestamp, $t_user_id, $t_issue_id, $t_bugnote_id);
break;
case BUG_MONITOR:
# Skip monitors added for others due to reminders, only add monitor events where added
# user is the same as the logged in user.
if ((int) $t_history_event['old_value'] == (int) $t_history_event['userid']) {
$t_event = new IssueMonitorTimelineEvent($t_timestamp, $t_user_id, $t_issue_id, true);
}
break;
case BUG_UNMONITOR:
$t_event = new IssueMonitorTimelineEvent($t_timestamp, $t_user_id, $t_issue_id, false);
break;
case TAG_ATTACHED:
$t_event = new IssueTagTimelineEvent($t_timestamp, $t_user_id, $t_issue_id, $t_history_event['old_value'], true);
break;
case TAG_DETACHED:
$t_event = new IssueTagTimelineEvent($t_timestamp, $t_user_id, $t_issue_id, $t_history_event['old_value'], false);
break;
case NORMAL_TYPE:
switch ($t_history_event['field']) {
case 'status':
$t_event = new IssueStatusChangeTimelineEvent($t_timestamp, $t_user_id, $t_issue_id, $t_history_event['old_value'], $t_history_event['new_value']);
break;
case 'handler_id':
$t_event = new IssueAssignedTimelineEvent($t_timestamp, $t_user_id, $t_issue_id, $t_history_event['new_value']);
break;
}
break;
}
# Do not include skipped events
if ($t_event != null && !$t_event->skip()) {
$t_timeline_events[] = $t_event;
$t_count++;
if ($p_max_events > 0 && $t_count >= $p_max_events) {
break;
}
}
}
return $t_timeline_events;
}
示例8: csv_get_default_filename
function csv_get_default_filename()
{
$t_current_project_id = helper_get_current_project();
if (ALL_PROJECTS == $t_current_project_id) {
$t_filename = user_get_name(auth_get_current_user_id());
} else {
$t_filename = project_get_field($t_current_project_id, 'name');
}
return $t_filename . '.csv';
}
示例9: footer
function footer()
{
$t_project_id = helper_get_current_project();
$t_user_id = auth_get_current_user_id();
$t_user_has_level = user_get_access_level($t_user_id, $t_project_id) >= plugin_config_get('BackgroundImageAccessLevel', PLUGINS_BACKGROUNDIMAGEVIEW_THRESHOLD_LEVEL_DEFAULT);
if (plugin_config_get('ShowInFooter') == 1 && $t_user_has_level) {
return '<address>' . $this->name . ' ' . $this->version . ' Copyright © 2015 by <a href="mailto://' . $this->contact . '">' . $this->author . '</a></address>';
}
return null;
}
示例10: __construct
public function __construct()
{
if (MANTIS_LOCAL) {
if (auth_attempt_script_login(MANTIS_USER, MANTIS_PWD)) {
$this->userID = auth_get_current_user_id();
}
} else {
$this->client = new SoapClient(MANTIS_WSDL);
}
}
示例11: rss_calculate_key
/**
* Calculates a key to be used for RSS authentication based on user name, cookie and password.
* if the user changes his user name or password, then the key becomes invalid.
* @param int $p_user_id
* @return string
*/
function rss_calculate_key($p_user_id = null)
{
if ($p_user_id === null) {
$t_user_id = auth_get_current_user_id();
} else {
$t_user_id = $p_user_id;
}
$t_seed = config_get_global('rss_key_seed');
$t_username = user_get_field($t_user_id, 'username');
$t_password = user_get_field($t_user_id, 'password');
$t_cookie = user_get_field($t_user_id, 'cookie_string');
return md5($t_seed . $t_username . $t_cookie . $t_password);
}
示例12: add_columns
function add_columns()
{
$t_project_id = helper_get_current_project();
$t_user_id = auth_get_current_user_id();
$t_user_has_level = user_get_access_level($t_user_id, $t_project_id) >= plugin_config_get('RelationshipColumnAccessLevel', PLUGINS_RELATIONSHIPCOLUMNVIEW_THRESHOLD_LEVEL_DEFAULT);
$t_result = array();
if (plugin_config_get('ShowRelationshipColumn') == gpc_get_int('ShowRelationshipColumn', ON) && $t_user_has_level) {
if ('1.2.' == substr(MANTIS_VERSION, 0, 4)) {
require_once 'classes' . DIRECTORY_SEPARATOR . 'RelationshipColumn.class.1.2.0.php';
} else {
require_once 'classes' . DIRECTORY_SEPARATOR . 'RelationshipColumn.class.1.3.0.php';
}
$t_result[] = 'RelationshipColumn';
}
return $t_result;
}
示例13: get
public function get($request)
{
/*
* Returns a Response with a representation of the note list.
*
* @param $request - The Request we're responding to
*/
$this->bug_id = BugnoteList::get_bug_id_from_url($request->url);
# Access checking and note gathering is based on Mantis's
# email_build_visible_bug_data().
$project_id = bug_get_field($this->bug_id, 'project_id');
$user_id = auth_get_current_user_id();
$access_level = user_get_access_level($user_id, $project_id);
if (!access_has_bug_level(VIEWER, $this->bug_id)) {
throw new HTTPException(403, "Access denied");
}
$visible_notes = bugnote_get_all_visible_bugnotes($this->bug_id, $access_level, 'ASC', 0);
$visible_note_ids = array();
foreach ($visible_notes as $n) {
$visible_note_ids[] = (int) $n->id;
}
# Apply conditions and sorts
$sql_to_add = $this->_build_sql_from_querystring($request->query);
$note_ids = array();
if ($sql_to_add) {
$mantis_bugnote_table = config_get('mantis_bugnote_table');
$query = "SELECT n.id FROM {$mantis_bugnote_table} n {$sql_to_add};";
$result = db_query($query);
foreach ($result as $r) {
if (in_array((int) $r[0], $visible_note_ids)) {
$note_ids[] = (int) $r[0];
}
}
} else {
$note_ids = $visible_note_ids;
}
$this->rsrc_data = array();
$this->rsrc_data['results'] = array();
foreach ($note_ids as $n) {
$config = get_config();
$this->rsrc_data['results'][] = Bugnote::get_url_from_mantis_id($n);
}
$resp = new Response();
$resp->status = 200;
$resp->body = $this->_repr($request);
return $resp;
}
示例14: rss_calculate_key
/**
* Calculates a key to be used for RSS authentication based on user name,
* cookie and password. If the user changes their user name or password, this
* RSS authentication key will become invalidated.
* @param integer $p_user_id User ID for the user which the key is being calculated for.
* @return string RSS authentication key (384bit) encoded according to the base64 with URI safe alphabet approach described in RFC4648.
*/
function rss_calculate_key($p_user_id = null)
{
if ($p_user_id === null) {
$t_user_id = auth_get_current_user_id();
} else {
$t_user_id = $p_user_id;
}
$t_username = user_get_field($t_user_id, 'username');
$t_password = user_get_field($t_user_id, 'password');
$t_cookie = user_get_field($t_user_id, 'cookie_string');
$t_key_raw = hash('whirlpool', 'rss_key' . config_get_global('crypto_master_salt') . $t_username . $t_password . $t_cookie, true);
# Note: We truncate the last 8 bits from the hash output so that base64
# encoding can be performed without any trailing padding.
$t_key_base64_encoded = base64_encode(substr($t_key_raw, 0, 63));
$t_key = strtr($t_key_base64_encoded, '+/', '-_');
return $t_key;
}
示例15: 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;
}