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 | require_once dirname(__FILE__).'/functions.php'; |
||
| 26 | require_once dirname(__FILE__).'/utilit/vacincl.php'; |
||
| 27 | require_once dirname(__FILE__).'/utilit/workperiod_recover_request.class.php'; |
||
| 28 | require_once dirname(__FILE__).'/utilit/workperiod_recover_request.ui.php'; |
||
| 29 | require_once dirname(__FILE__).'/utilit/agent.class.php'; |
||
| 30 | |||
| 31 | class absences_WorkingDayList extends absences_Paginate |
||
| 32 | { |
||
| 33 | const MAX = 30; |
||
| 34 | |||
| 35 | private $res; |
||
| 36 | |||
| 37 | public $altbg = true; |
||
| 38 | |||
| 39 | View Code Duplication | public function __construct() |
|
|
0 ignored issues
–
show
|
|||
| 40 | { |
||
| 41 | $this->t_user = absences_translate('User'); |
||
| 42 | $this->t_begin = absences_translate('Begin'); |
||
| 43 | $this->t_end = absences_translate('End'); |
||
| 44 | $this->t_type = absences_translate('Type'); |
||
| 45 | $this->t_status = absences_translate('Status'); |
||
| 46 | $this-> t_delete = absences_translate('Delete'); |
||
| 47 | $this->t_confirmdelete = absences_translate('Do you really want to delete this working day? the generated recovery right will not be deleted'); |
||
| 48 | |||
| 49 | $f = new absences_getRequestSearchForm(); |
||
| 50 | |||
| 51 | $this->res = new absences_WorkperiodRecoverRequestIterator; |
||
| 52 | $this->res->archived = (int) bab_rp('archived', 0); |
||
| 53 | |||
| 54 | if ($status = $f->param('idstatus')) |
||
| 55 | { |
||
| 56 | if ('W' === $status) |
||
| 57 | { |
||
| 58 | $status = ''; |
||
| 59 | } |
||
| 60 | $this->res->status = $status; |
||
| 61 | } |
||
| 62 | |||
| 63 | if ($userid = $f->param('userid')) |
||
| 64 | { |
||
| 65 | $this->res->users = array($userid); |
||
| 66 | } |
||
| 67 | |||
| 68 | if ($organization = $f->param('organization')) |
||
| 69 | { |
||
| 70 | $this->res->organization = array($organization); |
||
| 71 | } |
||
| 72 | |||
| 73 | $W = bab_Widgets(); |
||
| 74 | $datePicker = $W->DatePicker(); |
||
| 75 | |||
| 76 | if ($begin = $datePicker->getISODate($f->param('dateb', null))) |
||
| 77 | { |
||
| 78 | $this->res->startFrom = $begin; |
||
| 79 | } |
||
| 80 | |||
| 81 | if ($end = $datePicker->getISODate($f->param('datee', null))) |
||
| 82 | { |
||
| 83 | $this->res->startTo = $end; |
||
| 84 | } |
||
| 85 | |||
| 86 | |||
| 87 | $this->res->rewind(); |
||
| 88 | |||
| 89 | $this->paginate($this->res->count(), self::MAX); |
||
| 90 | $this->res->seek($this->pos); |
||
| 91 | |||
| 92 | |||
| 93 | $this->searchform = $f->getHtmlForm(array('W' => absences_translate("Waiting"), 'Y' => absences_translate("Accepted"), 'N' => absences_translate("Refused"))); |
||
| 94 | } |
||
| 95 | |||
| 96 | |||
| 97 | public function getnext() |
||
| 98 | { |
||
| 99 | if (($this->res->key() - $this->pos) >= self::MAX) |
||
| 100 | { |
||
| 101 | return false; |
||
| 102 | } |
||
| 103 | |||
| 104 | if ($this->res->valid()) |
||
| 105 | { |
||
| 106 | $wd = $this->res->current(); |
||
| 107 | /*@var $wd absences_WorkperiodRecoverRequest */ |
||
| 108 | |||
| 109 | $this->altbg = !$this->altbg; |
||
| 110 | |||
| 111 | $this->editurl = bab_toHtml(absences_addon()->getUrl().'vacadmwd&idx=edit&id='.$wd->id); |
||
| 112 | $this->deleteurl = bab_toHtml(absences_addon()->getUrl().'vacadmwd&idx=delete&id='.$wd->id); |
||
| 113 | $this->username = bab_toHtml(bab_getUserName($wd->id_user)); |
||
| 114 | $this->begin = bab_toHtml(bab_shortDate(bab_mktime($wd->date_begin))); |
||
| 115 | $this->end = bab_toHtml(bab_shortDate(bab_mktime($wd->date_end))); |
||
| 116 | |||
| 117 | $type = $wd->getType(); |
||
| 118 | $this->type = ''; |
||
| 119 | if ($type->getRow()) { |
||
| 120 | $this->type = bab_toHtml($type->name); |
||
|
0 ignored issues
–
show
The property
name does not exist on object<absences_WorkperiodType>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 121 | } |
||
| 122 | $this->status = bab_toHtml($wd->getStatusStr()); |
||
| 123 | $this->res->next(); |
||
| 124 | return true; |
||
| 125 | } |
||
| 126 | |||
| 127 | return false; |
||
| 128 | } |
||
| 129 | |||
| 130 | |||
| 131 | View Code Duplication | public function getnextstatus() |
|
|
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...
|
|||
| 132 | { |
||
| 133 | static $i = 0; |
||
| 134 | if( $i < count($this->statarr)) |
||
| 135 | { |
||
| 136 | $this->statusid = $i; |
||
| 137 | $this->statusname = bab_toHtml($this->statarr[$i]); |
||
| 138 | if( $this->idstatus != "" && $i == $this->idstatus ) |
||
| 139 | $this->selected = "selected"; |
||
| 140 | else |
||
| 141 | $this->selected = ""; |
||
| 142 | $i++; |
||
| 143 | return true; |
||
| 144 | } |
||
| 145 | else |
||
| 146 | return false; |
||
| 147 | } |
||
| 148 | } |
||
| 149 | |||
| 150 | |||
| 151 | |||
| 152 | function absences_WorkingDayList() |
||
| 153 | { |
||
| 154 | $babBody = bab_getInstance('babBody'); |
||
| 155 | $list = new absences_WorkingDayList; |
||
| 156 | |||
| 157 | if (bab_rp('archived')) |
||
| 158 | { |
||
| 159 | $babBody->setTitle(absences_translate('Archived working days entitling recovery')); |
||
| 160 | } else { |
||
| 161 | $babBody->setTitle(absences_translate('Working days entitling recovery')); |
||
| 162 | } |
||
| 163 | |||
| 164 | absences_addSpoofButton('workperiod_recover_request', absences_translate('Add a workperiod')); |
||
| 165 | |||
| 166 | $babBody->addStyleSheet(absences_Addon()->getStylePath().'vacation.css'); |
||
| 167 | $babBody->addJavascriptFile($GLOBALS['babInstallPath'].'scripts/bab_dialog.js'); |
||
| 168 | $babBody->babEcho(bab_printTemplate($list, absences_addon()->getRelativePath()."vacadmwd.html", "list")); |
||
| 169 | } |
||
| 170 | |||
| 171 | |||
| 172 | |||
| 173 | |||
| 174 | /** |
||
| 175 | * Save form |
||
| 176 | * @param array $workperiod |
||
| 177 | * @throws Exception |
||
| 178 | */ |
||
| 179 | function absences_saveWorkperiodRecoverRequestAdm(absences_WorkperiodRecoverRequest $workperiodRecover, Array $workperiod) |
||
| 180 | { |
||
| 181 | |||
| 182 | if (!absences_WorkperiodRecoverRequest::checkForm($workperiod, $workperiodRecover)) |
||
| 183 | { |
||
| 184 | return false; |
||
| 185 | } |
||
| 186 | |||
| 187 | $workperiodRecover->date_begin = absences_dateTimeForm($workperiod['datebegin'], $workperiod['hourbegin']); |
||
| 188 | $workperiodRecover->date_end = absences_dateTimeForm($workperiod['dateend'], $workperiod['hourend']); |
||
| 189 | $workperiodRecover->id_type = $workperiod['id_type']; |
||
| 190 | $workperiodRecover->comment = $workperiod['comment']; |
||
| 191 | |||
| 192 | if ('' === $workperiodRecover->status) |
||
| 193 | { |
||
| 194 | $workperiodRecover->quantity = $workperiod['quantity']; |
||
| 195 | $workperiodRecover->quantity_unit = $workperiod['quantity_unit']; |
||
| 196 | } |
||
| 197 | |||
| 198 | $workperiodRecover->save(); |
||
| 199 | |||
| 200 | return true; |
||
| 201 | } |
||
| 202 | |||
| 203 | |||
| 204 | |||
| 205 | View Code Duplication | function absences_WDgotoList() |
|
|
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. Loading history...
|
|||
| 206 | { |
||
| 207 | require_once $GLOBALS['babInstallPath'].'utilit/urlincl.php'; |
||
| 208 | |||
| 209 | $url = bab_url::get_request('tg'); |
||
| 210 | $url->idx = 'list'; |
||
| 211 | $url->location(); |
||
| 212 | } |
||
| 213 | |||
| 214 | |||
| 215 | View Code Duplication | function absences_WorkingDayEdit() |
|
|
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. Loading history...
|
|||
| 216 | { |
||
| 217 | $W = bab_Widgets(); |
||
| 218 | $page = $W->BabPage(); |
||
| 219 | |||
| 220 | |||
| 221 | if (isset($_POST['workperiod'])) |
||
| 222 | { |
||
| 223 | if ( isset($_POST['workperiod']['cancel']) ) |
||
| 224 | { |
||
| 225 | absences_WDgotoList(); |
||
| 226 | } |
||
| 227 | |||
| 228 | |||
| 229 | if( isset($_POST['workperiod']['save'] )) |
||
| 230 | { |
||
| 231 | |||
| 232 | // modification uniquement |
||
| 233 | |||
| 234 | $values = $_POST['workperiod']; |
||
| 235 | $wd = absences_WorkperiodRecoverRequest::getById($values['id']); |
||
| 236 | |||
| 237 | if (!$wd->getRow()) |
||
| 238 | { |
||
| 239 | throw new Exception('Work period not found'); |
||
| 240 | } |
||
| 241 | |||
| 242 | try { |
||
| 243 | absences_saveWorkperiodRecoverRequestAdm($wd, $values); |
||
| 244 | absences_WDgotoList(); |
||
| 245 | } catch(Exception $e) |
||
| 246 | { |
||
| 247 | $page->addError($e->getMessage()); |
||
| 248 | } |
||
| 249 | } |
||
| 250 | } |
||
| 251 | |||
| 252 | $id = bab_gp('id', null); |
||
| 253 | |||
| 254 | if ($id) |
||
| 255 | { |
||
| 256 | $wd = absences_WorkperiodRecoverRequest::getById($id); |
||
| 257 | } else { |
||
| 258 | $wd = null; |
||
| 259 | } |
||
| 260 | |||
| 261 | $editor = new absences_WorkperiodRecoverRequestEditor($wd); |
||
| 262 | |||
| 263 | $page->setTitle(absences_translate('Worked day entitling recovery')); |
||
| 264 | $page->addItem($editor); |
||
| 265 | $page->displayHtml(); |
||
| 266 | } |
||
| 267 | |||
| 268 | |||
| 269 | |||
| 270 | View Code Duplication | function absences_WorkingDayDelete() |
|
|
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. Loading history...
|
|||
| 271 | { |
||
| 272 | require_once $GLOBALS['babInstallPath'].'utilit/urlincl.php'; |
||
| 273 | $id = bab_gp('id', null); |
||
| 274 | |||
| 275 | if ($id) |
||
| 276 | { |
||
| 277 | $wd = absences_WorkperiodRecoverRequest::getById($id); |
||
| 278 | $wd->delete(); |
||
| 279 | } |
||
| 280 | |||
| 281 | bab_url::get_request('tg')->location(); |
||
| 282 | } |
||
| 283 | |||
| 284 | |||
| 285 | /* main */ |
||
| 286 | bab_requireCredential(); |
||
| 287 | $agent = absences_Agent::getCurrentUser(); |
||
| 288 | if( !$agent->isManager()) |
||
| 289 | { |
||
| 290 | $babBody->msgerror = absences_translate("Access denied"); |
||
| 291 | return; |
||
| 292 | } |
||
| 293 | |||
| 294 | if ($agent->isInPersonnel()) |
||
| 295 | { |
||
| 296 | $babBody->addItemMenu("vacuser", absences_translate("Vacations"), absences_addon()->getUrl()."vacuser"); |
||
| 297 | } |
||
| 298 | $babBody->addItemMenu("menu", absences_translate("Management"), absences_addon()->getUrl()."vacadm&idx=menu"); |
||
| 299 | $babBody->addItemMenu("list", absences_translate("Working days"), absences_addon()->getUrl()."vacadmwd&idx=list"); |
||
| 300 | |||
| 301 | |||
| 302 | |||
| 303 | $idx = bab_rp('idx', "list"); |
||
| 304 | |||
| 305 | 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. Loading history...
|
|||
| 306 | { |
||
| 307 | case 'edit': |
||
| 308 | absences_WorkingDayEdit(); |
||
| 309 | $babBody->addItemMenu("edit", absences_translate("Edit"), absences_addon()->getUrl()."vacadmwd&idx=edit&id=".bab_rp('id')); |
||
| 310 | break; |
||
| 311 | |||
| 312 | case 'archives': |
||
| 313 | case 'list': |
||
| 314 | absences_WorkingDayList(); |
||
| 315 | $babBody->addItemMenu("archives", absences_translate("Archives"), absences_addon()->getUrl()."vacadmwd&idx=archives&archived=1"); |
||
| 316 | break; |
||
| 317 | |||
| 318 | case 'delete': |
||
| 319 | absences_WorkingDayDelete(); |
||
| 320 | break; |
||
| 321 | } |
||
| 322 | |||
| 323 | $babBody->setCurrentItemMenu($idx); |
||
| 324 | 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.