This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * Copyright (c) Enalean, 2014. All rights reserved |
||
4 | * |
||
5 | * This file is a part of Tuleap. |
||
6 | * |
||
7 | * Tuleap is free software; you can redistribute it and/or modify |
||
8 | * it under the terms of the GNU General Public License as published by |
||
9 | * the Free Software Foundation; either version 2 of the License, or |
||
10 | * (at your option) any later version. |
||
11 | * |
||
12 | * Tuleap is distributed in the hope that it will be useful, |
||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
15 | * GNU General Public License for more details. |
||
16 | * |
||
17 | * You should have received a copy of the GNU General Public License |
||
18 | * along with Tuleap. If not, see <http://www.gnu.org/licenses/ |
||
19 | */ |
||
20 | |||
21 | require_once 'pre.php'; |
||
22 | |||
23 | session_require(array('isloggedin'=>'1')); |
||
24 | |||
25 | $em = EventManager::instance(); |
||
26 | $um = UserManager::instance(); |
||
27 | |||
28 | $user = $um->getCurrentUser(); |
||
29 | |||
30 | $third_paty_html = ''; |
||
31 | $can_change_password = true; |
||
32 | $can_change_realname = true; |
||
33 | $can_change_email = true; |
||
34 | $extra_user_info = array(); |
||
35 | $ssh_keys_extra_html = ''; |
||
36 | |||
37 | $em->processEvent( |
||
38 | Event::MANAGE_THIRD_PARTY_APPS, |
||
39 | array( |
||
40 | 'user' => $user, |
||
41 | 'html' => &$third_paty_html |
||
42 | ) |
||
43 | ); |
||
44 | |||
45 | $em->processEvent( |
||
46 | 'display_change_password', |
||
47 | array( |
||
48 | 'allow' => &$can_change_password |
||
49 | ) |
||
50 | ); |
||
51 | |||
52 | $em->processEvent( |
||
53 | 'display_change_realname', |
||
54 | array( |
||
55 | 'allow' => &$can_change_realname |
||
56 | ) |
||
57 | ); |
||
58 | |||
59 | $em->processEvent( |
||
60 | 'display_change_email', |
||
61 | array( |
||
62 | 'allow' => &$can_change_email |
||
63 | ) |
||
64 | ); |
||
65 | |||
66 | $em->processEvent( |
||
67 | 'account_pi_entry', |
||
68 | array( |
||
69 | 'user' => $user, |
||
70 | 'user_info' => &$extra_user_info, |
||
71 | ) |
||
72 | ); |
||
73 | |||
74 | $em->processEvent( |
||
75 | Event::LIST_SSH_KEYS, |
||
76 | array( |
||
77 | 'user' => $user, |
||
78 | 'html' => &$ssh_keys_extra_html |
||
79 | ) |
||
80 | ); |
||
81 | |||
82 | $csrf = new CSRFSynchronizerToken('/account/index.php'); |
||
83 | $mail_manager = new MailManager(); |
||
84 | $tracker_formats = array(); |
||
85 | |||
86 | foreach ($mail_manager->getAllMailFormats() as $format) { |
||
87 | $tracker_formats[] = array( |
||
88 | 'format' => $format, |
||
89 | 'is_selected' => $format === $mail_manager->getMailPreferencesByUser($user) |
||
90 | ); |
||
91 | } |
||
92 | |||
93 | $all_themes = array(); |
||
94 | $themes = util_get_theme_list(); |
||
95 | natcasesort($themes); |
||
96 | |||
97 | foreach ($themes as $theme) { |
||
98 | $is_default = $theme === $GLOBALS['sys_themedefault']; |
||
99 | $is_selected = $is_default; |
||
100 | if ($user->getTheme()) { |
||
101 | $is_selected = $theme === $user->getTheme(); |
||
102 | } |
||
103 | |||
104 | $all_themes[] = array( |
||
105 | 'theme_name' => $theme, |
||
106 | 'is_selected' => $is_selected, |
||
107 | 'is_default' => $is_default |
||
108 | ); |
||
109 | } |
||
110 | |||
111 | $languages_html = array(); |
||
112 | foreach($GLOBALS['Language']->getLanguages() as $code => $lang) { |
||
113 | $languages_html[] = array( |
||
114 | 'lang' => $lang, |
||
115 | 'code' => $code, |
||
116 | 'is_selected' => $user->getLocale() === $code |
||
117 | ); |
||
118 | } |
||
119 | |||
120 | $user_helper_preferences = array( |
||
121 | array( |
||
122 | 'preference_name' => UserHelper::PREFERENCES_NAME_AND_LOGIN, |
||
123 | 'preference_label' => $Language->getText('account_options','tuleap_name_and_login'), |
||
124 | 'is_selected' => (int) user_get_preference("username_display") === UserHelper::PREFERENCES_NAME_AND_LOGIN |
||
125 | ), |
||
126 | array( |
||
127 | 'preference_name' => UserHelper::PREFERENCES_LOGIN_AND_NAME, |
||
128 | 'preference_label' => $Language->getText('account_options','tuleap_login_and_name'), |
||
129 | 'is_selected' => (int) user_get_preference("username_display") === UserHelper::PREFERENCES_LOGIN_AND_NAME |
||
130 | ), |
||
131 | array( |
||
132 | 'preference_name' => UserHelper::PREFERENCES_LOGIN, |
||
133 | 'preference_label' => $Language->getText('account_options','tuleap_login'), |
||
134 | 'is_selected' => (int) user_get_preference("username_display") === UserHelper::PREFERENCES_LOGIN |
||
135 | ), |
||
136 | array( |
||
137 | 'preference_name' => UserHelper::PREFERENCES_REAL_NAME, |
||
138 | 'preference_label' => $Language->getText('account_options','real_name'), |
||
139 | 'is_selected' => (int) user_get_preference("username_display") === UserHelper::PREFERENCES_REAL_NAME |
||
140 | ) |
||
141 | ); |
||
142 | |||
143 | $plugins_prefs = array(); |
||
144 | $em->processEvent( |
||
145 | 'user_preferences_appearance', |
||
146 | array('preferences' => &$plugins_prefs) |
||
147 | ); |
||
148 | |||
149 | $all_csv_separator = array(); |
||
150 | |||
151 | foreach (PFUser::$csv_separators as $separator) { |
||
152 | $all_csv_separator[] = array( |
||
153 | 'separator_name' => $separator, |
||
154 | 'separator_label' => $Language->getText('account_options', $separator), |
||
155 | 'is_selected' => $separator === user_get_preference("user_csv_separator") |
||
156 | ); |
||
157 | } |
||
158 | |||
159 | $all_csv_dateformat = array(); |
||
160 | |||
161 | foreach (PFUser::$csv_dateformats as $dateformat) { |
||
162 | $all_csv_dateformat[] = array( |
||
163 | 'dateformat_name' => $dateformat, |
||
164 | 'dateformat_label' => $Language->getText('account_preferences', $dateformat), |
||
165 | 'is_selected' => $dateformat === user_get_preference("user_csv_dateformat") |
||
166 | ); |
||
167 | } |
||
168 | |||
169 | $user_access_info = $um->getUserAccessInfo($user); |
||
170 | if (! $user_access_info) { |
||
0 ignored issues
–
show
|
|||
171 | $user_access_info = array( |
||
172 | 'last_auth_success' => false, |
||
173 | 'last_auth_failure' => false, |
||
174 | 'nb_auth_failure' => false, |
||
175 | 'prev_auth_success' => false, |
||
176 | ); |
||
177 | } |
||
178 | |||
179 | $svn_token_handler = new SVN_TokenHandler( |
||
180 | new SVN_TokenDao(), |
||
181 | new RandomNumberGenerator(), |
||
182 | PasswordHandlerFactory::getPasswordHandler() |
||
183 | ); |
||
184 | $svn_token_presenters = array(); |
||
185 | foreach($svn_token_handler->getSVNTokensForUser($user) as $user_svn_token) { |
||
186 | $svn_token_presenters[] = new SVN_TokenPresenter($user_svn_token); |
||
187 | } |
||
188 | |||
189 | $last_svn_token = ''; |
||
190 | if (isset($_SESSION['last_svn_token'])) { |
||
191 | $last_svn_token = $_SESSION['last_svn_token']; |
||
192 | unset($_SESSION['last_svn_token']); |
||
193 | } |
||
194 | |||
195 | $presenter = new User_PreferencesPresenter( |
||
196 | $user, |
||
197 | $can_change_realname, |
||
198 | $can_change_email, |
||
199 | $can_change_password, |
||
200 | $extra_user_info, |
||
201 | $user_access_info, |
||
202 | $ssh_keys_extra_html, |
||
203 | $svn_token_presenters, |
||
204 | $third_paty_html, |
||
205 | $csrf->fetchHTMLInput(), |
||
206 | $tracker_formats, |
||
207 | $all_themes, |
||
208 | $languages_html, |
||
209 | $user_helper_preferences, |
||
210 | $plugins_prefs, |
||
211 | $all_csv_separator, |
||
212 | $all_csv_dateformat, |
||
213 | $last_svn_token |
||
214 | ); |
||
215 | |||
216 | $HTML->header(array( |
||
217 | 'title' => $Language->getText('account_options', 'title'), |
||
218 | 'body_class' => array('account-maintenance') |
||
219 | ) |
||
220 | ); |
||
221 | |||
222 | $renderer = TemplateRendererFactory::build()->getRenderer(dirname(__FILE__).'/../../templates/user'); |
||
223 | $renderer->renderToPage('account-maintenance', $presenter); |
||
224 | |||
225 | $HTML->footer(array()); |
||
226 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.