Completed
Branch develop (83c04d)
by
unknown
14:55
created
htdocs/fourn/card.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
45 45
 }
46 46
 if (!empty($conf->accounting->enabled)) {
47
-	require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
47
+	require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
48 48
 }
49 49
 
50 50
 // Load translation files required by page
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 		print '<td class="titlefield">';
281 281
 		print $form->textwithpicto($langs->trans('VATReverseChargeByDefault'), $langs->trans('VATReverseChargeByDefaultDesc'));
282 282
 		print '</td><td>';
283
-		print '<input type="checkbox" name="vat_reverse_charge" ' . ($object->vat_reverse_charge == '1' ? ' checked' : '') . ' disabled>';
283
+		print '<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge == '1' ? ' checked' : '').' disabled>';
284 284
 		print '</td>';
285 285
 		print '</tr>';
286 286
 	}
Please login to merge, or discard this patch.
htdocs/core/lib/functions2.lib.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 		} else {
197 197
 			print ': ';
198 198
 		}
199
-		if (! empty($object->user_creation) && is_object($object->user_creation)) {	// deprecated mode
199
+		if (!empty($object->user_creation) && is_object($object->user_creation)) {	// deprecated mode
200 200
 			if ($object->user_creation->id) {
201 201
 				print $object->user_creation->getNomUrl(-1, '', 0, 0, 0);
202 202
 			} else {
@@ -1216,14 +1216,14 @@  discard block
 block discarded – undo
1216 1216
 	$counter = 0;
1217 1217
 	$sql = "SELECT MAX(".$sqlstring.") as val";
1218 1218
 	$sql .= " FROM ".MAIN_DB_PREFIX.$table;
1219
-	$sql .= " WHERE ".$field." LIKE '".$db->escape($maskLike) . (getDolGlobalString('SEARCH_FOR_NEXT_VAL_ON_START_ONLY') ? "%" : "") . "'";
1219
+	$sql .= " WHERE ".$field." LIKE '".$db->escape($maskLike).(getDolGlobalString('SEARCH_FOR_NEXT_VAL_ON_START_ONLY') ? "%" : "")."'";
1220 1220
 	$sql .= " AND ".$field." NOT LIKE '(PROV%)'";
1221 1221
 
1222 1222
 	// To ensure that all variables within the MAX() brackets are integers
1223 1223
 	// This avoid bad detection of max when data are noised with non numeric values at the position of the numero
1224 1224
 	if (getDolGlobalInt('MAIN_NUMBERING_FILTER_ON_INT_ONLY')) {
1225 1225
 		// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
1226
-		$sql .= " AND ". $db->regexpsql($sqlstring, '^[0-9]+$', 1);
1226
+		$sql .= " AND ".$db->regexpsql($sqlstring, '^[0-9]+$', 1);
1227 1227
 	}
1228 1228
 
1229 1229
 	if ($bentityon) { // only if entity enable
@@ -1285,7 +1285,7 @@  discard block
 block discarded – undo
1285 1285
 		$ref = '';
1286 1286
 		$sql = "SELECT ".$field." as ref";
1287 1287
 		$sql .= " FROM ".MAIN_DB_PREFIX.$table;
1288
-		$sql .= " WHERE ".$field." LIKE '".$db->escape($maskLike) . (getDolGlobalString('SEARCH_FOR_NEXT_VAL_ON_START_ONLY') ? "%" : "") . "'";
1288
+		$sql .= " WHERE ".$field." LIKE '".$db->escape($maskLike).(getDolGlobalString('SEARCH_FOR_NEXT_VAL_ON_START_ONLY') ? "%" : "")."'";
1289 1289
 		$sql .= " AND ".$field." NOT LIKE '%PROV%'";
1290 1290
 		if ($bentityon) { // only if entity enable
1291 1291
 			$sql .= " AND entity IN (".getEntity($sharetable).")";
@@ -1349,7 +1349,7 @@  discard block
 block discarded – undo
1349 1349
 			$maskrefclient_sql = "SELECT MAX(".$maskrefclient_sqlstring.") as val";
1350 1350
 			$maskrefclient_sql .= " FROM ".MAIN_DB_PREFIX.$table;
1351 1351
 			//$sql.= " WHERE ".$field." not like '(%'";
1352
-			$maskrefclient_sql .= " WHERE ".$field." LIKE '".$db->escape($maskrefclient_maskLike) . (getDolGlobalString('SEARCH_FOR_NEXT_VAL_ON_START_ONLY') ? "%" : "") . "'";
1352
+			$maskrefclient_sql .= " WHERE ".$field." LIKE '".$db->escape($maskrefclient_maskLike).(getDolGlobalString('SEARCH_FOR_NEXT_VAL_ON_START_ONLY') ? "%" : "")."'";
1353 1353
 			if ($bentityon) { // only if entity enable
1354 1354
 				$maskrefclient_sql .= " AND entity IN (".getEntity($sharetable).")";
1355 1355
 			} elseif (!empty($forceentity)) {
@@ -2955,7 +2955,7 @@  discard block
 block discarded – undo
2955 2955
 	$string = trim($string);
2956 2956
 
2957 2957
 	// If string does not start and end with parenthesis, we return $string as is.
2958
-	if (! preg_match('/^\(.*\)$/', $string)) {
2958
+	if (!preg_match('/^\(.*\)$/', $string)) {
2959 2959
 		return $string;
2960 2960
 	}
2961 2961
 
@@ -2992,15 +2992,15 @@  discard block
 block discarded – undo
2992 2992
 function getArrayOfEmoji()
2993 2993
 {
2994 2994
 	$arrayofcommonemoji = array(
2995
-		'misc' => array('2600', '26FF'),		// Miscellaneous Symbols
2996
-		'ding' => array('2700', '27BF'),		// Dingbats
2997
-		'????' => array('9989', '9989'),		// Variation Selectors
2998
-		'vars' => array('FE00', 'FE0F'),		// Variation Selectors
2999
-		'pict' => array('1F300', '1F5FF'),		// Miscellaneous Symbols and Pictographs
3000
-		'emot' => array('1F600', '1F64F'),		// Emoticons
3001
-		'tran' => array('1F680', '1F6FF'),		// Transport and Map Symbols
3002
-		'flag' => array('1F1E0', '1F1FF'),		// Flags (note: may be 1F1E6 instead of 1F1E0)
3003
-		'supp' => array('1F900', '1F9FF'),		// Supplemental Symbols and Pictographs
2995
+		'misc' => array('2600', '26FF'), // Miscellaneous Symbols
2996
+		'ding' => array('2700', '27BF'), // Dingbats
2997
+		'????' => array('9989', '9989'), // Variation Selectors
2998
+		'vars' => array('FE00', 'FE0F'), // Variation Selectors
2999
+		'pict' => array('1F300', '1F5FF'), // Miscellaneous Symbols and Pictographs
3000
+		'emot' => array('1F600', '1F64F'), // Emoticons
3001
+		'tran' => array('1F680', '1F6FF'), // Transport and Map Symbols
3002
+		'flag' => array('1F1E0', '1F1FF'), // Flags (note: may be 1F1E6 instead of 1F1E0)
3003
+		'supp' => array('1F900', '1F9FF'), // Supplemental Symbols and Pictographs
3004 3004
 	);
3005 3005
 
3006 3006
 	return $arrayofcommonemoji;
Please login to merge, or discard this patch.
htdocs/emailcollector/class/emailcollector.class.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -24,25 +24,25 @@  discard block
 block discarded – undo
24 24
  */
25 25
 
26 26
 // Put here all includes required by your class file
27
-include_once DOL_DOCUMENT_ROOT .'/emailcollector/lib/emailcollector.lib.php';
28
-
29
-require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
30
-require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
31
-require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
32
-
33
-require_once DOL_DOCUMENT_ROOT .'/comm/propal/class/propal.class.php';                   // Customer Proposal
34
-require_once DOL_DOCUMENT_ROOT .'/commande/class/commande.class.php';                    // Sale Order
35
-require_once DOL_DOCUMENT_ROOT .'/compta/facture/class/facture.class.php';               // Customer Invoice
36
-require_once DOL_DOCUMENT_ROOT .'/contact/class/contact.class.php';                      // Contact / Address
37
-require_once DOL_DOCUMENT_ROOT .'/expedition/class/expedition.class.php';                // Shipping / Delivery
38
-require_once DOL_DOCUMENT_ROOT .'/fourn/class/fournisseur.commande.class.php';           // Purchase Order
39
-require_once DOL_DOCUMENT_ROOT .'/fourn/class/fournisseur.facture.class.php';            // Purchase Invoice
40
-require_once DOL_DOCUMENT_ROOT .'/projet/class/project.class.php';                       // Project
41
-require_once DOL_DOCUMENT_ROOT .'/reception/class/reception.class.php';                  // Reception
42
-require_once DOL_DOCUMENT_ROOT .'/recruitment/class/recruitmentcandidature.class.php';   // Recruiting
43
-require_once DOL_DOCUMENT_ROOT .'/societe/class/societe.class.php';                      // Third-Party
44
-require_once DOL_DOCUMENT_ROOT .'/supplier_proposal/class/supplier_proposal.class.php';  // Supplier Proposal
45
-require_once DOL_DOCUMENT_ROOT .'/ticket/class/ticket.class.php';                        // Ticket
27
+include_once DOL_DOCUMENT_ROOT.'/emailcollector/lib/emailcollector.lib.php';
28
+
29
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
30
+require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
31
+require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
32
+
33
+require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; // Customer Proposal
34
+require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; // Sale Order
35
+require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // Customer Invoice
36
+require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; // Contact / Address
37
+require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; // Shipping / Delivery
38
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; // Purchase Order
39
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; // Purchase Invoice
40
+require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Project
41
+require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php'; // Reception
42
+require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php'; // Recruiting
43
+require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; // Third-Party
44
+require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; // Supplier Proposal
45
+require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; // Ticket
46 46
 //require_once DOL_DOCUMENT_ROOT .'/expensereport/class/expensereport.class.php';        // Expense Report
47 47
 //require_once DOL_DOCUMENT_ROOT .'/holiday/class/holiday.class.php';                    // Holidays (leave request)
48 48
 
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 		} elseif (empty($this->imap_encryption) || ($this->imap_encryption == 'ssl' && getDolGlobalString('IMAP_FORCE_NOSSL'))) {
788 788
 			$flags .= '';
789 789
 		} else {
790
-			$flags .= '/' . $this->imap_encryption;
790
+			$flags .= '/'.$this->imap_encryption;
791 791
 		}
792 792
 
793 793
 		$flags .= '/novalidate-cert';
@@ -817,8 +817,8 @@  discard block
 block discarded – undo
817 817
 	{
818 818
 		if (function_exists('mb_convert_encoding')) {
819 819
 			// change spaces by entropy because mb_convert fail with spaces
820
-			$str = preg_replace("/ /", "xxxSPACExxx", $str);		// the replacement string must be valid in utf7 so _ can't be used
821
-			$str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str);	// the replacement string must be valid in utf7 so _ can't be used
820
+			$str = preg_replace("/ /", "xxxSPACExxx", $str); // the replacement string must be valid in utf7 so _ can't be used
821
+			$str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str); // the replacement string must be valid in utf7 so _ can't be used
822 822
 			// if mb_convert work
823 823
 			if ($str = mb_convert_encoding($str, "UTF-7")) {
824 824
 				// change characters
@@ -1430,7 +1430,7 @@  discard block
 block discarded – undo
1430 1430
 				}
1431 1431
 
1432 1432
 				if ($rule['type'] == 'from') {
1433
-					$tmprulevaluearray = explode('*', $rule['rulevalue']);	// Search on abc*def means searching on 'abc' and on 'def'
1433
+					$tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def'
1434 1434
 					if (count($tmprulevaluearray) >= 2) {
1435 1435
 						foreach ($tmprulevaluearray as $tmprulevalue) {
1436 1436
 							$search .= ($search ? ' ' : '').$not.'FROM "'.str_replace('"', '', $tmprulevalue).'"';
@@ -1440,7 +1440,7 @@  discard block
 block discarded – undo
1440 1440
 					}
1441 1441
 				}
1442 1442
 				if ($rule['type'] == 'to') {
1443
-					$tmprulevaluearray = explode('*', $rule['rulevalue']);	// Search on abc*def means searching on 'abc' and on 'def'
1443
+					$tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def'
1444 1444
 					if (count($tmprulevaluearray) >= 2) {
1445 1445
 						foreach ($tmprulevaluearray as $tmprulevalue) {
1446 1446
 							$search .= ($search ? ' ' : '').$not.'TO "'.str_replace('"', '', $tmprulevalue).'"';
@@ -1616,7 +1616,7 @@  discard block
 block discarded – undo
1616 1616
 			}
1617 1617
 		}
1618 1618
 
1619
-		$arrayofemailtodelete = array();	// Track email to delete to make the deletion at end.
1619
+		$arrayofemailtodelete = array(); // Track email to delete to make the deletion at end.
1620 1620
 
1621 1621
 		// Loop on each email found
1622 1622
 		if (!$error && !empty($arrayofemail) && count($arrayofemail) > 0) {
@@ -1814,7 +1814,7 @@  discard block
 block discarded – undo
1814 1814
 						$attachments = [];
1815 1815
 					}
1816 1816
 				} else {
1817
-					$this->getmsg($connection, $imapemail);	// This set global var $charset, $htmlmsg, $plainmsg, $attachments
1817
+					$this->getmsg($connection, $imapemail); // This set global var $charset, $htmlmsg, $plainmsg, $attachments
1818 1818
 				}
1819 1819
 				'@phan-var-force Webklex\PHPIMAP\Attachment[] $attachments';
1820 1820
 
@@ -2145,7 +2145,7 @@  discard block
 block discarded – undo
2145 2145
 									} else {
2146 2146
 										foreach ($arrayofreferences as $key => $referencetmp) {
2147 2147
 											if (!str_contains($objectemail->origin_references, $referencetmp)) {
2148
-												$objectemail->origin_references.= " ".$referencetmp;
2148
+												$objectemail->origin_references .= " ".$referencetmp;
2149 2149
 												$changeonticket_references = true;
2150 2150
 											}
2151 2151
 										}
@@ -2281,7 +2281,7 @@  discard block
 block discarded – undo
2281 2281
 
2282 2282
 						// Make Operation
2283 2283
 						dol_syslog("Execute action ".$operation['type']." actionparam=".$operation['actionparam'].' thirdpartystatic->id='.$thirdpartystatic->id.' contactstatic->id='.$contactstatic->id.' projectstatic->id='.$projectstatic->id);
2284
-						dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type);	// If a Dolibarr tracker id is found, we should now the id of object
2284
+						dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type); // If a Dolibarr tracker id is found, we should now the id of object
2285 2285
 
2286 2286
 						$actioncode = 'EMAIL_IN';
2287 2287
 						// If we scan the Sent box, we use the code for out email
@@ -2316,7 +2316,7 @@  discard block
 block discarded – undo
2316 2316
 							$alreadycreated2 = $tickettocreate->fetch(0, '', '', $msgid);
2317 2317
 							$alreadycreated = $alreadycreated1 + $alreadycreated2;
2318 2318
 							if ($alreadycreated1 < 0 || $alreadycreated2 < 0) {
2319
-								$errorfetchticket ++;
2319
+								$errorfetchticket++;
2320 2320
 							}
2321 2321
 							if (empty($errorfetchticket)) {
2322 2322
 								if ($alreadycreated == 0) {
@@ -2556,11 +2556,11 @@  discard block
 block discarded – undo
2556 2556
 									$result = $contactstatic->fetch(0, null, '', $from);
2557 2557
 									if ($result < 0) {
2558 2558
 										$errorforactions++;
2559
-										$this->error = 'Error when getting contact with email ' . $from;
2559
+										$this->error = 'Error when getting contact with email '.$from;
2560 2560
 										$this->errors[] = $this->error;
2561 2561
 										break;
2562 2562
 									} elseif ($result == 0) {
2563
-										dol_syslog("Contact with email " . $from . " was not found. We try to create it.");
2563
+										dol_syslog("Contact with email ".$from." was not found. We try to create it.");
2564 2564
 										$contactstatic = new Contact($this->db);
2565 2565
 
2566 2566
 										// Create contact
@@ -2575,28 +2575,28 @@  discard block
 block discarded – undo
2575 2575
 										} else {
2576 2576
 											// Search country by name or code
2577 2577
 											if (!empty($contactstatic->country)) {
2578
-												require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
2578
+												require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
2579 2579
 												$result = getCountry('', 3, $this->db, '', 1, $contactstatic->country);
2580 2580
 												if ($result == 'NotDefined') {
2581 2581
 													$errorforactions++;
2582
-													$this->error = "Error country not found by this name '" . $contactstatic->country . "'";
2582
+													$this->error = "Error country not found by this name '".$contactstatic->country."'";
2583 2583
 												} elseif (!($result > 0)) {
2584 2584
 													$errorforactions++;
2585
-													$this->error = "Error when search country by this name '" . $contactstatic->country . "'";
2585
+													$this->error = "Error when search country by this name '".$contactstatic->country."'";
2586 2586
 													$this->errors[] = $this->db->lasterror();
2587 2587
 												} else {
2588 2588
 													$contactstatic->country_id = $result;
2589 2589
 													$operationslog .= '<br>We set property country_id='.dol_escape_htmltag($result);
2590 2590
 												}
2591 2591
 											} elseif (!empty($contactstatic->country_code)) {
2592
-												require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
2592
+												require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
2593 2593
 												$result = getCountry($contactstatic->country_code, 3, $this->db);
2594 2594
 												if ($result == 'NotDefined') {
2595 2595
 													$errorforactions++;
2596
-													$this->error = "Error country not found by this code '" . $contactstatic->country_code . "'";
2596
+													$this->error = "Error country not found by this code '".$contactstatic->country_code."'";
2597 2597
 												} elseif (!($result > 0)) {
2598 2598
 													$errorforactions++;
2599
-													$this->error = "Error when search country by this code '" . $contactstatic->country_code . "'";
2599
+													$this->error = "Error when search country by this code '".$contactstatic->country_code."'";
2600 2600
 													$this->errors[] = $this->db->lasterror();
2601 2601
 												} else {
2602 2602
 													$contactstatic->country_id = $result;
@@ -2607,28 +2607,28 @@  discard block
 block discarded – undo
2607 2607
 											if (!$errorforactions) {
2608 2608
 												// Search state by name or code (for country if defined)
2609 2609
 												if (!empty($contactstatic->state)) {
2610
-													require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
2610
+													require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
2611 2611
 													$result = dol_getIdFromCode($this->db, $contactstatic->state, 'c_departements', 'nom', 'rowid');
2612 2612
 													if (empty($result)) {
2613 2613
 														$errorforactions++;
2614
-														$this->error = "Error state not found by this name '" . $contactstatic->state . "'";
2614
+														$this->error = "Error state not found by this name '".$contactstatic->state."'";
2615 2615
 													} elseif (!($result > 0)) {
2616 2616
 														$errorforactions++;
2617
-														$this->error = "Error when search state by this name '" . $contactstatic->state . "'";
2617
+														$this->error = "Error when search state by this name '".$contactstatic->state."'";
2618 2618
 														$this->errors[] = $this->db->lasterror();
2619 2619
 													} else {
2620 2620
 														$contactstatic->state_id = $result;
2621 2621
 														$operationslog .= '<br>We set property state_id='.dol_escape_htmltag($result);
2622 2622
 													}
2623 2623
 												} elseif (!empty($contactstatic->state_code)) {
2624
-													require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
2624
+													require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
2625 2625
 													$result = dol_getIdFromCode($this->db, $contactstatic->state_code, 'c_departements', 'code_departement', 'rowid');
2626 2626
 													if (empty($result)) {
2627 2627
 														$errorforactions++;
2628
-														$this->error = "Error state not found by this code '" . $contactstatic->state_code . "'";
2628
+														$this->error = "Error state not found by this code '".$contactstatic->state_code."'";
2629 2629
 													} elseif (!($result > 0)) {
2630 2630
 														$errorforactions++;
2631
-														$this->error = "Error when search state by this code '" . $contactstatic->state_code . "'";
2631
+														$this->error = "Error when search state by this code '".$contactstatic->state_code."'";
2632 2632
 														$this->errors[] = $this->db->lasterror();
2633 2633
 													} else {
2634 2634
 														$contactstatic->state_id = $result;
@@ -2691,8 +2691,8 @@  discard block
 block discarded – undo
2691 2691
 								$actioncomm->label       = $langs->trans("ActionAC_".$actioncode).' - '.$langs->trans("MailFrom").' '.$from;
2692 2692
 								$actioncomm->note_private = $descriptionfull;
2693 2693
 								$actioncomm->fk_project  = $projectstatic->id;
2694
-								$actioncomm->datep       = $date;	// date of email
2695
-								$actioncomm->datef       = $date;	// date of email
2694
+								$actioncomm->datep       = $date; // date of email
2695
+								$actioncomm->datef       = $date; // date of email
2696 2696
 								$actioncomm->percentage  = -1; // Not applicable
2697 2697
 								$actioncomm->socid       = $thirdpartystatic->id;
2698 2698
 								$actioncomm->contact_id = $contactstatic->id;
@@ -2891,7 +2891,7 @@  discard block
 block discarded – undo
2891 2891
 								}
2892 2892
 								$hookmanager->initHooks(array('emailcolector'));
2893 2893
 								$parameters = array('arrayobject' => $arrayobject);
2894
-								$reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters);    // Note that $action and $object may have been modified by some hooks
2894
+								$reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters); // Note that $action and $object may have been modified by some hooks
2895 2895
 								if ($reshook > 0) {
2896 2896
 									$arrayobject = $hookmanager->resArray;
2897 2897
 								}
@@ -2900,10 +2900,10 @@  discard block
 block discarded – undo
2900 2900
 
2901 2901
 								foreach ($arrayobject as $key => $objectdesc) {
2902 2902
 									$sql = 'SELECT DISTINCT t.rowid ';
2903
-									$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->db->sanitize($objectdesc['table']) . ' AS t';
2903
+									$sql .= ' FROM '.MAIN_DB_PREFIX.$this->db->sanitize($objectdesc['table']).' AS t';
2904 2904
 									$sql .= ' WHERE ';
2905 2905
 									foreach ($objectdesc['fields'] as $field) {
2906
-										$sql .= "('" .$this->db->escape($subject) . "'  LIKE CONCAT('%',  t." . $this->db->sanitize($field) . ", '%') AND t." . $this->db->sanitize($field) . " <> '') OR ";
2906
+										$sql .= "('".$this->db->escape($subject)."'  LIKE CONCAT('%',  t.".$this->db->sanitize($field).", '%') AND t.".$this->db->sanitize($field)." <> '') OR ";
2907 2907
 									}
2908 2908
 									$sql = substr($sql, 0, -4);
2909 2909
 
@@ -2923,8 +2923,8 @@  discard block
 block discarded – undo
2923 2923
 									foreach ($ids as $val) {
2924 2924
 										$res = $objectmanaged->fetch($val);
2925 2925
 										if ($res) {
2926
-											$path = ($objectmanaged->entity > 1 ? "/" . $objectmanaged->entity : '');
2927
-											$dirs[] = DOL_DATA_ROOT . $path . "/" . $elementpath . '/' . dol_sanitizeFileName($objectmanaged->ref) . '/';
2926
+											$path = ($objectmanaged->entity > 1 ? "/".$objectmanaged->entity : '');
2927
+											$dirs[] = DOL_DATA_ROOT.$path."/".$elementpath.'/'.dol_sanitizeFileName($objectmanaged->ref).'/';
2928 2928
 										} else {
2929 2929
 											$this->errors[] = 'object not found';
2930 2930
 										}
@@ -2933,7 +2933,7 @@  discard block
 block discarded – undo
2933 2933
 								foreach ($dirs as $target) {
2934 2934
 									$prefix = $this->actions[$this->id]['actionparam'];
2935 2935
 									foreach ($data as $filename => $content) {
2936
-										$resr = saveAttachment($target, $prefix . '_' . $filename, $content);
2936
+										$resr = saveAttachment($target, $prefix.'_'.$filename, $content);
2937 2937
 										if ($resr == -1) {
2938 2938
 											$this->errors[] = 'Doc not saved';
2939 2939
 										}
@@ -2980,7 +2980,7 @@  discard block
 block discarded – undo
2980 2980
 								$percent_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'percent');
2981 2981
 
2982 2982
 								$projecttocreate->title = $subject;
2983
-								$projecttocreate->date_start = $date;	// date of email
2983
+								$projecttocreate->date_start = $date; // date of email
2984 2984
 								$projecttocreate->date_end = 0;
2985 2985
 								$projecttocreate->opp_status = $id_opp_status;
2986 2986
 								$projecttocreate->opp_percent = $percent_opp_status;
@@ -3242,7 +3242,7 @@  discard block
 block discarded – undo
3242 3242
 								$candidaturetocreate->note_private = $descriptionfull;
3243 3243
 								$candidaturetocreate->entity = $conf->entity;
3244 3244
 								$candidaturetocreate->email_msgid = $msgid;
3245
-								$candidaturetocreate->email_date = $date;		// date of email
3245
+								$candidaturetocreate->email_date = $date; // date of email
3246 3246
 								$candidaturetocreate->status = $candidaturetocreate::STATUS_DRAFT;
3247 3247
 								//$candidaturetocreate->fk_contact = $contactstatic->id;
3248 3248
 
@@ -3609,8 +3609,8 @@  discard block
 block discarded – undo
3609 3609
 				 * append increment number to the original filename
3610 3610
 				 */
3611 3611
 				while (file_exists($destdir.$file_name.".".$extension)) {
3612
-					$file_name = $file_name_original . ' (' . $num . ')';
3613
-					$file_name_complete = $file_name . "." . $extension;
3612
+					$file_name = $file_name_original.' ('.$num.')';
3613
+					$file_name_complete = $file_name.".".$extension;
3614 3614
 					$destination = $destdir.$file_name_complete;
3615 3615
 					$num++;
3616 3616
 				}
@@ -3724,7 +3724,7 @@  discard block
 block discarded – undo
3724 3724
 	 */
3725 3725
 	private function saveAttachment($destdir, $filename, $content)
3726 3726
 	{
3727
-		require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php';
3727
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
3728 3728
 
3729 3729
 		$tmparraysize = getDefaultImageSizes();
3730 3730
 		$maxwidthsmall = $tmparraysize['maxwidthsmall'];
Please login to merge, or discard this patch.
htdocs/webhook/target_card.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 global $conf, $db, $hookmanager, $langs, $user;
35 35
 
36 36
 // Load translation files required by the page
37
-$langs->loadLangs(array('other','admin'));
37
+$langs->loadLangs(array('other', 'admin'));
38 38
 
39 39
 // Get parameters
40 40
 $id = GETPOSTINT('id');
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'targetcard'; // To manage different context of search
46 46
 $backtopage = GETPOST('backtopage', 'alpha');
47 47
 $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
48
-$lineid   = GETPOSTINT('lineid');
48
+$lineid = GETPOSTINT('lineid');
49 49
 
50 50
 // Initialize technical objects
51 51
 $object = new Target($db);
Please login to merge, or discard this patch.
htdocs/webhook/ajax/webhook.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,10 +92,10 @@
 block discarded – undo
92 92
 			if (is_object($obj)) {
93 93
 				//TODO: Case if obj is an object
94 94
 			} else {
95
-				$objnotfound ++;
95
+				$objnotfound++;
96 96
 			}
97 97
 		} else {
98
-			$objnotfound ++;
98
+			$objnotfound++;
99 99
 		}
100 100
 
101 101
 		if ($objnotfound) {
Please login to merge, or discard this patch.
test/phpunit/SecurityTest.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -24,36 +24,36 @@  discard block
 block discarded – undo
24 24
  *		\remarks	To run this script as CLI:  phpunit filename.php
25 25
  */
26 26
 
27
-global $conf,$user,$langs,$db;
27
+global $conf, $user, $langs, $db;
28 28
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
29 29
 //require_once 'PHPUnit/Autoload.php';
30 30
 
31
-if (! defined('NOREQUIRESOC')) {
31
+if (!defined('NOREQUIRESOC')) {
32 32
 	define('NOREQUIRESOC', '1');
33 33
 }
34
-if (! defined('NOCSRFCHECK')) {
34
+if (!defined('NOCSRFCHECK')) {
35 35
 	define('NOCSRFCHECK', '1');
36 36
 }
37
-if (! defined('NOTOKENRENEWAL')) {
37
+if (!defined('NOTOKENRENEWAL')) {
38 38
 	define('NOTOKENRENEWAL', '1');
39 39
 }
40
-if (! defined('NOREQUIREMENU')) {
40
+if (!defined('NOREQUIREMENU')) {
41 41
 	define('NOREQUIREMENU', '1'); // If there is no menu to show
42 42
 }
43
-if (! defined('NOREQUIREHTML')) {
43
+if (!defined('NOREQUIREHTML')) {
44 44
 	define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
45 45
 }
46
-if (! defined('NOREQUIREAJAX')) {
46
+if (!defined('NOREQUIREAJAX')) {
47 47
 	define('NOREQUIREAJAX', '1');
48 48
 }
49
-if (! defined("NOLOGIN")) {
50
-	define("NOLOGIN", '1');       // If this page is public (can be called outside logged session)
49
+if (!defined("NOLOGIN")) {
50
+	define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
51 51
 }
52
-if (! defined("NOSESSION")) {
52
+if (!defined("NOSESSION")) {
53 53
 	define("NOSESSION", '1');
54 54
 }
55 55
 
56
-require_once dirname(__FILE__).'/../../htdocs/main.inc.php';	// We force include of main.inc.php instead of master.inc.php even if we are in CLI mode because it contains a lot of security components we want to test.
56
+require_once dirname(__FILE__).'/../../htdocs/main.inc.php'; // We force include of main.inc.php instead of master.inc.php even if we are in CLI mode because it contains a lot of security components we want to test.
57 57
 require_once dirname(__FILE__).'/../../htdocs/core/lib/security.lib.php';
58 58
 require_once dirname(__FILE__).'/../../htdocs/core/lib/security2.lib.php';
59 59
 require_once dirname(__FILE__).'/CommonClassTest.class.php';
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 		$result = testSqlAndScriptInject($test, 0);
228 228
 		$this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject eee');
229 229
 
230
-		$test = "<IMG SRC=\"jav\tascript:alert('XSS');\">";		// Is locked by some browser like chrome because the default directive no-referrer-when-downgrade is sent when requesting the SRC and then refused because of browser protection on img src load without referrer.
231
-		$test = "<IMG SRC=\"jav&#x0D;ascript:alert('XSS');\">";	// Same
230
+		$test = "<IMG SRC=\"jav\tascript:alert('XSS');\">"; // Is locked by some browser like chrome because the default directive no-referrer-when-downgrade is sent when requesting the SRC and then refused because of browser protection on img src load without referrer.
231
+		$test = "<IMG SRC=\"jav&#x0D;ascript:alert('XSS');\">"; // Same
232 232
 
233 233
 		$test = '<SCRIPT/XSS SRC="http://xss.rocks/xss.js"></SCRIPT>';
234 234
 		$result = testSqlAndScriptInject($test, 0);
@@ -262,21 +262,21 @@  discard block
 block discarded – undo
262 262
 		$result = testSqlAndScriptInject($test, 0);
263 263
 		$this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject lll');
264 264
 
265
-		$test = '<a onscrollend=alert(1) style="display:block;overflow:auto;border:1px+dashed;width:500px;height:100px;"><br><br><br><br><br><span+id=x>test</span></a>';	// Add the char %F6 into the variable
265
+		$test = '<a onscrollend=alert(1) style="display:block;overflow:auto;border:1px+dashed;width:500px;height:100px;"><br><br><br><br><br><span+id=x>test</span></a>'; // Add the char %F6 into the variable
266 266
 		$result = testSqlAndScriptInject($test, 0);
267 267
 		//print "test=".$test." result=".$result."\n";
268 268
 		$this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject mmm');
269 269
 
270 270
 
271 271
 		$test = "Text with ' encoded with the numeric html entity converted into text entity &#39; (like when submitted by CKEditor)";
272
-		$result = testSqlAndScriptInject($test, 0);	// result must be 0
272
+		$result = testSqlAndScriptInject($test, 0); // result must be 0
273 273
 		$this->assertEquals(0, $result, 'Error on testSqlAndScriptInject mmm, result should be 0 and is not');
274 274
 
275 275
 		$test = '<a href="j&Tab;a&Tab;v&Tab;asc&NewLine;ri&Tab;pt:&lpar;a&Tab;l&Tab;e&Tab;r&Tab;t&Tab;(document.cookie)&rpar;">XSS</a>';
276 276
 		$result = testSqlAndScriptInject($test, 0);
277 277
 		$this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject nnn, result should be >= 1 and is not');
278 278
 
279
-		$test = "/dolibarr/htdocs/index.php/".chr('246')."abc";	// Add the char %F6 into the variable
279
+		$test = "/dolibarr/htdocs/index.php/".chr('246')."abc"; // Add the char %F6 into the variable
280 280
 		$result = testSqlAndScriptInject($test, 2);
281 281
 		//print "test=".$test." result=".$result."\n";
282 282
 		$this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject with a non valid UTF8 char');
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	 */
290 290
 	public function testGETPOST()
291 291
 	{
292
-		global $conf,$user,$langs,$db;
292
+		global $conf, $user, $langs, $db;
293 293
 		$conf = $this->savconf;
294 294
 		$user = $this->savuser;
295 295
 		$langs = $this->savlangs;
@@ -306,18 +306,18 @@  discard block
 block discarded – undo
306 306
 		$_GET["param1"] = "222";
307 307
 		$_POST["param1"] = "333";
308 308
 		$_GET["param2"] = 'a/b#e(pr)qq-rr\cc';
309
-		$_GET["param3"] = '"&#110;a/b#e(pr)qq-rr\cc';    // Same than param2 + " and &#110;
309
+		$_GET["param3"] = '"&#110;a/b#e(pr)qq-rr\cc'; // Same than param2 + " and &#110;
310 310
 		$_GET["param4a"] = '..&#47;../dir';
311 311
 		$_GET["param4b"] = '..&#92;..\dirwindows';
312 312
 		$_GET["param5"] = "a_1-b";
313 313
 		$_POST["param6"] = "&quot;&gt;<svg o&#110;load='console.log(&quot;123&quot;)'&gt;";
314 314
 		$_POST["param6b"] = '<<<../>../>../svg><<<../>../>../animate =alert(1)>abc';
315 315
 		$_GET["param7"] = '"c:\this is a path~1\aaa&#110; &#x&#x31;&#x31;&#x30;;" abc<bad>def</bad>';
316
-		$_POST["param8a"] = "Hacker<svg o&#110;load='console.log(&quot;123&quot;)'";	// html tag is not closed so it is not detected as html tag but is still harmfull
317
-		$_POST['param8b'] = '<img src=x onerror=alert(document.location) t=';		// this is html obfuscated by non closing tag
316
+		$_POST["param8a"] = "Hacker<svg o&#110;load='console.log(&quot;123&quot;)'"; // html tag is not closed so it is not detected as html tag but is still harmfull
317
+		$_POST['param8b'] = '<img src=x onerror=alert(document.location) t='; // this is html obfuscated by non closing tag
318 318
 		$_POST['param8c'] = '< with space after is ok';
319 319
 		$_POST['param8d'] = '<abc123 is html to clean';
320
-		$_POST['param8e'] = '<123abc is not html to clean';	// other similar case: '<2021-12-12'
320
+		$_POST['param8e'] = '<123abc is not html to clean'; // other similar case: '<2021-12-12'
321 321
 		$_POST['param8f'] = 'abc<<svg <><<animate onbegin=alert(document.domain) a';
322 322
 		$_POST["param9"] = 'is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : \'objnotdefined\'';
323 323
 		$_POST["param10"] = 'is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : \'<abc>objnotdefined\'';
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 
338 338
 
339 339
 
340
-		$result = GETPOST('id', 'int');              // Must return nothing
340
+		$result = GETPOST('id', 'int'); // Must return nothing
341 341
 		print __METHOD__." result=".$result."\n";
342 342
 		$this->assertEquals('', $result);
343 343
 
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 
352 352
 		// Test with alpha
353 353
 
354
-		$result = GETPOST("param0", 'alpha');		// a simple format, so " completely removed
354
+		$result = GETPOST("param0", 'alpha'); // a simple format, so " completely removed
355 355
 		$resultexpected = 'A real string with aaa and and \' and & inside content';
356 356
 		print __METHOD__." result=".$result."\n";
357 357
 		$this->assertEquals($resultexpected, $result, 'Test on param0');
@@ -360,15 +360,15 @@  discard block
 block discarded – undo
360 360
 		print __METHOD__." result=".$result."\n";
361 361
 		$this->assertEquals($result, 'a/b#e(pr)qq-rr/cc', 'Test on param2');
362 362
 
363
-		$result = GETPOST("param3", 'alpha');  // Must return string sanitized from char "
363
+		$result = GETPOST("param3", 'alpha'); // Must return string sanitized from char "
364 364
 		print __METHOD__." result=".$result."\n";
365 365
 		$this->assertEquals($result, 'na/b#e(pr)qq-rr/cc', 'Test on param3');
366 366
 
367
-		$result = GETPOST("param4a", 'alpha');  // Must return string sanitized from ../
367
+		$result = GETPOST("param4a", 'alpha'); // Must return string sanitized from ../
368 368
 		print __METHOD__." result=".$result."\n";
369 369
 		$this->assertEquals($result, 'dir');
370 370
 
371
-		$result = GETPOST("param4b", 'alpha');  // Must return string sanitized from ../
371
+		$result = GETPOST("param4b", 'alpha'); // Must return string sanitized from ../
372 372
 		print __METHOD__." result=".$result."\n";
373 373
 		$this->assertEquals($result, 'dirwindows');
374 374
 
@@ -378,19 +378,19 @@  discard block
 block discarded – undo
378 378
 		print __METHOD__." result=".$result."\n";
379 379
 		$this->assertEquals($result, $_GET["param1"]);
380 380
 
381
-		$result = GETPOST("param2", 'aZ09');  // Must return '' as string contains car not in aZ09 definition
381
+		$result = GETPOST("param2", 'aZ09'); // Must return '' as string contains car not in aZ09 definition
382 382
 		print __METHOD__." result=".$result."\n";
383 383
 		$this->assertEquals($result, '');
384 384
 
385
-		$result = GETPOST("param3", 'aZ09');  // Must return '' as string contains car not in aZ09 definition
385
+		$result = GETPOST("param3", 'aZ09'); // Must return '' as string contains car not in aZ09 definition
386 386
 		print __METHOD__." result=".$result."\n";
387 387
 		$this->assertEquals($result, '');
388 388
 
389
-		$result = GETPOST("param4a", 'aZ09');  // Must return '' as string contains car not in aZ09 definition
389
+		$result = GETPOST("param4a", 'aZ09'); // Must return '' as string contains car not in aZ09 definition
390 390
 		print __METHOD__." result=".$result."\n";
391 391
 		$this->assertEquals('', $result);
392 392
 
393
-		$result = GETPOST("param4b", 'aZ09');  // Must return '' as string contains car not in aZ09 definition
393
+		$result = GETPOST("param4b", 'aZ09'); // Must return '' as string contains car not in aZ09 definition
394 394
 		print __METHOD__." result=".$result."\n";
395 395
 		$this->assertEquals('', $result);
396 396
 
@@ -501,9 +501,9 @@  discard block
 block discarded – undo
501 501
 		print __METHOD__." result=".$result."\n";
502 502
 		$this->assertEquals("Text with ' encoded with the numeric html entity converted into text entity &#39; (like when submitted by CKEditor)", $result, 'Test 14');
503 503
 
504
-		$result = GETPOST("param15", 'restricthtml');		// param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string
504
+		$result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string
505 505
 		print __METHOD__." result=".$result."\n";
506
-		$this->assertEquals("<img onerror=alert(document.domain) src=>0xbeefed", $result, 'Test 15');	// The GETPOST return a harmull string
506
+		$this->assertEquals("<img onerror=alert(document.domain) src=>0xbeefed", $result, 'Test 15'); // The GETPOST return a harmull string
507 507
 
508 508
 		$result = GETPOST("param19", 'restricthtml');
509 509
 		print __METHOD__." result=".$result."\n";
@@ -520,17 +520,17 @@  discard block
 block discarded – undo
520 520
 		print __METHOD__." result for param0=".$result."\n";
521 521
 		$this->assertEquals($resultexpected, $result, 'Test on param0');
522 522
 
523
-		$result = GETPOST("param15", 'restricthtml');		// param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string
523
+		$result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string
524 524
 		print __METHOD__." result for param15=".$result."\n";
525 525
 		//$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b');   // With some PHP and libxml version, we got this result when parsing invalid HTML, but ...
526 526
 		//$this->assertEquals('<img onerror> src=&gt;0xbeefed', $result, 'Test 15b');	// ... on other PHP and libxml versions, we got a HTML that has been cleaned
527 527
 
528
-		$result = GETPOST("param6", 'restricthtml');		// param6 = "&quot;&gt;<svg o&#110;load='console.log(&quot;123&quot;)'&gt;"
528
+		$result = GETPOST("param6", 'restricthtml'); // param6 = "&quot;&gt;<svg o&#110;load='console.log(&quot;123&quot;)'&gt;"
529 529
 		print __METHOD__." result for param6=".$result." - before=".$_POST["param6"]."\n";
530 530
 		//$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b');   // With some PHP and libxml version, we got this result when parsing invalid HTML, but ...
531 531
 		//$this->assertEquals('"&gt;', $result);										// ... on other PHP and libxml versions, we got a HTML that has been cleaned
532 532
 
533
-		$result = GETPOST("param7", 'restricthtml');		// param7 = "c:\this is a path~1\aaa&#110; &#x&#x31;&#x31;&#x30;;" abc<bad>def</bad>
533
+		$result = GETPOST("param7", 'restricthtml'); // param7 = "c:\this is a path~1\aaa&#110; &#x&#x31;&#x31;&#x30;;" abc<bad>def</bad>
534 534
 		print __METHOD__." result param7 = ".$result."\n";
535 535
 		//$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b');   // With some PHP and libxml version, we got this result when parsing invalid HTML, but ...
536 536
 		//$this->assertEquals('"c:\this is a path~1\aaan 110;" abcdef', $result);		// ... on other PHP and libxml versions, we got a HTML that has been cleaned
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 			print __METHOD__." result for param0=".$result."\n";
548 548
 			$this->assertEquals($resultexpected, $result, 'Test on param0');
549 549
 
550
-			$result = GETPOST("param15", 'restricthtml');		// param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string
550
+			$result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string
551 551
 			print __METHOD__." result=".$result."\n";
552 552
 
553 553
 			$result = GETPOST("param6", 'restricthtml');
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 			print __METHOD__." result for param0=".$result."\n";
572 572
 			$this->assertEquals($resultexpected, $result, 'Test on param0');
573 573
 
574
-			$result = GETPOST("param15", 'restricthtml');		// param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string
574
+			$result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string
575 575
 			print __METHOD__." result=".$result."\n";
576 576
 
577 577
 			$result = GETPOST("param6", 'restricthtml');
@@ -784,21 +784,21 @@  discard block
 block discarded – undo
784 784
 	{
785 785
 		global $conf;
786 786
 
787
-		$genpass1 = getRandomPassword(true);				// Should be a string return by dol_hash (if no option set, will be md5)
787
+		$genpass1 = getRandomPassword(true); // Should be a string return by dol_hash (if no option set, will be md5)
788 788
 		print __METHOD__." genpass1=".$genpass1."\n";
789 789
 		$this->assertEquals(strlen($genpass1), 32);
790 790
 
791
-		$genpass1 = getRandomPassword(true, array('I'));	// Should be a string return by dol_hash (if no option set, will be md5)
791
+		$genpass1 = getRandomPassword(true, array('I')); // Should be a string return by dol_hash (if no option set, will be md5)
792 792
 		print __METHOD__." genpass1=".$genpass1."\n";
793 793
 		$this->assertEquals(strlen($genpass1), 32);
794 794
 
795 795
 		$conf->global->USER_PASSWORD_GENERATED = 'None';
796
-		$genpass2 = getRandomPassword(false);				// Should return an empty string
796
+		$genpass2 = getRandomPassword(false); // Should return an empty string
797 797
 		print __METHOD__." genpass2=".$genpass2."\n";
798 798
 		$this->assertEquals($genpass2, '');
799 799
 
800 800
 		$conf->global->USER_PASSWORD_GENERATED = 'Standard';
801
-		$genpass3 = getRandomPassword(false);				// Should return a password of 12 chars
801
+		$genpass3 = getRandomPassword(false); // Should return a password of 12 chars
802 802
 		print __METHOD__." genpass3=".$genpass3."\n";
803 803
 		$this->assertEquals(strlen($genpass3), 12);
804 804
 
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
 	 */
813 813
 	public function testRestrictedArea()
814 814
 	{
815
-		global $conf,$user,$langs,$db;
815
+		global $conf, $user, $langs, $db;
816 816
 		$conf = $this->savconf;
817 817
 		$user = $this->savuser;
818 818
 		$langs = $this->savlangs;
@@ -843,40 +843,40 @@  discard block
 block discarded – undo
843 843
 		$tmpvar = preg_match('/not supported/', $tmp['curl_error_msg']);
844 844
 		$this->assertEquals(1, $tmpvar, "Did not find the /not supported/ in getURLContent error message. We should.");
845 845
 
846
-		$url = 'https://www.dolibarr.fr';	// This is a redirect 301 page
847
-		$tmp = getURLContent($url, 'GET', '', 0);	// We do NOT follow
846
+		$url = 'https://www.dolibarr.fr'; // This is a redirect 301 page
847
+		$tmp = getURLContent($url, 'GET', '', 0); // We do NOT follow
848 848
 		print __METHOD__." url=".$url."\n";
849 849
 		$this->assertEquals(301, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url 301 response');
850 850
 
851
-		$url = 'https://www.dolibarr.fr';	// This is a redirect 301 page
852
-		$tmp = getURLContent($url);		// We DO follow a page with return 300 so result should be 200
851
+		$url = 'https://www.dolibarr.fr'; // This is a redirect 301 page
852
+		$tmp = getURLContent($url); // We DO follow a page with return 300 so result should be 200
853 853
 		print __METHOD__." url=".$url."\n";
854 854
 		$this->assertEquals(200, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url 301 with a follow -> 200 but we get '.(empty($tmp['http_code']) ? 0 : $tmp['http_code']));
855 855
 
856 856
 		$url = 'http://localhost';
857
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
857
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
858 858
 		print __METHOD__." url=".$url."\n";
859
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that resolves to a local URL');	// Test we receive an error because localtest.me is not an external URL
859
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL
860 860
 
861 861
 		$url = 'http://127.0.0.1';
862
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
862
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
863 863
 		print __METHOD__." url=".$url."\n";
864
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL');	// Test we receive an error because 127.0.0.1 is not an external URL
864
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.0.1 is not an external URL
865 865
 
866 866
 		$url = 'http://127.0.2.1';
867
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
867
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
868 868
 		print __METHOD__." url=".$url."\n";
869
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL');	// Test we receive an error because 127.0.2.1 is not an external URL
869
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.2.1 is not an external URL
870 870
 
871 871
 		$url = 'https://169.254.0.1';
872
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
872
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
873 873
 		print __METHOD__." url=".$url."\n";
874
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL');	// Test we receive an error because 169.254.0.1 is not an external URL
874
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 169.254.0.1 is not an external URL
875 875
 
876 876
 		$url = 'http://[::1]';
877
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
877
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
878 878
 		print __METHOD__." url=".$url."\n";
879
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL');	// Test we receive an error because [::1] is not an external URL
879
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because [::1] is not an external URL
880 880
 
881 881
 		/*$url = 'localtest.me';
882 882
 		 $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
@@ -885,9 +885,9 @@  discard block
 block discarded – undo
885 885
 		 */
886 886
 
887 887
 		$url = 'http://192.0.0.192';
888
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL but on an IP in blacklist
888
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL but on an IP in blacklist
889 889
 		print __METHOD__." url=".$url." tmp['http_code'] = ".(empty($tmp['http_code']) ? 0 : $tmp['http_code'])."\n";
890
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Access should be refused and was not');	// Test we receive an error because ip is in blacklist
890
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Access should be refused and was not'); // Test we receive an error because ip is in blacklist
891 891
 
892 892
 		return 0;
893 893
 	}
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
 	 */
900 900
 	public function testDolSanitizeUrl()
901 901
 	{
902
-		global $conf,$user,$langs,$db;
902
+		global $conf, $user, $langs, $db;
903 903
 		$conf = $this->savconf;
904 904
 		$user = $this->savuser;
905 905
 		$langs = $this->savlangs;
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
 	 */
926 926
 	public function testDolSanitizeEmail()
927 927
 	{
928
-		global $conf,$user,$langs,$db;
928
+		global $conf, $user, $langs, $db;
929 929
 		$conf = $this->savconf;
930 930
 		$user = $this->savuser;
931 931
 		$langs = $this->savlangs;
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
 	 */
956 956
 	public function testDolSanitizeFileName()
957 957
 	{
958
-		global $conf,$user,$langs,$db;
958
+		global $conf, $user, $langs, $db;
959 959
 		$conf = $this->savconf;
960 960
 		$user = $this->savuser;
961 961
 		$langs = $this->savlangs;
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
 	 */
979 979
 	public function testDolEval()
980 980
 	{
981
-		global $conf,$user,$langs,$db;
981
+		global $conf, $user, $langs, $db;
982 982
 		$conf = $this->savconf;
983 983
 		$user = $this->savuser;
984 984
 		$langs = $this->savlangs;
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
 		include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
989 989
 		include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
990 990
 
991
-		$result = dol_eval('1==\x01', 1, 0);	// Check that we can't make dol_eval on string containing \ char.
991
+		$result = dol_eval('1==\x01', 1, 0); // Check that we can't make dol_eval on string containing \ char.
992 992
 		print "result0 = ".$result."\n";
993 993
 		$this->assertStringContainsString('Bad string syntax to evaluate', $result);
994 994
 
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
 		print "result13 = ".$result."\n";
1068 1068
 		$this->assertEquals('358080.38', $result);
1069 1069
 
1070
-		global $leftmenu;	// Used into strings to eval
1070
+		global $leftmenu; // Used into strings to eval
1071 1071
 
1072 1072
 		$leftmenu = 'AAA';
1073 1073
 		$result = dol_eval('$conf->currency && preg_match(\'/^(AAA|BBB)/\',$leftmenu)', 1, 1, '1');
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
 		print "result17 = ".$result."\n";
1096 1096
 		$this->assertTrue($result);
1097 1097
 
1098
-		$result = dol_eval('1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL', 1, 0);	// Should return false and not a 'Bad string syntax to evaluate ...'
1098
+		$result = dol_eval('1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL', 1, 0); // Should return false and not a 'Bad string syntax to evaluate ...'
1099 1099
 		print "result18 = ".$result."\n";
1100 1100
 		$this->assertFalse($result);
1101 1101
 
@@ -1121,12 +1121,12 @@  discard block
 block discarded – undo
1121 1121
 		global $conf;
1122 1122
 
1123 1123
 		// Set options for cleaning data
1124
-		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0;	// disabled, does not work on HTML5 and some libxml versions
1124
+		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; // disabled, does not work on HTML5 and some libxml versions
1125 1125
 		// Enabled option MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY if possible
1126 1126
 		if (extension_loaded('tidy') && class_exists("tidy")) {
1127 1127
 			$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1;
1128 1128
 		}
1129
-		$conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0;	// disabled, does not work on HTML5 and some libxml versions
1129
+		$conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // disabled, does not work on HTML5 and some libxml versions
1130 1130
 
1131 1131
 
1132 1132
 
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
 		//$result = dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0)), 1, 1, 'common', 0, 1);
1140 1140
 		$result = dolPrintHTML($stringtotest);
1141 1141
 		print __METHOD__." result=".$result."\n";
1142
-		$this->assertEquals($stringfixed, $result, 'Error');    // Expected '' because should failed because login 'auto' does not exists
1142
+		$this->assertEquals($stringfixed, $result, 'Error'); // Expected '' because should failed because login 'auto' does not exists
1143 1143
 
1144 1144
 
1145 1145
 		// For a string that is already HTML (contains HTML tags) with special tags but badly formatted
@@ -1196,17 +1196,17 @@  discard block
 block discarded – undo
1196 1196
 		print __METHOD__." login=".$login."\n";
1197 1197
 		$this->assertEquals($login, '');
1198 1198
 
1199
-		$login = checkLoginPassEntity('admin', 'admin', 1, array('dolibarr'));            // Should works because admin/admin exists
1199
+		$login = checkLoginPassEntity('admin', 'admin', 1, array('dolibarr')); // Should works because admin/admin exists
1200 1200
 		print __METHOD__." login=".$login."\n";
1201 1201
 		$this->assertEquals($login, 'admin', 'The test to check if pass of user "admin" is "admin" has failed');
1202 1202
 
1203
-		$login = checkLoginPassEntity('admin', 'admin', 1, array('http','dolibarr'));    // Should work because of second authentication method
1203
+		$login = checkLoginPassEntity('admin', 'admin', 1, array('http', 'dolibarr')); // Should work because of second authentication method
1204 1204
 		print __METHOD__." login=".$login."\n";
1205 1205
 		$this->assertEquals($login, 'admin');
1206 1206
 
1207 1207
 		$login = checkLoginPassEntity('admin', 'admin', 1, array('forceuser'));
1208 1208
 		print __METHOD__." login=".$login."\n";
1209
-		$this->assertEquals('', $login, 'Error');    // Expected '' because should failed because login 'auto' does not exists
1209
+		$this->assertEquals('', $login, 'Error'); // Expected '' because should failed because login 'auto' does not exists
1210 1210
 	}
1211 1211
 
1212 1212
 
@@ -1225,11 +1225,11 @@  discard block
 block discarded – undo
1225 1225
 		$this->assertEquals('a', $result);
1226 1226
 
1227 1227
 		// Test that testRealCharforNumericEntities return an emoji utf8 char when code is inside Emoji range
1228
-		$arraytmp = array(0 => '&#9989;', 1 => '9989;');	// Encoded as decimal
1228
+		$arraytmp = array(0 => '&#9989;', 1 => '9989;'); // Encoded as decimal
1229 1229
 		$result = realCharForNumericEntities($arraytmp);
1230 1230
 		$this->assertEquals('✅', $result);
1231 1231
 
1232
-		$arraytmp = array(0 => '&#x2705;', 1 => 'x2705;');	// Encoded as hexadecimal
1232
+		$arraytmp = array(0 => '&#x2705;', 1 => 'x2705;'); // Encoded as hexadecimal
1233 1233
 		$result = realCharForNumericEntities($arraytmp);
1234 1234
 		$this->assertEquals('✅', $result);
1235 1235
 
Please login to merge, or discard this patch.