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; }
/** * 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(); } }
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; }
/** * 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"; } }
/** * 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; }
/** * 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; } }
/** * 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; }
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'; }
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; }
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); } }
/** * 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); }
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; }
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; }
/** * 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; }
/** * 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 = '******' "; } 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; }
function lang_get_default() { global $g_active_language; $t_lang = false; # Confirm that the user's language can be determined if (auth_is_user_authenticated()) { $t_lang = user_pref_get_language(auth_get_current_user_id()); } # Otherwise fall back to default if (false === $t_lang) { $t_lang = config_get('default_language'); } if ('auto' == $t_lang) { $t_lang = lang_map_auto(); } # Remember the language $g_active_language = $t_lang; return $t_lang; }
/** * @param $types */ function print_document_selection($types) { $project_id = gpc_get_int('project_id', helper_get_current_project()); $specmanagement_database_api = new specmanagement_database_api(); echo '<select name="version_id">'; foreach ($types as $type) { $type_string = string_html_specialchars($type); $type_id = $specmanagement_database_api->get_type_id($type); $version_id_array = get_version_ids($type_id, $project_id); foreach ($version_id_array as $version_id) { $version_spec_project_id = version_get_field($version_id, 'project_id'); if (project_includes_user($version_spec_project_id, auth_get_current_user_id()) || user_is_administrator(auth_get_current_user_id())) { $version_string = version_full_name($version_id); echo '<option value="' . $version_id . '">'; echo $type_string . " - " . $version_string; echo '</option>'; } } } echo '</select>'; }
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>'; } }
function menu() { if (plugin_config_get('show_menu')) { require_once __DIR__ . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'wmApi.php'; $projectId = helper_get_current_project(); $userId = auth_get_current_user_id(); $userAccessLevel = user_get_access_level($userId, $projectId); $whiteboardPlugins = wmApi::getWhiteboardPlugins(); $showMenu = false; foreach ($whiteboardPlugins as $whiteboardPlugin) { $pluginAccessLevel = $whiteboardPlugin[2]; if (user_is_administrator($userId) || $userAccessLevel >= $pluginAccessLevel) { $showMenu = true; break; } } if ($showMenu) { return '<a href="' . plugin_page('whiteboard_menu') . '">' . plugin_lang_get('menu_title') . '</a>'; } } return null; }
/** * print menu entrys for each plugin */ public static function printWhiteboardMenu() { $projectId = helper_get_current_project(); $userId = auth_get_current_user_id(); $userAccessLevel = user_get_access_level($userId, $projectId); $whiteboardPlugins = self::getWhiteboardPlugins(); $whiteboardPluginCount = count($whiteboardPlugins); echo '<div class="table">'; for ($index = 0; $index < $whiteboardPluginCount; $index++) { $whiteboardPlugin = $whiteboardPlugins[$index]; $plugin = $whiteboardPlugin[1]; $pluginAccessLevel = $whiteboardPlugin[2]; $pluginShowMenu = $whiteboardPlugin[3]; if ((user_is_administrator($userId) || $userAccessLevel >= $pluginAccessLevel) && $pluginShowMenu == 1) { if ($index > 0) { echo '<div class="item"> | </div>'; } $pluginLink = $whiteboardPlugin[4]; echo '<div class="item"><a href="' . $pluginLink . '">' . plugin_lang_get('menu_title', $plugin) . '</a></div>'; } } echo '</div>'; }
/** * * @param BugData $p_bug bug object * @param int $p_columns_target see COLUMNS_TARGET_* in constant_inc.php * @return null * @access public */ function print_column_status($p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE) { echo '<td class="column-status">'; printf('<span class="issue-status" title="%s">%s</span>', get_enum_element('resolution', $p_bug->resolution, auth_get_current_user_id(), $p_bug->project_id), get_enum_element('status', $p_bug->status, auth_get_current_user_id(), $p_bug->project_id)); # print username instead of status if (ON == config_get('show_assigned_names') && $p_bug->handler_id > 0 && access_has_project_level(config_get('view_handler_threshold'), $p_bug->project_id)) { printf(' (%s)', prepare_user_name($p_bug->handler_id)); } echo '</td>'; }
$f_os_build = gpc_get_string('os_build'); $f_description = gpc_get_string('description'); if (profile_is_global($f_profile_id)) { access_ensure_global_level(config_get('manage_global_profile_threshold')); profile_update(ALL_USERS, $f_profile_id, $f_platform, $f_os, $f_os_build, $f_description); form_security_purge('profile_update'); print_header_redirect('manage_prof_menu_page.php'); } else { profile_update(auth_get_current_user_id(), $f_profile_id, $f_platform, $f_os, $f_os_build, $f_description); form_security_purge('profile_update'); print_header_redirect('account_prof_menu_page.php'); } break; case 'delete': if (profile_is_global($f_profile_id)) { access_ensure_global_level(config_get('manage_global_profile_threshold')); profile_delete(ALL_USERS, $f_profile_id); form_security_purge('profile_update'); print_header_redirect('manage_prof_menu_page.php'); } else { profile_delete(auth_get_current_user_id(), $f_profile_id); form_security_purge('profile_update'); print_header_redirect('account_prof_menu_page.php'); } break; case 'make_default': current_user_set_pref('default_profile', $f_profile_id); form_security_purge('profile_update'); print_header_redirect('account_prof_menu_page.php'); break; }
if ($f_manage_page && $t_dst_project_id == ALL_PROJECTS && !current_user_is_administrator()) { access_denied(); } # only MANAGERS can set global defaults.for a project if ($f_manage_page && $t_dst_project_id != ALL_PROJECTS) { access_ensure_project_level(MANAGER, $t_dst_project_id); } # user should only be able to set columns for a project that is accessible. if ($t_dst_project_id != ALL_PROJECTS) { access_ensure_project_level(VIEWER, $t_dst_project_id); } # Calculate the user id to set the configuration for. if ($f_manage_page) { $t_user_id = NO_USER; } else { $t_user_id = auth_get_current_user_id(); } $t_all_columns = columns_get_all(); $t_default = null; $t_view_issues_page_columns = config_get('view_issues_page_columns', $t_default, $t_user_id, $t_src_project_id); $t_view_issues_page_columns = columns_remove_invalid($t_view_issues_page_columns, $t_all_columns); $t_print_issues_page_columns = config_get('print_issues_page_columns', $t_default, $t_user_id, $t_src_project_id); $t_print_issues_page_columns = columns_remove_invalid($t_print_issues_page_columns, $t_all_columns); $t_csv_columns = config_get('csv_columns', $t_default, $t_user_id, $t_src_project_id); $t_csv_columns = columns_remove_invalid($t_csv_columns, $t_all_columns); $t_excel_columns = config_get('excel_columns', $t_default, $t_user_id, $t_src_project_id); $t_excel_columns = columns_remove_invalid($t_excel_columns, $t_all_columns); config_set('view_issues_page_columns', $t_view_issues_page_columns, $t_user_id, $t_dst_project_id); config_set('print_issues_page_columns', $t_print_issues_page_columns, $t_user_id, $t_dst_project_id); config_set('csv_columns', $t_csv_columns, $t_user_id, $t_dst_project_id); config_set('excel_columns', $t_excel_columns, $t_user_id, $t_dst_project_id);
function print_formatted_severity_string($p_bug) { $t_sev_str = get_enum_element('severity', $p_bug->severity, auth_get_current_user_id(), $p_bug->project_id); $t_severity_threshold = config_get('severity_significant_threshold'); if ($t_severity_threshold >= 0 && $p_bug->severity >= $t_severity_threshold && $p_bug->status < config_get('bug_closed_status_threshold')) { echo "<span class=\"bold\">{$t_sev_str}</span>"; } else { echo $t_sev_str; } }
/** * Check if the specified bug can be reopened * @param BugData $p_bug Bug to check access against * @param int|null $p_user_id integer representing user id, defaults to null to use current user * @return bool whether user has access to reopen bugs * @access public */ function access_can_reopen_bug($p_bug, $p_user_id = null) { if (!bug_is_resolved($p_bug->id)) { # Can't reopen a bug that's not resolved return false; } if ($p_user_id === null) { $p_user_id = auth_get_current_user_id(); } # If allow_reporter_reopen is enabled, then reporters can always reopen # their own bugs as long as their access level is reporter or above if (ON == config_get('allow_reporter_reopen', null, null, $p_bug->project_id) && bug_is_user_reporter($p_bug->id, $p_user_id) && access_has_project_level(config_get('report_bug_threshold', null, $p_user_id, $p_bug->project_id), $p_bug->project_id, $p_user_id)) { return true; } # Other users's access level must allow them to reopen bugs $t_reopen_bug_threshold = config_get('reopen_bug_threshold', null, null, $p_bug->project_id); if (access_has_bug_level($t_reopen_bug_threshold, $p_bug->id, $p_user_id)) { $t_reopen_status = config_get('bug_reopen_status', null, null, $p_bug->project_id); # User must be allowed to change status to reopen status $t_reopen_status_threshold = access_get_status_threshold($t_reopen_status, $p_bug->project_id); return access_has_bug_level($t_reopen_status_threshold, $p_bug->id, $p_user_id); } return false; }
for ($i = 0; $i < $t_sponsor_count; ++$i) { $t_sponsor_row = $t_sponsors[$i]; $t_bug = bug_get($t_sponsor_row['bug']); $t_sponsor = sponsorship_get($t_sponsor_row['sponsor']); $t_buglist[] = $t_sponsor_row['bug'] . ':' . $t_sponsor_row['sponsor']; # describe bug $t_status = string_attribute(get_enum_element('status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id)); $t_resolution = string_attribute(get_enum_element('resolution', $t_bug->resolution, auth_get_current_user_id(), $t_bug->project_id)); $t_version_id = version_get_id($t_bug->fixed_in_version, $t_bug->project_id); if (false !== $t_version_id && VERSION_RELEASED == version_get_field($t_version_id, 'released')) { $t_released_label = '<a title="' . lang_get('released') . '">' . $t_bug->fixed_in_version . '</a>'; } else { $t_released_label = $t_bug->fixed_in_version; } # choose color based on status $t_status_label = html_get_status_css_class($t_bug->status, auth_get_current_user_id(), $t_bug->project_id); echo '<tr class="' . $t_status_label . '">'; echo '<td><a href="' . string_get_bug_view_url($t_sponsor_row['bug']) . '">' . bug_format_id($t_sponsor_row['bug']) . '</a></td>'; echo '<td>' . string_display_line(project_get_field($t_bug->project_id, 'name')) . ' </td>'; echo '<td class="right">' . $t_released_label . ' </td>'; echo '<td><a title="' . $t_resolution . '"><span class="underline">' . $t_status . '</span> </a></td>'; # summary echo '<td>' . string_display_line($t_bug->summary); if (VS_PRIVATE == $t_bug->view_state) { printf(' <img src="%s" alt="(%s)" title="%s" />', $t_icon_path . 'protected.gif', lang_get('private'), lang_get('private')); } echo '</td>'; # describe sponsorship amount echo '<td>'; print_user($t_sponsor->user_id); echo '</td>';
/** * Cache collapse API data from the database for the current user. * If the collapse cookie has been set, grab the changes and resave * the token, or touch it otherwise. */ function collapse_cache_token() { global $g_collapse_cache_token; if (!auth_is_user_authenticated() || current_user_is_anonymous()) { $g_collapse_cache_token = array(); return; } if (isset($g_collapse_cache_token)) { return; } $t_user_id = auth_get_current_user_id(); $t_token = token_get_value(TOKEN_COLLAPSE); if (!is_null($t_token)) { $t_data = unserialize($t_token); } else { $t_data = array(); } $g_collapse_cache_token = $t_data; $t_cookie = gpc_get_cookie('MANTIS_collapse_settings', ''); if (false !== $t_cookie && !is_blank($t_cookie)) { $t_update = false; $t_data = explode('|', $t_cookie); foreach ($t_data as $t_pair) { $t_pair = explode(',', $t_pair); if (false !== $t_pair && count($t_pair) == 2) { $g_collapse_cache_token[$t_pair[0]] = true == $t_pair[1]; $t_update = true; } } if ($t_update) { $t_token = serialize($g_collapse_cache_token); token_set(TOKEN_COLLAPSE, $t_token, TOKEN_EXPIRY_COLLAPSE); } else { token_touch(TOKEN_COLLAPSE); } gpc_clear_cookie('MANTIS_collapse_settings'); } }
$t_full_projects = array(); foreach ($t_projects as $t_project_id) { $t_full_projects[] = project_get_row($t_project_id); } $t_projects = multi_sort($t_full_projects, $f_sort, $t_direction); $t_stack = array($t_projects); while (0 < count($t_stack)) { $t_projects = array_shift($t_stack); if (0 == count($t_projects)) { continue; } $t_project = array_shift($t_projects); $t_project_id = $t_project['id']; $t_level = count($t_stack); # only print row if user has project management privileges if (access_has_project_level($t_manage_project_threshold, $t_project_id, auth_get_current_user_id())) { ?> <tr <?php echo helper_alternate_class(); ?> > <td> <a href="manage_proj_edit_page.php?project_id=<?php echo $t_project['id']; ?> "><?php echo str_repeat("» ", $t_level) . string_display($t_project['name']); ?> </a> </td> <td>
if (!config_is_set('current_user_assume_userstories_filter_direction', auth_get_current_user_id())) { config_set('current_user_assume_userstories_filter_direction', 'ASC', auth_get_current_user_id()); } if (config_get('current_user_assume_userstories_filter_direction', null, auth_get_current_user_id()) == 'ASC') { $direction = 'DESC'; } else { $direction = 'ASC'; } # check if available if (plugin_config_get('gadiv_ranking_order') == 0 && config_get('current_user_assume_userstories_filter', null, auth_get_current_user_id()) == 'rankingOrder') { config_set('current_user_assume_userstories_filter', '', auth_get_current_user_id()); config_set('current_user_assume_userstories_filter_direction', 'ASC', auth_get_current_user_id()); } if (plugin_config_get('gadiv_tracker_planned_costs') == 0 && config_get('current_user_assume_userstories_filter', null, auth_get_current_user_id()) == 'plannedWork') { config_set('current_user_assume_userstories_filter', '', auth_get_current_user_id()); config_set('current_user_assume_userstories_filter_direction', 'ASC', auth_get_current_user_id()); } # get all unresolved user stories $undone = $agilemantis_pb->getAllUndoneUserStories($product_backlog); if (empty($undone)) { echo '<br><center><span class="message_error">' . plugin_lang_get('assume_userstories_error_120C01') . '</span></center>'; } if (plugin_is_loaded('agileMantisExpert')) { event_signal('EVENT_LOAD_USERSTORY'); } else { } ?> <br> <form action="" method="post"> <input type="hidden" name="action" value="save"> <input type="hidden"
<th class="category"> <label for="profile_id"><?php echo lang_get('select_profile'); ?> </label> </th> <td> <?php if (count(profile_get_all_for_user(auth_get_current_user_id())) > 0) { ?> <select <?php echo helper_get_tab_index(); ?> id="profile_id" name="profile_id"> <?php print_profile_option_list(auth_get_current_user_id(), $f_profile_id); ?> </select> <?php } ?> </td> </tr> <tr> <td colspan="2" class="none"> <?php if (ON == config_get('use_javascript')) { ?> <?php collapse_open('profile'); collapse_icon('profile');