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) STMicroelectronics, 2005. All Rights Reserved. |
||
4 | * |
||
5 | * Originally written by Manuel Vacelet, 2005 |
||
6 | * |
||
7 | * This file is a part of Codendi. |
||
8 | * |
||
9 | * Codendi is free software; you can redistribute it and/or modify |
||
10 | * it under the terms of the GNU General Public License as published by |
||
11 | * the Free Software Foundation; either version 2 of the License, or |
||
12 | * (at your option) any later version. |
||
13 | * |
||
14 | * Codendi is distributed in the hope that it will be useful, |
||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
17 | * GNU General Public License for more details. |
||
18 | * |
||
19 | * You should have received a copy of the GNU General Public License |
||
20 | * along with Codendi; if not, write to the Free Software |
||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
22 | * |
||
23 | * |
||
24 | */ |
||
25 | |||
26 | // This screen is a part of the "hidden" registeration process under Codendi when |
||
27 | // LDAP is enabled. |
||
28 | // In this case, there is no more "Create new account" for new users but the |
||
29 | // login process automaticaly create new account when: |
||
30 | // * given user exist in LDAP |
||
31 | // * this user is authenticated against the LDAP |
||
32 | // * corresponding codendi account do not exist: |
||
33 | // * imply codendi username not exist |
||
34 | // * imply ldap_name not already in DB |
||
35 | |||
36 | require_once('pre.php'); |
||
37 | require_once('timezones.php'); |
||
38 | require_once('account.php'); |
||
39 | require_once('../include/LDAP_UserManager.class.php'); |
||
40 | require_once('common/valid/ValidFactory.class.php'); |
||
41 | |||
42 | $hp = Codendi_HTMLPurifier::instance(); |
||
43 | |||
44 | function welcome_exit_error($title,$text) { |
||
45 | global $HTML,$Language,$pv; |
||
46 | $GLOBALS['feedback'] .= $title; |
||
47 | if (isset($pv) && $pv == 2) |
||
48 | $HTML->pv_header(array()); |
||
49 | else site_header(array('title'=>$Language->getText('include_exit','exit_error'), |
||
50 | 'registeration_process' => true)); |
||
51 | echo '<p>',$text,'</p>'; |
||
52 | (isset($pv) && $pv == 2) ? $HTML->pv_footer(array()) : $HTML->footer(array('showfeedback' => false)); |
||
53 | exit; |
||
0 ignored issues
–
show
|
|||
54 | } |
||
55 | |||
56 | // LDAP plugin enabled |
||
57 | $pluginManager = PluginManager::instance(); |
||
58 | $ldapPlugin = $pluginManager->getPluginByName('ldap'); |
||
59 | if (!$ldapPlugin || !$pluginManager->isPluginAvailable($ldapPlugin)) { |
||
60 | $GLOBALS['Response']->redirect('/my'); |
||
61 | } |
||
62 | |||
63 | |||
64 | $um = UserManager::instance(); |
||
65 | $currentUser = $um->getCurrentUser(); |
||
66 | $user_id = $currentUser->getId(); |
||
67 | |||
68 | if($request->isPost() && $request->existAndNonEmpty('action')) { |
||
69 | if(!is_valid_timezone($request->get('timezone'))) { |
||
70 | welcome_exit_error($Language->getText('plugin_ldap', 'welcome_error_up'), |
||
71 | $Language->getText('plugin_ldap', 'welcome_err_notz')); |
||
72 | } |
||
73 | |||
74 | $mailSite = 0; |
||
75 | $vMailSite = new Valid_WhiteList('form_mail_site', array('1')); |
||
76 | $vMailSite->required(); |
||
77 | if($request->valid($vMailSite)) { |
||
78 | $mailSite = 1; |
||
79 | } |
||
80 | |||
81 | $mailVa = 0; |
||
82 | $vMailVa = new Valid_WhiteList('form_mail_va', array('1')); |
||
83 | $vMailVa->required(); |
||
84 | if($request->valid($vMailVa)) { |
||
85 | $mailVa = 1; |
||
86 | } |
||
87 | |||
88 | if ($currentUser) { |
||
89 | $currentUser->setTimezone($timezone); |
||
90 | $currentUser->setMailVA($mailVa); |
||
91 | $currentUser->setMailSiteUpdates($mailSite); |
||
92 | $currentUser->setUnixStatus('A'); |
||
93 | if ($um->updateDb($currentUser)) { |
||
94 | $ldapUserDao = new LDAP_UserDao(CodendiDataAccess::instance()); |
||
95 | $ldapUserDao->setLoginDate($user_id, $_SERVER['REQUEST_TIME']); |
||
96 | } else { |
||
97 | welcome_exit_error($Language->getText('plugin_ldap', 'welcome_error_up'), |
||
98 | $Language->getText('plugin_ldap', 'welcome_error_up_expl', array(''))); |
||
99 | } |
||
100 | } |
||
101 | account_redirect_after_login(); |
||
102 | } |
||
103 | else { |
||
104 | $pv = 0; |
||
105 | $vPv = new Valid_Pv(); |
||
106 | if($request->valid($vPv)) { |
||
107 | $pv = $request->get('pv'); |
||
108 | } |
||
109 | $timezone = $request->get('timezone'); |
||
110 | |||
111 | $ldapUm = $ldapPlugin->getLdapUserManager(); |
||
112 | $lr = $ldapUm->getLdapFromUserId($user_id); |
||
113 | $ldap_name = $lr->getLogin(); |
||
114 | |||
115 | $star = '<span class="highlight"><big>*</big></span>'; |
||
116 | |||
117 | if ($pv == 2) { |
||
118 | $HTML->pv_header(array()); |
||
119 | } else { |
||
120 | $HTML->header(array('title'=>$Language->getText('plugin_ldap', 'welcome_title', array($lr->getCommonName())), |
||
121 | 'registeration_process' => true)); |
||
122 | } |
||
123 | |||
124 | print '<h2>'; |
||
125 | print $Language->getText('plugin_ldap', 'welcome_title', array($lr->getCommonName())); |
||
126 | print '</h2>'; |
||
127 | |||
128 | print '<h3>'; |
||
129 | print $Language->getText('plugin_ldap', 'welcome_first_login', array($GLOBALS['sys_name'])); |
||
130 | print '</h3>'; |
||
131 | |||
132 | print '<p>'.$Language->getText('plugin_ldap', 'welcome_fill_form', array($GLOBALS['sys_name'])).'</p>'; |
||
133 | |||
134 | print '<fieldset>'; |
||
135 | |||
136 | print '<legend>'.$Language->getText('plugin_ldap', 'welcome_preferences').'</legend>'; |
||
137 | |||
138 | $return_to = ''; |
||
139 | $vReturnTo = new Valid_String('return_to'); |
||
140 | $vReturnTo->required(); |
||
141 | if($request->valid($vReturnTo)) { |
||
142 | $return_to = trim($request->get('return_to')); |
||
143 | } |
||
144 | |||
145 | print ' |
||
146 | <form name="welcome" action="'.$ldapPlugin->getPluginPath().'/welcome.php" method="post"> |
||
147 | <input type="hidden" name="return_to" value="'. $hp->purify($return_to, CODENDI_PURIFIER_CONVERT_HTML) .'"> |
||
148 | <input type="hidden" name="action" value="update_reg"> |
||
149 | <input type="hidden" name="pv" value="'.$pv.'"> |
||
150 | |||
151 | <p>'.$star.' '.$Language->getText('plugin_ldap', 'welcome_tz').':'; |
||
152 | |||
153 | echo html_get_timezone_popup($timezone); |
||
154 | |||
155 | print '</p> |
||
156 | <p><input type="checkbox" name="form_mail_site" value="1" checked />'.$Language->getText('plugin_ldap', 'welcome_siteupdate'); |
||
157 | |||
158 | print '</p> |
||
159 | <p><input type="checkbox" name="form_mail_va" value="1" />'.$Language->getText('plugin_ldap', 'welcome_communitymail').'</p>'; |
||
160 | |||
161 | print '<p>'.$Language->getText('plugin_ldap', 'welcome_mandatory', array($star)).'</p>'; |
||
162 | |||
163 | print '<p><input type="submit" name="update_reg" value="'.$Language->getText('plugin_ldap', 'welcome_btn_update').'"></p>'; |
||
164 | print '</fieldset>'; |
||
165 | |||
166 | print '<fieldset>'; |
||
167 | print '<legend>'.$Language->getText('plugin_ldap', 'welcome_your_data', array($GLOBALS['sys_org_name'])).'</legend>'; |
||
168 | |||
169 | print '<table> |
||
170 | <tr> |
||
171 | <td>'.$Language->getText('plugin_ldap', 'welcome_ldap_login').'</td> |
||
172 | <td><strong>'.$ldap_name.'</strong></td> |
||
173 | </tr> |
||
174 | <tr> |
||
175 | <td>'.$Language->getText('plugin_ldap', 'welcome_email').'</td> |
||
176 | <td><strong>'.$currentUser->getEmail().'</strong></td> |
||
177 | </tr> |
||
178 | <tr> |
||
179 | <td>'.$Language->getText('plugin_ldap', 'welcome_codendi_login', array($GLOBALS['sys_name'])).'</td> |
||
180 | <td>'.$currentUser->getUserName().'<br> |
||
181 | '.$Language->getText('plugin_ldap', 'welcome_codendi_login_j', array($GLOBALS['sys_name'])).' |
||
182 | </td> |
||
183 | </tr> |
||
184 | </table>'; |
||
185 | |||
186 | print '</fieldset>'; |
||
187 | |||
188 | ($pv == 2) ? $HTML->pv_footer(array()) : $HTML->footer(array()); |
||
189 | } |
||
190 | ?> |
An exit expression should only be used in rare cases. For example, if you write a short command line script.
In most cases however, using an
exit
expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.