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 | * OVIDENTIA http://www.ovidentia.org * |
||
4 | ************************************************************************ |
||
5 | * Copyright (c) 2003 by CANTICO ( http://www.cantico.fr ) * |
||
6 | * * |
||
7 | * This file is part of Ovidentia. * |
||
8 | * * |
||
9 | * Ovidentia 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, or (at your option) * |
||
12 | * any later version. * |
||
13 | * * |
||
14 | * This program is distributed in the hope that it will be useful, but * |
||
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of * |
||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * |
||
17 | * See the GNU General Public License for more details. * |
||
18 | * * |
||
19 | * You should have received a copy of the GNU General Public License * |
||
20 | * along with this program; if not, write to the Free Software * |
||
21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,* |
||
22 | * USA. * |
||
23 | ************************************************************************/ |
||
24 | |||
25 | include_once dirname(__FILE__).'/functions.php'; |
||
26 | require_once dirname(__FILE__).'/utilit/options.ui.php'; |
||
27 | |||
28 | |||
29 | |||
30 | |||
31 | function vacationOptions() |
||
32 | { |
||
33 | require_once $GLOBALS['babInstallPath'].'admin/acl.php'; |
||
34 | $W = bab_Widgets(); |
||
35 | $page = $W->BabPage(); |
||
36 | |||
37 | |||
38 | |||
39 | if (isset($_POST['options'])) |
||
40 | { |
||
41 | |||
42 | if( isset($_POST['options']['save'] )) |
||
43 | { |
||
44 | $values = $_POST['options']; |
||
45 | record_options($values); |
||
46 | |||
47 | aclSetRightsString('absences_managers_groups', 1, $values['managers']); |
||
48 | aclSetRightsString('absences_public_planning_groups', 1, $values['public_planning']); |
||
49 | } |
||
50 | } |
||
51 | |||
52 | |||
53 | |||
54 | $editor = new absences_OptionsEditor(); |
||
55 | |||
56 | $page->setTitle(absences_translate('Vacations options')); |
||
57 | $page->addItem($editor); |
||
58 | $page->displayHtml(); |
||
59 | } |
||
60 | |||
61 | |||
62 | |||
63 | |||
64 | |||
65 | |||
66 | function record_options($values) { |
||
67 | global $babDB; |
||
68 | |||
69 | if (!isset($values['id_chart'])) |
||
70 | { |
||
71 | $values['id_chart'] = 0; |
||
72 | } |
||
73 | |||
74 | |||
75 | list($n) = $babDB->db_fetch_array($babDB->db_query("SELECT COUNT(*) FROM absences_options")); |
||
76 | if ($n > 0) { |
||
77 | |||
78 | $babDB->db_query(' |
||
79 | UPDATE absences_options |
||
80 | |||
81 | SET chart_superiors_create_request = ' . $babDB->quote($values['chart_superiors_create_request']) . ', |
||
82 | chart_superiors_set_rights = ' . $babDB->quote($values['chart_superiors_set_rights']) . ', |
||
83 | chart_superiors_user_edit = ' . $babDB->quote($values['chart_superiors_user_edit']) . ', |
||
84 | allow_mismatch = ' . $babDB->quote($values['allow_mismatch']).' , |
||
85 | workperiod_recover_request = '.$babDB->quote($values['workperiod_recover_request']).' , |
||
86 | display_personal_history = '.$babDB->quote($values['display_personal_history']).' , |
||
87 | modify_confirmed = '.$babDB->quote($values['modify_confirmed']).' , |
||
88 | modify_waiting = '.$babDB->quote($values['modify_waiting']).' , |
||
89 | email_manager_ondelete = '.$babDB->quote($values['email_manager_ondelete']).' , |
||
90 | approb_email_defer = '.$babDB->quote($values['approb_email_defer']).' , |
||
91 | entity_planning = '.$babDB->quote($values['entity_planning']).', |
||
92 | entity_planning_display_types = '.$babDB->quote($values['entity_planning_display_types']).', |
||
93 | approb_alert = '.$babDB->quote($values['approb_alert']).', |
||
94 | auto_approval = '.$babDB->quote($values['auto_approval']).', |
||
95 | auto_confirm = '.$babDB->quote($values['auto_confirm']).', |
||
96 | sync_server = '.$babDB->quote($values['sync_server']).', |
||
97 | sync_url = '.$babDB->quote($values['sync_url']).', |
||
98 | sync_nickname = '.$babDB->quote($values['sync_nickname']).', |
||
99 | sync_password = '.$babDB->quote($values['sync_password']).', |
||
100 | id_chart = '.$babDB->quote($values['id_chart']).', |
||
101 | user_add_email = '.$babDB->quote($values['user_add_email']).', |
||
102 | end_recup = '.$babDB->quote($values['end_recup']).', |
||
103 | delay_recovery = '.$babDB->quote($values['delay_recovery']).', |
||
104 | maintenance = '.$babDB->quote($values['maintenance']).', |
||
105 | archivage_day = '.$babDB->quote($values['archivage_day']).', |
||
106 | archivage_month = '.$babDB->quote($values['archivage_month']).', |
||
107 | appliquant_email = '.$babDB->quote($values['appliquant_email']) .', |
||
108 | organization_sync = '.$babDB->quote($values['organization_sync']) |
||
109 | |||
110 | ); |
||
111 | } else { |
||
112 | $babDB->db_query(' |
||
113 | |||
114 | INSERT INTO absences_options ( |
||
115 | chart_superiors_create_request, |
||
116 | chart_superiors_set_rights, |
||
117 | chart_superiors_user_edit, |
||
118 | allow_mismatch, |
||
119 | workperiod_recover_request, |
||
120 | display_personal_history, |
||
121 | modify_confirmed, |
||
122 | modify_waiting, |
||
123 | email_manager_ondelete, |
||
124 | approb_email_defer, |
||
125 | entity_planning, |
||
126 | entity_planning_display_types, |
||
127 | approb_alert, |
||
128 | auto_approval, |
||
129 | auto_confirm, |
||
130 | sync_server, |
||
131 | sync_url, |
||
132 | sync_nickname, |
||
133 | sync_password, |
||
134 | id_chart, |
||
135 | user_add_email, |
||
136 | end_recup, |
||
137 | delay_recovery, |
||
138 | maintenance, |
||
139 | archivage_day, |
||
140 | archivage_month, |
||
141 | appliquant_email, |
||
142 | organization_sync |
||
143 | ) |
||
144 | VALUES ( |
||
145 | ' . $babDB->quote($values['chart_superiors_create_request']) . ', |
||
146 | ' . $babDB->quote($values['chart_superiors_set_rights']) . ', |
||
147 | ' . $babDB->quote($values['chart_superiors_user_edit']) . ', |
||
148 | ' . $babDB->quote($values['allow_mismatch']) . ', |
||
149 | ' . $babDB->quote($values['workperiod_recover_request']) . ', |
||
150 | ' . $babDB->quote($values['display_personal_history']). ', |
||
151 | ' . $babDB->quote($values['modify_confirmed']). ', |
||
152 | ' . $babDB->quote($values['modify_waiting']). ', |
||
153 | ' . $babDB->quote($values['email_manager_ondelete']). ', |
||
154 | ' . $babDB->quote($values['approb_email_defer']). ', |
||
155 | ' . $babDB->quote($values['entity_planning']). ', |
||
156 | ' . $babDB->quote($values['entity_planning_display_types']). ', |
||
157 | ' . $babDB->quote($values['approb_alert']). ', |
||
158 | ' . $babDB->quote($values['auto_approval']). ', |
||
159 | ' . $babDB->quote($values['auto_confirm']). ', |
||
160 | ' . $babDB->quote($values['sync_server']). ', |
||
161 | ' . $babDB->quote($values['sync_url']). ', |
||
162 | ' . $babDB->quote($values['sync_nickname']). ', |
||
163 | ' . $babDB->quote($values['sync_password']). ', |
||
164 | ' . $babDB->quote($values['id_chart']). ', |
||
165 | ' . $babDB->quote($values['user_add_email']). ', |
||
166 | ' . $babDB->quote($values['end_recup']). ', |
||
167 | ' . $babDB->quote($values['delay_recovery']). ', |
||
168 | ' . $babDB->quote($values['maintenance']). ', |
||
169 | ' . $babDB->quote($values['archivage_day']). ', |
||
170 | ' . $babDB->quote($values['archivage_month']). ', |
||
171 | ' . $babDB->quote($values['appliquant_email']). ', |
||
172 | ' . $babDB->quote($values['organization_sync']). ' |
||
173 | )' |
||
174 | ); |
||
175 | } |
||
176 | } |
||
177 | |||
178 | |||
179 | |||
180 | |||
181 | |||
182 | function absences_initOrganizations() |
||
183 | { |
||
184 | $W = bab_Widgets(); |
||
185 | $page = $W->BabPage(null, $W->VBoxLayout()); |
||
186 | $page->setEmbedded(false); |
||
187 | |||
188 | $page->setTitle(absences_translate('Set the personnel members organization field using their directory entries')); |
||
189 | |||
190 | require_once dirname(__FILE__).'/utilit/agent.class.php'; |
||
191 | require_once dirname(__FILE__).'/utilit/organization.class.php'; |
||
192 | |||
193 | // update the organization list |
||
194 | absences_Organization::createFromDirectory(); |
||
195 | |||
196 | $agents = new absences_AgentIterator(); |
||
197 | |||
198 | |||
199 | foreach($agents as $agent) { |
||
200 | // set the associated organization |
||
201 | |||
202 | try { |
||
203 | $agent->setOrganizationFromDirEntry(); |
||
204 | $page->addItem($W->Label(sprintf(absences_translate('%s has been modified'), $agent->getName()))); |
||
205 | } catch (Exception $e) { |
||
206 | |||
207 | $label = $agent->getName().' : '.$e->getMessage(); |
||
208 | |||
209 | if ($link = bab_getUserDirEntryLink($agent->getIdUser())) { |
||
210 | $page->addItem($W->Link($label, $link)->setOpenMode(Widget_Link::OPEN_POPUP)); |
||
211 | } else { |
||
212 | $page->addItem($W->Label($label)); |
||
213 | } |
||
214 | } |
||
215 | } |
||
216 | |||
217 | $page->displayHtml(); |
||
218 | } |
||
219 | |||
220 | |||
221 | |||
222 | |||
223 | /* main */ |
||
224 | bab_requireCredential(); |
||
225 | if( !bab_isUserAdministrator() ) |
||
226 | { |
||
227 | $babBody->title = absences_translate("Access denied"); |
||
228 | return; |
||
229 | } |
||
230 | |||
231 | |||
232 | $idx = bab_rp('idx', 'options'); |
||
233 | |||
234 | |||
235 | |||
236 | |||
237 | |||
238 | View Code Duplication | switch ($idx) { |
|
0 ignored issues
–
show
|
|||
239 | case 'init': |
||
240 | absences_initOrganizations(); |
||
241 | break; |
||
242 | |||
243 | default: |
||
244 | case 'options': |
||
245 | $babBody->addItemMenu('options', absences_translate("Options"), absences_addon()->getUrl()."admvacs&idx=options"); |
||
246 | vacationOptions(); |
||
247 | break; |
||
248 | } |
||
249 | |||
250 | $babBody->setCurrentItemMenu($idx); |
||
251 | bab_siteMap::setPosition('absences','Admin'); |
||
252 | |||
253 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.