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/utilit/rightincl.php (28 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
26
27
class absences_RightCopyStep1
28
{
29
30
    public $altbg;
31
    
32
	public function __construct() {
33
		$this->t_help = absences_translate("The right theoretical period is used to determine the year");
0 ignored issues
show
The property t_help 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...
34
		$this->t_year_from = absences_translate("Year");
0 ignored issues
show
The property t_year_from 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...
35
		$this->t_year_to = absences_translate("Create rights for year");
0 ignored issues
show
The property t_year_to 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...
36
		$this->t_record = absences_translate("Record");
0 ignored issues
show
The property t_record 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...
37
		$this->t_report = absences_translate("Create report rights with type");
0 ignored issues
show
The property t_report 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...
38
		
39
		$this->t_right_name = absences_translate("Right name");
0 ignored issues
show
The property t_right_name 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...
40
		$this->t_right_kind = absences_translate("Right kind");
0 ignored issues
show
The property t_right_kind 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...
41
		$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...
42
		
43
		$this->t_help = absences_translate("Users will be associated to rights as in the previous period but the specific quantities of users will not be retained. Only the rights configured with a theoretical period can be renewed using this form.");
44
45
		global $babDB;
46
47
		$this->resyear = $babDB->db_query("SELECT 
0 ignored issues
show
The property resyear 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
		    YEAR(date_begin) year  
49
		FROM 
50
		    absences_rights 
51
		WHERE 
52
		    date_begin<>'0000-00-00' 
53
		    AND kind IN(".$babDB->quote($this->getAllowedKinds()).") 
54
	     GROUP BY year ORDER BY year DESC");
55
56
		$this->year_to = isset($_POST['year_to']) ? $_POST['year_to'] : '';
0 ignored issues
show
The property year_to does not seem to exist. Did you mean t_year_to?

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...
57
		
58
	}
59
	
60
	
61
	protected function getAllowedKinds()
62
	{
63
	    return array(
64
	        absences_Right::REGULAR, 
65
	        absences_Right::CET,
66
	        absences_Right::INCREMENT 
67
	    );
68
	}
69
	
70
71
	public function getnextyear() {
72
		global $babDB;
73
		if ($arr = $babDB->db_fetch_assoc($this->resyear)) {
74
			$this->year = bab_toHtml($arr['year']);
0 ignored issues
show
The property year 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...
75
			if (empty($this->year_to)) {
0 ignored issues
show
The property year_to does not seem to exist. Did you mean t_year_to?

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...
76
				$this->year_to = $this->year;
0 ignored issues
show
The property year_to does not seem to exist. Did you mean t_year_to?

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...
77
			}
78
			$this->selected = isset($_POST['year_from']) && $_POST['year_from'] == $arr['year'];
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...
79
			return true;
80
		}
81
		return false;
82
	}
83
84
	public function year_to() {
85
		$selected_year = isset($_POST['year_from']) ? $_POST['year_from'] : $this->year_to;
0 ignored issues
show
The property year_to does not seem to exist. Did you mean t_year_to?

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...
86
		if (!isset($_POST['year_to'])) {
87
			$this->year_to++;
0 ignored issues
show
The property year_to does not seem to exist. Did you mean t_year_to?

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...
88
		}
89
		global $babDB;
90
91
		$this->resrights = $babDB->db_query("
0 ignored issues
show
The property resrights 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...
92
			SELECT
93
				r.* 
94
			FROM
95
				".ABSENCES_RIGHTS_TBL." r
96
			WHERE
97
				 YEAR(r.date_begin) = ".$babDB->quote($selected_year)." 
98
				AND r.kind IN(".$babDB->quote($this->getAllowedKinds()).")
99
		    
100
			GROUP BY r.id
101
		    ORDER BY r.sortkey, r.description  
102
			");
103
104
		return false;
105
	}
106
107
	public function getnextright() {
108
		global $babDB;
109
		if ($arr = $babDB->db_fetch_assoc($this->resrights)) {
110
		    
111
		    $this->altbg = !$this->altbg;
112
		    
113
		    $right = new absences_Right($arr['id']);
114
		    $right->setRow($arr);
115
		    
116
			$this->right_description	= bab_toHtml($right->description);
0 ignored issues
show
The property right_description 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...
117
			$this->right_kind           = bab_toHtml($right->getKindLabel());
0 ignored issues
show
The property right_kind does not seem to exist. Did you mean t_right_kind?

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...
118
			$this->id_right				= bab_toHtml($right->id);
0 ignored issues
show
The property id_right 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
			$this->quantity             = bab_toHtml(absences_editQuantity($right->quantity, $right->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...
120
			$this->right_unit           = bab_toHtml($right->getUnitLabel());
0 ignored issues
show
The property right_unit 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...
121
			$this->checked				= (isset($_POST['rights']) && isset($_POST['rights'][$arr['id']])) || empty($_POST);
0 ignored issues
show
The property checked 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...
122
			return true;
123
		}
124
		return false;
125
	}
126
	
127
128
}
129
130
131
132
class absences_RightCopyStep2 {
133
134
	var $messages = array();
135
136
	public function __construct() {
137
138
		include_once $GLOBALS['babInstallPath']."utilit/dateTime.php";
139
140
		global $babDB;
141
		$this->increment = ((int) $_POST['year_to']) - ((int) $_POST['year_from']);
0 ignored issues
show
The property increment 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...
142
143
		$this->nb_right_insert = 0;
0 ignored issues
show
The property nb_right_insert 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...
144
		
145
		
146
		$renewal_uid = date('YmdHis').'-'.$_POST['year_from'].'-'.$_POST['year_to'];
147
148
149
		// create rights
150
151
		if (isset($_POST['rights'])) {
152
		    
153
			foreach($_POST['rights'] as $arr) {
154
			    
155
			    if (!isset($arr['checked'])) {
156
			        continue;
157
			    }
158
			    
159
				$row = $this->get_row($arr['id']);
160
				$row['quantity'] = str_replace(',', '.', $arr['quantity']);
161
				$row['quantity'] = str_replace(' ', '', $row['quantity']);
162
				if (true === $this->transform_row($row)) {
163
				    
164
				    $row['renewal_uid'] = $renewal_uid;
165
					$this->insert_row($row);
166
				}
167
			}
168
		}
169
170
171
		$this->addMessage( sprintf( absences_translate("%d rights has been inserted"), $this->nb_right_insert) );
172
	}
173
174
175
	private function addMessage($str) {
176
		$this->messages[] = $str;
177
	}
178
179
	public function getnextmessage() {
180
		return list(,$this->message) = each($this->messages);
0 ignored issues
show
The property message does not seem to exist. Did you mean messages?

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...
181
	}
182
183
184
	private function get_row($id_right) {
185
		global $babDB;
186
		$res = $babDB->db_query("SELECT * FROM ".ABSENCES_RIGHTS_TBL." WHERE id=".$babDB->quote($id_right));
187
		return $babDB->db_fetch_assoc($res);
188
	}
189
190
191
	private function increment_ISO($date) {
192
		if ('0000-00-00' === $date) {
193
			return $date;
194
		}
195
		
196
		if ('0000-00-00 00:00:00' === $date) {
197
			return $date;
198
		}
199
		
200
		$obj = BAB_DateTime::fromIsoDateTime($date);
201
		$obj->add($this->increment,BAB_DATETIME_YEAR);
202
		
203
		if (10 == mb_strlen($date)) {
204
			return $obj->getIsoDate();
205
		} else {
206
			return $obj->getIsoDateTime();
207
		}
208
	}
209
210
211
	public function transform_row(&$row) {
212
213
		global $babDB;
214
215
		$row['id_creditor']			= $GLOBALS['BAB_SESS_USERID'];
216
217
		$row['createdOn']			= date('Y-m-d H:i:s');
218
		$row['date_entry']			= date('Y-m-d H:i:s');
219
		$row['date_begin']			= $this->increment_ISO($row['date_begin']);
220
		$row['date_end']			= $this->increment_ISO($row['date_end']);
221
		$row['date_begin_valid']	= $this->increment_ISO($row['date_begin_valid']);
222
		$row['date_end_valid']		= $this->increment_ISO($row['date_end_valid']);
223
		$row['date_end_fixed']		= $this->increment_ISO($row['date_end_fixed']);
224
		$row['date_begin_fixed']	= $this->increment_ISO($row['date_begin_fixed']);
225
		
226
		$row['date_end_report']		= $this->increment_ISO($row['date_end_report']);
227
		$row['quantity_alert_begin']= $this->increment_ISO($row['quantity_alert_begin']);
228
		$row['quantity_alert_end']	= $this->increment_ISO($row['quantity_alert_end']);
229
		
230
		$row['dynconf_begin']       = $this->increment_ISO($row['dynconf_begin']);
231
		$row['dynconf_end']         = $this->increment_ISO($row['dynconf_end']);
232
233
		$row['description'] = preg_replace_callback("/\d{4}/",
234
			create_function(
235
			   '$matches',
236
			   'return $matches[0] + '.$this->increment.';'
237
			 ),
238
			$row['description']
239
		);
240
		
241
		$row['renewal_parent']    = $row['id'];
242
		
243
		
244
245
		$res = $babDB->db_query("
246
		SELECT COUNT(*) FROM ".ABSENCES_RIGHTS_TBL."
247
		WHERE
248
			description=".$babDB->quote($row['description'])."
249
			AND date_begin=".$babDB->quote($row['date_begin'])."
250
			AND date_end=".$babDB->quote($row['date_end'])."
251
		");
252
253
		list($n) = $babDB->db_fetch_array($res);
254
255
		if ($n > 0) {
256
			$this->addMessage(sprintf(absences_translate("The right %s already exists"), $row['description']));
257
			return false;
258
		}
259
260
		return true;
261
	}
262
263
264
265
	private function insert_row($row) {
266
267
		global $babDB;
268
269
		$old_id_right = $row['id'];
270
271
		unset($row['id']);
272
273
		foreach($row as $key => $value) {
274
			$row[$key] = $babDB->db_escape_string($value);
275
		}
276
277
		$babDB->db_query("INSERT INTO ".ABSENCES_RIGHTS_TBL." (".implode(',',array_keys($row)).") VALUES (".$babDB->quote($row).")");
278
279
		$this->nb_right_insert++;
280
281
		$new_id_right = $babDB->db_insert_id();
282
283
284
		$res = $babDB->db_query("SELECT * FROM ".ABSENCES_RIGHTS_RULES_TBL." WHERE id_right=".$babDB->quote($old_id_right));
285
		if ($rule = $babDB->db_fetch_assoc($res)) {
286
			unset($rule['id']);
287
			$rule['id_right'] = $new_id_right;
288
289
			$rule['trigger_p1_begin']	= $this->increment_ISO($rule['trigger_p1_begin']);
290
			$rule['trigger_p1_end']		= $this->increment_ISO($rule['trigger_p1_end']);
291
292
			$rule['trigger_p2_begin']	= $this->increment_ISO($rule['trigger_p2_begin']);
293
			$rule['trigger_p2_end']		= $this->increment_ISO($rule['trigger_p2_end']);
294
295
			$babDB->db_query("INSERT INTO ".ABSENCES_RIGHTS_RULES_TBL." (".implode(',',array_keys($rule)).") VALUES (".$babDB->quote($rule).")");
296
		}
297
298
299
		$res = $babDB->db_query("SELECT * FROM ".ABSENCES_RIGHTS_INPERIOD_TBL." WHERE id_right=".$babDB->quote($old_id_right));
300
		if ($inperiod = $babDB->db_fetch_assoc($res)) {
301
			unset($inperiod['id']);
302
			$inperiod['id_right'] = $new_id_right;
303
304
			$inperiod['period_start']	= $this->increment_ISO($inperiod['period_start']);
305
			$inperiod['period_end']		= $this->increment_ISO($inperiod['period_end']);
306
307
			$babDB->db_query("INSERT INTO ".ABSENCES_RIGHTS_INPERIOD_TBL." (".implode(',',array_keys($inperiod)).") VALUES (".$babDB->quote($inperiod).")");
308
		}
309
		
310
		
311
		
312
		
313
		$res = $babDB->db_query("SELECT * FROM absences_dynamic_configuration WHERE id_right=".$babDB->quote($old_id_right));
314 View Code Duplication
		while ($arr = $babDB->db_fetch_assoc($res))
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...
315
		{
316
		    $babDB->db_query('INSERT INTO absences_dynamic_configuration (id_right, test_quantity, quantity) 
317
		        VALUES ('.$babDB->quote($new_id_right).', '.$babDB->quote($arr['test_quantity']).', '.$babDB->quote($arr['quantity']).')');
318
		}
319
		
320
		
321
		// recopier les liens droit-regime
322
		
323
		$res = $babDB->db_query('SELECT * FROM absences_coll_rights WHERE id_right='.$babDB->quote($old_id_right));
324 View Code Duplication
		while ($arr = $babDB->db_fetch_assoc($res))
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...
325
		{
326
			$babDB->db_query('INSERT INTO absences_coll_rights (id_coll, id_right) VALUES ('.$babDB->quote($arr['id_coll']).', '.$babDB->quote($new_id_right).')');
327
		}
328
		
329
		
330
		
331
		// recopier les liens droit-utilisateur
332
		
333
		$res = $babDB->db_query("SELECT
334
			t2.* 
335
		FROM
336
				absences_users_rights t2
337
				WHERE t2.id_right=".$babDB->quote($old_id_right)." AND renewal='1'");
338
339
		while ($arr = $babDB->db_fetch_assoc($res)) {
340
			$babDB->db_query("INSERT INTO absences_users_rights (
341
				id_user, 
342
				id_right,
343
				date_begin_valid,
344
				date_end_valid,
345
				inperiod_start,
346
				inperiod_end,
347
				validoverlap,
348
				saving_begin,
349
				saving_end 
350
			) VALUES (
351
				".$babDB->quote($arr['id_user']).",
352
				".$babDB->quote($new_id_right).",
353
				".$babDB->quote($this->increment_ISO($arr['date_begin_valid'])).",
354
				".$babDB->quote($this->increment_ISO($arr['date_begin_valid'])).",
355
				".$babDB->quote($this->increment_ISO($arr['inperiod_start'])).",
356
				".$babDB->quote($this->increment_ISO($arr['inperiod_end'])).",
357
				".$babDB->quote($arr['validoverlap']).",
358
				".$babDB->quote($this->increment_ISO($arr['saving_begin'])).",
359
				".$babDB->quote($this->increment_ISO($arr['saving_end']))."
360
			)");
361
		}
362
363
	}
364
}
365