Passed
Pull Request — master (#2)
by
unknown
26:19
created
dolibarr/htdocs/core/filemanagerdol/connectors/php/connector.php 1 patch
Braces   +8 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,8 +30,9 @@  discard block
 block discarded – undo
30 30
 require 'basexml.php';
31 31
 require 'commands.php';
32 32
 
33
-if ( !$Config['Enabled'] )
33
+if ( !$Config['Enabled'] ) {
34 34
 	SendError(1, 'This connector is disabled. Please check the "editor/filemanager/connectors/php/config.php" file');
35
+}
35 36
 
36 37
 DoResponse();
37 38
 
@@ -45,8 +46,9 @@  discard block
 block discarded – undo
45 46
     if (!isset($_GET)) {
46 47
         global $_GET;
47 48
     }
48
-	if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) )
49
-		return;
49
+	if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) ) {
50
+			return;
51
+	}
50 52
 
51 53
 	// Get the main request informaiton.
52 54
 	$sCommand		= $_GET['Command'] ;
@@ -59,8 +61,9 @@  discard block
 block discarded – undo
59 61
 		SendError(1, 'The "' . $sCommand . '" command isn\'t allowed');
60 62
 	}
61 63
 	// Check if it is an allowed type.
62
-	if (! IsAllowedType($sResourceType))
63
-		SendError(1, 'Invalid type specified');
64
+	if (! IsAllowedType($sResourceType)) {
65
+			SendError(1, 'Invalid type specified');
66
+	}
64 67
 
65 68
 	// File Upload doesn't have to Return XML, so it must be intercepted before anything.
66 69
 	if ( $sCommand == 'FileUpload' )
Please login to merge, or discard this patch.
dolibarr/htdocs/core/filemanagerdol/connectors/php/upload.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,8 +41,9 @@  discard block
 block discarded – undo
41 41
 
42 42
 
43 43
 // Check if this uploader has been enabled.
44
-if ( !$Config['Enabled'] )
44
+if ( !$Config['Enabled'] ) {
45 45
 	SendUploadResults('1', '', '', 'This file uploader is disabled. Please check the "filemanagerdol/connectors/php/config.php" file');
46
+}
46 47
 
47 48
 $sCommand = 'QuickUpload' ;
48 49
 
@@ -52,12 +53,14 @@  discard block
 block discarded – undo
52 53
 $sCurrentFolder	= "/" ;
53 54
 
54 55
 // Is enabled the upload?
55
-if (! IsAllowedCommand($sCommand))
56
+if (! IsAllowedCommand($sCommand)) {
56 57
 	SendUploadResults('1', '', '', 'The ""' . $sCommand . '"" command isn\'t allowed');
58
+}
57 59
 
58 60
 // Check if it is an allowed type.
59
-if (! IsAllowedType($sType))
61
+if (! IsAllowedType($sType)) {
60 62
     SendUploadResults(1, '', '', 'Invalid type specified');
63
+}
61 64
 
62 65
 
63 66
 // @CHANGE
Please login to merge, or discard this patch.
dolibarr/htdocs/core/filemanagerdol/connectors/php/io.php 1 patch
Braces   +53 added lines, -40 removed lines patch added patch discarded remove patch
@@ -44,11 +44,12 @@  discard block
 block discarded – undo
44 44
 {
45 45
 	global $Config ;
46 46
 
47
-	if ($sCommand == "QuickUpload")
48
-		return $Config['QuickUploadPath'][$resourceType] ;
49
-	else
50
-		return $Config['FileTypesPath'][$resourceType] ;
51
-}
47
+	if ($sCommand == "QuickUpload") {
48
+			return $Config['QuickUploadPath'][$resourceType] ;
49
+	} else {
50
+			return $Config['FileTypesPath'][$resourceType] ;
51
+	}
52
+	}
52 53
 
53 54
 /**
54 55
  * GetResourceTypeDirectory
@@ -62,16 +63,17 @@  discard block
 block discarded – undo
62 63
 	global $Config ;
63 64
 	if ($sCommand == "QuickUpload")
64 65
 	{
65
-		if ( strlen($Config['QuickUploadAbsolutePath'][$resourceType]) > 0)
66
-			return $Config['QuickUploadAbsolutePath'][$resourceType] ;
66
+		if ( strlen($Config['QuickUploadAbsolutePath'][$resourceType]) > 0) {
67
+					return $Config['QuickUploadAbsolutePath'][$resourceType] ;
68
+		}
67 69
 
68 70
 		// Map the "UserFiles" path to a local directory.
69 71
 		return Server_MapPath($Config['QuickUploadPath'][$resourceType]);
70
-	}
71
-	else
72
+	} else
72 73
 	{
73
-		if ( strlen($Config['FileTypesAbsolutePath'][$resourceType]) > 0)
74
-			return $Config['FileTypesAbsolutePath'][$resourceType] ;
74
+		if ( strlen($Config['FileTypesAbsolutePath'][$resourceType]) > 0) {
75
+					return $Config['FileTypesAbsolutePath'][$resourceType] ;
76
+		}
75 77
 
76 78
 		// Map the "UserFiles" path to a local directory.
77 79
 		return Server_MapPath($Config['FileTypesPath'][$resourceType]);
@@ -116,8 +118,9 @@  discard block
 block discarded – undo
116 118
 
117 119
 	// Ensure that the directory exists.
118 120
 	$sErrorMsg = CreateServerFolder($sResourceTypePath);
119
-	if ( $sErrorMsg != '' )
120
-		SendError(1, "Error creating folder \"{$sResourceTypePath}\" ({$sErrorMsg})");
121
+	if ( $sErrorMsg != '' ) {
122
+			SendError(1, "Error creating folder \"{$sResourceTypePath}\" ({$sErrorMsg})");
123
+	}
121 124
 
122 125
 	// Return the resource type directory combined with the required path.
123 126
 	return CombinePaths($sResourceTypePath, $folderPath);
@@ -162,8 +165,9 @@  discard block
 block discarded – undo
162 165
 		}
163 166
 
164 167
 		$sErrorMsg = CreateServerFolder($sParent, $folderPath);
165
-		if ( $sErrorMsg != '' )
166
-			return $sErrorMsg ;
168
+		if ( $sErrorMsg != '' ) {
169
+					return $sErrorMsg ;
170
+		}
167 171
 	}
168 172
 
169 173
 	if ( !file_exists($folderPath))
@@ -178,8 +182,7 @@  discard block
 block discarded – undo
178 182
 		if ( isset( $Config['ChmodOnFolderCreate'] ) && !$Config['ChmodOnFolderCreate'] )
179 183
 		{
180 184
 			mkdir($folderPath);
181
-		}
182
-		else
185
+		} else
183 186
 		{
184 187
 			$permissions = '0777';
185 188
 			if ( isset( $Config['ChmodOnFolderCreate'] ) && $Config['ChmodOnFolderCreate'])
@@ -202,10 +205,10 @@  discard block
 block discarded – undo
202 205
 		ini_restore('error_reporting');
203 206
 
204 207
 		return $sErrorMsg ;
208
+	} else {
209
+			return '' ;
210
+	}
205 211
 	}
206
-	else
207
-		return '' ;
208
-}
209 212
 
210 213
 /**
211 214
  * Get Root Path
@@ -230,8 +233,9 @@  discard block
 block discarded – undo
230 233
 
231 234
     // This can check only that this script isn't run from a virtual dir
232 235
     // But it avoids the problems that arise if it isn't checked
233
-    if ( $position === false || $position <> strlen($sRealPath) - strlen($sSelfPath) )
234
-        SendError(1, 'Sorry, can\'t map "UserFilesPath" to a physical path. You must set the "UserFilesAbsolutePath" value in "editor/filemanager/connectors/php/config.php".');
236
+    if ( $position === false || $position <> strlen($sRealPath) - strlen($sSelfPath) ) {
237
+            SendError(1, 'Sorry, can\'t map "UserFilesPath" to a physical path. You must set the "UserFilesAbsolutePath" value in "editor/filemanager/connectors/php/config.php".');
238
+    }
235 239
 
236 240
     return substr($sRealPath, 0, $position);
237 241
 }
@@ -265,11 +269,13 @@  discard block
 block discarded – undo
265 269
 	$arAllowed	= $Config['AllowedExtensions'][$resourceType] ;
266 270
 	$arDenied	= $Config['DeniedExtensions'][$resourceType] ;
267 271
 
268
-	if ( count($arAllowed) > 0 && !in_array($sExtension, $arAllowed))
269
-		return false ;
272
+	if ( count($arAllowed) > 0 && !in_array($sExtension, $arAllowed)) {
273
+			return false ;
274
+	}
270 275
 
271
-	if ( count($arDenied) > 0 && in_array($sExtension, $arDenied))
272
-		return false ;
276
+	if ( count($arDenied) > 0 && in_array($sExtension, $arDenied)) {
277
+			return false ;
278
+	}
273 279
 
274 280
 	return true ;
275 281
 }
@@ -283,8 +289,9 @@  discard block
 block discarded – undo
283 289
 function IsAllowedType($resourceType)
284 290
 {
285 291
 	global $Config ;
286
-	if ( !in_array($resourceType, $Config['ConfigAllowedTypes']))
287
-		return false ;
292
+	if ( !in_array($resourceType, $Config['ConfigAllowedTypes'])) {
293
+			return false ;
294
+	}
288 295
 
289 296
 	return true ;
290 297
 }
@@ -299,8 +306,9 @@  discard block
 block discarded – undo
299 306
 {
300 307
 	global $Config ;
301 308
 
302
-	if (! in_array($sCommand, $Config['ConfigAllowedCommands']))
303
-		return false ;
309
+	if (! in_array($sCommand, $Config['ConfigAllowedCommands'])) {
310
+			return false ;
311
+	}
304 312
 
305 313
 	return true ;
306 314
 }
@@ -318,10 +326,12 @@  discard block
 block discarded – undo
318 326
 	$sCurrentFolder	= isset( $_GET['CurrentFolder'] ) ? GETPOST('CurrentFolder', '', 1) : '/' ;
319 327
 
320 328
 	// Check the current folder syntax (must begin and start with a slash).
321
-	if (!preg_match('|/$|', $sCurrentFolder))
322
-		$sCurrentFolder .= '/' ;
323
-	if (strpos($sCurrentFolder, '/') !== 0)
324
-		$sCurrentFolder = '/' . $sCurrentFolder ;
329
+	if (!preg_match('|/$|', $sCurrentFolder)) {
330
+			$sCurrentFolder .= '/' ;
331
+	}
332
+	if (strpos($sCurrentFolder, '/') !== 0) {
333
+			$sCurrentFolder = '/' . $sCurrentFolder ;
334
+	}
325 335
 
326 336
 	// Ensure the folder path has no double-slashes
327 337
 	while ( strpos($sCurrentFolder, '//') !== false ) {
@@ -329,11 +339,13 @@  discard block
 block discarded – undo
329 339
 	}
330 340
 
331 341
 	// Check for invalid folder paths (..)
332
-	if ( strpos($sCurrentFolder, '..') || strpos($sCurrentFolder, "\\"))
333
-		SendError(102, '');
342
+	if ( strpos($sCurrentFolder, '..') || strpos($sCurrentFolder, "\\")) {
343
+			SendError(102, '');
344
+	}
334 345
 
335
-	if ( preg_match(",(/\.)|[[:cntrl:]]|(//)|(\\\\)|([\:\*\?\"\<\>\|]),", $sCurrentFolder))
336
-		SendError(102, '');
346
+	if ( preg_match(",(/\.)|[[:cntrl:]]|(//)|(\\\\)|([\:\*\?\"\<\>\|]),", $sCurrentFolder)) {
347
+			SendError(102, '');
348
+	}
337 349
 
338 350
 	return $sCurrentFolder ;
339 351
 }
@@ -357,8 +369,9 @@  discard block
 block discarded – undo
357 369
 	$sNewFileName = stripslashes($sNewFileName);
358 370
 
359 371
 	// Replace dots in the name with underscores (only one dot can be there... security issue).
360
-	if ( $Config['ForceSingleExtension'] )
361
-		$sNewFileName = preg_replace('/\\.(?![^.]*$)/', '_', $sNewFileName);
372
+	if ( $Config['ForceSingleExtension'] ) {
373
+			$sNewFileName = preg_replace('/\\.(?![^.]*$)/', '_', $sNewFileName);
374
+	}
362 375
 
363 376
 	// Remove \ / | : ? * " < >
364 377
 	$sNewFileName = preg_replace('/\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFileName);
Please login to merge, or discard this patch.
dolibarr/htdocs/core/filemanagerdol/connectors/php/commands.php 1 patch
Braces   +32 added lines, -28 removed lines patch added patch discarded remove patch
@@ -43,8 +43,9 @@  discard block
 block discarded – undo
43 43
 	{
44 44
 		while ( $sFile = readdir($oCurrentFolder) )
45 45
 		{
46
-			if ( $sFile != '.' && $sFile != '..' && is_dir($sServerDir . $sFile) )
47
-				$aFolders[] = '<Folder name="' . ConvertToXmlAttribute($sFile) . '" />' ;
46
+			if ( $sFile != '.' && $sFile != '..' && is_dir($sServerDir . $sFile) ) {
47
+							$aFolders[] = '<Folder name="' . ConvertToXmlAttribute($sFile) . '" />' ;
48
+			}
48 49
 		}
49 50
 		closedir($oCurrentFolder);
50 51
 	}
@@ -53,8 +54,9 @@  discard block
 block discarded – undo
53 54
 	echo "<Folders>" ;
54 55
 
55 56
 	natcasesort($aFolders);
56
-	foreach ( $aFolders as $sFolder )
57
-		echo $sFolder ;
57
+	foreach ( $aFolders as $sFolder ) {
58
+			echo $sFolder ;
59
+	}
58 60
 
59 61
 	// Close the "Folders" node.
60 62
 	echo "</Folders>" ;
@@ -84,9 +86,9 @@  discard block
 block discarded – undo
84 86
 		{
85 87
 			if ( $sFile != '.' && $sFile != '..' )
86 88
 			{
87
-				if ( is_dir($sServerDir . $sFile) )
88
-					$aFolders[] = '<Folder name="' . ConvertToXmlAttribute($sFile) . '" />' ;
89
-				else
89
+				if ( is_dir($sServerDir . $sFile) ) {
90
+									$aFolders[] = '<Folder name="' . ConvertToXmlAttribute($sFile) . '" />' ;
91
+				} else
90 92
 				{
91 93
 					$iFileSize = @filesize($sServerDir . $sFile);
92 94
 					if ( !$iFileSize ) {
@@ -95,8 +97,9 @@  discard block
 block discarded – undo
95 97
 					if ( $iFileSize > 0 )
96 98
 					{
97 99
 						$iFileSize = round($iFileSize / 1024);
98
-						if ( $iFileSize < 1 )
99
-							$iFileSize = 1 ;
100
+						if ( $iFileSize < 1 ) {
101
+													$iFileSize = 1 ;
102
+						}
100 103
 					}
101 104
 
102 105
 					$aFiles[] = '<File name="' . ConvertToXmlAttribute($sFile) . '" size="' . $iFileSize . '" />' ;
@@ -110,8 +113,9 @@  discard block
 block discarded – undo
110 113
 	natcasesort($aFolders);
111 114
 	echo '<Folders>' ;
112 115
 
113
-	foreach ( $aFolders as $sFolder )
114
-		echo $sFolder ;
116
+	foreach ( $aFolders as $sFolder ) {
117
+			echo $sFolder ;
118
+	}
115 119
 
116 120
 	echo '</Folders>' ;
117 121
 
@@ -119,8 +123,9 @@  discard block
 block discarded – undo
119 123
 	natcasesort($aFiles);
120 124
 	echo '<Files>' ;
121 125
 
122
-	foreach ( $aFiles as $sFiles )
123
-		echo $sFiles ;
126
+	foreach ( $aFiles as $sFiles ) {
127
+			echo $sFiles ;
128
+	}
124 129
 
125 130
 	echo '</Files>' ;
126 131
 }
@@ -145,8 +150,10 @@  discard block
 block discarded – undo
145 150
 		$sNewFolderName = $_GET['NewFolderName'] ;
146 151
 		$sNewFolderName = SanitizeFolderName($sNewFolderName);
147 152
 
148
-		if (strpos($sNewFolderName, '..') !== false)
149
-			$sErrorNumber = '102' ;		// Invalid folder name.
153
+		if (strpos($sNewFolderName, '..') !== false) {
154
+					$sErrorNumber = '102' ;
155
+		}
156
+		// Invalid folder name.
150 157
 		else
151 158
 		{
152 159
 			// Map the virtual path to the local server path of the current folder.
@@ -171,13 +178,13 @@  discard block
 block discarded – undo
171 178
 						$sErrorNumber = '110' ;
172 179
 						break ;
173 180
 				}
181
+			} else {
182
+							$sErrorNumber = '103' ;
174 183
 			}
175
-			else
176
-				$sErrorNumber = '103' ;
177 184
 		}
185
+	} else {
186
+			$sErrorNumber = '102' ;
178 187
 	}
179
-	else
180
-		$sErrorNumber = '102' ;
181 188
 
182 189
 	// Create the "Error" node.
183 190
 	echo '<Error number="' . $sErrorNumber . '" />' ;
@@ -254,8 +261,7 @@  discard block
 block discarded – undo
254 261
 					$iCounter++ ;
255 262
 					$sFileName = RemoveExtension($sOriginalFileName) . '(' . $iCounter . ').' . $sExtension ;
256 263
 					$sErrorNumber = '201' ;
257
-				}
258
-				else
264
+				} else
259 265
 				{
260 266
 					move_uploaded_file($oFile['tmp_name'], $sFilePath);
261 267
 
@@ -289,19 +295,18 @@  discard block
 block discarded – undo
289 295
 				{
290 296
 					@unlink($sFilePath);
291 297
 					$sErrorNumber = '202' ;
292
-				}
293
-				else if ( isset( $detectHtml ) && $detectHtml === -1 && DetectHtml($sFilePath) === true )
298
+				} else if ( isset( $detectHtml ) && $detectHtml === -1 && DetectHtml($sFilePath) === true )
294 299
 				{
295 300
 					@unlink($sFilePath);
296 301
 					$sErrorNumber = '202' ;
297 302
 				}
298 303
 			}
304
+		} else {
305
+					$sErrorNumber = '202' ;
299 306
 		}
300
-		else
307
+	} else {
301 308
 			$sErrorNumber = '202' ;
302 309
 	}
303
-	else
304
-		$sErrorNumber = '202' ;
305 310
 
306 311
 
307 312
 	$sFileUrl = CombinePaths(GetResourceTypePath($resourceType, $sCommand), $currentFolder);
@@ -314,8 +319,7 @@  discard block
 block discarded – undo
314 319
     {
315 320
         // this line already exists so wrap the if block around it
316 321
         SendUploadResults($sErrorNumber, $sFileUrl, $sFileName);
317
-    }
318
-    else
322
+    } else
319 323
 	{
320 324
 	    //issue the CKEditor Callback
321 325
 		SendCKEditorResults(
Please login to merge, or discard this patch.
dolibarr/htdocs/core/filemanagerdol/connectors/php/config.php 1 patch
Braces   +10 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,10 @@  discard block
 block discarded – undo
34 34
 require_once '../../../../main.inc.php';
35 35
 $uri=preg_replace('/^http(s?):\/\//i','',$dolibarr_main_url_root);
36 36
 $pos = strstr($uri, '/');       // $pos contient alors url sans nom domaine
37
-if ($pos == '/') $pos = '';     // si $pos vaut /, on le met a ''
37
+if ($pos == '/') {
38
+    $pos = '';
39
+}
40
+// si $pos vaut /, on le met a ''
38 41
 define('DOL_URL_ROOT', $pos);
39 42
 $entity = ((!empty($_SESSION['dol_entity']) && $_SESSION['dol_entity'] > 1) ? $_SESSION['dol_entity'] : null);
40 43
 
@@ -81,14 +84,18 @@  discard block
 block discarded – undo
81 84
 // Set to 0 to disable this feature.
82 85
 // Note: not needed on Windows-based servers.
83 86
 $newmask = '0644';
84
-if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
87
+if (! empty($conf->global->MAIN_UMASK)) {
88
+    $newmask=$conf->global->MAIN_UMASK;
89
+}
85 90
 $Config['ChmodOnUpload'] = $newmask;
86 91
 
87 92
 // See comments above.
88 93
 // Used when creating folders that does not exist.
89 94
 $newmask = '0755';
90 95
 $dirmaskdec=octdec($newmask);
91
-if (! empty($conf->global->MAIN_UMASK)) $dirmaskdec=octdec($conf->global->MAIN_UMASK);
96
+if (! empty($conf->global->MAIN_UMASK)) {
97
+    $dirmaskdec=octdec($conf->global->MAIN_UMASK);
98
+}
92 99
 $dirmaskdec |= octdec('0200');  // Set w bit required to be able to create content for recursive subdirs files
93 100
 $newmask = decoct($dirmaskdec);
94 101
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/filemanagerdol/connectors/php/util.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -87,8 +87,7 @@  discard block
 block discarded – undo
87 87
 	if ( defined('PHP_OS') )
88 88
 	{
89 89
 		$os = PHP_OS ;
90
-	}
91
-	else
90
+	} else
92 91
 	{
93 92
 		$os = php_uname();
94 93
 	}
@@ -96,8 +95,7 @@  discard block
 block discarded – undo
96 95
 	if (strtoupper(substr($os, 0, 3)) === 'WIN' || FindBadUtf8($value))
97 96
 	{
98 97
 		return (utf8_encode(htmlspecialchars($value)));
99
-	}
100
-	else
98
+	} else
101 99
 	{
102 100
 		return (htmlspecialchars($value));
103 101
 	}
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/import.lib.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,9 @@
 block discarded – undo
36 36
 {
37 37
 	global $langs;
38 38
 
39
-	if (empty($maxstep)) $maxstep=6;
39
+	if (empty($maxstep)) {
40
+	    $maxstep=6;
41
+	}
40 42
 
41 43
 	$h=0;
42 44
 	$head = array();
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/agenda.lib.php 1 patch
Braces   +80 added lines, -32 removed lines patch added patch discarded remove patch
@@ -68,8 +68,11 @@  discard block
 block discarded – undo
68 68
 
69 69
 	print '<div class="fichecenter">';
70 70
 
71
-	if ($conf->browser->layout == 'phone') print '<div class="fichehalfleft">';
72
-	else print '<table class="nobordernopadding" width="100%"><tr><td class="borderright">';
71
+	if ($conf->browser->layout == 'phone') {
72
+	    print '<div class="fichehalfleft">';
73
+	} else {
74
+	    print '<table class="nobordernopadding" width="100%"><tr><td class="borderright">';
75
+	}
73 76
 
74 77
 	print '<table class="nobordernopadding centpercent">';
75 78
 
@@ -80,7 +83,9 @@  discard block
 block discarded – undo
80 83
 		print $langs->trans("ActionsToDoBy").' &nbsp; ';
81 84
 		print '</td><td style="padding-bottom: 2px; padding-right: 4px;">';
82 85
 		print $form->select_dolusers($filtert, 'search_filtert', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
83
-		if (empty($conf->dol_optimize_smallscreen)) print ' &nbsp; '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").' &nbsp; ';
86
+		if (empty($conf->dol_optimize_smallscreen)) {
87
+		    print ' &nbsp; '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").' &nbsp; ';
88
+		}
84 89
 		print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit);
85 90
 		print '</td></tr>';
86 91
 
@@ -104,10 +109,12 @@  discard block
 block discarded – undo
104 109
 		print $langs->trans("Type");
105 110
 		print ' &nbsp;</td><td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
106 111
 		$multiselect=0;
107
-		if (! empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE))     // We use an option here because it adds bugs when used on agenda page "peruser" and "list"
112
+		if (! empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) {
113
+		    // We use an option here because it adds bugs when used on agenda page "peruser" and "list"
108 114
 		{
109 115
             $multiselect=(!empty($conf->global->AGENDA_USE_EVENT_TYPE));
110 116
 		}
117
+		}
111 118
         print $formactions->select_type_actions($actioncode, "search_actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1), 0, $multiselect);
112 119
 		print '</td></tr>';
113 120
 	}
@@ -154,10 +161,15 @@  discard block
 block discarded – undo
154 161
 		print "<td class='nowrap'>";
155 162
 		print '<div class="ui-grid-a"><div class="ui-block-a">';
156 163
 		print '<input type="number" class="short" name="begin_h" value="'.$begin_h.'" min="0" max="23">';
157
-		if (empty($conf->dol_use_jmobile)) print ' - ';
158
-		else print '</div><div class="ui-block-b">';
164
+		if (empty($conf->dol_use_jmobile)) {
165
+		    print ' - ';
166
+		} else {
167
+		    print '</div><div class="ui-block-b">';
168
+		}
159 169
 		print '<input type="number" class="short" name="end_h" value="'.$end_h.'" min="1" max="24">';
160
-		if (empty($conf->dol_use_jmobile)) print ' '.$langs->trans("H");
170
+		if (empty($conf->dol_use_jmobile)) {
171
+		    print ' '.$langs->trans("H");
172
+		}
161 173
 		print '</div></div>';
162 174
 		print '</td></tr>';
163 175
 
@@ -167,8 +179,11 @@  discard block
 block discarded – undo
167 179
 		print "<td class='nowrap'>";
168 180
 		print '<div class="ui-grid-a"><div class="ui-block-a">';
169 181
 		print '<input type="number" class="short" name="begin_d" value="'.$begin_d.'" min="1" max="7">';
170
-		if (empty($conf->dol_use_jmobile)) print ' - ';
171
-		else print '</div><div class="ui-block-b">';
182
+		if (empty($conf->dol_use_jmobile)) {
183
+		    print ' - ';
184
+		} else {
185
+		    print '</div><div class="ui-block-b">';
186
+		}
172 187
 		print '<input type="number" class="short" name="end_d" value="'.$end_d.'" min="1" max="7">';
173 188
 		print '</div></div>';
174 189
 		print '</td></tr>';
@@ -180,11 +195,17 @@  discard block
 block discarded – undo
180 195
 
181 196
 	print '</table>';
182 197
 
183
-	if ($conf->browser->layout == 'phone') print '</div>';
184
-	else print '</td>';
198
+	if ($conf->browser->layout == 'phone') {
199
+	    print '</div>';
200
+	} else {
201
+	    print '</td>';
202
+	}
185 203
 
186
-	if ($conf->browser->layout == 'phone') print '<div class="fichehalfright">';
187
-	else print '<td align="center" valign="middle" class="nowrap">';
204
+	if ($conf->browser->layout == 'phone') {
205
+	    print '<div class="fichehalfright">';
206
+	} else {
207
+	    print '<td align="center" valign="middle" class="nowrap">';
208
+	}
188 209
 
189 210
 	print '<table class="centpercent"><tr><td align="center">';
190 211
 	print '<div class="formleftzone">';
@@ -193,8 +214,11 @@  discard block
 block discarded – undo
193 214
 	print '</td></tr>';
194 215
 	print '</table>';
195 216
 
196
-	if ($conf->browser->layout == 'phone') print '</div>';
197
-	else print '</td></tr></table>';
217
+	if ($conf->browser->layout == 'phone') {
218
+	    print '</div>';
219
+	} else {
220
+	    print '</td></tr></table>';
221
+	}
198 222
 
199 223
 	print '</div>';	// Close fichecenter
200 224
 	print '<div style="clear:both"></div>';
@@ -224,11 +248,17 @@  discard block
 block discarded – undo
224 248
 	$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN ";
225 249
 	$sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action";
226 250
     $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
227
-	if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
251
+	if (!$user->rights->societe->client->voir && !$socid) {
252
+	    $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
253
+	}
228 254
 	$sql.= " WHERE a.entity = ".$conf->entity;
229 255
     $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))";
230
-	if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
231
-	if ($socid) $sql.= " AND s.rowid = ".$socid;
256
+	if (!$user->rights->societe->client->voir && !$socid) {
257
+	    $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
258
+	}
259
+	if ($socid) {
260
+	    $sql.= " AND s.rowid = ".$socid;
261
+	}
232 262
 	$sql.= " ORDER BY a.datep DESC, a.id DESC";
233 263
 	$sql.= $db->plimit($max, 0);
234 264
 
@@ -278,11 +308,21 @@  discard block
 block discarded – undo
278 308
             // Date
279 309
 			print '<td width="100" align="right">'.dol_print_date($datep,'day').'&nbsp;';
280 310
 			$late=0;
281
-			if ($obj->percent == 0 && $datep && $datep < time()) $late=1;
282
-			if ($obj->percent == 0 && ! $datep && $datep2 && $datep2 < time()) $late=1;
283
-			if ($obj->percent > 0 && $obj->percent < 100 && $datep2 && $datep2 < time()) $late=1;
284
-			if ($obj->percent > 0 && $obj->percent < 100 && ! $datep2 && $datep && $datep < time()) $late=1;
285
-			if ($late) print img_warning($langs->trans("Late"));
311
+			if ($obj->percent == 0 && $datep && $datep < time()) {
312
+			    $late=1;
313
+			}
314
+			if ($obj->percent == 0 && ! $datep && $datep2 && $datep2 < time()) {
315
+			    $late=1;
316
+			}
317
+			if ($obj->percent > 0 && $obj->percent < 100 && $datep2 && $datep2 < time()) {
318
+			    $late=1;
319
+			}
320
+			if ($obj->percent > 0 && $obj->percent < 100 && ! $datep2 && $datep && $datep < time()) {
321
+			    $late=1;
322
+			}
323
+			if ($late) {
324
+			    print img_warning($langs->trans("Late"));
325
+			}
286 326
 			print "</td>";
287 327
 
288 328
 			// Statut
@@ -295,8 +335,7 @@  discard block
 block discarded – undo
295 335
 	    print "</table><br>";
296 336
 
297 337
 	    $db->free($resql);
298
-	}
299
-	else
338
+	} else
300 339
 	{
301 340
 	    dol_print_error($db);
302 341
 	}
@@ -321,11 +360,17 @@  discard block
 block discarded – undo
321 360
 	$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN ";
322 361
 	$sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action ";
323 362
     $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
324
-	if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
363
+	if (!$user->rights->societe->client->voir && !$socid) {
364
+	    $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
365
+	}
325 366
 	$sql.= " WHERE a.entity = ".$conf->entity;
326 367
     $sql.= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))";
327
-	if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
328
-    if ($socid) $sql.= " AND s.rowid = ".$socid;
368
+	if (!$user->rights->societe->client->voir && !$socid) {
369
+	    $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
370
+	}
371
+    if ($socid) {
372
+        $sql.= " AND s.rowid = ".$socid;
373
+    }
329 374
 	$sql .= " ORDER BY a.datep2 DESC";
330 375
 	$sql .= $db->plimit($max, 0);
331 376
 
@@ -383,8 +428,7 @@  discard block
 block discarded – undo
383 428
 		print "</table><br>";
384 429
 
385 430
 		$db->free($resql);
386
-	}
387
-	else
431
+	} else
388 432
 	{
389 433
 		dol_print_error($db);
390 434
 	}
@@ -471,7 +515,9 @@  discard block
 block discarded – undo
471 515
         $listofresourcelinked = $resource->getElementResources($object->element, $object->id);
472 516
         $nbResources=count($listofresourcelinked);
473 517
 		$head[$h][1] = $langs->trans("Resources");
474
-		if ($nbResources > 0) $head[$h][1].= ' <span class="badge">'.($nbResources).'</span>';
518
+		if ($nbResources > 0) {
519
+		    $head[$h][1].= ' <span class="badge">'.($nbResources).'</span>';
520
+		}
475 521
 		$head[$h][2] = 'resources';
476 522
 		$h++;
477 523
 	}
@@ -484,7 +530,9 @@  discard block
 block discarded – undo
484 530
     $nbLinks=Link::count($db, $object->element, $object->id);
485 531
     $head[$h][0] = DOL_URL_ROOT.'/comm/action/document.php?id='.$object->id;
486 532
     $head[$h][1] = $langs->trans("Documents");
487
-	if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
533
+	if (($nbFiles+$nbLinks) > 0) {
534
+	    $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
535
+	}
488 536
     $head[$h][2] = 'documents';
489 537
     $h++;
490 538
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/invoice.lib.php 1 patch
Braces   +23 added lines, -8 removed lines patch added patch discarded remove patch
@@ -50,7 +50,9 @@  discard block
 block discarded – undo
50 50
 	    $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
51 51
 	    $head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$object->id;
52 52
 		$head[$h][1] = $langs->trans('ContactsAddresses');
53
-		if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
53
+		if ($nbContact > 0) {
54
+		    $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
55
+		}
54 56
 		$head[$h][2] = 'contact';
55 57
 		$h++;
56 58
 	}
@@ -66,12 +68,17 @@  discard block
 block discarded – undo
66 68
         if ($resql)
67 69
         {
68 70
             $obj=$db->fetch_object($resql);
69
-            if ($obj) $nbStandingOrders = $obj->nb;
71
+            if ($obj) {
72
+                $nbStandingOrders = $obj->nb;
73
+            }
74
+        } else {
75
+            dol_print_error($db);
70 76
         }
71
-        else dol_print_error($db);
72 77
 		$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id;
73 78
 		$head[$h][1] = $langs->trans('StandingOrders');
74
-		if ($nbStandingOrders > 0) $head[$h][1].= ' <span class="badge">'.$nbStandingOrders.'</span>';
79
+		if ($nbStandingOrders > 0) {
80
+		    $head[$h][1].= ' <span class="badge">'.$nbStandingOrders.'</span>';
81
+		}
75 82
 		$head[$h][2] = 'standingorders';
76 83
 		$h++;
77 84
 	}
@@ -85,11 +92,17 @@  discard block
 block discarded – undo
85 92
     if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
86 93
     {
87 94
     	$nbNote = 0;
88
-        if(!empty($object->note_private)) $nbNote++;
89
-		if(!empty($object->note_public)) $nbNote++;
95
+        if(!empty($object->note_private)) {
96
+            $nbNote++;
97
+        }
98
+		if(!empty($object->note_public)) {
99
+		    $nbNote++;
100
+		}
90 101
     	$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id;
91 102
     	$head[$h][1] = $langs->trans('Notes');
92
-		if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
103
+		if ($nbNote > 0) {
104
+		    $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
105
+		}
93 106
     	$head[$h][2] = 'note';
94 107
     	$h++;
95 108
     }
@@ -101,7 +114,9 @@  discard block
 block discarded – undo
101 114
     $nbLinks=Link::count($db, $object->element, $object->id);
102 115
 	$head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id;
103 116
 	$head[$h][1] = $langs->trans('Documents');
104
-	if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
117
+	if (($nbFiles+$nbLinks) > 0) {
118
+	    $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
119
+	}
105 120
 	$head[$h][2] = 'documents';
106 121
 	$h++;
107 122
 
Please login to merge, or discard this patch.