/issues/account_prof_menu_page.php

https://github.com/osarrat/sigmah-website · PHP · 178 lines · 135 code · 13 blank · 30 comment · 10 complexity · c277adb65eaa549dedb863ad67f0eb26 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. * This page allows users to add a new profile which is POSTed to
  17. * account_prof_add.php
  18. *
  19. * Users can also manage their profiles
  20. *
  21. * @package MantisBT
  22. * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
  23. * @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
  24. * @link http://www.mantisbt.org
  25. */
  26. /**
  27. * MantisBT Core API's
  28. */
  29. require_once( 'core.php' );
  30. if ( isset( $g_global_profiles ) ) {
  31. $g_global_profiles = true;
  32. } else {
  33. $g_global_profiles = false;
  34. }
  35. require_once( 'current_user_api.php' );
  36. auth_ensure_user_authenticated();
  37. current_user_ensure_unprotected();
  38. if ( $g_global_profiles ) {
  39. access_ensure_global_level( config_get( 'manage_global_profile_threshold' ) );
  40. } else {
  41. access_ensure_global_level( config_get( 'add_profile_threshold' ) );
  42. }
  43. html_page_top( lang_get( 'manage_profiles_link' ) );
  44. if ( $g_global_profiles ) {
  45. print_manage_menu( 'manage_prof_menu_page.php' );
  46. }
  47. if ( $g_global_profiles ) {
  48. $t_user_id = ALL_USERS;
  49. } else {
  50. $t_user_id = auth_get_current_user_id();
  51. }
  52. # Add Profile Form BEGIN
  53. ?>
  54. <br />
  55. <div align="center">
  56. <form method="post" action="account_prof_update.php">
  57. <?php echo form_security_field( 'profile_update' )?>
  58. <input type="hidden" name="action" value="add" />
  59. <table class="width75" cellspacing="1">
  60. <tr>
  61. <td class="form-title">
  62. <input type="hidden" name="user_id" value="<?php echo $t_user_id ?>" />
  63. <?php echo lang_get( 'add_profile_title' ) ?>
  64. </td>
  65. <td class="right">
  66. <?php
  67. if ( !$g_global_profiles ) {
  68. print_account_menu( 'account_prof_menu_page.php' );
  69. }
  70. ?>
  71. </td>
  72. </tr>
  73. <tr class="row-1">
  74. <td class="category" width="25%">
  75. <span class="required">*</span><?php echo lang_get( 'platform' ) ?>
  76. </td>
  77. <td width="75%">
  78. <input type="text" name="platform" size="32" maxlength="32" />
  79. </td>
  80. </tr>
  81. <tr class="row-2">
  82. <td class="category">
  83. <span class="required">*</span><?php echo lang_get( 'operating_system' ) ?>
  84. </td>
  85. <td>
  86. <input type="text" name="os" size="32" maxlength="32" />
  87. </td>
  88. </tr>
  89. <tr class="row-1">
  90. <td class="category">
  91. <span class="required">*</span><?php echo lang_get( 'os_version' ) ?>
  92. </td>
  93. <td>
  94. <input type="text" name="os_build" size="16" maxlength="16" />
  95. </td>
  96. </tr>
  97. <tr class="row-2">
  98. <td class="category">
  99. <?php echo lang_get( 'additional_description' ) ?>
  100. </td>
  101. <td>
  102. <textarea name="description" cols="60" rows="8"></textarea>
  103. </td>
  104. </tr>
  105. <tr>
  106. <td class="left">
  107. <span class="required"> * <?php echo lang_get( 'required' ) ?></span>
  108. </td>
  109. <td class="center">
  110. <input type="submit" class="button" value="<?php echo lang_get( 'add_profile_button' ) ?>" />
  111. </td>
  112. </tr>
  113. </table>
  114. </form>
  115. </div>
  116. <?php
  117. # Add Profile Form END
  118. # Edit or Delete Profile Form BEGIN
  119. $t_profiles = profile_get_all_for_user( $t_user_id );
  120. if( $t_profiles ) {
  121. ?>
  122. <br />
  123. <div align="center">
  124. <form method="post" action="account_prof_update.php">
  125. <?php echo form_security_field( 'profile_update' )?>
  126. <table class="width75" cellspacing="1">
  127. <tr>
  128. <td class="form-title" colspan="2">
  129. <?php echo lang_get( 'edit_or_delete_profiles_title' ) ?>
  130. </td>
  131. </tr>
  132. <tr class="row-1">
  133. <td class="center" colspan="2">
  134. <input type="radio" name="action" value="edit" checked="checked" /> <?php echo lang_get( 'edit_profile' ) ?>
  135. <?php
  136. if ( !$g_global_profiles ) {
  137. ?>
  138. <input type="radio" name="action" value="make_default" /> <?php echo lang_get( 'make_default' ) ?>
  139. <?php
  140. }
  141. ?>
  142. <input type="radio" name="action" value="delete" /> <?php echo lang_get( 'delete_profile' ) ?>
  143. </td>
  144. </tr>
  145. <tr class="row-2">
  146. <td class="category" width="25%">
  147. <?php echo lang_get( 'select_profile' ) ?>
  148. </td>
  149. <td width="75%">
  150. <select name="profile_id">
  151. <?php print_profile_option_list( $t_user_id, '', $t_profiles ) ?>
  152. </select>
  153. </td>
  154. </tr>
  155. <tr>
  156. <td class="center" colspan="2">
  157. <input type="submit" class="button" value="<?php echo lang_get( 'submit_button' ) ?>" />
  158. </td>
  159. </tr>
  160. </table>
  161. </form>
  162. </div>
  163. <?php
  164. } # Edit or Delete Profile Form END
  165. html_page_bottom();