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/vacadmcet.php (19 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/cet_deposit_request.class.php';
28
require_once dirname(__FILE__).'/utilit/cet_deposit_request.ui.php';
29
require_once dirname(__FILE__).'/utilit/agent.class.php';
30
31
class absences_CetListCls extends absences_Paginate 
32
{
33
	const MAX = 30;
34
	
35
	private $res;
36
	
37
	public $altbg = true;
38
39
	
40 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...
41
	{
42
		$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...
43
		$this->t_right_source = absences_translate('Right source');
0 ignored issues
show
The property t_right_source 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_quantity = absences_translate('Quantity');
0 ignored issues
show
The property t_quantity 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 CET deposit request? the associated quantity in the time saving account will not be removed');
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
		
50
		$f = new absences_getRequestSearchForm();
51
		
52
		$this->res = new absences_CetDepositRequestIterator;
53
		$this->res->archived = (int) bab_rp('archived', 0);
54
		
55
		if ($status = $f->param('idstatus'))
56
		{
57
			if ('W' === $status)
58
			{
59
				$status = '';
60
			}
61
			$this->res->status = $status;
62
		}
63
		
64
		if ($userid = $f->param('userid'))
65
		{
66
			$this->res->users = array($userid);
67
		}
68
		
69
		if ($organization = $f->param('organization'))
70
		{
71
		    $this->res->organization = $organization;
72
		}
73
		
74
		$W = bab_Widgets();
75
		$datePicker = $W->DatePicker();
76
		
77
		if ($begin = $datePicker->getISODate($f->param('dateb', null)))
78
		{
79
			$this->res->startFrom = $begin;
80
		}
81
		
82
		if ($end = $datePicker->getISODate($f->param('datee', null)))
83
		{
84
			$this->res->startTo = $end;
85
		}
86
		$this->res->rewind();
87
		
88
		$this->paginate($this->res->count(), self::MAX);
89
		$this->res->seek($this->pos);
90
		
91
		
92
		$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...
93
	}
94
	
95
	
96
	public function getnext()
97
	{
98
		if (($this->res->key() - $this->pos) >= self::MAX)
99
		{
100
			return false;
101
		}
102
		
103
		if ($this->res->valid())
104
		{
105
			$this->altbg = !$this->altbg;
106
			
107
			$deposit = $this->res->current();
108
			/*@var $deposit absences_CetDepositRequest */
109
			
110
			$this->editurl = bab_toHtml(absences_addon()->getUrl().'vacadmcet&idx=edit&id='.$deposit->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...
111
			$this->deleteurl = bab_toHtml(absences_addon()->getUrl().'vacadmcet&idx=delete&id='.$deposit->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...
112
			$this->username = bab_toHtml(bab_getUserName($deposit->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...
113
			
114
			$right = $deposit->getAgentRightSource()->getRight();
115
			
116
			$description = isset($right->description) ? $right->description : absences_translate('Unknown');
117
			$quantity_unit = isset($right->quantity_unit) ? $right->quantity_unit : 'D';
118
			
119
			$this->right_source = bab_toHtml($description);
0 ignored issues
show
The property right_source does not seem to exist. Did you mean t_right_source?

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...
120
			$this->quantity = bab_toHtml(absences_quantity($deposit->quantity, $quantity_unit));
0 ignored issues
show
The property quantity does not seem to exist. Did you mean t_quantity?

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...
121
			$this->status = bab_toHtml($deposit->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...
122
			
123
			
124
			$this->res->next();
125
			
126
			return true;
127
		}
128
		
129
		return false;
130
	}
131
}
132
133
134
135
function absences_CetList()
136
{
137
	$babBody = bab_getInstance('babBody');
138
	$list = new absences_CetListCls;
139
	
140
	if (bab_rp('archived'))
141
	{
142
		$babBody->setTitle(absences_translate('Archived deposits in time saving accounts'));
143
	} else {
144
		$babBody->setTitle(absences_translate('Deposits in time saving accounts'));
145
	}
146
	absences_addSpoofButton('cet_deposit_request', absences_translate('Add a time saving account deposit'));
147
	$babBody->babEcho(bab_printTemplate($list, absences_addon()->getRelativePath()."vacadmcet.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...
148
}
149
150
151
152 View Code Duplication
function absences_CETgotoList()
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...
153
{
154
	require_once $GLOBALS['babInstallPath'].'utilit/urlincl.php';
155
156
	$url = bab_url::get_request('tg');
157
	$url->idx = 'list';
158
	$url->location();
159
}
160
161
162
163
/**
164
 * Save form
165
 * @param absences_CetDepositRequest $deposit
166
 * @param Array $cet
167
 * @throws Exception
168
 */
169
function absences_saveCetdepositRequestAdm(absences_CetDepositRequest $deposit, Array $cet)
170
{
171
	if ('' === $deposit->status)
172
	{
173
		// waiting validation, modification allowed
174
		$deposit->quantity = str_replace(',', '.', $cet['quantity']);
175
		$deposit->id_agent_right_source = (int) $cet['id_agent_right_source'];
176
	}
177
	
178
	
179
	$deposit->comment = $cet['comment'];
180
	$deposit->save();
181
	
182
	return true;
183
}
184
185
186
187 View Code Duplication
function absences_CetEdit()
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...
188
{
189
	$W = bab_Widgets();
190
	$page = $W->BabPage();
191
	
192
	
193
	if (isset($_POST['cet']))
194
	{
195
		if ( isset($_POST['cet']['cancel']) )
196
		{
197
			absences_CETgotoList();
198
		}
199
	
200
	
201
		if( isset($_POST['cet']['save'] ))
202
		{
203
	
204
			// modification uniquement
205
	
206
			$values = $_POST['cet'];
207
			$deposit = absences_CetDepositRequest::getById($values['id']);
208
	
209
			if (!$deposit->getRow())
210
			{
211
				throw new Exception('Deposit not found');
212
			}
213
	
214
			try {
215
				absences_saveCetdepositRequestAdm($deposit, $values);
216
				absences_CETgotoList();
217
			} catch(Exception $e)
218
			{
219
				$page->addError($e->getMessage());
220
			}
221
		}
222
	}
223
	
224
	$id = bab_gp('id', null);
225
	
226
	if ($id)
227
	{
228
		$deposit = absences_CetDepositRequest::getById($id);
229
	} else {
230
		$deposit = null;
231
	}
232
	
233
	$editor = new absences_CetDepositRequestEditor($deposit);
234
	
235
	$page->setTitle(absences_translate('Time saving account deposit request'));
236
	$page->addItem($editor);
237
	$page->displayHtml();
238
}
239
240
241
242
243
244 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...
245
{
246
	require_once $GLOBALS['babInstallPath'].'utilit/urlincl.php';
247
	$id = bab_gp('id', null);
248
249
	if ($id)
250
	{
251
		$wd = absences_CetDepositRequest::getById($id);
252
		$wd->delete();
253
	}
254
255
	bab_url::get_request('tg')->location();
256
}
257
258
259
260
261
/* main */
262
bab_requireCredential();
263
$agent = absences_Agent::getCurrentUser();
264
if( !$agent->isManager())
265
{
266
	$babBody->msgerror = absences_translate("Access denied");
267
	return;
268
}
269
270
if ($agent->isInPersonnel())
271
{
272
	$babBody->addItemMenu("vacuser", absences_translate("Vacations"), absences_addon()->getUrl()."vacuser");
273
}
274
$babBody->addItemMenu("menu", absences_translate("Management"), absences_addon()->getUrl()."vacadm&idx=menu");
275
$babBody->addItemMenu("list", absences_translate("Deposits"), absences_addon()->getUrl()."vacadmcet&idx=list");
276
277
$idx = bab_rp('idx', "list");
278
279
280 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...
281
{
282
	case 'edit':
283
		absences_CetEdit();
284
		$babBody->addItemMenu("edit", absences_translate("Edit"), absences_addon()->getUrl()."vacadmcet&idx=edit&id=".bab_rp('id'));
285
		break;
286
		
287
	
288
	case 'list':
289
	case 'archives':
290
		absences_CetList();
291
		$babBody->addItemMenu("archives", absences_translate("Archives"), absences_addon()->getUrl()."vacadmcet&idx=archives&archived=1");
292
		break;
293
		
294
	case 'delete':
295
		absences_WorkingDayDelete();
296
		break;
297
}
298
299
300
$babBody->setCurrentItemMenu($idx);
301
bab_siteMap::setPosition('absences','User');