/issues/view_user_page.php

https://github.com/osarrat/sigmah-website · PHP · 121 lines · 79 code · 17 blank · 25 comment · 9 complexity · 4186e80241bed3d6ab1cf3245ad4b66f MD5 · raw file

  1. <?php
  2. # MantisBT - a php based bugtracking system
  3. # MantisBT is free software: you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation, either version 2 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # MantisBT is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
  15. /**
  16. * @package MantisBT
  17. * @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
  18. * @link http://www.mantisbt.org
  19. */
  20. /**
  21. * MantisBT Core API's
  22. */
  23. require_once( 'core.php' );
  24. require_once( 'current_user_api.php' );
  25. auth_ensure_user_authenticated();
  26. # extracts the user information for the currently logged in user
  27. # and prefixes it with u_
  28. $f_user_id = gpc_get_int( 'id', auth_get_current_user_id() );
  29. $row = user_get_row( $f_user_id );
  30. extract( $row, EXTR_PREFIX_ALL, 'u' );
  31. $t_can_manage = access_has_global_level( config_get( 'manage_user_threshold' ) ) &&
  32. access_has_global_level( $u_access_level );
  33. $t_can_see_realname = access_has_project_level( config_get( 'show_user_realname_threshold' ) );
  34. $t_can_see_email = access_has_project_level( config_get( 'show_user_email_threshold' ) );
  35. # In case we're using LDAP to get the email address... this will pull out
  36. # that version instead of the one in the DB
  37. $u_email = user_get_email( $u_id );
  38. $u_realname = user_get_realname( $u_id );
  39. html_page_top();
  40. ?>
  41. <br />
  42. <div align="center">
  43. <table class="width75" cellspacing="1">
  44. <!-- Headings -->
  45. <tr>
  46. <td class="form-title">
  47. <?php echo lang_get( 'view_account_title' ) ?>
  48. </td>
  49. </tr>
  50. <!-- Username -->
  51. <tr <?php echo helper_alternate_class() ?>>
  52. <td class="category" width="25%">
  53. <?php echo lang_get( 'username' ) ?>
  54. </td>
  55. <td width="75%">
  56. <?php echo string_display_line( $u_username ) ?>
  57. </td>
  58. </tr>
  59. <!-- Email -->
  60. <tr <?php echo helper_alternate_class() ?>>
  61. <td class="category">
  62. <?php echo lang_get( 'email' ) ?>
  63. </td>
  64. <td>
  65. <?php
  66. if ( ! ( $t_can_manage || $t_can_see_email ) ) {
  67. print error_string(ERROR_ACCESS_DENIED);
  68. } else {
  69. if ( !is_blank( $u_email ) ) {
  70. print_email_link( $u_email, $u_email );
  71. } else {
  72. echo " - ";
  73. }
  74. }
  75. ?>
  76. </td>
  77. </tr>
  78. <!-- Realname -->
  79. <tr <?php echo helper_alternate_class() ?> valign="top">
  80. <td class="category">
  81. <?php echo lang_get( 'realname' ) ?>
  82. </td>
  83. <td>
  84. <?php
  85. if ( ! ( $t_can_manage || $t_can_see_realname ) ) {
  86. print error_string(ERROR_ACCESS_DENIED);
  87. } else {
  88. echo string_display_line( $u_realname );
  89. }
  90. ?>
  91. </td>
  92. </tr>
  93. <?php if ( $t_can_manage ) { ?>
  94. <tr>
  95. <td colspan="2" class="center">
  96. <?php print_bracket_link( 'manage_user_edit_page.php?user_id=' . $f_user_id, lang_get( 'manage_user' ) ); ?>
  97. </td>
  98. </tr>
  99. <?php } ?>
  100. </table>
  101. </div>
  102. <br />
  103. <?php
  104. html_page_bottom();