Passed
Branch develop (66e4de)
by Laurent
33:03
created
htdocs/core/ajax/row.php 1 patch
Braces   +22 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,12 +27,25 @@  discard block
 block discarded – undo
27 27
  *                   element_id (Example: 1)
28 28
  */
29 29
 
30
-if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disable token renewal
31
-if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
32
-if (!defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1');
33
-if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
34
-if (!defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '1');
35
-if (!defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN', '1');
30
+if (!defined('NOTOKENRENEWAL')) {
31
+	define('NOTOKENRENEWAL', '1');
32
+}
33
+// Disable token renewal
34
+if (!defined('NOREQUIREMENU')) {
35
+	define('NOREQUIREMENU', '1');
36
+}
37
+if (!defined('NOREQUIREHTML')) {
38
+	define('NOREQUIREHTML', '1');
39
+}
40
+if (!defined('NOREQUIREAJAX')) {
41
+	define('NOREQUIREAJAX', '1');
42
+}
43
+if (!defined('NOREQUIRESOC')) {
44
+	define('NOREQUIRESOC', '1');
45
+}
46
+if (!defined('NOREQUIRETRAN')) {
47
+	define('NOREQUIRETRAN', '1');
48
+}
36 49
 
37 50
 require '../../main.inc.php';
38 51
 require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
@@ -61,7 +74,9 @@  discard block
 block discarded – undo
61 74
 	$newrowordertab = array();
62 75
 	foreach ($rowordertab as $value)
63 76
 	{
64
-		if (!empty($value)) $newrowordertab[] = $value;
77
+		if (!empty($value)) {
78
+			$newrowordertab[] = $value;
79
+		}
65 80
 	}
66 81
 
67 82
 	$row = new GenericObject($db);
Please login to merge, or discard this patch.
htdocs/core/ajax/contacts.php 1 patch
Braces   +13 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,9 +21,16 @@  discard block
 block discarded – undo
21 21
  *       \brief      File to load contacts combobox
22 22
  */
23 23
 
24
-if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
25
-if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
26
-if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
24
+if (!defined('NOTOKENRENEWAL')) {
25
+	define('NOTOKENRENEWAL', '1');
26
+}
27
+// Disables token renewal
28
+if (!defined('NOREQUIREMENU')) {
29
+	define('NOREQUIREMENU', '1');
30
+}
31
+if (!defined('NOREQUIREAJAX')) {
32
+	define('NOREQUIREAJAX', '1');
33
+}
27 34
 
28 35
 require '../../main.inc.php';
29 36
 
@@ -46,7 +53,9 @@  discard block
 block discarded – undo
46 53
 	$form = new Form($db);
47 54
 
48 55
 	$return = array();
49
-	if (empty($showempty)) $showempty = 0;
56
+	if (empty($showempty)) {
57
+		$showempty = 0;
58
+	}
50 59
 
51 60
 	$return['value']	= $form->selectcontacts($id, '', $htmlname, $showempty, '', '', 0, '', true);
52 61
 	$return['num'] = $form->num;
Please login to merge, or discard this patch.
htdocs/core/ajax/fileupload.php 1 patch
Braces   +14 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,10 +21,20 @@
 block discarded – undo
21 21
  *       \brief      File to return Ajax response on file upload
22 22
  */
23 23
 
24
-if (!defined('NOCSRFCHECK'))    define('NOCSRFCHECK', '1');
25
-if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
26
-if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1'); // If there is no menu to show
27
-if (!defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
24
+if (!defined('NOCSRFCHECK')) {
25
+	define('NOCSRFCHECK', '1');
26
+}
27
+if (!defined('NOTOKENRENEWAL')) {
28
+	define('NOTOKENRENEWAL', '1');
29
+}
30
+if (!defined('NOREQUIREMENU')) {
31
+	define('NOREQUIREMENU', '1');
32
+}
33
+// If there is no menu to show
34
+if (!defined('NOREQUIREHTML')) {
35
+	define('NOREQUIREHTML', '1');
36
+}
37
+// If we don't need to load the html.form.class.php
28 38
 
29 39
 
30 40
 require '../../main.inc.php';
Please login to merge, or discard this patch.
htdocs/core/ajax/security.php 1 patch
Braces   +19 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,12 +21,25 @@
 block discarded – undo
21 21
  *                   like key to use into URL to protect them.
22 22
  */
23 23
 
24
-if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
25
-if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
26
-if (!defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1');
27
-if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
28
-if (!defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '1');
29
-if (!defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN', '1');
24
+if (!defined('NOTOKENRENEWAL')) {
25
+	define('NOTOKENRENEWAL', '1');
26
+}
27
+// Disables token renewal
28
+if (!defined('NOREQUIREMENU')) {
29
+	define('NOREQUIREMENU', '1');
30
+}
31
+if (!defined('NOREQUIREHTML')) {
32
+	define('NOREQUIREHTML', '1');
33
+}
34
+if (!defined('NOREQUIREAJAX')) {
35
+	define('NOREQUIREAJAX', '1');
36
+}
37
+if (!defined('NOREQUIRESOC')) {
38
+	define('NOREQUIRESOC', '1');
39
+}
40
+if (!defined('NOREQUIRETRAN')) {
41
+	define('NOREQUIRETRAN', '1');
42
+}
30 43
 
31 44
 require '../../main.inc.php';
32 45
 
Please login to merge, or discard this patch.
htdocs/core/ajax/selectobject.php 1 patch
Braces   +25 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,12 +20,25 @@  discard block
 block discarded – undo
20 20
  *       \brief      File to return Ajax response on a selection list request
21 21
  */
22 22
 
23
-if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
24
-if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
25
-if (!defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1');
26
-if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
27
-if (!defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '1');
28
-if (!defined('NOCSRFCHECK'))    define('NOCSRFCHECK', '1');
23
+if (!defined('NOTOKENRENEWAL')) {
24
+	define('NOTOKENRENEWAL', 1);
25
+}
26
+// Disables token renewal
27
+if (!defined('NOREQUIREMENU')) {
28
+	define('NOREQUIREMENU', '1');
29
+}
30
+if (!defined('NOREQUIREHTML')) {
31
+	define('NOREQUIREHTML', '1');
32
+}
33
+if (!defined('NOREQUIREAJAX')) {
34
+	define('NOREQUIREAJAX', '1');
35
+}
36
+if (!defined('NOREQUIRESOC')) {
37
+	define('NOREQUIRESOC', '1');
38
+}
39
+if (!defined('NOCSRFCHECK')) {
40
+	define('NOCSRFCHECK', '1');
41
+}
29 42
 
30 43
 require '../../main.inc.php';
31 44
 
@@ -54,7 +67,9 @@  discard block
 block discarded – undo
54 67
 
55 68
 top_httphead();
56 69
 
57
-if (empty($htmlname)) return;
70
+if (empty($htmlname)) {
71
+	return;
72
+}
58 73
 
59 74
 
60 75
 $InfoFieldList = explode(":", $objectdesc);
@@ -83,4 +98,6 @@  discard block
 block discarded – undo
83 98
 
84 99
 $db->close();
85 100
 
86
-if ($outjson) print json_encode($arrayresult);
101
+if ($outjson) {
102
+	print json_encode($arrayresult);
103
+}
Please login to merge, or discard this patch.
htdocs/core/ajax/getaccountcurrency.php 1 patch
Braces   +10 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,9 +20,16 @@
 block discarded – undo
20 20
  *       \brief      File to load currency rates
21 21
  */
22 22
 
23
-if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
24
-if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
25
-if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
23
+if (!defined('NOTOKENRENEWAL')) {
24
+	define('NOTOKENRENEWAL', '1');
25
+}
26
+// Disables token renewal
27
+if (!defined('NOREQUIREMENU')) {
28
+	define('NOREQUIREMENU', '1');
29
+}
30
+if (!defined('NOREQUIREAJAX')) {
31
+	define('NOREQUIREAJAX', '1');
32
+}
26 33
 
27 34
 require '../../main.inc.php';
28 35
 
Please login to merge, or discard this patch.
htdocs/core/tools.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,9 @@
 block discarded – undo
29 29
 
30 30
 // Security check
31 31
 $socid = 0;
32
-if ($user->socid > 0) $socid = $user->socid;
32
+if ($user->socid > 0) {
33
+	$socid = $user->socid;
34
+}
33 35
 
34 36
 
35 37
 
Please login to merge, or discard this patch.
htdocs/accountancy/admin/fiscalyear_info.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,10 +30,12 @@
 block discarded – undo
30 30
 $langs->loadLangs(array("admin", "compta"));
31 31
 
32 32
 // Security check
33
-if ($user->socid > 0)
33
+if ($user->socid > 0) {
34 34
 	accessforbidden();
35
-if (!$user->rights->accounting->fiscalyear->write)
35
+}
36
+if (!$user->rights->accounting->fiscalyear->write) {
36 37
 	accessforbidden();
38
+}
37 39
 
38 40
 $id = GETPOST('id', 'int');
39 41
 
Please login to merge, or discard this patch.
htdocs/modulebuilder/template/js/mymodule.js.php 1 patch
Braces   +53 added lines, -18 removed lines patch added patch discarded remove patch
@@ -17,16 +17,36 @@  discard block
 block discarded – undo
17 17
  * Library javascript to enable Browser notifications
18 18
  */
19 19
 
20
-if (!defined('NOREQUIREUSER'))  define('NOREQUIREUSER', '1');
21
-if (!defined('NOREQUIREDB'))    define('NOREQUIREDB', '1');
22
-if (!defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '1');
23
-if (!defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN', '1');
24
-if (!defined('NOCSRFCHECK'))    define('NOCSRFCHECK', 1);
25
-if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
26
-if (!defined('NOLOGIN'))        define('NOLOGIN', 1);
27
-if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', 1);
28
-if (!defined('NOREQUIREHTML'))  define('NOREQUIREHTML', 1);
29
-if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
20
+if (!defined('NOREQUIREUSER')) {
21
+	define('NOREQUIREUSER', '1');
22
+}
23
+if (!defined('NOREQUIREDB')) {
24
+	define('NOREQUIREDB', '1');
25
+}
26
+if (!defined('NOREQUIRESOC')) {
27
+	define('NOREQUIRESOC', '1');
28
+}
29
+if (!defined('NOREQUIRETRAN')) {
30
+	define('NOREQUIRETRAN', '1');
31
+}
32
+if (!defined('NOCSRFCHECK')) {
33
+	define('NOCSRFCHECK', 1);
34
+}
35
+if (!defined('NOTOKENRENEWAL')) {
36
+	define('NOTOKENRENEWAL', 1);
37
+}
38
+if (!defined('NOLOGIN')) {
39
+	define('NOLOGIN', 1);
40
+}
41
+if (!defined('NOREQUIREMENU')) {
42
+	define('NOREQUIREMENU', 1);
43
+}
44
+if (!defined('NOREQUIREHTML')) {
45
+	define('NOREQUIREHTML', 1);
46
+}
47
+if (!defined('NOREQUIREAJAX')) {
48
+	define('NOREQUIREAJAX', '1');
49
+}
30 50
 
31 51
 
32 52
 /**
@@ -38,23 +58,38 @@  discard block
 block discarded – undo
38 58
 // Load Dolibarr environment
39 59
 $res = 0;
40 60
 // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
41
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
61
+if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
62
+	$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
63
+}
42 64
 // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
43 65
 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
44 66
 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
45
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
46
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/../main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/../main.inc.php";
67
+if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
68
+	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
69
+}
70
+if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/../main.inc.php")) {
71
+	$res = @include substr($tmp, 0, ($i + 1))."/../main.inc.php";
72
+}
47 73
 // Try main.inc.php using relative path
48
-if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
49
-if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
50
-if (!$res) die("Include of main fails");
74
+if (!$res && file_exists("../../main.inc.php")) {
75
+	$res = @include "../../main.inc.php";
76
+}
77
+if (!$res && file_exists("../../../main.inc.php")) {
78
+	$res = @include "../../../main.inc.php";
79
+}
80
+if (!$res) {
81
+	die("Include of main fails");
82
+}
51 83
 
52 84
 // Define js type
53 85
 header('Content-Type: application/javascript');
54 86
 // Important: Following code is to cache this file to avoid page request by browser at each Dolibarr page access.
55 87
 // You can use CTRL+F5 to refresh your browser cache.
56
-if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
57
-else header('Cache-Control: no-cache');
88
+if (empty($dolibarr_nocache)) {
89
+	header('Cache-Control: max-age=3600, public, must-revalidate');
90
+} else {
91
+	header('Cache-Control: no-cache');
92
+}
58 93
 ?>
59 94
 
60 95
 /* Javascript library of module MyModule */
Please login to merge, or discard this patch.