Fix #12795 : Handle the 'user_id' property of attachments
[mantis.git] / login_select_proj_page.php
blobd7aa6cb5c354bd590010741911b0a16817853249
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 * Allows the user to select a project that is visible to him
20 * @package MantisBT
21 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
22 * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net
23 * @link http://www.mantisbt.org
25 * @uses core.php
26 * @uses authentication_api.php
27 * @uses constant_inc.php
28 * @uses current_user_api.php
29 * @uses gpc_api.php
30 * @uses html_api.php
31 * @uses lang_api.php
32 * @uses print_api.php
33 * @uses string_api.php
36 /**
37 * MantisBT Core API's
39 require_once( 'core.php' );
40 require_api( 'authentication_api.php' );
41 require_api( 'constant_inc.php' );
42 require_api( 'current_user_api.php' );
43 require_api( 'gpc_api.php' );
44 require_api( 'html_api.php' );
45 require_api( 'lang_api.php' );
46 require_api( 'print_api.php' );
47 require_api( 'string_api.php' );
49 auth_ensure_user_authenticated();
51 $f_ref = string_sanitize_url( gpc_get_string( 'ref', '' ) );
53 if ( count( current_user_get_accessible_projects() ) == 1) {
54 $t_project_ids = current_user_get_accessible_projects();
55 $t_project_id = (int) $t_project_ids[0];
56 if ( count( current_user_get_accessible_subprojects( $t_project_id ) ) == 0 ) {
57 $t_ref_urlencoded = string_url( $f_ref );
58 print_header_redirect( "set_project.php?project_id=$t_project_id&ref=$t_ref_urlencoded", true);
59 /* print_header_redirect terminates script execution */
63 html_page_top( lang_get( 'select_project_button' ) );
66 <!-- Project Select Form BEGIN -->
67 <div id="select-project-div" class="form-container">
68 <form id="select-project-form" method="post" action="set_project.php">
69 <?php # CSRF protection not required here - form does not result in modifications ?>
70 <fieldset>
71 <legend><span><?php echo lang_get( 'choose_project' ) ?></span></legend>
72 <input type="hidden" name="ref" value="<?php echo string_html_specialchars( $f_ref ) ?>" />
73 <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
74 <label for="select-project-id"><span><?php echo lang_get( 'select_project_button' ) ?></span></label>
75 <span class="select">
76 <select id="select-project-id" name="project_id">
77 <?php print_project_option_list( ALL_PROJECTS, false, null, true ) ?>
78 </select>
79 </span>
80 <span class="label-style"></span>
81 </div>
82 <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
83 <label for="set-default"><span><?php echo lang_get( 'make_default' ) ?></span></label>
84 <span class="checkbox"><input id="set-default" type="checkbox" name="make_default" /></span>
85 <span class="label-style"></span>
86 </div>
87 <span class="submit-button"><input type="submit" class="button" value="<?php echo lang_get( 'select_project_button') ?>" /></span>
88 </fieldset>
89 </form>
90 </div>
92 <?php
93 html_page_bottom();