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 | |||
| 26 | |||
| 27 | bab_Widgets()->includePhpClass('Widget_Form'); |
||
| 28 | |||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | |||
| 33 | |||
| 34 | abstract class absences_ArchiveYearEditor extends Widget_Form |
||
| 35 | { |
||
| 36 | |||
| 37 | |||
| 38 | |||
| 39 | |||
| 40 | View Code Duplication | public function __construct() |
|
|
0 ignored issues
–
show
|
|||
| 41 | { |
||
| 42 | $W = bab_Widgets(); |
||
| 43 | parent::__construct(null, $W->VBoxLayout()->setVerticalSpacing(2,'em')); |
||
| 44 | |||
| 45 | $this->setName('archive'); |
||
| 46 | $this->addClass('widget-bordered'); |
||
| 47 | $this->addClass('BabLoginMenuBackground'); |
||
| 48 | $this->addClass('widget-centered'); |
||
| 49 | $this->colon(); |
||
| 50 | |||
| 51 | $this->setCanvasOptions($this->Options()->width(50,'em')); |
||
|
0 ignored issues
–
show
It seems like
$this->Options()->width(50, 'em') targeting Widget_CanvasOptions::width() can also be of type double; however, Widget_Item::setCanvasOptions() does only seem to accept object<Widget_CanvasOptions>, maybe add an additional type check?
This check looks at variables that are passed out again to other methods. If the outgoing method call has stricter type requirements than the method itself, an issue is raised. An additional type check may prevent trouble. Loading history...
|
|||
| 52 | |||
| 53 | $this->addFields(); |
||
| 54 | $this->addButtons(); |
||
| 55 | $this->setSelfPageHiddenFields(); |
||
| 56 | |||
| 57 | } |
||
| 58 | |||
| 59 | |||
| 60 | abstract protected function addFields(); |
||
| 61 | |||
| 62 | |||
| 63 | abstract protected function getOptions(); |
||
| 64 | |||
| 65 | |||
| 66 | |||
| 67 | View Code Duplication | protected function year() |
|
|
0 ignored issues
–
show
This method 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. Loading history...
|
|||
| 68 | { |
||
| 69 | $W = bab_Widgets(); |
||
| 70 | |||
| 71 | |||
| 72 | $options = $this->getOptions(); |
||
| 73 | ksort($options); |
||
| 74 | |||
| 75 | return $W->LabelledWidget( |
||
| 76 | absences_translate('Year to archive'), |
||
| 77 | $W->RadioSet()->setOptions($options), |
||
| 78 | __FUNCTION__ |
||
| 79 | )->setValue(key($options)); |
||
| 80 | } |
||
| 81 | |||
| 82 | |||
| 83 | |||
| 84 | |||
| 85 | View Code Duplication | protected function comment() |
|
|
0 ignored issues
–
show
This method 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. Loading history...
|
|||
| 86 | { |
||
| 87 | $W = bab_Widgets(); |
||
| 88 | |||
| 89 | return $W->LabelledWidget( |
||
| 90 | absences_translate('Comment'), |
||
| 91 | $W->TextEdit()->setColumns(60)->setLines(4), |
||
| 92 | __FUNCTION__ |
||
| 93 | ); |
||
| 94 | } |
||
| 95 | |||
| 96 | |||
| 97 | |||
| 98 | |||
| 99 | |||
| 100 | View Code Duplication | protected function addButtons() |
|
|
0 ignored issues
–
show
This method 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. Loading history...
|
|||
| 101 | { |
||
| 102 | $W = bab_Widgets(); |
||
| 103 | |||
| 104 | $button = $W->FlowItems( |
||
| 105 | $W->SubmitButton()->setName('cancel')->setLabel(absences_translate('Cancel')), |
||
| 106 | $W->SubmitButton()->setName('save')->setLabel(absences_translate('Save')) |
||
| 107 | )->setSpacing(1,'em'); |
||
| 108 | |||
| 109 | $this->addItem($button); |
||
| 110 | } |
||
| 111 | } |
||
| 112 | |||
| 113 | |||
| 114 | |||
| 115 | |||
| 116 | |||
| 117 | |||
| 118 | |||
| 119 | |||
| 120 | |||
| 121 | class absences_RightArchiveYearEditor extends absences_ArchiveYearEditor |
||
| 122 | { |
||
| 123 | |||
| 124 | /** |
||
| 125 | * (non-PHPdoc) |
||
| 126 | * @see absences_ArchiveYearEditor::getOptions() |
||
| 127 | * |
||
| 128 | * @return array |
||
| 129 | */ |
||
| 130 | protected function getOptions() |
||
| 131 | { |
||
| 132 | $years = array(); |
||
| 133 | |||
| 134 | foreach(absences_getArchivableRights() as $right) |
||
| 135 | { |
||
| 136 | |||
| 137 | $y = $right->getYear(); |
||
| 138 | if (isset($years[$y])) |
||
| 139 | { |
||
| 140 | $years[$y]++; |
||
| 141 | } else { |
||
| 142 | $years[$y] = 1; |
||
| 143 | } |
||
| 144 | } |
||
| 145 | |||
| 146 | $options = array(); |
||
| 147 | foreach($years as $year => $quantity) |
||
| 148 | { |
||
| 149 | if ($year >= date('Y')) |
||
| 150 | { |
||
| 151 | continue; |
||
| 152 | } |
||
| 153 | |||
| 154 | $options[$year] = sprintf(absences_translate('%d : %d right', '%d : %d rights', $quantity), $year, $quantity); |
||
| 155 | } |
||
| 156 | |||
| 157 | return $options; |
||
| 158 | } |
||
| 159 | |||
| 160 | |||
| 161 | protected function addFields() |
||
| 162 | { |
||
| 163 | $this->addItem($this->year()); |
||
| 164 | } |
||
| 165 | |||
| 166 | } |
||
| 167 | |||
| 168 | |||
| 169 | class absences_RequestArchiveYearEditor extends absences_ArchiveYearEditor |
||
| 170 | { |
||
| 171 | protected function getOptions() |
||
| 172 | { |
||
| 173 | require_once $GLOBALS['babInstallPath'].'utilit/dateTime.php'; |
||
| 174 | require_once dirname(__FILE__).'/request.class.php'; |
||
| 175 | $I = new absences_RequestIterator(); |
||
| 176 | $I->archived = 0; |
||
| 177 | |||
| 178 | $day = absences_getVacationOption('archivage_day'); |
||
| 179 | $month = absences_getVacationOption('archivage_month'); |
||
| 180 | |||
| 181 | $years = array(); |
||
| 182 | foreach($I as $request) |
||
| 183 | { |
||
| 184 | /*@var $request absences_Request */ |
||
| 185 | $y = $request->getArchiveYear(); |
||
| 186 | |||
| 187 | if (isset($years[$y])) |
||
| 188 | { |
||
| 189 | $years[$y]++; |
||
| 190 | } else { |
||
| 191 | $years[$y] = 1; |
||
| 192 | } |
||
| 193 | } |
||
| 194 | |||
| 195 | $options = array(); |
||
| 196 | foreach($years as $year => $quantity) |
||
| 197 | { |
||
| 198 | if ($year >= date('Y')) |
||
| 199 | { |
||
| 200 | // continue; |
||
| 201 | } |
||
| 202 | |||
| 203 | $startDate = new BAB_DateTime($year, $month, $day); |
||
| 204 | $endDate = new BAB_DateTime($year+1, $month, $day-1); |
||
| 205 | |||
| 206 | $options[$year] = sprintf( |
||
| 207 | absences_translate( |
||
| 208 | '%d (from %s to %s) : %d request', |
||
| 209 | '%d (from %s to %s) : %d requests', |
||
| 210 | $quantity |
||
| 211 | ), |
||
| 212 | $year, $startDate->getFrenchDate(), $endDate->getFrenchDate(), $quantity |
||
| 213 | ); |
||
| 214 | } |
||
| 215 | |||
| 216 | return $options; |
||
| 217 | } |
||
| 218 | |||
| 219 | |||
| 220 | protected function addFields() |
||
| 221 | { |
||
| 222 | $this->addItem($this->organization()); |
||
| 223 | $this->addItem($this->year()); |
||
| 224 | } |
||
| 225 | |||
| 226 | |||
| 227 | |||
| 228 | |||
| 229 | |||
| 230 | View Code Duplication | protected function organization() |
|
|
0 ignored issues
–
show
This method 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. Loading history...
|
|||
| 231 | { |
||
| 232 | $W = bab_Widgets(); |
||
| 233 | $select = $W->Select()->addClass('absences-select'); |
||
| 234 | |||
| 235 | $select->addOption('', absences_translate('On all organizations')); |
||
| 236 | |||
| 237 | require_once dirname(__FILE__).'/organization.class.php'; |
||
| 238 | |||
| 239 | $I = new absences_OrganizationIterator(); |
||
| 240 | foreach($I as $org) { |
||
| 241 | $select->addOption($org->id, $org->name); |
||
| 242 | } |
||
| 243 | |||
| 244 | |||
| 245 | return $W->LabelledWidget( |
||
| 246 | absences_translate('Organization'), |
||
| 247 | $select, |
||
| 248 | __FUNCTION__ |
||
| 249 | ); |
||
| 250 | } |
||
| 251 | |||
| 252 | } |
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.