Issues (1940)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

programs/vacadmwd.php (32 issues)

Upgrade to new PHP Analysis Engine

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
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...
40
	{
41
		$this->t_user = absences_translate('User');
0 ignored issues
show
The property t_user does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
42
		$this->t_begin = absences_translate('Begin');
0 ignored issues
show
The property t_begin does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
43
		$this->t_end = absences_translate('End');
0 ignored issues
show
The property t_end does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
44
		$this->t_type = absences_translate('Type');
0 ignored issues
show
The property t_type does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
45
		$this->t_status = absences_translate('Status');
0 ignored issues
show
The property t_status does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
46
		$this-> t_delete = absences_translate('Delete');
0 ignored issues
show
The property t_delete does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
47
		$this->t_confirmdelete = absences_translate('Do you really want to delete this working day? the generated recovery right will not be deleted');
0 ignored issues
show
The property t_confirmdelete does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
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);
0 ignored issues
show
Documentation Bug introduced by
It seems like array($organization) of type array<integer,?,{"0":"?"}> is incompatible with the declared type integer of property $organization.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
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;
0 ignored issues
show
Documentation Bug introduced by
The property $startFrom was declared of type integer, but $begin is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
79
		}
80
		
81
		if ($end = $datePicker->getISODate($f->param('datee', null)))
82
		{
83
			$this->res->startTo = $end;
0 ignored issues
show
Documentation Bug introduced by
The property $startTo was declared of type integer, but $end is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
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")));
0 ignored issues
show
The property searchform does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
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);
0 ignored issues
show
The property editurl does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
112
			$this->deleteurl = bab_toHtml(absences_addon()->getUrl().'vacadmwd&idx=delete&id='.$wd->id);
0 ignored issues
show
The property deleteurl does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
113
			$this->username = bab_toHtml(bab_getUserName($wd->id_user));
0 ignored issues
show
The property username does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
114
			$this->begin = bab_toHtml(bab_shortDate(bab_mktime($wd->date_begin)));
0 ignored issues
show
The property begin does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
115
			$this->end = bab_toHtml(bab_shortDate(bab_mktime($wd->date_end)));
0 ignored issues
show
The property end does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
116
			
117
			$type = $wd->getType();
118
			$this->type = '';
0 ignored issues
show
The property type does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
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 _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?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());
0 ignored issues
show
The property status does not seem to exist. Did you mean t_status?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
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;
0 ignored issues
show
The property statusid does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
137
			$this->statusname = bab_toHtml($this->statarr[$i]);
0 ignored issues
show
The property statusname does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
The property statarr does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
138
			if( $this->idstatus != "" && $i == $this->idstatus )
0 ignored issues
show
The property idstatus does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
139
				$this->selected = "selected";
0 ignored issues
show
The property selected does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
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"));
0 ignored issues
show
Deprecated Code introduced by
The method bab_addonInfos::getRelativePath() has been deprecated with message: Do not use relative path in addons Addons are subject to move out of the core folder in futures version for bab_printTemplate, replace with $addon->printTemplate() for babBody->addStyleSheet use $addon->getStylePath() instead of relative path the addStyleSheet method support full path starting with vendor/ since the 8.1.98 version

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
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...
The function absences_WorkingDayDelete() has been defined more than once; this definition is ignored, only the first definition in programs/vacadmcet.php (L244-256) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

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');