Completed
Branch develop (7f1737)
by
unknown
25:20
created
htdocs/modulebuilder/index.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 if (empty($tab)) {
78 78
 	$tab = 'description';
79 79
 }
80
-'@phan-var-force string $tab';  // Workaround 'empty()' bug of phan
80
+'@phan-var-force string $tab'; // Workaround 'empty()' bug of phan
81 81
 if (empty($tabobj)) {
82 82
 	$tabobj = 'newobjectifnoobj';
83 83
 }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 $family = (string) GETPOST('family', 'alpha');
97 97
 $picto = (string) GETPOST('idpicto', 'alpha');
98 98
 $idmodule = (string) GETPOST('idmodule', 'alpha');
99
-$format = '';  // Prevent undefined in css tab
99
+$format = ''; // Prevent undefined in css tab
100 100
 
101 101
 // Security check
102 102
 if (!isModEnabled('modulebuilder')) {
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 		// Copy last 'html.formsetup.class.php' to backport folder
307 307
 		if (getDolGlobalInt('MODULEBUILDER_SUPPORT_COMPATIBILITY_V16')) {
308 308
 			$tryToCopyFromSetupClass = true;
309
-			$backportDest = $destdir .'/backport/v16/core/class';
309
+			$backportDest = $destdir.'/backport/v16/core/class';
310 310
 			$backportFileSrc = DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php';
311 311
 			$backportFileDest = $backportDest.'/html.formsetup.class.php';
312 312
 			$result = dol_mkdir($backportDest);
@@ -414,11 +414,11 @@  discard block
 block discarded – undo
414 414
 			);
415 415
 
416 416
 			if (getDolGlobalString('MODULEBUILDER_SPECIFIC_AUTHOR')) {
417
-				$arrayreplacement['---Replace with your own copyright and developer email---'] = dol_print_date($now, '%Y')."\t\t" . getDolGlobalString('MODULEBUILDER_SPECIFIC_AUTHOR');
417
+				$arrayreplacement['---Replace with your own copyright and developer email---'] = dol_print_date($now, '%Y')."\t\t".getDolGlobalString('MODULEBUILDER_SPECIFIC_AUTHOR');
418 418
 			}
419 419
 
420 420
 			// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
421
-			$result = dolReplaceInFile($phpfileval['fullname'], $arrayreplacement);  // @phpstan-ignore-line
421
+			$result = dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); // @phpstan-ignore-line
422 422
 			//var_dump($result);
423 423
 			if ($result < 0) {
424 424
 				setEventMessages($langs->trans("ErrorFailToMakeReplacementInto", $phpfileval['fullname']), null, 'errors');
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 
444 444
 		clearstatcache(true);
445 445
 		if (function_exists('opcache_invalidate')) {
446
-			opcache_reset();	// remove the include cache hell !
446
+			opcache_reset(); // remove the include cache hell !
447 447
 		}
448 448
 
449 449
 		header("Location: ".$_SERVER["PHP_SELF"].'?module='.$modulename);
@@ -451,9 +451,9 @@  discard block
 block discarded – undo
451 451
 	}
452 452
 }
453 453
 
454
-$destdir = '/not_set/';  // Initialize (for static analysis)
455
-$destfile = '/not_set/';  // Initialize (for static analysis)
456
-$srcfile = '/not_set/';  // Initialize (for static analysis)
454
+$destdir = '/not_set/'; // Initialize (for static analysis)
455
+$destfile = '/not_set/'; // Initialize (for static analysis)
456
+$srcfile = '/not_set/'; // Initialize (for static analysis)
457 457
 
458 458
 // init API, PHPUnit
459 459
 if ($dirins && in_array($action, array('initapi', 'initphpunit', 'initpagecontact', 'initpagedocument', 'initpagenote', 'initpageagenda')) && !empty($module) && $user->hasRight("modulebuilder", "run")) {
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
 			}
924 924
 			$stringLog = implode("\n", $strreplace);
925 925
 			// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
926
-			dolReplaceInFile($destfile, array('//include::ChangeLog.md[]' => '','__CHANGELOG__' => $stringLog));
926
+			dolReplaceInFile($destfile, array('//include::ChangeLog.md[]' => '', '__CHANGELOG__' => $stringLog));
927 927
 		}
928 928
 
929 929
 		// Delete old documentation files
@@ -1370,7 +1370,7 @@  discard block
 block discarded – undo
1370 1370
 		}
1371 1371
 	}
1372 1372
 
1373
-	$filetogenerate = array();  // For static analysis
1373
+	$filetogenerate = array(); // For static analysis
1374 1374
 	if (!$error) {
1375 1375
 		// Copy some files
1376 1376
 		$filetogenerate = array(
@@ -1610,7 +1610,7 @@  discard block
 block discarded – undo
1610 1610
 		} else {
1611 1611
 			$menus = array();
1612 1612
 		}
1613
-		$counter = 0 ;
1613
+		$counter = 0;
1614 1614
 		foreach ($menus as $menu) {
1615 1615
 			if ($menu['leftmenu'] == strtolower($objectname)) {
1616 1616
 				$counter++;
@@ -1652,10 +1652,10 @@  discard block
 block discarded – undo
1652 1652
 			);
1653 1653
 
1654 1654
 			if (getDolGlobalString('MODULEBUILDER_SPECIFIC_AUTHOR')) {
1655
-				$arrayreplacement['---Replace with your own copyright and developer email---'] = dol_print_date($now, '%Y').' ' . getDolGlobalString('MODULEBUILDER_SPECIFIC_AUTHOR');
1655
+				$arrayreplacement['---Replace with your own copyright and developer email---'] = dol_print_date($now, '%Y').' '.getDolGlobalString('MODULEBUILDER_SPECIFIC_AUTHOR');
1656 1656
 			}
1657 1657
 
1658
-			$result = dolReplaceInFile($phpfileval['fullname'], $arrayreplacement);  // @phpstan-ignore-line
1658
+			$result = dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); // @phpstan-ignore-line
1659 1659
 			//var_dump($result);
1660 1660
 			if ($result < 0) {
1661 1661
 				setEventMessages($langs->trans("ErrorFailToMakeReplacementInto", $phpfileval['fullname']), null, 'errors');
@@ -1754,7 +1754,7 @@  discard block
 block discarded – undo
1754 1754
 		} else {
1755 1755
 			createNewDictionnary($module, $moduledescriptorfile, $newdicname, $dictionaries);
1756 1756
 			if (function_exists('opcache_invalidate')) {
1757
-				opcache_reset();	// remove the include cache hell !
1757
+				opcache_reset(); // remove the include cache hell !
1758 1758
 			}
1759 1759
 			clearstatcache(true);
1760 1760
 			header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : ''));
@@ -1853,7 +1853,7 @@  discard block
 block discarded – undo
1853 1853
 				'isameasure' => GETPOSTINT('propisameasure'),
1854 1854
 				'comment' => GETPOST('propcomment', 'alpha'),
1855 1855
 				'help' => GETPOST('prophelp', 'alpha'),
1856
-				'css' => GETPOST('propcss', 'alpha'),        // Can be 'maxwidth500 widthcentpercentminusxx' for example
1856
+				'css' => GETPOST('propcss', 'alpha'), // Can be 'maxwidth500 widthcentpercentminusxx' for example
1857 1857
 				'cssview' => GETPOST('propcssview', 'alpha'),
1858 1858
 				'csslist' => GETPOST('propcsslist', 'alpha'),
1859 1859
 				'default' => GETPOST('propdefault', 'restricthtml'),
@@ -2010,7 +2010,7 @@  discard block
 block discarded – undo
2010 2010
 
2011 2011
 			clearstatcache(true);
2012 2012
 			if (function_exists('opcache_invalidate')) {
2013
-				opcache_reset();	// remove the include cache hell !
2013
+				opcache_reset(); // remove the include cache hell !
2014 2014
 			}
2015 2015
 
2016 2016
 			header("Location: ".$_SERVER["PHP_SELF"].'?module=deletemodule');
@@ -2067,7 +2067,7 @@  discard block
 block discarded – undo
2067 2067
 		$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
2068 2068
 		dol_include_once($pathtofile);
2069 2069
 		$class = 'mod'.$module;
2070
-		$moduleobj =  null;
2070
+		$moduleobj = null;
2071 2071
 		if (class_exists($class)) {
2072 2072
 			try {
2073 2073
 				$moduleobj = new $class($db);
@@ -2110,7 +2110,7 @@  discard block
 block discarded – undo
2110 2110
 
2111 2111
 			clearstatcache(true);
2112 2112
 			if (function_exists('opcache_invalidate')) {
2113
-				opcache_reset();	// remove the include cache hell !
2113
+				opcache_reset(); // remove the include cache hell !
2114 2114
 			}
2115 2115
 			$resultko = 0;
2116 2116
 			foreach ($filetodelete as $tmpfiletodelete) {
@@ -2130,7 +2130,7 @@  discard block
 block discarded – undo
2130 2130
 	}
2131 2131
 
2132 2132
 	$action = '';
2133
-	if (! $error) {
2133
+	if (!$error) {
2134 2134
 		$tabobj = 'newobject';
2135 2135
 	} else {
2136 2136
 		$tabobj = 'deleteobject';
@@ -2241,7 +2241,7 @@  discard block
 block discarded – undo
2241 2241
 			setEventMessages($langs->trans("DictionaryDeleted", ucfirst(substr($newdicname, 2))), null);
2242 2242
 		}
2243 2243
 		if (function_exists('opcache_invalidate')) {
2244
-			opcache_reset();	// remove the include cache hell !
2244
+			opcache_reset(); // remove the include cache hell !
2245 2245
 		}
2246 2246
 		clearstatcache(true);
2247 2247
 		header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : ''));
@@ -2249,7 +2249,7 @@  discard block
 block discarded – undo
2249 2249
 	}
2250 2250
 }
2251 2251
 if ($dirins && $action == 'updatedictionary' && GETPOST('dictionnarykey') && $user->hasRight("modulebuilder", "run")) {
2252
-	$keydict = GETPOSTINT('dictionnarykey') - 1 ;
2252
+	$keydict = GETPOSTINT('dictionnarykey') - 1;
2253 2253
 
2254 2254
 	$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
2255 2255
 	$destdir = $dirins.'/'.strtolower($module);
@@ -2285,7 +2285,7 @@  discard block
 block discarded – undo
2285 2285
 				setEventMessages($langs->trans("DictionaryNameUpdated", ucfirst(GETPOST('tablib'))), null);
2286 2286
 			}
2287 2287
 			if (function_exists('opcache_invalidate')) {
2288
-				opcache_reset();	// remove the include cache hell !
2288
+				opcache_reset(); // remove the include cache hell !
2289 2289
 			}
2290 2290
 			clearstatcache(true);
2291 2291
 			header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : ''));
@@ -2467,7 +2467,7 @@  discard block
 block discarded – undo
2467 2467
 
2468 2468
 		clearstatcache(true);
2469 2469
 		if (function_exists('opcache_invalidate')) {
2470
-			opcache_reset();	// remove the include cache hell !
2470
+			opcache_reset(); // remove the include cache hell !
2471 2471
 		}
2472 2472
 		header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
2473 2473
 		exit;
@@ -2582,12 +2582,12 @@  discard block
 block discarded – undo
2582 2582
 		if ($rewrite < 0) {
2583 2583
 			setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Permissions"), "mod".$module."class.php"), null, 'warnings');
2584 2584
 		} else {
2585
-			$rightUpdated = null;  // I not set at this point
2585
+			$rightUpdated = null; // I not set at this point
2586 2586
 			reWriteAllPermissions($moduledescriptorfile, $permissions, $key, $rightUpdated, '', '', 2);
2587 2587
 			setEventMessages($langs->trans('PermissionUpdatedSuccesfuly'), null);
2588 2588
 			clearstatcache(true);
2589 2589
 			if (function_exists('opcache_invalidate')) {
2590
-				opcache_reset();	// remove the include cache hell !
2590
+				opcache_reset(); // remove the include cache hell !
2591 2591
 			}
2592 2592
 			header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
2593 2593
 			exit;
@@ -2640,7 +2640,7 @@  discard block
 block discarded – undo
2640 2640
 
2641 2641
 			clearstatcache(true);
2642 2642
 			if (function_exists('opcache_invalidate')) {
2643
-				opcache_reset();	// remove the include cache hell !
2643
+				opcache_reset(); // remove the include cache hell !
2644 2644
 			}
2645 2645
 
2646 2646
 			header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
@@ -2806,7 +2806,7 @@  discard block
 block discarded – undo
2806 2806
 
2807 2807
 		clearstatcache(true);
2808 2808
 		if (function_exists('opcache_invalidate')) {
2809
-			opcache_reset();	// remove the include cache hell !
2809
+			opcache_reset(); // remove the include cache hell !
2810 2810
 		}
2811 2811
 
2812 2812
 		setEventMessages($langs->trans('MenuDeletedSuccessfuly'), null);
@@ -2866,7 +2866,7 @@  discard block
 block discarded – undo
2866 2866
 		setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Url")), null, 'errors');
2867 2867
 	}
2868 2868
 	if (!empty(GETPOST('target'))) {
2869
-		$targets = array('_blank','_self','_parent','_top','');
2869
+		$targets = array('_blank', '_self', '_parent', '_top', '');
2870 2870
 		if (!in_array(GETPOST('target'), $targets)) {
2871 2871
 			$error++;
2872 2872
 			setEventMessages($langs->trans("ErrorFieldValue", $langs->transnoentities("target")), null, 'errors');
@@ -2972,7 +2972,7 @@  discard block
 block discarded – undo
2972 2972
 
2973 2973
 // Modify a menu entry
2974 2974
 if ($dirins && $action == "update_menu" && GETPOSTINT('menukey') && GETPOST('tabobj') && $user->hasRight("modulebuilder", "run")) {
2975
-	$objectname =  GETPOST('tabobj');
2975
+	$objectname = GETPOST('tabobj');
2976 2976
 	$dirins = $listofmodules[strtolower($module)]['moduledescriptorrootpath'];
2977 2977
 	$destdir = $dirins.'/'.strtolower($module);
2978 2978
 	$objects = dolGetListOfObjectClasses($destdir);
@@ -3071,7 +3071,7 @@  discard block
 block discarded – undo
3071 3071
 			}
3072 3072
 		}
3073 3073
 	} else {
3074
-		$_POST['type'] = '';	// TODO Use a var here and later
3074
+		$_POST['type'] = ''; // TODO Use a var here and later
3075 3075
 		$_POST['titre'] = '';
3076 3076
 		$_POST['fk_menu'] = '';
3077 3077
 		$_POST['leftmenu'] = '';
@@ -3472,7 +3472,7 @@  discard block
 block discarded – undo
3472 3472
 	print '<input type="text" name="editorurl" value="'.(GETPOSTISSET('editorurl') ? GETPOST('editorurl') : getDolGlobalString('MODULEBUILDER_SPECIFIC_EDITOR_URL', $mysoc->url)).'" placeholder="'.dol_escape_htmltag($langs->trans("EditorUrl")).'"><br>';
3473 3473
 	print '</div></div>';
3474 3474
 
3475
-	print '</div>';	// End div tagtable
3475
+	print '</div>'; // End div tagtable
3476 3476
 
3477 3477
 	print '<br><center>';
3478 3478
 	print '<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans("Create")).'"'.($dirins ? '' : ' disabled="disabled"').'>';
@@ -4180,8 +4180,8 @@  discard block
 block discarded – undo
4180 4180
 				}
4181 4181
 				print '</table><br>'."\n";
4182 4182
 				print '<div class="center">';
4183
-				print '<input type="submit" class="button button-save" name="add" value="' . dol_escape_htmltag($langs->trans('Create')) . '">';
4184
-				print '<input type="button" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag($langs->trans('Cancel')) . '" onclick="goBack()">';
4183
+				print '<input type="submit" class="button button-save" name="add" value="'.dol_escape_htmltag($langs->trans('Create')).'">';
4184
+				print '<input type="button" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans('Cancel')).'" onclick="goBack()">';
4185 4185
 				print '</div>';
4186 4186
 				print '</form>';
4187 4187
 				// javascript
@@ -4287,16 +4287,16 @@  discard block
 block discarded – undo
4287 4287
 						// Define path for sql file
4288 4288
 						$pathtosql = strtolower($module).'/sql/llx_'.strtolower($module).'_'.strtolower($tabobj).'-'.strtolower($module).'.sql';
4289 4289
 						$result = dol_buildpath($pathtosql);
4290
-						if (! dol_is_file($result)) {
4290
+						if (!dol_is_file($result)) {
4291 4291
 							$pathtosql = strtolower($module).'/sql/llx_'.strtolower($module).'_'.strtolower($tabobj).'.sql';
4292 4292
 							$result = dol_buildpath($pathtosql);
4293
-							if (! dol_is_file($result)) {
4293
+							if (!dol_is_file($result)) {
4294 4294
 								$pathtosql = 'install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($tabobj).'-'.strtolower($module).'.sql';
4295 4295
 								$result = dol_buildpath($pathtosql);
4296
-								if (! dol_is_file($result)) {
4296
+								if (!dol_is_file($result)) {
4297 4297
 									$pathtosql = 'install/mysql/tables/llx_'.strtolower($module).'-'.strtolower($module).'.sql';
4298 4298
 									$result = dol_buildpath($pathtosql);
4299
-									if (! dol_is_file($result)) {
4299
+									if (!dol_is_file($result)) {
4300 4300
 										$pathtosql = 'install/mysql/tables/llx_'.strtolower($module).'.sql';
4301 4301
 										$pathtosqlextra = 'install/mysql/tables/llx_'.strtolower($module).'_extrafields.sql';
4302 4302
 										$result = dol_buildpath($pathtosql);
@@ -4315,12 +4315,12 @@  discard block
 block discarded – undo
4315 4315
 						$pathtosqlroot = preg_replace('/\/llx_.*$/', '', $pathtosql);
4316 4316
 
4317 4317
 						$pathtosqlkey   = preg_replace('/\.sql$/', '.key.sql', $pathtosql);
4318
-						$pathtosqlextrakey   = preg_replace('/\.sql$/', '.key.sql', $pathtosqlextra);
4318
+						$pathtosqlextrakey = preg_replace('/\.sql$/', '.key.sql', $pathtosqlextra);
4319 4319
 
4320 4320
 						$pathtolib      = strtolower($module).'/lib/'.strtolower($module).'.lib.php';
4321 4321
 						$pathtoobjlib   = strtolower($module).'/lib/'.strtolower($module).'_'.strtolower($tabobj).'.lib.php';
4322 4322
 
4323
-						$tmpobject = $tmpobject ?? null;  // @phan-suppress-current-line PhanPluginDuplicateExpressionAssignmentOperation
4323
+						$tmpobject = $tmpobject ?? null; // @phan-suppress-current-line PhanPluginDuplicateExpressionAssignmentOperation
4324 4324
 						if (is_object($tmpobject) && property_exists($tmpobject, 'picto')) {
4325 4325
 							$pathtopicto = $tmpobject->picto;
4326 4326
 							$realpathtopicto = '';
@@ -5626,7 +5626,7 @@  discard block
 block discarded – undo
5626 5626
 						}
5627 5627
 					  });
5628 5628
 
5629
-					var groupedRights = ' . $groupedRights_json . ';
5629
+					var groupedRights = ' . $groupedRights_json.';
5630 5630
 					var objectsSelect = $("select[id=\'objects\']");
5631 5631
 					var permsSelect = $("select[id=\'perms\']");
5632 5632
 
@@ -5850,7 +5850,7 @@  discard block
 block discarded – undo
5850 5850
 							if (in_array($perm[5], array('lire', 'read', 'creer', 'write', 'effacer', 'delete'))) {
5851 5851
 								print dol_escape_htmltag(ucfirst($perm[4]));
5852 5852
 							} else {
5853
-								print '';	// No particular object
5853
+								print ''; // No particular object
5854 5854
 							}
5855 5855
 							print '</td>';
5856 5856
 
@@ -6754,9 +6754,9 @@  discard block
 block discarded – undo
6754 6754
 
6755 6755
 						print '<td>';
6756 6756
 						if ($tabName[0] === "+") {
6757
-							print '<span class="badge badge-status4 badge-status">' . dol_escape_htmltag($tabName) . '</span>';
6757
+							print '<span class="badge badge-status4 badge-status">'.dol_escape_htmltag($tabName).'</span>';
6758 6758
 						} else {
6759
-							print '<span class="badge badge-status8 badge-status">' . dol_escape_htmltag($tabName) . '</span>';
6759
+							print '<span class="badge badge-status8 badge-status">'.dol_escape_htmltag($tabName).'</span>';
6760 6760
 						}
6761 6761
 						print '</td>';
6762 6762
 
Please login to merge, or discard this patch.