Passed
Branch develop (66e4de)
by Laurent
33:03
created
htdocs/core/ajax/saveinplace.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,10 +20,19 @@  discard block
 block discarded – undo
20 20
  *       \brief      File to save field value
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');
26
-if (!defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '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
+}
33
+if (!defined('NOREQUIRESOC')) {
34
+	define('NOREQUIRESOC', '1');
35
+}
27 36
 
28 37
 require '../../main.inc.php';
29 38
 require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
@@ -197,7 +206,9 @@  discard block
 block discarded – undo
197 206
 
198 207
 		if (!$error)
199 208
 		{
200
-			if ((isset($object) && !is_object($object)) || empty($savemethod)) $object = new GenericObject($db);
209
+			if ((isset($object) && !is_object($object)) || empty($savemethod)) {
210
+				$object = new GenericObject($db);
211
+			}
201 212
 
202 213
 			// Specific for add_object_linked()
203 214
 			// TODO add a function for variable treatment
@@ -209,8 +220,11 @@  discard block
 block discarded – undo
209 220
 			$ret = $object->$savemethodname($field, $newvalue, $table_element, $fk_element, $format);
210 221
 			if ($ret > 0)
211 222
 			{
212
-				if ($type == 'numeric') $value = price($newvalue);
213
-				elseif ($type == 'textarea') $value = dol_nl2br($newvalue);
223
+				if ($type == 'numeric') {
224
+					$value = price($newvalue);
225
+				} elseif ($type == 'textarea') {
226
+					$value = dol_nl2br($newvalue);
227
+				}
214 228
 
215 229
 				$return['value'] = $value;
216 230
 				$return['view'] = (!empty($view) ? $view : $value);
Please login to merge, or discard this patch.
htdocs/core/ajax/objectonoff.php 1 patch
Braces   +22 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,12 +20,25 @@  discard block
 block discarded – undo
20 20
  *       			 This Ajax service is called when option MAIN_DIRECT_STATUS_UPDATE is set.
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('NOREQUIRETRAN'))  define('NOREQUIRETRAN', '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('NOREQUIRETRAN')) {
40
+	define('NOREQUIRETRAN', '1');
41
+}
29 42
 
30 43
 require '../../main.inc.php';
31 44
 require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
@@ -74,7 +87,9 @@  discard block
 block discarded – undo
74 87
 	}
75 88
 
76 89
 	$tablename = $element;
77
-	if ($tablename == 'websitepage') $tablename = 'website_page';
90
+	if ($tablename == 'websitepage') {
91
+		$tablename = 'website_page';
92
+	}
78 93
 
79 94
 	$format = 'int';
80 95
 
Please login to merge, or discard this patch.
htdocs/core/ajax/vatrates.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 vat rates combobox
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/ajax/loadinplace.php 1 patch
Braces   +28 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,10 +20,19 @@  discard block
 block discarded – undo
20 20
  *       \brief      File to load field value
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');
26
-if (!defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '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
+}
33
+if (!defined('NOREQUIRESOC')) {
34
+	define('NOREQUIRESOC', '1');
35
+}
27 36
 
28 37
 require '../../main.inc.php';
29 38
 require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
@@ -55,11 +64,15 @@  discard block
 block discarded – undo
55 64
 		$subelement = $regs[2];
56 65
 	}
57 66
 
58
-	if ($element == 'propal') $element = 'propale';
59
-	elseif ($element == 'fichinter') $element = 'ficheinter';
60
-	elseif ($element == 'product') $element = 'produit';
61
-	elseif ($element == 'member') $element = 'adherent';
62
-	elseif ($element == 'order_supplier') {
67
+	if ($element == 'propal') {
68
+		$element = 'propale';
69
+	} elseif ($element == 'fichinter') {
70
+		$element = 'ficheinter';
71
+	} elseif ($element == 'product') {
72
+		$element = 'produit';
73
+	} elseif ($element == 'member') {
74
+		$element = 'adherent';
75
+	} elseif ($element == 'order_supplier') {
63 76
 		$element = 'fournisseur';
64 77
 		$subelement = 'commande';
65 78
 	} elseif ($element == 'invoice_supplier') {
@@ -81,7 +94,9 @@  discard block
 block discarded – undo
81 94
 			if (method_exists($form, $methodname))
82 95
 			{
83 96
 				$ret = $form->$methodname();
84
-				if ($ret > 0) echo json_encode($form->$cachename);
97
+				if ($ret > 0) {
98
+					echo json_encode($form->$cachename);
99
+				}
85 100
 			} elseif (!empty($ext_element))
86 101
 			{
87 102
 				$module = $subelement = $ext_element;
@@ -95,7 +110,9 @@  discard block
 block discarded – undo
95 110
 				$classname = 'Actions'.ucfirst($subelement);
96 111
 				$object = new $classname($db);
97 112
 				$ret = $object->$methodname($fk_element);
98
-				if ($ret > 0) echo json_encode($object->$cachename);
113
+				if ($ret > 0) {
114
+					echo json_encode($object->$cachename);
115
+				}
99 116
 			}
100 117
 		} else {
101 118
 			$object = new GenericObject($db);
Please login to merge, or discard this patch.
htdocs/core/ajax/extraparams.php 1 patch
Braces   +16 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,11 +20,22 @@
 block discarded – undo
20 20
  *	\brief      File to make Ajax action on setting extra parameters of elements
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');
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
+}
28 39
 
29 40
 include '../../main.inc.php';
30 41
 
Please login to merge, or discard this patch.
htdocs/core/ajax/price.php 1 patch
Braces   +13 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,10 +20,19 @@
 block discarded – undo
20 20
  *       \brief      File to get ht and ttc
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');
26
-if (!defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '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
+}
33
+if (!defined('NOREQUIRESOC')) {
34
+	define('NOREQUIRESOC', '1');
35
+}
27 36
 
28 37
 require '../../main.inc.php';
29 38
 
Please login to merge, or discard this patch.
htdocs/core/ajax/ziptown.php 1 patch
Braces   +34 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,12 +22,25 @@  discard block
 block discarded – undo
22 22
  *       \brief     File to return Ajax response on zipcode or town request
23 23
  */
24 24
 
25
-if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
26
-if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
27
-if (!defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1');
28
-if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
29
-if (!defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '1');
30
-if (!defined('NOCSRFCHECK'))    define('NOCSRFCHECK', '1');
25
+if (!defined('NOTOKENRENEWAL')) {
26
+	define('NOTOKENRENEWAL', 1);
27
+}
28
+// Disables token renewal
29
+if (!defined('NOREQUIREMENU')) {
30
+	define('NOREQUIREMENU', '1');
31
+}
32
+if (!defined('NOREQUIREHTML')) {
33
+	define('NOREQUIREHTML', '1');
34
+}
35
+if (!defined('NOREQUIREAJAX')) {
36
+	define('NOREQUIREAJAX', '1');
37
+}
38
+if (!defined('NOREQUIRESOC')) {
39
+	define('NOREQUIRESOC', '1');
40
+}
41
+if (!defined('NOCSRFCHECK')) {
42
+	define('NOCSRFCHECK', '1');
43
+}
31 44
 
32 45
 require '../../main.inc.php';
33 46
 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
@@ -60,9 +73,11 @@  discard block
 block discarded – undo
60 73
 	$zipcode = $_GET['zipcode'] ? $_GET['zipcode'] : '';
61 74
 	$town = $_GET['town'] ? $_GET['town'] : '';
62 75
 
63
-	if (!empty($conf->global->MAIN_USE_ZIPTOWN_DICTIONNARY))   // Use zip-town table
76
+	if (!empty($conf->global->MAIN_USE_ZIPTOWN_DICTIONNARY)) {
77
+		// Use zip-town table
64 78
 	{
65 79
 		$sql = "SELECT z.rowid, z.zip, z.town, z.fk_county, z.fk_pays as fk_country";
80
+	}
66 81
 		$sql .= ", c.rowid as fk_country, c.code as country_code, c.label as country";
67 82
 		$sql .= ", d.rowid as fk_county, d.code_departement as county_code, d.nom as county";
68 83
 		$sql .= " FROM ".MAIN_DB_PREFIX."c_ziptown as z";
@@ -71,8 +86,12 @@  discard block
 block discarded – undo
71 86
 		$sql .= " ".MAIN_DB_PREFIX."c_country as c";
72 87
 		$sql .= " WHERE z.fk_pays = c.rowid";
73 88
 		$sql .= " AND z.active = 1 AND c.active = 1";
74
-		if ($zipcode) $sql .= " AND z.zip LIKE '".$db->escape($zipcode)."%'";
75
-		if ($town)    $sql .= " AND z.town LIKE '%".$db->escape($town)."%'";
89
+		if ($zipcode) {
90
+			$sql .= " AND z.zip LIKE '".$db->escape($zipcode)."%'";
91
+		}
92
+		if ($town) {
93
+			$sql .= " AND z.town LIKE '%".$db->escape($town)."%'";
94
+		}
76 95
 		$sql .= " ORDER BY z.zip, z.town";
77 96
 		$sql .= $db->plimit(100); // Avoid pb with bad criteria
78 97
 	} else // Use table of third parties
@@ -84,8 +103,12 @@  discard block
 block discarded – undo
84 103
 		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON s.fk_departement = d.rowid";
85 104
 		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid';
86 105
 		$sql .= " WHERE";
87
-		if ($zipcode) $sql .= " s.zip LIKE '".$db->escape($zipcode)."%'";
88
-		if ($town)    $sql .= " s.town LIKE '%".$db->escape($town)."%'";
106
+		if ($zipcode) {
107
+			$sql .= " s.zip LIKE '".$db->escape($zipcode)."%'";
108
+		}
109
+		if ($town) {
110
+			$sql .= " s.town LIKE '%".$db->escape($town)."%'";
111
+		}
89 112
 		$sql .= " ORDER BY s.fk_pays, s.zip, s.town";
90 113
 		$sql .= $db->plimit(100); // Avoid pb with bad criteria
91 114
 	}
Please login to merge, or discard this patch.
htdocs/core/ajax/pingresult.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,12 +20,25 @@  discard block
 block discarded – undo
20 20
  *       \brief      File to save result of an anonymous ping into database (1 ping is done per installation)
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('NOREQUIRETRAN'))  define('NOREQUIRETRAN', '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('NOREQUIRETRAN')) {
40
+	define('NOREQUIRETRAN', '1');
41
+}
29 42
 
30 43
 require '../../main.inc.php';
31 44
 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
@@ -36,8 +49,9 @@  discard block
 block discarded – undo
36 49
 
37 50
 
38 51
 // Security check
39
-if (!empty($user->socid))
52
+if (!empty($user->socid)) {
40 53
 	$socid = $user->socid;
54
+}
41 55
 
42 56
 $now = dol_now();
43 57
 
Please login to merge, or discard this patch.
htdocs/core/lib/ldap.lib.php 1 patch
Braces   +30 added lines, -10 removed lines patch added patch discarded remove patch
@@ -142,15 +142,28 @@  discard block
 block discarded – undo
142 142
 	global $bc, $conf;
143 143
 
144 144
 	$count--;
145
-	if ($count == 0) return -1; // To stop loop
146
-	if (!is_array($result)) return -1;
145
+	if ($count == 0) {
146
+		return -1;
147
+	}
148
+	// To stop loop
149
+	if (!is_array($result)) {
150
+		return -1;
151
+	}
147 152
 
148 153
 	foreach ($result as $key => $val)
149 154
 	{
150
-		if ("$key" == "objectclass") continue;
151
-		if ("$key" == "count") continue;
152
-		if ("$key" == "dn") continue;
153
-		if ("$val" == "objectclass") continue;
155
+		if ("$key" == "objectclass") {
156
+			continue;
157
+		}
158
+		if ("$key" == "count") {
159
+			continue;
160
+		}
161
+		if ("$key" == "dn") {
162
+			continue;
163
+		}
164
+		if ("$val" == "objectclass") {
165
+			continue;
166
+		}
154 167
 
155 168
 		$lastkey[$level] = $key;
156 169
 
@@ -163,18 +176,25 @@  discard block
 block discarded – undo
163 176
 				print '<td>';
164 177
 				print $key;
165 178
 				print '</td><td>';
166
-				if (strtolower($key) == 'userpassword') $hide = 1;
179
+				if (strtolower($key) == 'userpassword') {
180
+					$hide = 1;
181
+				}
167 182
 			}
168 183
 			show_ldap_content($val, $level + 1, $count, $var, $hide, $val["count"]);
169 184
 		} elseif ($subcount)
170 185
 		{
171 186
 			$subcount--;
172 187
 			$newstring = dol_htmlentitiesbr($val);
173
-			if ($hide) print preg_replace('/./i', '*', $newstring);
174
-			else print $newstring;
188
+			if ($hide) {
189
+				print preg_replace('/./i', '*', $newstring);
190
+			} else {
191
+				print $newstring;
192
+			}
175 193
 			print '<br>';
176 194
 		}
177
-		if ("$val" != $lastkey[$level] && !$subcount) print '</td></tr>';
195
+		if ("$val" != $lastkey[$level] && !$subcount) {
196
+			print '</td></tr>';
197
+		}
178 198
 	}
179 199
 	return 1;
180 200
 }
Please login to merge, or discard this patch.