Issue #10730: Use crypto_api for generating nonces and improve hashing
[mantis/radio.git] / account_prof_menu_page.php
blob759dbfbbf24dfd1d30bd3c294773e23d2008e65a
1 <?php
2 # MantisBT - A PHP based bugtracking system
4 # MantisBT is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 2 of the License, or
7 # (at your option) any later version.
9 # MantisBT is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
17 /**
18 * This page allows users to add a new profile which is POSTed to
19 * account_prof_add.php
21 * Users can also manage their profiles
23 * @package MantisBT
24 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
25 * @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
26 * @link http://www.mantisbt.org
28 * @uses core.php
29 * @uses access_api.php
30 * @uses authentication_api.php
31 * @uses config_api.php
32 * @uses constant_inc.php
33 * @uses current_user_api.php
34 * @uses form_api.php
35 * @uses html_api.php
36 * @uses lang_api.php
37 * @uses print_api.php
38 * @uses profile_api.php
41 require_once( 'core.php' );
42 require_api( 'access_api.php' );
43 require_api( 'authentication_api.php' );
44 require_api( 'config_api.php' );
45 require_api( 'constant_inc.php' );
46 require_api( 'current_user_api.php' );
47 require_api( 'form_api.php' );
48 require_api( 'html_api.php' );
49 require_api( 'lang_api.php' );
50 require_api( 'print_api.php' );
51 require_api( 'profile_api.php' );
53 if ( isset( $g_global_profiles ) ) {
54 $g_global_profiles = true;
55 } else {
56 $g_global_profiles = false;
59 auth_ensure_user_authenticated();
61 current_user_ensure_unprotected();
63 if ( $g_global_profiles ) {
64 access_ensure_global_level( config_get( 'manage_global_profile_threshold' ) );
65 } else {
66 access_ensure_global_level( config_get( 'add_profile_threshold' ) );
69 html_page_top( lang_get( 'manage_profiles_link' ) );
71 if ( $g_global_profiles ) {
72 print_manage_menu( 'manage_prof_menu_page.php' );
75 if ( $g_global_profiles ) {
76 $t_user_id = ALL_USERS;
77 } else {
78 $t_user_id = auth_get_current_user_id();
81 # Add Profile Form BEGIN
83 <br />
84 <div align="center">
85 <form method="post" action="account_prof_update.php">
86 <?php echo form_security_field( 'profile_update' )?>
87 <input type="hidden" name="action" value="add" />
88 <table class="width75" cellspacing="1">
89 <tr>
90 <td class="form-title">
91 <input type="hidden" name="user_id" value="<?php echo $t_user_id ?>" />
92 <?php echo lang_get( 'add_profile_title' ) ?>
93 </td>
94 <td class="right">
95 <?php
96 if ( !$g_global_profiles ) {
97 print_account_menu( 'account_prof_menu_page.php' );
100 </td>
101 </tr>
102 <tr class="row-1">
103 <td class="category" width="25%">
104 <span class="required">*</span><?php echo lang_get( 'platform' ) ?>
105 </td>
106 <td width="75%">
107 <input type="text" name="platform" size="32" maxlength="32" />
108 </td>
109 </tr>
110 <tr class="row-2">
111 <td class="category">
112 <span class="required">*</span><?php echo lang_get( 'operating_system' ) ?>
113 </td>
114 <td>
115 <input type="text" name="os" size="32" maxlength="32" />
116 </td>
117 </tr>
118 <tr class="row-1">
119 <td class="category">
120 <span class="required">*</span><?php echo lang_get( 'os_version' ) ?>
121 </td>
122 <td>
123 <input type="text" name="os_build" size="16" maxlength="16" />
124 </td>
125 </tr>
126 <tr class="row-2">
127 <td class="category">
128 <?php echo lang_get( 'additional_description' ) ?>
129 </td>
130 <td>
131 <textarea name="description" cols="60" rows="8"></textarea>
132 </td>
133 </tr>
134 <tr>
135 <td class="left">
136 <span class="required"> * <?php echo lang_get( 'required' ) ?></span>
137 </td>
138 <td class="center">
139 <input type="submit" class="button" value="<?php echo lang_get( 'add_profile_button' ) ?>" />
140 </td>
141 </tr>
142 </table>
143 </form>
144 </div>
145 <?php
146 # Add Profile Form END
147 # Edit or Delete Profile Form BEGIN
149 $t_profiles = profile_get_all_for_user( $t_user_id );
150 if( $t_profiles ) {
152 <br />
153 <div align="center">
154 <form method="post" action="account_prof_update.php">
155 <?php echo form_security_field( 'profile_update' )?>
156 <table class="width75" cellspacing="1">
157 <tr>
158 <td class="form-title" colspan="2">
159 <?php echo lang_get( 'edit_or_delete_profiles_title' ) ?>
160 </td>
161 </tr>
162 <tr class="row-1">
163 <td class="center" colspan="2">
164 <input type="radio" name="action" value="edit" checked="checked" /> <?php echo lang_get( 'edit_profile' ) ?>
165 <?php
166 if ( !$g_global_profiles ) {
168 <input type="radio" name="action" value="make_default" /> <?php echo lang_get( 'make_default' ) ?>
169 <?php
172 <input type="radio" name="action" value="delete" /> <?php echo lang_get( 'delete_profile' ) ?>
173 </td>
174 </tr>
175 <tr class="row-2">
176 <td class="category" width="25%">
177 <?php echo lang_get( 'select_profile' ) ?>
178 </td>
179 <td width="75%">
180 <select name="profile_id">
181 <?php print_profile_option_list( $t_user_id, '', $t_profiles ) ?>
182 </select>
183 </td>
184 </tr>
185 <tr>
186 <td class="center" colspan="2">
187 <input type="submit" class="button" value="<?php echo lang_get( 'submit_button' ) ?>" />
188 </td>
189 </tr>
190 </table>
191 </form>
192 </div>
193 <?php
194 } # Edit or Delete Profile Form END
196 html_page_bottom();