/** * 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; }
<!-- Realname --> <tr <?php echo helper_alternate_class(1); ?> > <td class="category" width="30%"> <?php echo lang_get('realname'); ?> </td> <td width="70%"> <?php // With LDAP if ($t_ldap && ON == config_get('use_ldap_realname')) { echo string_display_line(user_get_realname($t_user_id)); } else { ?> <input type="text" size="32" maxlength="<?php echo DB_FIELD_SIZE_REALNAME; ?> " name="realname" value="<?php echo string_attribute($t_user['realname']); ?> " /> <?php } ?> </td> </tr>
private function get_account_menu() { $t_protected = current_user_get_field('protected'); $t_current_project = helper_get_current_project(); # $t_menu_options = array(); $t_menu_options = $this->get_manage_menu(); echo ' <a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> <i class="icon-user"></i> '; echo user_get_realname(current_user_get_field('id')); echo ' <b class="caret"></b> </a> <ul class="dropdown-menu"> '; echo '<li><a href="' . helper_mantis_url('manage_overview_page.php') . '">Manage</a></li>'; echo '<li>' . implode($t_menu_options, ' </li> <li> ') . '</li>'; if ($t_menu_options) { echo '<li class="divider"></li>'; } unset($t_menu_options); # Account Page (only show accounts that are NOT protected) if (OFF == $t_protected) { $t_menu_options[] = '<a href="' . helper_mantis_url('account_page.php">') . '<i class="icon-user"></i> ' . lang_get('account_link') . '</a>'; } # Logout (no if anonymously logged in) if (!current_user_is_anonymous()) { $t_menu_options[] = '<a href="' . helper_mantis_url('logout_page.php">') . '<i class="icon-off"></i> ' . lang_get('logout_link') . '</a>'; } echo '<li>' . implode($t_menu_options, ' </li> <li> ') . '</li>'; echo '</ul>'; }
require_api('string_api.php'); require_api('user_api.php'); require_api('utility_api.php'); auth_ensure_user_authenticated(); # extracts the user information for the currently logged in user # and prefixes it with u_ $f_user_id = gpc_get_int('id', auth_get_current_user_id()); $row = user_get_row($f_user_id); extract($row, EXTR_PREFIX_ALL, 'u'); $t_can_manage = access_has_global_level(config_get('manage_user_threshold')) && access_has_global_level($u_access_level); $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')); # In case we're using LDAP to get the email address... this will pull out # that version instead of the one in the DB $u_email = user_get_email($u_id); $u_realname = user_get_realname($u_id); html_page_top(); ?> <br /> <div align="center"> <table class="width75" cellspacing="1"> <tr> <td class="form-title"> <?php echo lang_get('view_account_title'); ?> </td> </tr> <tr <?php echo helper_alternate_class();
$t_template['project_name'] = project_get_name($t_project_id); $t_template['version_id'] = $t_version; if ($t_version != 0) { $t_template['version_name'] = version_get_field($t_version, 'version'); $t_template['version_description'] = version_get_field($t_version, 'description'); $t_template['version_date_order'] = version_get_field($t_version, 'date_order'); $t_template['version_date'] = date(config_get('normal_date_format'), $t_template['version_date_order']); } else { $t_template['version_name'] = ''; $t_template['version_description'] = ''; $t_template['version_date_order'] = ''; $t_template['version_date'] = ''; } $t_template['user_id'] = $t_current_user_id; $t_template['user_name'] = user_get_name($t_current_user_id); $t_template['user_realname'] = user_get_realname($t_current_user_id); $t_template['user_email'] = user_get_email($t_current_user_id); $t_template_file = $t_template_dir . 'text_inc.php'; ob_start(); if (file_exists($t_template_file)) { include $t_template_file; } else { echo 'ERROR: Contact your Mantis administrator'; } $t_message = ob_get_contents(); ob_end_clean(); $t_template_file = $t_template_dir . 'html_inc.php'; ob_start(); if (file_exists($t_template_file)) { include $t_template_file; } else {
?> </th> <td width="70%"> <?php if (!$t_ldap || config_get('use_ldap_realname') == OFF) { ?> <input type="text" size="16" maxlength="<?php echo REALLEN; ?> " name="realname" value="<?php echo string_attribute($t_user['realname']); ?> " /> <?php } else { echo string_display(user_get_realname($f_user_id)); } ?> </td> </tr> <!-- Email --> <tr <?php echo helper_alternate_class(); ?> > <th class="category"> <?php echo lang_get('email_label'); ?> </th>
/** * Print the real name in the user row of the plugin table * * @param $data_row */ function print_real_name($data_row) { $user_id = $data_row['user_id']; $real_name = ''; if (userprojectapi::check_user_id_is_valid($user_id)) { $real_name = user_get_realname($user_id); } userprojectapi::get_cell_highlighting($data_row, 1, 'nowrap'); echo $real_name; echo '</td>' . PHP_EOL; }
/** * Gets the managers of the current selected project * * @param $version_id * @return string */ public function calculate_person_in_charge($version_id) { $person_in_charge = ''; $project_id = helper_get_current_project(); if ($project_id == 0) { $project_id = version_get_field($version_id, 'project_id'); } $project_related_users = project_get_local_user_rows($project_id); $count = 0; foreach ($project_related_users as $project_related_user) { if ($project_related_user['project_id'] == $project_id && $project_related_user['access_level'] == 70 && user_is_enabled($project_related_user['user_id'])) { if ($count > 0) { $person_in_charge .= ', '; } $person_in_charge .= user_get_realname($project_related_user['user_id']); $count++; } } return $person_in_charge; }
/** * Converts an array of bugnotes to array of billing rows * * @param array $p_bugnotes Array of bugnotes * @return array Array of billing rows * @access private */ function billing_rows_to_array($p_bugnotes) { $t_billing_rows = array(); foreach ($p_bugnotes as $t_note) { $t_row = array(); $t_row['id'] = $t_note['id']; $t_row['minutes'] = $t_note['minutes']; $t_row['duration'] = db_minutes_to_hhmm($t_note['minutes']); $t_row['note'] = $t_note['note']; $t_row['reporter_id'] = $t_note['reporter_id']; $t_row['reporter_username'] = user_get_name($t_note['reporter_id']); $t_row['reporter_realname'] = user_get_realname($t_note['reporter_id']); $t_row['date_submitted'] = $t_note['date_submitted']; if (is_blank($t_row['reporter_realname'])) { $t_row['reporter_realname'] = $t_row['reporter_username']; } $t_row['bug_id'] = $t_note['bug_id']; $t_row['bug_summary'] = $t_note['bug_summary']; $t_row['cost'] = $t_note['cost']; $t_billing_rows[] = $t_row; } return $t_billing_rows; }
if( VS_PRIVATE == $t_bug->view_state ) { echo '<img src="' . $t_icon_path . 'protected.gif" width="8" height="15" alt="' . lang_get( 'private' ) . '" />'; } echo '</div>'; */ $t_submitted = date(config_get('normal_date_format'), $t_bug->date_submitted); echo '<div class="bugTime">' . $t_submitted . '<br>'; $t_last_updated = date(config_get('normal_date_format'), $t_bug->last_updated); echo $t_last_updated . '</div>'; // print username instead of status if (ON == config_get('show_assigned_names') && $t_bug->handler_id > 0 && user_exists($t_bug->handler_id) && access_has_project_level(config_get('view_handler_threshold'), $t_bug->project_id)) { $emailHash = md5(strtolower(trim(user_get_email($t_bug->handler_id)))); echo '<div class="owner">'; echo '<div class="img-wrap"><img src="http://www.gravatar.com/avatar/' . $emailHash . '?s=28&d=monsterid" width="28" height="28" /></div>'; echo user_get_realname($t_bug->handler_id); echo '</div>'; } echo '</div>'; $i++; } } } ?> </td><?php } ?> </td> </tr> <tr> <?php
function print_option_realname_col($user_id) { echo '<td class="group_row_bg">'; if (user_exists($user_id)) { echo user_get_realname($user_id); } else { echo '<s>' . user_get_realname($user_id) . '</s>'; } echo '</td>'; }