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 | include_once dirname(__FILE__).'/utilit/vacincl.php'; |
||
27 | include_once dirname(__FILE__).'/utilit/agent.class.php'; |
||
28 | include_once dirname(__FILE__).'/utilit/archive.ui.php'; |
||
29 | include_once $GLOBALS['babInstallPath'].'utilit/urlincl.php'; |
||
30 | |||
31 | /** |
||
32 | * @return array |
||
33 | */ |
||
34 | function absences_getArchivableRights() |
||
35 | { |
||
36 | require_once dirname(__FILE__).'/utilit/right.class.php'; |
||
37 | $I = new absences_RightIterator(); |
||
38 | $I->archived = 0; |
||
39 | |||
40 | $rights = array(); |
||
41 | |||
42 | foreach($I as $right) |
||
43 | { |
||
44 | /*@var $right absences_Right */ |
||
45 | if (!$right->isResulted()) |
||
46 | { |
||
47 | continue; |
||
48 | } |
||
49 | |||
50 | $y = $right->getYear(); |
||
51 | |||
52 | if (!isset($y)) |
||
53 | { |
||
54 | continue; |
||
55 | } |
||
56 | |||
57 | $rights[] = $right; |
||
58 | } |
||
59 | |||
60 | return $rights; |
||
61 | } |
||
62 | |||
63 | |||
64 | |||
65 | |||
66 | |||
67 | function absences_ArchiveRightsSave($values) |
||
68 | { |
||
69 | global $babBody; |
||
70 | $year = $values['year']; |
||
71 | |||
72 | if (empty($year)) |
||
73 | { |
||
74 | return false; |
||
75 | } |
||
76 | |||
77 | $filtered = array(); |
||
78 | $rights = absences_getArchivableRights(); |
||
79 | foreach($rights as $right) { |
||
80 | if ($right->getYear() == $year) { |
||
81 | $filtered[] = $right; |
||
82 | } |
||
83 | } |
||
84 | |||
85 | if (0 === count($filtered)) { |
||
86 | $babBody->addNextPageMessage(absences_translate('No rights to archive')); |
||
87 | return true; |
||
88 | } |
||
89 | |||
90 | foreach($filtered as $right) |
||
91 | { |
||
92 | $right->archive(); |
||
93 | } |
||
94 | |||
95 | $babBody->addNextPageMessage(sprintf(absences_translate('%d rights where archived'), count($filtered))); |
||
96 | return true; |
||
97 | } |
||
98 | |||
99 | |||
100 | |||
101 | |||
102 | /** |
||
103 | * Archivage des droits par annee |
||
104 | * proposer les annes contenant que des droits soldes et inactifs (les droits supportant les soldes negatifs doivent etres desactives) |
||
105 | */ |
||
106 | View Code Duplication | function absences_ArchiveRights() |
|
0 ignored issues
–
show
|
|||
107 | { |
||
108 | |||
109 | $W = bab_Widgets(); |
||
110 | $page = $W->BabPage(); |
||
111 | |||
112 | |||
113 | |||
114 | if (isset($_POST['archive'])) |
||
115 | { |
||
116 | |||
117 | if( isset($_POST['archive']['save'] )) |
||
118 | { |
||
119 | $values = $_POST['archive']; |
||
120 | absences_ArchiveRightsSave($values); |
||
121 | } |
||
122 | |||
123 | // Go to main menu |
||
124 | $url = new bab_url; |
||
125 | $url->tg = 'addon/absences/vacadm'; |
||
126 | $url->location(); |
||
127 | } |
||
128 | |||
129 | |||
130 | |||
131 | |||
132 | $editor = new absences_RightArchiveYearEditor(); |
||
133 | |||
134 | $page->setTitle(absences_translate('Archive vacation rights by year')); |
||
135 | $page->addItem($editor); |
||
136 | $page->displayHtml(); |
||
137 | } |
||
138 | |||
139 | |||
140 | |||
141 | |||
142 | |||
143 | function absences_ArchiveRequestsSave($values) |
||
144 | { |
||
145 | global $babBody; |
||
146 | require_once $GLOBALS['babInstallPath'].'utilit/dateTime.php'; |
||
147 | |||
148 | $organization = (int) $values['organization']; |
||
149 | $year = $values['year']; |
||
150 | |||
151 | if (empty($year)) |
||
152 | { |
||
153 | return false; |
||
154 | } |
||
155 | |||
156 | |||
157 | require_once dirname(__FILE__).'/utilit/request.class.php'; |
||
158 | $I = new absences_RequestIterator(); |
||
159 | $I->archived = 0; |
||
160 | |||
161 | if ($organization > 0) { |
||
162 | $I->organization = $organization; |
||
163 | } |
||
164 | |||
165 | $day = absences_getVacationOption('archivage_day'); |
||
166 | $month = absences_getVacationOption('archivage_month'); |
||
167 | $startDate = new BAB_DateTime($year, $month, $day); |
||
168 | $endDate = new BAB_DateTime($year+1, $month, $day-1); |
||
169 | $I->startFrom = $startDate->getIsoDate(). ' 00:00:00'; |
||
170 | $I->startTo = $endDate->getIsoDate(). ' 23:59:59'; |
||
171 | |||
172 | |||
173 | if (0 === $I->count()) { |
||
174 | $babBody->addNextPageMessage(absences_translate('No requests to archive')); |
||
175 | return true; |
||
176 | } |
||
177 | |||
178 | |||
179 | foreach($I as $request) |
||
180 | { |
||
181 | $request->archive(); |
||
182 | } |
||
183 | |||
184 | |||
185 | $babBody->addNextPageMessage(sprintf(absences_translate('%d requests where archived'), $I->count())); |
||
186 | |||
187 | return true; |
||
188 | } |
||
189 | |||
190 | |||
191 | |||
192 | /** |
||
193 | * Archivage des demandes par annees |
||
194 | */ |
||
195 | View Code Duplication | function absences_ArchiveRequests() |
|
0 ignored issues
–
show
This function seems to be duplicated in your project.
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. ![]() |
|||
196 | { |
||
197 | |||
198 | $W = bab_Widgets(); |
||
199 | $page = $W->BabPage(); |
||
200 | |||
201 | |||
202 | if (isset($_POST['archive'])) |
||
203 | { |
||
204 | |||
205 | if( isset($_POST['archive']['save'] )) |
||
206 | { |
||
207 | $values = $_POST['archive']; |
||
208 | absences_ArchiveRequestsSave($values); |
||
209 | } |
||
210 | |||
211 | // Go to main menu |
||
212 | $url = new bab_url; |
||
213 | $url->tg = 'addon/absences/vacadm'; |
||
214 | $url->location(); |
||
215 | } |
||
216 | |||
217 | |||
218 | |||
219 | |||
220 | $editor = new absences_RequestArchiveYearEditor(); |
||
221 | |||
222 | |||
223 | $page->addStyleSheet(absences_Addon()->getStylePath().'vacation.css'); |
||
224 | $page->setTitle(absences_translate('Archive requests by year')); |
||
225 | $page->addItem($editor); |
||
226 | $page->displayHtml(); |
||
227 | } |
||
228 | |||
229 | |||
230 | /* main */ |
||
231 | bab_requireCredential(); |
||
232 | $agent = absences_Agent::getCurrentUser(); |
||
233 | if( !$agent->isManager()) |
||
234 | { |
||
235 | $babBody->msgerror = absences_translate("Access denied"); |
||
236 | return; |
||
237 | } |
||
238 | |||
239 | $idx = bab_rp('idx', 'request'); |
||
240 | $babBody->addItemMenu("menu", absences_translate("Management"), absences_addon()->getUrl()."vacadm&idx=menu"); |
||
241 | |||
242 | |||
243 | View Code Duplication | switch($idx) |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
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. ![]() |
|||
244 | { |
||
245 | case 'right': |
||
246 | |||
247 | absences_ArchiveRights(); |
||
248 | $babBody->addItemMenu("right", absences_translate("Archive"), absences_addon()->getUrl()."archive&idx=right"); |
||
249 | |||
250 | break; |
||
251 | |||
252 | case 'request': |
||
253 | absences_ArchiveRequests(); |
||
254 | $babBody->addItemMenu("request", absences_translate("Archive"), absences_addon()->getUrl()."archive&idx=right"); |
||
255 | |||
256 | break; |
||
257 | } |
||
258 | |||
259 | |||
260 | $babBody->setCurrentItemMenu($idx); |
||
261 | bab_siteMap::setPosition('absences','User'); |
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.